TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: The development of algae in a pond is as follows.  Let the total weight of the algae at the beginning of the year i be x_i gram. For i≥2000, the following formula holds:    * x_{i+1} = rx_i - D  You are given r, D and x_{2000}. Calculate x_{2001}, ..., x_{2010} and print them in order.

Submission attempts (in order):
a, b = map(int, input().split())

if a>=13:
    print(b)
elif a >= 6:
    print(int(b / 2))
else:
    print(0)

r ,d ,x = map(int, input().split())

new_x = r * x - d
print(new_x) #2011
for i in range(2002, 2011):
    new_x = r * new_x - d
    print(new_x)

Verdicts: Runtime Error

Accepted
Problem: The development of algae in a pond is as follows.  Let the total weight of the algae at the beginning of the year i be x_i gram. For i≥2000, the following formula holds:    * x_{i+1} = rx_i - D  You are given r, D and x_{2000}. Calculate x_{2001}, ..., x_{2010} and print them in order.

Submission attempts (in order):
li = list(map(int,input().split()))
r = li[0]
D = li[1]
x2000 = li[2]
def a(x):
  return r * x - D

x2000 = a(x2000)
print(x2000)

li = list(map(int,input().split()))
r = li[0]
D = li[1]
x2000 = li[2]
def a(x):
  return r * x - D

for i in range(10):
  x2000 = a(x2000)
  print(x2000)

Verdicts: Wrong Answer

Accepted
Problem: The development of algae in a pond is as follows.  Let the total weight of the algae at the beginning of the year i be x_i gram. For i≥2000, the following formula holds:    * x_{i+1} = rx_i - D  You are given r, D and x_{2000}. Calculate x_{2001}, ..., x_{2010} and print them in order.

Submission attempts (in order):
r,d,x = map(int,input().split())
x_list = []
x_list.append(x)
for i in range(10):
    x_2 = r*x_list[i] -d
    x_list.append(x_2)

for i in range(10):
    print(x_list[i])


r,d,x = map(int,input().split())
x_list = []
x_list.append(x)
for i in range(11):
    x_2 = r*x_list[i] -d
    x_list.append(x_2)

for i in range(10):
    print(x_list[i+1])

Verdicts: Wrong Answer

Accepted
Problem: The development of algae in a pond is as follows.  Let the total weight of the algae at the beginning of the year i be x_i gram. For i≥2000, the following formula holds:    * x_{i+1} = rx_i - D  You are given r, D and x_{2000}. Calculate x_{2001}, ..., x_{2010} and print them in order.

Submission attempts (in order):
print(X[1])
print(X[2])
print(X[3])
print(X[4])
print(X[5])
print(X[6])
print(X[7])
print(X[8])
print(X[9])
print(X[10])

r,D,x = map(int,input().split())
X = [x]*11

for i in range(0,10):
  X[i+1] = r*X[i] - D
  
  
print(X[1:11])

r,D,x = map(int,input().split())
X = [x]*11

for i in range(0,10):
  X[i+1] = r*X[i] - D
  
  
print(X[1])
print(X[2])
print(X[3])
print(X[4])
print(X[5])
print(X[6])
print(X[7])
print(X[8])
print(X[9])
print(X[10])

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: The development of algae in a pond is as follows.  Let the total weight of the algae at the beginning of the year i be x_i gram. For i≥2000, the following formula holds:    * x_{i+1} = rx_i - D  You are given r, D and x_{2000}. Calculate x_{2001}, ..., x_{2010} and print them in order.

Submission attempts (in order):
r,d,x=map(int, input().split())
ans=x
for i in range(1,10):
    ans=r*ans-d
    print(ans)

r,d,x=map(int, input().split())
ans=x
for i in range(1,11):
    ans=r*ans-d
    print(ans)

Verdicts: Wrong Answer

Accepted
Problem: The development of algae in a pond is as follows.  Let the total weight of the algae at the beginning of the year i be x_i gram. For i≥2000, the following formula holds:    * x_{i+1} = rx_i - D  You are given r, D and x_{2000}. Calculate x_{2001}, ..., x_{2010} and print them in order.

Submission attempts (in order):

using namespace std;

int main()
{
    int I,d,r,x1,x2,x3,x4,x5 ,x6 ,x7 ,x9 ,x8 ,x10;
    cin >> I>> d>>r;
    x1=r*I-d;
    x2=r*x1-d;
    x3=r*x2-d;
    x4=r*x3-d;
    x5=r*x4-d;
    x6=r*x5-d;
    x7=r*x6-d;
    x8=r*x7-d;
    x9=r*x8-d;
    x10=r*x9-d;
    cout << x1 <<endl;
    cout <<x2 <<endl;
    cout <<x3 <<endl;
    cout <<x4 <<endl;
    cout <<x5 << endl;
    cout <<x6 <<endl;
    cout <<x7 <<endl;
    cout <<x8 <<endl;
    cout <<x9<<endl;
    cout <<x10<<endl;






    return 0;
}


a, b, c = map(int, input().split())
for i in range(10):
    c =  a * c - b
    print(c)

Verdicts: Runtime Error

Accepted
Problem: The development of algae in a pond is as follows.  Let the total weight of the algae at the beginning of the year i be x_i gram. For i≥2000, the following formula holds:    * x_{i+1} = rx_i - D  You are given r, D and x_{2000}. Calculate x_{2001}, ..., x_{2010} and print them in order.

Submission attempts (in order):
r, d, x = map(int,input().split())

result = r*x-d
for i in range(9):
  result = r*result-d
  print(result)


r, d, x = map(int,input().split())

result = r*x-d
print(result)
for i in range(9):
  result = r*result-d
  print(result)


Verdicts: Wrong Answer

Accepted
Problem: The development of algae in a pond is as follows.  Let the total weight of the algae at the beginning of the year i be x_i gram. For i≥2000, the following formula holds:    * x_{i+1} = rx_i - D  You are given r, D and x_{2000}. Calculate x_{2001}, ..., x_{2010} and print them in order.

Submission attempts (in order):
r, d, x = map(int, input().split())

for i in range(10):
    x = (r * x) - D
    print(x)


r, d, x = map(int, input().split())

for i in range(10):
    x = (r * x) - d
    print(x)


Verdicts: Runtime Error

Accepted
Problem: The development of algae in a pond is as follows.  Let the total weight of the algae at the beginning of the year i be x_i gram. For i≥2000, the following formula holds:    * x_{i+1} = rx_i - D  You are given r, D and x_{2000}. Calculate x_{2001}, ..., x_{2010} and print them in order.

Submission attempts (in order):
r, D, x = map(int, input().split())
ans = r * x - D
final = []
for num in range(10):
    x = r * x - D
    final.append(x)
print(final)

r, D, x = map(int, input().split())
final = []
for num in range(10):
    x = r * x - D
    final.append(x)
print(final)

r, D, x = map(int, input().split())
final = []
for num in range(10):
    x = r * x - D
    final.append(x)
    print(final[num])

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: The development of algae in a pond is as follows.  Let the total weight of the algae at the beginning of the year i be x_i gram. For i≥2000, the following formula holds:    * x_{i+1} = rx_i - D  You are given r, D and x_{2000}. Calculate x_{2001}, ..., x_{2010} and print them in order.

Submission attempts (in order):
r,d,x=map(int,input().split())
for i in range(10):
  x=r*d-x
    print(x)

r,d,x=map(int,input().split())
for i in range(10):
    x=r*x-d
    print(x)

Verdicts: Runtime Error

Accepted
Problem: The development of algae in a pond is as follows.  Let the total weight of the algae at the beginning of the year i be x_i gram. For i≥2000, the following formula holds:    * x_{i+1} = rx_i - D  You are given r, D and x_{2000}. Calculate x_{2001}, ..., x_{2010} and print them in order.

Submission attempts (in order):
r, d, x0 = map(int,input().split())

def mo(i):
    if i == 0:
        return x0
    return r*mo(i-1) - d 

for i in range(1,10):
    print(mo(i))

r, d, x0 = map(int,input().split())

def mo(i):
    if i == 0:
        return x0
    return r*mo(i-1) - d 

for i in range(1,11):
    print(mo(i))


Verdicts: Wrong Answer

Accepted
Problem: The development of algae in a pond is as follows.  Let the total weight of the algae at the beginning of the year i be x_i gram. For i≥2000, the following formula holds:    * x_{i+1} = rx_i - D  You are given r, D and x_{2000}. Calculate x_{2001}, ..., x_{2010} and print them in order.

Submission attempts (in order):
def mos(r,d,x,i):
  if i==0:
    return(x)
  else:
    return(mos(r,d,x,i-1)*r-d)
  
r,d,x=map(int,input().split())
for i in range(10):
  print(r,d,x,i)

def mos(r,d,x,i):
  if i==0:
    return(x)
  else:
    return(mos(r,d,x,i-1)*r-d)
  
r,d,x=map(int,input().split())
for i in range(1,11):
  print(r,d,x,i)

r,d,x=map(int,input().split())
for i in range(10):
  x=r*x-d
  print(x)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: The development of algae in a pond is as follows.  Let the total weight of the algae at the beginning of the year i be x_i gram. For i≥2000, the following formula holds:    * x_{i+1} = rx_i - D  You are given r, D and x_{2000}. Calculate x_{2001}, ..., x_{2010} and print them in order.

Submission attempts (in order):
#! python3
#  solve127A.py

age,cost = map(int,input().split())

if age <= 5:
    cost = 0
elif 6 <= age <= 12:
    cost = cost//2
elif 7 <= age:
    cost = cost

print(cost)

r,D,x =map(int,input().split())

for i in range(10)
	x = r*x-D
  	print(x)

#! python3
#  solve127B.py

r,D,x = map(int,input().split())
for i in range(10):
    x = r*x - D
    print(x)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: The development of algae in a pond is as follows.  Let the total weight of the algae at the beginning of the year i be x_i gram. For i≥2000, the following formula holds:    * x_{i+1} = rx_i - D  You are given r, D and x_{2000}. Calculate x_{2001}, ..., x_{2010} and print them in order.

Submission attempts (in order):
!/work/yota509/env_python3/bin/python3                                                              
# -*- coding: utf-8 -*-                                                                              


def read_input():
    a,b,c=map(int, input().split())
    if 2<=a<=5 and 1<=b<=100 and b<c<=200:
        return a,b,c
    else :
        print("Error")
        exit()

def main():
    num = 10
    # r=None                                                                                         
    # d=None                                                                                         
    # x=None                                                                                         

    r,D,x=read_input()
    sum_x=x

    for i in range(num):
        sum_x=r*sum_x-D
        print(sum_x)
        sum_x=sum_x



if __name__ == "__main__":
    main()


def read_input():
    a,b,c=map(int, input().split())
    if 2<=a<=5 and 1<=b<=100 and b<c<=200:
        return a,b,c
    else :
        print("Error")
        exit()

def main():
    num = 10

    r,D,x=read_input()
    sum_x=x

    for i in range(num):
        sum_x=r*sum_x-D
        print(sum_x)
        sum_x=sum_x



if __name__ == "__main__":
    main()


Verdicts: Runtime Error

Accepted
Problem: The development of algae in a pond is as follows.  Let the total weight of the algae at the beginning of the year i be x_i gram. For i≥2000, the following formula holds:    * x_{i+1} = rx_i - D  You are given r, D and x_{2000}. Calculate x_{2001}, ..., x_{2010} and print them in order.

Submission attempts (in order):
r,d,x=list(map(int,input().split()))
for i in 9:
  x=r*x-d
  print(x)

r,d,x=list(map(int,input().split()))
for i in range(9):
  x=r*x-d
  print(x)

r,d,x=list(map(int,input().split()))
for i in range(10):
  x=r*x-d
  print(x)

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: The development of algae in a pond is as follows.  Let the total weight of the algae at the beginning of the year i be x_i gram. For i≥2000, the following formula holds:    * x_{i+1} = rx_i - D  You are given r, D and x_{2000}. Calculate x_{2001}, ..., x_{2010} and print them in order.

Submission attempts (in order):
r,d,x=map(int,input().split())
for i in range(10):
  x=r*x-D
  print(x)

r,d,x=map(int,input().split())
for i in range(10):
  x=r*x-d
  print(x)

Verdicts: Runtime Error

Accepted
Problem: The development of algae in a pond is as follows.  Let the total weight of the algae at the beginning of the year i be x_i gram. For i≥2000, the following formula holds:    * x_{i+1} = rx_i - D  You are given r, D and x_{2000}. Calculate x_{2001}, ..., x_{2010} and print them in order.

Submission attempts (in order):
r,d,x = map(int,input().split())
for i in range(0,10):
  x = r+x-d
  print(x)

r,d,x = map(int,input().split())
for i in range(0,10):
  x = r*x - d
  print(x)

Verdicts: Wrong Answer

Accepted
Problem: The development of algae in a pond is as follows.  Let the total weight of the algae at the beginning of the year i be x_i gram. For i≥2000, the following formula holds:    * x_{i+1} = rx_i - D  You are given r, D and x_{2000}. Calculate x_{2001}, ..., x_{2010} and print them in order.

Submission attempts (in order):
a,b,c=(int(i) for i in input().split())
for i in range(1,10):
  c=a*c-b
  print(c)


a,b,c=(int(i) for i in input().split())
for i in(1,10):
  c=a*c-b
  print(c)


a,b,c=map(int,input().split( ))
for i in range(0,9):
  c=a*c-b
  print c

a,b,c=(int(i) for i in input().split())
for i in range(0,9):
  c=a*c-b
  print(c)


a,b,c=(int(i) for i in input().split())
for i in range(10):
  c=a*c-b
  print(c)

Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Accepted
Problem: The development of algae in a pond is as follows.  Let the total weight of the algae at the beginning of the year i be x_i gram. For i≥2000, the following formula holds:    * x_{i+1} = rx_i - D  You are given r, D and x_{2000}. Calculate x_{2001}, ..., x_{2010} and print them in order.

Submission attempts (in order):
#coding:utf-8
r,D,x = map(int,input().split())
x2001 = r * X - D
x2002 = r * X2001 -D
x2003 = r * X2002 - D
x2004 = r * X2003 - D
x2005 = r * X2004- D
x2006 = r * X2005- D
x2007 = r * X2006 - D
x2008 = r * X2007 - D
x2009 = r * X2008 - D
x2010 = r * X2009 - D
X = [x2001,x2002,x2003,x2004,x2005,x2006,x2007.x2008,x2009,x2010]
print(split(X))

#coding:utf-8
r,D,x = map(int,input().split())
x2001 = r * x - D
x2002 = r * x2001 -D
x2003 = r * x2002 - D
x2004 = r * x2003 - D
x2005 = r * x2004- D
x2006 = r * x2005- D
x2007 = r * x2006 - D
x2008 = r * x2007 - D
x2009 = r * x2008 - D
x2010 = r * x2009 - D
X = [x2001,x2002,x2003,x2004,x2005,x2006,x2007.x2008,x2009,x2010]
print(X)

#coding:utf-8
r,D,x = map(int,input().split())
x2001 = r * X - D
x2002 = r * X2001 -D
x2003 = r * X2002 - D
x2004 = r * X2003 - D
x2005 = r * X2004- D
x2006 = r * X2005- D
x2007 = r * X2006 - D
x2008 = r * X2007 - D
x2009 = r * X2008 - D
x2010 = r * X2009 - D
X = [x2001,x2002,x2003,x2004,x2005,x2006,x2007.x2008,x2009,x2010]
print(X)

#coding:utf-8
r,D,x = map(int,input().split())
x2001 = r * x - D
x2002 = r * x2001 - D
x2003 = r * x2002 - D
x2004 = r * x2003 - D
x2005 = r * x2004 - D
x2006 = r * x2005 - D
x2007 = r * x2006 - D
x2008 = r * x2007 - D
x2009 = r * x2008 - D
x2010 = r * x2009 - D
X = '''x2001
x2002
x2003
x2004
x2005
x2006
x2007
x2008
x2009
x2010'''
print(int(X))

#coding:utf-8
r,D,x = map(int,input().split())
x2001 = r * x - D
x2002 = r * x2001 - D
x2003 = r * x2002 - D
x2004 = r * x2003 - D
x2005 = r * x2004 - D
x2006 = r * x2005 - D
x2007 = r * x2006 - D
x2008 = r * x2007 - D
x2009 = r * x2008 - D
x2010 = r * x2009 - D
print(x2001)
print(x2002)
print(x2003)
print(x2004)
print(x2005)
print(x2006)
print(x2007)
print(x2008)
print(x2009)
print(x2010)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: The development of algae in a pond is as follows.  Let the total weight of the algae at the beginning of the year i be x_i gram. For i≥2000, the following formula holds:    * x_{i+1} = rx_i - D  You are given r, D and x_{2000}. Calculate x_{2001}, ..., x_{2010} and print them in order.

Submission attempts (in order):
r, d, x2000 = map(int, input().split())

x = []

for i in range(10+1):
    x.append(0)

print(x)

x[0] = x2000
# print(x[0])

for i in range(10):
    x[i+1] = r * x[i] - d
    print(x[i+1])


r, d, x2000 = map(int, input().split())

x = []

for i in range(10+1):
    x.append(0)

x[0] = x2000
# print(x[0])

for i in range(10):
    x[i+1] = r * x[i] - d
    print(x[i+1])


Verdicts: Wrong Answer

Accepted
Problem: The development of algae in a pond is as follows.  Let the total weight of the algae at the beginning of the year i be x_i gram. For i≥2000, the following formula holds:    * x_{i+1} = rx_i - D  You are given r, D and x_{2000}. Calculate x_{2001}, ..., x_{2010} and print them in order.

Submission attempts (in order):
r,D,x=map(int,input().split())
for i in range(2001,2011,1):
    print(x)
    x_=r*x-D
    x=x_

r,D,x=map(int,input().split())
for i in range(2001,2011,1):
    x_=r*x-D
    x=x_
    print(x)

Verdicts: Wrong Answer

Accepted
Problem: The development of algae in a pond is as follows.  Let the total weight of the algae at the beginning of the year i be x_i gram. For i≥2000, the following formula holds:    * x_{i+1} = rx_i - D  You are given r, D and x_{2000}. Calculate x_{2001}, ..., x_{2010} and print them in order.

Submission attempts (in order):
r,d,x=map(int,input().split())
for i in range(10):
  r=r*x-d
  print(r)
  

r,d,x=map(int,input().split())
for i in range(10):
  x=r*x-d
  print(x)

Verdicts: Wrong Answer

Accepted
Problem: The development of algae in a pond is as follows.  Let the total weight of the algae at the beginning of the year i be x_i gram. For i≥2000, the following formula holds:    * x_{i+1} = rx_i - D  You are given r, D and x_{2000}. Calculate x_{2001}, ..., x_{2010} and print them in order.

Submission attempts (in order):
r,d,x = map(int, input().split())
result=[]
result.append(x)
for i in range(10):
	x=r*x-d
	result.append(x)
for i in result:
	print(i)

r,d,x = map(int, input().split())
result=[]
result.append(x)
for i in range(10):
	x=r*x-d
	result.append(x)
for i in result[1:11]:
	print(str(i))

Verdicts: Wrong Answer

Accepted
Problem: The development of algae in a pond is as follows.  Let the total weight of the algae at the beginning of the year i be x_i gram. For i≥2000, the following formula holds:    * x_{i+1} = rx_i - D  You are given r, D and x_{2000}. Calculate x_{2001}, ..., x_{2010} and print them in order.

Submission attempts (in order):
r,d,x_2000=map(int,input().split())
x_i = x_2000
for i in range(10):
  x_ii = r*x_i-D
  x_i = x_ii
  print(x_ii)

r,d,x_2000=map(int,input().split())
x_i = x_2000
for i in range(10):
  x_ii = r*x_i-d
  x_i = x_ii
  print(x_ii)

Verdicts: Runtime Error

Accepted
Problem: The development of algae in a pond is as follows.  Let the total weight of the algae at the beginning of the year i be x_i gram. For i≥2000, the following formula holds:    * x_{i+1} = rx_i - D  You are given r, D and x_{2000}. Calculate x_{2001}, ..., x_{2010} and print them in order.

Submission attempts (in order):
r,d,x=map(int,input().split())
for i in range(10):
	x=x*r-d
print(x)	






r,d,x=map(int,input().split())
for i in range(10):
	x=r*x-d
	print(x)	






Verdicts: Wrong Answer

Accepted
Problem: The development of algae in a pond is as follows.  Let the total weight of the algae at the beginning of the year i be x_i gram. For i≥2000, the following formula holds:    * x_{i+1} = rx_i - D  You are given r, D and x_{2000}. Calculate x_{2001}, ..., x_{2010} and print them in order.

Submission attempts (in order):
r,d,x0 = map(int,input().split())
a=[x0]

for i in range(1,11):
    a.append(r*a[i-1]-d)

for i in range(11):
    print(a[i])

r,d,x0 = map(int,input().split())
a=[x0]

for i in range(1,11):
    a.append(r*a[i-1]-d)

for i in range(1,11):
    print(a[i])

Verdicts: Wrong Answer

Accepted
Problem: The development of algae in a pond is as follows.  Let the total weight of the algae at the beginning of the year i be x_i gram. For i≥2000, the following formula holds:    * x_{i+1} = rx_i - D  You are given r, D and x_{2000}. Calculate x_{2001}, ..., x_{2010} and print them in order.

Submission attempts (in order):
r, d, x = [int(x) for x in input().split()]
for i in range(2001, 2011):
  x = r * x - D
  print(x)

r, d, x = [int(x) for x in input().split()]
for i in range(2001, 2011):
  x = r * x - d
  print(x)

Verdicts: Runtime Error

Accepted
Problem: The development of algae in a pond is as follows.  Let the total weight of the algae at the beginning of the year i be x_i gram. For i≥2000, the following formula holds:    * x_{i+1} = rx_i - D  You are given r, D and x_{2000}. Calculate x_{2001}, ..., x_{2010} and print them in order.

Submission attempts (in order):
a,b = map(int,input().split())
if a <= 5:
  print('0')
else:
  if a <= 12:
    print(int(b/2))
  else:
    print(b)

a,b,c = map(int,input().split())
for i in range(10):
  c = a*c-b
  print(c)

Verdicts: Runtime Error

Accepted
Problem: The development of algae in a pond is as follows.  Let the total weight of the algae at the beginning of the year i be x_i gram. For i≥2000, the following formula holds:    * x_{i+1} = rx_i - D  You are given r, D and x_{2000}. Calculate x_{2001}, ..., x_{2010} and print them in order.

Submission attempts (in order):
r,D,x=map(int,input().split())
for i in range(10):
  print(x)
  x=r*x-D
print(x)

r,D,x=map(int,input().split())
for i in range(10):
  x=r*x-D
  print(x)

Verdicts: Wrong Answer

Accepted
Problem: The development of algae in a pond is as follows.  Let the total weight of the algae at the beginning of the year i be x_i gram. For i≥2000, the following formula holds:    * x_{i+1} = rx_i - D  You are given r, D and x_{2000}. Calculate x_{2001}, ..., x_{2010} and print them in order.

Submission attempts (in order):
#ABC127 B

r,D,x = map(int,input().split())
A = []
for i in range(10):
    if i == 0:
        A.append(x)
    else:
        A.append(r*(A[i-1])-D)
print(A)

#ABC127 B

r,D,x = map(int,input().split())
A = []
for i in range(10):
    if i == 0:
        A.append(x)
    else:
        A.append(r*(A[i-1])-D)

for j in range(10):
    print(A[j])

#ABC127 B

r,D,x = map(int,input().split())
A = []
for i in range(11):
    if i == 0:
        A.append(x)
    else:
        A.append(r*(A[i-1])-D)

for j in range(10):
    print(A[j+1])

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: The development of algae in a pond is as follows.  Let the total weight of the algae at the beginning of the year i be x_i gram. For i≥2000, the following formula holds:    * x_{i+1} = rx_i - D  You are given r, D and x_{2000}. Calculate x_{2001}, ..., x_{2010} and print them in order.

Submission attempts (in order):
# -*- coding: utf-8 -*-


#x_i+1=r*x_i-D

r, D, x = map(int, input().split())

res = []
res.append(x)

for i in range(1,11):
    res.append(r * res[i-1] - D)

for p in res:
    print(p)


# -*- coding: utf-8 -*-


#x_i+1=r*x_i-D

r, D, x = map(int, input().split())

res = []
res.append(x)

for i in range(1,11):
    res.append(r * res[i-1] - D)

for p in range(1,len(res)):
    print(res[p])



Verdicts: Wrong Answer

Accepted
Problem: The development of algae in a pond is as follows.  Let the total weight of the algae at the beginning of the year i be x_i gram. For i≥2000, the following formula holds:    * x_{i+1} = rx_i - D  You are given r, D and x_{2000}. Calculate x_{2001}, ..., x_{2010} and print them in order.

Submission attempts (in order):
r, d, x = map(int, input().split())
ans = [0] * 13
ans[0] = x

for i in range(0, 11):
    ans[i+1] = (r * ans[i]) - d
    print(ans[i])

r, d, x = map(int, input().split())
ans = [x]

for i in range(11):
    ans.append((r * ans[i]) - d)
    if i == 0:
        continue
    print(ans[i])

Verdicts: Wrong Answer

Accepted
Problem: The development of algae in a pond is as follows.  Let the total weight of the algae at the beginning of the year i be x_i gram. For i≥2000, the following formula holds:    * x_{i+1} = rx_i - D  You are given r, D and x_{2000}. Calculate x_{2001}, ..., x_{2010} and print them in order.

Submission attempts (in order):
r,D,x=map(int,input().split())
for i in range(10):
    x=r*x-D
print(x)

r,D,x=map(int,input().split())
for i in range(10):
    x=r*x-D
    print(x)

Verdicts: Wrong Answer

Accepted
Problem: The development of algae in a pond is as follows.  Let the total weight of the algae at the beginning of the year i be x_i gram. For i≥2000, the following formula holds:    * x_{i+1} = rx_i - D  You are given r, D and x_{2000}. Calculate x_{2001}, ..., x_{2010} and print them in order.

Submission attempts (in order):
r, d, x = list(map(int, input().split()))
for i in range(10):
  x = r*x-D
  print(x)


r, d, x = map(int, input().split())
for i in range(10):
  x = r*x-D
  print(x)

r, D, x = list(map(int, input().split()))
for i in range(10):
  x = r*x-D
  print(x)


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: We have N ID cards, and there are M gates.  We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards.  How many of the ID cards allow us to pass all the gates alone?

Submission attempts (in order):
n,m=map(int,input().split())
li = [list(map(int, input().split())) for i in range(m)]

a=li[0][0]
b=li[0][1]
for i in range(m-1):
  if li[i+1][0]>a:
    a=li[i+1][0]
  if li[i+1][1]<b:
    b=li[i+1][1]

if b<a:
  print(int(0))
  break
  
if b-a+1<n:
  print(b-a+1)
else:
  print(n)

n,m=map(int,input().split())
li = [list(map(int, input().split())) for i in range(m)]
 
a=li[0][0]
b=li[0][1]
for i in range(m-1):
  if li[i+1][0]>a:
    a=li[i+1][0]
  if li[i+1][1]<b:
    b=li[i+1][1]
 
if b<a:
  print(int(0))
  exit()
  
if b-a+1<n:
  print(b-a+1)
else:
  print(n)

Verdicts: Runtime Error

Accepted
Problem: We have N ID cards, and there are M gates.  We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards.  How many of the ID cards allow us to pass all the gates alone?

Submission attempts (in order):
N, M = map(int,input().split())

from collections import defaultdict


def main():
	Ls = []
	cardDic = defaultdict(int)
	Rs = []
	for i in range(M):
		inputs= list(map(int,input().split()))
		Ls.append(inputs[0])
		cardDic[inputs[0]] += 1
		Rs.append(inputs[1])
		cardDic[inputs[1]] += 1

	if M == 1:
		print(N)
		return
	result = []
	for i in range(1, M + 1):
		Li = Ls[i - 1]
		LiPlusOne = Li + 1
		Ri = Rs[i - 1]
		res = set([Li, LiPlusOne, Ri])
		print(res)
		if len(result) == 0:
			result.extend(list(res))
		result = list(set(result) & res)

	answer = 0
	for i in result:
		if i in cardDic:
			answer += 1
	print(answer)

if __name__ == '__main__':
	main()

N, M = map(int,input().split())

As = list(map(int,input().split())).sort()

Bs = []
Cs = []
for i in range(M):
	inputs = list(map(int,input().split()))
	Bs.append(inputs[0])
	Cs.append(inputs[1])

for j in range(1, M + 1):
	for n in range(Bs[j - 1]):
		if As[n] < Cs[j - 1]:
			As[n] = Cs[j - 1]
	As.sort()

print(sum(As))

N, M = map(int,input().split())


def main():
	Ls = []
	Rs = []
	for i in range(M):
		inputs = list(map(int,input().split()))
		Ls.append(inputs[0])
		Rs.append(inputs[1])

	maxL = max(Ls)
	minR = min(Rs)

	if maxL > minR:
		print(0)
	else:
		print(minR - maxL + 1)

if __name__ == '__main__':
	main()

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: We have N ID cards, and there are M gates.  We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards.  How many of the ID cards allow us to pass all the gates alone?

Submission attempts (in order):
# coding: UTF-8
# sample code

v = list(map(int, input().split()))
n, m = v[0], v[1]

l, r = [], []
for i in range(m):
	v = list(map(int, input().split()))
	l.append(v[0])
	r.append(v[1])

min = 1
max = n
for i in range(m):
	if l[i] > min:
		min = l[i]
	if max > r[i]:
		max = r[i]
	print(min,'～',max)

num = max-min+1
if num < 0:
	print(0)
else:
	print(num)

# coding: UTF-8
# sample code

v = list(map(int, input().split()))
n, m = v[0], v[1]

l, r = [], []
for i in range(m):
	v = list(map(int, input().split()))
	l.append(v[0])
	r.append(v[1])

min = 1
max = n
for i in range(m):
	if l[i] > min:
		min = l[i]
	if max > r[i]:
		max = r[i]

num = max-min+1
if num < 0:
	print(0)
else:
	print(num)

Verdicts: Wrong Answer

Accepted
Problem: We have N ID cards, and there are M gates.  We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards.  How many of the ID cards allow us to pass all the gates alone?

Submission attempts (in order):
a,b=map(int,input().split())

answer = 0

upper = a
under = 0

for i in range(b):
  c,d=map(int,input().split())
  if d <= upper:
    upper = d
  if under <= c:
    under = c

if (upper - under) >= 0:
  print(0)
else:    
  print(upper - under + 1)

a,b=map(int,input().split())

answer = 0

upper = a
under = 0

for i in range(b):
  c,d=map(int,input().split())
  if d <= upper:
    upper = d
  if under <= c:
    under = c

if (upper - under) < 0:
  print(0)
else:    
  print(upper - under + 1)

Verdicts: Wrong Answer

Accepted
Problem: We have N ID cards, and there are M gates.  We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards.  How many of the ID cards allow us to pass all the gates alone?

Submission attempts (in order):
L=[]
R=[]
for _ in range(M):
	l,r=map(int, input().split())
	L.append(l)
	R.append(r)

l = max(L)
r = min(R)

res = 0
for i in range(1,N+1):
	if l<=i and i<=r:
		res+=1
print(res)


N,M=map(int, input().split())
L=[]
R=[]
for _ in range(M):
	l,r=map(int, input().split())
	L.append(l)
	R.append(r)

l = max(L)
r = min(R)

res = 0
for i in range(1,N+1):
	if l<=i and i<=r:
		res+=1
print(res)


Verdicts: Runtime Error

Accepted
Problem: We have N ID cards, and there are M gates.  We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards.  How many of the ID cards allow us to pass all the gates alone?

Submission attempts (in order):
n,m=map(int,input().split())
l=[0]*m
r=[0]*m
for i in range(m):
    l[i],r[i]=map(int,input().split())
if max(l)<min(r):
    print(0)
else:
    print(min(r)-max(l)+1)

n,m=map(int,input().split())
l=[0]*m
r=[0]*m
for i in range(m):
    l[i],r[i]=map(int,input().split())
if max(l)<=min(r):
    print(0)
else:
    print(min(r)-max(l)+1)

n,m=map(int,input().split())
l=[0]*m
r=[0]*m
for i in range(m):
    l[i],r[i]=map(int,input().split())
if max(l)<min(r):
    print(0)
elif max(l)>min(r):
    print(0)
else:
    print(min(r)-max(l)+1)

n,m=map(int,input().split())
l=[0]*m
r=[0]*m
for i in range(m):
    l[i],r[i]=map(int,input().split())
if max(l)>min(r):
    print(0)
else:
    print(min(r)-max(l)+1)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: We have N ID cards, and there are M gates.  We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards.  How many of the ID cards allow us to pass all the gates alone?

Submission attempts (in order):
n,m=map(int,input().split())
lh=0
rh=10**9
for i in range(m):
  l,r=map(int,input().split())
  if lh<=l:
    lh=l
  if rh>=r:
    rh=r
print(rh,lh)
if rh-lh<0:
  print(0)
else:
  print(rh-lh+1)

n,m=map(int,input().split())
lh=0
rh=10**9
for i in range(m):
  l,r=map(int,input().split())
  if lh<=l:
    lh=l
  if rh>=r:
    rh=r
if rh-lh<0:
  print(0)
else:
  print(rh-lh+1)

Verdicts: Wrong Answer

Accepted
Problem: We have N ID cards, and there are M gates.  We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards.  How many of the ID cards allow us to pass all the gates alone?

Submission attempts (in order):
N, M = (int(x) for x in input().split())
L = []
R = []
for i in range(M):
	l, r = (int(x) for x in input().split())
	L.append(l)
	R.append(r)
	
lmax = max(L)
rmin = min(R)
ans = lmax - rmin + 1

print(ans)

N, M = (int(x) for x in input().split())
L = []
R = []
for i in range(M):
	l, r = (int(x) for x in input().split())
	L.append(l)
	R.append(r)
	
lmax = max(L)
rmin = min(R)
ans = rmin - lmax + 1
if ans < 0:
	ans = 0

print(ans)

Verdicts: Wrong Answer

Accepted
Problem: We have N ID cards, and there are M gates.  We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards.  How many of the ID cards allow us to pass all the gates alone?

Submission attempts (in order):
n,m = map(int,input().split())

Lmax = 0
Rmin = 100000
for i in range(m):
	L,R = map(int,input().split())
	if Lmax < L:
		Lmax = L
	if Rmin > R:
		Rmin = R
if Rmin > Lmax:
	print("0")
else:
	print("%d" % (Rmin - Lmax +1))

n,m = map(int,input().split())

Lmax = 0
Rmin = 1000000
for i in range(m):
	L,R = map(int,input().split())
	if Lmax < L:
		Lmax = L
	if Rmin > R:
		Rmin = R
if Rmin > Lmax:
	print(0)
else:
	print("%d" % (Rmin - Lmax +1))

n,m = map(int,input().split())

Lmax = 0
Rmin = 1000000
for i in range(m):
	L,R = map(int,input().split())
	if Lmax < L:
		Lmax = L
	if Rmin > R:
		Rmin = R
res = Rmin - Lmax + 1
if res > 0:
	print("%d" % (Rmin - Lmax +1))
else:
	print(0)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: We have N ID cards, and there are M gates.  We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards.  How many of the ID cards allow us to pass all the gates alone?

Submission attempts (in order):
N, M = map(int, input().split())
card = False
for _ in range(M):
    L, R = map(int, input().split())
    if card is True:
        card = card & set([i for i in range(L, R + 1)])
    else:
        card = set([i for i in range(L, R + 1)])
print(len(card))

N, M = map(int, input().split()) 
left = 1
right = N
for _ in range(M):
    L, R = map(int, input().split())
    left = max(left, L)
    right = min(right, R)
if left > right:
    print(0)
else:
    print(right - left + 1)

Verdicts: Wrong Answer

Accepted
Problem: We have N ID cards, and there are M gates.  We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards.  How many of the ID cards allow us to pass all the gates alone?

Submission attempts (in order):

n,m = map(int,input().split())
s = -1
t = n+1
for i in range(m):
    l_i,r_i = map(int,input().split())
    l = max(l,l_i)
    r = min(r,r_i)
print(max(0,r-l+1))



n,m = map(int,input().split())
l = -1
r = n+1
for i in range(m):
    l_i,r_i = map(int,input().split())
    l = max(l,l_i)
    r = min(r,r_i)
print(max(0,r-l+1))

Verdicts: Runtime Error

Accepted
Problem: We have N ID cards, and there are M gates.  We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards.  How many of the ID cards allow us to pass all the gates alone?

Submission attempts (in order):
N, M = map(int, input().split())
gate = [None] * M
range_L = 1
range_R = N
for i in range(M):
    gate[i] = tuple(map(int, input().split()))
    left = gate[i][0]
    right = gate[i][1]
    if range_L < left:
        range_L = left
    if right < range_R:
        range_R = right

print(range_R, range_L)
print(range_R - range_L + 1)


N, M = map(int, input().split())
left = [None] * M
right = [None] * M
for i in range(M):
    left[i], right[i] = map(int, input().split())

ans = min(right) - max(left) + 1
if ans < 0:
    print(0)
else:
    print(ans)
 

Verdicts: Wrong Answer

Accepted
Problem: We have N ID cards, and there are M gates.  We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards.  How many of the ID cards allow us to pass all the gates alone?

Submission attempts (in order):
N, M = map(int, input().split())
lr = [tuple(map(int, input().split())) for _ in range(M)]

s = [0] * (N + 1)
for i in range(M):
    l, r = lr[i]
    s[l - 1] += 1
    if r != N + 2:
        s[r] -= 1

ruiseki = [0] * (N + 1)
for i in range(1, N + 1):
    ruiseki[i] += ruiseki[i - 1] + s[i]


print(ruiseki.count(M))


N, M = map(int, input().split())
lr = [tuple(map(int, input().split())) for _ in range(M)]

s = [0] * (N + 1)
for i in range(M):
    l, r = lr[i]
    s[l - 1] += 1
    if r != N + 2:
        s[r] -= 1

ruiseki = [0] * (N + 2)
for i in range(N + 1):
    ruiseki[i + 1] += ruiseki[i] + s[i]


print(ruiseki.count(M))

Verdicts: Wrong Answer

Accepted
Problem: We have N ID cards, and there are M gates.  We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards.  How many of the ID cards allow us to pass all the gates alone?

Submission attempts (in order):
N,M=map(int,input().split())
LR=list(map(int,input().split()) for _ in range(M) )
L=1
R=N
for i in range(M):
    L=max(L,LR[i][0])
    R=min(R,LR[i][1])
print(R-L+1 if R<=L else 0)

N,M=map(int,input().split())
LR=list(list(map(int,input().split())) for _ in range(M))
L=1
R=N
for i in range(M):
    L=max(L,LR[i][0])
    R=min(R,LR[i][1])
print(R-L+1 if L<=R else 0)

Verdicts: Runtime Error

Accepted
Problem: We have N ID cards, and there are M gates.  We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards.  How many of the ID cards allow us to pass all the gates alone?

Submission attempts (in order):
N,M = map(int, input().split())
l=0
r=N
for _ in range(M):
  ll,rr=map(int,input().split())
  l = max(l,ll)
  r = min(r,rr)
print(rr-ll+1)

N,M = map(int, input().split())
l=0
r=N
for _ in range(M):
  ll,rr=map(int,input().split())
  l = max(l,ll)
  r = min(r,rr)
ans = r - l + 1
print(ans if ans > 0 else 0)

Verdicts: Wrong Answer

Accepted
Problem: We have N ID cards, and there are M gates.  We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards.  How many of the ID cards allow us to pass all the gates alone?

Submission attempts (in order):
n,m = map(int,(input().spit()))
L = []
R = []

for i in range(m):
	l,r = map(int(input().spit()))
	L.append(l)
	R.append(r)

ans = min(R) - max(L) + 1

if ans >0:
	print(ans)
else:
	print(0)

n, m = map(int, input().split())
L = []
R = []
for i in range(m):
	l,r = map(int,input().split())
	L.append(l)
	R.append(r)
print(min(R)-max(L))

n,m = map(int(input().spit()))
L = []
R = []

for i in range(m):
	l,r = map(int(input().spit()))
	L.append(l)
	R.append(r)

ans = min(R) - max(L) + 1

if ans >0:
	print(ans)
else:
	print(0)

n,m=map(int,input().split())

p=[]
q=[]

for i in range(m):
    l,r=map(int,input().split())
    p.append(l)
    q.append(r)

p1=max(p)
q1=min(q)

if p1>=q1:
    print(q1-p1)
else:
    print(0)


n,m=map(int,input().split())

p=[]
q=[]

for i in range(m):
    l,r=map(int,input().split())
    p.append(l)
    q.append(r)

p1=max(p)
q1=min(q)

if p1>=q1:
    print(q1-p1+1)
else:
    print(0)


n = int(input())
lis = list(map(int,input().split()))

ans = "Yes"
m = 0
for i in range(n):
	if m - lis[i] > 1:
		ans = "No"
		break
	else:
		m = max(m,lis[i])
print(ans)

n, m = map(int, input().split())
L = []
R = []
for i in range(m):
	l,r = map(int,input().split())
	L.append(l)
	R.append(r)
if min(R)-max(L)+1 >0:
	print(min(R)-max(L)+1)
else:
	print(0)

Verdicts: Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Runtime Error

Accepted
Problem: We have N ID cards, and there are M gates.  We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards.  How many of the ID cards allow us to pass all the gates alone?

Submission attempts (in order):
n, m = list(map(int, input().split()))

R, L = [], []
for i in range(m):
  r, l = list(map(int, input().split()))
  R.append(r)
  L.append(l)
  
print( min(R) - max(L) + 1)

n, m = list(map(int, input().split()))

R, L = [], []
for i in range(m):
  l, r = list(map(int, input().split()))
  R.append(r)
  L.append(l)
  
print(max(min(R) - max(L) + 1, 0))

Verdicts: Wrong Answer

Accepted
Problem: We have N ID cards, and there are M gates.  We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards.  How many of the ID cards allow us to pass all the gates alone?

Submission attempts (in order):
N,M=(int(x) for x in int(input().split()))
L=0
R=N
for i in range(M):
  Li,Ri=(int(x) for x in int(input().split()))
  L=Li if Li>L 
  R=Ri if Ri<R
print(Ri-Li+1)

N,M=(int(x) for x in input().split())
L=0
R=N
for i in range(M):
  Li,Ri=(int(x) for x in input().split())
  L=Li if Li>L else L
  R=Ri if Ri<R else R
  print(str(L)+str(R))
ans=R-L+1 if R>=L else 0
print(ans)

N,M=(int(x) for x in input().split())
L=0
R=N
for i in range(M):
  Li,Ri=(int(x) for x in input().split())
  L=Li if Li>L else L
  R=Ri if Ri<R else R
print(Ri-Li+1)

N,M=(int(x) for x in input().split())
L=0
R=N
for i in range(M):
  Li,Ri=(int(x) for x in input().split())
  L=Li if Li>L else L
  R=Ri if Ri<R else R
ans=R-L+1 if R>=L else 0
print(ans)

Verdicts: Runtime Error

Wrong Answer

Wrong Answer

Accepted
Problem: We have N ID cards, and there are M gates.  We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards.  How many of the ID cards allow us to pass all the gates alone?

Submission attempts (in order):
N, M = map(int, input().split())
L = []*M
R = []*M
for i in range(M):
  L[i], R[i] = map(int, input().split())
  
ans = min(R)-(max(L)-1)

print(ans)

N, M = map(int, input().split())
L = [0 for i in range(M)]
R = [0 for i in range(M)]
for i in range(M):
  L[i], R[i] = map(int, input().split())
  
ans = min(R)-(max(L)-1)

print(max(ans,0))


Verdicts: Runtime Error

Accepted
Problem: We have N ID cards, and there are M gates.  We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards.  How many of the ID cards allow us to pass all the gates alone?

Submission attempts (in order):
n,m = map(int, input().split())
n = range(1,n+1)
for i in range(m):
  a,b = map(int, input().split())
  n = [j for j in n if a <= j <= b]
print(len(j))

n,m = map(int, input().split())
p,q = float('-inf'),float('inf')
for i in range(m):
  a,b = map(int, input().split())
  if a > p:
    p = a
  if b < q:
    q = b
if (q-p) < 0:
  print(0)
else:
  print(q-p+1)

Verdicts: Runtime Error

Accepted
Problem: We have N ID cards, and there are M gates.  We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards.  How many of the ID cards allow us to pass all the gates alone?

Submission attempts (in order):
n,m=map(int,input().split())
D=[list(map(int,input().split())) for i in range(m)]
maxI=n
minI=1
for i in range(m):
  maxI=max(maxI,D[i][1])
  minI=min(minI,D[i][0])
print(maxI-minI+1)

n,m=map(int,input().split())
D=[list(map(int,input().split())) for i in range(m)]
maxI=n
minI=1
for i in range(m):
  maxI=min(maxI,D[i][1])
  minI=max(minI,D[i][0])
print(max(maxI-minI+1,0))

Verdicts: Wrong Answer

Accepted
Problem: We have N ID cards, and there are M gates.  We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards.  How many of the ID cards allow us to pass all the gates alone?

Submission attempts (in order):
import sys
N,M = map(int,input().split())
L,R = sorted(map(int, input().split()))
range_min = L
range_max = R


def end_checker(L,R,range_min,range_max):
  if  L < range_max or R < range_min:
    return True
  return False

while M > 1:
  L,R = sorted(map(int, input().split()))
  if end_checker(L,R,range_min,range_max):
    print(0)
    sys.exit()
  
  range_min = L if L > range_min else range_min
  range_max = R if R < range_max else range_max
  M -= 1

ans = range_max - range_min + 1  
print(ans)

import sys
N,M = map(int,input().split())
L,R = sorted(map(int, input().split()))
range_min = L
range_max = R


def end_checker(L,R,range_min,range_max):
  if  L < range_max or R < range_min:
    return True
  return False

while M > 1:
  L,R = sorted(map(int, input().split()))
  if end_checker(L,R,range_min,range_max):
    print(0)
    sys.exit()
  
  range_min = L if L > range_min else range_min
  range_max = R if R < range_max else range_max
  print(range_max,range_min)
  M -= 1

ans = range_max - range_min + 1  
print(ans)

import sys
N,M = map(int,input().split())
L,R = sorted(map(int, input().split()))
range_min = L
range_max = R
print(L,R)

def end_checker(L,R,range_min,range_max):
  if  L > range_max or R < range_min:
    return True
  return False

while M > 1:
  L,R = sorted(map(int, input().split()))
  if end_checker(L,R,range_min,range_max):
    print(0)
    sys.exit()
  
  range_min = L if L > range_min else range_min
  range_max = R if R < range_max else range_max
  print(range_max,range_min)
  M -= 1

ans = range_max - range_min + 1  
print(ans)

N,M = map(int,input().split())
L,R = sorted(map(int, input().split()))
range_min = L
range_max = R

while M > 1:
  L,R = sorted(map(int, input().split()))
  range_min = L if L > range_min else range_min
  range_max = R if R < range_max else range_max
  print(range_max,range_min)
  M -= 1

print(range_max - range_min + 1)

import sys
N,M = map(int,input().split())
L,R = sorted(map(int, input().split()))
range_min = L
range_max = R

def end_checker(L,R,range_min,range_max):
  if  L > range_max or R < range_min:
    return True
  return False

while M > 1:
  L,R = sorted(map(int, input().split()))
  if end_checker(L,R,range_min,range_max):
    print(0)
    sys.exit()
  
  range_min = L if L > range_min else range_min
  range_max = R if R < range_max else range_max
  M -= 1

ans = range_max - range_min + 1  
print(ans)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: We have N ID cards, and there are M gates.  We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards.  How many of the ID cards allow us to pass all the gates alone?

Submission attempts (in order):
import numpy as np
N, M = map(int, input().split())
L = []
R = []
for i in range(M):
    l, r = map(int, input().split())
    L.append(l)
    R.append(r)
L, R = np.array(L), np.array(R)
np.append(L, R)
print(np.sum((L[M-1]<=L)*(L<R[0])))


N, M = map(int, input().split())
L, R = [], []
for _ in range(M):
    l, r = map(int, input().split())
    L.append(l)
    R.append(r)
print(max(min(R)-max(L)+1, 0))


Verdicts: Wrong Answer

Accepted
Problem: We have N ID cards, and there are M gates.  We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards.  How many of the ID cards allow us to pass all the gates alone?

Submission attempts (in order):
n, m = list(map(int, input().split()))

list = [list(map(int, input().split())) for x in range(m)]

ans = [1]*n

s = 0
m = n

for i in list:
    if i[0] > s:
        s = i[0]
    if i[1] < m:
        m = i[1]
if m>=s:
    print(s, m)
else:
    print(0)

n, m = list(map(int, input().split()))

list = [list(map(int, input().split())) for x in range(m)]

ans = [1]*n

s = 0
m = n

for i in list:
    if i[0] > s:
        s = i[0]
    if i[1] < m:
        m = i[1]
if m>=s:
    print(m-s+1)
else:
    print(0)

Verdicts: Wrong Answer

Accepted
Problem: We have N ID cards, and there are M gates.  We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards.  How many of the ID cards allow us to pass all the gates alone?

Submission attempts (in order):
while True:
    try:
        N, M = map(int, input().split())
        gate = [list(map(int, input().split())) for i in range(M)]
        
        dp = [0] * (N+1)
        for l, r in gate:
            dp[l-1] += 1
            dp[r] -= 1
            print(dp)
        
        cnt = 0
        ans = 0
        for i in range(N):
            cnt += dp[i]
            if cnt == M:
                ans += 1
            
        print(ans)
    except:
        break

while True:
    try:
        N, M = map(int, input().split())
        
        dp = [0]*(10**5+5)
        for i in range(M):
            L, R = map(int, input().split())
            dp[L-1] += 1
            dp[R] -= 1
        
        cnt = 0
        ans = 0
        for i in range(N):
            cnt += dp[i]
            if cnt == M:
                ans += 1
            
        print(ans)
    except:
        break

Verdicts: Wrong Answer

Accepted
Problem: We have N ID cards, and there are M gates.  We can pass the i-th gate if we have one of the following ID cards: the L_i- th, (L_i+1)-th, ..., and R_i-th ID cards.  How many of the ID cards allow us to pass all the gates alone?

Submission attempts (in order):
n,m=map(int,input().split())
l=1
r=n
for i in range(m):
  li,ri=map(int,input().split())
  l = max(l,li)
  r = min(r,ri)
print(max(r-l,0)

n,m=map(int,input().split())
l=1
r=n
for i in range(m):
  li,ri=map(int,input().split())
  l = max(l,li)
  r = min(r,ri)
print(max(r-l+1,0))

Verdicts: Runtime Error

Accepted