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

Fixed submission:
S, T = input().split()
print(T + S)

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

while True:
    
    flag = 0
    
    for i in range(2, X+1): #2からXまでのループ
        if (X+1) % i == 0: #対象はX+1という数
            flag = 1
            break
    if flag == 1:
        X += 1
        continue
    break
    
print(X + 1)

Buggy submission (verdict: Runtime Error):
S, T = input()
print(T + S)
Problem p02996 (python)

Fixed submission:
from operator import itemgetter

N = int(input())
job = [list(map(int, input().split())) for i in range(N)]

job.sort(key = itemgetter(1))

time = 0
flag = 0
for i in range(N):
    time += job[i][0]
    if time > job[i][1]:
        flag = 1    
    
if flag == 0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
job = [list(map(int, input().split())) for i in range(N)]

job.sort(key = lambda x: x[1]

time = 0
flag = 0
for i in range(N):
    time += job[i][0]
    if time > job[i][1]:
        flag = 1 
    
if flag == 0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
from operatpr import itemgetter

N = int(input())
job = [list(map(int, input().split())) for i in range(N)]

job.sort(key = itemgetter(1))

time = 0
flag = 0
for i in range(N):
    time += job[i][0]
    if time > job[i][1]:
        flag = 1
    print(flag)    
    
if flag == 0:
    print('Yes')
else:
    print('No')
Problem p03001 (python)

Fixed submission:
X, H, x, y = map(int, input().split())
S = X * H
max_small = S / 2

print(max_small, end=' ')

if x == (X/2) and y == (H/2):
    print('1')
else:
    print('0')

Buggy submission (verdict: Runtime Error):
X, H, x, y = map(int, input().split())
S = X * H
max_small = S / 2

print(max_small, end=' ')
if x == w/2 and y == H/2:
    print('1')
else:
    print('0')
Problem p02747 (python)

Fixed submission:
S = str(input())
if "hi" == S:
  print("Yes")
elif "hihi" == S:
  print("Yes")
elif "hihihi" == S:
  print("Yes")
elif "hihihihi" == S:
  print("Yes")
elif "hihihihihi" == S:
  print("Yes") 
else:
  print("No")

Buggy submission (verdict: Runtime Error):
S = str(input())
if "hi" = S:
  print("Yes")
elif "hihi" = S:
  print("Yes")
elif "hihihi" = S:
  print("Yes")
elif "hihihihi" = S:
  print("Yes")
else:
  print("No")
Problem p02760 (python)

Fixed submission:
card=[list(map(int,input().split())) for i in range(3)]
N=int(input())
b=[int(input()) for i in range(N)]
for i in range(N):
    for j in range(3):
        for k in range(3):
            if card[j][k]==b[i]:
                card[j][k]=0
if (card[0][0]==card[0][1]==card[0][2]==0) or (card[1][0]==card[1][1]==card[1][2]==0) or (card[2][0]==card[2][1]==card[2][2]==0) or (card[0][0]==card[1][0]==card[2][0]==0) or (card[0][1]==card[1][1]==card[2][1]==0)  or (card[0][2]==card[1][2]==card[2][2]==0) or (card[0][0] == card[1][1] == card[2][2] == 0) or (card[2][0]==card[1][1]==card[0][2]==0):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
Card=[list(map(int,input().split())) for i in range(3)]
N=int(input())
b=[int(input()) for i in range(N)]
for i in range(N):
    for j in range(3):
        for k in range(3):
            if A[j][k]==b[i]:
                A[j][k]=0
if (A[0][0]==A[0][1]==A[0][2]==0) or (A[1][0]==A[1][1]==A[1][2]==0) or (A[2][0]==A[2][1]==A[2][2]==0) or (A[0][0]==A[1][0]==A[2][0]==0) or (A[0][1]==A[1][1]==A[2][1]==0)  or (A[0][2]==A[1][2]==A[2][2]==0) or (A[0][0] == A[1][1] == A[2][2] == 0) or (A[2][0]==A[1][1]==A[0][2]==0):
    print('Yes')
else:
    print('No')
Problem p02772 (python)

Fixed submission:
a = int(input())
array = list(map(int, input().split())) 
ans = "APPROVED"
nu = 0
for i in range (a):
  nu = array[i]
  if nu % 2 == 0:
    if nu % 3 == 0 or nu % 5 == 0:
      pass
    else:
      ans = "DENIED"
print(ans)

Buggy submission (verdict: Runtime Error):
a = int(input())
array = list(map(int, input().split())) 
ans = "APPROVED"
nu = 0
for i in range a:
  nu = array[i]
  if nu % 2 == 0:
    if nu % 3 == 0 or nu % 5 == 0:
      pass
    else:
      ans = "DENIED"
print(ans)
Problem p02812 (python)

Fixed submission:
N = int(input())
S = str(input())
cou = 0
for i in range(N-2):
  if S[i:i+3] == "ABC":
    cou += 1
print(cou)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = str(input())
cou = 0
for i in range(N):
  if i <= N-2:
    if S[i] == "A" and S[i+1] == "B" and S[i+2]== "C":
      cou += 1
print(cou)
Problem p02813 (python)

Fixed submission:
import itertools
N = int(input())
LN = []
for i in range(N):
  LN.append(i+1)
LLN=list(itertools.permutations(LN))
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
print(abs(LLN.index(tuple(P))-LLN.index(tuple(Q))))

Buggy submission (verdict: Runtime Error):
import itertools
N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
permutations = list(itertools.permutations(range(1, N+1)))
p = permutations.index(P)
q = permutations.index(Q)
print(p-q)

Buggy submission (verdict: Runtime Error):
permutations = list(itertools.permutations(range(1, N+1)))
p = permutations.index(P)
q = permutations.index(Q)
Problem p03160 (python)

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

Buggy submission (verdict: Runtime Error):
N = int(input())
h = list(map(int, input().split()))
DP = [10000]*7
DP[0] = 0
DP[1] = abs(h[1]-h[0])
for i in range(N-1):
  DP[i+1] = abs(h[i+1]-h[i])+DP[i]
  if i > 0:
    DP[i+1] = min(abs(h[i+1]-h[i])+DP[i], abs(h[i+1]-h[i-1])+DP[i-1])
print(DP[N-1])

Buggy submission (verdict: Runtime Error):
N = int(input())
h = list(map(int, input().split()))
DP = [10000]*7
DP[0] = 0
DP[1] = abs(h[1]-h[0])
for i in range(N-1):
  DP[i+1] = abs(h[i+1]-h[i])+DP[i]
  if i > 0:
    DP[i+1] = min(abs(h[i+1]-h[i])+DP[i], abs(h[i+1]-h[i-1])+DP[i-1])
print(DP)
Problem p03285 (python)

Fixed submission:
import math
n = int(input())
counter = False
#for n in range (0,100):
for i in range (math.ceil((n+1) / 4) ):
  for j in range (math.ceil((n+1) / 7) ):
    #print(n, i,j)
    if i*4 + j*7 == n:
      counter = True
if counter == True:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
def temp(H):
  ans = - H *0.006
  return ans
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
TE = list(map(temp,H))
TLA = list(map(lambda x: abs(T + x -A) , TE))
ans=TLA.index(min(TLA))
print(ans+1)
Problem p03325 (python)

Fixed submission:
def time2(n):
  ans = 0
  while n % 2 == 0:
    n /= 2
    ans += 1
  return ans
N = int(input())
LA = list(map(int, input().split()))
sum = sum(map(time2, LA))
print(sum)

Buggy submission (verdict: Runtime Error):
D, N = map(int,input().split())
if D == 2:
  if N < 100:
    print(N*10000)
  else:
    print(1010000)
elif D == 1:
  if N < 100:
    print(N*100)
  else:
    print(10100)
else:
  if N < 100:
    print(N)
  else:
    print(101)
Problem p03369 (python)

Fixed submission:
s = input()
count = 700
for i in range (len(s)):
  if s[i] == 'o':
    count += 100
  else:
    pass
print(count)

Buggy submission (verdict: Runtime Error):
import math
N, X = map(int, input().split())
s = 0
cake =[]
for i in range (N):
  s = int(input())
  cake.append(s)
ans = N + (X - sum(cake)) / min(cake)
print(math.floor(ans))
Problem p03407 (python)

Fixed submission:
A, B, C =map(int, input().split())
if A + B < C:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
A, B, C =map(int, input().split())
if A + B => C:
  print("Yes")
else:
  print("No")
Problem p03473 (python)

Fixed submission:
M = int(input())
print(48-M)

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  int a;
  cin >> a;
  cout << 48-a << endl;
}
Problem p03563 (python)

Fixed submission:
R = int(input())
G = int(input())
print(2*G-R)

Buggy submission (verdict: Runtime Error):
R, G = map(int, input().split())
print(2*G-R)
Problem p03597 (python)

Fixed submission:
N = int(input())
A = int(input())
print(N**2-A)

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N, A;
  cin >> N >> A;
  cout << N*N-A << endl;
}

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N, A;
  cin >> N >> A;
  cout << N*N-A << endl;
}
Problem p03624 (python)

Fixed submission:
N = str(input())
ans = None
for l in "abcdefghijklmnopqrstuvwxyz":
    if l not in N:
        ans = l
        break
print(ans)

Buggy submission (verdict: Runtime Error):
N = str(input())
ans = "None"
for l in "abcdefghijklmnopqrstuvwxyz":
    if l not in N:
        ans = letter
        break
print(ans)

Buggy submission (verdict: Runtime Error):
N = input()
ans = None
for l in "abcdefghijklmnopqrstuvwxyz":
    if l not in N:
        ans = letter
        break
print(ans)
Problem p03720 (python)

Fixed submission:
N, M = map(int,input().split())
a = []
for i in range(M):
  K,S = map(int, input().split())
  a.append(K)
  a.append(S)
for i in range(N):
  print(a.count(i+1))

Buggy submission (verdict: Runtime Error):
8 8
1 2
3 4
1 5
2 8
3 7
5 2
4 1
6 8
Problem p02743 (python)

Fixed submission:
a, b, c = map(int, input().split())
 
if 4*a*b < (c-a-b)**2 and c > a+b:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
 
if 4*a*b < (c-a-b)**2 ans c > a+b:
    print("Yes")
else:
    print("No")

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

if 4*a*b < (c-a-b)**2 ans c > a+b:
  print("Yes")
else:
  print("No")
Problem p02802 (python)

Fixed submission:
N, M = map(int, input().split())

p = [0] * M
k = [""] * M

for i in range(M):
    p[i], k[i] = input().split()
    p[i] = int(p[i])-1
    

ans = [0]*N
pen = [0]*N
accept = 0
pena = 0
for i in range(M):
    if k[i] == "WA" and ans[p[i]] == 0:
        pen[p[i]] += 1
    elif k[i] == "AC" and ans[p[i]] == 0:
        pena += pen[p[i]]
        ans[p[i]] = 1
        accept += 1
        
print(str(accept) + " " + str(pena))

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

p = [0]*M
k = [""] * M

for i in range(M):
    p[i], k[i] = input().split()
    p[i] = int(p[i])
    

ans = [0]*N
pen = [0]*N
accept = 0
pena = 0
for i in range(M):
    if k[i] == "WA" and ans[p[i]] == 0:
        pen[p[i]] += 1
    elif k[i] == "AC" and ans[p[i]] == 0:
        pena += pen[p[i]]
        ans[p[i]] = 1
        accept += 1
        
print(str(accept) + " " + str(pena))
Problem p02921 (python)

Fixed submission:
s = input()
t = input()
ans = 0
for i in range(len(s)):
    if s[i] == t[i]:
        ans+=1
        
print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
 
print(int(N*(N-1)//2))
Problem p02924 (python)

Fixed submission:
N=int(input())
 
print(int(N*(N-1)//2))

Buggy submission (verdict: Runtime Error):
N=int(input())
if N%2 == 0:
    print(round(N/2*(N-1)))
else:
    print(round((N-1)/2*N)))
Problem p02952 (python)

Fixed submission:
n = int(input())

if n < 10:
    print(n)
elif n < 100:
    print("9")
elif n < 1000:
    print(n-90)
elif n < 10000:
    print("909")
elif n < 100000:
    print(n-9090)
else:
    print("90909")

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

if n < 10:
    print(n)
elif n < 100:
    print("9")
elif n < 1000:
    print(n-90)
elif n < 10000:
    print("909")
elif n < 100000
    print(n-9090)
else:
    print("90909")
Problem p02747 (python)

Fixed submission:
s=input()
i=0;
found=False;
h=0;
k=0;
if(len(s)%2!=0):
	found=False
else:
	while(i<len(s)):
		if(s[i]=='h' or s[i]=='i'):
			if(i%2==0 and s[i]=='h'):
				found=True
			if(i%2!=0 and s[i]=='i'):
				found=True
			if(i%2!=0 and s[i]=='h'):
				found=False
			if(i%2==0 and s[i]=='i'):
				found=False
			
		else:
			found=False
			break;		
		i=i+1
if(len(s)>1):
	if(s[0]=='i'):
		found=False
	if(s[1]=='h'):
		found=False

if(found==False):
	print("No")
else:
	print("Yes")

Buggy submission (verdict: Runtime Error):
s=input()
i=0;
found=False;
h=0;
k=0;
if(len(s)%2!=0):
	found=False
else:
	while(i<len(s)):
		if(s[i]=='h' or s[i]=='i'):
			if(i%2==0 and s[i]=='h'):
				found=True
			if(i%2!=0 and s[i]=='i'):
				found=True
			if(i%2!=0 and s[i]=='h'):
				found=False
			if(i%2==0 and s[i]=='i'):
				found=False
			
		else:
			found=False
			break;		
		i=i+1
if(s[0]=='i'):
	found=False
if(s[1]=='h'):
	found=False

if(found==False):
	print("No")
else:
	print("Yes")
Problem p02787 (python)

Fixed submission:
H, N = (int(i) for i in input().split())
A = [0]*N
B = [0]*N
for i in range(N):
    A[i], B[i] = (int(j) for j in input().split())
A_max = max(A)

DP = [0]*(H+A_max)
for i in range(1, H+A_max):
    dp = float('inf')
    for a, b in zip(A,B):
        if i-a>=0:
            dp = min(dp, DP[i-a] + b)
    DP[i] = dp
print(min(DP[H:]))

Buggy submission (verdict: Runtime Error):
A = []
B = []
for i in range(N):
    a, b = (int(j) for j in input().split())
    A.append(a)
    B.append(b)
A_max = max(A)

DP = [0]
for i in range(1, H+A_max):
    dp = float('inf')
    for a, b in zip(A,B):
        if i-a>=0:
            dp = min(dp, DP[i-a] + b)
    DP.append(dp)
print(min(DP[H:]))

Buggy submission (verdict: Runtime Error):
import math

input_func = input
H, N = (int(i) for i in input_func().split())
A = []
B = []
for i in range(N):
    a, b = (int(j) for j in input_func().split())
    A.append(a)
    B.append(b)
A_max = max(A)
    
DP = [0]
for i in range(1, H+A_max):
    dp = math.inf
    for a, b in zip(A,B):
        if i-a>=0:
            dp = min(dp, DP[i-a] + b)
    DP.append(dp)
    #print(DP[i])
print(min(DP[H:H+A_max]))
Problem p02921 (python)

Fixed submission:
S=input()
T=input()
ans=0
for s,t in zip(S,T):
  if s==t:
    ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import deque
def main():
    N=int(input())
    A = [deque(map(int, input().split())) for _ in range(N)]

    days = 0
    changed = True
    played = set()
    while changed:
        played.clear()
        changed = False
        for i in range(N-1):
            if len(A[i]) == 0:
                continue
            a1 = A[i][0]
            if len(A[a1-1]) == 0:
                continue
            a2 = A[a1-1][0]
            if a1 in played or a2 in played:
                continue
            if a2-1 == i:
                A[a2-1].popleft()
                A[a1-1].popleft()
                played.add(a2)
                played.add(a1)
                changed = True
        if changed:
            days+=1

    for a in A:
        if len(a) > 0:
            print(-1)
            break
    else:
        print(days)

if __name__ == '__main__':
    main()
Problem p02941 (python)

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

    count = 0
    prev_count = -1
    while count!=prev_count:
        prev_count = count
        for i in range(N):
            d = B[i-1 if i>=1 else N-1] + B[i+1 if i<N-1 else 0]
            c = (B[i]-A[i]) // d
            B[i] -= d * c
            count += c

    if A == B:
        print(count)
    else:
        print(-1)

if __name__ == '__main__':
    main()

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

    count = 0
    while A!=B:
        b = True
        for i in range(N):
            d = B[i-1 if i>=1 else N-1] + B[i+1 if i<N-1 else 0]
            if B[i] > d:
                b = False
                c = B[i] // d
                B[i] -= d * c
                count += c
        if b:
            print(-1)
            break
    else:
        print(count)

if __name__ == '__main__':
    main()

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

    count = 0
    while A!=B:
        b = True
        for i in range(N):
            d = B[i-1 if i>=1 else N-1] + B[i+1 if i<N-1 else 0]
            if B[i] > d:
                b = False
                c = B[i] // d
                B[i] -= d * c
                count += c
        if b:
            print(-1)
            break
    else:
        print(count)

if __name__ == '__main__':
    main()
Problem p03163 (python)

Fixed submission:
import sys
sys.setrecursionlimit(200000)

n,w = (int(x) for x in input().split())
a = [tuple(map(int, input().split())) for _ in range(n)]
dp = [[0] * (w+1) for _ in range(n+1)]

def rec(i, j):
  if dp[i][j] != 0:
    return dp[i][j]
  if i == n:
    res = 0
  elif j < a[i][0]:
    res = rec(i+1, j)
  else:
    res = max(rec(i+1, j), rec(i+1, j - a[i][0]) + a[i][1])
  dp[i][j] = res
  return dp[i][j]

print(int(rec(0, w)))

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np

n,w = (int(x) for x in input().split())
a = [tuple(map(int, input().split())) for _ in range(n)]
dp = np.full((n+1, w+1), -1)

def rec(i, j):
  if dp[i][j] != -1:
    return dp[i][j]
  if i == n:
    res = 0
  elif j == 0:
    res = 0
  elif j < a[i][0]:
    res = rec(i+1, j)
  else:
    res = max(rec(i+1, j), rec(i+1, j - a[i][0]) + a[i][1])
  dp[i][j] = res
  return dp[i][j]

print(int(rec(0, w)))

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np
sys.setrecursionlimit(200000)

n,w = (int(x) for x in input().split())
a = [tuple(map(int, input().split())) for _ in range(n)]
dp = np.full((n+1, w+1), -1)

def rec(i, j):
  if dp[i][j] != -1:
    return dp[i][j]
  if i == n:
    res = 0
  elif j == 0:
    res = 0
  elif j < a[i][0]:
    res = rec(i+1, j)
  else:
    res = max(rec(i+1, j), rec(i+1, j - a[i][0]) + a[i][1])
  dp[i][j] = res
  return dp[i][j]

print(int(rec(0, w)))
Problem p03030 (python)

Fixed submission:
N = int(input())
a = []
for x in range(N):
	i = x + 1
	S_i, P_i = input().split()
	a.append([S_i, int(P_i), i])
# print(a)
a = sorted(a, key=lambda x:(x[0],-x[1]))
for review in a:
	print(review[2])

Buggy submission (verdict: Runtime Error):
N = int(input())
a = []
for x in range(N):
	i = x + 1
	a.append(list(input().split()).extend([i]))
print(a)
sorted(a, key=lambda x:(x[0],x[1]), reverse=True)
for review in a:
	print(review[2])
Problem p02761 (python)

Fixed submission:
N,M = map(int, input().split())

appear_list = [[]for i in range(N)]
flag = 0
ans = ""
for i in range(M):
  s,c = map(int, input().split())
  if len(appear_list[s-1]) == 0:
    appear_list[s-1].append(str(c))
  if len(appear_list[s-1]) ==1 and appear_list[s-1][0] != str(c):
    flag = 1
    break

for i in range(len(appear_list)):
  if i == 0:
    if len(appear_list[i]) == 0 and i != N-1:
      ans += "1"
    elif len(appear_list[i]) == 0 and i == N-1:
      ans += "0"
    elif appear_list[i][0] == "0" and i != N-1:
      flag = 1
      break
    else:
      ans += appear_list[i][0]
  else:
    if len(appear_list[i]) == 0:
      ans += "0"
    else:
      ans += appear_list[i][0]
if flag == 0:
  print(int(ans))
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
N,M = map(int, input().split())
appear_list = [[]for i in range(N)]
flag = 0
for i in range(M):
  s,c = map(int, input().split())
  appear_list[s-1].append(str(c))
ans = ""

for i in range(len(appear_list)):
  if len(set(appear_list[i])) > 1:
    flag = 1
    break
  elif len(set(appear_list[i])) == 1: 
    if appear_list[i][0] == "0" and len(ans) == 0 and i < (N-1):
      flag = 1
      break
    ans += appear_list[i][0]
  else:
    if len(ans) > 0:
	    ans += "0"
if flag == 0:
  print(int(ans))
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
N,M = map(int, input().split())
appear_list = [[]for i in range(N)]
flag = 0
for i in range(M):
  s,c = map(int, input().split())
  appear_list[s-1].append(str(c))
ans = ""

for i in range(len(appear_list)):
  if len(set(appear_list[i])) > 1:
    flag = 1
    break
  elif len(set(appear_list[i])) == 1: 
    if appear_list[i][0] == "0" and len(ans) == 0:
      flag = 1
      break
    ans += appear_list[i][0]
  else:
    if len(ans) > 0:
	    ans += "0"
if flag == 0:
  print(int(ans))
else:
  print(-1)
Problem p02913 (python)

Fixed submission:
N = int(input())
S = input()
sride = 1
count = 0
max_num = 0
for i in range(N-1):
  for j in range(N-sride):
    if S[j] == S[j+sride]:
      count += 1
      max_num = max(max_num, count)
    else:
      count = 0
    if count == sride:
      max_num = max(max_num, count)
      break
  sride += 1
  count = 0
print(max_num)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
sride = 1
count = 0
max_num = 0
for i in range(N-1):
  for j in range(N-sride):
    if S[j] == S[j+sride]:
      count += 1
      max_num = max(max_num, count)
    else:
      count = 0
    if count == sride:
      max_num = max(max_nuzm, count)
      break
  sride += 1
  count = 0
print(max_num)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
max_range = N//2
count_list = [[0 for j in range 50005] for i in range 5005]
print(count_list.shape)
print(count_list)
Problem p02917 (python)

Fixed submission:
N = int(input())
B = list(map(int,input().split()))
ins = 0
count = 0
for i in range(N-1):
  if i == 0:
    count += B[i]
  if i > 0 and B[i-1] > B[i]:
    count += B[i]
  elif i > 0 and B[i-1] <= B[i]:
    count += B[i-1]
count += B[i]
print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
B = list(map(int,input().split()))
ins = 0
count = 0
for i in range(N):
  if i == 0:
    count += B[i]
  if i > 0 and B[i-1] > B[i]:
    count += B[i]
  elif i > 0 and B[i-1] <= B[i]:
    count += B[i-1]
print(count)
Problem p02947 (python)

Fixed submission:
from collections import Counter
import sys

input = sys.stdin.readline
n = int(input())
str_list = [''.join(sorted(input().rstrip())) for i in range(n)]
ans = 0
count_list = list(Counter(str_list).values())
for i in count_list:
  sum = 0
  for j in range(int(i)):
    sum += j
  ans +=sum
print(ans)

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
s = [''.join(sorted(input())) for i in range(N)]
def count_s(s):
  count = []
  while s != []:
    moji = s.pop(0)
    num = s.count(moji)
    if num > 0:
      for i in range(num):
        s.pop(s.index(moji))
      count.append(num+1)
  return count
count = count_s(s)
ans = 0
if len(count) == 0:
  print(ans)
else:
  for i in count:
    ans += math.factorial(i)/2
  print(int(ans))

Buggy submission (verdict: Runtime Error):
from collections import Counter
import sys
input = sys.stdin.readline
n = int(input())
str_list = [input() for i in range(n)]
counter_list = [Counter[i] for i in str_list]
ans = 0
for i in range(n):
  first = Counter(str_list[i])
  for j in range(n-i-1):
    second = Counter(str_list[j+i+1])
    if first == second:
      ans +=1
print(ans)