ZhenlongDai/ACPR huggingface dataset:
Problem: p02411
Buggy submission (Python3, verdict: Wrong Answer):
for _ in range(10000):
    res = list(map(int,input().split()))
    if res == [-1,-1,-1]:
        break
    su = res[0]+res[1]
    if su<30:
        gr="F"
    elif su<50:
        if res[2]>=50:
            gr="C"
        else:
            gr="D"
    elif su<65:
        gr="C"
    elif su<80:
        gr="B"
    else:
        gr="A"
    print(gr)


Failing test case input:
86 -1 0
22 57 -1
0 2 -2
-1 -1 -1

Expected output:
F
B
F


Actual output:
A
B
F


Fixed submission (verdict: Accepted):
for _ in range(10000):
    res = list(map(int,input().split()))
    if res == [-1,-1,-1]:
        break
    su = res[0]+res[1]
    if su<30:
        gr="F"
    elif su<50:
        if res[2]>=50:
            gr="C"
        else:
            gr="D"
    elif su<65:
        gr="C"
    elif su<80:
        gr="B"
    else:
        gr="A"
    if res[0]==-1 or res[1]==-1:
        gr="F"
    print(gr)

Problem: p02411
Buggy submission (Python3, verdict: Wrong Answer):
while True:
  m, f, r = map(int, input().split())
  if m == -1 and f == -1 and r == -1:
    break
  elif m + f >= 80:
    print('A')
  elif 65 <= m + f < 80:
    print('B')
  elif 50 <= m + f < 65:
    print('C')
  elif 30 <= m + f < 50:
    if r >= 50:
      print('C')
    else:
      print('D')
  else:
    print('F')
  


Failing test case input:
86 -1 0
22 57 -1
0 2 -2
-1 -1 -1

Expected output:
F
B
F


Actual output:
A
B
F


Fixed submission (verdict: Accepted):
while True:
  m, f, r = map(int, input().split())
  if m == -1 and f == -1 and r == -1:
    break
  elif m == -1 or f == -1:
    print('F')
  elif m + f >= 80:
    print('A')
  elif 65 <= m + f:
    print('B')
  elif 50 <= m + f:
    print('C')
  elif 30 <= m + f:
    if r >= 50:
      print('C')
    else:
      print('D')
  else:
    print('F')

Problem: p02411
Buggy submission (Python3, verdict: Wrong Answer):
A=[]
while True:
	
	
	
	m,f,r = [int(i) for i in input().split()]
	if m == f == r == -1:
		break
	elif m+f >= 80:
		A.append('A')
	elif 65<=m+f<80:
		A.append('B')
	elif (50<=m+f<65) or ((30<=m+f<50) and (50<=r)):
		A.append('C')
	elif (30<=m+f<50):
		A.append('D')
	else:
		A.append('F')

for i in range(len(A)):
	print(A[i])

Failing test case input:
86 -1 0
22 57 -1
0 2 -2
-1 -1 -1

Expected output:
F
B
F


Actual output:
A
B
F


Fixed submission (verdict: Accepted):
A=[]
while True:
	
	
	
	m,f,r = [int(i) for i in input().split()]
	if m == f == r == -1:
		break
	elif m==-1 or f==-1:
		A.append('F')	
	elif m+f >= 80:
		A.append('A')
	elif 65<=m+f<80:
		A.append('B')
	elif (50<=m+f<65) or ((30<=m+f<50) and (50<=r)):
		A.append('C')
	elif (30<=m+f<50):
		A.append('D')
	else:
		A.append('F')

for i in range(len(A)):
	print(A[i])
Problem: p02411
Buggy submission (Python3, verdict: Wrong Answer):
while True:
    m, f, r = [int(i) for i in input().split()]
    if m == f == r == -1:
        break
    s = m + f
    if s >= 80:
        rank = 'A'
    elif 65 <= s < 80:
        rank = 'B'
    elif 50 <= s < 65 or (30 <= s < 50 and r >= 50):
        rank = 'C'
    elif 30 <= s < 50:
        rank = 'D'
    elif m == -1 or f == -1 or s < 30:
        rank = 'F'
    print(rank)
    

Failing test case input:
86 -1 0
22 57 -1
0 2 -2
-1 -1 -1

Expected output:
F
B
F


Actual output:
A
B
F


Fixed submission (verdict: Accepted):
while True:
    m, f, r = [int(i) for i in input().split()]
    if m == f == r == -1:
        break
    s = m + f
    if m == -1 or f == -1:
        print('F')
        continue
    if s >= 80:
        rank = 'A'
    elif 65 <= s < 80:
        rank = 'B'
    elif 50 <= s < 65 or (30 <= s < 50 and r >= 50):
        rank = 'C'
    elif 30 <= s < 50:
        rank = 'D'
    elif s < 30:
        rank = 'F'
    print(rank)

Problem: p02411
Buggy submission (Python3, verdict: Wrong Answer):
while 1:
    m,f,l = map(int,input().split())
    if m == f == l == -1:
        break
    elif (m == -1) or (f == -1):
        print("F")
        print(m,f,l)
    elif m + f >= 80:
        print("A")
    elif m + f >= 65:
        print("B")
    elif m + f >= 50:
        print("C")
    elif (m + f >= 30) and (l >= 50):
        print("C")
    elif m + f >= 30:
        print("D")
    else:
        print("F")

Failing test case input:
0 22 -2
50 30 -1
-1 2 -2
-1 -1 -1

Expected output:
F
A
F


Actual output:
F
A
F
-1 2 -2


Fixed submission (verdict: Accepted):
while 1:
    m,f,l = map(int,input().split())
    if m == f == l == -1:
        break
    elif (m == -1) or (f == -1):
        print("F")
    elif m + f >= 80:
        print("A")
    elif m + f >= 65:
        print("B")
    elif m + f >= 50:
        print("C")
    elif (m + f >= 30) and (l >= 50):
        print("C")
    elif m + f >= 30:
        print("D")
    else:
        print("F")

Problem: p02411
Buggy submission (Python3, verdict: Wrong Answer):
while True:
    m, f, r = map(int, input().split())
    if m == f == r== -1:
        break
    s = m + f
    if m == -1 or f == -1:
        print("F")
    if s >= 80:
        print("A")
    elif s >= 65:
        print("B")
    elif s >= 50:
        print("C")
    elif s >= 30:
        if r >= 50:
            print("C")
        else:
            print("D")
    else:
        print("F")
    




Failing test case input:
86 -1 0
22 57 -1
0 2 -2
-1 -1 -1

Expected output:
F
B
F


Actual output:
F
A
B
F


Fixed submission (verdict: Accepted):
while True:
    m, f, r = map(int, input().split())
    if m == f == r== -1:
        break
    s = m + f
    if m == -1 or f == -1:
        print("F")
    elif s >= 80:
        print("A")
    elif s >= 65:
        print("B")
    elif s >= 50:
        print("C")
    elif s >= 30:
        if r >= 50:
            print("C")
        else:
            print("D")
    else:
        print("F")
Problem: p02411
Buggy submission (Python3, verdict: Wrong Answer):
while True:
    m, f, r = [int(i) for i in input().split()]

    if m == f == r == -1:
        break

    total = m + f
    if m == -1 or f == -1 or total < 30:
        print("F")

    elif 65 <= total or total < 80:
        print("B")

    elif 50 <= total or total < 65:
        print("C")

    elif 30 <= total or total < 50 and r < 50:
        print("D")

    else:
        print("A")

    print()

Failing test case input:
40 53 -1
0 58 -1
0 1 0
-1 -1 -1

Expected output:
A
C
F


Actual output:
B

B

F



Fixed submission (verdict: Accepted):
while True:
   m, f, r = [int(i) for i in input().split()]
  
   if m == f == r == -1:
      break
   total = m + f
   if m == -1 or f == -1 or total < 30:
      print("F")
    
   elif total < 50 and r < 50:
      print("D")
 
   elif r >= 50 or total < 65:
      print("C")
    
   elif total < 80:
      print("B")
 
   else:
      print("A")

Problem: p02411
Buggy submission (Python3, verdict: Wrong Answer):
result = []
while True:
    m, f, r = map(int, input().split())
    if (m, f, r) == (-1, -1, -1):
        break
    if m == -1 or f == -1:
        result.append('F')
    if m + f >= 80:
        result.append('A')
    if 80 > m + f >= 65:
        result.append('B')
    if 65 > m + f >= 50:
        result.append('C')
    if 50 > m + f >= 30:
        result.append(['D', 'C'][r >= 50])
    if 30 > m + f:
        result.append('F')
for r in result:
    print(r)

Failing test case input:
20 11 -2
30 30 0
1 -1 -1
-1 -1 -1

Expected output:
D
C
F


Actual output:
D
C
F
F


Fixed submission (verdict: Accepted):
result = []
while True:
    m, f, r = map(int, input().split())
    if (m, f, r) == (-1, -1, -1):
        break
    if m == -1 or f == -1:
        result.append('F')
        continue
    if m + f >= 80:
        result.append('A')
    if 80 > m + f >= 65:
        result.append('B')
    if 65 > m + f >= 50:
        result.append('C')
    if 50 > m + f >= 30:
        result.append(['D', 'C'][r >= 50])
    if 30 > m + f:
        result.append('F')
for r in result:
    print(r)

Problem: p02411
Buggy submission (Python3, verdict: Wrong Answer):

while True:
    m,f,r=list(map(int,input().split()))
    if m==f==r==-1: break
    s=m+f
    print('F' if m*f<0 or s<30 else 'D' if 30<=s<50 and r<50 else 'C' if 50<=s<65 or m>=50 else 'B' if 65<=s<80 else 'A')

Failing test case input:
92 64 -1
16 50 -1
1 1 0
-1 -1 -1

Expected output:
A
B
F


Actual output:
C
B
F


Fixed submission (verdict: Accepted):

while True:
    m,f,r=list(map(int,input().split()))
    if m==f==r==-1: break
    s=m+f
    print('F' if m*f<0 or s<30 else 'D' if 30<=s<50 and r<50 else 'C' if 50<=s<65 or 30<=s<50 and 50<=r else 'B' if 65<=s<80 else 'A')
Problem: p02411
Buggy submission (Python3, verdict: Wrong Answer):
while True:
    m,f,r = map(int, input().split())
    if m==f==r==-1:
        break
    if m ==-1 or f == -1:
        print("F")
    elif (m+f) <=80:
        print("A")
    elif (m+f) <=65:
        print("B")
    elif (m+f) <=50:
        print("C")
    elif( m+f)<=30 and r <=50:
        print("C")
    elif ( m+f)<=30:
        print("D")
    else :
        print("F")



Failing test case input:
92 64 -1
16 50 -1
1 1 0
-1 -1 -1

Expected output:
A
B
F


Actual output:
F
A
A


Fixed submission (verdict: Accepted):
while True:
    m,f,r = map(int, input().split())
    if m==f==r==-1:
        break
    if m ==-1 or f == -1:
        print("F")
    elif (m+f) >=80:
        print("A")
    elif (m+f) >=65:
        print("B")
    elif (m+f) >=50:
        print("C")
    elif( m+f)>=30 and r >=50:
        print("C")
    elif (m+f)>=30:
        print("D")
    else:
        print("F")

Problem: p02411
Buggy submission (Python3, verdict: Wrong Answer):
while True:
    m,f,r=map(int,input().split())

    if m==f==r==-1:
        break

    elif 50<=m+f<65:
        print("C")

    
    elif m or f ==-1:
        print("F")

    elif 65<=m+f<80:
        print("B")

 

    elif 30<=m+f<50:
        print("D")

    elif 30<m+f<50 and r>50:
        print("C")

    elif  m+f>=80:
        print("A")

    else:
        print("F")

Failing test case input:
92 64 -1
16 30 -1
0 0 0
-1 -1 -1

Expected output:
A
D
F


Actual output:
F
F
F


Fixed submission (verdict: Accepted):
while True:
    m,f,r=map(int,input().split())
    if m==f==r==-1:
        break

    elif m==-1 or f==-1:
        print("F")

    elif m+f>=80:
        print("A")

    elif 65<=m+f<80:
        print("B")

    elif 50<=m+f<65:
        print("C")

    elif r>=50:
        print("C")

    elif 30<=m+f<50:
        print("D")

    else:
        print("F")

Problem: p02411
Buggy submission (Python3, verdict: Wrong Answer):
while True:
    m, f, r = map(int, input().split())
    if (m, f, r) == (-1, -1, -1):
        break
    if m+f >= 80:
        print("A")
    elif m+f >= 65 and m+f < 80:
        print("B")
    elif m+f >= 50 and m+f < 65:
        print("C")
    elif m+f >= 30 and m+f < 50:
        if r >= 50:
            print("C")
        else:
            print("D")
    else:
        print("F")

Failing test case input:
86 -1 0
22 57 -1
0 2 -2
-1 -1 -1

Expected output:
F
B
F


Actual output:
A
B
F


Fixed submission (verdict: Accepted):
while True:
    m, f, r = map(int, input().split())
    if (m, f, r) == (-1, -1, -1):
        break
    if m == -1 or f == -1:
        print("F")
    elif m+f >= 80:
        print("A")
    elif m+f >= 65 and m+f < 80:
        print("B")
    elif m+f >= 50 and m+f < 65:
        print("C")
    elif m+f >= 30 and m+f < 50:
        if r >= 50:
            print("C")
        else:
            print("D")
    else:
        print("F")
Problem: p02411
Buggy submission (Python3, verdict: Wrong Answer):
def solve(m, f, r):
    if (m == -1 or f == -1) or m + f < 30:
        return "F"
    for a, b in ((80, "A"), (65, "B"), (50, "C")):
        if m + f >= a:
            return b
    if r >= 50:
        return "C"
    return "F"
while True:
    m, f, r = map(int, input().split())
    if m == f == r == -1:
        break
    print(solve(m, f, r))


Failing test case input:
150 64 -2
16 30 -1
1 0 -1
-1 -1 -1

Expected output:
A
D
F


Actual output:
A
F
F


Fixed submission (verdict: Accepted):
def solve(m, f, r):
    if (m == -1 or f == -1) or m + f < 30:
        return "F"
    for a, b in ((80, "A"), (65, "B"), (50, "C")):
        if m + f >= a:
            return b
    if r >= 50:
        return "C"
    return "D"
while True:
    m, f, r = map(int, input().split())
    if m == f == r == -1:
        break
    print(solve(m, f, r))

Problem: p02411
Buggy submission (Python3, verdict: Wrong Answer):
import sys

for i in sys.stdin:
    scores = list(map(int, i.split()))
    m = scores[0]
    f = scores[1]
    r = scores[2]
    if m == f == r == -1:
        break
    elif m + f >= 80:
        print("A")
    elif 65 <= (m + f) < 80:
        print("B")
    elif 50 <= (m + f) < 65:
        print("C")
    elif 30 <= (m + f) < 50:
        if r >= 50:
            print("C")
        else:
            print("D")
    else:
        print("F")

Failing test case input:
86 -1 0
22 57 -1
0 2 -2
-1 -1 -1

Expected output:
F
B
F


Actual output:
A
B
F


Fixed submission (verdict: Accepted):
import sys

for i in sys.stdin:
    scores = list(map(int, i.split()))
    m = scores[0]
    f = scores[1]
    r = scores[2]
    if m == f == r == -1:
        break
    elif (m == -1) or (f == -1):
        print("F")
    elif m + f >= 80:
        print("A")
    elif 65 <= (m + f) < 80:
        print("B")
    elif 50 <= (m + f) < 65:
        print("C")
    elif 30 <= (m + f) < 50:
        if r >= 50:
            print("C")
        else:
            print("D")
    else:
        print("F")

Problem: p02411
Buggy submission (Python3, verdict: Wrong Answer):
while True:
    m,f,r =[int(i) for i in input().split()]

    if m == f == r ==-1:
        break

    elif (m+f) >=80:
        print("A")

    elif 65<=(m+f)<80:
        print("B")

    elif 50<=(m+f)<65 :
        print("C")

    elif 30 <= (m + f)<50:
        if r>=50:
            print("C")
        else:
            print("D")


    elif (m+f)<30:
        print("F")

    elif m==-1 or f==-1:
        print("F")

Failing test case input:
86 -1 0
22 57 -1
0 2 -2
-1 -1 -1

Expected output:
F
B
F


Actual output:
A
B
F


Fixed submission (verdict: Accepted):
while True:
    m, f, r = [int(i) for i in input().split()]
 
    if m == f == r == -1:
        break
 
    total = m + f
    if m == -1 or f == -1 or total < 30:
        print('F')
 
    elif total < 50 and r < 50:
        print('D')
 
    elif total < 65:
        print('C')
         
    elif total < 80:
        print('B')
         
    else:
        print('A')
Problem: p02411
Buggy submission (Python3, verdict: Wrong Answer):
while True:
    points = list(map(int,input().split()))

    if points == [-1,-1,-1]:
        break

    gou = points[0] + points[1]
    if gou >= 80:
        print("A")
    elif 65 <= gou < 80:
        print("B")
    elif 50 <= gou < 65:
        print("C")
    elif 30 <= gou < 50:
        if points[2] >= 50:
            print("C")
        else:
            print("D")
    else:
        print("F")

Failing test case input:
86 -1 0
22 57 -1
0 2 -2
-1 -1 -1

Expected output:
F
B
F


Actual output:
A
B
F


Fixed submission (verdict: Accepted):
while True:
    points = list(map(int,input().split()))

    if points == [-1,-1,-1]:
        break

    gou = points[0] + points[1]
    if points[0]==-1 or points[1]==-1:
        print("F")
    elif gou >= 80:
        print("A")
    elif 65 <= gou < 80:
        print("B")
    elif 50 <= gou < 65:
        print("C")
    elif 30 <= gou < 50:
        if points[2] >= 50:
            print("C")
        else:
            print("D")
    else:
        print("F")

Problem: p02411
Buggy submission (Python3, verdict: Wrong Answer):
score = []
while True:
    (m, f, r) = [int(i) for i in input().split()]
    if m == f == r == -1:
        break
    score.append([m, f, r])

for mc, fc, rc in score:
    if mc + fc >= 80:
        print('A')
    elif mc + fc >= 65:
        print('B')
    elif mc + fc >= 50 or rc >= 50:
        print('C')
    elif mc + fc >= 30:
        print('F')
    else:
        print('F')

Failing test case input:
54 50 -1
16 30 -1
0 2 -1
-1 -1 -1

Expected output:
A
D
F


Actual output:
A
F
F


Fixed submission (verdict: Accepted):
score = []
while True:
    (m, f, r) = [int(i) for i in input().split()]
    if m == f == r == -1:
        break
    score.append([m, f, r])

for mc, fc, rc in score:
    if mc == -1 or fc == -1:
        print('F')
    elif mc + fc >= 80:
        print('A')
    elif mc + fc >= 65:
        print('B')
    elif mc + fc >= 50 or rc >= 50:
        print('C')
    elif mc + fc >= 30:
        print('D')
    else:
        print('F')
Problem: p02411
Buggy submission (Python3, verdict: Wrong Answer):
m = 0
f = 0
r = 0

while(True):
    I = input().split()
    m = int(I[0])
    f = int(I[1])
    r = int(I[2])
    if m == -1 and f == -1 and r == -1:
        break
    score = m + f
    if score >= 80:
        print('A')
    if 65 <= score and score < 80:
        print('B')
    if 50 <= score and score < 65:
        print('C')
    if 30 <= score and score < 50:
        if r >= 50:
            print('C')
        else:
            print('D')
    if score < 30:
        print('F')

Failing test case input:
86 -1 0
22 57 -1
0 2 -2
-1 -1 -1

Expected output:
F
B
F


Actual output:
A
B
F


Fixed submission (verdict: Accepted):
m = 0
f = 0
r = 0

while(True):
    I = input().split()
    m = int(I[0])
    f = int(I[1])
    r = int(I[2])
    if m == -1 and f == -1 and r == -1:
        break
    score = m + f
    if m == -1 or f == -1:
        print('F')
        continue
    if score >= 80:
        print('A')
    if 65 <= score and score < 80:
        print('B')
    if 50 <= score and score < 65:
        print('C')
    if 30 <= score and score < 50:
        if r >= 50:
            print('C')
        else:
            print('D')
    if score < 30:
        print('F')

Problem: p02411
Buggy submission (Python3, verdict: Wrong Answer):
while True:
    m, f, r = map(int, (input().split()))
    score = m + f
    if m == f == r == -1:
        break
    else:
        if m == -1 or f == -1:
            print("F")
        elif score >= 80:
            print("A")
        elif 80 > score >= 65:
            print("B")
        elif 65 > score >= 50:
            print("C")
        elif 50 > score >= 35 and r >= 50:
            print("C")
        elif 50 > score >= 35 and r < 50:
            print("D")
        else:
            print("F")

Failing test case input:
20 11 -2
16 30 0
1 0 -1
-1 -1 -1

Expected output:
D
D
F


Actual output:
F
D
F


Fixed submission (verdict: Accepted):
while True:
    m, f, r = map(int, (input().split()))
    score = m + f
    if m == f == r == -1:
        break
    else:
        if m == -1 or f == -1:
            print("F")
        elif score >= 80:
            print("A")
        elif 80 > score >= 65:
            print("B")
        elif 65 > score >= 50:
            print("C")
        elif 50 > score >= 30 and r >= 50:
            print("C")
        elif 50 > score >= 30 and r < 50:
            print("D")
        else:
            print("F")
Problem: p02411
Buggy submission (Python3, verdict: Wrong Answer):
results = []
while True:
    m, f, r = map(int, input().split())
    result = ""
    if m == f == r == -1:
        break
    else:
        if 80 <= m + f:
            result = "A"
        elif 65 <= m + f < 80:
            result = "B"
        elif 50 <= m + f < 65:
            result = "C"
        elif 30 <= m + f < 50:
            if 50 <= r:
                result = "C"
            else:
                result = "D"
        else:
            result = "F"
    results.append(result)

for result in results:
    print(result)



Failing test case input:
86 -1 0
22 57 -1
0 2 -2
-1 -1 -1

Expected output:
F
B
F


Actual output:
A
B
F


Fixed submission (verdict: Accepted):
results = []
while True:
    m, f, r = map(int, input().split())
    result = ""
    if m == f == r == -1:
        break
    elif m == -1 or f == -1:
        result = "F"
    else:
        if 80 <= m + f:
            result = "A"
        elif 65 <= m + f < 80:
            result = "B"
        elif 50 <= m + f < 65:
            result = "C"
        elif 30 <= m + f < 50:
            if 50 <= r:
                result = "C"
            else:
                result = "D"
        else:
            result = "F"
    results.append(result)

for result in results:
    print(result)

Problem: p02411
Buggy submission (Python3, verdict: Wrong Answer):
while True:
    m,f,r = tuple(int(n) for n in input().split())
    if m == f == r == -1:
        break
    if (m == -1 or f == -1) or m * f < 30:
        print("F")
    elif m + f >= 80:
        print("A")
    elif 65 <= m + f < 80:
        print("B")
    elif 50 <= m + f < 65:
        print("C")
    else:
        if r >= 50:
            print("C")
        else:
            print("D")


Failing test case input:
40 53 -1
0 58 -1
0 2 -1
-1 -1 -1

Expected output:
A
C
F


Actual output:
A
F
F


Fixed submission (verdict: Accepted):
while True:
    m,f,r = tuple(int(n) for n in input().split())
    if m == f == r == -1:
        break
    if (m == -1 or f == -1) or m + f < 30:
        print("F")
    elif m + f >= 80:
        print("A")
    elif 65 <= m + f < 80:
        print("B")
    elif 50 <= m + f < 65:
        print("C")
    else:
        if r >= 50:
            print("C")
        else:
            print("D")
Problem: p02411
Buggy submission (Python3, verdict: Wrong Answer):
result = []
while True:
    m, f, r = map(int, input().split())
    if (m, f, r) == (-1, -1, -1):
        break
    if m == -1 or f == -1:
        result.append('F')
    if m + f >= 80:
        result.append('A')
    if 80 > m + f >= 65:
        result.append('B')
    if 65 > m + f >= 50:
        result.append('C')
    if 50 > m + f >= 30:
        result.append(['D', 'C'][r >= 50])
    if 30 > m + f:
        result.append('F')
print('\n'.join(result))

Failing test case input:
0 22 -2
50 30 -1
-1 2 -2
-1 -1 -1

Expected output:
F
A
F


Actual output:
F
A
F
F


Fixed submission (verdict: Accepted):
result = []
while True:
    m, f, r = map(int, input().split())
    if (m, f, r) == (-1, -1, -1):
        break
    if m == -1 or f == -1:
        result.append('F')
        continue
    if m + f >= 80:
        result.append('A')
    if 80 > m + f >= 65:
        result.append('B')
    if 65 > m + f >= 50:
        result.append('C')
    if 50 > m + f >= 30:
        result.append(['D', 'C'][r >= 50])
    if 30 > m + f:
        result.append('F')
for r in result:
    print(r)

Problem: p02411
Buggy submission (Python3, verdict: Wrong Answer):
for _ in [None] * 50:
    m, f, r = map(int, input().split())
    result = " "
    if m == f == r == -1:
        break
    if m == -1 or f == -1 or m + f < 30:
        result = "F"
    elif m + f > 80:
        result = "A"
    elif 80 > m + f >= 65:
        result = "B"
    elif 65 > m + f >= 50:
        result = "C"
    else:
        result = "C" if r >= 50 else "D"
    print(result)



Failing test case input:
0 22 -2
50 30 -1
-1 2 -2
-1 -1 -1

Expected output:
F
A
F


Actual output:
F
D
F


Fixed submission (verdict: Accepted):
for _ in [None] * 50:
    m, f, r = map(int, input().split())
    result = " "
    if m == f == r == -1:
        break
    if m == -1 or f == -1 or m + f < 30:
        result = "F"
    elif m + f >= 80:
        result = "A"
    elif 80 > m + f >= 65:
        result = "B"
    elif 65 > m + f >= 50:
        result = "C"
    else:
        result = "C" if r >= 50 else "D"
    print(result)

Problem: p02411
Buggy submission (Python3, verdict: Wrong Answer):
while True:
    m,f,r = map(int,input().split())
    score = ""
    if(m == -1 and f == -1 and r == -1): break
    if(m == -1 or f == -1): score = "F"
    if(m+f >= 80): score = "A"
    elif(m+f >= 65): score = "B"
    elif(m+f >= 50): score = "C"
    elif(m+f >= 30):
        if(r >= 50): score = "C"
        else: score = "D"
    else:
        score = "F"
    print(score)
    


Failing test case input:
86 -1 0
22 57 -1
0 2 -2
-1 -1 -1

Expected output:
F
B
F


Actual output:
A
B
F


Fixed submission (verdict: Accepted):
while True:
    m,f,r = map(int,input().split())
    score = ""
    if(m == -1 and f == -1 and r == -1): break
    if(m == -1 or f == -1): score = "F"
    elif(m+f >= 80): score = "A"
    elif(m+f >= 65): score = "B"
    elif(m+f >= 50): score = "C"
    elif(m+f >= 30):
        if(r >= 50): score = "C"
        else: score = "D"
    else:
        score = "F"
    print(score)
Problem: p02411
Buggy submission (Python3, verdict: Wrong Answer):
while 1:
 m,f,r=map(int,input().split())
 if m==f==r==-1:break
 if m==-1 or f==-1:print('F')
 elif m+f>79:print('A')
 elif m+f>64:print('B')
 elif m+f>49:print('C')
 elif m+f>29:print('D') if r>49 else print('C')
 else:print('F')

Failing test case input:
40 10 -1
16 30 -1
0 2 -1
-1 -1 -1

Expected output:
C
D
F


Actual output:
C
C
F


Fixed submission (verdict: Accepted):
while 1:
 m,f,r=map(int,input().split())
 if m==f==r==-1:break
 if m==-1 or f==-1:print('F')
 elif m+f>79:print('A')
 elif m+f>64:print('B')
 elif m+f>49:print('C')
 elif m+f>29:print('C') if r>49 else print('D')
 else:print('F')

Problem: p02411
Buggy submission (Python3, verdict: Wrong Answer):
result = []
m,f,r=[int(x) for x in input().split()]
while not m==f==r==-1:
    if (m + f >= 80):
        res = 0
    elif (65 <= m + f < 80):
        res = 1
    elif (50 <= m + f < 65):
        res = 2
    elif (30 <= m + f < 50):
        res = 4
        if (50 <= r):
            res = 3
    else :
        res = 5
    result.append(res)
    m,f,r=[int(x) for x in input().split()]
for i in result:
    print(chr(65+i))

Failing test case input:
92 111 -1
16 30 -1
0 2 -1
-1 -1 -1

Expected output:
A
D
F


Actual output:
A
E
F


Fixed submission (verdict: Accepted):
result = []
m,f,r=[int(x) for x in input().split()]
while not m==f==r==-1:
    if (m == -1 or f == -1):
        res = "F"
    elif (m + f >= 80):
        res = "A"
    elif (65 <= m + f < 80):
        res = "B"
    elif (50 <= m + f < 65):
        res = "C"
    elif (30 <= m + f < 50):
        res = "D"
        if (50 <= r):
            res = "C"
    else :
        res = "F"
    result.append(res)
    m,f,r=[int(x) for x in input().split()]
for i in result:
    print(i)

Problem: p02411
Buggy submission (Python3, verdict: Wrong Answer):
while True:
    (m, f, r) = [int(i) for i in input().split()]
    if m == f == r == -1:
        break

    s = m + f

    if m == -1 or f == -1 or s < 30:
        print('F')

    elif 80 < s:
        print('A')


    elif 65 < s:
        print('B')

    elif 50 < s or 50 < r:
        print('C')

    elif 30 < s:
        print('D')

Failing test case input:
40 10 -1
16 30 -1
0 2 -1
-1 -1 -1

Expected output:
C
D
F


Actual output:
D
D
F


Fixed submission (verdict: Accepted):
while True:
    (m, f, r) = [int(i) for i in input().split()]
    if m == f == r == -1:
        break

    s = m + f

    if m == -1 or f == -1 or s < 30:
        print('F')
    elif s < 50 and r < 50:
        print('D')
    elif s < 65:
        print('C')
    elif s < 80:
        print('B')
    else:
        print('A')
Problem: p02411
Buggy submission (Python3, verdict: Wrong Answer):
while True:
    a = input().split(' ')
    if a[0] == '-1' and a[1] == '-1' and a[2] == '-1':
        break
    elif int(a[0]) + int(a[1]) >= 80:
        print('A')
    elif 65 <= int(a[0]) + int(a[1]) < 80:
        print('B')
    elif 50 <= int(a[0]) + int(a[1]) < 65:
        print('C')
    elif 30 <= int(a[0]) + int(a[1]) < 50:
        if int(a[2]) >= 50:
            print('C')
        else:
            print('D')
    else:
        print('F')

Failing test case input:
86 -1 0
22 57 -1
0 2 -2
-1 -1 -1

Expected output:
F
B
F


Actual output:
A
B
F


Fixed submission (verdict: Accepted):
while True:
    a = input().split(' ')
    if a[0] == '-1' and a[1] == '-1' and a[2] == '-1':
        break
    elif int(a[0]) == -1 or int(a[1]) == -1:
        print('F')
    elif int(a[0]) + int(a[1]) >= 80:
        print('A')
    elif 65 <= int(a[0]) + int(a[1]) < 80:
        print('B')
    elif 50 <= int(a[0]) + int(a[1]) < 65:
        print('C')
    elif 30 <= int(a[0]) + int(a[1]) < 50:
        if int(a[2]) >= 50:
            print('C')
        else:
            print('D')
    else:
        print('F')

Problem: p02411
Buggy submission (Python3, verdict: Wrong Answer):
while True:
    m,f,r =[int(i) for i in input().split()]

    if m == f == r ==-1:
        break

    if (m+f) >=80:
        print("A")

    elif 65<=(m+f)<80:
        print("B")

    elif 50<=(m+f)<65 :
        print("C")

    elif 30 <= (m + f)<50:
        if r>=50:
            print("C")
        else:
            print("D")


    elif (m+f)<30 or m == -1 or f ==-1:
        print("F")

Failing test case input:
86 -1 0
22 57 -1
0 2 -2
-1 -1 -1

Expected output:
F
B
F


Actual output:
A
B
F


Fixed submission (verdict: Accepted):
while True:
    m, f, r = [int(i) for i in input().split()]
 
    if m == f == r == -1:
        break
 
    total = m + f
    if m == -1 or f == -1 or total < 30:
        print('F')
 
    elif total < 50 and r < 50:
        print('D')
 
    elif total < 65:
        print('C')
         
    elif total < 80:
        print('B')
         
    else:
        print('A')
Problem: p02411
Buggy submission (Python3, verdict: Wrong Answer):
while True:
    try:
        m, f, r = map(int, input().split())
        result = ""
        if m == f == r == -1:
            break
        s = m + f
        if m == -1 or f == -1:
            result = "F"
        elif s >= 80:
            result = "A"
        elif s >= 65:
            result = "B"
        elif s >= 50:
            result = "C"
        elif s >= 30 and r >= 50:
            result = "C"
        elif s >= 0:
            result = "F"
    except EOFError:
        break
    print(result)

Failing test case input:
20 11 -2
16 30 0
1 -1 -1
-1 -1 -1

Expected output:
D
D
F


Actual output:
F
F
F


Fixed submission (verdict: Accepted):
while True:
    try:
        m, f, r = map(int, input().split())
        result = ""
        if m == f == r == -1:
            break
        s = m + f
        if m == -1 or f == -1:
            result = "F"
        elif s >= 80:
            result = "A"
        elif s >= 65:
            result = "B"
        elif s >= 50:
            result = "C"
        elif s >= 30:
            if r >= 50:
                result = "C"
            else:
                result = "D"
        elif s >= 0:
            result = "F"
    except EOFError:
        break
    print(result)

Problem: p02411
Buggy submission (Python3, verdict: Wrong Answer):
while True:
    m, f, r = map(int, input().split())

    if m == -1 and f == -1 and r == -1:
        break

    if m == -1 and f == -1:
        print('F')
    elif m + f >= 80:
        print('A')
    elif 80 > m + f >= 65:
        print('B')
    elif 65 > m + f >= 50 or r >= 50:
        print('C')
    elif 50 > m + f >= 30:
        print('D')
    else:
        print('F')

Failing test case input:
86 -1 0
22 57 -1
0 2 -2
-1 -1 -1

Expected output:
F
B
F


Actual output:
A
B
F


Fixed submission (verdict: Accepted):
while True:
    m, f, r = map(int, input().split())

    if m == -1 and f == -1 and r == -1:
        break

    if m == -1 or f == -1:
        print('F')
    elif m + f >= 80:
        print('A')
    elif 80 > m + f >= 65:
        print('B')
    elif 65 > m + f >= 50 or r >= 50:
        print('C')
    elif 50 > m + f >= 30:
        print('D')
    else:
        print('F')
Problem: p02411
Buggy submission (Python3, verdict: Wrong Answer):
while True:

    m, f, r = map(int, input().split())
    if m==f==r== -1:
        break
    result = ""
    sum = m + f
    
    if (m==-1)or(f==-1):
        result = "F"
    elif sum >= 80:
        result = 'A'
    elif sum>= 65:
        result = "B"
    elif sum>=50:
        result = "C"
    elif sum>= 30:
        reult="D"
        if r>=50:
            result = 'C'
    else:
        result = 'F'

    print("{}".format(result))

Failing test case input:
92 64 0
16 30 -1
0 2 0
-1 -1 -1

Expected output:
A
D
F


Actual output:
A

F


Fixed submission (verdict: Accepted):
while True:

    m, f, r = map(int, input().split())
    if m==f==r== -1:
        break
    result = ""
    sum = m + f
    
    if (m==-1)or(f==-1):
        result = "F"
    elif sum >= 80:
        result = 'A'
    elif sum>= 65:
        result = "B"
    elif sum>=50:
        result = "C"
    elif sum>= 30:
        result="D"
        if r>=50:
            result = 'C'
    else:
        result = 'F'

    print("{}".format(result))

Problem: p02411
Buggy submission (Python3, verdict: Wrong Answer):
while True:
    m, f, r = map(int,input().split())
    if m + f + r < 0:
        break
    if m < 0 or f < 0:
        print("F")
    elif m + f >= 80:
        print("A")
    elif m + f >= 65:
        print("B")
    elif m + f >= 50:
        print("C")
    elif m + f >= 30:
        if r >= 50:
            print("C")
        else:
            print("D")
    else:
        print("F")

Failing test case input:
40 53 -1
0 7 -1
0 1 -2
-1 -1 -1

Expected output:
A
F
F


Actual output:
A
F


Fixed submission (verdict: Accepted):
while True:
    m, f, r = map(int,input().split())
    if m + f < 0:
        break
    if m < 0 or f < 0:
        print("F")
    elif m + f >= 80:
        print("A")
    elif m + f >= 65:
        print("B")
    elif m + f >= 50:
        print("C")
    elif m + f >= 30:
        if r >= 50:
            print("C")
        else:
            print("D")
    else:
        print("F")

Problem: p02411
Buggy submission (Python3, verdict: Wrong Answer):
result = []
while True:
    m, f, r = map(int, input().split())
    if (m, f) == (-1, -1):
        break
    if m == -1 or f == -1:
        result.append('F')
    if m + f >= 80:
        result.append('A')
    if 80 > m + f >= 65:
        result.append('B')
    if 65 > m + f >= 50:
        result.append('C')
    if 50 > m + f >= 30:
        result.append('D')
    if 30 > m + f:
        result.append('F')
print('\n'.join(result))

Failing test case input:
0 22 -2
50 30 -1
-1 2 -2
-1 -1 -1

Expected output:
F
A
F


Actual output:
F
A
F
F


Fixed submission (verdict: Accepted):
result = []
while True:
    m, f, r = map(int, input().split())
    if (m, f, r) == (-1, -1, -1):
        break
    if m == -1 or f == -1:
        result.append('F')
        continue
    if m + f >= 80:
        result.append('A')
    if 80 > m + f >= 65:
        result.append('B')
    if 65 > m + f >= 50:
        result.append('C')
    if 50 > m + f >= 30:
        result.append(['D', 'C'][r >= 50])
    if 30 > m + f:
        result.append('F')
for r in result:
    print(r)
Problem: p02411
Buggy submission (Python3, verdict: Wrong Answer):
def main():
    while True:
        m, f, r = map(int, input().split())
        if m == f == r == -1:
            break
        total = m + f
        if m == f == -1:
            print('F')
        elif total >= 80:
            print('A')
        elif total >= 65:
            print('B')
        elif total >= 50:
            print('C')
        elif total >= 30:
            if r >= 50:
                print('C')
            else:
                print('D')
        else:
            print('F')
    return


if __name__ == '__main__':
    main()



Failing test case input:
86 -1 0
22 57 -1
0 2 -2
-1 -1 -1

Expected output:
F
B
F


Actual output:
A
B
F


Fixed submission (verdict: Accepted):
def main():
    while True:
        m, f, r = map(int, input().split())
        if m == f == r == -1:
            break
        total = m + f
        if m == -1 or f == -1:
            print('F')
        elif total >= 80:
            print('A')
        elif total >= 65:
            print('B')
        elif total >= 50:
            print('C')
        elif total >= 30:
            if r >= 50:
                print('C')
            else:
                print('D')
        else:
            print('F')
    return


if __name__ == '__main__':
    main()

Problem: p02411
Buggy submission (Python3, verdict: Wrong Answer):

while True:
	arr = list(map(int, input().split()))
	m = arr[0]
	f = arr[1]
	r = arr[2]
	
	if m == -1 and f == -1 and r == -1:
		break
	
	total = m + f
	if total >= 80: print('A')
	elif total >= 65: print('B')
	elif total >= 50: print('C')
	elif total >= 30 and r >= 50: print('C')
	elif total >= 30: print('D')
	else: print('F')



Failing test case input:
86 -1 0
22 57 -1
0 2 -2
-1 -1 -1

Expected output:
F
B
F


Actual output:
A
B
F


Fixed submission (verdict: Accepted):

while True:
	arr = list(map(int, input().split()))
	m = arr[0]
	f = arr[1]
	r = arr[2]
	
	if m == -1 and f == -1 and r == -1:
		break
	
	total = m + f
	if m == -1 or f == -1: print('F')
	elif total >= 80: print('A')
	elif total >= 65: print('B')
	elif total >= 50: print('C')
	elif total >= 30 and r >= 50: print('C')
	elif total >= 30: print('D')
	else: print('F')

Problem: p02411
Buggy submission (Python3, verdict: Wrong Answer):
while True:
    m,f,r = [int(i) for i in input().strip().split()]
    if m==f==r==-1 : break
    if m*f<0 and 0<=(m or f)<30 : print("F")

    if m+f<30 : print("F")
    elif m+f<50 and r<50 : print("D")
    elif m+f<65 : print("C")
    elif m+f<80 : print("B")
    elif m+f>=80 : print("A")
    else: print("F")

Failing test case input:
20 11 -2
16 30 0
1 -1 -1
-1 -1 -1

Expected output:
D
D
F


Actual output:
D
D
F
F


Fixed submission (verdict: Accepted):
mf = 0
while True:
    m,f,r = [int(i) for i in input().strip().split()]
    if m==f==r==-1 : break
    mf = m+f

    if m*f<0 or mf<30 : print("F")
    elif mf<50 and r<50 : print("D")
    elif mf<65 : print("C")
    elif mf<80 : print("B")
    elif mf>=80 : print("A")
    else: print("F")
Problem: p02411
Buggy submission (Python3, verdict: Wrong Answer):
while(1):
    m,f,r=map(int,input().split())
    if m==-1 and f==-1 and r==-1:
        break
    if m==-1 or f==-1 or m+f<30:
        print("F")
    if m+f>=80:
        print("A")
    if m+f>=65 and m+f<80:
        print("B")
    if m+f>=50 and m+f<65:
        print("C")
    if m+f>=30 and m+f<50 or r>=50:
        print("D")







Failing test case input:
86 -1 0
22 57 -1
0 2 -2
-1 -1 -1

Expected output:
F
B
F


Actual output:
F
A
B
F


Fixed submission (verdict: Accepted):
while(1):
    m,f,r=map(int,input().split())
    if m==-1 and f==-1 and r==-1:
        break
    
    elif m==-1 or f==-1:
        print("F")
    elif m+f>=80:
        print("A")
    elif m+f>=65 and m+f<80:
        print("B")
    elif m+f>=50 and m+f<65:
        print("C")
    elif m+f>=30 and m+f<50 and r>=50:
        print("C")
    elif m+f>=30 and m+f<50:
        print("D")
    elif m+f<30:
        print("F")
Problem: p02264
Buggy submission (Python3, verdict: Wrong Answer):
n, q = [int(i) for i in input().split()]
que = []
ans_count = 0 
time = 0 

for i in range(n):
    que.append([i for i in input().split()])

while(ans_count!=n):
    pop_process = que.pop(0)
    pop_process[1] = int(pop_process[1])
    
    if pop_process[1] < q:
        time += pop_process[1]
        print('{0} {1}'.format(pop_process[0], time))
        ans_count += 1
    else:
        time += q
        pop_process[1] -= q
        que.append(pop_process)


Failing test case input:
5 100
p1 54
2p 80
3p 200
p4 350
p6 14

Expected output:
p1 54
2p 134
p6 348
3p 448
p4 698


Actual output:
p1 54
2p 134
p6 348
3p 548
p4 698


Fixed submission (verdict: Accepted):
n, q = [int(i) for i in input().split()]
que = []
ans_count = 0 
time = 0 

for i in range(n):
    que.append([i for i in input().split()])

while(ans_count!=n):
    pop_process = que.pop(0)
    pop_process[1] = int(pop_process[1])
    
    if pop_process[1] <= q:
        time += pop_process[1]
        print('{0} {1}'.format(pop_process[0], time))
        ans_count += 1
    else:
        time += q
        pop_process[1] -= q
        que.append(pop_process)

Problem: p02264
Buggy submission (Python3, verdict: Wrong Answer):
import collections
import sys

n,q = map(int,input().split())
data = [[i for i in input().split()]for i in range(n)]
time = 0
while data:
    task = data[0]
    del data[0]
    if int(task[1]) < q:
        time += int(task[1])
        print(task[0],time)
      
    else:
        time += q
        task[1] = str(int(task[1]) - q)
        data.append(task)

Failing test case input:
3 001
3p 25
2q 446
1p 314
p4 472
5o 25

Expected output:
3p 73
1p 653
2q 785


Actual output:
3p 75
1p 654
2q 785


Fixed submission (verdict: Accepted):
import collections
import sys

n,q = map(int,input().split())
data = [[i for i in input().split()]for i in range(n)]
time = 0
while data:
    task = data[0]
    del data[0]
    if int(task[1]) <= q:
        time += int(task[1])
        print(task[0],time)
      
    else:
        time += q
        task[1] = str(int(task[1]) - q)
        data.append(task)

Problem: p02264
Buggy submission (Python3, verdict: Wrong Answer):
N, Q = map(int, input().strip().split())

A = []
D = {}
for l in range(N):
    n, t = input().strip().split()
    D[n] = int(t)
    A.append(n)

print(A)
T = 0
d = 0
while True:
    n = A.pop(0)
    if D[n] > Q:
        D[n] -= Q
        T += Q
        A.append(n)
    else:
        T += D[n]
        print('{0}  {1}'.format(n, T))
        d += 1
        if d == N:
            break

Failing test case input:
3 100
p2 19
2p 134
p2 200
p4 350
p6 14

Expected output:
p2 19
2p 253
p2 353


Actual output:
['p2', '2p', 'p2']
p2  300
p2  400
2p  434


Fixed submission (verdict: Accepted):
N, Q = map(int, input().strip().split())

A = []
D = {}
for l in range(N):
    n, t = input().strip().split()
    A.append([n, int(t)])

T = 0
while A:
    l = A.pop(0)
    if l[1] > Q:
        l[1] -= Q
        T += Q
        A.append(l)
    else:
        T += l[1]
        print(l[0], T)
Problem: p02264
Buggy submission (Python3, verdict: Wrong Answer):
from collections import deque


def main():
    process_count, process_time, processes = get_input()
    result = run_roundrobin(processes=processes, time=process_time)
    for r in result:
        print(r.name, r.time)


def run_roundrobin(processes, time, total_time=0, result=[]):
    while not processes:
        p = processes.popleft()
        if p.time <= time:
            total_time += p.time
            p.time = total_time
            result.append(p)
        else:
            total_time += time
            p.time -= time
            processes.append(p)

    return result


def get_input():
    count, time = list(map(lambda x: int(x), input().split(' ')))

    processes = deque([])
    for _ in range(count):
        im = input().split(' ')
        p = Process(im[0], int(im[1]))
        processes.append(p)

    return count, time, processes


class Process():

    def __init__(self, name, time):
        self.name = name
        self.time = time


main()

Failing test case input:
3 100
p1 150
2p 134
p2 200
p4 350
p6 14

Expected output:
p1 350
2p 384
p2 484


Actual output:

Fixed submission (verdict: Accepted):
from collections import deque


def main():
    process_count, process_time, processes = get_input()
    result = run_roundrobin(processes=processes, time=process_time)
    for r in result:
        print(r.name, r.time)


def run_roundrobin(processes, time, total_time=0, result=[]):
    while processes:
        p = processes.popleft()
        if p.time <= time:
            total_time += p.time
            p.time = total_time
            result.append(p)
        else:
            total_time += time
            p.time -= time
            processes.append(p)

    return result


def get_input():
    count, time = list(map(lambda x: int(x), input().split(' ')))

    processes = deque([])
    for _ in range(count):
        im = input().split(' ')
        p = Process(im[0], int(im[1]))
        processes.append(p)

    return count, time, processes


class Process():

    def __init__(self, name, time):
        self.name = name
        self.time = time


main()
Problem: p02264
Buggy submission (Python3, verdict: Wrong Answer):
from collections import deque

n, q = [int(_) for _ in input().split()]
processes = deque([tuple(input().split()) for i in range(n)])

time = 0
while processes:
    process = processes.popleft()

    if int(process[1]) < q:
        time += int(process[1])
        print(process[0], time)

    else:
        time += q
        processes.append((process[0], int(process[1]) - q))



Failing test case input:
5 100
p1 54
2p 80
3p 200
p4 350
p5 14

Expected output:
p1 54
2p 134
p5 348
3p 448
p4 698


Actual output:
p1 54
2p 134
p5 348
3p 548
p4 698


Fixed submission (verdict: Accepted):
from collections import deque

n, q = [int(_) for _ in input().split()]
processes = deque([tuple(input().split()) for i in range(n)])

time = 0
while processes:
    process = processes.popleft()

    if int(process[1]) <= q:
        time += int(process[1])
        print(process[0], time)

    else:
        time += q
        processes.append((process[0], int(process[1]) - q))

Problem: p02264
Buggy submission (Python3, verdict: Wrong Answer):
N, Q = map(int, input().strip().split())

A = []
D = {}
for l in range(N):
    n, t = input().strip().split()
    D[n] = int(t)
    A.append(n)

print(A)
T = 0
d = 0
while True:
    n = A.pop(0)
    if D[n] > Q:
        D[n] -= Q
        T += Q
        A.append(n)
    else:
        T += D[n]
        print(str(n) + ' ' + str(T))
        d += 1
        if d == N:
            break

Failing test case input:
4 101
p1 150
3o 108
p3 460
p4 267
p4 8

Expected output:
p1 453
3o 460
p4 828
p3 985


Actual output:
['p1', '3o', 'p3', 'p4']
p1 453
3o 460
p4 828
p3 985


Fixed submission (verdict: Accepted):
N, Q = map(int, input().strip().split())

A = []
D = {}
for l in range(N):
    n, t = input().strip().split()
    A.append([n, int(t)])

T = 0
while A:
    l = A.pop(0)
    if l[1] > Q:
        l[1] -= Q
        T += Q
        A.append(l)
    else:
        T += l[1]
        print(l[0], T)

Problem: p02264
Buggy submission (Python3, verdict: Wrong Answer):
a=input().split()
n=int(a[0])
q=int(a[1])
b=[0 for i in range(2*n)]
cnt=0
tmp=0
for i in range(n):
    B=input().split()
    b[2*i]=B[0]
    b[2*i+1]=int(B[1])
while len(b)>0:
    tmp=b[1]-100
    if tmp>0:
        b.append(b[0])
        b.append(tmp)
        del b[0]
        del b[0]
        cnt=cnt+100
    else:
        cnt=cnt+b[1]
        print(b[0],cnt)
        del b[0]
        del b[0]


Failing test case input:
4 101
p3 102
p3 62
3p 433
q4 95
5p 19

Expected output:
p3 163
q4 359
p3 360
3p 692


Actual output:
p3 162
q4 357
p3 359
3p 692


Fixed submission (verdict: Accepted):
a=input().split()
n=(int)(a[0])
q=(int)(a[1])
b=[0 for i in range(2*n)]
cnt=0
tmp=0
for i in range(n):
    B=input().split()
    b[2*i]=B[0]
    b[2*i+1]=int(B[1])
while len(b)>0:
    tmp=b[1]-q
    if tmp>0:
        b.append(b[0])
        b.append(tmp)
        del b[0]
        del b[0]
        cnt=cnt+q
    else:
        cnt=cnt+b[1]
        print(b[0],cnt)
        del b[0]
        del b[0]