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

Fixed submission:
h,w,m=map(int,input().split())
g=[]
e1=[0]*h
e2=[0]*w
for c in range(m):
    a,b=map(int,input().split())
    g.append([a-1,b-1])
    e1[a-1]+=1
    e2[b-1]+=1
p1=max(e1)
p2=max(e2)
x=[1 if e1[c]==p1 else 0 for c in range(h)]
y=[1 if e2[c]==p2 else 0 for c in range(w)]
r=sum(x)*sum(y)
for i in g:
    if x[i[0]]==1 and y[i[1]]==1:
        r-=1
if r==0:
    print(p1+p2-1)
else:
    print(p1+p2)

Buggy submission (verdict: Runtime Error):
h,w,m=map(int,input().split())
g=[]
e1=[0]*h
e2=[0]*w
for c in range(m):
    a,b=map(int,input().split())
    g.append([a-1,b-1])
    e1[a-1]+=1
    e2[b-1]+=1
p1=max(e1)
p2=max(e2)
x=[1 if e1[c]==p1 else 0 for c in range(h)]
y=[1 if e2[c]==p2 else 0 for c in range(w)]
r=sum(x)*sum(y)
for i in g:
    if x[i[0]]==1 and y[i[1]]==1:
        r-=1
if r==0:
    print(p+q-1)
else:
    print(p+q)

Buggy submission (verdict: Runtime Error):
h,w,m=map(int,input().split())
g=[]
e1=[0]*h
e2=[0]*w
for c in range(m):
    a,b=map(int,input().split())
    g.append([a-1,b-1])
    e1[a-1]+=1
    e2[b-1]+=1
p1=max(e1)
p2=max(e2)
x=[c for c in range(h) if e1[c]==p1]
y=[c for c in range(w) if e2[c]==p2]
if len(x)*len(y)>m:
    print(p1+p2)
    exit()
for i in x:
    for j in y:
        if [i,j] not in g:
            print(p1+p2)
            exit()
print(p+q-1)
Problem p02623 (python)

Fixed submission:
n,m,k=map(int,input().split())
a=[int(x) for x in input().split()]
b=[int(x) for x in input().split()]
t=0
for p in range(n):
    if t+a[p]>k:
        p-=1
        break
    t+=a[p]
for q in range(m):
    if t+b[q]>k:
        q-=1
        break
    t+=b[q]
ans=p+q+2
if q<m-1:
    z=ans
    q+=1
    for s in range(p,-1,-1):
        t-=a[s]
        z-=1
        while q<m and t+b[q]<=k:
            t+=b[q]
            q+=1
            z+=1
        if z>ans:
            ans=z
        if q==m:
            break
print(ans)

Buggy submission (verdict: Runtime Error):
n,m,k=map(int,input().split())
a=[int(x) for x in input().split()]
b=[int(x) for x in input().split()]
t=0
for p in range(n):
    if t+a[p]>k:
        p-=1
        break
    t+=a[p]
for q in range(m):
    if t+b[q]>k:
        q-=1
        break
    t+=b[q]
ans=p+q+2
if q==m-1:
    print(ans)
else:
    z=ans
    r=0
    for r in range(p,-1,-1):
        t-=a[q]
        z-=1
        while r<m and t+b[r]<=k:
            t+=b[r]
            r+=1
            z+=1
        if z>ans:
            ans=z
        if r==m-1:
            break
    print(ans)
Problem p02915 (python)

Fixed submission:
n=int(input())
print(n*n*n)

Buggy submission (verdict: Runtime Error):
n=input()
print(n*n*n)
Problem p02623 (python)

Fixed submission:
import sys
n, m, k = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a, b = [0], [0]
for i in range(n):
  a.append(a[i] + A[i])
for i in range(m):
  b.append(b[i] + B[i])

ans = 0
j = m
for i in range(n + 1):
  if a[i] > k:
    break
  while a[i] + b[j] > k:
      j -= 1
  ans = max(ans, i + j)
    
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
n, m, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))

for i in range(1,n):
  a[i] += a[i-1]
for i in range(1,m):
  b[i] += b[i-1]
a_max = 0
for i in range(n, 0, -1)
  if a[i-1] <= k:
    a_max = i
    break
b_max = 0
for i in range(m, 0, -1)
  if a[i-1] <= k:
    b_max = i
    break
    
ans = 0
for i in range(a_max, 0, -1):
  p = 0
  q = 0
  if a[i-1] <= k:
    p = a[i-1]
    q = i
  for j in range(b_max, 0, -1):
    if p + b[j-1] <= k:
      ans = max(ans, q + j)
    
print(ans)
Problem p02970 (python)

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

Buggy submission (verdict: Runtime Error):
a, b=list(map(int, input()))
print((a-1)/(2*b + 1)/1)
Problem p02572 (python)

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

mod=10**9+7

B=[0]
for i in range(1,N+1):
    B.append(A[i-1]+B[i-1])

ans=0
for i in range(N-1):
    ans+=A[i]*(B[N]-B[i+1])
    ans%=mod

print(int(ans))

Buggy submission (verdict: Runtime Error):
sum_all=[]
for i in range(N-1):
    for j in range(i+1,N):
        A[i]=A[i]%mod
        A[j]=A[j]%mod
        sum_all.append((A[i])*(A[j]))

sum=0
for n in sum_all:
    sum+=n
print(sum%mod)
Problem p02578 (python)

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

sum=0
MaxNum=0
for i in range(N):
    MaxNum=max(MaxNum,A[i])
    B=MaxNum
    sum+=MaxNum-A[i]
    
print(sum)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
sum=0
for i in range(1,n):
    if x[i]<x[i-1]:
        t=x[i-1]-x[i]
        sum+=t
        x[i]=x[i-1]

print(sum)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
sum=0
for i in range(1,n):
    if x[i]<x[i-1]:
        t=x[i-1]-x[i]
        sum+=t

print(sum)
Problem p02570 (python)

Fixed submission:
D, T, S = [int(i) for i in input().split()]

if(D/S <= T):
  print("Yes")
else:
  print("No")

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

N = int(input())
A = np.array([int(i) for i in input().split()])
sum = 0

#累積和、二乗和の両方で1項ずつ求めてmodをとる
for x in A:
  sum += x
  sum %= (10**9+7)
#sum = A.sum() % (10**9+7)

sum2 = 0
for x in A:
  sum2 += x*x
  sum2 %= (10**9+7)
#sum2 = (A**2).sum() % (10**9+7)

ans = (sum**2 - sum2) % (10**9+7)
if ans < 0:
  ans += (10**9+7)
ans *= int((10**9+7+1)/2) 
ans %= (10**9+7)
print(int(ans))
Problem p02959 (python)

Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
B.append(0)

ans = 0
for i in range(N+1):
  taosukazu1 = min(A[i],B[i])
  B[i] -= taosukazu1
  A[i] -= taosukazu1
  ans += taosukazu1
  if B[i] > 0:
    taosukazu2 = min(A[i+1],B[i])
    B[i] -= taosukazu2
    A[i+1] -= taosukazu2
    ans += taosukazu2
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
B.append(0)

ans = 0
for i in range(N+1):
  taosukazu1 = min(A[i],B[i])
  B[i] -= taosukazu1
  A[i] -= taosukazu1
  ans += taosukazu1
  print(A)
  print(B)
  if B[i] > 0:
    taosukazu2 = min(A[i+1],B[i])
    B[i] -= taosukazu2
    A[i] -= taosukazu2
    ans += taosukazu2
print(ans)
Problem p02624 (python)

Fixed submission:
def main():
    import sys
    N=int(sys.stdin.readline())
    r=0
    for i in range(1,N+1):
        r+=(i+N-N%i)*(N//i)//2

    print(r)

    
main()

Buggy submission (verdict: Runtime Error):
def main():
    import sys
    N=int(sys.stdin.readline())
    r=0
    for i in range(1,N+1):
        r+=(i+N-N%i)*(N//i)//2
        print(i,r,(i+N-N%i)*(N//i)//2,N-N%i)

    
main()
Problem p02729 (python)

Fixed submission:
import math
def cmb(n, r):
    if n<2:
        return 0

    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def main():
    import sys
    N,M=list(map(int,sys.stdin.readline().split()))
    print(cmb(M,2)+cmb(N,2))


main()

Buggy submission (verdict: Runtime Error):
import math
def cmb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def main():
    import sys
    N,M=list(map(int,sys.stdin.readline().split()))
    print(cmb(M,2)+cmb(N,2))


main()

Buggy submission (verdict: Runtime Error):
from scipy.special import comb 

def cmb(n,r):
    return comb(n, r, exact=True)

def main():
    import sys
    N,M=list(map(int,sys.stdin.readline().split()))
    print(cmb(M,2)+cmb(N,2))


main()
Problem p02831 (python)

Fixed submission:

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

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

    
    return lcm(A,B)
print(solve())

Buggy submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
def solve():

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

    
    return lcm(A,B)
print(solve())

Buggy submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
def solve():

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

    
    return lcm(A,B)
print(solve())
Problem p02862 (python)

Fixed submission:
from operator import mul
from functools import reduce

def cmb(n, r, mod,g1,g2):

    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod


def solve():
    X,Y=[int(x) for x in input().split()]
    if (2*Y-X)%3 or (2*X-Y)%3:
        return 0
    
    a=(2*X-Y)//3
    b=(2*Y-X)//3
    

    n=a+b
    r=a

    g1 = [1, 1] # 元テーブル
    g2 = [1, 1] #逆元テーブル
    inverse = [0, 1] #逆元テーブル計算用テーブル
    mod = 10**9+7
    N = 10**6
    for i in range( 2, N + 1 ):
        g1.append( ( g1[-1] * i ) % mod )
        inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
        g2.append( (g2[-1] * inverse[-1]) % mod )
        
    return cmb(n,r,mod,g1,g2)

    
print(solve())

Buggy submission (verdict: Runtime Error):
import math

def solve():
    X,Y=[int(x) for x in input().split()]
    if (2*Y-X)%3 or (2*X-Y)%3:
        return 0
    
    a=(2*X-Y)//3
    b=(2*Y-X)//3

    n=a+b
    r=a
    return (math.factorial(n) // (math.factorial(n - r) * math.factorial(r)))%(10**9+7)

    
print(solve())
Problem p02891 (python)

Fixed submission:

def solve():
  S=input()
  K=int(input())
  if len(S)==1:
    return K//2
  count=1
  L=[]
  for i in range(len(S)):
      try:
          if S[i] == S[i+1]:
             count = count + 1
          else:
              L.append(count)
              count = 1
      except:
          # 最後の文字セットがOutOfRangeになるので結果に出力
          L.append(count)

  if S[-1]==S[1]:
    flag=0
    if len(L)==1:
      return len(S)*K//2
    else:
      if L[-1]%2==1 and L[0]%2==1:
        flag=1
      L[0]=(L[0]+L[-1])//2*2
      L[-1]=0
    return sum([x//2 for x in L])*K-flag
  else:
    return sum([x//2 for x in L])*K

print(solve())

Buggy submission (verdict: Runtime Error):
S=input()
K=int(input())

count=1
L=[]
for i in range(len(S)):
    try:
        if S[i] == S[i+1]:
           count = count + 1
        else:
            L.append(count)
            count = 1
    except:
        # 最後の文字セットがOutOfRangeになるので結果に出力
        L.append(count)

if S[-1]==S[1]:
  flag=0
  if len(L)==1:
    print(len(S)*K//2)
  else:
    if L[-1]%2==1 and L[0]%2==1:
      flag=1
    L[0]=(L[0]+L[-1])//2*2
    L[-1]=0
    print(sum([x//2 for x in L])*K-flag)
else:
  print(sum([x//2 for x in L])*K)
Problem p02970 (python)

Fixed submission:
import math
def Solve():
    N,D=[int(x) for x in input().split()]
    return math.ceil(N/(D*2+1))
print(Solve())

Buggy submission (verdict: Runtime Error):
N,D=[int(x) for x in input().split()]
if( N/D < N- D*2){
 print(int(N/D)) 
}else{
 print(int(N/D)+1)
}

Buggy submission (verdict: Runtime Error):
N,D=[int(x) for x in input().split()]
if( N/D < N- D*2){
 console.log(Math.floor(N/D)) 
}else{
 console.log(Math.floor(N/D)+1)
}
Problem p03038 (python)

Fixed submission:
import bisect
N,M=(int(x) for x in input().split())
As=sorted([int(x) for x in input().split()])
BC=[]

result=0
for _ in range(M):
    BC.append([int(x) for x in input().split()])

BC=sorted(BC, key=lambda x: x[1],reverse=True)
now=0
for b,c in BC:
    if now+b-1<=len(As)-1:
        if As[now+b-1]<=c:
            result+=c*b
            now+=b
        else:
            pos=bisect.bisect_left(As[now:],c)
            result+=c*pos
            now+=pos
            break
    else:
        if As[-1]<=c:
            result+=c*(N-now)
            As=[]
        else:
            pos=bisect.bisect_left(As[now:],c)
            result+=c*pos
            now+=pos
        break
        
print(result+sum(As[now:]))

Buggy submission (verdict: Runtime Error):
import bisect
N,M=(int(x) for x in input().split())
As=sorted([int(x) for x in input().split()])
BC=[]

result=0
for _ in range(M):
    BC.append([int(x) for x in input().split()])

BC=sorted(BC, key=lambda x: x[1],reverse=True)
now=0
for b,c in BC:
    if now+b-1<=len(As)-1:
        if As[now+b-1]<=c:
            result+=c*b
            now+=b
        else:
            pos=bisect.bisect_left(As[now:],c)
            result+=c*pos
            now+=pos
            break
    else:
        if As[-1]<=c:
            result+=c*(N-now)
            As=[]
        else:
            pos=bisect.bisect_left(As[now:],c)
            result+=c*pos
            now+=pos
            break
        
print(result+sum(As[now:]))

Buggy submission (verdict: Runtime Error):
import bisect
N,M=(int(x) for x in input().split())
As=sorted([int(x) for x in input().split()])
BC=[]

result=0
for _ in range(M):
    BC.append([int(x) for x in input().split()])

BC=sorted(BC, key=lambda x: x[1],reverse=True)
now=0
for b,c in BC:
    if As[now+min(b-1,len(As)-1)]<=c:
        result+=c*b
        now+=b
    else:
        pos=bisect.bisect_left(As[now:],c)
        result+=c*pos
        now+=pos
        break
        
print(result+sum(As[now:]))

Buggy submission (verdict: Runtime Error):
import bisect
N,M=(int(x) for x in input().split())
As=sorted([int(x) for x in input().split()])
BC=[]

result=0
for _ in range(M):
    BC.append([int(x) for x in input().split()])

BC=sorted(BC, key=lambda x: x[1],reverse=True)

for b,c in BC:
    if As[b-1]<=c:
        result+=c*b
        As=As[b:]
    else:
        pos=bisect.bisect_left(As,c)
        result+=c*pos
        As=As[pos:]
        break
        
print(result+sum(As))
Problem p02623 (python)

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

A, B = [0], [0]
for i in range(n):
    A.append(A[i] + a[i])
for i in range(m):
    B.append(B[i] + b[i])

ans, j = 0, m
for i in range(n+1):
    if A[i] > k:
        break
    while B[j] > k - A[i]:
        j -= 1
    ans = max(ans, i+j)
print(ans)

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

A = [0], B = [0]
for i in range(n):
    A.append(A[i] + a[i])
for i in range(m):
    B.append(B[i] + b[i])

ans, j = 0, m
for i in range(n+1):
    if A[i] > k:
        break
    while B[j] > k - A[i]:
        j -= 1
    ans = max(ans, i+j)
print(ans)
Problem p02723 (python)

Fixed submission:
s = input()
if s[2] == s[3] and s[4] == s[5]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s = input()
if s[2] == s[3] and s[4] == s[5]:
    print("Yes")
else:
    pritn("No")
Problem p02547 (python)

Fixed submission:
N = int(input())
count = 0
count_max = count
for i in range(N):
    di_1, di_2 = [int(i) for i in input().split()]
    if di_1 == di_2:
        count += 1
    else:
        count_max = max([count_max, count])
        count = 0
count_max = max([count_max, count])
if count_max >= 3:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
count = 0
for i in range(N):
    di_1, di_2 = int(input().split())
    if di_1 == di_2:
        count += 1
    else:
        count = 0
if count >= 3:
    print("Yes")
else:
    print("No")
Problem p02570 (python)

Fixed submission:
D, T, S = [int(i) for i in input().split()]
t = D / S
if t > T:
    print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
N = int(input())
n = 10 ** 9 + 7
A_n = [int(i) % n for i in input().split()]
A_n_mod = sum([(A_n[i] * A_n[j]) % n for i in range(N-1) for j in range(i+1, N, 1)])
res = A_n_mod % n
print(res)
Problem p02594 (python)

Fixed submission:
x = int(input())
if x>= 30:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
x = input()
if x >= 30:
  print("Yes")
else:
  print("No)
Problem p02595 (python)

Fixed submission:
import math
n, d = [int(i) for i in input().split()]
points = []
for i in range(n):
  points.append([int(x) for x in input().split()])
print(len([p for p in points if math.sqrt(p[0]**2+p[1]**2) <= d]))

Buggy submission (verdict: Runtime Error):
import math
n, d = input().split()
points = []
for i in range(n):
  points.append([int(x) for x in input().split()])
print(len([p for p in points if math.sqrt(p[0]**2+p[1]**2) <= d]))
Problem p02578 (python)

Fixed submission:
N = int(input())
a = [int(s) for s in input().split()]
b = int(0)

for i in range(N-1):
  if a[i] <= a[int(i+1)]:
    pass
  else:
    b = b + (a[i] - a[int(i+1)])
    a[int(i+1)] = a[i]

print(b)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = [int(s) for s in input().split()]
b = int(0)

for i in range(N):
  if a[i] <= a[int(i+1)]:
    pass
  else:
    b = b + (a[i] - a[int(i+1)])
    a[int(i+1)] = a[i]

print(b)
Problem p02580 (python)

Fixed submission:
import collections
a = input().split()
M = int(a[2])
hidari = []
migi = []
c = []
 
for i in range(M):
  b = input().split()
  hidari.append(b[0])
  migi.append(b[1])
  c.append(b)
  
countleft = collections.Counter(hidari)
countright = collections.Counter(migi)
leftmax = countleft.most_common()[0][1]
rightmax = countright.most_common()[0][1]
tempmax = int(leftmax + rightmax)
 
leftkeys = [k for k, v in countleft.items() if v == leftmax]
rightkeys = [k for k, v in countright.items() if v == rightmax]
 
leftkeyN = int(len(leftkeys))
rightkeyN = int(len(rightkeys))
flag = int(0)
cnt = int(0)
#これで左右の最頻回数はOK
#左右の最頻奴も探した
#ここから最頻同志になってるやつを探す
 
for i in range(M):
    goukei = int(countleft.get(c[i][0])) + int(countright.get(c[i][1]))
    if goukei == tempmax:
        cnt += 1
    else:
        pass

if cnt == int(leftkeyN * rightkeyN):
    print(int(tempmax - 1))
else:
    print(int(tempmax))

Buggy submission (verdict: Runtime Error):
import collections
a = input().split()
M = int(a[2])
hidari = []
migi = []
c = []
 
for i in range(M):
  b = input().split()
  hidari.append(b[0])
  migi.append(b[1])
  c.append(b)
  
countleft = collections.Counter(hidari)
countright = collections.Counter(migi)
leftmax = countleft.most_common()[0][1]
rightmax = countright.most_common()[0][1]
tempmax = int(leftmax + rightmax)
 
leftkeys = [k for k, v in countleft.items() if v == leftmax]
rightkeys = [k for k, v in countright.items() if v == rightmax]
 
leftkeyN = int(len(leftkeys))
rightkeyN = int(len(rightkeys))
flag = int(0)
cnt = int(0)
#これで左右の最頻回数はOK
#左右の最頻奴も探した
#ここから最頻同志になってるやつを探す
 
for T in range(M):
    if c[T][0] in leftkeys:
      if c[T][1] in rightkeys:
        cnt = cnt + 1
      else:
        pass
    else:
      pass
 
 
if cnt == int(leftkeyN * rightkeyN):
    print(int(tempmax - 1))
else:
    print(int(tempmax)
Problem p03785 (python)

Fixed submission:
a = [int(s) for s in input().split()]
N = a[0]
si = a[1]
ti = a[2]
s = [int(input()) for i in range(N)]
s = sorted(s)
X = int(0)
ans = int(0)

#全員乗るまで繰り返す
while N != X:
    #まずバスを用意して先頭を乗せる
    X += 1 
    ans += 1
    #この時点で全員乗ったら終わりにする
    if N == X:
        break
    #バスの残りsi-1枠に乗れるだけ乗せる
    #そもそも乗客がsi-1人もいない場合は残りのN-X人が上限
    temp = X
    for i in range(min([si-1,N-X])):
        if s[temp + i] <= s[temp-1] + ti:
            X += 1
        else:
            break

print(ans)

Buggy submission (verdict: Runtime Error):
a = [int(s) for s in input().split()]
N = a[0]
si = a[1]
ti = a[2]
s = [int(input()) for i in range(N)]
s = sorted(s)
X = int(0)
ans = int(0)

while N != X:
    X += 1 
    ans += 1
    if N == X:
        break
    for i in range(min([si-1,N-X])):
        if s[X + i] <= s[X-1] + ti:
            X += 1
        else:
            break

print(ans)

Buggy submission (verdict: Runtime Error):
a = [int(s) for s in input().split()]
N = a[0]
si = a[1]
ti = a[2]
s = [int(input()) for i in range(N)]
s = sorted(s)
X = int(0)
ans = int(0)

while N != X:
    X += 1 
    ans += 1
    if N == X:
        break
    for i in range(min([si-1,N-X])):
        if s[X + i] < s[X-1] + ti:
            X += 1
        else:
            break

print(ans)
Problem p02546 (python)

Fixed submission:
S = input()
if S.endswith('s'):
  print(S+'es')
else:
 print(S+'s')

Buggy submission (verdict: Runtime Error):
S = input()
if S.endswith('s'):
  print(S+'es')
else
 print(S+'s')

Buggy submission (verdict: Runtime Error):
a = input().split()
if a.endswith('e') :
 print(a+'s')
elif  a.endswith('s'):
 print(a+'es')
else:
 print(a)

Buggy submission (verdict: Runtime Error):
a = map(int, input().split())
if a.endswith('e'):
 print(a+'s')
elif  a.endswith('s'):
 print(a+'es')
else:
 print(a)
Problem p02571 (python)

Fixed submission:
s = input()
t = input()
if len(s) == len(t):
  a = 0
  for i in range(len(t)):
    if s[i] == t[i]:
      a+=1
  print(len(s)-a)
  exit(0)
g = []
for i in range(len(s)-len(t)):
  n = 0
  for j in range(len(t)):
    if s[i+j]==t[j]:
      n+=1
  g.append(len(t)-n)
print(min(g))

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
g = []
for i in range(len(s)-len(t)):
  n = 0
  for j in range(len(t)):
    if s[i+j]==t[j]:
      n+=1
  g.append(len(t)-n)
print(min(g))
Problem p02629 (python)

Fixed submission:
n = int(input())
a = ['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']
b = ''
def Base_10_to_n(X, n):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = a[X_dumy%n-1]+out
        if a[X_dumy%n-1] == 'z':
          X_dumy -= 26
        X_dumy = X_dumy//n
    return out

z = Base_10_to_n(n, 26)
print(z)

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

def change(): #ここに数字からアルファベットを1体1で対応させれば終わり

p=[]
while n>0:
  a=n%26
  p.append(a)
  n=n//26

for i in range(len(p)):
  p[i]=change(p[i])

p.reverse()  

b=''

for i in range(len(p)):
  b += p[i]
  
print(b)
Problem p02570 (python)

Fixed submission:
dts = input().split()
D = int(dts[0])
T = int(dts[1])
S = int(dts[2])

if T*S >= D:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
strS = input()
strT = input()

maxRange = 0
l = 0
while l <= (len(strS)-len(strT)):
    m = 0
    count = 0
    while m < (len(strT)):
        if strS[l+m] != strT[m]:
            count += 1
        m += 1
    if maxRange > count:
        maxRange = count
    l += 1

print(maxRange)

Buggy submission (verdict: Runtime Error):
strings = input().splitlines()

# 一致している数の最大値を取得する。
# そして、その一致している数と、Tの数を比較する。足りない文字数を補うと良い

strS = list(strings[0])
strT = list(strings[1])

maxRange = 0
l = 0
while l < (len(strS)-len(strT)):
    m = 0
    count = 0
    while m < (len(strT)):
        if strS[l+m] == strT[m]:
            count += 1
        m += 1
    if maxRange < count:
        maxRange = count
    l += 1
print(len(strT)-maxRange)