def remove_dot(this_list,value):
while value in this_list:
this_list.remove(value)
def check(list2):
if(list2==[]):
return “Valid”
elif(list2[0]==‘T’ or list2[len(list2)-1]==‘H’):
return “Invalid”
else :
count=0
for i in range(0,len(list2)-1,2):
if(list2[i] is ‘H’ and list2[i+1] is ‘T’):
count+=1
if((count*2) is len(list2)):
return “Valid”
else :
return “Invalid”
R=int(input())
L=[]
str=[]
dot=’.’
ans=[]
for i in range(0,R):
L.append(int(input())) #for j in range(0,L[i]):
value=input()
list=[]
list[:0]=value
remove_dot(list,dot)
ans.append(check(list))
for i in range(0,R):
print(ans[i])
This is my python code i run in my machine it gives me right output but when i submit in SmackDown contest it tells wrong answer i am trying from 2 days
Nick is now a well settled person. Impressed by the coding skills of Nick, N girls wish to marry him. Nick will consider marriage proposals of only those girls who have some special qualities. Qualities are represented by positive non-zero integers.
Nick has a list of M qualities which he wants in a girl. He can also consider those girls who have some extra qualities, provided they have at least all those qualities which Nick wants.
Find how many girls’ proposal will Nick consider.
Input:
First line contains the integer M, denoting the number of qualities which Nick wants.
Next line contains M single space separated distinct integers.
Third line contains an integer N, denoting the number of girls.
Next follow N lines, ith line contains few single-space separated distinct integers, denoting the qualities of the ith girl.
Output:
Print the number of girls, whose proposals will be considered by Nick.
Constraints:
1 ≤ M ≤ 100
1 ≤ N ≤ 9 x 103
1 ≤ Maximum no. of qualities possessed by girls ≤ 1000.
Qualities are positive non-zero integers such that 1 ≤ Quality ≤ 104
Subtask 1: ( 30 points )
1 ≤ M ≤ 10
1 ≤ N ≤ 100
1 ≤ Maximum no. of qualities possessed by girls ≤ 100.
Qualities are positive non-zero integers such that 1 ≤ Quality ≤ 1000
Subtask 2: ( 70 points )
Original constraints
Sample Input:
5
1 2 3 4 5
3
1 2 3 4 5 6
1 2 3 4 5
1 2 3 4
Sample Output:
2
Nick is now a well settled person. Impressed by the coding skills of Nick, N girls wish to marry him. Nick will consider marriage proposals of only those girls who have some special qualities. Qualities are represented by positive non-zero integers.
Nick has a list of M qualities which he wants in a girl. He can also consider those girls who have some extra qualities, provided they have at least all those qualities which Nick wants.
Find how many girls’ proposal will Nick consider.
Input:
First line contains the integer M, denoting the number of qualities which Nick wants.
Next line contains M single space separated distinct integers.
Third line contains an integer N, denoting the number of girls.
Next follow N lines, ith line contains few single-space separated distinct integers, denoting the qualities of the ith girl.
Output:
Print the number of girls, whose proposals will be considered by Nick.
Constraints:
1 ≤ M ≤ 100
1 ≤ N ≤ 9 x 103
1 ≤ Maximum no. of qualities possessed by girls ≤ 1000.
Qualities are positive non-zero integers such that 1 ≤ Quality ≤ 104
Subtask 1: ( 30 points )
1 ≤ M ≤ 10
1 ≤ N ≤ 100
1 ≤ Maximum no. of qualities possessed by girls ≤ 100.
Qualities are positive non-zero integers such that 1 ≤ Quality ≤ 1000
Subtask 2: ( 70 points )
Original constraints
Sample Input:
5
1 2 3 4 5
3
1 2 3 4 5 6
1 2 3 4 5
1 2 3 4
Sample Output:
2
Nick is now a well settled person. Impressed by the coding skills of Nick, N girls wish to marry him. Nick will consider marriage proposals of only those girls who have some special qualities. Qualities are represented by positive non-zero integers.
Nick has a list of M qualities which he wants in a girl. He can also consider those girls who have some extra qualities, provided they have at least all those qualities which Nick wants.
Find how many girls’ proposal will Nick consider.
Input:
First line contains the integer M, denoting the number of qualities which Nick wants.
Next line contains M single space separated distinct integers.
Third line contains an integer N, denoting the number of girls.
Next follow N lines, ith line contains few single-space separated distinct integers, denoting the qualities of the ith girl.
Output:
Print the number of girls, whose proposals will be considered by Nick.
Constraints:
1 ≤ M ≤ 100
1 ≤ N ≤ 9 x 103
1 ≤ Maximum no. of qualities possessed by girls ≤ 1000.
Qualities are positive non-zero integers such that 1 ≤ Quality ≤ 104
Subtask 1: ( 30 points )
1 ≤ M ≤ 10
1 ≤ N ≤ 100
1 ≤ Maximum no. of qualities possessed by girls ≤ 100.
Qualities are positive non-zero integers such that 1 ≤ Quality ≤ 1000
Subtask 2: ( 70 points )
Original constraints
Sample Input:
5
1 2 3 4 5
3
1 2 3 4 5 6
1 2 3 4 5
1 2 3 4
Sample Output:
2
import java.util.Scanner;
public class A1 {
public static void main(String args[]){
Scanner input=new Scanner(System.in);
int t=input.nextInt();
int a[]=new int[t];
for(int i=0;i<t;i++) {
System.out.println("");
int n=input.nextInt();
int factorial=1;
for(int x=1;x<=n;x++){
factorial=factorial*x;
}
a[i]=factorial;
}
For Practice Survive
import java.util.;
import java.lang.;
import java.io.;
/ Name of the class has to be “Main” only if the class is public. /
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sx=new Scanner(System.in);
int t=sx.nextInt();
if(t<=100) {
for(int i=0;i<t;i++)
{
int n=sx.nextInt();
int k=sx.nextInt();
int s=sx.nextInt();
if(n<=100 && k<=100 && s<=1000)
{
int res=(n(s-(s/7)))-ks;
if(res<0)
{
System.out.println(“-1”);
}
else if(res==0)
{
System.out.println(s-(s/7));
}else{System.out.println(1+((ks)/n));}}}}sx.close();}}