ValueError: invalid literal for int() with base 10: ‘1,000,000,000’

By Abhi Ram

I want to perform operations on variables with below constraints

1 ≤ T ≤ 10,000

1 ≤ N, B ≤ 1,000,000,000
When i try using int() it gives the following error.

Traceback (most recent call last):
  File "./prog.py", line 3, in <module>
  File "./prog.py", line 3, in <listcomp>
ValueError: invalid literal for int() with base 10: '1,000,000,000'

My code:

t=int(input())
for i in range(t):
ts=[int(x) for x in input().split()]
n=ts[0]
b=ts[1]
max=0
x=n//b
for i in range(1,x+1):
    y=n-(b*i)
    y=y*i
    if(y>max):
        max=y
print(max)

Source: Stack Overflow

    

Share it with your friends!

    Fatal error: Uncaught Exception: 12: REST API is deprecated for versions v2.1 and higher (12) thrown in /home/content/19/9652219/html/wp-content/plugins/seo-facebook-comments/facebook/base_facebook.php on line 1273