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

Fixed submission:
n,x=map(int,input().split())
l=list(map(int,input().split()))
t=0
c=1
for i in range(n):
    t+=l[i]
    if t>x:
        break
    c+=1
print(c)

Buggy submission (verdict: Runtime Error):
import sys
n,x=map(int,input().split())
l=list(map(int,input().split()))
t=0
c=0
for i in range(n+1):
  t+=l[i]
  c+=1
  if t>x:
    print(c)
    sys.exit()
print(len(l))

Buggy submission (verdict: Runtime Error):
import sys
n,x=map(int,input().split())
l=list(map(int,input().split()))
t=0
c=0
for i in range(n+1):
  t+=l[i]
  c+=1
  if t>x:
    print(c)
    sys.exit()
Problem p03067 (python)

Fixed submission:
a,b,c=map(int,input().split())
if a<c<b or b<c<a:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n=int(input())
s=list(input())
k=int(input())
l=s[k-1]
for i in range(n):
  if s[i]!=l:
    s[i]="*"
print("".join(s))
Problem p03071 (python)

Fixed submission:
a,b=list(map(int,input().split()))
c=max([a,b])
if a<b:
    b-=1
else:
    a-=1
d=max([a,b])
print(c+d)

Buggy submission (verdict: Runtime Error):
a.b=list(map(int,input().split()))
if a==b:
  print(max([a,b])*2)
else:
  print(max([a,b])*2-1)

Buggy submission (verdict: Runtime Error):
a=list(map(int,input().split()))
if a==b:
  print(max(a)*2)
else:
  print(max(a)*2-1)
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().split())
if (a * b) % 2 == 0:
  print("Even")
else
  print("Odd")

Buggy submission (verdict: Runtime Error):
a, b = map(int,input().split())
if (a * b) % 2 == 0:
  print("Even")
elif
  print("Odd")

Buggy submission (verdict: Runtime Error):
a, b = map(int,input().split())
if a * b % 2 == 0:
  print("Even")
elif
  print("Odd")

Buggy submission (verdict: Runtime Error):
a, b = input().split()
if a * b % 2 == 0:
  print("Even")
elif
  print("Odd")
Problem p02664 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**6)

t=input()

a=[]
j=0
for i in range(len(t)):
    if t[i]=="?":
        a.append("D")
    else:
        a.append(t[i])

print("".join(a))
#print(a)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**6)

def count(s: str):
    p=0
    for i in range(len(s)):
        if s[i]=="D":
            p+=1
        if s[i]=="P":
            if i<len(s)-1 and s[i+1]=="D":
                p+=1
    return p


t=input()

#print(len(t))

a=[]
j=0
for i in range(len(t)):
    if t[i]=="?":
        a.append(i)
        j+=1       
#print(a)

s=j
tt=t
#print(tt[1])
tt_list=list(tt)
#print(tt_list)

max_score=0
for i in range(2**s):
#    bin_str=bin(i).zfill(s+2)
    bin_str=format(i,'b').zfill(s)
#    print("bin_str=",bin_str)
#    print(bin_str[1])
    for j in range(len(bin_str)):
        if bin_str[j]=="0":
            tt_list[a[j]]="P"
        else: # :1
            tt_list[a[j]]="D"
    score=count("".join(tt_list))
#    print(score)
#    print("".join(tt_list))
    max_score=max(max_score,score)

for i in range(2**s):
    bin_str=format(i,'b').zfill(s)
#    print("bin_str=",bin_str)
#    print(bin_str[1])
    for j in range(len(bin_str)):
        if bin_str[j]=="0":
            tt_list[a[j]]="P"
        else: # :1
            tt_list[a[j]]="D"
    score=count("".join(tt_list))
    if score==max_score:
        print("".join(tt_list))
        exit()
Problem p02675 (python)

Fixed submission:
s=input()
#print(s)
a=int(s[-1])
#print(a)

if a==3:
    print("bon")
elif a==0 or a==1 or a==6 or a==8:
    print('pon')
else:
    print("hon")

Buggy submission (verdict: Runtime Error):
import math
#import decimal
#decimal.getcontext().prec = 12

#getcontext().prec=20
a,b,h,m=map(int,input().split())
#a=decimal.Decimal(a)
#b=decimal.Decimal(b)
#h=decimal.Decimal(h)
#m=decimal.Decimal(m)

#print(a,b,h,m)

#ang1=decimal.Decimal(360*(h/12)+30*m/60)
#ang2=decimal.Decimal(360*m/60)
#ang=decimal.Decimal(abs(ang1-ang2))
ang1=360*(h/12)+30*m/60
ang2=360*m/60
ang=abs(ang1-ang2)
#print(ang)
if ang>=180.0:
#    ang=ang-180.0
    ang=360.0-ang

#print(ang)
#ans = ((a)**2 + (b)**2 - decimal.Decimal(2.0)*(a)*(b)*decimal.Decimal(math.cos(math.radians(ang))))
ans = a**2 + b**2 - 2.0*a*b*math.cos(math.radians(ang))
ans = math.sqrt(ans)
#print(math.cos(math.radians(ang)))

print(ans)
Problem p03294 (python)

Fixed submission:
import sys
import numpy as np
import math
from functools import reduce
sys.setrecursionlimit(10**6)

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

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

#def lcm_base(x,y):
#    return (x*y)//math.gcd(x,y)
#def lcm_list(numbers):
#    return reduce(lcm_base, numbers, 1)
#c=lcm_list(a)

#print(b)
#print(c)

ans=0
for j in range(n):
    ans+=(b-1)%a[j]
#    ans+=(c-1)%a[j]

#ans=0
##for i in range(b):
#for i in range(c):
#    f=0
#    for j in range(n):
#        f+=(i+1)%a[j]
#    ans=max(ans,f)

print(ans)

Buggy submission (verdict: Runtime Error):
import sys
import numpy as np
import math
from functools import reduce
sys.setrecursionlimit(10**6)

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

#b=1
#for i in range(n):
#    b*=a[i]

def lcm_base(x,y):
    return (x*y)//math.gcd(x,y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
c=lcm_list(a)

#print(b)
#print(c)

ans=0
for j in range(n):
    ans+=(c-1)%a[j]

#ans=0
##for i in range(b):
#for i in range(c):
#    f=0
#    for j in range(n):
#        f+=(i+1)%a[j]
#    ans=max(ans,f)

print(ans)
Problem p03493 (python)

Fixed submission:
a=int(input())
b1=a // 100
b2=a % 100
c1=b2 // 10
c2=b2 % 10
print(b1+c1+c2)

Buggy submission (verdict: Runtime Error):
n=int(input())
#print(n)                                                                                                     
#a=input().split()                                                                                            
a=[int(x) for x in input().split()]
#a=map(int,input().split())                                                                                   
#print(a)                                                                                                     
#print(a[0]+a[1])                                                                                             
count=0
while True:
    flag=0
#    print(a)                                                                                                 
    for i in range(n):
        if((a[i] % 2)==0):
#        if((a[i]!=1) and (a[i] % 2)==0):                                                                     
            flag+=0
            a[i]=a[i]/2
        else:
            flag+=1
#    print(flag)                                                                                              
    if(flag!=0):
        break
    else:
        count+=1
#        print(count)                                                                                         

print(count)

Buggy submission (verdict: Runtime Error):
n=int(input())
#print(n)                                                                                                     
#a=input().split()                                                                                            
a=[int(x) for x in input().split()]
#a=map(int,input().split())                                                                                   
#print(a)                                                                                                     
#print(a[0]+a[1])                                                                                             
count=0
while True:
    flag=0
#    print(a)                                                                                                 
    for i in range(n):
        if((a[i] % 2)==0):
#        if((a[i]!=1) and (a[i] % 2)==0):                                                                     
            flag+=0
            a[i]=a[i]/2
        else:
            flag+=1
#    print(flag)                                                                                              
    if(flag!=0):
        break
    else:
        count+=1
#        print(count)                                                                                         

print(count)
Problem p02830 (python)

Fixed submission:
N = int(input())
s, t = map(str, input().split())

word = ""
for i in range(N):
    word = word + s[i]
    word = word + t[i]

print(word)

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

word = ""
for i in range(N):
    word = word + s[i]
    word = word + t[i]

input(word)
Problem p02613 (python)

Fixed submission:
#[int(i) for i in input().split()]
import collections
n = int(input())
dic = collections.defaultdict(int)
for i in range(n):
  dic[input()] += 1
print("AC x " + str(dic["AC"]))
print("WA x " + str(dic["WA"]))
print("TLE x " + str(dic["TLE"]))
print("RE x " + str(dic["RE"]))

Buggy submission (verdict: Runtime Error):
import collections
n = int(input())
dic = collections.defaultdict(int)
for i in range(n):
  dic[input()] += 1
print("AC x" + dic["AC"])
print("WA x" + dic["WA"])
print("TLE x" + dic["TLE"])
print("RE x" + dic["RE"])
Problem p02691 (python)

Fixed submission:
import collections
n = int(input())
a = [int(i) for i in input().split()]
pl = []
dic_mn = collections.defaultdict(int)

for i in range(n):
    pl.append(a[i] + i)
    dic_mn[i - a[i]] += 1
ans = 0
for i in range(n):
    ans += dic_mn[pl[i]]

print(ans)
#print(pl)
#print(dic_mn)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]
pl = []
dic_mn = {}
for i in range(-n,n):
    dic_mn[i] = 0

for i in range(n):
    pl.append(a[i] + i)
    dic_mn[i - a[i]] += 1
ans = 0
for i in range(n):
    try:
        ans += dic_mn[pl[i]]
    except:
        ans = ans
print(ans)
#print(pl)
#print(dic_mn)
Problem p02830 (python)

Fixed submission:
n = int(input())
[s,t] = [i for i in input().split()]
ans = ""
for i in range(n):
    ans += s[i]
    ans += t[i]
print(ans)

Buggy submission (verdict: Runtime Error):
n = input()
[s,t] = [i for i in input().split()]
ans = ""
for i in range(n):
    ans += s[i]
    ans += t[i]
print(ans)
Problem p02848 (python)

Fixed submission:
ls = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
dic = {"A":1,"B":2,"C":3,"D":4,"E":5,"F":6,"G":7,"H":8,"I":9,"J":10,"K":11,"L":12,"M":13,"N":14,"O":15,"P":16,"Q":17,"R":18,"S":19,"T":20,"U":21,"V":22,"W":23,"X":24,"Y":25,"Z":26}

n = int(input())
s = input()
ans = ""
for i in range(len(s)):
  ans += ls[(dic[s[i]]+n-1) % 26]
print(ans)

Buggy submission (verdict: Runtime Error):
ls = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
dic = {"A":1,"B":2,"C":3,"D":4,"E":5,"F":6,"G":7,"H":8,"I":9,"J":10,"K":11,"L":12,"M":13,"N":14,"O":15,"P":16,"Q":17,"R":18,"S":19,"T":20,"U":21,"V":22,"W":23,"X":24,"Y":25,"Z":26}

n = int(input())
s = input()
ans = ""
for i in range(len(s)):
  ans += ls[dic[s[i]]+n-1]
print(ans)
Problem p02922 (python)

Fixed submission:
[a,b] = [int(i) for i in input().split()]
now = 1
cnt = 0
while(now < b):
    now += a-1
    cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
#include <iostream>

using namespace std;

int main(){
  int a,b,cnt,now;
  cin >> a >> b;
  now = 1;
  cnt = 0;
  while(now < b){
    if (cnt == 0) now += a;
    else now += a - 1;
  cnt += 1;
  }
  cout << cnt << endl;
  return 0;
}
Problem p02923 (python)

Fixed submission:
n = int(input())
h = [int(i) for i in input().split()]
a = []
t = 0
for i in range(n):
  if i == 0:
    a.append(0)
  else:
    if h[i] <= h[i-1]:
      t += 1
    else:
      t = 0
    a.append(t)
print(max(a))

Buggy submission (verdict: Runtime Error):
n = int(input())
h = [int(i) for i in input().split()]
a = []
t = 0
for i in range(n):
  if i == 0:
    a.append(0)
  else:
    if h[i] < h[i-1]:
      t += 1
    else:
      t = 0
    a.append(t)
print(max(t))
Problem p02975 (python)

Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]

#a_b = []
dic = {}
m = 0
for i in range(len(a)):
    if a[i] in dic.keys():
        dic[a[i]] += 1
    else:
        dic[a[i]] = 1

ls = list(dic.keys())

if len(ls) <= 2 and 0 in ls:
    ls.sort()
    #2種類の時...0と何か
    if len(ls) == 2:
        #0の数が他の数の半分
        if 2 * dic[ls[0]] == dic[ls[1]]:
            print("Yes")
        else:
            print("No")
    #1種類の時...0だけ
    else:
        print("Yes")
#3種類の時...全ての個数が揃っていて2つが1つの排他的論理和になっている
elif len(ls) == 3:
    ls.sort()
    if  dic[ls[0]] == dic[ls[1]] and dic[ls[0]] == dic[ls[2]]:
        if list(ls)[0] ^ list(ls)[1] == list(ls)[2]:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
#4種類以上の時...ダメ
else:
    print("No")

"""
for i in a:
    if i == max(a):
        m = i
    #print(bin(i))
for i in a:
    a_b.append(bin(i)[:2]+'0'*(len(bin(m))-len(bin(i)))+bin(i)[2:])

#for i in range(len(a_b)):
#    print(a_b[i])


a = int("0b" + "0" * (len(bin(m))-2),2)

for i in range(len(a_b)):
    a = a ^ int(a_b[i],2)
if a == 0:
    print("Yes")
else:
    print("No")
"""

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]


dic = {}
m = 0
for i in range(len(a)):
    if a[i] in dic.keys():
        dic[a[i]] += 1
    else:
        dic[a[i]] = 1

ls = list(dic.keys())

if len(ls) <= 2 and 0 in ls:
    ls.sort()
    if dic[ls[0]] == 2 * dic[ls[1]]:
        print("Yes")
    else:
        print("No")
elif len(ls) == 3:
    ls.sort()
    if  dic[ls[0]] == dic[ls[1]] and dic[ls[0]] == dic[ls[2]]:
        if list(ls)[0] ^ list(ls)[1] == list(ls)[2]:
            print("Yes")
        else:
            print("No")
else:
    print("No")
Problem p03023 (python)

Fixed submission:
print((int(input())-2)*180)

Buggy submission (verdict: Runtime Error):
print((n-2) * 180)
Problem p03076 (python)

Fixed submission:
ls = []

for i in range(5):
    ls.append(int(input()))
sum = 0
ls1 = []
for i in range(5):
    if ls[i] % 10 == 0:
        sum += ls[i]
    else:
        ls1.append(10 - ls[i] % 10)
        sum += ((ls[i] // 10) + 1)* 10
#print(ls1)
if len(ls1) != 0:
    print(sum - max(ls1))
else:
    print(sum)

Buggy submission (verdict: Runtime Error):
ls = []

for i in range(5):
    ls.append(int(input()))
sum = 0
ls1 = []
for i in range(5):
    if ls[i] % 10 == 0:
        sum += ls[i]
    else:
        ls1.append(10 - ls[i] % 10)
        sum += (ls[i] // 10 + 1 )* 10
#print(ls1)
print(sum - max(ls1))
Problem p03085 (python)

Fixed submission:
b = input()
ans = ""
for i in range(len(b)):
    if b[i] == "A":
        ans += "T"
    elif b[i] == "T":
        ans += "A"
    elif b[i] == "C":
        ans += "G"
    else:
        ans += "C"
print(ans)

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

if d == "A":
    print("T")
    
else if d == "T":
    print("A")

else if d == "C":
    print("G")
    
else:
    print("C")

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

if d == "A":
    print("T")
    
else if d == "T":
    print("A")

    
else if d == "C":
    print("G")
    
else:
    print("C")
Problem p03086 (python)

Fixed submission:
b = input()
ans = ""

for i in range(len(b)):
    if b[i] == "A" or b[i] == "T" or b[i] == "C" or b[i] == "G":
        ans += "1"
    else:
        ans += "0"
#print(ans)

ls = ans.split("0")
#print(ls)
print(len(max(ls)))

Buggy submission (verdict: Runtime Error):
b = input()
ans = 0
ls = []
for i in range(len(b)):
    if b[i] == "A" or b[i] == "T" or b[i] == "C" or b[i] == "G":
        ans += 1
    else:
        ls.append(ans)
        ans = 0
print(max(ls))
Problem p03164 (python)

Fixed submission:
[n,w] = [int(i) for i in input().split()]
w_v = []
for i in range(n):
    w_v.append([int(j) for j in input().split()])

"""
dp[i][v] = w
i : 何番目までのものを使うか
v : ちょうどその価値になる
w : その時の重さ
最後に後ろから全探索して重さ超えてないやつ探す？
"""
INF = 10 ** 9 + 7
v_max = 10**3 * n + 1
dp = [[INF] * (v_max) for i in range(n)]
##print(dp)
#価値0になるところの重さは0
for i in range(n):
    dp[i][0] = 0
if n != 1:
    for i in range(n):
        #print("step",i)
        if i != 0:
            for v_zantei in range(v_max):
                if v_zantei >= w_v[i][1]:
                    dp[i][v_zantei] = min(dp[i-1][v_zantei],dp[i-1][v_zantei - w_v[i][1]] + w_v[i][0])
                else:
                    dp[i][v_zantei] = dp[i-1][v_zantei]
            #print(dp[i])
        else:
            dp[i][w_v[i][1]] = w_v[i][0]
            #print(dp[i])
    ans = -1
    for v in range(v_max-1,-1,-1):
        #print(w,dp[n-1][v],ans)
        if dp[n-1][v] <= w and ans < v:
            ##print(v)
            ans = v
    print(ans)
else:
    print(w_v[0][1])

Buggy submission (verdict: Runtime Error):
[n,w] = [int(i) for i in input().split()]
w_v = []
for i in range(n):
    w_v.append([int(j) for j in input().split()])

"""
dp[i][v] = w
i : 何番目までのものを使うか
v : ちょうどその価値になる
w : その時の重さ
最後に後ろから全探索して重さ超えてないやつ探す？
"""
INF = 10 ** 9 + 7
v_max = 10**3 * n
dp = [[INF] * (v_max) for i in range(n)]
##print(dp)
#価値0になるところの重さは0
for i in range(n):
    dp[i][0] = 0

for i in range(n):
    #print("step",i)
    if i != 0:
        for v_zantei in range(v_max):
            if v_zantei >= w_v[i][1]:
                dp[i][v_zantei] = min(dp[i-1][v_zantei],dp[i-1][v_zantei - w_v[i][1]] + w_v[i][0])
            else:
                dp[i][v_zantei] = dp[i-1][v_zantei]
        #print(dp[i])
    else:
        dp[i][w_v[i][1]] = w_v[i][0]
        #print(dp[i])
ans = -1
for v in range(v_max-1,-1,-1):
    #print(w,dp[n-1][v],ans)
    if dp[n-1][v] <= w and ans < v:
        ##print(v)
        ans = v
print(ans)

Buggy submission (verdict: Runtime Error):
[n,w] = [int(i) for i in input().split()]
w_v = []
for i in range(n):
    w_v.append([int(j) for j in input().split()])

"""
dp[i][v] = w
i : 何番目までのものを使うか
v : ちょうどその価値になる
w : その時の重さ
最後に後ろから全探索して重さ超えてないやつ探す？
"""
INF = 20
v_max = 20
dp = [[INF] * (v_max) for i in range(n)]
##print(dp)
#価値0になるところの重さは0
for i in range(n):
    dp[i][0] = 0
for i in range(n):
    #print("step",i)
    if i != 0:
        for v_zantei in range(v_max):
            if v_zantei >= w_v[i][1]:
                dp[i][v_zantei] = min(dp[i-1][v_zantei],dp[i-1][v_zantei - w_v[i][1]] + w_v[i][0])
            else:
                dp[i][v_zantei] = dp[i-1][v_zantei]
        #print(dp[i])
    else:
        dp[i][w_v[i][1]] = w_v[i][0]
        #print(dp[i])
ans = -1
for v in range(v_max-1,-1,-1):
    #print(w,dp[n-1][v],ans)
    if dp[n-1][v] <= w and ans < v:
        ##print(v)
        ans = v
print(ans)
Problem p03166 (python)

Fixed submission:
import collections
import sys
sys.setrecursionlimit(10**6)

def getls():
    return [ipt for ipt in input().split()]
def getlsi():
    return [int(ipt) for ipt in input().split()]
#Topological sort Gは辞書として渡す
def tsort(N,G,dic):
    res = 0
    #Topological Sort
    if dic[N] != -1:
        return dic[N]
    for node in G[N]:
        res = max(res,tsort(node,G,dic)+1)
    dic[N] = res
    return dic[N]

[n,m] = getlsi()
dic_next = collections.defaultdict(list)
dp = [-1] * n
for i in range(m):
    [x,y] = getlsi()
    dic_next[x-1].append(y-1)
ans = 0
for i in range(n):
    ans = max(ans,tsort(i,dic_next,dp))
print(ans)

Buggy submission (verdict: Runtime Error):
import collections

def getls():
    return [ipt for ipt in input().split()]
def getlsi():
    return [int(ipt) for ipt in input().split()]
#Topological sort Gは辞書として渡す
def tsort(N,G,dic):
    res = 0
    #Topological Sort
    if dic[N] != -1:
        return dic[N]
    for node in G[N]:
        res = max(res,tsort(node,G,dic)+1)
    dic[N] = res
    return dic[N]

[n,m] = getlsi()
dic_next = collections.defaultdict(list)
dp = [-1] * n
for i in range(m):
    [x,y] = getlsi()
    dic_next[x-1].append(y-1)
ans = 0
for i in range(n):
    ans = max(ans,tsort(i,dic_next,dp))
print(ans)

Buggy submission (verdict: Runtime Error):
import collections

def getls():
    return [ipt for ipt in input().split()]
def getlsi():
    return [int(ipt) for ipt in input().split()]
#Topological sort Gは辞書として渡す Lは空のリスト
def tsort(N,G,dic):
    res = 0
    #Topological Sort
    if dic[N] != -1:
        return dic[N]
    for node in G[N]:
        res = max(res,tsort(node,G,dic)+1)
    dic[N] = res
    return dic[N]

[n,m] = getlsi()
dic_next = collections.defaultdict(list)
dp = [-1] * n
for i in range(m):
    [x,y] = getlsi()
    dic_next[x-1].append(y-1)
ans = 0
for i in range(n):
    ans = max(ans,tsort(i,dic_next,dp))
print(ans)
Problem p03167 (python)

Fixed submission:
[h,w] = [int(i) for i in input().split()]
mod = 10**9+7
a = [["#"]*(w+2)]
for i in range(h):
    tmp = ["#"]
    s = input()
    for j in range(w):
        tmp.append(s[j])
    tmp.append("#")
    a.append(tmp)
a.append(["#"]*(w+2))

dp = [[0]* (w+2) for i in range(h+2)]
addi = 1
for i in range(1,h+1):
    if a[i][1] == "#":
        addi = 0
    dp[i][1] += addi
addi = 1
for i in range(2,w+1):
    if a[1][i] == "#":
        addi = 0
    dp[1][i] += addi


for i in range(2,h+1):
    for j in range(2,w+1):
        if a[i][j] != "#":
            dp[i][j] = dp[i-1][j] + dp[i][j-1]
            dp[i][j] %= mod
print(dp[h][w])
#for i in range(h+2):
#    print(dp[i])

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**6)

[h,w] = [int(i) for i in input().split()]
mod = 10**9+7
a = [["#"]*(w+2)]
for i in range(h):
    tmp = ["#"]
    s = input()
    for j in range(w):
        tmp.append(s[j])
    tmp.append("#")
    a.append(tmp)
a.append(["#"]*(w+2))


dp = [[0]* (w+2) for i in range(h+2)]
addi = 1
for i in range(1,h+1):
    if a[1][i] == "#":
        addi = 0
    dp[1][i] += addi
addi = 1
for i in range(1,w+1):
    if a[i][1] == "#":
        addi = 0
    dp[i][1] += addi
"""
#print(dp)
def rec(stage,y,x,dp_c):
    #print(y,x)
    if stage[y][x] == "#":
        return 0
    else:
        dp_c[y][x] = max(dp_c[y][x],rec(stage,y-1,x,dp_c) + rec(stage,y,x-1,dp_c))%(10**9+7)
        return dp_c[y][x]
rec(a,h,w,dp)
"""
for i in range(2,h+1):
    for j in range(2,w+1):
        if a[i][j] != "#":
            dp[i][j] = dp[i-1][j] + dp[i][j-1]
            dp[i][j] %= mod
print(dp[h][w])
#for i in range(h+2):
#    print(dp[i])
Problem p03241 (python)

Fixed submission:
[n,m] = [int(i) for i in input().split()]
if n == 1:
    print(m)
else:
    ans = -1
    #a1は高々この値
    a1_max = m // n
    for i in range(a1_max,0,-1):
        if (m - i) % i == 0 and (m - i)//i >= (n-1):
            ans = max(ans,i)
    print(ans)

Buggy submission (verdict: Runtime Error):
[n,m] = [int(i) for i in input().split()]
if n == 1:
    print(m)
else:
    ans = -1
    #a1は高々この値
    a1_max = m // n
    for i in range(a1_max,0,-1):
        if (m - i) % i == 0 and (m - i)//i >= (n-1):
            ans = max(ans,ls[-1])
    print(ans)

Buggy submission (verdict: Runtime Error):
[n,m] = [int(i) for i in input().split()]
a=[]
import math
for i in range(1,math.floor(m**(1/2))):
    if m % i == 0 and i <= m//n:
        a.append(i)

print(a[len(a)-1])
Problem p03262 (python)

Fixed submission:
import math
[n,x] = [int(i) for i in input().split()]
xs = [int(i) for i in input().split()]
if n != 1:
    xs.append(x)
    xs.sort()
    diff = []
    for i in range(1,n+1):
        diff.append(xs[i] - xs[i-1])
    ans = 0
    for i in range(1,len(diff)):
        if i == 1:
            ans = math.gcd(diff[i-1],diff[i])
        else:
            ans = math.gcd(ans,diff[i])
    print(ans)
else:
    print(abs(x - xs[0]))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

[n,x] = [int(i) for i in input().split()]
xs = [int(i) for i in input().split()]
xdiff = []

for i in xs:
    xdiff.append(abs(x - i))

print(gcd_list(xdiff))
Problem p03280 (python)

Fixed submission:
[a,b]=[int(i) for i in input().split()]
print((a-1)*(b-1))

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
print((a-1)*(b-1))
Problem p03302 (python)

Fixed submission:
[a,b]=[int(i) for i in input().split()]
if a*b==15:
    print("*")
elif a+b==15:
    print("+")
else:
    print("x")

Buggy submission (verdict: Runtime Error):
[a,b]=[int(i) for i in input().split()]
if a*b=15:
    print("*")
elif a+b=15:
    print("+")
else:
    print("x")