I am running the code but is showing error in second line, but when I am running the same code in python it is working.whats the problem here?
chefina=int(input("enter digit 1"))
Problem Link: GDTURN Problem - CodeChef
Hey uniyalansh05 , Welcome to CodeChef
The problem that you are solving includes a section named “Input Format”
If you read that properly you can understand what’s wrong with your code.
I specifies that the first line contains an integer t, which depicts the number of test cases, and the following t lines contain two integers.
You need to modify your code as follows:
t = int(input())
for i in range(t):
input_str = input().split() # This makes the input_str a list which contains two elements, X and Y
chef = int(input_str) # The first integer is for chef
chefina = int(input_str) # The Second integer is for chefina
# Add the rest of the logic inside the for loop.
If you want to simplify, the process of taking input, you can also use the following code.
for _ in range(int(input)):
chef, chefina = map(int, input().split())
# Rest of your code