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

Fixed submission:
import itertools
import sys

[a,b,c] = [int(x) for x in input().split()]
[d,e,f] = [int(x) for x in input().split()]
[g,h,i] = [int(x) for x in input().split()]
N = int(input())
num_list = []
for j in range(N):
  n = int(input())
  num_list.append(n)

set_list = [{a,b,c},{d,e,f},{g,h,i},{a,d,g},{b,e,h},{c,f,i},{a,e,i},{c,e,g}]
the_set = set(num_list) & set([a,b,c,d,e,f,g,h,i])

v = itertools.permutations(the_set,3)
for k in v:
  if set(k) in set_list:
    print('Yes')
    sys.exit()
print('No')

Buggy submission (verdict: Runtime Error):
import itertools

[a,b,c] = [int(x) for x in input().split()]
[d,e,f] = [int(x) for x in input().split()]
[g,h,i] = [int(x) for x in input().split()]
N = int(input())
num_list = []
for i in N:
  n = int(input())
  num_list.append(n)
set_list = [{a,b,c},{d,e,f},{g,h,i},{a,d,g},{b,e,h},{c,f,i},{a,e,i}]
the_set = set(num_list) & set([a,b,c,d,e,f,g,h,i])
v = itertools.permutations(the_set,3)
for i in f:
  if i in set_list:
    print('Yes')
    break

Buggy submission (verdict: Runtime Error):
import itertools

[a,b,c] = [int(x) for x in input().split()]
[d,e,f] = [int(x) for x in input().split()]
[g,h,i] = [int(x) for x in input().split()]
N = int(input())
num_list = []
for i in N:
  n = int(input())
  num_list.append(n)
set_list = [{a,b,c},{d,e,f},{g,h,i},{a,d,g},{b,e,h},{c,f,i},{a,e,i}]
the_set = set(num_list) & set([a,b,c,d,e,f,g])
v = itertools.permutations(the_set,3)
for i in f:
  if i in set_list:
    print('Yes')
    break

Buggy submission (verdict: Runtime Error):
import itertools

[a,b,c] = [int(x) for x in input().split()]
[d,e,f] = [int(x) for x in input().split()]
[g,h,i] = [int(x) for x in input().split()]
N = int(input())
num_list = []
for i in N:
  n = int(input())
  num_list.append(n)
set_list = [{a,b,c},{d,e,f},{g,h,i},{a,d,g},{b,e,h},{c,f,i},{a,e,i}]
the_set = set(N) & set([a,b,c,d,e,f,g])
v = itertools.permutations(the_set,3)
for i in f:
  if i in set_list:
    print('Yes')
    break
Problem p02909 (python)

Fixed submission:
weather_list = ['Sunny', 'Cloudy', 'Rainy']
input_value = input()
number = weather_list.index(input_value) + 1
if number <= 2:
    print(weather_list[number])
else:
    print(weather_list[number - 3])

Buggy submission (verdict: Runtime Error):
weather_list = ['Sunny', 'Cloudy', 'Rainy']
input_value = input()
number = index(weather_list, input_value) + 1
if number <= 2:
    print(weather_list[number])
else:
    print(weather_list[number - 3])
Problem p02910 (python)

Fixed submission:
input_line = input()
def check():
  num = 1
  for i in input_line:
      if num % 2 == 1 and i == 'L':
          return 'No'
          break
      elif num % 2 == 0 and i == 'R':
          return 'No'
          break
      elif num % 2 == 1 and i == 'R' or i == 'U' or i == 'D':
          pass
      elif num % 2 == 0 and i == 'L' or i == 'U' or i == 'D':
          pass
      num += 1

if check() == 'No':
  print('No')
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
input_line = input()
for i in input():
    num = index.input_line(i)
    if (num + 1) % 2 == 1 and i == 'R' or i == 'U' or i == 'D':
        pass
    elif num % 2 == 0 and i == 'L' or i == 'U' or i == 'D':
        pass
    print('Yes')
    break
    elif (num + 1) % 2 == 1 and i == 'L':
        print('No')
    elif num % 2 == 0 and i == 'R':
        print('No')
Problem p02969 (python)

Fixed submission:
num = int(input())
print(3 * num * num)

Buggy submission (verdict: Runtime Error):
num = input()
print(3 * num * num)
Problem p02999 (python)

Fixed submission:
input_line = input()
l = input_line.split(' ')
l = [int(x) for x in l]

if l[0] < l[1]:
    print(0)
else:
    print(10)

Buggy submission (verdict: Runtime Error):
N,X = [int(x) for x in input().split()] # N と　X
list_2 = [int(x) for x in input().split()]
 
sum_list = []
for i in list_2:
    if sum(sum_list) < X:
      sum_list.append(i)
    elif sum(sum_list) == X:
      print(len(sum_list) + 1)
      break
    elif sum(sum_list) > X:
      print(len(sum_list))
      break
if sum(sum_list) < X:
    print(N + 1)

Buggy submission (verdict: Runtime Error):
list_1 = [int(x) for x in il_1.split(' ')] # N と　X
list_2 = [int(x) for x in il_2.split(' ')]
 
sum_list = []
for i in list_2:
    if sum(sum_list) < list_1[1]:
      sum_list.append(i)
    elif sum(sum_list) == list_1[1]:
      print(len(sum_list) + 1)
      break
    elif sum(sum_list) > list_1[1]:
      print(len(sum_list))
      break
if sum(sum_list) < list_1[1]
    print(list_1[0] + 1)

Buggy submission (verdict: Runtime Error):
input_line = input()
l = input().split(' ')
l = [int(x) for x in l]

if l[0] < l[1]:
    print(0)
else:
    print(10)

Buggy submission (verdict: Runtime Error):
input_line = input()
l = input().split(' ')
l = [int(x) for x in l]

if l[0] < l[1]:
  print(0)
else:
  print(10)

Buggy submission (verdict: Runtime Error):
input_line = input()
l = input().split(' ')
l = [int(x) for x in l]

if l[0] < i[1]:
  print(0)
else:
  print(10)
Problem p02642 (python)

Fixed submission:
M = 10 ** 6 + 5
N = int(input())
A = list(map(int, input().split()))

cnt = [0] * M
for i in A:
    if(cnt[i] >= 2):
        continue
    for j in range(i, M, i):
        cnt[j] += 1
ans = 0
for i in A:
    if(cnt[i] == 1):
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
M = 10 ** 6 + 5
N = int(input())
A_ref = list(map(int, input().split()))
A = set(M)
for i in A_ref:
    A.add(i)
cnt = [0] * M
for i in A:
    for j in range(0, M, i):
        cnt[j] += 1
ans = 0
for i in A:
    if(cnt[i] == 1):
        ans += 1
print(ans)
Problem p02660 (python)

Fixed submission:
from collections import defaultdict
import math

def soi(num_ref):
    arr = []
    num = num_ref
    for i in range(2, int(math.sqrt(num))+1):
        if num%i == 0:
            cnt = 0
            while num%i == 0:
                cnt += 1
                num //= i
            arr.append([i, cnt])
    if num != 1:
        arr.append([num, 1])
    if arr == []:
        arr.append([num_ref, 1])
    return arr

N = int(input())
if N == 1:
    print(0)
    exit()
arr = soi(N)
cnt = 0
for i in arr:
    minus = 1
    tmp = i[1]
    while(tmp - minus >= 0):
        tmp -= minus
        minus += 1
        cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
import math

def soi(num_ref):
    arr = []
    num = num_ref
    for i in range(2, int(math.sqrt(num))+1):
        if num%i == 0:
            cnt = 0
            while num%i == 0:
                cnt += 1
                num //= i
            arr.append([i, cnt])
    if num != 1:
        arr.append({num, 1})
    if arr == []:
        arr.append([num_ref, 1])
    return arr

N = int(input())
if N == 1:
    print(0)
    exit()
arr = soi(N)
cnt = 0
for i in arr:
    minus = 1
    tmp = i[1]
    while(tmp - minus >= 0):
        tmp -= minus
        minus += 1
        cnt += 1
print(cnt)
Problem p02713 (python)

Fixed submission:
import math

k=int(input())+1
l=[]
for a in range(1,k):
    for b in range(1,k):
        for c in range(1,k):
            l.append(math.gcd(a,math.gcd(b,c)))
print (sum(l))

Buggy submission (verdict: Runtime Error):
k=int(input())+1
l=[]
for a in range(1,k):
    for b in range(1,k):
        for c in range(1,k):
            l.append(math.gcd(a,math.gcd(b,c)))
print (sum(l))
Problem p02742 (python)

Fixed submission:
a,b=map(int,input().split())
if a==1 or b==1:
    print (1)
else:
    print (((a*b)+1)//2)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input_line.split())
if a==1 or b==1:
    print (1)
else:
    print (((a*b)+1)//2)
Problem p02909 (python)

Fixed submission:
list=['Sunny','Cloudy','Rainy']
input1=input()
if input1=='Rainy':
  print ('Sunny')
else:
	print (list[list.index(input1)+1])

Buggy submission (verdict: Runtime Error):
list=['Sunny','Cloudy','Rainy']
print (list[list.index(input())+1])
Problem p03437 (python)

Fixed submission:
x, y=map(int, input().split())
print(-1 if x%y==0 else x)

Buggy submission (verdict: Runtime Error):
x,y=map(int,input().split())
if x==y:print(-1)
else:
  while True:
    r=x*2
    if r%y!=0:
      print(r)
      break
    elif r>=10**18:
      print(-1)
      break
    i+=1

Buggy submission (verdict: Runtime Error):
x,y=map(int,input().split());ans=0
if x==y:
  print(-1)
else:
  while True:
    r=x*2
    if r%y!=0:
      print(r)
      break
    elif r>=10**18:
      print(-1)
    i+=1
Problem p03992 (python)

Fixed submission:
input_line=input()
print (input_line[:4]+" "+input_line[4:])

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
a = [None] + a
cnt = 0
for i in range(1, n):
  j = a[i]
  if j > i and a[j] == i:
    cnt += 1
print(cnt)
Problem p03304 (python)

Fixed submission:
n, m, d = map(int, input().split())
if d == 0:
    print((m-1)/n)
else:
    print((2*(n-d)/ n**2)*(m-1))

Buggy submission (verdict: Runtime Error):
n, m, d = map(int, input().split())
print(((n-d)*(m-1)/n)/(n-1))
Problem p03399 (python)

Fixed submission:
a = []
for _ in range(4):
    a.append(int(input()))

print(min(a[0],a[1])+ min(a[2],a[3]))

Buggy submission (verdict: Runtime Error):
a = []
for _ in range(4):
    a.append(int(input))

print(min(min(a[0],a[1]), min(a[2],a[3])))
Problem p03433 (python)

Fixed submission:
n = int(input())
a = int(input())

r = n % 500
if r > a:
  print('No')
else:
  print('Yes')

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

r = n % 500
if r > a:
  print('No')
else:
  print('Yes')
Problem p03469 (python)

Fixed submission:
s = list(input())
s[3] = '8'
s2 = "".join(s)
print(s2)

Buggy submission (verdict: Runtime Error):
n, y = map(int, input().split())
res = [-1, -1, -1]
for a in range(n + 1):
    for b in range(n - a + 1):
        if 10000 * a + 5000 * b + 1000 * (n - a - b) == y:
            res[0] = a
            res[1] = b
            res[2] = n - a - b
print(' '.join(map(str, res)))
Problem p03599 (python)

Fixed submission:
a, b, c, d, e, f = map(int, input().split())
max_concentration = 0
for i in range(0, f + 1, 100 * a):
    for j in range(0, f - i + 1, 100 * b):
        if i == 0 and j == 0:
            continue
        y = min((i + j) * e // 100, f - i - j)
        for k in range(0, y + 1, c):
            for l in range(0, y - k + 1, d):
                concentration = 100 * (k + l) / (i + j + k + l)
                if max_concentration <= concentration:
                    max_concentration = concentration
                    res1 = i + j + k + l
                    res2 = k + l
print(str(res1) + ' ' + str(res2))

Buggy submission (verdict: Runtime Error):
a, b, c, d, e, f = map(int, input().split())
max_concentration = 0
for i in range(0, f + 1, 100 * a):
    for j in range(0, f - i + 1, 100 * b):
        if i == 0 and j == 0:
            continue
        y = min((i + j) * e // 100, f - i - j)
        for k in range(0, y + 1, c):
            for l in range(0, y - k + 1, d):
                concentration = 100 * (k + l) / (i + j + k + l)
                if max_concentration < concentration:
                    max_concentration = concentration
                    res1 = i + j + k + l
                    res2 = k + l
print(str(res1) + ' ' + str(res2))

Buggy submission (verdict: Runtime Error):
a, b, c, d, e, f = map(int, input().split())
max_concentration = 0
for i in range(0, f + 1, 100 * a):
    for j in range(0, f - i + 1, 100 * b):
        if i == 0 and j == 0:
            continue
        y = min((i + j) * e // 100, f - i - j)
        for k in range(0, y + 1, c):
            for l in range(0, y - k + 1, d):
                concentration = 100 * (k + l) // (i + j + k + l)
                if max_concentration < concentration:
                    max_concentration = concentration
                    res1 = i + j + k + l
                    res2 = k + l
print(str(res1) + ' ' + str(res2))
Problem p04044 (python)

Fixed submission:
n, l = map(int, input().split())
str_list = [input() for i in range(n)]

str_list.sort()

print("".join(str_list))

Buggy submission (verdict: Runtime Error):
n, l = map(int, input().split())
str_list = [input() for i in range(l)]

str_list.sort()

print("".join(str_list))

Buggy submission (verdict: Runtime Error):
n, l = map(int, input().split())
str_list = [input() for i in range(3)]

str_list.sort()

print("".join(str_list))
Problem p02628 (python)

Fixed submission:
N, K = map(int, input().split())
p = list(map(int, input().split()))
print(sum(sorted(p)[:K]))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().splilt())
p = list(map(int, input().splilt()))
print(sum(sorted(p)[:M]))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().splilt())
L = list(map(int, input().splilt()))
print(sum(sorted(L)[:M]))

Buggy submission (verdict: Runtime Error):
N, M = int(input().split())
list = str(input().split())
list.sort()
total = 0
for i in [0:M]:
  total += list[i]
print(total)
Problem p02614 (python)

Fixed submission:
import copy
H,W,K=map(int,input().split())
L=[[x for x in input()] for i in range(H)]
ans=0
for i in range(2**H):
    for j in range(2**W):
        C=copy.deepcopy(L)
        for k in range(H):
            if (i>>k&1):
                C[k]=["r"]*W
        for l in range(W):
            if (j>>l&1):
                for m in range(H):
                    C[m][l]="r"
        count=0
        for p in range(H):
            for q in range(W):
                if C[p][q]=="#":
                    count+=1
        if count==K:
            ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
import copy
H,W,K=map(int,input().split())
L=[list(map(int,input().split())) for i in range(H)]
ans=0
for i in range(2**H):
    for j in range(2**W):
        C=copy.deepcopy(L)
        for k range(H):
            if (i>>k&1):
                C[k]=["r"]*W
        for l range(W):
            if (j>>l&1):
                for m range(H):
                    C[l][m]="r"
        count=0
        for i in range(H):
            for j in range(W):
                if C[i][j]=="#":
                    count+=1
        if count==K:
            ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
H,W,K=map(int,input().split())
L=[list(map(int,input().split())) for i in range(H)]
ans=0
for i in range(2**H):
    for j in range(2**W):
        C=deepcopy.(L)
        for k range(H):
            if (i>>k&1):
                C[k]=["r"]*W
        for l range(W):
            if (j>>l&1):
                for m range(H):
                    C[l][m]="r"
        count=0
        for i in range(H):
            for j in range(W):
                if C[i][j]=="#":
                    count+=1
        if count==K:
            ans+=1
print(ans)
Problem p02630 (python)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
S=0
B=[0]*(10**5+1)
for i in A:
    S+=i
    B[i]+=1  #Bは要素数管理
Q=int(input())
C=[list(map(int,input().split())) for i in range(Q)]
for i in range(Q):
    S=S+(C[i][1]-C[i][0])*B[C[i][0]]
    B[C[i][1]]=B[C[i][0]]+B[C[i][1]]
    B[C[i][0]]=0
    print(S)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
S=0
B=[0]*10**5
for i in A:
    S+=i
    B[i]+=1  #Bは要素数管理
Q=int(input())
C=[list(map(int,input().split())) for i in range(Q)]
for i in range(Q):
    S=S+(C[i][1]-C[i][0])*B[C[i][0]]
    B[C[i][1]]+=B[C[i][0]]
    B[C[i][0]]=0
    print(S)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
S=0
B=[0]*10**5
for i in A:
    S+=i
    B[i]+=1  #Bは要素数管理
Q=int(input())
C=[list(map(int,input().split())) for i in range(Q)]
for i in range(Q):
    S=S+(C[i][1]-C[i][0])*B[C[i][0]]
    B[C[i][1]]=B[C[i][0]]+B[C[i][1]]
    B[C[i][0]]=0
    print(S)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
S=0
B=[0]*10**5
for i in A:
    S+=i
    B[i]=A.count(i)  #Bは要素数管理
Q=int(input())
C=[list(map(int,input().split())) for i in range(Q)]
for i in range(Q):
    S=S+(C[i][1]-C[i][0])*B[C[i][0]]
    B[C[i][1]]=B[C[i][0]]+B[C[i][1]]
    B[C[i][0]]=0
    print(S)
Problem p03087 (python)

Fixed submission:
N,Q=map(int,input().split())
S=input()
L=[]
R=[]
C=[0]*N
c=0
for i in range(Q):
    A=list(map(int,input().split()))
    L.append(A[0])
    R.append(A[1])
for i in range(N-1):
    if S[i]=="A" and S[i+1]=="C":
        c+=1
        C[i]=c
    else:
        C[i]=c
C[N-1]=c
S+="X"
for i in range(Q):
    p=0
    if S[R[i]-1]=="A" and S[R[i]]=="C":
        p=C[R[i]-1]-C[L[i]-1]-1
    else:
        p=C[R[i]-1]-C[L[i]-1]
    if S[L[i]-1]=="A" and S[L[i]]=="C":
        p+=1
    print(p)

Buggy submission (verdict: Runtime Error):
N,Q=map(int,input().split())
S=input()
L=[]
R=[]
C=[0]*N
c=0
for i in range(Q):
    A=list(map(int,input().split()))
    L.append(A[0])
    R.append(A[1])
for i in range(N-1):
    if S[i]=="A" and S[i+1]=="C":
        c+=1
        C[i]=c
    else:
        C[i]=c
C[N-1]=c
for i in range(Q):
    p=0
    if S[R[i]-1]=="A" and S[R[i]]=="C":
        p=C[R[i]-1]-C[L[i]-1]-1
    else:
        p=C[R[i]-1]-C[L[i]-1]
    if S[L[i]-1]=="A" and S[L[i]]=="C":
        p+=1
    print(p)

Buggy submission (verdict: Runtime Error):
N,Q=map(int,input().split())
S=input()
L=[]
R=[]
C=[0]*N
c=0
for i in range(Q):
    A=list(map(int,input().split()))
    L.append(A[0])
    R.append(A[1])
for i in range(N-1):
    if S[i]=="A" and S[i+1]=="C":
        c+=1
        C[i]=c
    else:
        C[i]=c
C[N-1]=c
for i in range(Q):
    if S[R[i]-1]=="A" and S[R[i]]=="C":
        print(C[R[i]-1]-C[L[i]-1]-1)
    else:
        print(C[R[i]-1]-C[L[i]-1]+1)
print(C)
Problem p02553 (python)

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

print(max(a*c, a*d, b*c, b*d))

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

print(max(a*c, a*d, b*c, b*d))
Problem p02642 (python)

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

num = [1 for i in range(1000001)]
ans_list = [0 for i in range(1000001)]
for i in range(N):
    now = A[i]
    if ans_list[now] == 2:
        continue
    elif ans_list[now] == 1:
        ans_list[now] = 2
    else:
        ans_list[now] = 1
    for j in range(2*now, 1000001, now):
        num[j] = 0

count = 0
for i in range(N):
    now = A[i]
    if num[now] == 1 and ans_list[now] == 1:
        count += 1
        
print(count)

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

ans_list = [[1, 0] for i in range(100001)]
for i in range(N):
    now = A[i]
    ans_list[now][1] += 1
    for j in range(2*now, 100001, now):
        ans_list[j][0] = 0

count = 0
for i in range(N):
    now = A[i]
    if ans_list[now][0] == 1 and ans_list[now][1] == 1:
        count += 1
        
print(count)
Problem p02797 (python)

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

ans = []
for i in range(K):
    ans.append(S)
    
for i in range(N - len(ans)):
    ans.append(10**9-1)

print(*ans)

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

mawari = S // K
mid = S // K + S % K

ans = []

for i in range(K-1):
    ans.append(mawari)

ans.append(mid)

for i in range(K-1):
    ans.append(mawari)

for i in range(N - len(ans)):
    ans.append(10**9-1)

print(*ans)

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

mawari = S // K
mid = S // K + S % K

ans = []

for i in range(K-1):
    ans.append(mawari)

ans.append(mid)

for i in range(K-1):
    ans.append(mawari)

for i in range(N - len(ans)):
    ans.append(S)

print(*ans)
Problem p02995 (python)

Fixed submission:
import fractions

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

A, B, C, D = map(int, input().split())

lcm_CD = lcm(C, D)
count = (B // C - (A-1) // C) + (B // D - (A-1) // D) - (B // lcm_CD - (A-1) // lcm_CD)
    
print((B - A + 1) - count)

Buggy submission (verdict: Runtime Error):
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

A, B, C, D = map(int, input().split())

lcm_CD = lcm(C, D)
count = (B // C - (A-1) // C) + (B // D - (A-1) // D) - (B // lcm_CD - (A-1) // lcm_CD)
    
print((B - A + 1) - count)

Buggy submission (verdict: Runtime Error):
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

A, B, C, D = map(int, input().split())

lcm_CD = lcm(C, D)
count = (B // C - (A-1) // C) + (B // D - (A-1) // D) - (B // lcm_CD - (A-1) // lcm_CD)
    
print((B - A + 1) - count)
Problem p03071 (python)

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

sum_coin = 0
tmp = max(A, B)
sum_coin += tmp
if tmp == A:
    A += -1
else:
    B += -1
tmp = max(A, B)
sum_coin += tmp
print(sum_coin)

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

bl = []
if S[0] == "0":
    bl.append(0)
bl.append(0)
for i in range(1, N):
    if S[i-1] != S[i]:
        bl.append(i)
bl.append(N)
bl.append(N)

nbl = len(bl)
m = [bl[i+2 * K+1] - bl[i] 
     for i in range(nbl - 2*K-1) if i%2 == 0]
if len(m) == 0:
    print(N)
else:
    print(max(m))
Problem p03165 (python)

Fixed submission:
s = input()
t = input()

dp = [[0 for i in range(3010)] for j in range(3010)]

for i in range(len(s)):
    for j in range(len(t)):
        if s[i] == t[j]:
            dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j] + 1)
        dp[i+1][j+1] = max(dp[i+1][j+1], dp[i+1][j], dp[i][j+1])
        
ans = ""
i = len(s)
j = len(t)
while i > 0 and j > 0:
    if dp[i][j] == dp[i-1][j]:
        i -= 1
    elif dp[i][j] == dp[i][j-1]:
        j -= 1
    else:
        ans = s[i-1] + ans
        i -= 1
        j -= 1

print(ans)

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

dp = [[0 for i in range(len(s)+2)] for j in range(len(t)+2)]

for i in range(len(s)):
    for j in range(len(t)):
        if s[i] == t[j]:
            dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j] + 1)
        dp[i+1][j+1] = max(dp[i+1][j+1], dp[i+1][j], dp[i][j+1])
        
ans = ""
i = len(s)
j = len(t)
while i > 0 and j > 0:
    if dp[i][j] == dp[i-1][j]:
        i -= 1
    elif dp[i][j] == dp[i][j-1]:
        j -= 1
    else:
        ans = s[i-1] + ans
        i -= 1
        j -= 1

print(ans)
Problem p03240 (python)

Fixed submission:
N=int(input())
a=[list(map(int,input().split())) for i in range(N)]
flag=False
for cx in range(101):
    if flag:
        break
    for cy in range(101):
        count=0
        if flag:
            break
        for i in range(N):
            if a[i][2]!=0:
                if count==0:
                    H=a[i][2]+abs(cx-a[i][0])+abs(cy-a[i][1])
                    count+=1
                if H!=a[i][2]+abs(cx-a[i][0])+abs(cy-a[i][1]):
                    break
            if i==N-1:
                x=cx
                y=cy
                flag=True
                for k in range(N):
                    if a[k][2]!=max(H-abs(x-a[k][0])-abs(y-a[k][1]),0):
                        flag=False
print(x,y,H)

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

xyh = []
max_h = 0
for i in range(N):
    x = list(map(int, input().split()))
    xyh.append(x)
    if max_h < x[2]:
        max_h = x[2]

flag = False    
while True:
    for i in range(101):
        for j in range(101):
            count = 0
            for k in range(3):
                if xyh[k][2] == max(max_h - abs(xyh[k][0] - i) - abs(xyh[k][1] - j), 0):
                    count += 1
            if count == 3:
                cx = i
                cy = j
                H = max_h
                flag = True
                break
        if flag == True:
            break
            
    max_h += 1
    if flag == True:
        break

print(cx, cy, H)
Problem p03260 (python)

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

if A*B % 2 == 0:
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
A, B = map(int, input())

if A*B % 2 == 0:
    print("No")
else:
    print("Yes")