id stringlengths 9 106 | function_java stringlengths 50 1.9k | d_with_params stringlengths 426 32.8k |
|---|---|---|
PRIMALITY_TEST_SET_1_INTRODUCTION_AND_SCHOOL_METHOD_1 | static boolean f_filled ( int n ) {
if ( n <= 1 ) return false ;
if ( n <= 3 ) return true ;
if ( n % 2 == 0 || n % 3 == 0 ) return false ;
for ( int i = 5 ;
i * i <= n ;
i = i + 6 ) if ( n % i == 0 || n % ( i + 2 ) == 0 ) return false ;
return true ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
bool [] results = [false, false, false, false, false, false, false, false, false, true];
int [] param0 = [15, 90, 38, 65, 91, 16, 48, 74, 14, 47];
int n_success = 0;
for (int i = 0; i < param0.length; i... |
PRIME_NUMBERS | static boolean f_filled ( int n ) {
if ( n <= 1 ) return false ;
for ( int i = 2 ;
i < n ;
i ++ ) if ( n % i == 0 ) return false ;
return true ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
bool [] results = [true, false, false, false, false, false, false, false, true, false];
int [] param0 = [2, 74, 46, 38, 51, 48, 6, 14, 31, 10];
int n_success = 0;
for (int i = 0; i < param0.length; i++)... |
PYTHON_PROGRAM_FIND_PERIMETER_CIRCUMFERENCE_SQUARE_RECTANGLE_1 | static int f_filled ( int l , int w ) {
return ( 2 * ( l + w ) ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [194, 172, 216, 130, 178, 130, 256, 178, 116, 210];
int [] param0 = [58, 37, 56, 22, 77, 34, 74, 37, 21, 75];
int [] param1 = [39, 49, 52, 43, 12, 31, 54, 52, 37, 30];
int n_success = 0;... |
PROGRAM_CENSOR_WORD_ASTERISKS_SENTENCE | static String f_filled ( String text , String word ) {
String [ ] word_list = text . split ( "\\s+" ) ;
String result = "" ;
String stars = "" ;
for ( int i = 0 ;
i < word . length ( ) ;
i ++ ) stars += '*' ;
int index = 0 ;
for ( String i : word_list ) {
if ( i . compareTo ( word ) == 0 ) word_list... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
string [] results = ["iggvaxtmj ", "76711241128 ", "010 ", "hikon ", "3680369217 ", "1111 ", "zii ", "06 ", "111 ", "njnnrvu "];
string [] param0 = ["iggvaxtmj", "76711241128", "010", "hikon", "3680369217", "1111... |
PROGRAM_FIND_SLOPE_LINE | static float f_filled ( float x1 , float y1 , float x2 , float y2 ) {
return ( y2 - y1 ) / ( x2 - x1 ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
float [] results = [-0.6486899453998202, -0.12115078452752318, 0.617204628531244, -0.8320918116165706, -38.51013687881985, -0.6052307962095809, -0.7142746798007333, 0.9387777514963889, -4.2964732392719505, 2.85002783... |
PROGRAM_TO_FIND_REMAINDER_WITHOUT_USING_MODULO_OR_OPERATOR | static int f_filled ( int num , int divisor ) {
return ( num - divisor * ( num / divisor ) ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [26, 0, 1, 22, 3, 61, 45, 29, 30, 9];
int [] param0 = [80, 63, 1, 22, 66, 61, 45, 29, 95, 9];
int [] param1 = [54, 21, 56, 39, 7, 67, 63, 44, 65, 68];
int n_success = 0;
for (int i ... |
RECURSIVE_C_PROGRAM_LINEARLY_SEARCH_ELEMENT_GIVEN_ARRAY | static int f_filled ( int arr [ ] , int l , int r , int x ) {
if ( r < l ) return - 1 ;
if ( arr [ l ] == x ) return l ;
if ( arr [ r ] == x ) return r ;
return f_filled ( arr , l + 1 , r - 1 , x ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [-1, 3, -1, -1, 7, 0, 2, -1, -1, 2];
int [] [] param0 = [[10, 74, 5], [-90, 72, 36, 96, 42, 0, -66, 5], [0, 5], [99, 70, 67, 5], [-98, -98, -26, -26, -24, -18, -16, 80, 5], [1, 1, 1, 1, 0, 1, 5],... |
REMOVE_BRACKETS_ALGEBRAIC_STRING_CONTAINING_OPERATORS | static String f_filled ( String str ) {
int len = str . length ( ) ;
char res [ ] = new char [ len ] ;
int index = 0 , i = 0 ;
Stack < Integer > s = new Stack < Integer > ( ) ;
s . push ( 0 ) ;
while ( i < len ) {
if ( str . charAt ( i ) == '+' ) {
if ( s . peek ( ) == 1 ) res [ index ++ ] = '-' ;... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
string [] results = ["ggbsmvmzcmovd", "384292670", "10000100", "fdhme", "09198832", "0011111011", "snxwrs", "071", "01101", "xwmqxgba"];
string [] param0 = ["ggbsmvmzcmovd", "384292670", "10000100", "fdhme", "091... |
REMOVE_MINIMUM_ELEMENTS_EITHER_SIDE_2MIN_MAX | static int f_filled ( int arr [ ] , int n ) {
int longest_start = - 1 , longest_end = 0 ;
for ( int start = 0 ;
start < n ;
start ++ ) {
int min = Integer . MAX_VALUE , max = Integer . MIN_VALUE ;
for ( int end = start ;
end < n ;
end ++ ) {
int val = arr [ end ] ;
if ( val < min ) {... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [1, 9, 9, 0, 28, 10, 2, 23, 2, 0];
int [] [] param0 = [[32, 50, 66, 73, 76, 87], [68, 74, 16, 40, 6, -44, -36, 94, 6, -24, -4, -58, -16, 24], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1... |
REMOVE_MINIMUM_NUMBER_ELEMENTS_NO_COMMON_ELEMENT_EXIST_ARRAY | static int f_filled ( 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 . ... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [3, 1, 9, 0, 1, 2, 1, 0, 24, 1];
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, ... |
REPLACE_CHARACTER_C1_C2_C2_C1_STRING_S | static String f_filled ( String s , char c1 , char c2 ) {
int l = s . length ( ) ;
char [ ] arr = s . toCharArray ( ) ;
for ( int i = 0 ;
i < l ;
i ++ ) {
if ( arr [ i ] == c1 ) arr [ i ] = c2 ;
else if ( arr [ i ] == c2 ) arr [ i ] = c1 ;
}
return String . valueOf ( arr ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
string [] results = ["iztsmw j", "7288334", "010110000", "b gjx", "734", "1", "xcaukdha", "4370992544981", "10101", "znifgshawa"];
string [] param0 = ["iztsmw j", "7288334", "010110000", "b gjx", "734", "1", "xca... |
ROUND_THE_GIVEN_NUMBER_TO_NEAREST_MULTIPLE_OF_10 | static int f_filled ( int n ) {
int a = ( n / 10 ) * 10 ;
int b = a + 10 ;
return ( n - a > b - n ) ? b : a ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [30, 80, 20, 40, 80, 90, 90, 20, 90, 0];
int [] param0 = [31, 78, 19, 36, 77, 94, 86, 16, 95, 2];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i] == f... |
ROW_WISE_COMMON_ELEMENTS_TWO_DIAGONALS_SQUARE_MATRIX | static int f_filled ( int mat [ ] [ ] , int n ) {
int res = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) if ( mat [ i ] [ i ] == mat [ i ] [ n - i - 1 ] ) res ++ ;
return res ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [0, 0, 6, 1, 0, 22, 0, 0, 3, 0];
int [] [] [] param0 = [[[62]], [[-56, -6, -12, 64, 36, 12, -40, -38, 14, 68, 62, -46, -30], [56, 30, -18, -92, -10, 76, 6, 64, 14, -94, 34, 6, 12], [-80, 90, -40,... |
SCHEDULE_JOBS_SERVER_GETS_EQUAL_LOAD | static int f_filled ( int a [ ] , int b [ ] , int n ) {
int i ;
int s = 0 ;
for ( i = 0 ;
i < n ;
i ++ ) s += ( a [ i ] + b [ i ] ) ;
if ( n == 1 ) return a [ 0 ] + b [ 0 ] ;
if ( s % n != 0 ) return - 1 ;
int x = s / n ;
for ( i = 0 ;
i < n ;
i ++ ) {
if ( a [ i ] > x ) return - 1 ;
if ( ... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [-1, -1, -1, -1, -1, -1, 81, -1, -1, -1];
int [] [] param0 = [[4, 9, 16, 18, 20, 23, 24, 25, 25, 26, 29, 30, 35, 40, 41, 43, 44, 46, 53, 53, 56, 56, 58, 60, 62, 70, 80, 80, 80, 82, 86, 90, 92, 92... |
SEARCHING_ARRAY_ADJACENT_DIFFER_K | static int f_filled ( int arr [ ] , int n , int x , int k ) {
int i = 0 ;
while ( i < n ) {
if ( arr [ i ] == x ) return i ;
i = i + Math . max ( 1 , Math . abs ( arr [ i ] - x ) / k ) ;
}
return - 1 ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [6, -1, -1, -1, -1, -1, -1, -1, -1, 0];
int [] [] param0 = [[1, 5, 9, 11, 14, 18, 19, 21, 26, 32, 38, 38, 43, 47, 49, 52, 55, 61, 65, 67, 69, 73, 74, 79, 84, 90, 91, 91, 92, 93, 94, 99], [12, -86... |
SEARCH_ALMOST_SORTED_ARRAY | static int f_filled ( int arr [ ] , int l , int r , int x ) {
if ( r >= l ) {
int mid = l + ( r - l ) / 2 ;
if ( arr [ mid ] == x ) return mid ;
if ( mid > l && arr [ mid - 1 ] == x ) return ( mid - 1 ) ;
if ( mid < r && arr [ mid + 1 ] == x ) return ( mid + 1 ) ;
if ( arr [ mid ] > x ) return f_f... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [12, 11, 1, -1, 2, -1, -1, -1, -1, -1];
int [] [] param0 = [[6, 7, 15, 42, 47, 54, 56, 59, 59, 64, 68, 70, 71, 75, 91, 93], [6, 7, 15, 42, 47, 56, 54, 59, 59, 64, 68, 71, 70, 75, 91, 93], [-92, -... |
SEARCH_AN_ELEMENT_IN_AN_ARRAY_WHERE_DIFFERENCE_BETWEEN_ADJACENT_ELEMENTS_IS_1 | static int f_filled ( int arr [ ] , int n , int x ) {
int i = 0 ;
while ( i < n ) {
if ( arr [ i ] == x ) return i ;
i = i + Math . abs ( arr [ i ] - x ) ;
}
return - 1 ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [7, -1, 4, -1, -1, -1, -1, -1, -1, -1];
int [] [] param0 = [[8, 7, 6, 7, 6, 5, 4, 3, 2, 3, 4, 3], [6, 90], [1, 2, 3, 4, 5, 4], [97, 35, 60, 96, 3, 67, 72, 95, 55, 9, 69, 28, 15, 91, 31, 59], [-84... |
SEARCH_AN_ELEMENT_IN_A_SORTED_AND_PIVOTED_ARRAY | static int f_filled ( int arr [ ] , int l , int h , int key ) {
if ( l > h ) return - 1 ;
int mid = ( l + h ) / 2 ;
if ( arr [ mid ] == key ) return mid ;
if ( arr [ l ] <= arr [ mid ] ) {
if ( key >= arr [ l ] && key <= arr [ mid ] ) return f_filled ( arr , l , mid - 1 , key ) ;
return f_filled ( arr ,... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [8, 1, 3, -1, -1, -1, -1, -1, -1, -1];
int [] [] param0 = [[5, 6, 7, 8, 9, 10, 1, 2, 3], [30, 40, 50, 10, 20], [40, 50, 55, 67, 70, 4, 5, 6, 7], [14, 41, 38, 67, 99, 11, 96, 52, 4, 29, 22, 57, 3,... |
SEARCH_INSERT_AND_DELETE_IN_AN_UNSORTED_ARRAY | static int f_filled ( int arr [ ] , int n , int key ) {
for ( int i = 0 ;
i < n ;
i ++ ) if ( arr [ i ] == key ) return i ;
return - 1 ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [2, 1, 0, 8, -1, -1, -1, -1, -1, -1];
int [] [] param0 = [[4, 8, 11, 23, 55, 57, 73, 74, 77, 79, 93], [-88, 12, -62, -66, -24, 18, 12, 22, 94, 30, -50, -42, -94, 18, 76, -6, -48, -68, 48, 36, -78... |
SEARCH_INSERT_AND_DELETE_IN_A_SORTED_ARRAY | static int f_filled ( int arr [ ] , int low , int high , int key ) {
if ( high < low ) return - 1 ;
int mid = ( low + high ) / 2 ;
if ( key == arr [ mid ] ) return mid ;
if ( key > arr [ mid ] ) return f_filled ( arr , ( mid + 1 ) , high , key ) ;
return f_filled ( arr , low , ( mid - 1 ) , key ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1];
int [] [] param0 = [[2, 10, 73, 91, 98], [30, 24, 24, -8, 64, 50, 46, -76, 26, 8, -92, -78, 40, -86, 96, 14, 60, 38, 6, -72, -6, -20, 26, -26, 0, 2], [0,... |
SEARCH_INSERT_AND_DELETE_IN_A_SORTED_ARRAY_1 | static int f_filled ( int arr [ ] , int n , int key , int capacity ) {
if ( n >= capacity ) return n ;
int i ;
for ( i = n - 1 ;
( i >= 0 && arr [ i ] > key ) ;
i -- ) arr [ i + 1 ] = arr [ i ] ;
arr [ i + 1 ] = key ;
return ( n + 1 ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [0, 7, 13, 21, 30, 12, 13, 38, 3, 24];
int [] [] param0 = [[69], [-34, -38, -72, 90, -84, -40, 6, -52, -12, 80, -4, -58], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1], [9... |
SEQUENCES_GIVEN_LENGTH_EVERY_ELEMENT_EQUAL_TWICE_PREVIOUS | static int f_filled ( int m , int n ) {
if ( m < n ) return 0 ;
if ( n == 0 ) return 1 ;
return f_filled ( m - 1 , n ) + f_filled ( m / 2 , n - 1 ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [0, 0, 0, 0, 484, 0, 0, 0, 0, 0];
int [] param0 = [38, 39, 24, 90, 44, 49, 58, 97, 99, 19];
int [] param1 = [34, 29, 99, 23, 2, 70, 84, 34, 72, 67];
int n_success = 0;
for (int i = ... |
SEQUENCES_GIVEN_LENGTH_EVERY_ELEMENT_EQUAL_TWICE_PREVIOUS_1 | static int f_filled ( 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... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [4, 6, 0, 330, 0, 0, 0, 0, 0, 0];
int [] param0 = [10, 5, 2, 83, 91, 18, 83, 98, 43, 31];
int [] param1 = [4, 2, 8, 7, 0, 53, 41, 53, 37, 20];
int n_success = 0;
for (int i = 0; i <... |
SMALLEST_DIFFERENCE_PAIR_VALUES_TWO_UNSORTED_ARRAYS | static int f_filled ( int A [ ] , int B [ ] , int m , int n ) {
Arrays . sort ( A ) ;
Arrays . sort ( B ) ;
int a = 0 , b = 0 ;
int result = Integer . MAX_VALUE ;
while ( a < m && b < n ) {
if ( Math . abs ( A [ a ] - B [ b ] ) < result ) result = Math . abs ( A [ a ] - B [ b ] ) ;
if ( A [ a ] < B [ ... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
int [] [] param0 = [[2, 2, 11, 13, 18, 18, 23, 25, 28, 28, 37, 39, 53, 56, 67, 70, 74, 74, 75, 79, 80, 82, 84, 89, 94, 95, 95, 98, 98], [-94, -78, -78, -72, -72, -... |
SMALLEST_OF_THREE_INTEGERS_WITHOUT_COMPARISON_OPERATORS | static int f_filled ( int x , int y , int z ) {
int c = 0 ;
while ( x != 0 && y != 0 && z != 0 ) {
x -- ;
y -- ;
z -- ;
c ++ ;
}
return c ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [23, 55, 29, 9, 22, 42, 26, 51, 1, 44];
int [] param0 = [23, 87, 35, 25, 93, 52, 95, 91, 75, 96];
int [] param1 = [98, 55, 90, 9, 22, 42, 88, 64, 1, 44];
int [] param2 = [25, 94, 29, 41, ... |
SMALLEST_OF_THREE_INTEGERS_WITHOUT_COMPARISON_OPERATORS_1 | static int f_filled ( int x , int y , int z )
{
int c = 0;
while (x != 0 && y != 0 && z != 0) {
x--;
y--;
z--;
c++;
}
return c;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [48, 11, 50, 21, 39, 22, 3, 62, 2, 1];
int [] param0 = [48, 11, 50, 21, 94, 22, 3, 67, 59, 50];
int [] param1 = [63, 55, 89, 71, 39, 44, 41, 62, 2, 11];
int [] param2 = [56, 84, 96, 74, 4... |
SMALLEST_POWER_OF_2_GREATER_THAN_OR_EQUAL_TO_N | static int f_filled ( int n ) {
int count = 0 ;
if ( n > 0 && ( n & ( n - 1 ) ) == 0 ) return n ;
while ( n != 0 ) {
n >>= 1 ;
count += 1 ;
}
return 1 << count ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [16, 32, 1, 32, 128, 128, 64, 64, 128, 64];
int [] param0 = [13, 27, 1, 24, 98, 94, 36, 41, 74, 39];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i] =... |
SMALLEST_POWER_OF_2_GREATER_THAN_OR_EQUAL_TO_N_1 | static int f_filled ( int n ) {
int p = 1 ;
if ( n > 0 && ( n & ( n - 1 ) ) == 0 ) return n ;
while ( p < n ) p <<= 1 ;
return p ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [32, 128, 128, 128, 64, 64, 32, 32, 64, 32];
int [] param0 = [31, 89, 92, 66, 38, 34, 17, 24, 54, 20];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i]... |
SMALLEST_POWER_OF_2_GREATER_THAN_OR_EQUAL_TO_N_2 | static int f_filled ( int n ) {
n -- ;
n |= n >> 1 ;
n |= n >> 2 ;
n |= n >> 4 ;
n |= n >> 8 ;
n |= n >> 16 ;
n ++ ;
return n ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [64, 32, 64, 64, 128, 128, 32, 64, 64, 32];
int [] param0 = [60, 20, 33, 34, 68, 79, 20, 41, 36, 17];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i] ... |
SMALLEST_SUM_CONTIGUOUS_SUBARRAY | static int f_filled ( int arr [ ] , int n ) {
int min_ending_here = 2147483647 ;
int min_so_far = 2147483647 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
if ( min_ending_here > 0 ) min_ending_here = arr [ i ] ;
else min_ending_here += arr [ i ] ;
min_so_far = Math . min ( min_so_far , min_ending_here ) ;
... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [2, -58, 0, 1, -316, 0, 3, -402, 0, 1];
int [] [] param0 = [[2, 9, 13, 14, 15, 18, 19, 19, 25, 26, 29, 29, 29, 30, 31, 36, 37, 37, 38, 39, 39, 40, 40, 42, 42, 46, 50, 53, 58, 60, 62, 64, 65, 67, ... |
SPACE_OPTIMIZED_SOLUTION_LCS | static int f_filled ( String X , String Y ) {
int m = X . length ( ) , n = Y . length ( ) ;
int L [ ] [ ] = new int [ 2 ] [ n + 1 ] ;
int bi = 0 ;
for ( int i = 0 ;
i < m ;
i ++ ) {
bi = i & 1 ;
for ( int j = 0 ;
j <= n ;
j ++ ) {
if ( i == 0 || j == 0 ) L [ bi ] [ j ] = 0 ;
else... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [0, 2, 1, 0, 3, 8, 0, 2, 2, 2];
string [] param0 = ["ynpjsv", "736519", "11010000100010", "v ", "8311172", "100011101011", "u", "3943042", "101", "mpbff osizevam"];
string [] param1 = ["qtukj... |
SPLIT_N_MAXIMUM_COMPOSITE_NUMBERS | static int f_filled ( int n ) {
if ( n < 4 ) return - 1 ;
int rem = n % 4 ;
if ( rem == 0 ) return n / 4 ;
if ( rem == 1 ) {
if ( n < 9 ) return - 1 ;
return ( n - 9 ) / 4 + 1 ;
}
if ( rem == 2 ) return ( n - 6 ) / 4 + 1 ;
if ( rem == 3 ) {
if ( n < 15 ) return - 1 ;
return ( n - 15 ) / 4 ... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [12, 7, 6, 17, -1, -1, 12, 7, 15, 13];
int [] param0 = [55, 35, 24, 75, 5, 7, 50, 28, 67, 59];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i] == f_fi... |
SQUARED_TRIANGULAR_NUMBER_SUM_CUBES | static int f_filled ( int s ) {
int sum = 0 ;
for ( int n = 1 ;
sum < s ;
n ++ ) {
sum += n * n * n ;
if ( sum == s ) return n ;
}
return - 1 ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [-1, 3, -1, -1, -1, -1, -1, -1, -1, -1];
int [] param0 = [15, 36, 39, 43, 75, 49, 56, 14, 62, 97];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i] == ... |
SQUARE_PYRAMIDAL_NUMBER_SUM_SQUARES | static int f_filled ( int s ) {
int sum = 0 ;
for ( int n = 1 ;
sum < s ;
n ++ ) {
sum += n * n ;
if ( sum == s ) return n ;
}
return - 1 ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [1, 2, 3, 7, 8, -1, 11, -1, -1, -1];
int [] param0 = [1, 5, 14, 140, 204, 3, 506, 42, 4, 87];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i] == f_fil... |
SQUARE_ROOT_OF_AN_INTEGER | static int f_filled ( int x ) {
if ( x == 0 || x == 1 ) return x ;
int i = 1 , result = 1 ;
while ( result <= x ) {
i ++ ;
result = i * i ;
}
return i - 1 ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [9, 3, 3, 9, 8, 7, 7, 4, 9, 8];
int [] param0 = [89, 11, 14, 92, 76, 63, 51, 16, 83, 66];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i] == f_filled(... |
SQUARE_ROOT_OF_AN_INTEGER_1 | static int f_filled ( int x ) {
if ( x == 0 || x == 1 ) return x ;
int start = 1 , end = x , ans = 0 ;
while ( start <= end ) {
int mid = ( start + end ) / 2 ;
if ( mid * mid == x ) return mid ;
if ( mid * mid < x ) {
start = mid + 1 ;
ans = mid ;
}
else end = mid - 1 ;
}
retur... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [6, 3, 6, 7, 1, 8, 8, 3, 8, 3];
int [] param0 = [40, 10, 46, 54, 1, 67, 64, 10, 75, 11];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i] == f_filled(p... |
SQUARE_ROOT_OF_A_PERFECT_SQUARE | static float f_filled ( float n ) {
float x = n ;
float y = 1 ;
double e = 0.000001 ;
while ( x - y > e ) {
x = ( x + y ) / 2 ;
y = n / x ;
}
return x ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
float [] results = [41.99589376968351, -3544.737136289062, 88.84373605423394, -3008.0331952533734, 78.45502015008492, -5799.751467314729, 90.74222584648552, -1829.5367705266551, 76.01465104349802, -7785.473710863676]... |
STACK_PERMUTATIONS_CHECK_IF_AN_ARRAY_IS_STACK_PERMUTATION_OF_OTHER | static boolean f_filled ( int ip [ ] , int op [ ] , int n ) {
Queue < Integer > input = new LinkedList < > ( ) ;
for ( int i = 0 ;
i < n ;
i ++ ) {
input . add ( ip [ i ] ) ;
}
Queue < Integer > output = new LinkedList < > ( ) ;
for ( int i = 0 ;
i < n ;
i ++ ) {
output . add ( op [ i ] ) ;
... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
bool [] results = [false, false, false, false, false, false, false, true, false, false];
int [] [] param0 = [[2, 3, 3, 3, 4, 5, 6, 9, 18, 20, 35, 39, 39, 45, 50, 55, 57, 61, 63, 65, 72, 73, 77, 77, 78, 87, 88, 91... |
STEINS_ALGORITHM_FOR_FINDING_GCD | static int f_filled ( int a , int b ) {
if ( a == 0 ) return b ;
if ( b == 0 ) return a ;
int k ;
for ( k = 0 ;
( ( a | b ) & 1 ) == 0 ;
++ k ) {
a >>= 1 ;
b >>= 1 ;
}
while ( ( a & 1 ) == 0 ) a >>= 1 ;
do {
while ( ( b & 1 ) == 0 ) b >>= 1 ;
if ( a > b ) {
int temp = a ;
a... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [1, 1, 1, 1, 1, 3, 1, 1, 1, 2];
int [] param0 = [37, 58, 89, 75, 59, 84, 47, 37, 83, 28];
int [] param1 = [93, 13, 27, 14, 47, 39, 76, 75, 62, 58];
int n_success = 0;
for (int i = 0... |
STEINS_ALGORITHM_FOR_FINDING_GCD_1 | static int f_filled ( 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_filled ( a >> 1 , b ) ;
else return f_filled ( a >> 1 , b >> 1 ) << 1 ;
}
if ( ( ~ b & 1 ) == 1 ) return f_filled ( a , b >> 1 )... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [1, 2, 6, 1, 1, 1, 5, 2, 3, 1];
int [] param0 = [52, 36, 12, 69, 45, 7, 45, 62, 96, 89];
int [] param1 = [29, 94, 6, 7, 11, 51, 55, 86, 63, 12];
int n_success = 0;
for (int i = 0; i... |
STOOGE_SORT | static int f_filled ( int arr [ ] , int l , int h ) {
if ( l >= h ) return arr[0];
if ( arr [ l ] > arr [ h ] ) {
int t = arr [ l ] ;
arr [ l ] = arr [ h ] ;
arr [ h ] = t ;
}
if ( h - l + 1 > 2 ) {
int t = ( h - l + 1 ) / 3 ;
f_filled ( arr , l , h - t ) ;
f_filled ( arr , l + t , h ) ;... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [6, -13, 0, 7, 88, 1, 2, -31, 0, 77];
int [] [] param0 = [[6, 25, 42, 52, 53, 54, 58, 66, 67, 70], [-13, -98, 50, -63, 48, 3, -76, 12, -35, 93, 29, 17, 16, 5, -97, -54, -45, -25], [0, 0, 0, 0, 0,... |
STRING_CONTAINING_FIRST_LETTER_EVERY_WORD_GIVEN_STRING_SPACES | static String f_filled ( String str ) {
String result = "" ;
boolean v = true ;
for ( int i = 0 ;
i < str . length ( ) ;
i ++ ) {
if ( str . charAt ( i ) == ' ' ) {
v = true ;
}
else if ( str . charAt ( i ) != ' ' && v == true ) {
result += ( str . charAt ( i ) ) ;
v = false ;
... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
string [] results = ["ta", "77267", "011", "kcoi", "2", "01", "ysw", "586", "0100", "q"];
string [] param0 = ["t a", "77 78 2 600 7", "011 10 10", "kv co o ir", "2", "0 11", "y st wghec", "58 824 6", "00 100 001 ... |
STRING_K_DISTINCT_CHARACTERS_NO_CHARACTERS_ADJACENT | static String f_filled ( 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 ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
string [] results = ["abcdefg", "aaaaa", "abcdef", "abcdef", "abcde", "abcdefghi", "ababab", "abababab", "abcdab", "abc"];
int [] param0 = [6, 5, 1, 4, 5, 3, 6, 8, 6, 2];
int [] param1 = [7, 1, 6, 6, 5, 9, 2,... |
SUBARRAYS_DISTINCT_ELEMENTS | static int f_filled ( int [ ] arr , int n ) {
Set < Integer > s = new HashSet < > ( ) ;
int j = 0 , ans = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
while ( j < n && ! s . contains ( arr [ j ] ) ) {
s . add ( arr [ j ] ) ;
j ++ ;
}
ans += ( ( j - i ) * ( j - i + 1 ) ) / 2 ;
s . remove ... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [255, 335, 30, 13, 35, 4, 152, 1791, 29, 35];
int [] [] param0 = [[3, 4, 5, 6, 12, 15, 16, 17, 20, 20, 22, 24, 24, 27, 28, 34, 37, 39, 39, 41, 43, 49, 49, 51, 55, 62, 63, 67, 71, 74, 74, 74, 77, ... |
SUBSEQUENCES_SIZE_THREE_ARRAY_WHOSE_SUM_DIVISIBLE_M | static int f_filled ( int A [ ] , int N , int M ) {
int sum = 0 ;
int ans = 0 ;
for ( int i = 0 ;
i < N ;
i ++ ) {
for ( int j = i + 1 ;
j < N ;
j ++ ) {
for ( int k = j + 1 ;
k < N ;
k ++ ) {
sum = A [ i ] + A [ j ] + A [ k ] ;
if ( sum % M == 0 ) ans ++ ;
... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [0, 0, 1, 19, 207, 120, 85, 2, 220, 92];
int [] [] param0 = [[14, 35, 56, 70, 88], [-50, -92, 16, -68, -36], [0, 0, 0, 1, 1, 1], [76, 43, 22, 41, 49, 99, 25, 40, 3, 45, 60, 16, 83, 62, 26, 93, 64... |
SUM_BINOMIAL_COEFFICIENTS | static int f_filled ( int n ) {
int C [ ] [ ] = new int [ n + 1 ] [ n + 1 ] ;
for ( int i = 0 ;
i <= n ;
i ++ ) {
for ( int j = 0 ;
j <= Math . min ( i , n ) ;
j ++ ) {
if ( j == 0 || j == i ) C [ i ] [ j ] = 1 ;
else C [ i ] [ j ] = C [ i - 1 ] [ j - 1 ] + C [ i - 1 ] [ j ] ;
}
}
... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [256, 512, 32, 16, 4, 64, 128, 4096, 1024, 8];
int [] param0 = [8, 9, 5, 4, 2, 6, 7, 12, 10, 3];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i] == f_... |
SUM_BINOMIAL_COEFFICIENTS_1 | static int f_filled ( int n ) {
return ( 1 << n ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [256, 4, 32, 128, 8, 2, 64, 512, 32768, 4096];
int [] param0 = [8, 2, 5, 7, 3, 1, 6, 9, 15, 12];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i] == f_... |
SUM_DIVISORS_1_N_1 | static int f_filled ( int n ) {
int sum = 0 ;
for ( int i = 1 ;
i <= n ;
++ i ) sum += ( n / i ) * i ;
return sum ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [4406, 1384, 1098, 660, 1987, 491, 5977, 2846, 5561, 1342];
int [] param0 = [73, 41, 36, 28, 49, 24, 85, 59, 82, 40];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
... |
SUM_FACTORS_NUMBER | static int f_filled ( int n ) {
int result = 0 ;
for ( int i = 2 ;
i <= Math . sqrt ( n ) ;
i ++ ) {
if ( n % i == 0 ) {
if ( i == ( n / i ) ) result += i ;
else result += ( i + n / i ) ;
}
}
return ( result + n + 1 ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [140, 32, 7, 57, 48, 72, 44, 56, 91, 6];
int [] param0 = [76, 21, 4, 49, 35, 55, 43, 39, 36, 5];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i] == f_... |
SUM_FAI_AJ_PAIRS_ARRAY_N_INTEGERS | static int f_filled ( int a [ ] , int n ) {
Map < Integer , Integer > cnt = new HashMap < Integer , Integer > ( ) ;
int ans = 0 , pre_sum = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
ans += ( i * a [ i ] ) - pre_sum ;
pre_sum += a [ i ] ;
if ( cnt . containsKey ( a [ i ] - 1 ) ) ans -= cnt . get ( a [... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [3278, -112, 0, 2551, 16640, 0, 12408, -6856, 0, 542];
int [] [] param0 = [[2, 8, 12, 19, 23, 23, 26, 39, 54, 56, 57, 57, 73, 78, 83, 83, 89, 91], [62, -34, 10, -28, -42, -12, 4, 20, -20, -84, -7... |
SUM_FIBONACCI_NUMBERS | static int f_filled ( 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 ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [88, 12, 33, 2, 4, 609, 232, 143, 20, 7];
int [] param0 = [9, 5, 7, 2, 3, 13, 11, 10, 6, 4];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i] == f_fill... |
SUM_K_TH_GROUP_ODD_POSITIVE_NUMBERS | static int f_filled ( int k ) {
int cur = ( k * ( k - 1 ) ) + 1 ;
int sum = 0 ;
while ( k -- > 0 ) {
sum += cur ;
cur += 2 ;
}
return sum ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [753571, 140608, 474552, 132651, 274625, 59319, 74088, 1728, 175616, 941192];
int [] param0 = [91, 52, 78, 51, 65, 39, 42, 12, 56, 98];
int n_success = 0;
for (int i = 0; i < param0.len... |
SUM_K_TH_GROUP_ODD_POSITIVE_NUMBERS_1 | static int f_filled ( int k ) {
return k * k * k ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [185193, 884736, 2744, 262144, 13824, 405224, 614125, 19683, 474552, 1];
int [] param0 = [57, 96, 14, 64, 24, 74, 85, 27, 78, 1];
int n_success = 0;
for (int i = 0; i < param0.length; i... |
SUM_LARGEST_PRIME_FACTOR_NUMBER_LESS_EQUAL_N | static int f_filled ( int n ) {
int prime [ ] = new int [ n + 1 ] , sum = 0 ;
Arrays . fill ( prime , 0 ) ;
int max = n / 2 ;
for ( int p = 2 ;
p <= max ;
p ++ ) {
if ( prime [ p ] == 0 ) {
for ( int i = p * 2 ;
i <= n ;
i += p ) prime [ i ] = p ;
}
}
for ( int p = 2 ;
p <= n... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [15, 291, 1554, 1672, 875, 43, 901, 90, 1695, 1334];
int [] param0 = [6, 35, 87, 91, 63, 11, 66, 17, 92, 81];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (res... |
SUM_MANHATTAN_DISTANCES_PAIRS_POINTS | static int f_filled ( int x [ ] , int y [ ] , int n ) {
int sum = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) for ( int j = i + 1 ;
j < n ;
j ++ ) sum += ( Math . abs ( x [ i ] - x [ j ] ) + Math . abs ( y [ i ] - y [ j ] ) ) ;
return sum ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [35930, 35216, 4, 19322, 42084, 4, 2776, 28932, 188, 0];
int [] [] param0 = [[2, 4, 6, 6, 8, 11, 12, 13, 14, 19, 20, 22, 24, 28, 29, 30, 32, 35, 37, 44, 48, 49, 51, 51, 56, 59, 59, 62, 65, 68, 68... |
SUM_MATRIX_ELEMENT_ABSOLUTE_DIFFERENCE_ROW_COLUMN_NUMBERS | static int f_filled ( int n ) {
int [ ] [ ] arr = new int [ n ] [ n ] ;
for ( int i = 0 ;
i < n ;
i ++ ) for ( int j = 0 ;
j < n ;
j ++ ) arr [ i ] [ j ] = Math . abs ( i - j ) ;
int sum = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) for ( int j = 0 ;
j < n ;
j ++ ) sum += arr [ i ] [ j ] ;
return sum... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [71980, 28380, 124392, 242970, 323400, 30360, 6552, 440, 91520, 46852];
int [] param0 = [60, 44, 72, 90, 99, 45, 27, 11, 65, 52];
int n_success = 0;
for (int i = 0; i < param0.length; i... |
SUM_MATRIX_ELEMENT_ABSOLUTE_DIFFERENCE_ROW_COLUMN_NUMBERS_1 | static int f_filled ( int n ) {
int sum = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) sum += i * ( n - i ) ;
return 2 * sum ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [83328, 124392, 7308, 14280, 70, 114310, 2660, 168, 168, 14280];
int [] param0 = [63, 72, 28, 35, 6, 70, 20, 8, 8, 35];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
... |
SUM_MATRIX_ELEMENT_ABSOLUTE_DIFFERENCE_ROW_COLUMN_NUMBERS_2 | static int f_filled ( int n ) {
n -- ;
int sum = 0 ;
sum += ( n * ( n + 1 ) ) / 2 ;
sum += ( n * ( n + 1 ) * ( 2 * n + 1 ) ) / 6 ;
return sum ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [572, 234960, 146300, 2, 177120, 440, 5850, 14280, 1360, 95810];
int [] param0 = [12, 89, 76, 2, 81, 11, 26, 35, 16, 66];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
... |
SUM_MATRIX_ELEMENT_ELEMENT_INTEGER_DIVISION_ROW_COLUMN | static int f_filled ( int n ) {
int ans = 0 ;
for ( int i = 1 ;
i <= n ;
i ++ ) for ( int j = 1 ;
j <= n ;
j ++ ) ans += ( i / j ) ;
return ans ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [7021, 11190, 77, 11190, 1974, 8680, 19920, 156, 3697, 10530];
int [] param0 = [60, 74, 8, 74, 34, 66, 96, 11, 45, 72];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
... |
SUM_MATRIX_ELEMENT_ELEMENT_INTEGER_DIVISION_ROW_COLUMN_1 | static int f_filled ( 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 ... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [630, 4371, 28, 3321, 3240, 1128, 28, 861, 1770, 595];
int [] param0 = [35, 93, 7, 81, 80, 47, 7, 41, 59, 34];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (re... |
SUM_NODES_K_TH_LEVEL_TREE_REPRESENTED_STRING | static int f_filled ( String tree , int k ) {
int level = - 1 ;
int sum = 0 ;
int n = tree . length ( ) ;
for ( int i = 0 ;
i < n ;
i ++ ) {
if ( tree . charAt ( i ) == '(' ) level ++ ;
else if ( tree . charAt ( i ) == ')' ) level -- ;
else {
if ( level == k ) sum += ( tree . charAt ( i ) ... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [14, 9, 12, 16, 0, 0, 9, 0, 0, 0];
string [] param0 = ["(0(5(6()())(4()(9()())))(7(1()())(3()())))", "(8(3(2()())(6(5()())()))(5(10()())(7(13()())())))", "(0(5(6()())(4()(9()())))(7(1()())(3()())... |
SUM_OF_ALL_ELEMENTS_UP_TO_NTH_ROW_IN_A_PASCALS_TRIANGLE | static long f_filled ( int n ) {
long sum = 0 ;
for ( int row = 0 ;
row < n ;
row ++ ) {
sum = sum + ( 1 << row ) ;
}
return sum ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
long [] results = [3, 15, 7, 127, 255, 31, 63, 1023, 4095, 32767];
int [] param0 = [2, 4, 3, 7, 8, 5, 6, 10, 12, 15];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i] =... |
SUM_OF_ALL_ELEMENTS_UP_TO_NTH_ROW_IN_A_PASCALS_TRIANGLE_1 | static long f_filled ( int n ) {
long sum = 0 ;
sum = 1 << n ;
return ( sum - 1 ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
long [] results = [31, 7, 2047, 15, 255, 8191, 63, 7, 65535, 511];
int [] param0 = [5, 3, 11, 4, 8, 13, 6, 3, 16, 9];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i] =... |
SUM_OF_ALL_PROPER_DIVISORS_OF_A_NATURAL_NUMBER | static int f_filled ( int num ) {
int result = 0 ;
for ( int i = 2 ;
i <= Math . sqrt ( num ) ;
i ++ ) {
if ( num % i == 0 ) {
if ( i == ( num / i ) ) result += i ;
else result += ( i + num / i ) ;
}
}
return ( result + 1 ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [1, 23, 28, 1, 22, 1, 33, 1, 40, 1];
int [] param0 = [2, 57, 28, 43, 38, 29, 45, 47, 44, 3];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i] == f_fill... |
SUM_PAIRWISE_PRODUCTS | static int f_filled ( int n ) {
int sum = 0 ;
for ( int i = 1 ;
i <= n ;
i ++ ) for ( int j = i ;
j <= n ;
j ++ ) sum = sum + i * j ;
return sum ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [28336, 145112, 9996, 284050, 1155, 25, 140, 601036, 551310, 7438442];
int [] param0 = [21, 32, 16, 38, 9, 3, 5, 46, 45, 87];
int n_success = 0;
for (int i = 0; i < param0.length; i++) ... |
SUM_PAIRWISE_PRODUCTS_1 | static int f_filled ( 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 ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [382571, 834275, 2645897, 15675, 1711355, 266, 74907, 601036, 834275, 23485];
int [] param0 = [41, 50, 67, 18, 60, 6, 27, 46, 50, 20];
int n_success = 0;
for (int i = 0; i < param0.leng... |
SUM_PAIRWISE_PRODUCTS_2 | static int f_filled ( int n ) {
return n * ( n + 1 ) * ( n + 2 ) * ( 3 * n + 1 ) / 24 ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [1397887, 15675, 11449977, 1155, 420497, 2645897, 3327486, 2493271, 2972060, 15675];
int [] param0 = [57, 18, 97, 9, 42, 67, 71, 66, 69, 18];
int n_success = 0;
for (int i = 0; i < para... |
SUM_SEQUENCE_2_22_222 | static double f_filled ( int n ) {
return 0.0246 * ( Math . pow ( 10 , n ) - 1 - ( 9 * n ) ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
double [] results = [2459998.2042, 24599997.9828, 245998.42560000002, 24598.647, 23.9112, 245999997.7614, 1.9926, 0.0, 245.0898, 2458.8684];
int [] param0 = [8, 9, 7, 6, 3, 10, 2, 1, 4, 5];
int n_success = 0... |
SUM_SERIES_0_6_0_06_0_006_0_0006_N_TERMS | static double f_filled ( int n ) {
return ( 0.666 ) * ( 1 - 1 / Math . pow ( 10 , n ) ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
double [] results = [0.5994, 0.65934, 0.665334, 0.6659334, 0.6659933400000001, 0.666, 0.666, 0.666, 0.665999999334, 0.665999999999334];
int [] param0 = [1, 2, 3, 4, 5, 74, 77, 67, 9, 12];
int n_success = 0;
... |
SUM_SERIES_12_32_52_2N_12 | static int f_filled ( int n ) {
int sum = 0 ;
for ( int i = 1 ;
i <= n ;
i ++ ) sum = sum + ( 2 * i - 1 ) * ( 2 * i - 1 ) ;
return sum ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [3654, 302621, 67525, 848046, 138415, 1254890, 457310, 18424, 585276, 18424];
int [] param0 = [14, 61, 37, 86, 47, 98, 70, 24, 76, 24];
int n_success = 0;
for (int i = 0; i < param0.len... |
SUM_SERIES_12_32_52_2N_12_1 | static int f_filled ( int n ) {
return ( n * ( 2 * n - 1 ) * ( 2 * n + 1 ) ) / 3 ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [790244, 540274, 1004731, 52394, 62196, 29260, 457310, 455, 18424, 138415];
int [] param0 = [84, 74, 91, 34, 36, 28, 70, 7, 24, 47];
int n_success = 0;
for (int i = 0; i < param0.length... |
SUM_SERIES_23_45_67_89_UPTO_N_TERMS | static double f_filled ( int n ) {
int i = 1 ;
double res = 0.0 ;
boolean sign = true ;
while ( n > 0 ) {
n -- ;
if ( sign ) {
sign = ! sign ;
res = res + ( double ) ++ i / ++ i ;
}
else {
sign = ! sign ;
res = res - ( double ) ++ i / ++ i ;
}
}
return res ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
double [] results = [0.7803986631477524, -0.16507936507936516, -0.21050375120783382, -0.21185466678122022, -0.2120245854859959, 0.7770671416747363, -0.21172836828074082, 0.780190394898247, 0.7821931668684383, 0.78255... |
SUM_SERIES_555555_N_TERMS | static int f_filled ( int n ) {
return ( int ) ( 0.6172 * ( Math . pow ( 10 , n ) - 1 ) - 0.55 * n ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [61719994, 5, 6171995, 6169, 617199994, 617196, 5, 614, 60, 61716];
int [] param0 = [8, 1, 7, 4, 9, 6, 1, 3, 2, 5];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
i... |
SUM_SUBSETS_SET_FORMED_FIRST_N_NATURAL_NUMBERS | static long f_filled ( int n ) {
return ( n * ( n + 1 ) / 2 ) * ( 1 << ( n - 1 ) ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
long [] results = [1792, 6, 80, 240, 28160, 11520, 24, 672, 159744, 4608];
int [] param0 = [7, 2, 4, 5, 10, 9, 3, 6, 12, 8];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (resul... |
SUM_TWO_LARGE_NUMBERS | static String f_filled ( String str1 , String str2 ) {
if ( str1 . length ( ) > str2 . length ( ) ) {
String t = str1 ;
str1 = str2 ;
str2 = t ;
}
String str = "" ;
int n1 = str1 . length ( ) , n2 = str2 . length ( ) ;
str1 = new StringBuilder ( str1 ) . reverse ( ) . toString ( ) ;
str2 = new S... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
string [] results = ["575584", "0526110507350", "121110010", "74169", "614", "01110101112", "106743", "898423490593", "01211112110121", "359233"];
string [] param0 = ["12687", "0526110506447", "011010010", "70234... |
SWAP_ALL_ODD_AND_EVEN_BITS | static int f_filled ( int x ) {
int even_bits = x & 0xAAAAAAAA ;
int odd_bits = x & 0x55555555 ;
even_bits >>= 1 ;
odd_bits <<= 1 ;
return ( even_bits | odd_bits ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [147, 173, 7, 3, 142, 54, 57, 129, 145, 24];
int [] param0 = [99, 94, 11, 3, 77, 57, 54, 66, 98, 36];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i] ... |
SWAP_BITS_IN_A_GIVEN_NUMBER | static int f_filled ( int x , int p1 , int p2 , int n ) {
int set1 = ( x >> p1 ) & ( ( 1 << n ) - 1 ) ;
int set2 = ( x >> p2 ) & ( ( 1 << n ) - 1 ) ;
int xor = ( set1 ^ set2 ) ;
xor = ( xor << p1 ) | ( xor << p2 ) ;
int result = x ^ xor ;
return result ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [5, 1, 5, 5, 129, 65, 192, 65, 3, 6];
int [] param0 = [5, 1, 5, 5, 9, 5, 6, 5, 3, 6];
int [] param1 = [8, 2, 5, 5, 1, 6, 6, 1, 3, 6];
int [] param2 = [7, 5, 4, 9, 5, 2, 1, 5, 9, 6];
i... |
SWAP_TWO_NIBBLES_BYTE | static int f_filled ( int x ) {
return ( ( x & 0x0F ) << 4 | ( x & 0xF0 ) >> 4 ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [147, 54, 36, 22, 245, 162, 245, 149, 48, 69];
int [] param0 = [57, 99, 66, 97, 95, 42, 95, 89, 3, 84];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i... |
TAIL_RECURSION | static int f_filled ( int n ) {
if ( n == 0 ) return 1 ;
return n * f_filled ( n - 1 ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [5040, 2, 24, 720, 40320, 6, 362880, 3628800, 39916800, 1];
int [] param0 = [7, 2, 4, 6, 8, 3, 9, 10, 11, 1];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (res... |
TAIL_RECURSION_FIBONACCI | static int f_filled ( int n , int a , int b ) {
if ( n == 0 ) return a ;
if ( n == 1 ) return b ;
return f_filled ( n - 1 , b , a + b ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [18, 104, 327, 176, 8, 120, 14, 568, 1385, 4];
int [] param0 = [4, 6, 9, 7, 2, 8, 3, 10, 12, 1];
int [] param1 = [3, 8, 1, 9, 8, 6, 0, 7, 1, 3];
int [] param2 = [4, 8, 9, 8, 0, 2, 7, 6, 9... |
TEMPLE_OFFERINGS | static int f_filled ( int n , int templeHeight [ ] ) {
int sum = 0 ;
for ( int i = 0 ;
i < n ;
++ i ) {
int left = 0 , right = 0 ;
for ( int j = i - 1 ;
j >= 0 ;
-- j ) {
if ( templeHeight [ j ] < templeHeight [ j + 1 ] ) ++ left ;
else break ;
}
for ( int j = i + 1 ;
j <... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [78, 92, 17, 15, 0, 50, 106, 16, 19, 64];
int [] param0 = [12, 46, 16, 9, 0, 38, 28, 9, 18, 29];
int [] [] param1 = [[3, 11, 12, 15, 16, 21, 24, 29, 32, 39, 42, 44, 51, 68, 79, 81, 81, 85, 92... |
TILING_WITH_DOMINOES | static int f_filled ( 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 ] ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [0, 0, 0, 41, 0, 3, 0, 11, 153, 571];
int [] param0 = [9, 13, 5, 6, 7, 2, 19, 4, 8, 10];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i] == f_filled(p... |
TOTAL_NUMBER_OF_NON_DECREASING_NUMBERS_WITH_N_DIGITS | static int f_filled ( int n ) {
int dp [ ] [ ] = new int [ 10 ] [ n + 1 ] ;
for ( int i = 0 ;
i < 10 ;
i ++ ) dp [ i ] [ 1 ] = 1 ;
for ( int digit = 0 ;
digit <= 9 ;
digit ++ ) {
for ( int len = 2 ;
len <= n ;
len ++ ) {
for ( int x = 0 ;
x <= digit ;
x ++ ) dp [ digit ] [ le... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [14307150, 715, 24310, 48620, 220, 1307504, 2002, 293930, 11440, 167960];
int [] param0 = [21, 4, 8, 9, 3, 15, 5, 12, 7, 11];
int n_success = 0;
for (int i = 0; i < param0.length; i++) ... |
TOTAL_NUMBER_OF_NON_DECREASING_NUMBERS_WITH_N_DIGITS_1 | static long f_filled ( int n ) {
int N = 10 ;
long count = 1 ;
for ( int i = 1 ;
i <= n ;
i ++ ) {
count *= ( N + i - 1 ) ;
count /= i ;
}
return count ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
long [] results = [2054455634, 167960, 2509710226100, 293052087900, 5005, 293052087900, 42757703560, 2054455634, 97082021465, 125595622175];
int [] param0 = [40, 11, 94, 73, 6, 73, 58, 40, 64, 66];
int n_suc... |
TRIANGULAR_MATCHSTICK_NUMBER | static int f_filled ( int x ) {
return ( 3 * x * ( x + 1 ) ) / 2 ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [63, 975, 360, 1395, 459, 9720, 1134, 273, 234, 6834];
int [] param0 = [6, 25, 15, 30, 17, 80, 27, 13, 12, 67];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (r... |
TRIANGULAR_NUMBERS | static boolean f_filled ( int num ) {
if ( num < 0 ) return false ;
int sum = 0 ;
for ( int n = 1 ;
sum <= num ;
n ++ ) {
sum = sum + n ;
if ( sum == num ) return true ;
}
return false ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
bool [] results = [false, false, false, false, false, false, false, false, true, false];
int [] param0 = [97, 97, 32, 40, 18, 14, 90, 39, 1, 57];
int n_success = 0;
for (int i = 0; i < param0.length; i+... |
TRIANGULAR_NUMBERS_1 | static boolean f_filled ( int num ) {
if ( num < 0 ) return false ;
int c = ( - 2 * num ) ;
int b = 1 , a = 1 ;
int d = ( b * b ) - ( 4 * a * c ) ;
if ( d < 0 ) return false ;
float root1 = ( - b + ( float ) Math . sqrt ( d ) ) / ( 2 * a ) ;
float root2 = ( - b - ( float ) Math . sqrt ( d ) ) / ( 2 * a ) ... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
bool [] results = [true, true, true, true, true, false, false, false, false, false];
int [] param0 = [1, 3, 6, 10, 55, 48, 63, 72, 16, 85];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
... |
TURN_OFF_THE_RIGHTMOST_SET_BIT | static int f_filled ( int n ) {
return n & ( n - 1 ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [8, 52, 56, 0, 40, 0, 0, 50, 56, 88];
int [] param0 = [9, 54, 60, 32, 41, 64, 4, 51, 57, 92];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i] == f_fil... |
UGLY_NUMBERS | static int f_filled ( int n ) {
int ugly [ ] = new int [ n ] ;
int i2 = 0 , i3 = 0 , i5 = 0 ;
int next_multiple_of_2 = 2 ;
int next_multiple_of_3 = 3 ;
int next_multiple_of_5 = 5 ;
int next_ugly_no = 1 ;
ugly [ 0 ] = 1 ;
for ( int i = 1 ;
i < n ;
i ++ ) {
next_ugly_no = Math . min ( next_multipl... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [64, 450, 1250, 1152, 972, 1000, 625, 1000, 90, 1];
int [] param0 = [27, 64, 93, 90, 85, 86, 72, 86, 32, 1];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (resu... |
UNIQUE_CELLS_BINARY_MATRIX | static int f_filled ( int mat [ ] [ ] , int n , int m ) {
int [ ] rowsum = new int [ n ] ;
int [ ] colsum = new int [ m ] ;
for ( int i = 0 ;
i < n ;
i ++ ) for ( int j = 0 ;
j < m ;
j ++ ) if ( mat [ i ] [ j ] != 0 ) {
rowsum [ i ] ++ ;
colsum [ j ] ++ ;
}
int uniquecount = 0 ;
for ( int i ... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [2, 1, 1, 0, 0, 0, 0, 0, 0];
int [] [] [] param0 = [[[0, 1, 0, 0], [0, 0, 1, 0], [1, 0, 0, 1]], [[0, 1, 0, 0], [0, 0, 1, 1], [1, 0, 1, 1]], [[0, 1, 0, 0], [0, 0, 1, 0], [1, 1, 0, 1]], [[1, 1, 1, ... |
WAYS_REMOVE_ONE_ELEMENT_BINARY_STRING_XOR_BECOMES_ZERO | static int f_filled ( String s ) {
int one_count = 0 , zero_count = 0 ;
char [ ] str = s . toCharArray ( ) ;
int n = str . length ;
for ( int i = 0 ;
i < n ;
i ++ ) if ( str [ i ] == '1' ) one_count ++ ;
else zero_count ++ ;
if ( one_count % 2 == 0 ) return zero_count ;
return one_count ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [7, 1, 2, 9, 1, 5, 12, 1, 4, 9];
string [] param0 = ["kfctjnp", "05312505872", "100111", "tdeehkxrq", "50824233019", "10001110010", "t sezanm myq", "838415739", "01110100", "wyqiaey h"];
int... |
WAYS_TRANSFORMING_ONE_STRING_REMOVING_0_CHARACTERS | static int f_filled ( String a , String b ) {
int n = a . length ( ) , m = b . length ( ) ;
if ( m == 0 ) {
return 1 ;
}
int dp [ ] [ ] = new int [ m + 1 ] [ n + 1 ] ;
for ( int i = 0 ;
i < m ;
i ++ ) {
for ( int j = i ;
j < n ;
j ++ ) {
if ( i == 0 ) {
if ( j == 0 ) {
... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [3, 4, 1, 0, 0, 11, 0, 1, 7, 1];
string [] param0 = ["abcccdf", "aabba", "aabsdfljk", "ioniqv", "9667771256770", "10001011", "fczbdtmdt", "298746088", "01100011000", "qk"];
string [] param1 =... |
WILDCARD_CHARACTER_MATCHING | static boolean f_filled ( String first , String second ) {
if ( first . length ( ) == 0 && second . length ( ) == 0 ) return true ;
if ( first . length ( ) > 1 && first . charAt ( 0 ) == '*' && second . length ( ) == 0 ) return false ;
if ( ( first . length ( ) > 1 && first . charAt ( 0 ) == '?' ) || ( first . le... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
bool [] results = [true, true, false, false, true, false, true, true, true, false];
string [] param0 = ["g*ks", "ge?ks*", "g*k", "*pqrs", "abc*bcd", "abc*c?d", "*c*d", "*?c*d", "?*1", "a*"];
string [] param1 ... |
WRITE_AN_EFFICIENT_METHOD_TO_CHECK_IF_A_NUMBER_IS_MULTIPLE_OF_3 | static int f_filled ( int n ) {
int odd_count = 0 ;
int even_count = 0 ;
if ( n < 0 ) n = - n ;
if ( n == 0 ) return 1 ;
if ( n == 1 ) return 0 ;
while ( n != 0 ) {
if ( ( n & 1 ) != 0 ) odd_count ++ ;
if ( ( n & 2 ) != 0 ) even_count ++ ;
n = n >> 2 ;
}
return f_filled ( Math . abs ( odd_co... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [0, 0, 0, 1, 0, 1, 0, 0, 0, 0];
int [] param0 = [94, 94, 79, 39, 16, 90, 64, 76, 83, 47];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i] == f_filled(... |
WRITE_A_C_PROGRAM_TO_CALCULATE_POWXN | static int f_filled ( int x , int y ) {
if ( y == 0 ) return 1 ;
else if ( y % 2 == 0 ) return f_filled ( x , y / 2 ) * f_filled ( x , y / 2 ) ;
else return x * f_filled ( x , y / 2 ) * f_filled ( x , y / 2 ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [36, 4782969, 0, 1, 6, 1, 117649, 100, 1679616, 1];
int [] param0 = [6, 9, 0, 1, 6, 1, 7, 10, 6, 9];
int [] param1 = [2, 7, 2, 6, 1, 9, 6, 2, 8, 0];
int n_success = 0;
for (int i = ... |
WRITE_A_C_PROGRAM_TO_FIND_THE_PARITY_OF_AN_UNSIGNED_INTEGER | static boolean f_filled ( int n ) {
boolean parity = false ;
while ( n != 0 ) {
parity = ! parity ;
n = n & ( n - 1 ) ;
}
return parity ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
bool [] results = [false, true, false, false, false, false, true, true, true, true];
int [] param0 = [3, 64, 85, 36, 20, 63, 42, 19, 62, 97];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {... |
WRITE_ONE_LINE_C_FUNCTION_TO_FIND_WHETHER_A_NO_IS_POWER_OF_TWO | static boolean f_filled ( int n ) {
if ( n == 0 ) return false ;
while ( n != 1 ) {
if ( n % 2 != 0 ) return false ;
n = n / 2 ;
}
return true ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
bool [] results = [true, true, true, true, false, false, false, false, false, false];
int [] param0 = [1, 2, 8, 1024, 24, 7, 46, 61, 73, 66];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {... |
WRITE_ONE_LINE_C_FUNCTION_TO_FIND_WHETHER_A_NO_IS_POWER_OF_TWO_1 | static boolean f_filled ( int x ) {
return x != 0 && ( ( x & ( x - 1 ) ) == 0 ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
bool [] results = [true, true, true, true, false, false, false, false, false, false];
int [] param0 = [1, 2, 8, 1024, 24, 7, 46, 61, 73, 66];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {... |
WRITE_YOU_OWN_POWER_WITHOUT_USING_MULTIPLICATION_AND_DIVISION | static int f_filled ( int a , int b ) {
if ( b == 0 ) return 1 ;
int answer = a ;
int increment = a ;
int i , j ;
for ( i = 1 ;
i < b ;
i ++ ) {
for ( j = 1 ;
j < a ;
j ++ ) {
answer += increment ;
}
increment = answer ;
}
return answer ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [1296, 262144, 256, 125, 4096, 100, 19683, 2401, 10077696, 371293];
int [] param0 = [6, 8, 2, 5, 4, 10, 3, 7, 6, 13];
int [] param1 = [4, 6, 8, 3, 6, 2, 9, 4, 9, 5];
int n_success = 0;
... |
ZECKENDORFS_THEOREM_NON_NEIGHBOURING_FIBONACCI_REPRESENTATION | static int f_filled ( int n ) {
if ( n == 0 || n == 1 ) return n ;
int f1 = 0 , f2 = 1 , f3 = 1 ;
while ( f3 <= n ) {
f1 = f2 ;
f2 = f3 ;
f3 = f1 + f2 ;
}
return f2 ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [34, 55, 55, 55, 89, 34, 55, 89, 89, 55];
int [] param0 = [54, 71, 64, 71, 96, 43, 70, 94, 95, 69];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i] ==... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.