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

Fixed submission:
s = input()
count = 0
ans = 0
for i in range(len(s)):
    if s[i] in "ACGT":
        count += 1
        ans = max(ans,count)
    else:
        count = 0
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
count = 0
ans = []
for i in s:
    if i == 'A'or i=='G' or i == 'T' or i == 'C':
        count +=1
    else:
        ans.append(count)
        count = 0
print(max(ans))

Buggy submission (verdict: Runtime Error):
s = input()
ans = []
count = 0
for i in range(len(s)):
    if  s[i]  in"ACGT":
            count +=1
    else:
        ans.append(count)
        count = 0
print(max(ans))
Problem p03147 (python)

Fixed submission:
N = int(input())
h = list(map(int,input().split()))
cnt = h[0]
for i in range(N-1):
  if h[i+1]>h[i]:
    cnt += h[i+1]-h[i]
print(cnt)

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int,input().split()))
count = h[0]
for i in range(n-1):
    if h[i+1]>h[i]:
        count += h[i+1]-h[i]
print(cnt)

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int,input().split()))
count = h[0]
for i in range(N-1):
    if h[i+1]>h[i]:
        count += h[i+1]-h[i]
print(cnt)
Problem p03457 (python)

Fixed submission:
n = int(input())
for i in range(n):
  t, x, y = map(int, input().split())
  if t < (x+y) or (t+x+y)%2==1:
    print("No")
    exit()

print("Yes")

Buggy submission (verdict: Runtime Error):
n = int(input())
t = []
for i in range(n):
    txy = list(map(int,input().split()))
    t.append(txy)
if t[0][0]<sum(t[0][1:]) or t[1][0]<sum(t[1][1:]):
    print('No')
else:
    if sum(t[0][1:]) == 0 or sum(t[1][1:]) == 0:
        if t[0]%2==0:
            print('Yes')
        else:
            print('No')
    elif t[0][0]%sum(t[0][1:])==0 and t[1][0]%sum(t[1][1:])==0:
        print('Yes')
    else:
        print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
t = []
for i in range(n):
    txy = list(map(int,input().split()))
    t.append(txy)
if t[0][0]<sum(t[0][1:]) or t[1][0]<sum(t[1][1:]):
    print('No')
else:
    if t[0][0]%sum(t[0][1:])==0 and t[1][0]%sum(t[1][1:])==0:
        print('Yes')
    else:
        print('No')
Problem p03544 (python)

Fixed submission:
n = int(input())

i0 = 2
i1 = 1
if n>1:
    for i in range(n-1):
        ans = i0+i1
        i0 = i1
        i1  = ans
if n==0:
    print(2)
elif n==1:
    print(1)
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
x = ['+++', '++-', '+-+', '+--', '-++', '-+-', '--+', '---']
a = input()
for i in range(8):
    ans = a[0] + x[i][0] + a[1] + x[i][1] + a[2] + x[i][2] + a[3]
    if eval(ans) == 7:
        print(ans + '=7')
        break

Buggy submission (verdict: Runtime Error):
n = int(input())

i0 = 2
i1 = 1
for i in range(n-1):
    ans = i0+i1
    i0 = i1
    i1  = ans
print(ans)
Problem p03556 (python)

Fixed submission:
n = int(input())
for i in range(n):
    a = i**2
    if a>n:
        b = i
        break
if n<=2:
    print(1)
else:
    print((b-1)**2)

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = 0
for i in range(n):
    a = i**2
    if a>n:
        b = i
        break
print((b-1)**2)
Problem p03612 (python)

Fixed submission:
n = int(input())
p = [int(i) for i in input().split()]
count = 0
for i in range(n - 1):
    if i+1 == p[i]:
        p[i],p[i+1] = p[i+1],p[i]
        count+=1
if n == p[n-1]:
    count+=1
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
p = [int(i) for i in input().split()]
count = 0
for i in range(1,n):
    if i+1 == p[i]:
        cha = p[i-1]
        p[i-1] = p[i]
        p[i] = cha
        count+=1
if n == p[n-1]
    count+=1
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
p = [int(i) for i in input().split()]
liI = [int(j) for j in range(1,n+1)]
count = 0
for i in range(n):
    if p[i] == liI[i]:
        cha = p[i]
        p[i] = p[i+1]
        p[i+1] = cha
        count+=1
print(count)
Problem p03721 (python)

Fixed submission:
n,k = map(int,input().split())

count= []
ans = 0
for i in range(n):
    ab = list(map(int,input().split()))
    count.append(ab)
count.sort()
i = 0
while ans < k:
    ans +=count[i][1]
    i +=1
print(count[i-1][0])

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())

ab= []
ans = 0
for i in range(n):
    ab = list(map(int,input().split()))
    ab.append(count)
ab.sort()

while ans < k:
    ans +=ab[i][1]
    i +=1
print(ab[i-1][0])
Problem p03777 (python)

Fixed submission:
a,b = map(str,input().split())

if a == "H" and b == "H":
    print("H")
elif a== "H"and b == "D":
    print("D")
elif a == "D" and b == "H":
    print("D")
else:
    print("H")

Buggy submission (verdict: Runtime Error):
a,b = map(str,input().split())

if a == "H" and b == "H":
    print("H")
elif a== "H"and b == "D":
    print("D")
elif a == "D" and b == "H":
    print("D")
else;
    print("H")

Buggy submission (verdict: Runtime Error):
a,b = map(str,input().split())

if a == "H" and b == "H":
    print("H")
elif a== "H"and b == "D":
    print("D")
elif a == "D" and b == "H":
    print("D")
else;
print("H")
Problem p02681 (python)

Fixed submission:
S = input()
T = input()

if len(S)+1 != len(T):
    print("No")

elif T[0:len(S)] == S:
    print("Yes")

else:
    print("No")

Buggy submission (verdict: Runtime Error):
nums = input()
S,T = nums.split(" ")

if len(S)+1 != len(T):
    print("No")

elif T[0:len(S)] == S:
    print("Yes")

else:
    print("No")
Problem p02784 (python)

Fixed submission:
h, n = map(int,input().split())
a = list(map(int,input().split()))
print('Yes' if sum(a) >= h else 'No')

Buggy submission (verdict: Runtime Error):
h, n = map(int,input().split())
a = list(map(int,input().split()))
l = []

for i in range(5):
  for j in range(5):
    if a[i] + a[j] >= h:
      l.append(1)
    else:
      l.append(0)

print('Yes' if sum(l) > 0 else 'No')
Problem p02898 (python)

Fixed submission:
n, k = map(int,input().split())
h = list(map(int,input().split()))
ans = 0
for i in range(n):
  if h[i] >= k:
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n, k = map(int,input().split())
h = list(map(int,input().split()))
ans = 0
for i in range(n):
  if n[0] >= k:
    ans += 1
print(ans)
Problem p03125 (python)

Fixed submission:
a,b = map(int,input().split())
print(a+b if b%a == 0 else b-a)

Buggy submission (verdict: Runtime Error):
a,b = map(int,inout().split())
print(a+b if b%a == 0 else b-a)
Problem p03493 (python)

Fixed submission:
s=input()
count=0
for i in range(3):
  if s[i]=='1':
    count+=1
print(count)

Buggy submission (verdict: Runtime Error):
s=input()
count=0
for i for range(3):
  if s[i]=='1':
    count+=1
print(count)
Problem p04043 (python)

Fixed submission:
a,b,c = map(int, input().split())
 
if a == 5:
  if b == 5:
    if c == 5:
      print('NO')
    else:
      print('YES')
  else:
    if c == 5:
      print('YES')
    else:
      print('NO')
else:
  if b == 5:
    if c == 5:
      print('YES')
    else:
      print('NO')
  else:
    print('NO')

Buggy submission (verdict: Runtime Error):
A,B,C = map(input().split())

a, b, c = len(A), len(B), len(C)
 
if a == 5 or a == 7:
  if b == 5:
    if c == 5:
      print('NO')
    else:
      print('YES')
  else:
    if c == 5:
      print('YES')
    else:
      print('NO')
Problem p02608 (python)

Fixed submission:
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
# from scipy.sparse.csgraph import floyd_warshall
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations, combinations_with_replacement
from heapq import heappop, heappush, heapify
from fractions import gcd
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7

def main():
    n = int(input())
    ans = [0 for _ in range(n)]
    for x in range(1,n):
        for y in range(1,n):
            for z in range(1,n):
                if x*x+y*y+z*z+x*y+y*z+x*z >= n+1:
                    break
                ans[x*x+y*y+z*z+x*y+y*z+x*z-1] += 1
    for i in range(n):
        print(ans[i])
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
# from scipy.sparse.csgraph import floyd_warshall
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations, combinations_with_replacement
from heapq import heappop, heappush, heapify
from fractions import gcd
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7

def main():
    n = int(input())
    ans = [0 for _ in range(n)]
    for x in range(1,n):
        for y in range(1,n):
            for z in range(1,n):
                if x*x+y*y+z*z+x*y+y*z+x*z-1 >= n+1:
                    break
                ans[x*x+y*y+z*z+x*y+y*z+x*z-1] += 1
    for i in range(n):
        print(ans[i])
if __name__ == "__main__":
    main()
Problem p02612 (python)

Fixed submission:
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
# from scipy.sparse.csgraph import floyd_warshall
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations, combinations_with_replacement
from heapq import heappop, heappush, heapify
from fractions import gcd
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7

def main():
    ans = 1000-int(int(input())%1000)
    if ans == 1000:
        print(0)
    else:
        print(ans)
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
# from scipy.sparse.csgraph import floyd_warshall
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations, combinations_with_replacement
from heapq import heappop, heappush, heapify
from fractions import gcd
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7

def main():
    ans = 1000-int(int(input())%1000)
    if ans == 1000:
        print(0)
    else:
        print(ans)
if __name__ == "__main__":1
    main()
Problem p02617 (python)

Fixed submission:
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
# from scipy.sparse.csgraph import floyd_warshall
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations, combinations_with_replacement
from heapq import heappop, heappush, heapify
from fractions import gcd
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7

def main():
    n = int(input())
    ans = n*(n+1)*(n+2)//6
    for i in range(n-1):
        u,v = map(int,input().split())
        if u > v:
            u,v = v,u
        ans -= (u)*(n-v+1)
    print(ans)
    
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
n=int(input())
ans=n*(n+1)*(n+2)//6
for i in range(n-1):
    u=map(int,input().split())
    ans-=min(u)*(n-max(u)+1)
print(ans)
Problem p02642 (python)

Fixed submission:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
 
def main():
    n = int(input())
    a = list(map(int, input().split()))
    a.sort()
    ans = 0
    N = max(a)+1
    tab = [1 for _ in range(N)]
    for i in range(n):
        x = a[i]
        if i < n-1 and a[i] == a[i+1]:
            tab[a[i]] = 0
        if tab[x]:
            ans += 1
        for i in range(N):
            if x*i >= N:
                break
            tab[x*i] = 0        
    print(ans)
    
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import sys
from collections import defaultdict
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
import numpy as np

def seachPrimeNum(N):
    max = int(np.sqrt(N))
    seachList = [i for i in range(2,N+1)]
    primeNum = []
    while seachList[0] <= max:
        primeNum.append(seachList[0])
        tmp = seachList[0]
        seachList = [i for i in seachList if i % tmp != 0]
    primeNum.extend(seachList)
    return primeNum
def main():
    n = int(input())
    a = list(map(int, input().split()))
    dic = defaultdict(int)
    a.sort()
    f = seachPrimeNum(max(a))
    ans = 0
    for i in range(n):
        x = a[i]
        if i < n-1 and a[i] == a[i+1]:
            dic[a[i]] = 1
            continue
        flag = 1
        for check in f:
            if check >= int(x**0.5)+1:
                break
            if(x%check==0):
                if dic[check]:
                    flag = 0
                    break
                if dic[x//check]:
                    flag = 0
                    break
        if flag:
            ans += 1
        dic[a[i]] = 1
    print(ans)
    
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import sys
from collections import defaultdict
import sympy
input = sys.stdin.readline
sys.setrecursionlimit(10**8)

def main():
    n = int(input())
    a = list(map(int, input().split()))
    dic = defaultdict(int)
    a.sort()
    ans = 0
    for i in range(n):
        if i < n-1 and a[i] == a[i+1]:
            dic[a[i]] = 1
            continue
        flag = 1
        for e in sympy.divisors(a[i]):
            if dic[e]:
                flag = 0
                break
        if flag:
            ans += 1
        dic[a[i]] = 1
    print(ans)
    
if __name__ == "__main__":
    main()
Problem p02696 (python)

Fixed submission:
def main():
    a,b,n = map(int,input().split())
    print(int(a*min((b-1),n)/b) - a*int(min((b-1),n)/b))

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
from fractions import gcd
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

def main():
    a,b,n = inpm()
    ans = int(a*n/b) - a*int(n/b)
    if n > b:
        ans = max(ans,int(a*(b-1)/b) - a*int((b-1)/b))
        
    for i in range(1,min(n//b+1)):
        if i*b<=n:
            x = int(a*(b*i-1)/b) - a*int((b*i-1)/b)
            ans = max(ans,x)
    print(ans)

if __name__ == "__main__":
    main()
Problem p02775 (python)

Fixed submission:
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input()) # n=1
def inpm(): return map(int,input().split()) # x=1,y=2
def inpl(): return list(map(int, input().split())) # a=[1,2,3,4,5,...,n]
def inpls(): return list(input().split())  # a=['1','2','3',...,'n']
def inplm(n): return list(int(input()) for _ in range(n)) # x=[] 複数行
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return sorted([list(map(int, input().split())) for _ in range(n)]) # [[1,1,1,1],[2,2,2,2],[3,3,3,3]] 

def main():
    n = list(input())
    l = len(n)
    ans = 0
    for i in range(l):
        n[i] = int(n[i])
    for i in range(l-1,-1,-1):
        if n[i] <= 4:
            ans += n[i]
        elif n[i] == 5 and (i == 0 or n[i-1] <= 4):
            ans += n[i]
        else:
            ans += 10 - n[i]
            n[i] = 0
            if i != 0:
                n[i-1] += 1
        if i == 0 and n[i] == 0:
            ans += 1
    print(ans)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input()) # n=1
def inpm(): return map(int,input().split()) # x=1,y=2
def inpl(): return list(map(int, input().split())) # a=[1,2,3,4,5,...,n]
def inpls(): return list(input().split())  # a=['1','2','3',...,'n']
def inplm(n): return list(int(input()) for _ in range(n)) # x=[] 複数行
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return sorted([list(map(int, input().split())) for _ in range(n)]) # [[1,1,1,1],[2,2,2,2],[3,3,3,3]] 

def main():
    N = inp()
    n = []
    while N > 0:
        n.append(N%10)
        N //= 10
    l = len(n)
    ans = 0
    for i in range(l):
        if n[i] == 10:
            n[i+1] += 1
            n[i] = 0
        if n[i] == 0:
            continue
        if n[i] <= 4:
            ans += n[i]
        elif n[i] == 5 and (i == l-1 or n[i+1] <= 4):
            ans += n[i]
        else:
            ans += 10 - n[i]
            n[i] = 0
            n[i+1] += 1
        if i == l-1:
            if n[i] == 0:
                ans += 1
    print(ans)

if __name__ == "__main__":
    main()
Problem p02923 (python)

Fixed submission:
def main():
    n = int(input())
    s = list(map(int,input().split()))
    ans=0
    point=-1
    for i in range(n-1):
        mark=0
        if i > point and i + ans < n:
            for j in range(n-i-1):
                if s[i+j]>=s[i+j+1]:
                    mark+=1
                    if mark>=ans:
                        ans=mark
                else:
                    if mark>=ans:
                        ans=mark
                        point=i+j
                    break
    print(ans)
main()

Buggy submission (verdict: Runtime Error):
n = int(input())
s = list(map(int,input().split()))
ans=[0 for _ in range(n-1)]
for i in range(n-1):
    j=0
    if(ans[i]==0):
        while(i+j<n-1):
            if(s[i+j]>=s[i+j+1]):
                for k in range(j+1):
                    ans[i+k]+=1
                j+=1
            else:
                break
print(max(ans))

Buggy submission (verdict: Runtime Error):
n = int(input())
s = list(map(int,input().split()))
ans=[0 for _ in range(n-1)]
for i in range(n-1):
    j=i
    while(j<n-1):
        if(s[j]>=s[j+1]):
            ans[i]+=1
            j+=1
        else:
            break
        
print(max(ans))
Problem p02973 (python)

Fixed submission:
import bisect
from collections import deque
def LIS(a):
    lis = deque()
    lis.append(-1)
    for i in range(len(a)):
        index = bisect.bisect_left(lis,a[i])
        if index == 0:
            lis.appendleft(a[i])
        else:
            lis[index-1] = a[i]
    return len(lis)

def main():
    n = int(input())
    a = [int(input()) for _ in range(n)]
    print(LIS(a))

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import bisect
def LIS(a):
    lis = [a[0]]
    for i in range(len(a)):
        if i != 0 and a[i] >= lis[-1]:
            lis.append(a[i])
        else:
            index = bisect.bisect_right(lis,a[i])
            lis[index] = a[i]
    return len(lis)

def main():
    n = int(input())
    a = [-int(input()) for _ in range(n)]
    print(LIS(a))

if __name__ == "__main__":
    main()
Problem p03032 (python)

Fixed submission:
from collections import Counter,defaultdict,deque
import sys
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
    
def inp(): # n=1
    return int(input())
def inpm(): # x=1,y=2
    return map(int,input().split())
def inpl(): # a=[1,2,3,4,5,...,n]
    return list(map(int, input().split()))
def inpls(): # a=['1','2','3',...,'n']
    return list(input().split())
def inplm(n): # x=[] 複数行
    return list(int(input()) for _ in range(n))
def inpll(n): # [[1,1,1,1],[2,2,2,2],[3,3,3,3]]
    return sorted([list(map(int, input().split())) for _ in range(n)])

def main():
    n,k = inpm()
    v = inpl()
    a = [0 for _ in range(n+1)]
    b = [0 for _ in range(n+1)]
    ans = 0
    for i in range(n):
        a[i+1] = a[i] + v[i]
        b[i+1] = b[i] + v[n-1-i]
    for x in range(min(n+1,k+1)):
        for y in range(min(n-x+1,k-x+1)):
            que = []
            for i in range(x):
                que.append(v[i])
            for i in range(y):
                que.append(v[n-1-i])
            que.sort()
            l = len(que)
            pre = a[x] + b[y]
            for z in range(min(l,k-x-y)):
                if que[z]>=0:
                    break
                pre -= que[z]
                ans = max(ans,pre)
            ans = max(ans,pre)
    print(ans)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
from collections import Counter,defaultdict,deque
import sys
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
    
def inp(): # n=1
    return int(input())
def inpm(): # x=1,y=2
    return map(int,input().split())
def inpl(): # a=[1,2,3,4,5,...,n]
    return list(map(int, input().split()))
def inpls(): # a=['1','2','3',...,'n']
    return list(input().split())
def inplm(n): # x=[] 複数行
    return list(int(input()) for _ in range(n))
def inpll(n): # [[1,1,1,1],[2,2,2,2],[3,3,3,3]]
    return sorted([list(map(int, input().split())) for _ in range(n)])

def main():
    n,k = inpm()
    v = inpl()
    a = [0 for _ in range(n+1)]
    b = [0 for _ in range(n+1)]
    ans = 0
    for i in range(n):
        a[i+1] = a[i] + v[i]
        b[i+1] = b[i] + v[n-1-i]
    for x in range(k+1):
        for y in range(k-x+1):
            que = []
            for i in range(x):
                que.append(v[i])
            for i in range(y):
                que.append(v[n-1-i])
            que.sort()
            l = len(que)
            pre = a[x] + b[y]
            for z in range(min(l,k-x-y)):
                if que[z]>=0:
                    break
                pre -= que[z]
                ans = max(ans,pre)
    print(ans)

if __name__ == "__main__":
    main()