can i use c-like arrays in python instead of lists as list are slow
Question: <http://www.hackerearth.com/problem/algorithm/little-deepu-and-array/>

This is the problem on above link which i solved using python. but as list are
slow i am not able to pass all test cases due to time constraint, whereas when
solved using arrays in c++, i passed all test cases.

**Python:**

    
    
    n=input()
    l=map(int,raw_input().split())
    m=input()
    for i in range(m):
        x=input()
        for j in range(n):
            if(l[j]>x):
                l[j]-=1
    for i in range(n):
        print l[i],
    

**C++:**

    
    
    int main() 
    {
        int n,numCalls,x,i,j;
        long int arr[1000000];
    
        cin>>n;
    
        for(i=0;i<n;i++)
            cin>>arr[i];
    
        cin>>numCalls;
        for(i=0;i<numCalls;i++)
        {
            cin>>x;
            for(j=0;j<n;j++)
                if(arr[j]>x)
                    arr[j]-=1;
        }
    
        for(i=0;i<n;i++)
            cout<<arr[i]<<" ";
    }
    

Can anyone solve this problem in python efficiently so that all test-cases can
be passed!!.


Answer: Here's your code with one change, initializing `l` with a Python array:

    
    
    import array
    
    n=input()
    l=array.array('l', map(int, raw_input().split()))
    m=input()
    for i in range(m):
        x=input()
        for j in range(n):
            if(l[j]>x):
                l[j]-=1
    for i in range(n):
        print l[i],
    

