qyliang/CodeNanoFix huggingface dataset:
Buggy code:
a = int(input())
b = int(input())
h = int(input())

s = ((a + b) * h ) / 2
print(s)


Fixed code:
a = int(input())
b = int(input())
h = int(input())
print((a+b) * h // 2)
Buggy code:
a = int(input())
b = int(input())
h = int(input())

print((a + b) / 2 * h)

Fixed code:
a,b,h=int(input()),int(input()),int(input())
print((a+b)*h//2)
Buggy code:
l=[int(input()) for in in range(3)]
a=l[0]
b=l[1]
h=l[2]
print((a+b)*h//2)

Fixed code:
l=[int(input()) for i in range(3)]
a=l[0]
b=l[1]
h=l[2]
print((a+b)*h//2)
Buggy code:
# input
a = int(input())
b = int(input())
h = int(input())

ans = (a + b) * h / 2
print(ans)

Fixed code:
# input
a = int(input())
b = int(input())
h = int(input())

ans = (a + b) * h // 2
print(ans)
Buggy code:
a = int(input())
b = int(input())
h = int(input())
print(a*b*h//2)

Fixed code:
a =int(input())
b =int(input())
h =int(input())


print((a+b)*h//2)
Buggy code:
a=int(input())
b=int(input())
h=int(input())
print(((a+b)*h)/2)

Fixed code:
a=input()
a=int(a)
b=input()
b=int(b)
h=input()
h=int(h)
print(((a+b)*h)//2)
Buggy code:
a = int(input())
b = int(input())
c = int(input())
print(int(((a+b)*c)/2)

Fixed code:
a = int(input())
b = int(input())
c = int(input())

print((a+b) * c //2)
Buggy code:
a = int(input())
b = int(input())
c = int(input())

print(((a+b)*c)/2)

Fixed code:
a=int(input())
b=int(input())
c=int(input())
print((a+b)*c//2)
Buggy code:
a = int(input())
b = int(input())
h = int(input())
k = (a + b)* h /2
print(k)

Fixed code:

a = int(input())
b = int(input())
h = int(input())

print ( (a+b)*h // 2 )
Buggy code:
a, b, h = [int(input()) for _ in range(3)]

print((a + b) * h / 2)

Fixed code:
a,b,h = map(int,[input() for _ in range(3)])
print((a+b)*h//2)
Buggy code:
a = int(input())
b = int(input())
h = int(input())
print((a + b) / 2 * h)

Fixed code:
a = int( input() )
b = int( input() ) 
h = int( input() )

print( ( a + b ) * h // 2 )
Buggy code:
a=[int(input()) for i in range(3)]
print((a[0]+a[1])*a[2]/2)

Fixed code:
a=[int(input()) for i in range(3)];print((a[0]+a[1])*a[2]//2)
Buggy code:
a = int(input)
b = int(input)
h = int(input)
print ((a+b)*h //2)

Fixed code:
a = int(input())
b = int(input())
h = int(input())
s = (a + b) * h // 2
print(s)
Buggy code:
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    a = int(input())
    b = int(input())
    h = int(input())

    res = (a + b) * 2 // h
    print(res)


if __name__ == '__main__':
    resolve()


Fixed code:
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    a = int(input())
    b = int(input())
    h = int(input())

    res = ((a + b) * h) // 2
    print(res)


if __name__ == '__main__':
    resolve()
Buggy code:

a = int(input())
b = int(input())
h = int(input())

ans = (a + b) * h / 2

print(ans)

Fixed code:
a = int(input())
b = int(input())
h = int(input())

print((a + b)* h // 2)
Buggy code:
import sys

def main(a,b,h):
    reuturn (a+b)*h//2

a =int(sys.stdin.readline().strip())
b =int(sys.stdin.readline().strip())
h =int(sys.stdin.readline().strip())

print(main(a,b,h))


Fixed code:
import sys

def main(a,b,h):
    return (a+b)*h//2

a =int(sys.stdin.readline().strip())
b =int(sys.stdin.readline().strip())
h =int(sys.stdin.readline().strip())

print(main(a,b,h))
Buggy code:
"""
author : halo2halo
date : 2, Feb, 2020
"""

import sys
import itertools

import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

a,b,h=map(int, read().split())
print(h*(b+a))


Fixed code:
"""
author : halo2halo
date : 2, Feb, 2020
"""

import sys
import itertools

import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

a,b,h=map(int, read().split())
print(h*(b+a)//2)
Buggy code:
a = int(input())
b = int(input())
h = int(input())

print(int((a+b)/2*h)

Fixed code:
a,b,h=int(input()),int(input()),int(input())
print(((a+b)*h)//2)
Buggy code:
a = int(input())
b = int(input())
h = int(input())
print((a+b) * (h/2))



Fixed code:
a=int(input());b=int(input());h=int(input());print((a+b)*h//2)
Buggy code:
a, b, h = [int(input()) for i in range(3)]
print((a + b)*h/2)

Fixed code:
a, b, h = [int(input()) for _ in range(3)]

print((a+b) * h // 2)
Buggy code:
a, b, h = [int(input()) for i in range(4)]
print((a + b) * h // 2)

Fixed code:
a, b, h = [int(input()) for i in range(1, 4)]
print((a + b) * h // 2)
Buggy code:
a = int(input())
b = int(input())
h = int(input())

print((a+b)*h /2)

Fixed code:
a = int(input())
b = int(input())
h = int(input())

area = (a+b)*h//2
print(area)
Buggy code:
a = int(input())
b = int(input())
h = int(input())
print(((a+b)*h/2))

Fixed code:
a = int(input())
b = int(input())
h = int(input())

result = ((a+b) * h)//2
print(result)
Buggy code:
a = int(input())
b = int(input())
h = int(input())

print(a*b*h/2)a = int(input())
b = int(input())
h = int(input())

print((a+b)*h/2)

Fixed code:
a = int(input()); b = int(input()); h = int(input())
print((a+b)*h//2)
Buggy code:
a = int(input())
b = int(input())
h = int(input())
ans = (a+b)//2 * h
print(ans)


Fixed code:
a = int( input())
b = int( input())
h = int( input())
print((a+b)*h//2)
Buggy code:
a, b, h = [int(input()) for _ in range(3)]
print((a+b)*h/2)

Fixed code:
a,b,h = [int(input()) for _ in range(3)]
print(h*(a+b)//2)
Buggy code:
a = int(input())
b = int(input())
h = int(input())

print(int((a + b) * h) / 2)

Fixed code:
a = int(input())
b = int(input())
h = int(input())
ans = ((a+b)*h)//2
print(ans)
Buggy code:
A = list(input())
B = list(input())
C = list(input())
A.append("0")
B.append("0")
C.append("0")
x = A[0]
del A[0]
while x != "0":
    if x == "a":
        x = A[0]
        del A[0]
    elif x == "b":
        x = B[0]
        del B[0]
    else:
        x = C[0]
        del C[0]
print(A,B,C,x)
if "0" not in A:
    print("A")
elif "0" not in B:
    print("B")
else:
    print("C")

Fixed code:
A = list(input())
B = list(input())
C = list(input())
A.append("0")
B.append("0")
C.append("0")
x = A[0]
del A[0]
while x != "0":
    if x == "a":
        x = A[0]
        del A[0]
    elif x == "b":
        x = B[0]
        del B[0]
    else:
        x = C[0]
        del C[0]

if "0" not in A:
    print("A")
elif "0" not in B:
    print("B")
else:
    print("C")
Buggy code:
def solve(a,b,c,turn):
	if turn == "a":
		if a == "":
			return "A"
		else:
			next_turn = a[0]
			a = a[1:]
	elif turn == "b":
		if b == "":
			return "B"
		else:
			next_turn = b[0]
			b = b[1:]
	else
		if c == "":
			return "C"
		else:
			next_turn = c[0]
			c = c[1:]
	return solve(a,b,c, next_turn)
a=input().strip()
b=input().strip()
b=input().strip()
print(solve(a,b,c,"a"))

Fixed code:
def solve(a,b,c,turn):
	if turn == "a":
		if a == "":
			return "A"
		else:
			next_turn = a[0]
			a = a[1:]
	elif turn == "b":
		if b == "":
			return "B"
		else:
			next_turn = b[0]
			b = b[1:]
	else:
		if c == "":
			return "C"
		else:
			next_turn = c[0]
			c = c[1:]
	return solve(a,b,c, next_turn)
a=input().strip()
b=input().strip()
c=input().strip()
print(solve(a,b,c,"a"))
Buggy code:
s=input()
t=input()
u=input()
a=b=c=0
now = 0
while 1:
  if now == 0:
    if s[a] == 'a':
      now = 0
    elif s[a] == 'b':
      now = 1
    else:
      now = 2
    if a==len(s):
      print('A')
      break
  elif now == 1:
    if s[b] == 'a':
      now = 0
    elif s[b] == 'b':
      now = 1
    else:
      now = 2
    if b==len(t):
      print('B')
      break
  else:
    if s[c] == 'a':
      now = 0
    elif s[c] == 'b':
      now = 1
    else:
      now = 2
    if c==len(u):
      print('C')
      break

Fixed code:
s=input()
t=input()
u=input()
a=b=c=0
now = 0
while 1:
  if now == 0:
    if a==len(s):
      print('A')
      break
    if s[a] == 'a':
      now = 0
    elif s[a] == 'b':
      now = 1
    else:
      now = 2
    a+=1
  elif now == 1:
    if b==len(t):
      print('B')
      break
    if t[b]=='a':
      now = 0
    elif t[b]== 'b':
      now = 1
    else:
      now = 2
    b+=1
  else:
    if c==len(u):
      print('C')
      break
    if u[c]== 'a':
      now = 0
    elif u[c]== 'b':
      now = 1
    else:
      now = 2
    c+=1
Buggy code:
S = {p: input() for p in 'abc'}
card = 'a'
while S[card]:
    card, S[card] = S[card][0], S[card][1:]
print(card.upper())

Fixed code:
S = {p: input() for p in 'abc'}
card = 'a'
while S[card]:
    new_card, S[card] = S[card][0], S[card][1:]
    card = new_card
print(card.upper())
Buggy code:
from collections import deque

def solve(top, sa, sb, sc):
  if len(s[top]) == 0:
    return top
  top = s[top].popleft()
  return solve(top, sa, sb, sc)
  
s = {}
s['a'] = deque(input())
s['b'] = deque(input())
s['c'] = deque(input())

top = s['a'].popleft()
print(solve(top, sa, sb, sc))

Fixed code:
from collections import deque

def solve(top, sa, sb, sc):
  if len(s[top]) == 0:
    return top.upper()
  top = s[top].popleft()
  return solve(top, sa, sb, sc)
  
s = {}
s['a'] = deque(input())
s['b'] = deque(input())
s['c'] = deque(input())

top = s['a'].popleft()
print(solve(top, s['a'], s['b'], s['c']))
Buggy code:
A = input()
B = input()
C = input()

owner = 'a'

while True:
    if owner == 'a'
        if len(A):
            owner = A[0]
            del(A[0])
        else:
            print('a')
            break
    if owner == 'b'
        if len(B):
            owner = B[0]
            del(B[0])
        else:
            print('b')
            break
    if owner == 'c'
        if len(C):
            owner = C[0]
            del(C[0])
        else:
            print('c')
            break

Fixed code:
A = list(input())
B = list(input())
C = list(input())

owner = 'a'

while True:
    if owner == 'a':
        if len(A):
            owner = A[0]
            del(A[0])
        else:
            print('A')
            break
    if owner == 'b':
        if len(B):
            owner = B[0]
            del(B[0])
        else:
            print('B')
            break
    if owner == 'c':
        if len(C):
            owner = C[0]
            del(C[0])
        else:
            print('C')
            break
Buggy code:
Sa=list(input())
Sb=list(input())
Sc=list(input())
S=Sa.pop(0)
Win=""
while(S):
  if(S=="a"):
    S=Sa.pop(0)
    Win="A"
  elif(S=="b"):
    S=Sb.pop(0)
  	Win="B"
  elif(S=="c"):
    S=Sc.pop(0)
  	Win="C"
print(Win)

Fixed code:
Sa=list(input())
Sb=list(input())
Sc=list(input())
S=Sa.pop(0)
Win="A"
while(S!=""):
  if(S=="a"):
    S=""
    if(len(Sa)!=0):
    	S=Sa.pop(0)
    Win="A"
  elif(S=="b"):
    S=""
    if(len(Sb)!=0):
	    S=Sb.pop(0)
    Win="B"
  elif(S=="c"):
    S=""
    if(len(Sc)!=0):
    	S=Sc.pop(0)
    Win="C"
print(Win)
Buggy code:
a = list(input())
b = list(input())
c = list(input())
moji = a[0]
select = "a"
lengtha = len(a)
lengthb = len(b)
lengthc = len(c)
while True:
  if select == "a":
    select = a[0]
    del a[0]
    lengtha -= 1
    if lengtha == 0:
      print("A")
  elif select == "b":
    select = b[0]
    del b[0]
    lengthb -= 1
    if lengthb == 0:
      print("B")
      break;
  else:
    select = c[0]
    del c[0]
    lengthc -= 1
    if lengthc==0:
      print("C")
      break;

Fixed code:
a = list(input())
b = list(input())
c = list(input())
moji = a[0]
select = "a"
lengtha = len(a)
lengthb = len(b)
lengthc = len(c)
while True:
  if select == "a":
    if lengtha == 0:
      print("A")
      break;
    else:
      select = a[0]
      del a[0]
      lengtha -= 1
  elif select == "b":
    if lengthb == 0:
      print("B")
      break;
    else:
      select = b[0]
      del b[0]
      lengthb -= 1
  else:
    if lengthc==0:
      print("C")
      break;
    else:
      select = c[0]
      del c[0]
      lengthc -= 1
Buggy code:
import sys
SA = str(input())
SB = str(input())
SC = str(input())
turn = "A"
while (1):
    if( turn == "A"):
        if SA == "":
            break
        if SA[0] == "a":
            turn = "A"
        elif SA[0] == "b":
            turn = "B"
        else:
            turn = "C"
        SA = SA[1:]
    elif( turn == "B"):
        if SB == "":
            break
        if SB[0] == "a":
            turn = "A"
        elif SB[0] == "b":
            turn = "B"
        else:
            turn = "C"
        SB = SB[1:]
    else:
        if SC == "":
            break
        if SC[0] == "a":
            turn = "A"
        elif SC[0] == "b":
            turn = "B"
        else:
            turn = "C"
        SC = SC[1:]
if SA == "":
    ans = "A"
elif SB == "":
    ans = "B"
else:
    ans = "C"
print(ans)


Fixed code:
import sys
SA = str(input())
SB = str(input())
SC = str(input())
turn = "A"
while (1):
    if( turn == "A"):
        if SA == "":
            break
        if SA[0] == "a":
            turn = "A"
        elif SA[0] == "b":
            turn = "B"
        else:
            turn = "C"
        SA = SA[1:]
    elif( turn == "B"):
        if SB == "":
            break
        if SB[0] == "a":
            turn = "A"
        elif SB[0] == "b":
            turn = "B"
        else:
            turn = "C"
        SB = SB[1:]
    else:
        if SC == "":
            break
        if SC[0] == "a":
            turn = "A"
        elif SC[0] == "b":
            turn = "B"
        else:
            turn = "C"
        SC = SC[1:]
print(turn)
Buggy code:
#n = int(input())
#n,k = map(int,input().split())
#x = list(map(int,input().split()))

import queue

a = list(input())
b = list(input())
c = list(input())

A = queue.Queue()
B = queue.Queue()
C = queue.Queue()

for i in range(len(a)):
    A.put(a[i])
for i in range(len(b)):
    B.put(b[i])
for i in range(len(c)):
    C.put(c[i])

memo = "a"
while(1):
    if not A.empty():
        print("A")
        break
    elif not B.empty():
        print("B")
        break
    elif not C.empty():
        print("C")
        break

    if memo == "a":
        memo = A.get()
    elif memo == "b":
        memo = B.get()
    elif memo =="C":
        memo = C.get()


    




Fixed code:
#n = int(input())
#n,k = map(int,input().split())
#x = list(map(int,input().split()))

import queue

a = list(input())
b = list(input())
c = list(input())

A = queue.Queue()
B = queue.Queue()
C = queue.Queue()

for i in range(len(a)):
    A.put(a[i])
for i in range(len(b)):
    B.put(b[i])
for i in range(len(c)):
    C.put(c[i])

memo = "a"
while(1):
    if memo == "a":
        if A.empty():
            print("A")
            break
        memo = A.get()

    elif memo == "b":
        if B.empty():
            print("B")
            break
        memo = B.get()

    elif memo =="c":
        if C.empty():
            print("C")
            break
        memo = C.get()
Buggy code:
A=input()
B=input()
C=input()
D=[]
E=[]
F=[]
s=a
x=len(A)
y=len(B)
z=len(C)
for i in range(len(A)):
    D.append(A[i])
for i in range(len(B)):
    E.append(B[i]) 
for i in range(len(C)):
    F.append(C[i])
while x>=0 and y>=0 and z>=0:
    if s==a:
        if x==0:
            print("A")
            break
        else:
            count=D[0]
            D.pop(0)
            x-=1
    elif s==b:
        if y==0:
            print("B")
            break
        else:
            count=E[0]
            E.pop(0)
            y-=1
    else:
        if z==0:
            print("C")
            break
        else:
            count=F[0]
            F.pop(0)
            z-=1
 
    

Fixed code:
A=input()
B=input()
C=input()
D=[]
E=[]
F=[]
s="a"
x=len(A)
y=len(B)
z=len(C)
for i in range(len(A)):
    D.append(A[i])
for i in range(len(B)):
    E.append(B[i]) 
for i in range(len(C)):
    F.append(C[i])
while x>=0 and y>=0 and z>=0:
    if s=="a":
        if x==0:
            print("A")
            break
        else:
            s=(D[0])
            D.pop(0)
            x-=1
    elif s=="b":
        if y==0:
            print("B")
            break
        else:
            s=E[0]
            E.pop(0)
            y-=1
    elif s=="c":
        if z==0:
            print("C")
            break
        else:
            s=F[0]
            F.pop(0)
            z-=1
Buggy code:
sa = input()
sb = input()
sc = input()
turn = sa[0]
sa = sa[1:]
while True:
    if turn == 'a':
        if not sa:
            win = 'A'
            break
        else:
            turn = sa[0]
            sa = sa[1:]
    if turn == 'b':
        if not sb:
            win = 'B'
            break
        else:
            turn = sb[0]
            sb = sb[1:]
    if turn == 'c':
        if not sc:
            win = 'C'
            break
        else:
            turn = sc[0]
            sc = sc[1:]

Fixed code:
sa = input()
sb = input()
sc = input()
turn = sa[0]
sa = sa[1:]
while True:
    if turn == 'a':
        if not sa:
            win = 'A'
            break
        else:
            turn = sa[0]
            sa = sa[1:]
    if turn == 'b':
        if not sb:
            win = 'B'
            break
        else:
            turn = sb[0]
            sb = sb[1:]
    if turn == 'c':
        if not sc:
            win = 'C'
            break
        else:
            turn = sc[0]
            sc = sc[1:]
print(win)
Buggy code:
A = str(input())
B = str(input())
C = str(input())

n = "a"
while 1:
  if n == "a":
    n = "a"
    A = A[1:]
    if len(A) == 0:
      print("A")
      quit()
    elif n == "b":
      n = "b"
      B = B[1:]
      if len(B) == 0:
        print("B")
        quit()
    elif n == "c":
      n = "c"
      C = C[1:]
      if len(C) == 0:
        print("C")
        quit()

Fixed code:
A = str(input())
B = str(input())
C = str(input())

n = "a"
while 1:
  if n == "a":
    if len(A) == 0:
      print("A")
      quit()
    n = A[0]
    A = A[1:]
  elif n == "b":
    if len(B) == 0:
      print("B")
      quit()
    n = B[0]
    B = B[1:]
  elif n == "c":
    if len(C) == 0:
      print("C")
      quit()
    n = C[0]
    C = C[1:]
Buggy code:
hands_a, hands_b, hands_c = (list(input()) for i in range(3))

hands = {'a': hands_a, 'b': hands_b, 'c': hands_c}

turn = 'a'
while len(hands[turn]) > 0:
    turn = hands[turn].popleft
print(turn.upper())


Fixed code:
hands_a, hands_b, hands_c = (list(input()) for i in range(3))

hands = {'a': hands_a, 'b': hands_b, 'c': hands_c}

turn = 'a'
while len(hands[turn]) > 0:
    turn = hands[turn].pop(0)
print(turn.upper())
Buggy code:
sa=list(input())
sb=list(input())
sc=list(input())
ia=0
ib=0
ic=0
a=len(sa)-1
b=len(sb)-1
c=len(sc)-1
t='a'
while True:
  if t=='a':
    if ia==a:
      print('A')
      break
    t=sa[ia]
    ia+=1
  elif t=='b':
    if ib==b:
      print('B')
      break
    t=sb[ib]
    ib+=1
  else:
    if ic==c:
      print('C')
      break
    t=sc[ic]
    ic+=1

Fixed code:
tem=input()
a=len(tem)
sa=list(tem)
tem=input()
b=len(tem)
sb=list(tem)
tem=input()
c=len(tem)
sc=list(tem)
ia=0
ib=0
ic=0
t='a'
while True:
  if t=='a':
    if ia==a:
      print('A')
      break
    t=sa[ia]
    ia+=1
  elif t=='b':
    if ib==b:
      print('B')
      break
    t=sb[ib]
    ib+=1
  else:
    if ic==c:
      print('C')
      break
    t=sc[ic]
    ic+=1
Buggy code:
Sa_str = input()
Sb_str = input()
Sc_str = input()

Sa = []
Sb = []
Sc = []
for i in range(len(Sa_str)):
    Sa += [Sa_str[i]]
for i in range(len(Sb_str)):
    Sb += [Sb_str[i]]
for i in range(len(Sc_str)):
    Sc += [Sc_str[i]]

last = 'a'
res = 'A'

for i in range(len(Sa) + len(Sb) + len(Sc) + 3):
    if last == 'a':
        if len(Sa) == 0:
            res = 'A'
            break
        last = Sa[0]
        Sa = Sa[1:]
        print('A: ' + last)
    elif last == 'b':
        if len(Sb) == 0:
            res = 'B'
            break
        last = Sb[0]
        Sb = Sb[1:]
        print('B: ' + last)
    elif last == 'c':
        if len(Sc) == 0:
            res = 'C'
            break
        last = Sc[0]
        Sc = Sc[1:]
        print('C: ' + last)

print(res)


Fixed code:
Sa_str = input()
Sb_str = input()
Sc_str = input()

Sa = []
Sb = []
Sc = []
for i in range(len(Sa_str)):
    Sa += [Sa_str[i]]
for i in range(len(Sb_str)):
    Sb += [Sb_str[i]]
for i in range(len(Sc_str)):
    Sc += [Sc_str[i]]

last = 'a'
res = 'A'

for i in range(len(Sa) + len(Sb) + len(Sc) + 3):
    if last == 'a':
        if len(Sa) == 0:
            res = 'A'
            break
        last = Sa[0]
        Sa = Sa[1:]
    elif last == 'b':
        if len(Sb) == 0:
            res = 'B'
            break
        last = Sb[0]
        Sb = Sb[1:]
    elif last == 'c':
        if len(Sc) == 0:
            res = 'C'
            break
        last = Sc[0]
        Sc = Sc[1:]

print(res)
Buggy code:
sa=input()
sb=input()
sc=input()
print(sa[0])
while True:
  k="a"
  if k=="a":
    if sa==[]:
      print("A")
      exit()
    else:
      k=sa[0]
      sa=sa[1:]
  if k=="b":
    if sb==[]:
      print("B")
      exit()
    else:
      k=sb[0]
      sb=sb[1:]
  if k=="c":
    if sc==[]:
      print("C")
      exit()
    else:
      k=sc[0]
      sc=sc[1:]

Fixed code:
sa=input()
sb=input()
sc=input()
k="a"
while True:
  if k=="a":
    if len(sa)==0:
      print("A")
      exit()
    else:
      k=sa[0]
      sa=sa[1:]
  if k=="b":
    if len(sb)==0:
      print("B")
      exit()
    else:
      k=sb[0]
      sb=sb[1:]
  if k=="c": 
    if len(sc)==0:
      print("C")
      exit()
    else:
      k=sc[0]
      sc=sc[1:]
Buggy code:
# input
S = [list(input()) for _ in range(3)]

P_curr = 0

while S[P_curr] != []
    if S[P_curr][0] == 'a':
        P_curr = 0
    if S[P_curr][0] == 'b':
        P_curr = 1
    if S[P_curr][0] == 'c':
        P_curr = 2
    del S[P_curr][0]

if P_curr == 0:
    print('A')
if P_curr == 1:
    print('B')
if P_curr == 2:
    print('C')



Fixed code:
# input
S = [list(input()) for _ in range(3)]

P_curr = 0

while S[P_curr] != []:
    if S[P_curr][0] == 'a':
        del S[P_curr][0]
        P_curr = 0
    elif S[P_curr][0] == 'b':
        del S[P_curr][0]
        P_curr = 1
    elif S[P_curr][0] == 'c':
        del S[P_curr][0]
        P_curr = 2

if P_curr == 0:
    print('A')
if P_curr == 1:
    print('B')
if P_curr == 2:
    print('C')
Buggy code:
sa = list(reversed(input()))
sb = list(reversed(input()))
sc = list(reversed(input()))

turn = sa.pop()

while True:
    if (turn == "a" and not sa) or (turn == "b" and not sb) or (turn == "c" and not sc):
        break
    elif turn == "a":
        turn = sa.pop()
    elif turn == "b":
        turn = sb.pop()
    else turn == "c":
        turn = sc.pop()

print(turn.upper())


Fixed code:
sa = list(reversed(input()))
sb = list(reversed(input()))
sc = list(reversed(input()))

turn = sa.pop()

while True:
    if (turn == "a" and not sa) or (turn == "b" and not sb) or (turn == "c" and not sc):
        break
    elif turn == "a":
        turn = sa.pop()
    elif turn == "b":
        turn = sb.pop()
    else:
        turn = sc.pop()

print(turn.upper())
Buggy code:
a = input()
b = input()
c = input()
countlist = [1, 0, 0]
list = ["a", "b", "c"]
turn = 0
value = ""
for x in range(len(a) + len(b) + len(c)):
    
    if countlist[0] == len(a) + 1 or countlist[1] == len(b) or countlist[2] == len(c): break
    if turn == 0: value = a[countlist[turn] - 1]
    elif turn == 1: value = b[countlist[turn]]
    elif turn == 2: value = c[countlist[turn]]
        
    turn = list.index(value)
    countlist[turn] += 1
    print(countlist)

if countlist[0] == len(a) + 1: print("A")
elif countlist[1] == len(b): print("B")
elif countlist[2] == len(c): print("C")


Fixed code:
a = input()
b = input()
c = input()
countlist = [1, 0, 0]
list = ["a", "b", "c"]
turn = 0
value = ""
for x in range(len(a) + len(b) + len(c)):
    
    if countlist[0] > len(a) or countlist[1] > len(b) or countlist[2] > len(c): break
    if turn == 0: value = a[countlist[turn] - 1]
    elif turn == 1: value = b[countlist[turn] - 1]
    elif turn == 2: value = c[countlist[turn] - 1]
        
    turn = list.index(value)
    countlist[turn] += 1

if countlist[0] > len(a): print("A")
elif countlist[1] > len(b): print("B")
elif countlist[2] > len(c): print("C")