Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02609 (python)

Fixed submission:
def popcount(x):
    return bin(x)[2:].count("1")

def f(x):
    cnt=0
    while(x>0):
        x%=popcount(x)
        cnt+=1
    return cnt

n=int(input())
s=input()
d=s.count("1")
if d==0:
    for i in range(n):
        print(1)
elif d==1:
    if s[-1]=="1":
        for i in range(n-1):
            print(2)
        else:
            print(0)
    else:
        for i in range(n-1):
            if s[i]=="1":
                print(0)
            else:
                print(1)
        print(2)
else:
    s=s[::-1]
    toaddm=1
    toaddM=1
    m=0
    M=0
    for i in range(n):
        if s[i]=="1":
            m+=toaddm
            M+=toaddM
            m%=d-1
            M%=d+1
        toaddm*=2
        toaddm%=d-1
        toaddM*=2
        toaddM%=d+1
    toaddm=-1
    toaddM=1
    res=[None for i in range(n)]
    for i in range(n):
        if s[i]=="1":
            res[i]=f((m+toaddm)%(d-1))+1
        else:
            res[i]=f((M+toaddM)%(d+1))+1
        toaddm*=2
        toaddm%=d-1
        toaddM*=2
        toaddM%=d+1
    for i in res[::-1]:
        print(i)

Buggy submission (verdict: Runtime Error):
def popcount(x):
    return bin(x)[2:].count("1")

def f(x):
    cnt=0
    while(x>0):
        x%=popcount(x)
        cnt+=1
    return cnt

n=int(input())
s=input()
d=s.count("1")
s=s[::-1]
toaddm=1
toaddM=1
m=0
M=0
for i in range(n):
    if s[i]=="1":
        m+=toaddm
        M+=toaddM
        m%=d-1
        M%=d+1
    toaddm*=2
    toaddm%=d-1
    toaddM*=2
    toaddM%=d+1
toaddm=-1
toaddM=1
res=[None for i in range(n)]
for i in range(n):
    if s[i]=="1":
        res[i]=f((m+toaddm)%(d-1))+1
    else:
        res[i]=f((M+toaddM)%(d+1))+1
    toaddm*=2
    toaddm%=d-1
    toaddM*=2
    toaddM%=d+1
for i in res[::-1]:
    print(i)
Problem p02681 (python)

Fixed submission:
import sys
s=input()
t=input()
for c in ["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"]:
    if s+c==t:
        print("Yes")
        sys.exit(0)
print("No")

Buggy submission (verdict: Runtime Error):
import numpy as np
n,m,x=map(int,input().split())
c=[None for i in range(n)]
a=[None for i in range(n)]
for i in range(n):
    l=[int(i) for i in input().split()]
    c[i]=l[0]
    a[i]=np.array(l[1:])
mincos=1000000000000
for mask in range(2**n):
    rikai=np.zeros(m,dtype="int32")
    cos=0
    mm=mask
    for i in range(n):
        if mm%2:
            rikai+=a[i]
            cos+=c[i]
        mm//=2
    if np.all(rikai>=x):
        mincos=min(cos,mincos)

if mincos==1000000000000:
    print(-1)
else:
    print(mincos)
Problem p02683 (python)

Fixed submission:
import numpy as np
n,m,x=map(int,input().split())
c=[None for i in range(n)]
a=[None for i in range(n)]
for i in range(n):
    l=[int(i) for i in input().split()]
    c[i]=l[0]
    a[i]=np.array(l[1:])
mincos=1000000000000
for mask in range(2**n):
    rikai=np.zeros(m,dtype="int32")
    cos=0
    mm=mask
    for i in range(n):
        if mm%2:
            rikai+=a[i]
            cos+=c[i]
        mm//=2
    if np.all(rikai>=x):
        mincos=min(cos,mincos)

if mincos==1000000000000:
    print(-1)
else:
    print(mincos)

Buggy submission (verdict: Runtime Error):
import numpy as np
n,m,x=map(int,input().split())
c=[None for i in range(n)]
a=[None for i in range(n)]
for i in range(n):
    l=[int(i) for i in input().split()]
    c[i]=l[0]
    a[i]=np.array(l[1:])
mincos=1000000000000
for mask in range(2**n):
    rikai=np.zeros(m,dtype="int32")
    cos=0
    mm=mask
    for i in range(n):
        if mm%2:
            rikai+=a[i]
            cos+=c[i]
        mm//=2
    if np.all(rikai>=x):
        mincos=min(cos,mincos)

if mincos==1000000000000:
    print(-1)
else:
    print(mincos)
Problem p02830 (python)

Fixed submission:
n=int(input())
s,t=input().split()
for i in range(n):
  print(s[i],end="")
  print(t[i],end="")

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
t=input()
for i in range(n):
  print(s[i],end="")
  print(t[i],end="")
Problem p02843 (python)

Fixed submission:
dp=[0 for i in range(100110)]
dp[0]=1
a=[i for i in range(100,106)]
for i in range(100000):
  if dp[i]==1:
    for j in a:
      dp[i+j]=1
print(dp[int(input())])

Buggy submission (verdict: Runtime Error):
dp=[0 for i in range(100001)]
dp[0]=1
a=[i for i in range(100,106)]
for i in range(100001):
  if dp[i]==1:
    for j in a:
      dp[i+j]=1
print(dp[int(input())])
Problem p03068 (python)

Fixed submission:
n=int(input())
s=input()
x=s[int(input())-1]
for i in range(n):
  if s[i]==x:
    print(x,end="")
  else:
    print("*",end="")

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
x=s[int(input())]
for i in range(n):
  if s[i]==x:
    print(x,end="")
  else:
    print("*",end="")
Problem p03150 (python)

Fixed submission:
def solve():
  s=input()
  for l in range(len(s)):
    for r in range(l,len(s)+1):
      if "keyence"==s[:l]+s[r:]:
        print("YES")
        return
  print("NO")

solve()

Buggy submission (verdict: Runtime Error):
def solve():
  s=input()
  for l in range(len(s)):
    for r in range(l,len(s)):
      if "keyence" in a[:l]+a[r:]:
        print("YES")
        return
  print("NO")

solve()
Problem p03214 (python)

Fixed submission:
n=int(input())
s=input().split()
l=[int(s[i]) for i in range(n)]
su=sum(l)
best=10000000000000000
res=0
for i in range(n):
  if(abs(su-n*l[i])<best):
    best=abs(su-n*l[i])
    res=i
print(res)

Buggy submission (verdict: Runtime Error):
n=int(input())
l=map(int,input().split())
su=sum(l)
best=10000000000000000
res=0
for i in range(len(l)):
  if(su-n*l[i]<best):
    best=su-n*l[i]
    res=i
print(res)
Problem p03239 (python)

Fixed submission:
n,t=input().split()
n=int(n)
t=int(t)
res=10000
for i in range(n):
  s=input().split()
  if int(s[1])<=t:
    res=min(res,int(s[0]))
if res==10000:
  print("TLE")
else:
  print(res)

Buggy submission (verdict: Runtime Error):
n,t=input().split()
n=int(n)
t=int(t)
res=10000
for i in range(n):
  s=input().split()
  if int(s[1])<=T:
    res=min(res,int(s[0]))
if res==10000:
  print("TLE")
else:
  print(res)
Problem p03269 (python)

Fixed submission:
l=int(input())-1
s=bin(l)[2:]
if s.count("0")==0:
    n=len(s)+1
    print(str(n)+" "+str(2*(n-1)))
    for i in range(n-1):
        print(str(i+1)+" "+str(i+2)+" 0")
        print(str(i+1)+" "+str(i+2)+" "+str(2**i))
else:
    n=len(s)
    res=""
    for i in range(n-1):
        res+=str(i+1)+" "+str(i+2)+" 0\n"
        res+=str(i+1)+" "+str(i+2)+" "+str(2**i)+"\n"
    while True:
        if s[-1]=="1":
            for i in range(1,n+1):
                if s[-i]=="0":
                    break
            ss=s[:-i]+"0"*i
            nnn=int(ss,2)
            res+=str(i)+" "+str(n)+" "+str(nnn)+"\n"
            s=bin(nnn-1)[2:]
            if len(s)<n:
                break
        else:
            res+="1 "+str(n)+" "+str(l)+"\n"
            if s.count("1")>1:
                s=bin(l-1)[2:]
            else:
                break
    r=res.count("\n")
    res=res[:-1]
    print(str(n)+" "+str(r))
    print(res)

Buggy submission (verdict: Runtime Error):
l=int(input())-1
s=bin(l)[2:]
if s.count("0")==0:
    n=len(s)+1
    print(str(n-1)+" "+str(2*(n-1)))
    for i in range(n-1):
        print(str(i+1)+" "+str(i+2)+" 0")
        print(str(i+1)+" "+str(i+2)+" "+str(2**i))
else:
    n=len(s)
    res=""
    for i in range(n-1):
        res+=str(i+1)+" "+str(i+2)+" 0\n"
        res+=str(i+1)+" "+str(i+2)+" "+str(2**i)+"\n"
    while s.count("1")>1:
        if s[-1]=="1":
            for i in range(1,n+1):
                if s[-i]=="0":
                    break
            ss=s[:-i]+"0"*i
            nnn=int(ss,2)
            res+=str(i)+" "+str(n)+" "+str(nnn)+"\n"
            s=bin(nnn-1)[2:]
            if len(s)<n:
                break
        else:
            res+="1 "+str(n)+" "+str(l)+"\n"
            s=bin(l-1)[2:]
r=res.count("\n")
res=res[:-1]
print(str(n)+" "+str(r))
print(res)
Problem p03273 (python)

Fixed submission:
import numpy as np
n,m=map(int,input().split())
arr=[]
for i in range(n):
    l=[ord(c)-46 for c in input()]
    if l.count(0)==m:
        continue
    arr.append(l)
a=np.array(arr)
a=a.T
b=[]
for i in range(len(a)):
    if list(a[i]).count(0)==len(a[i]):
        continue
    b.append(list(a[i]))
b=list(np.array(b).T)
for l in b:
    for x in l:
        if x==0:
            print(".",end="")
        else:
            print("#",end="")
    print()

Buggy submission (verdict: Runtime Error):
import numpy as np
n,m=map(int,input().split())
arr=[]
for i in range(n):
    l=[ord(c)-46 for c in input()]
    if l.count(0)==m:
        continue
    arr.append(l)
a=np.array(arr)
a=a.T
b=[]
for i in range(len(a)):
    if list(a[i]).count(0)==len(a[i]):
        continue
    b.append(list(a[i]))
b=list(np.array(b).T)
for l in b:
    for x in l:
        if x==0:
            print(".",end="")
        else:
            print("#",end="")
    print()
Problem p03282 (python)

Fixed submission:
import sys
s=input()
k=int(input())
if k<105:
    if s[:k]=="1"*k:
        print("1")
        sys.exit(0)
i=0
while True:
    if s[i]!="1":
        print(s[i])
        break
    i+=1

Buggy submission (verdict: Runtime Error):
s=input()
k=int(input())
if s[:k]=="1"*k:
    print("1")
else:
    i=0
    while True:
        if s[i]!="1":
            print(s[i])
            break
        i+=1

Buggy submission (verdict: Runtime Error):
ss=input()
l=len(s)
if s=="1"*l:
    print("1")
else:
    i=0
    while True:
        if s[i]!="1":
            print(s[i])
            break
        i+=1
Problem p03287 (python)

Fixed submission:
s=input().split()
n,m=int(s[0]),int(s[1])
s=input().split()
l=[0]
for i in range(n):
    l.append((l[-1]+int(s[i]))%m)
l.sort()
j=-1
cnt=-100
ll=[]
for i in range(len(l)):
    cnt+=1
    if j!=l[i]:
        j=l[i]
        ll.append(cnt)
        cnt=0
ll.append(cnt+1)
res=0
for i in ll:
    if i>1:
        res+=(i*(i-1))//2
print(res)

Buggy submission (verdict: Runtime Error):
import bisect
def put(a,b):
    a+="0"*20
    b+="0"*20
    s=""
    for  i in range(20):
        s+=a[i]+b[i]
    s=s[-1::-1]
    ind=s.find("1")
    if ind==-1:
        print(0)
    else:
        s=s[ind:]
        print(s[-1::-1])
 
def quad(i):
    s=""
    while i>0:
        s+=str(i%4)
        i//=4
    return s[-1::-1]
 
l=[0,1]
for i in range(1,22):
    l+=[4**i+j for j in l]
 
n=int(input())
for i in range(len(l)):
    if (n-l[i])%2==0:
        ind=bisect.bisect_left(l,(l[i]-n)//2)
        if l[i]-2*l[ind]==n:
            put(quad(l[i]),quad(l[ind]))
            break
Problem p03328 (python)

Fixed submission:
s=input().split()
print(-int(s[0])+(int(s[1])-int(s[0])-1)*(int(s[1])-int(s[0]))//2)

Buggy submission (verdict: Runtime Error):
s=input().split()^M
print(-int(s[0])+(int(s[1])-int(s[0])-1)*(int(s[1])-int(s[0]))//2)

Buggy submission (verdict: Runtime Error):
s=input().split()
print(int[1]-(int(s[1])-int(s[0])-1)*(int(s[1])-int(s[0]))/2)
Problem p03330 (python)

Fixed submission:
s=input().split()
N=int(s[0])
C=int(s[1])
d=[]
for i in range(C):
    s=input().split()
    temp=[]
    for item in s:
        temp.append(int(item))
    d.append(temp)
if N==1:
    print("0")
else:
    c=[[],[],[]]
    cost=[[],[],[]]
    for j in range(N):
        s=input().split()
        for i in range(len(s)):
            c[(i+j)%3].append(int(s[i])-1)
    for i in range(C):
        s=0
        for col in c[0]:
            s+=d[col][i]
        cost[0].append((s,i))
        s=0
        for col in c[1]:
            s+=d[col][i]
        cost[1].append((s,i))
        s=0
        for col in c[2]:
            s+=d[col][i]
        cost[2].append((s,i))
    res=100000000000
    for i in range(C):
        for j in range(C):
            for k in range(C):
                if cost[0][i][1]!=cost[1][j][1] and cost[1][j][1]!=cost[2][k][1] and cost[2][k][1]!=cost[0][i][1]:
                    res=min(res,cost[0][i][0]+cost[1][j][0]+cost[2][k][0])
    print(res)

Buggy submission (verdict: Runtime Error):
s=input().split()
N=int(s[0])
C=int(s[1])
d=[]
for i in range(C):
    s=input().split()
    temp=[]
    for item in s:
        temp.append(int(item))
    d.append(temp)
if N==1:
    print("0")
else:
    c=[[],[],[]]
    cost=[[],[],[]]
    for j in range(N):
        s=input().split()
        for i in range(len(s)):
            c[(i+j)%3].append(int(s[i])-1)
    for i in range(C):
        s=0
        for col in c[0]:
            s+=d[col][i]
        cost[0].append((s,i))
        s=0
        for col in c[1]:
            s+=d[col][i]
        cost[1].append((s,i))
        s=0
        for col in c[2]:
            s+=d[col][i]
        cost[2].append((s,i))
    cost[0].sort()
    cost[1].sort()
    cost[2].sort()
    res=3000000
    for i in range(N):
        for j in range(N):
            for k in range(N):
                if cost[0][i][1]!=cost[1][j][1] and cost[1][j][1]!=cost[2][k][1] and cost[2][k][1]!=cost[0][i][1]:
                    res=min(res,cost[0][i][0]+cost[1][j][0]+cost[2][k][0])
                if cost[0][i][0]+cost[1][j][0]+cost[2][k][0]>res:
                    break

    print(res)
Problem p03427 (python)

Fixed submission:
s=input()
c=s.count("9")
if c==len(s):
    print(c*9)
elif len(s)==1:
    print(s)
elif s[1:].count("9")==len(s)-1:
    print(s[1:].count("9")*9+int(s[0]))
else:
    print((len(s)-1)*9+int(s[0])-1)

Buggy submission (verdict: Runtime Error):
s=input()
c=s.count("9")
if c==len(s):
    print(c*9)
else:
    print((c-1)*9+int(s[0]-1))
Problem p03547 (python)

Fixed submission:
x,y=input().split()
if x>y:
  print(">")
elif x<y:
  print("<")
else:
  print("=")

Buggy submission (verdict: Runtime Error):
x,y=input.split()
if x>y:
  print(">")
elif x<y:
  print("<")
else:
  print("=")
Problem p03578 (python)

Fixed submission:
lena=int(input())
s=input().split()
a=[]
for i in s:
 a.append(int(i))
a.sort()
lenb=int(input())
s=input().split()
b=[]
for i in s:
 b.append(int(i))
b.sort()
i=0
j=0
while i<lena:
    if a[i]==b[j]:
        i+=1
        j+=1
        if j==lenb:
            break
    elif a[i]<b[j]:
        i+=1
    else:
        break
if j==lenb:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
input()
s=input.split()
a=[]
for i in s:
 a.append(int(i))
a.sort()
input()
s=input.split()
b=[]
for i in s:
 b.append(int(i))
b.sort()
while len(a)>0:
    if a[0]==b[0]:
        del(a[0])
        del(b[0])
        if len(b)==0:
            break
    elif a[0]<b[0]:
        del(a[0])
    else:
        a=[]
if len(b)==0:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
import bisect
s=input()
s=input().split()
t=input()
t=input().split()
s.sort()
t.sort()
f=False
for c in t:
 i=bisect.bisect_left(s,c)
 if s[i]!=c:
  print("NO")
  f=True
  break
 else:
  s.pop[i]
if not f:
 print("YES")
Problem p03591 (python)

Fixed submission:
a=input()
if a[0:4]=="YAKI":
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a=input()
if a[0:4]=="YAKI":
 print("Yes")
else
 print("No")
Problem p03688 (python)

Fixed submission:
n=int(input())
s=input().split()
l=[int(s[i]) for i in range(n)]
l.sort()
if l[0]==l[-1]:
    if l[0]<=n//2 or l[0]==n-1:
        print("Yes")
    else:
        print("No")
elif l[-1]-l[0]>1:
    print("No")
else:
    a=l.count(l[0])
    b=l.count(l[-1])
    if a+1<=l[-1]<=a+b//2:
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input().split()
l=[int(s[i]) for i in range(n)]
l.sort()
if l[0]==l[-1]:
    if 1<=l[0]<=n//2:
        print("Yes")
    else:
        print("No")
elif l[-1]-l[0]>1:
    l[10000000]-=1
    print("No")
else:
    l[10000000]-=1
    a=l.count(l[0])
    b=l.count(l[-1])
    if a+1<=l[-1]<=a+b//2:
        print("Yes")
    else:
        print("No")
Problem p03948 (python)

Fixed submission:
n=int(input().split()[0])
s=input().split()
l=[0 for i in range(n)]
m=[0 for i in range(n)]
M=[0 for i in range(n)]
for i in range(n):
  l[i]=int(s[i])
m[0]=l[0]
M[0]=l[-1]
for i in range(1,n):
  m[i]=min(m[i-1],l[i])
  M[i]=max(M[i-1],l[-i-1])
M.reverse()
d=[M[i]-m[i] for i in range(n)]
ma=max(d)
memo=-1
cnt=0
for i in range(n):
   if d[i]==ma and m[i]!=memo:
      cnt+=1
      memo=m[i]
print(cnt)

Buggy submission (verdict: Runtime Error):
s=input().split()
l=[]
for i in range(1,len(s)):
  l.append(int(s[i])-int(s[i-1]))
l.sort()
m=l[-1]
for i in range(2,len(s)+1):
  if l[-i]!=m:
    break
print(i-1)
Problem p03959 (python)

Fixed submission:
n=int(input())
l= list(map(int, input().split()))
r= list(map(int, input().split()))
l=[0]+l
r.append(0)
 
res=1
if(l[-1]!=r[0]):
	res=0
for i in range(n):
	if( (l[i]<l[i+1]) or (r[i]>r[i+1]) ):
		if( ( (l[i]<l[i+1]) and (r[i]>r[i+1]) ) and (l[i+1]!=r[i]) ):
			res=0
		if( ( (l[i]<l[i+1]) and (r[i]==r[i+1]) ) and (l[i+1]>r[i]) ):
			res=0
		if( ( (l[i]==l[i+1]) and (r[i]>r[i+1]) ) and (l[i+1]<r[i]) ):
			res=0
	else:
		res*=min(l[i],r[i])
		res%=1000000007
print(res)

Buggy submission (verdict: Runtime Error):
    n=int(input())
    l= list(map(int, input().split()))
    r= list(map(int, input().split()))
    l=[0]+l
    r.append(0)
     
    res=1
    for i in range(n):
    	if( (l[i]<l[i+1]) or (r[i]>r[i+1]) ):
    		if( ( (l[i]<l[i+1]) and (r[i]>r[i+1]) ) and (l[i+1]!=r[i]) ):
    			res*=0
    	else:
    		res*=min(l[i],r[i])
    print(res%1000000007)

Buggy submission (verdict: Runtime Error):
n=int(input())
l= list(map(int, input().split()))
r= list(map(int, input().split()))
l=[0]+l
r.append(0)

res=1
max=1
if(max(l)!=max(r)):
	res=0
for i in range(n):
	if( (l[i]<l[i+1]) or (r[i]>r[i+1]) ):
		if( ( (l[i]<l[i+1]) and (r[i]>r[i+1]) ) and (l[i+1]!=r[i]) ):
			res*=0
	else:
		res*=min(l[i],r[i])
		res%=1000000007
print(res)
Problem p03962 (python)

Fixed submission:
print(len(set(input().split())))

Buggy submission (verdict: Runtime Error):
#include <iostream>
using namespace std;

int main(void){
	int a,b,c,s=0;
	int[101] arr={};
	cin >> a >> b >> c;
	int[a]=1;
	int[b]=1;
	int[c]=1;
	for(int i=0;i<101;i++){
		s+=arr[i];
	}
	cout << s;
	return 0;
}
Problem p03992 (python)

Fixed submission:
s=input()
ss=s[0:4]+" "+s[4:]
print(ss)

Buggy submission (verdict: Runtime Error):
s=input
ss=s[0:3]+" "+s[4:]
print(ss)
Problem p03994 (python)

Fixed submission:
def f(s,K):
 if K==0:
  return s,"",0
 res=0
 str=""
 for i in range(len(s)-1):
  if s[i]=="a":
   str+="a"
   res+=1
   continue
  if K>=123-ord(s[i]):
   str+="a"
   res+=1
   K-=123-ord(s[i])
  else:
   break
 if res==0:
  skip=0
  for skip in range(len(s)):
   if K>=123-ord(s[skip]):
    break
  return s[:skip],s[skip:],K
 return str,s[res:],K

ss=input()
KK=int(input())
sol=""
while len(ss)>1:
 x,ss,KK=f(ss,KK)
 sol+=x
if len(ss)==1:
 KK%=26
 if ord(ss[0])+KK<123:
  sol+=chr(ord(ss[0])+KK)
 else:
  sol+=chr(ord(ss[0])+KK-26)
print(sol)

Buggy submission (verdict: Runtime Error):
def f(s,K):
 res=0
 str=""
 for i in range(len(s)):
  if s[i]=="a":
   str+="a"
   res+=1
   continue
  if K>=123-ord(s[i]):
   str+="a"
   res+=1
   K-=123-ord(s[i])
  else:
   break
 if res==0:
  skip=0
  for skip in range(len(s)):
   if K>=123-ord(s[skip]):
    break
  return s[:skip],s[skip:],K
 return str,s[res:],K

ss=input()
KK=int(input())
sol=""
while len(ss)>1:
 x,ss,KK=f(ss,KK)
 sol+=x
KK%=26
if ord(ss[0])+KK<123:
 sol+=chr(ord(ss[0])+KK)
else:
 sol+=chr(ord(ss[0])+KK-26)
print(sol)

Buggy submission (verdict: Runtime Error):
def f(s,K):
 if len(s)==1:
  K%=26
  if ord(s[0])+K<123:
   return chr(ord(s[0])+K)
  else:
   return chr(ord(s[0])+K-26)
 res=0
 for i in range(len(s)):
  if s[i]=="a":
   res+=1
   continue
  if K>=123-ord(s[i]):
   res+=1
   K-=123-ord(s[i])
  else:
   break
 str=""
 for i in range(res):
  str+="a"
 if res==0:
  for i in range(len(s)):
   if K>=123-ord(s[i]):
    break
  return s[:i]+f(s[i:],K)
 return str+f(s[res:],K)
ss=input()
KK=int(input())
print(f(ss,KK))
Problem p03071 (python)

Fixed submission:
a,b=map(int, raw_input().split())
ans=max([a+a-1,b+b-1,a+b])
print ans

Buggy submission (verdict: Runtime Error):
a,b=map( raw_input(), int)
ans=max([a+a-1,b+b-1,a+b])
print ans

Buggy submission (verdict: Runtime Error):
a,b=map(int, raw_input())
ans=max([a+a-1,b+b-1,a+b])
print ans

Buggy submission (verdict: Runtime Error):
a,b=map(int, raw_input())
ans=Max([a+a-1,b+b-1,a+b])
print ans
Problem p03773 (python)

Fixed submission:
print sum(map(int, raw_input().split()))%24

Buggy submission (verdict: Runtime Error):
print(sum(map(int, raw_input().split()))%24)
Problem p02612 (python)

Fixed submission:
n = int(input())
print((1000-(n%1000))%1000)

Buggy submission (verdict: Runtime Error):
n = int(input())
print(n-(n%1000))%1000
Problem p02696 (python)

Fixed submission:
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate, combinations_with_replacement, compress
import sys
import math
import bisect


def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.readline())


def LS(): return [list(x) for x in sys.stdin.readline().split()]


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


def IR(n):
    return [I() for i in range(n)]


def LIR(n):
    return [LI() for i in range(n)]


def SR(n):
    return [S() for i in range(n)]


def LSR(n):
    return [LS() for i in range(n)]


sys.setrecursionlimit(1000000)


def main():
    A, B, N = LI()
    print(int(A / B * min(N, B - 1)))


main()

Buggy submission (verdict: Runtime Error):
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate, combinations_with_replacement, compress
import sys
import math
import bisect


def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.readline())


def LS(): return [list(x) for x in sys.stdin.readline().split()]


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


def IR(n):
    return [I() for i in range(n)]


def LIR(n):
    return [LI() for i in range(n)]


def SR(n):
    return [S() for i in range(n)]


def LSR(n):
    return [LS() for i in range(n)]


sys.setrecursionlimit(1000000)


def main():
    N, M, Q = LI()
    abcd = [LI() for _ in range(Q)]
    ans = 0

    for A in combinations_with_replacement(range(1, M + 1), N):
        tmp = 0
        for (a, b, c, d) in abcd:
            tmp += d if (A[b-1] - A[a-1] == c) else 0
        ans = max(ans, tmp)
    print(ans)


main()

Buggy submission (verdict: Runtime Error):
#!usr/bin/env pypy3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate, combinations_with_replacement, compress
import sys
import math
import bisect


def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.readline())


def LS(): return [list(x) for x in sys.stdin.readline().split()]


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


def IR(n):
    return [I() for i in range(n)]


def LIR(n):
    return [LI() for i in range(n)]


def SR(n):
    return [S() for i in range(n)]


def LSR(n):
    return [LS() for i in range(n)]


sys.setrecursionlimit(1000000)


def main():
    N, M, Q = LI()
    abcd = [LI() for _ in range(Q)]
    ans = 0

    for A in combinations_with_replacement(range(1, M + 1), N):
        tmp = 0
        for (a, b, c, d) in abcd:
            tmp += d if (A[b-1] - A[a-1] == c) else 0
        ans = max(ans, tmp)
    print(ans)


main()