Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

import sys
import os
import math

for s in sys.stdin:
    n = int(s)

    T = [0] * 2001
    for a in range(1001):
        for b in range(1001):
            T[a+b] += 1

    sum_n_num = 0
    for a_b_sum in range(0, n+1):
        c_d_sum = n - a_b_sum
        sum_n_num += T[a_b_sum] * T[c_d_sum]

    print(sum_n_num)

Fixed submission:
# -*- coding: utf-8 -*-

import sys
import os
import math

T = [0] * 2001
for a in range(1001):
    for b in range(1001):
        T[a + b] += 1

for s in sys.stdin:
    n = int(s)

    sum_n_num = 0
    for a_b_sum in range(0, n+1):
        c_d_sum = n - a_b_sum
        if a_b_sum <= 2000 and c_d_sum <= 2000:
            sum_n_num += T[a_b_sum] * T[c_d_sum]

    print(sum_n_num)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

import sys
import os
import math

for s in sys.stdin:
    n = int(s)

    T = [0] * 2001
    for a in range(1001):
        for b in range(1001):
            T[a+b] += 1

    sum_n_num = 0
    for a_b_sum in range(0, n+1):
        c_d_sum = n - a_b_sum
        if a_b_sum <= 2000 and c_d_sum <= 2000:
            sum_n_num += T[a_b_sum] * T[c_d_sum]

    print(sum_n_num)

Fixed submission:
# -*- coding: utf-8 -*-

import sys
import os
import math

T = [0] * 2001
for a in range(1001):
    for b in range(1001):
        T[a + b] += 1

for s in sys.stdin:
    n = int(s)

    sum_n_num = 0
    for a_b_sum in range(0, n+1):
        c_d_sum = n - a_b_sum
        if a_b_sum <= 2000 and c_d_sum <= 2000:
            sum_n_num += T[a_b_sum] * T[c_d_sum]

    print(sum_n_num)

Buggy python submission (verdict: Runtime Error):
for s in sys.stdin:
    n = int(s)

    T = [0] * 2001
    for a in range(1001):
        for b in range(1001):
            T[a+b] += 1

    sum_n_num = 0
    for a_b_sum in range(0, n+1):
        c_d_sum = n - a_b_sum
        if a_b_sum <= 2000 and c_d_sum <= 2000:
            sum_n_num += T[a_b_sum] * T[c_d_sum]

    print(sum_n_num)

Fixed submission:
# -*- coding: utf-8 -*-

import sys
import os
import math

T = [0] * 2001
for a in range(1001):
    for b in range(1001):
        T[a + b] += 1

for s in sys.stdin:
    n = int(s)

    sum_n_num = 0
    for a_b_sum in range(0, n+1):
        c_d_sum = n - a_b_sum
        if a_b_sum <= 2000 and c_d_sum <= 2000:
            sum_n_num += T[a_b_sum] * T[c_d_sum]

    print(sum_n_num)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

import sys
import os

for s in sys.stdin:
    n = int(s)

    T = [0] * 2001
    for a in range(1001):
        for b in range(1001):
            T[a+b] += 1

    sum_n_num = 0
    for a_b_sum in range(0, n+1):
        c_d_sum = n - a_b_sum
        if a_b_sum <= 2000 and c_d_sum <= 2000:
            sum_n_num += T[a_b_sum] * T[c_d_sum]

    print(sum_n_num)

Fixed submission:
# -*- coding: utf-8 -*-

import sys
import os
import math

T = [0] * 2001
for a in range(1001):
    for b in range(1001):
        T[a + b] += 1

for s in sys.stdin:
    n = int(s)

    sum_n_num = 0
    for a_b_sum in range(0, n+1):
        c_d_sum = n - a_b_sum
        if a_b_sum <= 2000 and c_d_sum <= 2000:
            sum_n_num += T[a_b_sum] * T[c_d_sum]

    print(sum_n_num)