id stringlengths 9 106 | function_java stringlengths 50 1.9k | d_with_params stringlengths 426 32.8k |
|---|---|---|
CHECK_STRING_FOLLOWS_ANBN_PATTERN_NOT | static boolean f_filled ( String s ) {
int l = s . length ( ) ;
if ( l % 2 == 1 ) {
return false ;
}
int i = 0 ;
int j = l - 1 ;
while ( i < j ) {
if ( s . charAt ( i ) != 'a' || s . charAt ( j ) != 'b' ) {
return false ;
}
i ++ ;
j -- ;
}
return true ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
bool [] results = [false, true, false, false, false, false, false, false, false, false];
string [] param0 = ["ba", "aabb", "abab", "aaabb", "aabbb", "abaabbaa", "abaababb", "bbaa", "11001000", "zwxv te"];
in... |
LONGEST_REPEATING_SUBSEQUENCE | static int f_filled ( String str ) {
int n = str . length ( ) ;
int [ ] [ ] dp = new int [ n + 1 ] [ n + 1 ] ;
for ( int i = 1 ;
i <= n ;
i ++ ) {
for ( int j = 1 ;
j <= n ;
j ++ ) {
if ( str . charAt ( i - 1 ) == str . charAt ( j - 1 ) && i != j ) dp [ i ] [ j ] = 1 + dp [ i - 1 ] [ j - 1 ]... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [0, 3, 6, 1, 1, 0, 1, 3, 5, 0];
string [] param0 = ["jxzfz", "7648992235770", "11100000", "crn sgyjpsctj", "434", "1", "jrfziasbrpbz", "03779368305592", "1111000", "bkuluii"];
int n_success... |
CHECK_TWO_GIVEN_CIRCLES_TOUCH_INTERSECT | static int f_filled ( int x1 , int y1 , int x2 , int y2 , int r1 , int r2 ) {
int distSq = ( x1 - x2 ) * ( x1 - x2 ) + ( y1 - y2 ) * ( y1 - y2 ) ;
int radSumSq = ( r1 + r2 ) * ( r1 + r2 ) ;
if ( distSq == radSumSq ) return 1 ;
else if ( distSq > radSumSq ) return - 1 ;
else return 0 ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [-1, 0, -1, 0, 0, 0, 0, 0, 0, -1];
int [] param0 = [11, 87, 51, 89, 64, 57, 65, 32, 73, 3];
int [] param1 = [36, 1, 1, 67, 10, 86, 90, 23, 61, 99];
int [] param2 = [62, 62, 47, 9, 79, 99,... |
REMOVE_ARRAY_END_ELEMENT_MAXIMIZE_SUM_PRODUCT | static int f_filled ( int dp [ ] [ ] , int a [ ] , int low , int high , int turn ) {
if ( low == high ) {
return a [ low ] * turn ;
}
if ( dp [ low ] [ high ] != 0 ) {
return dp [ low ] [ high ] ;
}
dp [ low ] [ high ] = Math . max ( a [ low ] * turn + f_filled ( dp , a , low + 1 , high , turn + 1 ) ,... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [89, 2256, 32, 62, 52, 1, 24, -240, 1, 14];
int [] [] [] param0 = [[[23, 37, 54, 57, 59, 75, 97], [9, 15, 34, 39, 80, 96, 99], [15, 25, 26, 31, 43, 47, 93], [22, 31, 37, 44, 54, 62, 91], [7, 19, ... |
CHECK_VALID_SEQUENCE_DIVISIBLE_M_1 | static int f_filled ( int n , int index , int modulo , int M , int arr [ ] , int dp [ ] [ ] ) {
modulo = ( ( modulo % M ) + M ) % M ;
if ( index == n ) {
if ( modulo == 0 ) {
return 1 ;
}
return 0 ;
}
if ( dp [ index ] [ modulo ] != - 1 ) {
return dp [ index ] [ modulo ] ;
}
int placeA... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [6, -80, 1, 26, 16, 1, 25, 1, 0, 47];
int [] param0 = [19, 14, 5, 8, 14, 16, 24, 7, 35, 8];
int [] param1 = [29, 17, 7, 10, 12, 21, 26, 7, 35, 5];
int [] param2 = [20, 13, 6, 10, 16, 17, ... |
COUNT_PAIRS_TWO_SORTED_ARRAYS_WHOSE_SUM_EQUAL_GIVEN_VALUE_X_2 | static int f_filled ( int arr1 [ ] , int arr2 [ ] , int m , int n , int x ) {
int count = 0 ;
int l = 0 , r = n - 1 ;
while ( l < m && r >= 0 ) {
if ( ( arr1 [ l ] + arr2 [ r ] ) == x ) {
l ++ ;
r -- ;
count ++ ;
}
else if ( ( arr1 [ l ] + arr2 [ r ] ) < x ) l ++ ;
else r -- ;
... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [3, 0, 0, 0, 0, 0, 1, 1, 0, 0];
int [] [] param0 = [[5, 5, 7, 10, 14, 14, 17, 21, 32, 34, 37, 40, 40, 40, 46, 46, 50, 50, 51, 55, 57, 62, 65, 67, 67, 69, 70, 70, 72, 73, 76, 77, 77, 78, 84, 85, 8... |
CHECK_WHETHER_ARITHMETIC_PROGRESSION_CAN_FORMED_GIVEN_ARRAY | static boolean f_filled ( int arr [ ] , int n ) {
if ( n == 1 ) return true ;
Arrays . sort ( arr ) ;
int d = arr [ 1 ] - arr [ 0 ] ;
for ( int i = 2 ;
i < n ;
i ++ ) if ( arr [ i ] - arr [ i - 1 ] != d ) return false ;
return true ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
bool [] results = [false, true, true, true, true, false, false, false, false, false];
int [] [] param0 = [[1, 4, 16, 64], [0, 4, 8, 12], [-2, 0, 2, 4, 6], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [46, 56, 66, 76, 86... |
FORM_MINIMUM_NUMBER_FROM_GIVEN_SEQUENCE_1 | static String f_filled ( String seq ) {
int n = seq . length ( ) ;
if ( n >= 9 ) return "-1" ;
char result [ ] = new char [ n + 1 ] ;
int count = 1 ;
for ( int i = 0 ;
i <= n ;
i ++ ) {
if ( i == n || seq . charAt ( i ) == 'I' ) {
for ( int j = i - 1 ;
j >= - 1 ;
j -- ) {
res... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
string [] results = ["21", "12", "321", "123", "21435", "126543", "321654798", "7654321", "21", "7654321"];
string [] param0 = ["d", "i", "dd", "ii", "didi", "iiddd", "ddiddiid", "176297", "1", "xhkhzq"];
in... |
CHECK_WHETHER_GIVEN_DEGREES_VERTICES_REPRESENT_GRAPH_TREE | static boolean f_filled ( int degree [ ] , int n ) {
int deg_sum = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
deg_sum += degree [ i ] ;
}
return ( 2 * ( n - 1 ) == deg_sum ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
bool [] results = [true, true, false, true, true, false, false, false, false, false];
int [] [] param0 = [[2, 3, 1, 1, 1], [2, 2, 1, 1, 2], [2, 2, 1, 1, 1], [0, 0, 0, 3, 3, 4], [-10, 12, 2], [1, 1, 1, 1, 0, 0, 0,... |
COUNT_POSSIBLE_WAYS_TO_CONSTRUCT_BUILDINGS | static int f_filled ( 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 ;
... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [313679521, 45765225, 2550409, 974169, 54289, 20736, 1156, 441, 25, 9];
int [] param0 = [20, 18, 15, 14, 11, 10, 7, 6, 3, 2];
int n_success = 0;
for (int i = 0; i < param0.length; i++) ... |
CHECK_WHETHER_GIVEN_NUMBER_EVEN_ODD | static boolean f_filled ( int n ) {
return ( n % 2 == 0 ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
bool [] results = [false, true, false, true, false, true, true, true, false, false];
int [] param0 = [67, 90, 55, 90, 83, 32, 58, 38, 87, 87];
int n_success = 0;
for (int i = 0; i < param0.length; i++) ... |
CHECK_WHETHER_GIVEN_NUMBER_EVEN_ODD_1 | static boolean f_filled ( int n ) {
if ( ( n & 1 ) == 0 ) return true ;
else return false ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
bool [] results = [false, false, false, true, false, false, false, true, true, true];
int [] param0 = [57, 73, 79, 36, 71, 23, 41, 66, 46, 50];
int n_success = 0;
for (int i = 0; i < param0.length; i++)... |
HOW_TO_PRINT_MAXIMUM_NUMBER_OF_A_USING_GIVEN_FOUR_KEYS | static int f_filled ( int N ) {
if ( N <= 6 ) return N ;
int [ ] screen = new int [ N ] ;
int b ;
int n ;
for ( n = 1 ;
n <= 6 ;
n ++ ) screen [ n - 1 ] = n ;
for ( n = 7 ;
n <= N ;
n ++ ) {
screen [ n - 1 ] = Math . max ( 2 * screen [ n - 4 ] , Math . max ( 3 * screen [ n - 5 ] , 4 * screen [ n... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [110592, 5308416, 21233664, 82944, 1811939328, 5, 196608, 150994944, 1024, 84934656];
int [] param0 = [41, 55, 60, 40, 76, 5, 43, 67, 24, 65];
int n_success = 0;
for (int i = 0; i < par... |
CHECK_WHETHER_NUMBER_DUCK_NUMBER_NOT | static int f_filled ( String num ) {
int len = num . length ( ) ;
int count_zero = 0 ;
char ch ;
for ( int i = 1 ;
i < len ;
i ++ ) {
ch = num . charAt ( i ) ;
if ( ch == '0' ) count_zero ++ ;
}
return count_zero ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [0, 1, 8, 0, 2, 5, 0, 0, 1, 0];
string [] param0 = ["hllqwsphzcic", "080287724", "0000100000", " q", "4247040983", "00001011101", "lbnsnythmlbcf", "24", "110", "ie"];
int n_success = 0;
... |
FIND_LARGEST_PRIME_FACTOR_NUMBER | static long f_filled ( long n ) {
long maxPrime = - 1 ;
while ( n % 2 == 0 ) {
maxPrime = 2 ;
n >>= 1 ;
}
for ( int i = 3 ;
i <= Math . sqrt ( n ) ;
i += 2 ) {
while ( n % i == 0 ) {
maxPrime = i ;
n = n / i ;
}
}
if ( n > 2 ) maxPrime = n ;
return maxPrime ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
long [] results = [7, 2, 13, 13, 11, 5, 5, 37, 13, 5];
long [] param0 = [98, 8, 78, 65, 55, 10, 10, 37, 39, 15];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i] == f_f... |
CHECK_WHETHER_TRIANGLE_VALID_NOT_SIDES_GIVEN | static int f_filled ( int a , int b , int c ) {
if ( a + b <= c || a + c <= b || b + c <= a ) return 0 ;
else return 1 ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [0, 0, 0, 0, 1, 0, 1, 0, 0, 0];
int [] param0 = [29, 83, 48, 59, 56, 68, 63, 95, 2, 11];
int [] param1 = [19, 34, 14, 12, 39, 85, 36, 34, 90, 16];
int [] param2 = [52, 49, 65, 94, 22, 9, ... |
CHECK_WHETHER_TWO_STRINGS_ARE_ANAGRAM_OF_EACH_OTHER | static boolean f_filled ( char [ ] str1 , char [ ] str2 ) {
int n1 = str1 . length ;
int n2 = str2 . length ;
if ( n1 != n2 ) return false ;
Arrays . sort ( str1 ) ;
Arrays . sort ( str2 ) ;
for ( int i = 0 ;
i < n1 ;
i ++ ) if ( str1 [ i ] != str2 [ i ] ) return false ;
return true ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
bool [] results = [true, true, false, true, false, false, false, false, false, false];
char [] [] param0 = [['l', 'i', 's', 't', 'e', 'n'], ['t', 'r', 'i', 'a', 'n', 'g', 'l', 'e'], ['t', 'e', 's', 't'], ['n', 'i... |
CHOCOLATE_DISTRIBUTION_PROBLEM | static int f_filled ( int arr [ ] , int n , int m ) {
if ( m == 0 || n == 0 ) return 0 ;
Arrays . sort ( arr ) ;
if ( n < m ) return - 1 ;
int min_diff = Integer . MAX_VALUE ;
int first = 0 , last = 0 ;
for ( int i = 0 ;
i + m - 1 < n ;
i ++ ) {
int diff = arr [ i + m - 1 ] - arr [ i ] ;
if ( di... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [60, 178, 1, 43, 60, 1, 52, 90, 0, 35];
int [] [] param0 = [[2, 5, 11, 23, 33, 35, 39, 51, 52, 56, 74, 76, 76, 79, 85, 88, 93, 98], [-94, -94, -88, -84, -74, -70, -56, -50, -48, -42, -34, -24, -1... |
C_PROGRAM_FIND_LARGEST_ELEMENT_ARRAY_1 | static int f_filled ( int [ ] arr , int n ) {
Arrays . sort ( arr ) ;
return arr [ n - 1 ] ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [97, 84, 1, 92, 86, 1, 99, 86, 1, 98];
int [] [] param0 = [[10, 12, 14, 16, 17, 17, 20, 24, 26, 28, 37, 38, 41, 45, 49, 50, 59, 61, 63, 65, 65, 66, 69, 70, 70, 73, 73, 74, 81, 81, 83, 87, 94, 97]... |
CIRCLE_LATTICE_POINTS | static int f_filled ( 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 std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [12, 4, 12, 4, 4, 4, 4, 4, 4, 20];
int [] param0 = [34, 56, 90, 47, 36, 63, 21, 76, 18, 75];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i] == f_fill... |
COUNT_SUBARRAYS_EQUAL_NUMBER_1S_0S_1 | static int f_filled ( int [ ] arr , int n ) {
Map < Integer , Integer > myMap = new HashMap < > ( ) ;
int sum = 0 ;
int count = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
if ( arr [ i ] == 0 ) arr [ i ] = - 1 ;
sum += arr [ i ] ;
if ( sum == 0 ) count ++ ;
if ( myMap . containsKey ( sum ) ) coun... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [0, 2, 14, 0, 0, 32, 0, 6, 7, 0];
int [] [] param0 = [[1, 6, 6, 9, 9, 9, 16, 18, 19, 20, 21, 22, 23, 26, 26, 28, 39, 40, 41, 43, 43, 44, 44, 45, 51, 51, 55, 59, 60, 62, 67, 67, 68, 69, 70, 71, 71... |
COIN_GAME_WINNER_EVERY_PLAYER_THREE_CHOICES | static boolean f_filled ( 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 ] == ... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
bool [] results = [false, true, false, true, false, true, true, false, true, true];
int [] param0 = [6, 32, 99, 22, 26, 67, 69, 39, 7, 91];
int [] param1 = [27, 88, 18, 1, 78, 51, 57, 8, 82, 56];
int [] p... |
DYNAMIC_PROGRAMMING_SET_36_CUT_A_ROPE_TO_MAXIMIZE_PRODUCT_1 | static int f_filled ( int n ) {
if ( n == 2 || n == 3 ) return ( n - 1 ) ;
int res = 1 ;
while ( n > 4 ) {
n -= 3 ;
res *= 3 ;
}
return ( n * res ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [1162261467, 86093442, 6377292, 531441, 39366, 2916, 243, 18, 1];
int [] param0 = [57, 50, 43, 36, 29, 22, 15, 8, 1];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
... |
COMPOSITE_NUMBER | static boolean f_filled ( int n ) {
if ( n <= 1 ) System . out . println ( "False" ) ;
if ( n <= 3 ) System . out . println ( "False" ) ;
if ( n % 2 == 0 || n % 3 == 0 ) return true ;
for ( int i = 5 ;
i * i <= n ;
i = i + 6 ) if ( n % i == 0 || n % ( i + 2 ) == 0 ) return true ;
return false ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
bool [] results = [true, false, false, true, true, true, true, false, true, true];
int [] param0 = [62, 13, 29, 72, 30, 20, 10, 47, 91, 52];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
... |
GOOGLE_CASE_GIVEN_SENTENCE | static String f_filled ( String s ) {
int n = s . length ( ) ;
String s1 = "" ;
s1 = s1 + Character . toLowerCase ( s . charAt ( 0 ) ) ;
for ( int i = 1 ;
i < n ;
i ++ ) {
if ( s . charAt ( i ) == ' ' && i < n ) {
s1 = s1 + " " + Character . toLowerCase ( s . charAt ( i + 1 ) ) ;
i ++ ;
... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
string [] results = ["teyndweqza", "01865", "11001100", "czwznjmqet", "318305446", "0000001111110", "yzt", "38630230", "01101", "zoizi"];
string [] param0 = ["teyndweqza", "01865", "11001100", "czwznjmqet", "3183... |
COMPUTE_AVERAGE_TWO_NUMBERS_WITHOUT_OVERFLOW_1 | static int f_filled ( int a , int b ) {
return ( a / 2 ) + ( b / 2 ) + ( ( a % 2 + b % 2 ) / 2 ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [45, 73, 26, 40, 12, 41, 32, 71, 74, 78];
int [] param0 = [9, 68, 51, 31, 14, 73, 51, 75, 98, 83];
int [] param1 = [81, 79, 2, 49, 10, 9, 13, 67, 51, 74];
int n_success = 0;
for (in... |
NEXT_POWER_OF_2_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, 128, 16, 8, 64, 128, 64, 128, 128, 32];
int [] param0 = [63, 78, 13, 5, 34, 69, 63, 78, 80, 19];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i] ... |
COMPUTE_MODULUS_DIVISION_BY_A_POWER_OF_2_NUMBER | static int f_filled ( int n , int d ) {
return ( n & ( d - 1 ) ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [50, 3, 0, 9, 2, 0, 93, 32, 37, 15];
int [] param0 = [54, 39, 35, 9, 62, 16, 93, 32, 39, 63];
int [] param1 = [59, 84, 81, 60, 68, 16, 96, 38, 62, 16];
int n_success = 0;
for (int i... |
DYNAMIC_PROGRAMMING_SET_17_PALINDROME_PARTITIONING | static int f_filled ( String str ) {
int n = str . length ( ) ;
int [ ] [ ] C = new int [ n ] [ n ] ;
boolean [ ] [ ] P = new boolean [ n ] [ n ] ;
int i , j , k , L ;
for ( i = 0 ;
i < n ;
i ++ ) {
P [ i ] [ i ] = true ;
C [ i ] [ i ] = 0 ;
}
for ( L = 2 ;
L <= n ;
L ++ ) {
for ( i = ... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [2, 4, 1, 3, 10, 2, 2, 6, 0, 9];
string [] param0 = ["ydydv", "4446057", "0111", "keej", "642861576557", "11111000101", "ram", "09773261", "1", "avbekclfdj"];
int n_success = 0;
for (in... |
COMPUTE_NCR_P_SET_1_INTRODUCTION_AND_DYNAMIC_PROGRAMMING_SOLUTION | static int f_filled ( int n , int r , int p ) {
int C [ ] = new int [ r + 1 ] ;
Arrays . fill ( C , 0 ) ;
C [ 0 ] = 1 ;
for ( int i = 1 ;
i <= n ;
i ++ ) {
for ( int j = Math . min ( i , r ) ;
j > 0 ;
j -- ) C [ j ] = ( C [ j ] + C [ j - 1 ] ) % p ;
}
return C [ r ] ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [50, 80, 0, 0, 0, 2, 0, 0, 0, 12];
int [] param0 = [82, 45, 44, 88, 90, 98, 80, 60, 52, 71];
int [] param1 = [5, 24, 68, 24, 75, 55, 54, 75, 73, 26];
int [] param2 = [94, 95, 61, 43, 57, ... |
LENGTH_LONGEST_STRICT_BITONIC_SUBSEQUENCE | static int f_filled ( 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 < ... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [0, 1, 1, 1, 1, 3, 4, 1, 2, 2];
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, ... |
COMPUTE_N_UNDER_MODULO_P | static int f_filled ( 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 ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [0, 0, 0, 0, 0, 0, 0, 44, 0, 67];
int [] param0 = [85, 14, 83, 30, 96, 55, 82, 12, 38, 46];
int [] param1 = [18, 13, 21, 35, 51, 58, 71, 74, 3, 73];
int n_success = 0;
for (int i = ... |
POSITION_OF_RIGHTMOST_SET_BIT | static int f_filled ( int n ) {
return ( int ) ( ( Math . log10 ( n & - n ) ) / Math . log10 ( 2 ) ) + 1 ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [1, 2, 2, 5, 2, 1, 5, 1, 1, 1];
int [] param0 = [45, 26, 74, 80, 46, 67, 16, 87, 27, 17];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i] == f_filled(... |
CONSTRUCT_LEXICOGRAPHICALLY_SMALLEST_PALINDROME | static String f_filled ( char [ ] str , int len ) {
int i = 0 , j = len - 1 ;
for ( ;
i < j ;
i ++ , j -- ) {
if ( str [ i ] == str [ j ] && str [ i ] != '*' ) continue ;
else if ( str [ i ] == str [ j ] && str [ i ] == '*' ) {
str [ i ] = 'a' ;
str [ j ] = 'a' ;
continue ;
}
e... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
string [] results = ["", "", "", "", "", "", "dnr", "", "", ""];
char [] [] param0 = [['a', 'b', 'c', 'g', 'i', 'l', 'l', 'o', 'o', 'p', 'q', 's', 'w', 'y', 'c', 'd', 'e', 'f', 'f', 'i', 'm', 'm', 'o', 'q', 'v', ... |
LOWER_INSERTION_POINT | static int f_filled ( int arr [ ] , int n , int X ) {
if ( X < arr [ 0 ] ) return 0 ;
else if ( X > arr [ n - 1 ] ) return n ;
int lowerPnt = 0 ;
int i = 1 ;
while ( i < n && arr [ i ] < X ) {
lowerPnt = i ;
i = i * 2 ;
}
while ( lowerPnt < n && arr [ lowerPnt ] < X ) lowerPnt ++ ;
return lowerP... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [8, 14, 8, 0, 19, 12, 8, 2, 3, 0];
int [] [] param0 = [[1, 2, 5, 5, 16, 16, 20, 26, 32, 35, 39, 39, 41, 44, 48, 48, 51, 59, 59, 62, 66, 66, 70, 74, 75, 78, 80, 86, 86, 96], [-76, 80, -6, -2, 50, ... |
CONVERTING_ONE_STRING_USING_APPEND_DELETE_LAST_OPERATIONS | static boolean f_filled ( String str1 , String str2 , int k ) {
if ( ( str1 . length ( ) + str2 . length ( ) ) < k ) return true ;
int commonLength = 0 ;
for ( int i = 0 ;
i < Math . min ( str1 . length ( ) , str2 . length ( ) ) ;
i ++ ) {
if ( str1 == str2 ) commonLength ++ ;
else break ;
}
if ( ... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
bool [] results = [false, false, true, true, true, true, false, false, true, true];
string [] param0 = ["znhgro", "382880806774", "0", "lxhtrfctsq", "6399914758", "01100011100000", "wkgqlob", "46974006151", "1001... |
FIND_DIFFERENCE_BETWEEN_SUMS_OF_TWO_DIAGONALS | static int f_filled ( int arr [ ] [ ] , int n ) {
int d1 = 0 , d2 = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
for ( int j = 0 ;
j < n ;
j ++ ) {
if ( i == j ) d1 += arr [ i ] [ j ] ;
if ( i == n - j - 1 ) d2 += arr [ i ] [ j ] ;
}
}
return Math . abs ( d1 - d2 ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [12, 36, 3, 51, 6, 2, 59, 370, 0, 89];
int [] [] [] param0 = [[[1, 7, 17, 19, 22, 25, 27, 29, 41, 60, 67, 73, 79, 85, 94], [2, 6, 16, 21, 30, 42, 43, 48, 50, 52, 60, 61, 68, 92, 95], [4, 8, 10, 1... |
CONVERT_STRICTLY_INCREASING_ARRAY_MINIMUM_CHANGES | static int f_filled ( int arr [ ] , int n ) {
int LIS [ ] = new int [ n ] ;
int len = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) LIS [ i ] = 1 ;
for ( int i = 1 ;
i < n ;
i ++ ) {
for ( int j = 0 ;
j < i ;
j ++ ) {
if ( arr [ i ] > arr [ j ] && ( i - j ) <= ( arr [ i ] - arr [ j ] ) ) LIS [ ... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [2, 15, 5, 10, 4, 2, 0, 2, 1, 9];
int [] [] param0 = [[1, 4, 12, 14, 15, 18, 20, 24, 25, 25, 27, 33, 34, 42, 46, 48, 49, 50, 50, 52, 55, 56, 57, 58, 64, 65, 66, 69, 72, 75, 78, 80, 84, 90, 92, 95... |
MODULAR_EXPONENTIATION_POWER_IN_MODULAR_ARITHMETIC | static int f_filled ( int x , int y , int p ) {
int res = 1 ;
x = x % p ;
while ( y > 0 ) {
if ( ( y & 1 ) == 1 ) res = ( res * x ) % p ;
y = y >> 1 ;
x = ( x * x ) % p ;
}
return res ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [61, 18, 4, 0, 3, 3, 16, 5, 19, 29];
int [] param0 = [45, 67, 26, 33, 35, 68, 14, 5, 23, 37];
int [] param1 = [5, 25, 91, 61, 8, 41, 76, 89, 42, 63];
int [] param2 = [68, 49, 44, 9, 13, 5... |
COST_BALANCE_PARANTHESES | static int f_filled ( String s ) {
if ( s . length ( ) == 0 ) System . out . println ( 0 ) ;
int ans = 0 ;
int o = 0 , c = 0 ;
for ( int i = 0 ;
i < s . length ( ) ;
i ++ ) {
if ( s . charAt ( i ) == '(' ) o ++ ;
if ( s . charAt ( i ) == ')' ) c ++ ;
}
if ( o != c ) return - 1 ;
int [ ] a = ne... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [0, 4, -1, -1, 0, -1, 8, 3, 36, 36];
string [] param0 = ["()", "))((", "())", "(()", "(()()())", "))())(()(())", "))(())((", "49", "00001111", "kdahbyg "];
int n_success = 0;
for (int i... |
LARGEST_SUBARRAY_WITH_EQUAL_NUMBER_OF_0S_AND_1S | static int f_filled ( int arr [ ] , int n ) {
int sum = 0 ;
int maxsize = - 1 , startindex = 0 ;
int endindex = 0 ;
for ( int i = 0 ;
i < n - 1 ;
i ++ ) {
sum = ( arr [ i ] == 0 ) ? - 1 : 1 ;
for ( int j = i + 1 ;
j < n ;
j ++ ) {
if ( arr [ j ] == 0 ) sum += - 1 ;
else sum += 1 ... | 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 = [[56, 8, 67, 35, 19, 82, 81, 66, 10, 24, 82, 2, 42, 48, 18, 63, 48, 74, 60, 64, 64, 95, 95, 20, 95, 55, 63, 96, 54], [78, 67, 1, 78, 4... |
MULTIPLY_AN_INTEGER_WITH_3_5 | static int f_filled ( int x ) {
return ( x << 1 ) + x + ( x >> 1 ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [203, 56, 287, 115, 308, 178, 283, 133, 276, 311];
int [] param0 = [58, 16, 82, 33, 88, 51, 81, 38, 79, 89];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (resu... |
MINIMUM_SWAPS_REQUIRED_BRING_ELEMENTS_LESS_EQUAL_K_TOGETHER | static int f_filled ( int arr [ ] , int n , int k ) {
int count = 0 ;
for ( int i = 0 ;
i < n ;
++ i ) if ( arr [ i ] <= k ) ++ count ;
int bad = 0 ;
for ( int i = 0 ;
i < count ;
++ i ) if ( arr [ i ] > k ) ++ bad ;
int ans = bad ;
for ( int i = 0 , j = count ;
j < n ;
++ i , ++ j ) {
if ( ... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [0, 4, 0, 5, 0, 0, 0, 3, 0, 0];
int [] [] param0 = [[7, 12, 15, 30, 33, 34, 53, 66, 73, 74, 76, 77, 85, 90], [-62, -20, -26, -24, 92, 66, -74, -4, 18, -82, -36, 92, -4, 92, -80, 56, -24, 4, -48, ... |
PROGRAM_CALCULATE_VOLUME_OCTAHEDRON | static double f_filled ( double side ) {
return ( ( side * side * side ) * ( Math . sqrt ( 2 ) / 3 ) ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
double [] results = [17807230335.375374, -333508958.9649689, 263998930936.71603, -374202387762.81836, 216287285897.3415, -58885228987.99368, 439772223071.1617, -74883158892.28471, 141830229.25431916, -166494655500.36... |
COUNT_ARRAYS_CONSECUTIVE_ELEMENT_DIFFERENT_VALUES | static int f_filled ( int n , int k , int x ) {
int [ ] dp = new int [ 109 ] ;
dp [ 0 ] = 0 ;
dp [ 1 ] = 1 ;
for ( int i = 2 ;
i < n ;
i ++ ) dp [ i ] = ( k - 2 ) * dp [ i - 1 ] + ( k - 1 ) * dp [ i - 2 ] ;
return ( x == 1 ? ( k - 1 ) * dp [ n - 2 ] : dp [ n - 1 ] ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [0, 57, 14706, 1439671, 40690104, 214748365, 96855122, 699051, 0, 1];
int [] param0 = [1, 4, 7, 10, 13, 16, 19, 22, 25, 28];
int [] param1 = [10, 9, 8, 7, 6, 5, 4, 3, 2, 1];
int [] param2... |
COUNT_NUMBER_WAYS_REACH_GIVEN_SCORE_GAME | static int f_filled ( int n ) {
int table [ ] = new int [ n + 1 ] , i ;
Arrays . fill ( table , 0 ) ;
table [ 0 ] = 1 ;
for ( i = 3 ;
i <= n ;
i ++ ) table [ i ] += table [ i - 3 ] ;
for ( i = 5 ;
i <= n ;
i ++ ) table [ i ] += table [ i - 5 ] ;
for ( i = 10 ;
i <= n ;
i ++ ) table [ i ] += tabl... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [30, 4, 1, 1, 37, 16, 33, 27, 2, 10];
int [] param0 = [83, 29, 17, 12, 93, 55, 97, 75, 22, 52];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i] == f_f... |
POSITION_OF_RIGHTMOST_SET_BIT_1 | static int f_filled ( int n ) {
int position = 1 ;
int m = 1 ;
while ( ( n & m ) == 0 ) {
m = m << 1 ;
position ++ ;
}
return position ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [1, 1, 1, 3, 2, 3, 4, 2, 1, 1];
int [] param0 = [17, 97, 73, 68, 6, 84, 72, 66, 57, 11];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i] == f_filled(p... |
COUNT_BINARY_STRINGS_K_TIMES_APPEARING_ADJACENT_TWO_SET_BITS | static int f_filled ( int n , int k ) {
int dp [ ] [ ] [ ] = new int [ n + 1 ] [ k + 1 ] [ 2 ] ;
dp [ 1 ] [ 0 ] [ 0 ] = 1 ;
dp [ 1 ] [ 0 ] [ 1 ] = 1 ;
for ( int i = 2 ;
i <= n ;
i ++ ) {
for ( int j = 0 ;
j < i && j < k + 1 ;
j ++ ) {
dp [ i ] [ j ] [ 0 ] = dp [ i - 1 ] [ j ] [ 0 ] + dp [ ... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [0, 72495581, 0, 0, 0, 4221018, 0, 0, 0, 0];
int [] param0 = [29, 40, 77, 9, 29, 94, 51, 46, 18, 86];
int [] param1 = [85, 25, 96, 91, 80, 85, 87, 62, 96, 86];
int n_success = 0;
fo... |
FIND_A_TRIPLET_THAT_SUM_TO_A_GIVEN_VALUE_2 | static boolean f_filled ( int A [ ] , int arr_size , int sum ) {
for ( int i = 0 ;
i < arr_size - 2 ;
i ++ ) {
HashSet < Integer > s = new HashSet < Integer > ( ) ;
int curr_sum = sum - A [ i ] ;
for ( int j = i + 1 ;
j < arr_size ;
j ++ ) {
if ( s . contains ( curr_sum - A [ j ] )) {
... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
bool [] results = [true, true, false, false, false, true, false, true, false, false];
int [] [] param0 = [[1, 6, 8, 8, 9, 11, 13, 13, 15, 17, 21, 24, 38, 38, 42, 43, 46, 46, 47, 54, 55, 56, 57, 58, 60, 60, 60, 62... |
COUNT_CHARACTERS_POSITION_ENGLISH_ALPHABETS | static int f_filled ( 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 ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [0, 3, 1, 3, 2, 0, 1, 3, 0, 0];
string [] param0 = ["llkhfezgcb", "abced", "geeksforgeeks", "alphabetical", "abababab", "bcdefgxyz", "cbzaqx l", " bcd", "11", "mqqky"];
int n_success = 0;
... |
MINIMUM_NUMBER_SUBSETS_DISTINCT_ELEMENTS | static int f_filled ( int ar [ ] , int n ) {
int res = 0 ;
Arrays . sort ( ar ) ;
for ( int i = 0 ;
i < n ;
i ++ ) {
int count = 1 ;
for ( ;
i < n - 1 ;
i ++ ) {
if ( ar [ i ] == ar [ i + 1 ] ) count ++ ;
else break ;
}
res = Math . max ( res , count ) ;
}
return res ;
... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [2, 3, 27, 3, 2, 22, 1, 3, 3, 2];
int [] [] param0 = [[1, 2, 5, 8, 16, 21, 21, 22, 23, 26, 26, 27, 27, 29, 31, 33, 36, 37, 37, 38, 42, 45, 47, 50, 57, 58, 60, 60, 62, 63, 66, 66, 76, 84, 84, 88, ... |
COUNT_CHARACTERS_STRING_DISTANCE_ENGLISH_ALPHABETS | static int f_filled ( String str ) {
int result = 0 ;
int n = str . length ( ) ;
for ( int i = 0 ;
i < n ;
i ++ ) for ( int j = i + 1 ;
j < n ;
j ++ ) if ( Math . abs ( str . charAt ( i ) - str . charAt ( j ) ) == Math . abs ( i - j ) ) result ++ ;
return result ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [2, 3, 0, 0, 7, 1, 3, 1, 1, 2];
string [] param0 = ["smnkl", "270083", "0", "kczdsz", "483544224", "000011", "wysgcirmwkbzp", "3366", "110", "nlamkpcjugg"];
int n_success = 0;
for (int ... |
COUNT_DERANGEMENTS_PERMUTATION_SUCH_THAT_NO_ELEMENT_APPEARS_IN_ITS_ORIGINAL_POSITION_1 | static int f_filled ( int n ) {
int der [ ] = new int [ n + 1 ] ;
der [ 0 ] = 1 ;
der [ 1 ] = 0 ;
der [ 2 ] = 1 ;
for ( int i = 3 ;
i <= n ;
++ i ) der [ i ] = ( i - 1 ) * ( der [ i - 1 ] + der [ i - 2 ] ) ;
return der [ n ] ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [2, 9, 44, 265, 1854, 14833, 133496, 1334961, 14684570, 176214841];
int [] param0 = [3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
... |
NUMBER_WAYS_NODE_MAKE_LOOP_SIZE_K_UNDIRECTED_COMPLETE_CONNECTED_GRAPH_N_NODES | static int f_filled ( int n , int k ) {
int p = 1 ;
if ( k % 2 != 0 ) p = - 1 ;
return ( int ) ( Math . pow ( n - 1 , k ) + p * ( n - 1 ) ) / n ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [1439670, 1, 456, 14707, 5, 0, 11, 6, 8138020, 657];
int [] param0 = [7, 2, 9, 8, 6, 10, 12, 4, 6, 10];
int [] param1 = [9, 8, 4, 6, 2, 1, 2, 3, 11, 4];
int n_success = 0;
for (int ... |
FIND_SUBARRAY_WITH_GIVEN_SUM | static int f_filled ( int arr [ ] , int n , int sum ) {
int curr_sum , i , j ;
for ( i = 0 ;
i < n ;
i ++ ) {
curr_sum = arr [ i ] ;
for ( j = i + 1 ;
j <= n ;
j ++ ) {
if ( curr_sum == sum ) {
int p = j - 1 ;
System . out . println ( "Sum found between indexes " + i + " an... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [0, 0, 0, 0, 0, 0, 1, 0, 0, 0];
int [] [] param0 = [[4, 8, 8, 10, 15, 18, 19, 22, 25, 26, 30, 32, 35, 36, 40, 41, 43, 48, 53, 57, 59, 63, 64, 68, 71, 76, 76, 77, 78, 89, 96, 97], [-78, 16, -16, -... |
COUNT_DISTINCT_NON_NEGATIVE_PAIRS_X_Y_SATISFY_INEQUALITY_XX_YY_N_2_1 | static int f_filled ( int n ) {
int x = 0 , yCount , res = 0 ;
for ( yCount = 0 ;
yCount * yCount < n ;
yCount ++ ) ;
while ( yCount != 0 ) {
res += yCount ;
x ++ ;
while ( yCount != 0 && ( x * x + ( yCount - 1 ) * ( yCount - 1 ) >= n ) ) yCount -- ;
}
return res ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [64, 69, 83, 30, 41, 37, 71, 17, 71, 86];
int [] param0 = [72, 75, 92, 30, 45, 40, 81, 17, 81, 99];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i] ==... |
FIND_SUM_NODES_GIVEN_PERFECT_BINARY_TREE_1 | static double f_filled ( int l ) {
double leafNodeCount = Math . pow ( 2 , l - 1 ) ;
double sumLastLevel = 0 ;
sumLastLevel = ( leafNodeCount * ( leafNodeCount + 1 ) ) / 2 ;
double sum = sumLastLevel * l ;
return sum ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
double [] results = [680.0, 8590196736.0, 66048.0, 4.0541453871439934e+37, 2.4507641172284386e+36, 1.0535906843452986e+54, 1.82391348669623e+41, 6.079859587547136e+16, 6.0230643559004e+35, 1.0154976884767503e+26];
... |
COUNT_DISTINCT_OCCURRENCES_AS_A_SUBSEQUENCE | static int f_filled ( String S , String T ) {
int m = T . length ( ) ;
int n = S . length ( ) ;
if ( m > n ) return 0 ;
int mat [ ] [ ] = new int [ m + 1 ] [ n + 1 ] ;
for ( int i = 1 ;
i <= m ;
i ++ ) mat [ i ] [ 0 ] = 0 ;
for ( int j = 0 ;
j <= n ;
j ++ ) mat [ 0 ] [ j ] = 1 ;
for ( int i = 1 ;
... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [3, 2, 20, 0, 2, 0, 1, 4, 6, 1];
string [] param0 = ["banana", "49597223", "1000010000011", "btlzufk", "3474007", "0010", "dkhhotd", "9123259723", "11001000111110", "iy wjliz"];
string [] par... |
COUNT_ENTRIES_EQUAL_TO_X_IN_A_SPECIAL_MATRIX | static int f_filled ( int n , int x ) {
int f_filled = 0 ;
for ( int i = 1 ;
i <= n && i <= x ;
i ++ ) {
if ( x / i <= n && x % i == 0 ) f_filled ++ ;
}
return f_filled ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [8, 5, 4, 0, 3, 5, 4, 6, 0, 5];
int [] param0 = [47, 57, 55, 11, 55, 63, 64, 28, 49, 48];
int [] param1 = [30, 16, 63, 23, 49, 64, 98, 30, 61, 64];
int n_success = 0;
for (int i = 0... |
COUNT_EVEN_LENGTH_BINARY_SEQUENCES_WITH_SAME_SUM_OF_FIRST_AND_SECOND_HALF_BITS_1 | static int f_filled ( int n ) {
int nCr = 1 , res = 1 ;
for ( int r = 1 ;
r <= n ;
r ++ ) {
nCr = ( nCr * ( n + 1 - r ) ) / r ;
res += nCr * nCr ;
}
return res ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [2, 6, 20, 70, 252, 924, 3432, 12870, 48620, 184756, 705432, 2704156, 10400600, 40116600, 155117520, 601080390];
int [] param0 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16];
int ... |
MAXIMUM_NUMBER_SEGMENTS_LENGTHS_B_C | static int f_filled ( int n , int a , int b , int c ) {
int dp [ ] = new int [ n + 10 ] ;
Arrays . fill ( dp , - 1 ) ;
dp [ 0 ] = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
if ( dp [ i ] != - 1 ) {
if ( i + a <= n ) dp [ i + a ] = Math . max ( dp [ i ] + 1 , dp [ i + a ] ) ;
if ( i + b <= n ) dp... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [1, -1, 32, -1, -1, -1, 2, 7, -1, -1];
int [] param0 = [23, 62, 32, 82, 94, 44, 4, 53, 9, 23];
int [] param1 = [16, 76, 46, 48, 99, 21, 57, 23, 55, 15];
int [] param2 = [23, 81, 1, 72, 62... |
COUNT_FACTORIAL_NUMBERS_IN_A_GIVEN_RANGE | static int f_filled ( 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 ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [0, 0, 0, 0, 0, 0, 0, 2, 0, 0];
int [] param0 = [57, 57, 31, 62, 49, 82, 31, 5, 76, 55];
int [] param1 = [79, 21, 37, 87, 98, 76, 45, 52, 43, 6];
int n_success = 0;
for (int i = 0; ... |
COUNT_FIBONACCI_NUMBERS_GIVEN_RANGE_LOG_TIME | static int f_filled ( int low , int high ) {
int f1 = 0 , f2 = 1 , f3 = 1 ;
int result = 0 ;
while ( f1 <= high ) {
if ( f1 >= low ) result ++ ;
f1 = f2 ;
f2 = f3 ;
f3 = f1 + f2 ;
}
return result ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [0, 0, 3, 0, 0, 0, 0, 1, 6, 0];
int [] param0 = [76, 96, 19, 36, 60, 20, 76, 63, 2, 41];
int [] param1 = [43, 52, 79, 2, 11, 15, 4, 93, 25, 39];
int n_success = 0;
for (int i = 0; i... |
MINIMUM_SUM_TWO_NUMBERS_FORMED_DIGITS_ARRAY_2 | static int f_filled ( int a [ ] , int n ) {
Arrays . sort ( a ) ;
int num1 = 0 ;
int num2 = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
if ( i % 2 == 0 ) num1 = num1 * 10 + a [ i ] ;
else num2 = num2 * 10 + a [ i ] ;
}
return num2 + num1 ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [372, -1977127, 1, 95, -1149, 122222222, 108, -49, 12, 625];
int [] [] param0 = [[4, 1, 2, 3, 3, 8], [-9, -5, -8, 4, -1, -6, -8, -9, -8, -1, -2, -8], [0, 1], [7, 1, 7, 8], [-7, -4, -4, -2, 8, 3],... |
COUNT_FREQUENCY_K_MATRIX_SIZE_N_MATRIXI_J_IJ | static int f_filled ( int n , int k ) {
if ( n + 1 >= k ) return ( k - 1 ) ;
else return ( 2 * n + 1 - k ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [73, 35, 37, 70, -6, -30, 79, 74, 57, -19];
int [] param0 = [90, 86, 92, 72, 25, 11, 94, 91, 66, 34];
int [] param1 = [74, 36, 38, 71, 57, 53, 80, 75, 58, 88];
int n_success = 0;
fo... |
COUNT_NEGATIVE_NUMBERS_IN_A_COLUMN_WISE_ROW_WISE_SORTED_MATRIX_1 | static int f_filled ( int M [ ] [ ] , int n , int m ) {
int count = 0 ;
int i = 0 ;
int j = m - 1 ;
while ( j >= 0 && i < n ) {
if ( M [ i ] [ j ] < 0 ) {
count += j + 1 ;
i += 1 ;
}
else j -= 1 ;
}
return count ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [309, 1, 454, 0, 60, 20, 185, 63, 191, 295];
int [] [] [] param0 = [[[-43, -43, -39, -38, -36, -26, -25, -22, -12, -12, -11, -4, -3, 2, 3, 4, 18, 19, 25, 26, 27, 31, 31, 33, 33, 36, 42, 44, 47], ... |
COUNT_INDEX_PAIRS_EQUAL_ELEMENTS_ARRAY | static int f_filled ( int arr [ ] , int n ) {
int ans = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) for ( int j = i + 1 ;
j < n ;
j ++ ) if ( arr [ i ] == arr [ j ] ) ans ++ ;
return ans ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [1, 0, 0, 0, 0, 16, 0, 0, 61, 3];
int [] [] param0 = [[4, 6, 9, 16, 16, 21, 36, 41, 58, 60, 62, 73, 77, 81, 95], [-86, -72, -26, -34, 18, -62, -66], [1], [16], [-88, -80, -72, -68, -64, -26, 4, 1... |
PROGRAM_BINARY_DECIMAL_CONVERSION_1 | static int f_filled ( String n ) {
String num = n ;
int dec_value = 0 ;
int base = 1 ;
int len = num . length ( ) ;
for ( int i = len - 1 ;
i >= 0 ;
i -- ) {
if ( num . charAt ( i ) == '1' ) dec_value += base ;
base = base * 2 ;
}
return dec_value ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [0, 20, 154, 0, 130, 61, 0, 0, 1, 0];
string [] param0 = ["uemiagf", "753310137", "010011010", "kni", "04562016903312", "000111101", "bk", "9", "1", "xxt nxllk"];
int n_success = 0;
for... |
COUNT_INDEX_PAIRS_EQUAL_ELEMENTS_ARRAY_1 | static int f_filled ( int arr [ ] , int n ) {
HashMap < Integer , Integer > hm = new HashMap < > ( ) ;
for ( int i = 0 ;
i < n ;
i ++ ) {
if ( hm . containsKey ( arr [ i ] ) ) hm . put ( arr [ i ] , hm . get ( arr [ i ] ) + 1 ) ;
else hm . put ( arr [ i ] , 1 ) ;
}
int ans = 0 ;
for ( Map . Entry ... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [0, 2, 56, 0, 4, 0, 2, 2, 211, 0];
int [] [] param0 = [[5, 11, 18, 22, 40, 46, 50, 51, 53, 55, 64, 67, 73, 78, 86], [14, -98, 98, 58, -82, 90, -80, -56, -30, -36, -56, -30, -58, 68, 72, -76, 38, ... |
FIND_WHETHER_GIVEN_INTEGER_POWER_3_NOT | static boolean f_filled ( int n ) {
return 1162261467 % n == 0 ;
} | 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, 27, 9, -9, 11, 57, 21, 60, 44];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
... |
PIZZA_CUT_PROBLEM_CIRCLE_DIVISION_LINES | static int f_filled ( int n ) {
return 1 + n * ( n + 1 ) / 2 ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [1082, 2347, 11, 79, 1597, 106, 3322, 436, 352, 821];
int [] param0 = [46, 68, 4, 12, 56, 14, 81, 29, 26, 40];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (re... |
COUNT_INVERSIONS_OF_SIZE_THREE_IN_A_GIVE_ARRAY_1 | static int f_filled ( int arr [ ] , int n ) {
int invcount = 0 ;
for ( int i = 0 ;
i < n - 1 ;
i ++ ) {
int small = 0 ;
for ( int j = i + 1 ;
j < n ;
j ++ ) if ( arr [ i ] > arr [ j ] ) small ++ ;
int great = 0 ;
for ( int j = i - 1 ;
j >= 0 ;
j -- ) if ( arr [ i ] < arr [ j ] ) ... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [0, 404, 0, 37, 0, 0, 0, 20, 0, 43];
int [] [] param0 = [[4, 75, 89], [84, -66, -52, 34, -28, -6, 20, 22, -78, -26, 14, 24, -92, -18, 32, -94, -64, -38, 56, 4, -10, 58, -66, -58, -10, -8, -62, -6... |
COUNT_MINIMUM_NUMBER_SUBSETS_SUBSEQUENCES_CONSECUTIVE_NUMBERS | static int f_filled ( int arr [ ] , int n ) {
Arrays . sort ( arr ) ;
int count = 1 ;
for ( int i = 0 ;
i < n - 1 ;
i ++ ) {
if ( arr [ i ] + 1 != arr [ i + 1 ] ) count ++ ;
}
return count ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [37, 31, 2, 35, 45, 44, 32, 44, 30, 37];
int [] [] param0 = [[3, 7, 7, 11, 14, 14, 14, 16, 17, 17, 21, 22, 24, 27, 27, 27, 31, 33, 35, 36, 36, 37, 38, 43, 45, 49, 52, 54, 57, 59, 59, 60, 67, 73, ... |
FIND_WHETHER_A_GIVEN_NUMBER_IS_A_POWER_OF_4_OR_NOT | static int f_filled ( int n ) {
if ( n == 0 ) return 0 ;
while ( n != 1 ) {
if ( n % 4 != 0 ) return 0 ;
n = n / 4 ;
}
return 1 ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [0, 1, 0, 0, 0, 0, 0, 0, 0, 0];
int [] param0 = [45, 16, 15, 91, 82, 18, 31, 6, 93, 35];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i] == f_filled(p... |
COUNT_NATURAL_NUMBERS_WHOSE_PERMUTATION_GREATER_NUMBER | static int f_filled ( int n ) {
int result = 0 ;
for ( int i = 1 ;
i <= 9 ;
i ++ ) {
Stack < Integer > s = new Stack < > ( ) ;
if ( i <= n ) {
s . push ( i ) ;
result ++ ;
}
while ( ! s . empty ( ) ) {
int tp = s . peek ( ) ;
s . pop ( ) ;
for ( int j = tp % 10 ;
... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [48, 48, 52, 7, 45, 28, 20, 31, 27, 18];
int [] param0 = [69, 72, 88, 7, 66, 34, 23, 37, 33, 21];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i] == f... |
MINIMUM_COST_FOR_ACQUIRING_ALL_COINS_WITH_K_EXTRA_COINS_ALLOWED_WITH_EVERY_COIN | static int f_filled ( int coin [ ] , int n , int k ) {
Arrays . sort ( coin ) ;
int coins_needed = ( int ) Math . ceil ( 1.0 * n / ( k + 1 ) ) ;
int ans = 0 ;
for ( int i = 0 ;
i <= coins_needed - 1 ;
i ++ ) ans += coin [ i ] ;
return ans ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [6, -98, 0, 1, -98, 0, 5, -160, 0, 23];
int [] [] param0 = [[2, 4, 5, 9, 10, 10, 11, 14, 15, 19, 21, 22, 29, 36, 36, 38, 39, 39, 39, 41, 41, 42, 45, 45, 48, 55, 56, 57, 64, 66, 66, 66, 66, 69, 74... |
COUNT_NEGATIVE_NUMBERS_IN_A_COLUMN_WISE_ROW_WISE_SORTED_MATRIX | static int f_filled ( int M [ ] [ ] , int n , int m ) {
int count = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
for ( int j = 0 ;
j < m ;
j ++ ) {
if ( M [ i ] [ j ] < 0 ) count += 1 ;
else break ;
}
}
return count ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [383, 121, 84, 186, 258, 277, 643, 143, 130, 825];
int [] [] [] param0 = [[[-46, -39, -32, -31, -25, -24, -22, -21, -19, -19, -9, -4, -4, 5, 7, 10, 10, 17, 19, 20, 21, 26, 29, 29, 29, 30, 32, 32,... |
POLICEMEN_CATCH_THIEVES | static int f_filled ( char arr [ ] , int n , int k ) {
int res = 0 ;
ArrayList < Integer > thi = new ArrayList < Integer > ( ) ;
ArrayList < Integer > pol = new ArrayList < Integer > ( ) ;
for ( int i = 0 ;
i < n ;
i ++ ) {
if ( arr [ i ] == 'P' ) pol . add ( i ) ;
else if ( arr [ i ] == 'T' ) thi .... | 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, 1];
char [] [] param0 = [['a', 'b', 'b', 'd', 'e', 'e', 'f', 'g', 'g', 'g', 'i', 'j', 'o', 'p', 'q', 'q', 'q', 'q', 'r', 'r', 's', 'u', 'x', 'y', 'y', 'c', 'd', 'h', '... |
COUNT_PALINDROMIC_SUBSEQUENCE_GIVEN_STRING | static int f_filled ( String str ) {
int N = str . length ( ) ;
int [ ] [ ] cps = new int [ N + 1 ] [ N + 1 ] ;
for ( int i = 0 ;
i < N ;
i ++ ) cps [ i ] [ i ] = 1 ;
for ( int L = 2 ;
L <= N ;
L ++ ) {
for ( int i = 0 ;
i < N ;
i ++ ) {
int k = L + i - 1 ;
if ( k < N ) {
... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [1, 10, 2798, 20, 2, 270, 8, 2, 563, 3];
string [] param0 = ["r", "2956350", "11100111110101", "tztdliifad", "98", "1100100001", "okwgeatf", "19", "00010110100", "cyq"];
int n_success = 0;
... |
COUNT_NUMBERS_CAN_CONSTRUCTED_USING_TWO_NUMBERS | static int f_filled ( int n , int x , int y ) {
boolean [ ] arr = new boolean [ n + 1 ] ;
if ( x <= n ) arr [ x ] = true ;
if ( y <= n ) arr [ y ] = true ;
int result = 0 ;
for ( int i = Math . min ( x , y ) ;
i <= n ;
i ++ ) {
if ( arr [ i ] ) {
if ( i + x <= n ) arr [ i + x ] = true ;
if... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [1, 9, 30, 1, 0, 2, 0, 4, 13, 1];
int [] param0 = [23, 56, 30, 51, 21, 69, 12, 44, 99, 46];
int [] param1 = [16, 95, 63, 89, 99, 63, 69, 52, 65, 58];
int [] param2 = [16, 6, 1, 46, 38, 50... |
HOW_CAN_WE_SUM_THE_DIGITS_OF_A_GIVEN_NUMBER_IN_SINGLE_STATEMENT_1 | static int f_filled ( int n ) {
int sum ;
for ( sum = 0 ;
n > 0 ;
sum += n % 10 , n /= 10 ) ;
return sum ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [5, 11, 13, 13, 7, 3, 16, 17, 13, 5];
int [] param0 = [50, 92, 49, 94, 7, 30, 88, 98, 94, 23];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i] == f_fi... |
COUNT_NUMBERS_THAT_DONT_CONTAIN_3 | static int f_filled ( int n ) {
if ( n < 3 ) return n ;
if ( n >= 3 && n < 10 ) return n - 1 ;
int po = 1 ;
while ( n / po > 9 ) po = po * 10 ;
int msd = n / po ;
if ( msd != 3 ) return f_filled ( msd ) * f_filled ( po - 1 ) + f_filled ( msd ) + f_filled ( n % po ) ;
else return f_filled ( msd * po - 1 ) ... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [67, 68, 2, 26, 44, 26, 26, 13, 58, 57];
int [] param0 = [85, 86, 3, 35, 59, 38, 33, 15, 75, 74];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
if (results[i] == f... |
COUNT_NUMBER_BINARY_STRINGS_WITHOUT_CONSECUTIVE_1S | static int f_filled ( int n ) {
int a [ ] = new int [ n ] ;
int b [ ] = new int [ n ] ;
a [ 0 ] = b [ 0 ] = 1 ;
for ( int i = 1 ;
i < n ;
i ++ ) {
a [ i ] = a [ i - 1 ] + b [ i - 1 ] ;
b [ i ] = a [ i - 1 ] ;
}
return a [ n - 1 ] + b [ n - 1 ] ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [5, 13, 144, 1597, 17711, 196418, 2178309, 24157817, 267914296, 433494437, 1134903170];
int [] param0 = [3, 5, 10, 15, 20, 25, 30, 35, 40, 41, 43];
int n_success = 0;
for (int i = 0; i ... |
HOW_TO_TURN_OFF_A_PARTICULAR_BIT_IN_A_NUMBER | static int f_filled ( int n , int k ) {
if ( k <= 0 ) return n ;
return ( n & ~ ( 1 << ( k - 1 ) ) ) ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [49, 59, 76, 27, 61, 67, 63, 85, 26, 16];
int [] param0 = [49, 59, 76, 27, 61, 67, 63, 85, 90, 24];
int [] param1 = [31, 28, 25, 22, 19, 16, 13, 10, 7, 4];
int n_success = 0;
for (i... |
COUNT_NUMBER_OF_SOLUTIONS_OF_X2_1_MOD_P_IN_GIVEN_RANGE | static int f_filled ( int n , int p ) {
int ans = 0 ;
for ( int x = 1 ;
x < p ;
x ++ ) {
if ( ( x * x ) % p == 1 ) {
int last = x + p * ( n / p ) ;
if ( last > n ) last -= p ;
ans += ( ( last - x ) / p + 1 ) ;
}
}
return ans ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [11, 1, 6, 4, 1, 11, 3, 17, 1, 9];
int [] param0 = [94, 11, 88, 85, 74, 96, 49, 50, 21, 81];
int [] param1 = [36, 79, 63, 43, 89, 33, 51, 24, 26, 19];
int n_success = 0;
for (int i ... |
FIND_THE_NUMBER_OCCURRING_ODD_NUMBER_OF_TIMES_1 | static int f_filled ( int arr [ ] , int n ) {
HashMap < Integer , Integer > hmap = new HashMap < > ( ) ;
for ( int i = 0 ;
i < n ;
i ++ ) {
if ( hmap . containsKey ( arr [ i ] ) ) {
int val = hmap . get ( arr [ i ] ) ;
hmap . put ( arr [ i ] , val + 1 ) ;
}
else hmap . put ( arr [ i ] , ... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [49, -96, 0, 79, -90, 1, 2, 86, 0, 11];
int [] [] param0 = [[49, 90], [-96, 94, 92, -24, 48, 54, -30, -86, 28, -18, 12, -64, -36, 68, 68, -78, -6, 30, -84, 20, 52, -36, 40, -62, 90, -48, 86, 98, ... |
COUNT_NUMBER_OF_WAYS_TO_FILL_A_N_X_4_GRID_USING_1_X_4_TILES | static int f_filled ( 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 ] ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [188941273, 657, 685792227, 52054840, 59864, 1728, 95, 2385, 5453761, 3];
int [] param0 = [61, 22, 65, 57, 36, 25, 16, 26, 50, 5];
int n_success = 0;
for (int i = 0; i < param0.length; ... |
ELEMENTS_TO_BE_ADDED_SO_THAT_ALL_ELEMENTS_OF_A_RANGE_ARE_PRESENT_IN_ARRAY | static int f_filled ( int [ ] arr , int n ) {
int count = 0 ;
Arrays . sort ( arr ) ;
for ( int i = 0 ;
i < n - 1 ;
i ++ ) if ( arr [ i ] != arr [ i + 1 ] && arr [ i ] != arr [ i + 1 ] - 1 ) count += arr [ i + 1 ] - arr [ i ] - 1 ;
return count ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [62, 168, 0, 69, 146, 0, 54, 161, 0, 33];
int [] [] param0 = [[4, 4, 5, 7, 7, 9, 13, 15, 18, 19, 25, 27, 27, 29, 32, 36, 48, 51, 53, 53, 55, 65, 66, 67, 72, 74, 74, 76, 77, 79, 80, 81, 82, 83, 83... |
COUNT_NUMBER_OF_WAYS_TO_PARTITION_A_SET_INTO_K_SUBSETS_1 | static int f_filled ( int n , int k ) {
int [ ] [ ] dp = new int [ n + 1 ] [ k + 1 ] ;
for ( int i = 0 ;
i <= n ;
i ++ ) dp [ i ] [ 0 ] = 0 ;
for ( int i = 0 ;
i <= k ;
i ++ ) dp [ 0 ] [ k ] = 0 ;
for ( int i = 1 ;
i <= n ;
i ++ ) for ( int j = 1 ;
j <= k ;
j ++ ) if ( j == 1 || i == j ) dp [ i ... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [171798901, 9330, 1, 0, 512060978, 78, 1];
int [] param0 = [16, 10, 6, 9, 17, 13, 14];
int [] param1 = [4, 3, 1, 10, 11, 12, 14];
int n_success = 0;
for (int i = 0; i < param0.lengt... |
PERFECT_REVERSIBLE_STRING | static boolean f_filled ( String str ) {
int i = 0 , j = str . length ( ) - 1 ;
while ( i < j ) {
if ( str . charAt ( i ) != str . charAt ( j ) ) return false ;
i ++ ;
j -- ;
}
return true ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
bool [] results = [false, true, false, true, true, true, false, false, false, true];
string [] param0 = ["ab", "303", "11110000", "aba", "404", "10101", "abab", "6366", "001", ""];
int n_success = 0;
fo... |
FIND_THREE_ELEMENT_FROM_DIFFERENT_THREE_ARRAYS_SUCH_THAT_THAT_A_B_C_K | static boolean f_filled ( 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 ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
bool [] results = [false, false, true, true, true, true, false, false, false, false];
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], [-... |
COUNT_NUMBER_WAYS_TILE_FLOOR_SIZE_N_X_M_USING_1_X_M_SIZE_TILES | static int f_filled ( 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 ] ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [41, 131, 1, 1, 90, 1, 89625, 6, 11, 1578];
int [] param0 = [93, 17, 38, 33, 78, 40, 95, 12, 69, 78];
int [] param1 = [54, 4, 39, 64, 35, 61, 16, 8, 60, 21];
int n_success = 0;
for ... |
COUNT_OFDIFFERENT_WAYS_EXPRESS_N_SUM_1_3_4 | static int f_filled ( int n ) {
int DP [ ] = new int [ n + 1 ] ;
DP [ 0 ] = DP [ 1 ] = DP [ 2 ] = 1 ;
DP [ 3 ] = 2 ;
for ( int i = 4 ;
i <= n ;
i ++ ) DP [ i ] = DP [ i - 1 ] + DP [ i - 3 ] + DP [ i - 4 ] ;
return DP [ n ] ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [821223649, 119814916, 6677056, 974169, 54289, 7921, 441, 64, 4];
int [] param0 = [44, 40, 34, 30, 24, 20, 14, 10, 4];
int n_success = 0;
for (int i = 0; i < param0.length; i++) {
... |
COUNT_OF_OCCURRENCES_OF_A_101_PATTERN_IN_A_STRING | static int f_filled ( String str ) {
int len = str . length ( ) ;
boolean oneSeen = false ;
int count = 0 ;
for ( int i = 0 ;
i < len ;
i ++ ) {
char getChar = str . charAt ( i ) ;
if ( getChar == '1' && oneSeen == true ) {
if ( str . charAt ( i - 1 ) == '0' ) count ++ ;
}
if ( getChar... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [2, 3, 3, 0, 0, 0, 0, 0, 0, 0];
string [] param0 = ["1001ab010abc01001", "1001010001", "010100010100", "dlcu", "7072430592", "011", "pnjpypyoza", "1037", "111", "hxk"];
int n_success = 0;
... |
MAXIMUM_REMOVAL_FROM_ARRAY_WHEN_REMOVAL_TIME_WAITING_TIME | static int f_filled ( int arr [ ] , int n ) {
int count = 0 ;
int cummulative_sum = 0 ;
Arrays . sort ( arr ) ;
for ( int i = 0 ;
i < n ;
i ++ ) {
if ( arr [ i ] >= cummulative_sum ) {
count ++ ;
cummulative_sum += arr [ i ] ;
}
}
return count ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [3, 5, 5, 3, 6, 11, 5, 6, 13, 5];
int [] [] param0 = [[7, 33, 34, 42, 42, 45, 73], [-98, -90, -80, -66, -64, -62, -48, -30, -20, -10, 4, 6, 12, 14, 32, 42, 44, 44, 52, 64, 86, 92, 94], [0, 0, 0, ... |
PROGRAM_PAGE_REPLACEMENT_ALGORITHMS_SET_2_FIFO | static int f_filled ( int pages [ ] , int n , int capacity ) {
HashSet < Integer > s = new HashSet < > ( capacity ) ;
Queue < Integer > indexes = new LinkedList < > ( ) ;
int page_faults = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
if ( s . size ( ) < capacity ) {
if ( ! s . contains ( pages [ i ] ) )... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [34, 30, 2, 13, 9, 2, 16, 25, 2, 15];
int [] [] param0 = [[4, 4, 6, 7, 8, 11, 13, 18, 26, 35, 36, 37, 45, 46, 46, 47, 48, 49, 51, 52, 53, 56, 61, 74, 75, 77, 80, 83, 85, 86, 87, 90, 93, 95, 97, 9... |
COUNT_OPERATIONS_MAKE_STRINGAB_FREE | static int f_filled ( char [ ] s ) {
int b_count = 0 ;
int res = 0 ;
for ( int i = 0 ;
i < s . length ;
i ++ ) {
if ( s [ s . length - i - 1 ] == 'a' ) {
res = ( res + b_count ) ;
b_count = ( b_count * 2 ) ;
}
else {
b_count += 1 ;
}
}
return res ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [0, 0, 0, 5, 0, 0, 0, 0, 0, 9];
char [] [] param0 = [['l', 'k', 'y'], ['1', '0', '9', '5', '7', '4', '6', '0', '4', '8', '0', '1', '4', '1', '8', '9', '1', '5', '4', '4', '8', '0', '5', '8', '9',... |
COUNT_PAIRS_DIFFERENCE_EQUAL_K | static int f_filled ( int arr [ ] , int n , int k ) {
int count = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
for ( int j = i + 1 ;
j < n ;
j ++ ) if ( arr [ i ] - arr [ j ] == k || arr [ j ] - arr [ i ] == k ) count ++ ;
}
return count ;
} | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [3, 0, 0, 3, 0, 0, 2, 0, 0, 3];
int [] [] param0 = [[9, 14, 17, 19, 22, 23, 23, 27, 30, 31, 34, 37, 37, 39, 39, 42, 57, 61, 68, 73, 77, 79, 91, 96, 97], [-78, -42, 28, -88, 18, -52], [0, 0, 0, 0,... |
COUNT_PAIRS_DIFFERENCE_EQUAL_K_1 | static int f_filled ( int arr [ ] , int n , int k ) {
int count = 0 ;
Arrays . sort ( arr ) ;
int l = 0 ;
int r = 0 ;
while ( r < n ) {
if ( arr [ r ] - arr [ l ] == k ) {
count ++ ;
l ++ ;
r ++ ;
}
else if ( arr [ r ] - arr [ l ] > k ) l ++ ;
else r ++ ;
}
return count ;... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [1, 14, 1, 3, 4, 1, 0, 0, 0, 0];
int [] [] param0 = [[5, 5, 10, 19, 29, 32, 40, 60, 65, 70, 72, 89, 92], [-98, -90, -88, -82, -80, -78, -74, -74, -72, -62, -58, -58, -56, -52, -48, -46, -38, -38,... |
FIND_NUMBER_TIMES_STRING_OCCURS_GIVEN_STRING_1 | static int f_filled ( 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 ++... | import std.stdio;
import std.math;
import std.conv;
import std.algorithm;
//TOFILL//
void main(){
int [] results = [0, 0, 6, 0, 2, 0, 1, 6, 35, 0];
string [] param0 = ["fzokcdz lav", "2", "1000001110", "iaoybzgiwho", "211806", "1", "cvaqtg", "6265187228", "10111101101000", "vei"];
string [] param1 = ["fka... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.