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

Fixed submission:
import sys
sys.setrecursionlimit(410000)

h,w = map(int,input().split())
F = []
for i in range(h):
  F.append(list(input()))
  
V = [[False]*w for _ in range(h)]

def dfs(y,x,c):      
  V[y][x] = True
  black = 0
  white = 0
  if c =='#':
    black+=1
  else:
    white+=1
  for dy,dx in [(-1,0),(0,1),(1,0),(0,-1)]:
    ny = y + dy
    nx = x + dx
    if 0<=ny<h and 0<=nx<w:      
      if F[ny][nx]!=c and V[ny][nx] == False:
        nc = '#'
        if c =='#':
          nc = '.'
        bn,wn = dfs(ny,nx,nc)
        black += bn
        white += wn  
  return black,white
        
ans = 0
for i in range(h):
  for j in range(w):
    if F[i][j] == '#':      
      black,white = dfs(i,j,'#')
      ans += black*white
      
print(ans)

Buggy submission (verdict: Runtime Error):
h,w = map(int,input().split())
F = []
for i in range(h):
  F.append(list(input()))
  
V = [[False]*w for _ in range(h)]

def dfs(y,x,c):      
  V[y][x] = True
  black = 0
  white = 0
  if c =='#':
    black+=1
  else:
    white+=1
  for dy,dx in [(-1,0),(0,1),(1,0),(0,-1)]:
    ny = y + dy
    nx = x + dx
    if 0<=ny<h and 0<=nx<w:      
      if F[ny][nx]!=c and V[ny][nx] == False:
        nc = '#'
        if c =='#':
          nc = '.'
        bn,wn = dfs(ny,nx,nc)
        black += bn
        white += wn  
  return black,white
        
ans = 0
for i in range(h):
  for j in range(w):
    if F[i][j] == '#':      
      black,white = dfs(i,j,'#')
      ans += black*white
      
print(ans)
Problem p03170 (python)

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

dp = [-1]*(k+1)

for i in range(1,k+1):
  for j in range(n):
    if i >= aa[j]:
      dp[i] = max(dp[i],-dp[i-aa[j]])

if dp[k]>0:
  print('First')  
else:
  print('Second')

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

dp = [-1]*(k+1)

for i in range(1,k+1):
  for j in range(n):
    if i >= aa[j]:
      dp[i] = max(dp[i],-dp[i-aa[j]])

if win[k]>0:
  print('first')  
else:
  print('second')
Problem p03200 (python)

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

Buggy submission (verdict: Runtime Error):
s = input()

cw = 0
ans = 0
for i in range(n):
  if s[i] == 'W':
    ans += i-cw
    cw += 1
    
print(ans)
Problem p03229 (python)

Fixed submission:
n = int(input())
A = [int(input()) for _ in range(n)]
A = sorted(A,reverse=True)

ans = 0
if n%2 == 1:
  i = -1
  for i in range((n-2)//2):
    ans += A[i]*2
    ans -= A[-i-1]*2    
  ans += A[i+1]
  ans += A[i+2]
  ans -= A[i+3] *2
  
  tmp = 0
  for i in range((n-2)//2):
    tmp += A[i]*2
    tmp -= A[-i-1]*2    
  tmp += A[i+1] *2
  tmp -= A[i+2]
  tmp -= A[i+3]
  ans = max(ans,tmp)
  
else:
  i = -1
  for i in range((n-2)//2):
    ans += 2*A[i]
    ans -= 2*A[-i-1]      
  ans += A[i+1]
  ans -= A[i+2]
  
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
A = [int(input()) for _ in range(n)]
A = sorted(A,reverse=True)

ans = 0
if n%2 == 1:
  i = -1
  for i in range((n-2)//2):
    ans += A[i]*2
    ans -= A[-i-1]*2    
  ans += A[i+1]
  ans += A[i+2]
  ans -= A[i+3] *2
  
  tmp = 0
  for i in range((n-2)//2):
    tmp += A[i]*2
    tmp -= A[-i-1]*2    
  tmp += A[i+1] *2
  tmp -= A[i+2]
  tmp -= A[i+3]
  ans = max(ans,tmp)
  
else:
  for i in range((n-2)//2):
    ans += 2*A[i]
    ans -= 2*A[-i-1]      
  ans += A[i+1]
  ans -= A[i+2]
  
print(ans)

Buggy submission (verdict: Runtime Error):

n = int(input())
A = [int(input()) for _ in range(n)]
A = sorted(A)

l = 1
r = n-1

que = deque()
que.append(A[0])
c = 0

while l <= r:
  if r-l==0:
    if abs(que[0]-A[r]) >= abs(que[-1]-A[r]):
      que.appendleft(A[r])
    else:
      que.append(A[r])
    r-=1
  else:    
    if c%2 == 0:    
      if abs(que[0]-A[r]) >= abs(que[-1]-A[r]):
        que.appendleft(A[r])
        que.append(A[r-1])
      else:
        que.append(A[r])
        que.appendleft(A[r-1])
      r -= 2
    else:
      if abs(que[0]-A[l]) >= abs(que[-1]-A[l]):
        que.appendleft(A[l])
        que.append(A[l+1])
      else:
        que.append(A[l])
        que.appendleft(A[l+1])
      l += 2
  c += 1  

ans = 0  
for i in range(n-1):
  ans += abs(que[i]-que[i+1])
  
print(ans)
Problem p03263 (python)

Fixed submission:
h,w = map(int,input().split())
aa = [list(map(int,input().split())) for _ in range(h)]
ans=[]

for hi in range(h):
  for wi in range(w-1):
    if aa[hi][wi] % 2 == 1:      
      aa[hi][wi] -= 1
      aa[hi][wi+1] += 1
      ans.append([hi+1,wi+1,hi+1,wi+2])
      
  if hi < h-1:
    if aa[hi][-1] % 2 ==1:      
      aa[hi][-1] -= 1
      aa[hi+1][-1] += 1
      ans.append([hi+1,w, hi+2, w])

print(len(ans))
for yp,xp,yn,xn in ans:
  print('{} {} {} {}'.format(yp,xp,yn,xn))

Buggy submission (verdict: Runtime Error):
h,w = map(int,input().split())
aa = [list(map(int,input().split())) for _ in range(h)]
ans=[]

for hi in range(h):
  for wi in range(w-1):
    if aa[hi][wi] % 2 == 1:      
      aa[hi][wi] -= 1
      aa[hi][wi+1] += 1
      ans.append([hi+1,wi+1,hi+1,wi+2])
      
  if hi < h-1:
    if aa[hi][-1] % 2 ==1:      
      aa[hi][-1] -=1
      aa[hi+1][-1] +=1
      ans.append([hi+1,wi+2,hi+2,wi+2])

print(len(ans))
for yp,xp,yn,xn in ans:
  print('{} {} {} {}'.format(yp,xp,yn,xn))

Buggy submission (verdict: Runtime Error):
h,w = map(int,input().split())
aa = [list(map(int,input().split())) for _ in range(h)]
ans=[]

for hi in range(h):
  for wi in range(w-1):
    if aa[hi][wi] % 2 == 1:      
      aa[hi][wi] -= 1
      aa[hi][wi+1] += 1
      ans.append([hi+1,wi+1,hi+1,wi+2])
      
  if hi < h-1:
    if aa[hi][wi+1] % 2 ==1:      
      aa[hi][wi+1] -=1
      aa[hi+1][wi+1] +=1
      ans.append([hi+1,wi+2,hi+2,wi+2])

print(len(ans))
for yp,xp,yn,xn in ans:
  print('{} {} {} {}'.format(yp,xp,yn,xn))

Buggy submission (verdict: Runtime Error):
h,w = map(int,input().split())
aa = [list(map(int,input().split())) for _ in range(h)]
ans=[]

for hi in range(h):
  for wi in range(w-1):
    if aa[hi][wi] % 2 == 1:      
      aa[hi][wi+1] += 1
      ans.append([hi+1,wi+1,hi+1,wi+2])
      
  if hi < h-1:
    if aa[hi][wi+1] % 2 ==1:      
      aa[hi+1][wi+1] +=1
      ans.append([hi+1,wi+1,hi+2,wi+1])

print(len(ans))
for yp,xp,yn,xn in ans:
  print('{} {} {} {}'.format(yp,xp,yn,xn))

Buggy submission (verdict: Runtime Error):
h,w = map(int,input().split())
aa = [list(map(int,input().split())) for _ in range(h)]

for hi in range(h):
  for wi in range(w-1):
    if aa[hi][wi] % 2 == 1:
      aa[hi][wi] -= 1
      aa[hi][wi+1] += 1
      print('{} {} {} {}'.format(hi+1,wi+1,hi+1,wi+2))
  if hi < h-1:
    if aa[hi][wi+1] % 2 ==1:
      aa[hi][wi+1] -=1
      aa[hi+1][wi+1] +=1
      print('{} {} {} {}'.format(hi+1,wi+1,hi+2,wi+1))
Problem p03288 (python)

Fixed submission:
r = int(input())
if r >= 2800 :
  print('AGC')
elif r >= 1200:
  print('ARC')
else:
  print('ABC')

Buggy submission (verdict: Runtime Error):
r = int(input())
if r >= 2800 :
  print('AGC')
elif r >= 1200 :
  print('ARC'):
else:
  print('ABC')
Problem p03292 (python)

Fixed submission:
aa = list(map(int,input().split()))
print(max(aa)-min(aa))

Buggy submission (verdict: Runtime Error):
aa = map(int,input().split())
print(max(aa)-min(aa))
Problem p03309 (python)

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

b = [0]*n
for i in range(n):
  b[i] = a[i] - (i+1)  

bs = sorted(b)  
if n%2 ==1:
  median = bs[n//2] 
else:
  median = (bs[n//2 -1]+bs[(n//2)])//2
  
ans = 0
for i in range(n):
  ans+= abs(a[i] -(median + i+1))
  
print(ans)

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

b = [0]*n
for i in range(n):
  b[i] = a[i] - (i+1)  
  
if n%2 ==0:
  median = b[n//2] 
else:
  median = (b[n//2]+b[(n//2)+1])//2
  
ans = 0
for i in range(n):
  ans+= abs(a[i] -(median + i+1))
  
print(ans)
Problem p03324 (python)

Fixed submission:
d,n = map(int,input().split())
if d == 0:
  if n!= 100:
    print(n)
  else:
    print(101)
  
elif d == 1:
  if n != 100:
    print(100*n)
  else:
    print(101*100)
else:
  if n != 100:
    print(10000*n)
  else:
    print(101*10000)

Buggy submission (verdict: Runtime Error):
d,n = map(int,input().split())
if d == 0:
  if n!=100:
    print(n)
  else:
    print(101)
  
elif d == 1:
  if n=!100:
    print(100*n)
  else:
    print(101*100)
else:
  if n=!100:
    print(10000*n)
  else:
    print(101*10000)
Problem p03351 (python)

Fixed submission:
a,b,c,d=map(int,input().split())
if (abs(a-b)<=d and abs(b-c)<=d) or (abs(a-c) <= d):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
a,b,c,d==map(int,input().split())
if abs(a-b)>=d and abs(b-c)>=d :
  print('Yes')
else:
  print('No')
Problem p03380 (python)

Fixed submission:
from bisect import bisect_left

n = int(input())
aa = sorted(list(map(int,input().split())))
a_max = max(aa)

half = a_max/2
p = bisect_left(aa, half)
if abs(half - aa[p]) >= abs(half - aa[p-1]):
  print(a_max,aa[p-1])  
else:
  print(a_max,aa[p])

Buggy submission (verdict: Runtime Error):
n = int(input())
aa = sorted(list(map(int,input().split())))
a_max = max(aa)

half = a_max/2
p = bisect_left(aa, half)
if abs(half - aa[p]) >= abs(half - aa[p-1]):
  print(a_max,aa[p-1])  
else:
  print(a_max,aa[p])
Problem p03386 (python)

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


ans = []
for ai in range(a,a+k):
  if ai <= b:
    ans.append(ai)
for bi in range(b,b-k,-1):
  if bi >=a:
    ans.append(bi)
    
for i in sorted(list(set(ans))):
  print(i)

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

ab = list(range(a,b+1))
nums = set(ab[:k]+ab[-k:])

for i in sorted(list(nums)):
  print(i)
Problem p03407 (python)

Fixed submission:
a,b,c = map(int,input().split())
if a+b>=c:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input())
if a+b>=c:
  print('Yes')
else:
  print('No')
Problem p03435 (python)

Fixed submission:
c = [list(map(int,input().split())) for _ in range(3)]

def check(c):
  for a1 in range(c[0][0]):
    b = [c[0][i] - a1 for i in range(3)]
    a = [a1] + [c[i][0] - b[0] for i in range(1,3)]

    for ai in range(len(a)):
      for bi in range(len(b)):  
        if c[ai][bi] != a[ai]+b[bi]:
          print('No')
          return
  print('Yes')

check(c)

Buggy submission (verdict: Runtime Error):
c = [list(map(int,input().split())) for _ in range(3)]

def check(c):
  for a1 in range(c[0][0]):
    b = [c[0][i] - a1 for i in range(3)]
    a = [a1] + [c[i][0] - b[0] for i in range(1,3)]

    for ai in a:
      for bi in b:
        if c[ai][bi] != a[ai]+b[bi]:
          print('No')
          return
  print('Yes')

check(c)
Problem p03436 (python)

Fixed submission:
from collections import deque

h,w = map(int,input().split())
maze = [input() for _ in range(h)]

gx, gy = w-1, h-1

q = deque()
q.appendleft([0,0])
INF = 10**5

dist = [[INF]*w for _ in range(h)]
dist[0][0] = 0

while q:
  x,y = q.pop()
  
  for dx,dy in [[1,0],[0,1],[-1,0],[0,-1]]:
    nx = x+dx
    ny = y+dy
    
    if 0<=nx<w and 0<=ny<h:
      if dist[ny][nx]==INF and maze[ny][nx] != '#':
        dist[ny][nx] = dist[y][x]+1
        q.appendleft([nx,ny])      

black_num = sum([maze[i].count('#') for i in range(h)])

if dist[gy][gx] == INF:
  print(-1)
else:  
  print( h*w - dist[gy][gx] - black_num -1 )

Buggy submission (verdict: Runtime Error):
from collections import deque

gx, gy = w-1, h-1

q = deque()
q.appendleft([0,0])
INF = 10**5

dist = [[INF]*w for _ in range(h)]
dist[0][0] = 0

while q:
  x,y = q.pop()
  
  for dx,dy in [[1,0],[0,1],[-1,0],[0,-1]]:
    nx = x+dx
    ny = y+dy
    
    if 0<=nx<w and 0<=ny<h:
      if dist[ny][nx]==INF and maze[ny][nx] != '#':
        dist[ny][nx] = dist[y][x]+1
        q.appendleft([nx,ny])      

black_num = sum([maze[i].count('#') for i in range(h)])
print( h*w - dist[gy][gx] - black_num -1 )
Problem p03447 (python)

Fixed submission:
x = int(input())
a = int(input())
b = int(input())
print((x-a)%b)

Buggy submission (verdict: Runtime Error):
x,a,b = map(int,input().split())
print((x-a)%b)
Problem p03455 (python)

Fixed submission:
a,b = map(int,input().split())
if (a*b)%2==0:
  print('Even')
else:
  print('Odd')

Buggy submission (verdict: Runtime Error):
a,b = map(int,input())
if (a*b)%2==0:
  print('Even')
else:
  print('Odd')
Problem p03463 (python)

Fixed submission:
n,a,b = map(int,input().split())
if abs(b-a) % 2 == 0:
  print('Alice')
else:
  print('Borys')

Buggy submission (verdict: Runtime Error):
n,a,b = map(int,input().split())
if (b-a)%2 == 0:
  print('Borys')
else:
  pritn('Alice')
Problem p03574 (python)

Fixed submission:
h,w = map(int,input().split())
ff = [list(input()) for _ in range(h)]

d = [[-1,-1],[0,-1],[1,-1],
     [-1, 0],       [1, 0],
     [-1, 1],[0, 1],[1, 1]]

for hi in range(h):
  for wi in range(w):
    if ff[hi][wi]=='#':
      pass
    else:
      count = 0
      for dx,dy in d:
        x = dx+wi
        y = dy+hi        
        if (0<= x < w) and (0<= y <h) :
          if ff[y][x] == '#':
            count += 1
      ff[hi][wi] = str(count)
      
for fi in ff:
  print(''.join(fi))

Buggy submission (verdict: Runtime Error):
h,w = map(int,input().split())
ff = [list(input()) for _ in range(h)]

d = [[-1,-1],[0,-1],[1,-1],
     [-1, 0],       [1, 0],
     [-1, 1],[0, 1],[1, 1]]

for hi in range(h):
  for wi in range(w):
    if f[hi][wi]=='#':
      pass
    else:
      count = 0
      for dx,dy in d:
        x = dx+wi
        y = dy+hi        
        if (0<= x < w) and (0<= y <h) :
          if ff[y][x] == '#':
            count += 1
      ff[hi][wi] = str(count)
      
for fi in ff:
  print(''.join(fi))
Problem p03600 (python)

Fixed submission:
from copy import deepcopy
n = int(input())
INF = 10**12

A = []
for i in range(n):
  A.append(list(map(int,input().split())))

B = [[1]*n for _ in range(n)]
G = deepcopy(A)

for k in range(n):
  for i in range(n):
    for j in range(n):
      G[i][j] = min(G[i][j], G[i][k]+G[k][j])
      if not (i==j or j==k or k==i):
        if G[i][j] == G[i][k]+G[k][j]:
          B[i][j] = 0
      
if A==G:
  ans = 0
  for i in range(n):
    for j in range(i+1,n):      
      ans += G[i][j] * B[i][j]
  print(ans)
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
n = int(input())
INF = 10**12

A = []
for i in range(n):
  A.append(list(map(int,input().split())))

B = [[1]*n for _ in range(n)]
G = A.copy()

for k in range(n):
  for i in range(n):
    for j in range(n):
      G[i][j] = min(G[i][j], G[i][k]+G[k][j])
      if not (i==j or j==k or k==i):
        if G[i][j] == G[i][k]+G[k][j]:
          B[i][j] = 0
      
if A==G:
  ans = 0
  for i in range(n):
    for j in range(i+1,n):      
      ans += G[i][j] * B[i][j]
  print(ans)
else:
  print(-1)
Problem p03624 (python)

Fixed submission:
import string
s = input()
find = False
for c in string.ascii_lowercase:
  if c not in s:
    print(c)
    find = True
    break
if not find:
  print('None')

Buggy submission (verdict: Runtime Error):
s = input()
find = False
for c in string.ascii_lowercase:
  if c not in s:
    print(c)
    find = True
    break
if not find:
  print('None')
Problem p03640 (python)

Fixed submission:
h,w = map(int,input().split())
n = int(input())
aa = list(map(int,input().split()))

ans = [[0]*w for _ in range(h)]
nums = []

for i in range(n):
  for j in range(aa[i]):
    nums.append(i+1)
  
for i in range(len(nums)):  
  ans[i//w][i%w] = nums[i]  
  
for hi in range(h):
  if hi % 2 == 1:    
    print(' '.join(map(str,list(reversed(ans[hi])))))
  else:
    print(' '.join(map(str,ans[hi])))

Buggy submission (verdict: Runtime Error):
h,w = map(int,input().split())
n = int(input())
aa = list(map(int,input().split()))

ans = [[0]*w for _ in range(h)]
nums = ''

for i in range(n):
  nums += str(i+1)*aa[i]    
  
for i in range(len(nums)):  
  ans[i//w][i%w] = nums[i]  
  
for hi in range(h):
  if hi % 2 == 1:    
    print(' '.join(list(reversed(ans[hi]))))
  else:
    print(' '.join(ans[hi]))
Problem p03644 (python)

Fixed submission:
n = int(input())
i = 1

while True:
  if n<2**i:
    break
  else:
    i+=1
print(2**(i-1))

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split()) 
if b-a == c-b:
	print('YES')
else:
	print('NO')
Problem p03680 (python)

Fixed submission:
n = int(input())
A = [int(input())-1 for _ in range(n)]

visited = [0]*n
ans = 0
i = 0
while True:
  i = A[i]
  ans += 1  
  if visited[i]==1:
    ans = -1
    break    
  visited[i] = 1
  if i == 1:
    break
  
print(ans)

Buggy submission (verdict: Runtime Error):
visited = [0]*n
ans = 0
i = 0
while True:
  i = A[i]
  ans += 1  
  if visited[i]==1:
    ans = -1
    break    
  visited[i] = 1
  if i == 1:
    break
  
print(ans)
Problem p03698 (python)

Fixed submission:
s = input()
if len(s)==len(set(s)):
  print('yes')
else:
  print('no')

Buggy submission (verdict: Runtime Error):
s = input()
if len(s)==len(set(s)):
  print('yes')
else:
  print('no)

Buggy submission (verdict: Runtime Error):
s = input()
if len(s)==set(s):
  print('yes')
else:
  print('no)
Problem p03759 (python)

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

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split()) 
if b−a == c−b:
  print('YES')
else:
  print('NO')
Problem p03760 (python)

Fixed submission:
o = input()
e = input()

n = len(e)
ans = ''
for i in range(n):
  ans += o[i]
  ans += e[i]
    
if len(o)>n:
  ans += o[-1]

print(ans)

Buggy submission (verdict: Runtime Error):
o = input()
e = input()

n = len(e)
ans = ''
for i in range(n):
	ans += o[i]
  	ans += e[i]
    
if len(o)%2==1:
	ans += o[-1]
    
print(ans)

Buggy submission (verdict: Runtime Error):
o = input()
e = input()
n = len(e)
ans = ''
for i in range(n)
	ans += o[i]
  	ans += e[i]
    
if len(o)%2==1:
  ans += o[-1]

print(ans)
Problem p03854 (python)

Fixed submission:

s = input()
words = ['dream','dreamer','erase','eraser']
words_r = [w[::-1] for w in words]
s = s[::-1]

ans = 'NO'
i = 0
while i < len(s):  
  p = i
  for w in words_r:        
    if s[i:i+len(w)] == w:      
      i += len(w)
      if i == len(s):
        ans ='YES'
      break
  if p==i or ans=='YES':
    break

print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
sr = s[::-1]
words = [w[::-1] for w in ('dream','dreamer','erase','eraser')]

f = 0
while f == 0:  
  f = 1
  for w in words_r:
    if sr[0:len(w)] == w:
      sr = sr[len(w):]
      f = 0
  
if sr =='':
  print('YES')
else:
  print('NO')
Problem p03958 (python)

Fixed submission:
k,t = map(int,input().split())
A = list(map(int,input().split()))
print(max(0,2*max(A) - sum(A) -1))

Buggy submission (verdict: Runtime Error):
k,t = map(int,input().split())
A = list(map(int,input().split()))
print(max(2*max(A) - sum(A) -1))
Problem p04031 (python)

Fixed submission:
import numpy as np
n = int(input())
aa = np.array(list(map(int,input().split())))

ans = float('inf')
for i in range(min(aa),max(aa)+1):
  ans = min(ans,sum((aa-i)**2))
  
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
n = int(input())
aa = np.array(list(map(int,input().split())))

ans = float('inf')
for i in range(min(aa),max(aa)+1):
  ans = min(ans,sum((aa-i)**2))
  
print(ans)
Problem p02553 (python)

Fixed submission:
x=input().split(" ")
z=[]
for i in range(2):
	z.append(int(x[i-2])*int(x[0]))
for i in range(2):
    z.append(int(x[i-2])*int(x[1]))
print(max(z))

Buggy submission (verdict: Runtime Error):
x=input().rstrip.split(" ")
z=[]
for i in range(2):
	z.append(x[i-2]*x[0])
    z.append(x[i-2]*x[1])
print(max(z))

Buggy submission (verdict: Runtime Error):
x=input().rstrip.split(" ")
z=[]
for i in range(2):
	for y in range(2):
      z.append(x[i-2]*x[y-2])
print(max(z))
Problem p02555 (python)

Fixed submission:
s=int(input())
mod = 10**9+7

dp = [0]*(s+1)
dp[0] = 1
x = 0

for i in range(1,s+1):
  if i-3>=0:
    x += dp[i-3]
    x %= mod
  dp[i]=x
print(dp[s])

Buggy submission (verdict: Runtime Error):
n=int(input())
mod = 10**9+7

dp = [0]*(s+1)
dp[0] = 1

print(dp[])
Problem p02981 (python)

Fixed submission:
tmp=input().split()
n=int(tmp[0])
a=int(tmp[1])
b=int(tmp[2])

if a*n < b:
  print(a*n)
else:
  print(b)

Buggy submission (verdict: Runtime Error):
tmp=input().split()
n=int(tmp[0])
d=int(tmp[1])
xn = [0]*n
num = 0

for i in range(n):
  xn[i] = input().split()
    
for i in range(n):
  for j in range(i+1, n):
    dist = 0
    for k in range(d):
      dist = dist + pow(int(xn[i][k])-int(xn[j][k]), 2)
#    print("test",dist)
#    print(int(pow(int(pow(dist,0.5)), 2)))
    if dist == int(pow(int(pow(dist,0.5)), 2)):
      num += 1
print(num)
Problem p02982 (python)

Fixed submission:
tmp=input().split()
n=int(tmp[0])
d=int(tmp[1])
xn = [0]*n
num = 0

for i in range(n):
  xn[i] = input().split()
    
for i in range(n):
  for j in range(i+1, n):
    dist = 0
    for k in range(d):
      dist = dist + pow(int(xn[i][k])-int(xn[j][k]), 2)
#    print("test",dist)
#    print(int(pow(int(pow(dist,0.5)), 2)))
    if dist == int(pow(int(pow(dist,0.5)), 2)):
      num += 1
print(num)

Buggy submission (verdict: Runtime Error):
tmp=input().split()
n=int(tmp[0])
d=int(tmp[1])
xn = [0]*d
num = 0

for i in range(n):
  xn[i] = input().split()
    
for i in range(n):
  for j in range(i+1, n):
    dist = 0
    for k in range(d):
      dist = dist + pow(int(xn[i][k])-int(xn[j][k]), 2)
#    print("test",dist)
#    print(int(pow(int(pow(dist,0.5)), 2)))
    if dist == int(pow(int(pow(dist,0.5)), 2)):
      num += 1
print(num)
Problem p02582 (python)

Fixed submission:
import sys
import bisect as bi
import math
from collections import defaultdict as dd
input=sys.stdin.readline
##sys.setrecursionlimit(10**7)
def cin():
    return map(int,sin().split())
def ain():            
    return list(map(int,sin().split()))
def sin():
    return input()
def inin():
    return int(input())
for _ in range(1):
    s=input().strip()
    n=len(s)
    ans=0
    if('R' in s):
        p=s.index('R');
        c=1
        for i in range(p+1,n):
            if(s[i]=='R'):
                c+=1
            else:
                ans=max(ans,c)
                c=0
        ans=max(ans,c)
    print(ans)

Buggy submission (verdict: Runtime Error):
import sys
import bisect as bi
import math
from collections import defaultdict as dd
input=sys.stdin.readline
##sys.setrecursionlimit(10**7)
def cin():
    return map(int,sin().split())
def ain():            
    return list(map(int,sin().split()))
def sin():
    return input()
def inin():
    return int(input())
for _ in range(1):
    s=input().strip()
    p=s.index('R');n=len(s)
    ans=0
    if('R' in s):
        c=1
        for i in range(p+1,n):
            if(s[i]=='R'):
                c+=1
            else:
                ans=max(ans,c)
                c=0
        ans=max(ans,c)
    print(ans)
Problem p02639 (python)

Fixed submission:
x = list(map(int,input().split()))
for i in range(6):
    if i not in x:
        print(i)
        break

Buggy submission (verdict: Runtime Error):
x,y = (map(int,input().split()))

if y%2 != 0:
    print('No')
elif 2*x <= y <= 4*x:
    print('Yes')
else:
    print('No')