qyliang/CodeNanoFix huggingface dataset:
Buggy code:
S = input()
m = re.match('^A[a-z]+C[a-z]+$', S)
if m == None:
    print('WA')
else:
    print('AC')

Fixed code:
import re

S = input()
m = re.match('^A[a-z]+C[a-z]+$', S)
if m == None:
    print('WA')
else:
    print('AC')
Buggy code:
S = input()
if S[0] != "A":
  print("WA")
  exit()
elif S[2:-2].count("C") != 1:
  print("WA")
  exit()
else:
  if S.count("C") != 0:
    print("WA")
  else:
    S = S[1:].replace("C", "")
    if S.islower():
      print("AC")
    else:
      print("WA")

Fixed code:
S = input()
if S[0] != "A":
  print("WA")
  exit()
elif S[2:-1].count("C") != 1 or S[:2].count("C") != 0 or S[-1:].count("C") != 0:
  print("WA")
  exit()
else:
  S = S[1:].replace("C", "")
  if S.islower():
    print("AC")
  else:
    print("WA")
Buggy code:
if inp.startswith("A") and inp[2:len(inp)-1].count("C") ==  1 and inp[1:inp.find("C", 0, len(inp) - 1)] == inp[1:inp.find("C", 0, len(inp) - 1)].lower() and inp[inp.find("C", 0, len(inp) - 1) + 1:len(inp)] == inp[inp.find("C", 0, len(inp) - 1) + 1:len(inp)].lower():
  print("AC")
else:
  print("WA")

Fixed code:
inp = input()

#print(inp.startswith("A"))
#print(inp[2:len(inp)-1].count("C") ==  1)
#print(inp[1:inp.find("C", 0, len(inp) - 1)] == inp[1:inp.find("C", 0, len(inp) - 1)].lower())
#print(inp[inp.find("C", 0, len(inp) - 1) + 1:len(inp)] == inp[inp.find("C", 0, len(inp) - 1) + 1:len(inp)].lower())

if inp.startswith("A") and inp[2:len(inp)-1].count("C") ==  1 and inp[1:inp.find("C", 0, len(inp) - 1)] == inp[1:inp.find("C", 0, len(inp) - 1)].lower() and inp[inp.find("C", 0, len(inp) - 1) + 1:len(inp)] == inp[inp.find("C", 0, len(inp) - 1) + 1:len(inp)].lower():
  print("AC")
else:
  print("WA")
Buggy code:
#2019/10/22

s = open(0).read()
#print(s)
print("AC" if "C" in s[2:-1] and "A" in s and s[1:].replace("C","",1).islower() else "WA")


Fixed code:
#2019/10/22

#s = open(0).read()
s = input()
#print(s)
print("AC" if "C" in s[2:-1] and "A" in s and s[1:].replace("C","",1).islower() else "WA")
Buggy code:
s=input()
print(s[1:].replace('C', ''))
if s[0] =='A' and s[2:-1].count('C') ==1 and s.replace('A', '').replace('C', '').islower:
  print('AC')
else:
  print('WA')

Fixed code:
s = input()
print('AC' if s[0] == 'A' and 'C' in s[2:-1] and s[1:].replace('C', '', 1).islower() else 'WA')
Buggy code:
ans = "WA"
s = list(input())
if s[0] == "A":
  if s[2:-1].count("C") == 1:
    c = s[2:-1].index("C")
    if all([ list[i].islower() for i in range(1,len(s)) if i != c]):
      ans = "AC"
print(ans)

Fixed code:

ans = "WA"
s = list(input())
if s[0] == "A":
  if s[2:-1].count("C") == 1:
    c = s[2:-1].index("C")+2

    if all([ s[i].islower() for i in range(1,len(s)) if i != c]):
      ans = "AC"

print(ans)
Buggy code:
S = input()

if S[0] == 'A' and S[2:-2].count('C') == 1:
    if S.replace('A', '').replace('C', '').islower():
        print('AC')
    else:
        print('WA')
else:
    print('WA')

Fixed code:
S = input()

if S[0] == 'A' and S[2:-1].count('C') == 1:
    if S.replace('A', '').replace('C', '').islower():
        print('AC')
    else:
        print('WA')
else:
    print('WA')
Buggy code:
S=input()
n=len(S)
if S[0]=="A":
	if 2<=S.find("C")<=n-2:
		T=S.lstrip("A")
		R=T.replace("C","c",1)
		Q=T.replace("C","c")
		if R==Q:
			if R.lower()==R:
				print("AC")
print("WA")
			

Fixed code:
S=input()
n=len(S)
if S[0]=="A":
	if 2<=S.find("C")<=n-2:
		T=S.lstrip("A")
		R=T.replace("C","c",1)
		Q=T.replace("C","c")
		if R==Q:
			if R.lower()==R:
				print("AC")
				exit()
print("WA")
Buggy code:
s = list(input())
l = len(s)
if s[0] == 'A':
    c_cnt = 0
    cn_l = []
    for i, m in enumerate(s):
        if 1<i<l-1 & m=='C':
            cn_l.append(i)
            c_cnt += 1
    if c_cnt == 1:
        cn = cn_l[0]
        tmp = s
        tmp.pop(0)
        tmp.pop(cn)
        tmp_s = ''.join(tmp)
        if tmp_s == tmp_s.lower():
            print('AC')
else:
    print('WA')

Fixed code:
s = list(input())
l = len(s)
if s[0] == 'A':
    c_cnt = 0
    cn_l = []
    for i, m in enumerate(s):
        if 1<i<l-1 and m=='C':
            cn_l.append(i)
            c_cnt += 1
    if c_cnt == 1:
        cn = int(cn_l[0])
        tmp = s
        tmp.pop(0)
        tmp.remove('C')
        tmp_s = ''.join(tmp)
        if tmp_s == tmp_s.lower():
            print('AC')
        else:
            print('WA')
    else:
        print('WA')
else:
    print('WA')
Buggy code:
s = input()
t = s[2:-1]
count = 0
q = [t[1]]
for i in range(len(t)):
    if t[i] == "C":
        count += 1
    else:
        q.append(t[i])
q.append(t[-1])
q = ''.join(q)
if s[0] == "A" and count == 1 and str(q).lower ==q:
    print("AC")
else:
    print("WA")
    

Fixed code:
s = input()
t = s[2:-1]
count = 0
q = [s[1]]
for i in range(len(t)):
    if t[i] == "C":
        count += 1
    else:
        q.append(t[i])
q.append(s[-1])
q =''.join(q)
if s[0] == "A" and count == 1 and str(q).lower() ==str(q):
    print("AC")
else:
    print("WA")
Buggy code:
s = input()
if s[0] != 'A':
    print('WA') 
else:
    ii = s.count('C',2,-2)
    if ii != 1:
        print('WA')
    else:
        s_1 = s.lstrip('A')
        s_2 = s_1[1:-2].replace('C','')
        s_1 = s_1[0] + s_1[-1]
        s = s_1 + s_2
        if s.islower() == True:
            print('AC')
        else:
            print('WA')



Fixed code:
s = input()
if s[0] != 'A':
    print('WA') 
else:
    ii = s.count('C',2,-1)
    if ii != 1:
        print('WA')
    else:
        s_1 = s.lstrip('A')
        s_2 = s_1[1:-2].replace('C','')
        s_1 = s_1[0] + s_1[-1]
        s = s_1 + s_2
        if s.islower() == True:
            print('AC')
        else:
            print('WA')
Buggy code:
s = input()
length = len(s)
cnt = 0

if s[0] != 'A':
    print('WA')
    exit()
'''
if s[length-1].isupper():
    print('WA')
    exit()
'''
for i in range(2, length):
    if s[i].isupper():
        if s[i] != 'C':
            print('WA')
            exit()
        else:
            cnt += 1

if cnt != 1:
    print('WA')
    exit()

print('AC')
exit()



Fixed code:
s = input()
length = len(s)
cnt = 0

if s[0] != 'A':
    print('WA')
    exit()

if length == 4:
    if s[2] == 'C':
        cnt = 1
else:
    for i in range(2, length-1):
        cnt += 1 if s[i] == 'C' else 0

if cnt != 1:
    print('WA')
    exit()

up_cnt = 0
for c in s:
    if c.isupper():
        up_cnt += 1

if up_cnt != 2:
    print('WA')
    exit()

print('AC')
Buggy code:
s = input()
S = s[2:-1]
if s[0]=='A' and S.count('C')==1 and s[:s.index('C')].lower()==s[:s.index('C')] and s[s.index('C')+1:].lower()==s[s.index('C')+1:]:
  print('AC')
else:
  print('WA')

Fixed code:
s = input()
S = s[2:-1]
if s[0]=='A' and S.count('C')==1 and s[1:s.index('C')].lower()==s[1:s.index('C')] and s[s.index('C')+1:].lower()==s[s.index('C')+1:]:
  print('AC')
else:
  print('WA')
Buggy code:
s = input()
n = len(s)
cnt = 0
alpha = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
for i in range(n):
  if i == 0:
    if s[0] != 'A':
      print('WA')
      break
    s = 'a' + s[1:]
  if 2 <= i < n-1:
    if s[i] == 'C':
      cnt += 1
      if cnt == 2:
        print('WA')
        break
      s = s[:i] + 'c' + s[i+1:]
  if s[i] in alpha:
    print('WA')
    break
else:
  print('AC')

Fixed code:
s = input()
n = len(s)
cnt = 0
alpha = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
for i in range(n):
  if i == 0:
    if s[0] != 'A':
      print('WA')
      break
    s = 'a' + s[1:]
  if 2 <= i < n-1:
    if s[i] == 'C':
      cnt += 1
      if cnt == 2:
        print('WA')
        break
      s = s[:i] + 'c' + s[i+1:]
  if i == n-1:
    if cnt == 0:
      print('WA')
      break
  if s[i] in alpha:
    print('WA')
    break
else:
  print('AC')
Buggy code:
S = input()

ans = "WA"
if S[0] == "A":
    flag = "AC"
    S = S.replace("A", "a", 1)

count = 0
for i in range(2, len(S) - 1):
    if S[i] == "C":
        count += 1
        S = S.replace("C", "c", 1)
if count != 1:
    ans = "WA"

if not S.islower():
    ans = "WA"

print(ans)


Fixed code:
S = input()

ans = "WA"
if S[0] == "A":
    ans = "AC"
    S = S.replace("A", "a", 1)

count = 0
for i in range(2, len(S) - 1):
    if S[i] == "C":
        count += 1
        S = S.replace("C", "c", 1)
if count != 1:
    ans = "WA"

if not S.islower():
    ans = "WA"

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


s = list(input())
ans = True
li = list("abcdefghijklmnopqrstuvwxyz")

if s[0]!="A":
    ans = False
memo = s[2:-1]
if not("C" in memo):
    ans = False
for i in range(len(memo)):
    if not(memo[i] in li):
        ans = False

if ans:
    print("AC")
else:
    print("WA")










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


s = list(input())
ans = True
li = list("abcdefghijklmnopqrstuvwxyzC")

if s[0]!="A":
    ans = False
memo = s[2:-1]
if not("C" in memo):
    ans = False
C_cnt = 0
for i in range(1,len(s)):
    if not(s[i] in li):
        ans = False
    if s[i] == "C":
        C_cnt += 1

if ans and C_cnt==1:
    print("AC")
else:
    print("WA")
Buggy code:
s = list(input())
flag = 0
count = 0

if s[0] == 'A':
    flag += 1

a = s.pop(0)
b = s.pop(0)
c = s.pop(-1)

if s.count('C') == 1:
    flag += 1
if flag ==2:
    s.append(b)
    s.append(c)
    print(s)
    for i in range(len(s)):
        if s[i].islower():
            count += 1
        print(count)
    if (count+1) == len(s):
        flag += 1
print(flag)
if flag == 3:
    print("AC")
else:
    print("WA")
    

Fixed code:
s = list(input())
flag = 0
count = 0

if s[0] == 'A':
    flag += 1
#print(flag)
a = s.pop(0)
b = s.pop(0)
c = s.pop(-1)

if s.count('C') == 1:
    flag += 1
#print(flag)
if flag ==2:
    s.append(b)
    s.append(c)
    #print(s)
    for i in range(len(s)):
        if s[i].islower():
            count += 1
        #print(count)
    if (count+1) == len(s):
        flag += 1
##print(flag)
if flag == 3:
    print("AC")
else:
    print("WA")
Buggy code:
S = input()
ans = 'WA'
if S[0] == 'A':
    if S[2 : -1].count('C') == 1:
        if S[0].replace('A', 'a') + S[2 : -1].replace('C', 'c') + S[-1] == S.lower():
            ans = 'AC'
print(ans)

Fixed code:
S = input()
S2 = S
ans = 'WA'
if S[0] == 'A' and S[2:-1].count('C') == 1 and S[0].replace('A', 'a') + S[1] + S[2:-1].replace('C', 'c') + S[-1] == S2.lower():
    ans = 'AC'
print(ans)
Buggy code:
S = input()
mid = S[2:-1]
S_lower = S.lower()
S_replace = S.replace('C', 'c')
C_count = 0

if S[0] == 'A':
    for i in mid:
        if i == 'C':
            C_count += 1
    if C_count == 1:
        if S_lower == S_replace:
            print('AC')
        else:
            print('WA')
    else:
        print('WA')

Fixed code:
S = input()

mid = S[2:-1]
C_count = 0

for i in mid:
    if i == 'C':
        C_count += 1
        
S_lower = S.lower()
S_replace = S.replace('A', 'a').replace('C', 'c')
        
if S[0] == 'A' and C_count == 1 and S_lower == S_replace:
    print('AC')
else:
    print('WA')
Buggy code:
a = str(input())

if a[0]=="A":
    if "C" in a[2:len(a)-1]:
        if len(ad)==len(a)-2:
            ad = a[1:].replace("C","")
            if ad.islower():
                print("AC")
            else:
                print("WA")
        else:
            print("WA")
    else:
        print("WA")
else:
    print("WA")
            

Fixed code:
a = str(input())

if a[0]=="A":
    if "C" in a[2:len(a)-1]:
        ad = a[1:].replace("C","")
        if len(ad)==len(a)-2:
            if ad.islower():
                print("AC")
            else:
                print("WA")
        else:
            print("WA")
    else:
        print("WA")
else:
    print("WA")
Buggy code:
S = str(input())
s = list(S)
p = 0
for i in range(2,len(s)-1):
        if s[i] == 'C':
            p = p + 1
            del s[i]
if s[0] == 'A':
    del s[0]
    if p == 1:
        q = ''.join(s)
        if q.islower() == True:
            print('AC')
        else:
            print('WA')
    else:
        print('WA')
else:
    print('WA')

Fixed code:
S = str(input())
s = list(S)
u = s
p = 0
for i in range(2,len(s)-1):
        if s[i] == 'C':
            p = p + 1
for i in range(2,len(s)-p):
    if s[i] == 'C':
        if i != len(s) - 1:
            del s[i]
if s[0] == 'A':
    del s[0]
    if p == 1:
        q = ''.join(s)
        if q.islower() == True:
            print('AC')
        else:
            print('WA')
    else:
        print('WA')
else:
    print('WA')
Buggy code:
s_list=list(input())

def out_wa():
  print('WA')

if s_list[0]!='A':
  out_wa()
else:
  count=0
  for i in range(2,len(s_list)-1):
    if s_list[i] == 'C':
      count+=1

  if count != 1:
    out_wa()
  else:
    s = ''.join(s_list)
    l_s=s.lower()
    print(s)
    print(l_s)
    if l_s !=s:
      out_wa()
    else:
      print('AC')

Fixed code:
s_list=list(input())

def out_wa():
  print('WA')

if s_list[0]!='A':
  out_wa()
else:
  count=0
  for i in range(2,len(s_list)-1):
    if s_list[i] == 'C':
      count+=1

  if count != 1:
    out_wa()
  else:
    s = ''.join(s_list)
    s=s.replace('A','')
    s=s.replace('C','')
    l_s=s.lower()
    if l_s !=s:
      out_wa()
    else:
      print('AC')
Buggy code:
S=input()

cc=0
for i in range(2,len(S)-1):
    if S[i]=='C' and S[i].islower()==False:
        cc+=1
        nc=i

if cc==1:
    p1=True

if S[0]=='A' and S[0].islower()==False:
    p2=True

bc=0
for i in range(len(S)):
    if i==0 or i==nc:
        pass
    else:
        if S[i].islower()==False:
            bc+=1

if p1==True and p2==True and bc==0:
    print('AC')

else:
    print('WA')


Fixed code:
S=input()

cc=0
nc=0
for i in range(2,len(S)-1):
    if S[i]=='C' and S[i].islower()==False:
        cc+=1
        nc=i

if cc==1 and not nc==0:
    p1=True
else:
    p1=False

if S[0]=='A' and S[0].islower()==False:
    p2=True
else:
    p2=False

bc=0
for i in range(len(S)):
    if i==0 or i==nc:
        pass
    else:
        if S[i].islower()==False:
            bc+=1

if p1==True and p2==True and bc==0:
    print('AC')

else:
    print('WA')
Buggy code:
s=input()
if s[0]=='A':
  if s[2:-2].count('C')==1:
    if str(s[1]+s[2:-2].replace('C', '')+s[-1]).islower() :
      print('AC')
else:
  print('WA')

Fixed code:
s=input()
if s[0]=='A':
    if s[2:-1].count('C')==1:
        if (s[1]+s[2:-1].replace('C', '')+s[-1]).islower() :
            print('AC')
        else:
            print('WA')
    else:
        print('WA')
else:
    print('WA')
Buggy code:
s = input()
count = 1
if s[0] == 'A' and s[2:len(s)-1].count('C') == 1:
  for i in range(1,len(s)):
    if s[i].islower() == False:
      if s[i] == 'C':
        count += 1
      else:
        print('WA')
        exit()
      if 1 < count:
        print('WA')
        exit()
  print('AC')
else:
  print('WA')

Fixed code:
s = input()
count = 0
if s[0] == 'A' and s[2:len(s)-1].count('C') == 1:
  for i in range(1,len(s)):
    if s[i].islower() == False:
      if s[i] == 'C':
        count += 1
      else:
        print('WA')
        exit()
      if 1 < count:
        print('WA')
        exit()
  print('AC')
else:
  print('WA')
Buggy code:
def f(s):
  u = 0
  for c in s:
    if c.isupper:
      u += 1
  return u == 1
s = input()
if s[0] == 'A' and s[2:-1].count('C') == 1 and f(s):
  print('AC')
else:
  print('WA')


Fixed code:
def f(s):
  u = 0
  for c in s:
    if c.isupper():
      u += 1
  return u == 1
s = input()
if s[0] == 'A' and s[2:-1].count('C') == 1 and f(s[1:]):
  print('AC')
else:
  print('WA')
Buggy code:
S = input()
if S[0] == 'A' and S[2:-1].count('C') == 1:
    print(S[2:-1])
    index_c = S[2:-1].index('C')
    S = S[1:2 + index_c] + S[3 + index_c:]
    if S.islower():
        print('AC')
        exit()
print('WA')

Fixed code:
S = input()
if S[0] == 'A' and S[2:-1].count('C') == 1:
    index_c = S[2:-1].index('C')
    S = S[1:2 + index_c] + S[3 + index_c:]
    if S.islower():
        print('AC')
        exit()
print('WA')
Buggy code:
s=input()
#l=[]
#for ss in s:
#    l.append(ss)
q=0
if s[0]=="A":
    w=0
    for ss in s[2:-2]:
        if ss=="C":
            w+=1
#            l.remove(ss)

    if w==1:
        for ss in s[1:]:
            if ss=="C":
                continue
            elif ss==ss.lower() :
                continue
            else:
                q=1
                break
    else:
        q=1
else:
    q=1

if q==0:
    print("AC")
else:
    print("WA")

Fixed code:
s=input()
#l=[]
#for ss in s:
#    l.append(ss)
q=0
if s[0]=="A":
    w=0
    for ss in s[2:-1]:
        if ss=="C":
            w+=1
#            l.remove(ss)

    if w==1:
        for ss in s[1:]:
            if ss=="C":
                continue
            elif ss==ss.lower() :
                continue
            else:
                q=1
                break
    else:
        q=1
else:
    q=1

if q==0:
    print("AC")
else:
    print("WA")
Buggy code:
def check(s):
    t=True
    if s[0]!="A" :
        t=False
        #print("reached")
    a=s[:len(s)-2]
    count=0
    for i in range(len(a)):
        if a[i]=="C":
            count+=1
    if count!=1:
        t=False
    alph="BDEFGHIJKLMNOPQRSTUVWXYZ"
    for i in range(24):
        if alph[i] in s:
            t=False
            break
    if t:
        print("AC")
    else:
        print("WA")
s=input()
check(s) 

Fixed code:
def check(s):
    t=True
    if s[0]!="A" :
        t=False
        #print("reached")
    a=s[2:len(s)-1]
    #print(a)
    count=0
    for i in range(len(a)):
        if a[i]=="C":
            count+=1
    if count!=1:
        t=False
    alph="BDEFGHIJKLMNOPQRSTUVWXYZ"
    for i in range(24):
        if alph[i] in s:
            t=False
            break
    if t:
        print("AC")
    else:
        print("WA")
s=input()
check(s)
Buggy code:
import itertools

def combination(d):
    dd = [i for i in range(d)]
    return [itertools.combinations(dd, i) for i in range(1, d + 1)]

def all_green(d, g, ps, cs):
    # tood use int max value or other constant value
    min_count = 1000000
    for cc in combination(d):
        for c in cc:
            v = 0
            count = 0
            for ccc in c:
                v += cs[ccc]
                v += (ccc + 1) * 100 * ps[ccc]
                count += ps[ccc]
            if v >= g:
                if count < min_count:
                    min_count = count
                continue
            if count >= min_count:
                continue

            dd = [i if i not in c else None for i in range(d)]
            dd = list(filter(lambda x: x is not None, dd))
            for vvv in reversed(dd):
                for _ in range(ps[vvv]):
                    v += 100 * (vvv + 1)
                    count += 1
                    if v >= g:
                        if count < min_count:
                            min_count = count
                        break
                if count >= min_count:
                    break
    return min_count

d, g = map(int, input().split())
ps = []
cs = []
for _ in range(d):
    p, c = map(int, input().split())
    ps += [p]
    cs += [c]
print(all_green(d, g, ps, cs))


Fixed code:
import itertools

def combination(d):
    dd = [i for i in range(d)]
    return [itertools.combinations(dd, i) for i in range(d + 1)]

def all_green(d, g, ps, cs):
    # tood use int max value or other constant value
    min_count = 1000000
    for cc in combination(d):
        for c in cc:
            v = 0
            count = 0
            for ccc in c:
                v += cs[ccc]
                v += (ccc + 1) * 100 * ps[ccc]
                count += ps[ccc]
            if v >= g:
                if count < min_count:
                    min_count = count
                continue
            if count >= min_count:
                continue

            dd = [i if i not in c else None for i in range(d)]
            dd = list(filter(lambda x: x is not None, dd))
            for vvv in reversed(dd):
                for _ in range(ps[vvv]):
                    v += 100 * (vvv + 1)
                    count += 1
                    if v >= g:
                        if count < min_count:
                            min_count = count
                        break
                if count >= min_count:
                    break
    return min_count

d, g = map(int, input().split())
ps = []
cs = []
for _ in range(d):
    p, c = map(int, input().split())
    ps += [p]
    cs += [c]
print(all_green(d, g, ps, cs))
Buggy code:
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections

def judge(li):
    score = 0
    cnt = 0
    for i in range(len(li)):
        if li[i] == False:
            continue
        score += pc[i][1]
        score += pc[i][0]*(i+1)*(100)
        cnt += pc[i][0]
    return [cnt,score]
    
        
D,G = map(int,input().split())
pc = []
for i in range(D):
    p,c = map(int,input().split())
    pc.append([p,c])
ans = 100000000000000
for i in range(2**D):
    li = [False]*(D)
    for j in range(D):
        if (i>>j)&1:
            li[D-j-1] = True
    a = judge(li)
    j = D-1
    if a[1]<G:
        while True:
            if a[1]>=G or j == -1:
                break
            if li[j] == True:
                j-=1
                continue
            for k in range(pc[j][0]-1):
                a[1] += (j+1)*(100)
                a[0] += 1
                if a[1]>=G:
                    break
            j-=1
    ans = min(ans,a[0])
print(ans)
    

Fixed code:
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections

def judge(li):
    score = 0
    cnt = 0
    for i in range(len(li)):
        if li[i] == False:
            continue
        score += pc[i][1]
        score += pc[i][0]*(i+1)*(100)
        cnt += pc[i][0]
    return [cnt,score]
    
        
D,G = map(int,input().split())
pc = []
for i in range(D):
    p,c = map(int,input().split())
    pc.append([p,c])
ans = 100000000000000
for i in range(2**D):
    li = [False]*(D)
    for j in range(D):
        if (i>>j)&1:
            li[D-j-1] = True
    a = judge(li)
    j = D-1
    if a[1]<G:
        need = G-a[1]
        while True:
            if a[1]>=G:
                break
            if j == -1:
                break
            if li[j] == True:
                j-=1
                continue
            for k in range(pc[j][0]-1):
                a[1] += (j+1)*(100)
                a[0] += 1
                if a[1]>=G:
                    break
            j-=1
    if a[1]>=G:
        ans = min(ans,a[0])
print(ans)
Buggy code:
D,G = map(int,input().split())
questions = [list(map(int,input().split())) for _ in range(D)]
ans = float('inf')
for bit in range(1,1 << D):
  count = 0
  score = 0
  max_zero_index = 0
  for i in range(D):
    if (bit >> i) & 1:
      score += questions[i][0]*100*(i+1)+questions[i][1]
      count += questions[i][0]
    else:
      max_zero_index = i
  if score >= G:
    ans = min(count,ans)
  else:
    for _ in range(1,questions[max_zero_index][0]):
      count +=1
      score += 100*(max_zero_index+1)
      if score >= G:
        ans = min(count,ans)
print(ans)


Fixed code:
D,G = map(int,input().split())
questions = [list(map(int,input().split())) for _ in range(D)]
ans = float('inf')
for bit in range(1 << D):
  count = 0
  score = 0
  max_zero_index = 0
  for i in range(D):
    if (bit >> i) & 1:
      score += questions[i][0]*100*(i+1)+questions[i][1]
      count += questions[i][0]
    else:
      max_zero_index = i
  if score >= G:
    ans = min(count,ans)
  else:
    for _ in range(1,questions[max_zero_index][0]):
      count +=1
      score += 100*(max_zero_index+1)
      if score >= G:
        ans = min(count,ans)
print(ans)