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

Fixed submission:
S = input()
cnt = 0
s = S[0]
for i in range(1, len(S)):
    si = int(S[i])
    #print(s, si)
    if int(s) == int(si):
        #print("hit")
        s = 1 - si
        cnt += 1
    else:
        s = si

# reverse first
cnt2 = 1
s = 1 - int(S[0])
for i in range(1, len(S)):
    si = int(S[i])
    #print(s, si)
    if int(s) == int(si):
        #print("hit")
        s = 1 - si
        cnt2 += 1
    else:
        s = si

#print(cnt, cnt2)
print(min(cnt, cnt2))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = list(input())

arr = [0 for _ in range(N)]
idx = 0
pre = '1'
if S[0] == '0':
    idx += 1
    arr[0] = 0
    pre = '0'

for i in range(N):
    if pre == S[i]:
        arr[idx] += 1
    else:
        idx += 1
        arr[idx] += 1
    pre = S[i]

max_lensum = 0
for i in range(0, idx+1, 2):
    #print("arr", arr)
    #print("arr", arr[i:min(i+2*K+1, idx+1)])
    lensum = sum(arr[i:min(i+2*K+1, idx+1)])
    if lensum > max_lensum:
        max_lensum = lensum
    if i+2*K+1 > idx: break
print(max_lensum)
Problem p02831 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import sys
import itertools#これは色々使える組み込み関数みたいなやつ
#import math#数学的計算はこれでいける。普通に0.5乗しても計算可能
#w=input()
#a,bの最大公約数
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

#a,bの最小公倍数
def lcm(a, b):
    return a * b // gcd (a, b)
i=0
#N=int(input())
A, B=input().split()
A=int(A)
B=int(B)
print(lcm(A, B))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys
import itertools#これは色々使える組み込み関数みたいなやつ
import math#数学的計算はこれでいける。普通に0.5乗しても計算可能
#w=input()
i=0
#N=int(input())
A, B=input().split()
A=int(A)
B=int(B)
print(int((A*B)/math.gcd(A, B)))
Problem p02832 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import sys
import itertools#これは色々使える組み込み関数みたいなやつ
#import math#数学的計算はこれでいける。普通に0.5乗しても計算可能
#w=input()
i=0
N=int(input())
#N, L=input().split()
#S=input()
#T=input()
#S_list=list(S)
a_list=  list(map(int, input().split(" ")))
j=0
times=0

for i  in range(N):
    if a_list[i]==i-times+1:
       pass
    else:
       times=times+1

if times==len(a_list):
    print(-1)
    sys.exit()
print(times)



#for i in range(N):
# print(i,j,times, a_list)

 #if a_list[j]==j+1:
#     j=j+1
#     if j==len(a_list):
#         print(times)
#         sys.exit()

 #if a_list[i]==i+1:
 #i=j
 #print(i, a_list)
 #if i+1==len(a_list):
#    print(times)
#    sys.exit()
# if a_list[j]!=j+1:
#     a_list.pop(j)
     #j=i
     #i=j
#     times+=1
#     if len(a_list)==0:
#      print(-1)
#      sys.exit()
     #elif j+1==len(a_list):
     #print(times)
    #     sys.exit()

#     elif
#print(times)
#

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys
import itertools#これは色々使える組み込み関数みたいなやつ
#import math#数学的計算はこれでいける。普通に0.5乗しても計算可能
#w=input()
i=0
N=int(input())
#N, L=input().split()
#S=input()
#T=input()
#S_list=list(S)
a_list=  list(map(int, input().split(" ")))
j=0
times=0
for i in range(N):
# print(i,j,times, a_list)

 if a_list[j]==j+1:
     j=j+1
     if j==len(a_list):
         print(times)
         sys.exit()

 #if a_list[i]==i+1:
 #i=j
 #print(i, a_list)
 #if i+1==len(a_list):
#    print(times)
#    sys.exit()
 if a_list[j]!=j+1:
     a_list.pop(j)
     #j=i
     #i=j
     times+=1
     if len(a_list)==0:
      print(-1)
      sys.exit()
     #elif j+1==len(a_list):
     #print(times)
    #     sys.exit()

#     elif
print(times)
Problem p02933 (python)

Fixed submission:
x = int(input())
y = input()

if x >= 3200 :
     print(y)

else:
     print('red')

Buggy submission (verdict: Runtime Error):
n = int(input())
guzai_valu = list(map(int, input().split()))
heikin=0
i=1
while i <= n-1:
   guzai_valu_sort = sorted(guzai_valu)
   #print(guzai_valu_sort)
   heikin=(guzai_valu_sort.pop(0)+guzai_valu_sort.pop(0))/2
   #自動で成分がずれるのでリストの成分の内最初のものを2回選ぶことが最小のもの
   #を2つ選ぶことと等価になるんや
   #print(heikin)
   guzai_valu_sort.append(heikin)
   guzai_valu = guzai_valu_sort
   i=i+1


print(heikin)

Buggy submission (verdict: Runtime Error):
x = int(input())
y = input()

if x >= 3200 :
     print(y)

else:
print('red')

Buggy submission (verdict: Runtime Error):
x = int(input())
y = input()

if x >= 3200 :
     print(y)

else:
print('red')
Problem p02693 (python)

Fixed submission:
import math
 
a=int(input())
li = list(map(int,input().split()))
#print(math.ceil(li[0]/a)*a)
if li[1]<math.ceil(li[0]/a)*a:
    print("NG")
else:
    print("OK")

Buggy submission (verdict: Runtime Error):
import math

a=int(input())
#li = list(map(int,input().split()))
print(math.ceil(li[0]/a)*a)
if li[1]<math.ceil(li[0]/a)*a:
    print("NG")
else:
    print("OK")
Problem p03127 (python)

Fixed submission:
import fractions

a=int(input())
li = list(map(int,input().split()))
cnt = li[0]
for i in li:
    cnt = fractions.gcd(cnt, i)
print(cnt)

Buggy submission (verdict: Runtime Error):
import math

a=int(input())
li = list(map(int,input().split()))
cnt = li[0]
for i in li:
    cnt = math.gcd(cnt, i)
print(cnt)

Buggy submission (verdict: Runtime Error):
import math

a=int(input())
li = list(map(int,input().split()))
cnt = li[0]
for i in li:
    cnt = math.gcd(cnt, i)
print(cnt)
Problem p02711 (python)

Fixed submission:
N = list(input())

if "7" in N:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
import itertools


N = int(input())
A = list(map(int, input().split(" ")))


p = itertools.combinations(list(range(N)), 2)

if N % 2 == 0:
    ans = 0
    for i in range(N):
        A_new = A[:i] + A[i+1:]
        if ans < sum(A_new[0::2]):
            ans = sum(A_new[0::2])
    print(ans)

else:
    ans = 0
    for v in p:
        a, b = min(v), max(v)
        A_new = A[:a] + A[a+1:b] + A[b+1:]
        if ans < sum(A_new[0::2]):
            ans = sum(A_new[0::2])
    print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = list(input())
ans = 0
 
for i in range(N):
    first_s = S[i]
    for j in range(i+1, N):
        if S[j] != first_s:
            second_s = S[j]
            for k in range(j+1, N):
                if k == 2*j-i:
                    if (S[k] != first_s) and (S[k] != second_s):
                        continue
                if (S[k] != first_s) and (S[k] != second_s):
                    ans += 1
print(ans)
Problem p02726 (python)

Fixed submission:
import numpy as np
N,X,Y=map(int, input().split())
ans = [0]*(N-1)
for i in range(1,N):
  for j in range(i+1,N+1):
    root1 = j-i
    root2 = abs(X-i) + 1 + abs(Y-j)
    min_k = min(root1, root2)
    ans[min_k-1] = ans[min_k-1] + 1

for a in ans:
  print(a)

Buggy submission (verdict: Runtime Error):
import numpy as np
N,X,Y=map(int, input().split())
ans = [0]*(N-1)
for i in range(1,N):
  for j in range(i+1,N+1):
    root1 = j-i
    root2 = abs(X-i) + 1 + abs(Y-j)
    min_k = min(root1, root2)
    ans[min_k-1] = ans[min_k-1] + 1

for a in ans:
  print(a)

Buggy submission (verdict: Runtime Error):
import numpy as np
N,X,Y=map(int, input().split())
ans = np.zeros(N-1)
for i in range(1,N):
  for j in range(i+1,N+1):
    root1 = j-i
    root2 = abs(X-i) + 1 + abs(Y-j)
    min_k = min(root1, root2)
    ans[min_k-1] = ans[min_k-1] + 1

for a in ans:
  print(int(a))
Problem p02785 (python)

Fixed submission:
N, K = map(int, input().split())
H = list(map(int, input().split()))

ans = 0
if K>=N:
  print(ans)
else:
  H.sort(reverse=True)
  for i in range(K, N):
    ans += H[i]
  print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
H = list(map(int, input().split()))

ans = 0
if K>=N:
  print(ans)
else:
  H = H.sort(reverse=True)
  for i in range(K, N):
    ans += H[i]
  print(ans)
Problem p03013 (python)

Fixed submission:
import sys

inp = input().split(" ")
n,m = int(inp[0]),int(inp[1])
brokens = []
for i in range (m):
    brokens.append(int(input()))

if n == 1:
    print(1)
    sys.exit()


dp = []
for i in range(n+1):
    dp.append(0)

for i in brokens:
    dp[i]= -1

if dp[1] == -1 and dp[2] == -1:
    dp[1] = 0
    dp[2] = 0
elif dp[1] == -1:
    dp[1] = 0
    dp[2] = 1
elif dp[2] == -1 :
    dp[1] = 1
    dp[2] = 0
else:
    dp[1] = 1
    dp[2] = 2


if n <= 2:
    print(dp[n])
    sys.exit(0)


for i in range(3,n+1):
    if dp[i] == -1:
        dp[i] = 0
    else:
        dp[i] = dp[i - 1] + dp[i - 2]

print(dp[n] % 1000000007)

Buggy submission (verdict: Runtime Error):
inp = input().split(" ")
n,m = int(inp[0]),int(inp[1])
brokens = []
for i in range (m):
    brokens.append(int(input()))

dp = []
for i in range(n+1):
    dp.append(0)

for i in brokens:
    dp[i]= -1

if dp[1] == -1 and dp[2] == -1:
    dp[1] = 0
    dp[2] = 0
elif dp[1] == -1:
    dp[1] = 0
    dp[2] = 1
elif dp[2] == -1 :
    dp[1] = 1
    dp[2] = 0
else:
    dp[1] = 1
    dp[2] = 2


for i in range(3,n+1):
    if dp[i] == -1:
        dp[i] = 0
    else:
        dp[i] = dp[i - 1] + dp[i - 2]

print(dp[n] % 1000000007)
Problem p02831 (python)

Fixed submission:
a,b= map(int,input().split())
#v =list(map(int,input().split()))
# [list(map(int,input().split())) for i in range(N)]
from fractions import gcd
def lcm(a,b): return a*b//gcd(a,b)

print(lcm(a,b))

Buggy submission (verdict: Runtime Error):
import math
#N = int(input())
a,b= map(int,input().split())
#v =list(map(int,input().split()))
# [list(map(int,input().split())) for i in range(N)]

print(a * b / math.gcd(a, b))
Problem p02847 (python)

Fixed submission:
S = input()
if S[0]=='M':
  print(6)
elif S[2]=='E':
  print(5)
elif S[0] == 'W':
  print(4)
elif S[1] == 'H':
  print(3)
elif S[0] == 'F':
  print(2)
elif S[1] == 'A':
  print(1)
else:
  print(7)

Buggy submission (verdict: Runtime Error):
S = input()
SUN,MON,TUE,WED,THU,FRI,SAT

if S[0]=='M':
  print(6)
elif S[2]=='E':
  print(5)
elif S[0] == 'W':
  print(4)
elif S[1] == 'H':
  print(3)
elif S[0] == 'F':
  print(2)
elif S[1] == 'A':
  print(1)
else:
  print(7)
Problem p02916 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

answer = sum(B)
for i in range(len(A)-1):
  if A[i+1] == A[i]+1:
    answer += C[A[i]-1]

print(answer)

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

answer = sum(B)
for i in range(len(B)):
  if B[i+1] = B[i]+1:
    answer += C[i]

print(answer)
Problem p02954 (python)

Fixed submission:
S = input()

output = [0] * len(S)
R_counter = 0
L_counter = 0
index_save = 0

for i, s in enumerate(S):
    if i != len(S)-1:
        if s == 'R':
            if S[i+1] == 'R':
                R_counter += 1
            else:
                R_counter += 1
                index_save = i
        if s == 'L':
            if S[i+1] == 'L':
                L_counter += 1
            else:
                L_counter += 1
                output[index_save] = ((R_counter+1)//2 + L_counter //2)
                output[index_save+1] = (R_counter//2 + (L_counter+1)//2)
                R_counter = 0
                L_counter = 0
    else:
        L_counter += 1
        output[index_save] = ((R_counter+1)//2 + L_counter //2)
        output[index_save+1] = (R_counter//2 + (L_counter+1)//2)
        
        
print(*output)

Buggy submission (verdict: Runtime Error):
for i, s in enumerate(S):
    if i != len(S)-1:
        if s == 'R':
            if S[i+1] == 'R':
                R_counter += 1
            else:
                R_counter += 1
                index_save = i
        if s == 'L':
            if S[i+1] == 'L':
                L_counter += 1
            else:
                L_counter += 1
                output[index_save] = ((R_counter+1)//2 + L_counter //2)
                output[index_save+1] = (R_counter//2 + (L_counter+1)//2)
                R_counter = 0
                L_counter = 0
    else:
        L_counter += 1
        output[index_save] = ((R_counter+1)//2 + L_counter //2)
        output[index_save+1] = (R_counter//2 + (L_counter+1)//2)
        
        
print(*output)
Problem p02987 (python)

Fixed submission:
S = list(input())
S.sort()
if S[0] == S[1] and S[1] != S[2] and S[2] == S[3]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
import math
all ,blue = map(int,input().split())
red = all - blue

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


for i in range(1,blue+1):
    if (red+1) < i:
        print('0')
    else:
        print((combinations_count(blue-1,i-1)*combinations_count(red+1,i))%(10**9+7))
Problem p02990 (python)

Fixed submission:
import math
all ,blue = map(int,input().split())
red = all - blue

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


for i in range(1,blue+1):
    if (red+1) < i:
        print('0')
    else:
        print((combinations_count(blue-1,i-1)*combinations_count(red+1,i))%(10**9+7))

Buggy submission (verdict: Runtime Error):
mport math
all ,blue = map(int,input().split())
red = all - blue

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


for i in range(1,blue+1):
    if (red+1) < i:
        print('0')
    else:
        print((combinations_count(blue-1,i-1)*combinations_count(red+1,i))%(10**9+7))

Buggy submission (verdict: Runtime Error):
import math
all ,blue = map(int,input().split())
red = all - blue

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


for i in range(1,blue+1):
    print((combinations_count(blue-1,i-1)*combinations_count(red+1,i))%(1000000007))
Problem p03723 (python)

Fixed submission:
A, B, C = map(int, input().split())

if A==B==C:
    if A%2==0:
        print(-1)
    else:
        print(0)

else:
    for i in range(1000000000):
        if A %2==0 and B%2==0 and C%2==0:
            a = A/2
            b = B/2
            c = C/2
            A = b+c
            B = a+c
            C = a+b
        else:
            print(i)
            exit()

Buggy submission (verdict: Runtime Error):
if A==B==C:
    print(-1)
else:
    for i in range(100000000):
        if A %2==0 and B%2==0 and C%2==0:
            a = A/2
            b = B/2
            c = C/2
            A = b+c
            B = a+c
            C = a+b
        else:
            print(i)
            exit()
Problem p02754 (python)

Fixed submission:
# -*- coding: utf-8 -*-
n, a,b=map(int, input().split()) 
X = n//(a+b)
Y = n%(a+b)
if Y > a:
    print(X*a + a)
else:
    print(X*a + Y)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import math
import sys
a,b=map(int, input().split())

x = math.floor(a/0.08)
#1の位が1-9
y = math.floor(b/0.1)
if (x + 1) * 0.08 == a:
    xx = x + 2
else:
    xx = x + 1

for i in range(y,y+10):
    for j in range(x, xx):
        if i == j:
            print(i)
            sys.exit(0)
print(-1)
Problem p03221 (python)

Fixed submission:
# -*- coding: utf-8 -*-
n,m = map(int, input().split())
i=0
lst = []
while i < m: 
    lst.append(list(map(int, input().split())) + [i])
    i+=1
lst = sorted(lst)
j=0
i=1
for k in lst:
    if i != k[0]:
        i=k[0]
        j=1
        k[1]=i*1000000+j
    else:
        j+=1
        k[1]=i*1000000+j

#ans
for ans in sorted(lst, key=lambda x:x[2]):
    print('{0:012d}'.format(ans[1]))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
n,m = map(int, input().split())
i=0
lst = []
while i < m: 
    lst.append(list(map(int, input().split())) + [i])
    i+=1
lst = sorted(lst)
j=1

i=1
for k in lst:
    if i != k[0]:
        i==k[0]
        j=1
        k[1]=i*1000000+j
    else:
        j+=1
        k[1]=i*1000000+j

#ans
for ans in sorted(ll, key=lambda x:x[2]):
    print('{0:012d}'.format(ans[1]))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
n,m = map(int, input().split())
i=0
lst = []
while i < m: 
    lst.append(list(map(int, input().split())) + [i])
    i+=1
lst.sort()
j=1

i=1
for k in lst:
    if i != k[0]:
        i==k[0]
        j=1
        k[1]=i*1000000+j
    else:
        j+=1
        k[1]=i*1000000+j


#ans
for ans in sorted(ll, key=lambda x:x[2]):
    print('{0:012d}'.format(ans[1]))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
#import numpy as np

def func1(lst, value):
    return [i for i, x in enumerate(lst) if x == value]

n,m = map(int, input().split())
i=0
lst = []
while i < m: 
    l = list(map(int, input().split()))
    l.append(i)
    lst.append(l)
    i+=1
i=1
res=[]
for i in range(1,n+1):
    j=1
    for k in lst.sort():
        if i == k[0]:
            res.append([k[2],str(k[0]).rjust(6,'0') + str(j).rjust(6,'0')])
            j+=1
#ans
for ans in res.sort():
    print(ans[1])

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
#import numpy as np

def func1(lst, value):
    return [i for i, x in enumerate(lst) if x == value]

n,m = map(int, input().split())
i=0
lst = []
while i < m: 
    l = list(map(int, input().split()))
    l.append(i)
    lst.append(l)
    i+=1
i=1
res=[]
for i in range(1,n+1):
    j=1
    for k in sort(lst):
        if i == k[0]:
            res.append([k[2],str(k[0]).rjust(6,'0') + str(j).rjust(6,'0')])
            j+=1
#ans
for ans in sort(res):
    print(ans[1])

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
#import numpy as np
n,m = map(int, input().split())
i=0
lst = []
while i < m: 
    l = map(int, input().split())
    lst.append(list(l))
    i+=1

sort_lst = sorted(lst)
i=1
res=[]
for i in range(1,n+1):
    j=1
    for k in sort_lst:
        if i == k[0]:
            res.append([str(k[0])+str(k[1]),str(res[0]).rjust(6,'0') + str(res[2]).rjust(6,'0')])
            j+=1

#ans
for ans in lst:
    for res in sort_lst:
        if str(ans[0])+str(ans[1]) == res[0]:
            print(res[1])
Problem p02659 (python)

Fixed submission:
a, b = input().split()
a = int(a)
b_i = int(b[:-3])
b_f = int(b[-2:])
if b_f == 0:
  print(a*b_i)
  exit()
b_m = a*b_f
if b_m < 100:
  print(a*b_i)
  exit()
print(a*b_i + int(str(b_m)[:-2]))

Buggy submission (verdict: Runtime Error):
a, b = input().split()
a = int(a)
b_i = int(b[:-3])
b_f = int(b[-2:])
if b_f == 0:
  print(a*b_i)
  exit()
b_m = a*b_f
print(a*b_i + int(str(b_m)[:-2]))

Buggy submission (verdict: Runtime Error):
a, b = input().split()
a = int(a)
b_i = int(b[:-3])
b_f = int(b[-2:])
b_m = a*b_f
print(a*b_i + int(str(b_m)[:-2]))
Problem p02682 (python)

Fixed submission:
a, b, c, k = map(int, input().split())
print(min(a, k, a*2+b-k))

Buggy submission (verdict: Runtime Error):
a, b, c, k = map(int, input().split())
print(min(a, k, a-(k-a-b))

Buggy submission (verdict: Runtime Error):
l = list(map(int, input().split()))
lists = [1]*l[0] + [0]*l[1] + [-1]*l[2]
sum = 0
for i in range(l[3]):
    sum += lists[i]
print(sum)

Buggy submission (verdict: Runtime Error):
l = map(int, input().split())
lists = [1]*l[0] + [0]*l[1] + [-1]*l[2]
sum = 0
for i in range(l[3]):
    sum += lists[i]
print(sum)
Problem p03775 (python)

Fixed submission:
n = int(input())
ans = float('inf')
temp = 0
for i in range(int(n**(1/2)), 0, -1):
    if n%i == 0:
        temp = max(i, n//i)
        ans = min(temp, ans)
print(len(str(ans)))

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = float('inf')
temp = 0
for i in range(1,n**(1/2)):
    if n%i == 0:
        temp = max(i, n//i)
        ans = min(temp, ans)
print(len(str(ans)))

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = float('inf')
temp = 0
for i in range(1,(n/2)+1):
    if n%i == 0:
        temp = max(len(str(i)), len(str(n//i)))
        ans = min(temp, ans)
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = float('inf')
temp = 0
for i in range(1,n/2+1):
    if n%i == 0:
        temp = max(len(str(i)), len(str(n//i)))
        ans = min(temp, ans)
print(ans)
Problem p03835 (python)

Fixed submission:
k, s = map(int,input().split())
count = 0
for i in range(k+1):
    for j in range(k+1):
            if 0<=(s-i-j)<=k:
                count += 1
print(count)

Buggy submission (verdict: Runtime Error):
k, s = list(map(int, input().split()))
count = 0
for i in range(k+1):
    for j in range(k+1):
        for n in range(k+1):
            if (i+j+n == k):
                count += 1
print(count)

Buggy submission (verdict: Runtime Error):
k, s = list(map(int, input().split()))
count = 0
for i in range(k+1):
    for j in range(k+1):
        if (s-i-j <= k) and (0 <= s-i-j):
            count += 1
print(count)

Buggy submission (verdict: Runtime Error):
k, s = list(map(int, input().split()))
count = 0
for i in range(2,k+1):
    for j in range(2,k+1):
        if (s-i-j <= k) and (0 <= s-i-j):
            count += 1
print(count)
Problem p03072 (python)

Fixed submission:
n = int(input())

arr = list(map(int, input().strip().split()))

ma = arr[0]
cnt = 1

for i in range(1,n):
	if arr[i] >= ma:
		cnt += 1

	ma = max(ma, arr[i])

print (cnt)

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

arr = list(map(int, input().strip().split()))

ma = arr[0]
cnt = 1

for i in range(1,n):
  	if arr[i] >= ma:
      	cnt += 1
	ma = max(ma, arr[i])
    
print (ans)
Problem p02693 (python)

Fixed submission:
k = int(input())
a,b = map(int,input().split())
if a//k != b//k:
    print("OK")
elif a%k == 0:
    print("OK")
else:
    print("NG")

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
if a//k != b//k:
    print("OK")
else:
    print("NG")
Problem p02987 (python)

Fixed submission:
s=input()
st=[]
d=[]
for i in s:
    if i in d:
        st[d.index(i)]+=1
    else:
        d.append(i)
        st.append(1)

if len(st)==2 & st[0]==2 & st[1]==2:
    print('Yes')
else:
    print('No')

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

def conbi(arg1, arg2):
    k=1
    l=1
    if arg2>arg1/2:
        arg2=arg1-arg2
    for i in range(arg2):
        k=k*(arg1-i)
        l=l*(i+1)
    if arg1==0:
        return 1
    else:
        return k/l
        
for o in range(1,m+1):
    print(int((conbi(n-m+1,o)%(1000000007))*(conbi(m-1,o-1)%(1000000007))))

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

def conbi(arg1, arg2):
    k=1
    l=1
    for i in range(arg2):
        k=k*(arg1-i)
        l=l*(i+1)
    if arg1==0:
        k=1
    return k/l
        
for i in range(1,m+1):
    print(int(conbi(n-m+1,i)*conbi(m-1,i-1))%(1000000007))
Problem p02948 (python)

Fixed submission:
import sys
from heapq import heappush,heappop

n, m = map(int, sys.stdin.readline().split())
d = [[] for _ in range(m+1)]
for i in range(n):
    a, b = map(int, sys.stdin.readline().split())
    if a <= m:
        d[a].append(b)

res = 0
resList = []
for i in range(1, m+1):
    if len(d[i]) > 0:
        for j in d[i]:
            heappush(resList, -j)
    if len(resList) > 0:
        res += (-1) * resList[0]
        heappop(resList)

print(res)

Buggy submission (verdict: Runtime Error):
import sys
from collections import defaultdict
from bisect import insort

n, m = map(int, input().split())
d = [[] for _ in range(m+1)]
for i in range(n):
    a, b = map(int, sys.stdin.readline().rstrip().split())
    d[a].append(b)

res = 0
resList = []
for i in range(1, m+1):
    sub = d[i]
    if len(sub) > 0:
        for j in range(len(sub)):
            insort(resList, sub[j])
    if len(resList) > 0:
        res += resList.pop()

print(res)
Problem p03252 (python)

Fixed submission:
str1 = input()
str2 = input()

dict1 = dict()
ans = "Yes"

for i in range(len(str1)):
    if(str1[i] in dict1.keys()):
        if(dict1[str1[i]] != str2[i]):
            ans = "No"
    else:
        if(str2[i] in dict1.values()):
            ans = "No"
        dict1[str1[i]] = str2[i]

print(ans)

Buggy submission (verdict: Runtime Error):
str1 = input()
str2 = input()

dict = dict()
ans = "Yes"

for i in range(len(str1)):
    if(str1[i] in dict):
        if(dict[str[i]] != str2[i]):
            ans = "No"
    else:
        dict[str1[i]] = str2[i]

print(ans)