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

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
list1 = []
ame = A[0]
for i in range(N-1):
  list1.append(sum(A[:i+1])+sum(B[i:]))
  
if list1 == []:
  print(A[0]+B[0])
else:
  print(max(list1))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
list1 = []
ame = A[0]
for i in range(N-1):
  list1.append(sum(A[:i+1])+sum(B[i:]))
  
if list1 = []:
  print(A[0]+b[0])
else:
  print(max(list1))

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

for i in range(N-1):
  list1.append(sum(A[:i+1])+sum(B[i:]))
print(max(list1))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
list1 = []
ame = A[0]
for i in range(N-1):
  list1.append(sum(A[:i+1])+sum(B[i:]))
print(max(list1))
Problem p03545 (python)

Fixed submission:
S = [a for a in input()]
N = [int(a) for a in S]
M = [N[0]] + [-N[i] for i in range(1,4)]

S.insert(1, '+')
S.insert(3, '+')
S.insert(5, '+')

if sum(N) == 7:
    S = S
    print(''.join(S) + '=7')
    exit()

for i in range(1, 4):
    N[i] = -N[i]
    
    if sum(N) == 7:
        
        S[2 * i - 1] = '-'
        print(''.join(S) + '=7')
        exit()
    else: N[i] = -N[i]

for i in range(1, 4):
    S[1], S[3], S[5] = '-', '-', '-'
    
    M[i] = -M[i]
    
    if sum(M) == 7:
        S[2 * i - 1] = '+'
        print(''.join(S) + '=7')
        exit()
    else:
      M[i] = -M[i]

Buggy submission (verdict: Runtime Error):
S = [a for a in input()]
N = [int(a) for a in S]
M = [N[i] for i in range(1,4)]
S.insert(1, '+')
S.insert(3, '+')
S.insert(5, '+')

if sum(N) == 7:
    S = S
    print(''.join(S) + '=7')
    exit()

for i in range(1, 4):
    N[i] = -N[i]

    if sum(N) == 7:
        S[2 * i - 1] = '-'
        print(''.join(S) + '=7')
        exit()

for i in range(1, 4):
    S[1], S[3], S[5] == '-', '-', '-'
    M[i] = -M[i]
    if sum(M) == 7:
        S[2 * i - 1] = '+'
        print(''.join(S) + '=7')
        exit()

Buggy submission (verdict: Runtime Error):
S = [a for a in input()]
N = [int(a) for a in S]
M = [-N[i] for i in range(1,4)]
S.insert(1, '+')
S.insert(3, '+')
S.insert(5, '+')

if sum(N) == 7:
    S = S
    print(''.join(S) + '=7')
    exit()

for i in range(1, 4):
    N[i] = -N[i]

    if sum(N) == 7:
        S[2 * i - 1] = '-'
        print(''.join(S) + '=7')
        exit()

for i in range(1, 4):
    M[i] = -M[i]
    if sum(M) == 7:
        S[2 * i - 1] = '+'
        print(''.join(S) + '=7')
        exit()

if N[0] + N[1] - N[2] - N[3] == 7:
    S[3] = '-'
    S[5] = '-'
elif N[0] - N[1] + N[2] - N[3] == 7:
    S[1] = '-'
    S[5] = '-'
elif N[0] - N[1] - N[2] + N[3] == 7:
    S[1] = '-'
    S[5] = '-'
print(''.join(S) + '=7')
Problem p03574 (python)

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

s = [['.']*(w+2)]+ [list('.'+ input() + '.') for i in range(h)] + [['.']*(w+2)]
a = [[0]*w for i in range(h)]


for i in range(1, h+1):
  for j in range(1,w+1):
    if s[i][j] == '#':
      a[i-1][j-1] = '#'
    else:
      b = [s[i-1][j-1],s[i-1][j], s[i-1][j+1], s[i][j-1], s[i][j+1], s[i+1][j-1], s[i+1][j], s[i+1][j+1]]
      c = b.count('#')
           
      a[i-1][j-1] = c

for i in range(h):
  a[i] = [str(x) for x in a[i]]
  print(''.join(a[i]))

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())

S = [list(input()) for i in range(H)]
for i in range(1,H-1):
  for j in range(1,W-1):
    if S[i][j] == '.':
      x = [S[i-1][j-1], S[i-1][j], S[i-1][j+1], S[i][j-1], S[i][j+1],S[i+1][j-1], S[i+1][j],S[i+1][j+1]]
      S[i][j] = x.count('#')

for j in range(1,W-1):
  if S[0][j] == '.':
    x = [S[0][j-1], S[0][j+1], S[1][j-1], S[1][j], S[1][j+1]]
    S[0][j] = x.count('#')
    
  if S[H-1][j] == '.':
    x = [S[H-1][j-1], S[H-1][j+1], S[H-2][j-1], S[H-2][j], S[H-2][j+1]]
    S[H-1][j] = x.count('#')

for i in range(1, H-1):
  if S[i][0] == '.':
    x =[S[i-1][0],S[i-1][1],  S[i][1], S[i+1][0], S[i+1][1]]
    S[i][0] = x.count('#')
  if S[i][W-1] == '.':
    x =[S[i-1][W-1],S[i-1][W-2],  S[i][W-2], S[i+1][W-1], S[i+1][W-2]]
    S[i][W-1] = x.count('#')

if S[0][0] == '.':
  x = [S[0][1], S[1][0], S[1][1]]
  S[0][0] =x.count('#')
if S[H-1][0] == '.':
  x = [S[H-1][1], S[H-2][0], S[H-2][1]]
  S[H-1][0] = x.count('#')
if S[0][W-1] == '.':
  x = [S[0][W-2], S[1][W-1], S[1][W-2]]
  S[0][W-1] = x.count('#')
if S[H-1][W-1] == '.':
  x = [S[H-1][W-2], S[H-2][W-1], S[H-2][W-2]]
  S[H-1][W-1] = x.count('#')

for i in range(len(S)):
  S[i] = [str(x) for x in S[i]]
  print(''.join(S[i]))
Problem p03627 (python)

Fixed submission:
import collections
n = int(input())
aa = list(map(int, input().split()))
ca = collections.Counter(aa)
la = sorted([a for a in ca.items()], key = lambda x:x[0], reverse=True)

list1 = []
list2 = []

for a in la:
  if a[1] > 1:
    list1.append(a)
  if a[1] >3:
    list2.append(a)
    
if len(list1) > 1:    
    xr = list1[0][0] * list1[1][0]
else:
  xr = 0
    
if len(list2) > 0:
  xs = list2[0][0] * list2[0][0]
else:
  xs = 0
  
ans = max(xr, xs)

print(ans)

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

for a in aa:
  if aa.count(a) > 1:
    bb.add(a)
  if aa.count(a) >3:
    cc.add(a)
    
m1 = max(bb)
bb.remove(m1)
m2 = max(bb)

if len(cc) > 0:
  y = max(cc)
else:
  y = 0

if len(bb) >= 2:
  ans = max(m1*m2, y*y)
else:
  ans = max(0, y*y)
print(ans)
Problem p03951 (python)

Fixed submission:
n = int(input())
s = input()
t = input()
x = 2 * n
for i in range(n):
  if t.startswith(s[i:]):
    x = n + i
    print(x)
    exit()
print(x)

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

for i in range(n):
  if t.startswith(s[i:]):
    x = n + i

print(x)
Problem p04043 (python)

Fixed submission:
abc = list(input().split())

if abc.count('5') == 2 and abc.count('7') == 1:
  print('YES')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
N, L = map(int, input().split())
S = sorted([input() for i in range(N)])
print(''.join(S))
Problem p02715 (python)

Fixed submission:
n,k=map(int,input().split())
INF=10**9+7
baisu= [[] for _ in [0]*(k+1)]
D=[0]*(k+1)
ans=0
for d in range(1,k+1):
    baisu[d]=[d*i for i in range(2,k//d+1)]
    D[d]=pow(k//d,n,INF)

for d in range(k,0,-1):
    for b in baisu[d]:
        D[d]-=D[b]
    D[d]%=INF
for i,x in enumerate(D):
    #ans+=(i*x)%INFだとだめだった  ansを%INF
    ans=(ans+i*x)%INF
    
#print(baisu)
#print(D)
print(ans)

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

#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)

#define INF 2e9
#define ALL(v) v.begin(), v.end()

int k;
int memo[200+1][200+1];
ll N=1000000000+7;

int gcd(int x,int y){
    if(y==0){
        return x;
    }
    return gcd(y,x%y);
}

int main(){
    cin>>k;
    int ans=0;
    for(int a=1;a<=k;a++){
        for(int b=1;b<=k;b++){
            for(int c=1;c<=k;c++){
                ans+=gcd(gcd(a,b),c)%N;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}
Problem p02755 (python)

Fixed submission:
a,b=map(int,input().split())
ans=0
flag=False
for i in range(b*10,(b+1)*10):
    x=i*8
    if 100*(a+1)>x>=100*a:
        flag=True
        ans=i
        break
print(ans if flag else -1)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
ans=0
flag=False
for i in range(b*10,(b+1)*10+1):
    x=i*8
    if 100*(a+1>x>=100*a:
        flag=True
        ans=i
        break
print(ans if flag else -1)
Problem p02756 (python)

Fixed submission:
#abc 158 d
from collections import deque
x=deque()
flag=True # muki  true: migi false: hidari
s=input()
x.append(s)
q=int(input())
cnt=0
for i in range(q):
    line=list(input().split())
    if len(line)==1:
        cnt+=1
        if cnt%2==1:
            flag=False
        else:
            flag=True
    else:
        t=line[2]
        if line[1]=="1":
            if flag==True:
                x.appendleft(t)
            else:
                x.append(t)
        else:
            if flag==True:
                x.append(t)
            else:
                x.appendleft(t)
ans="".join(x)
if flag==False:
    ans=ans[::-1]
print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
q=int(input())
for i in range(q):
    line=list(input().split())
    if line[0]==1:
        s=s[::-1]
    else:
        t=line[2]
        if line[1]==1:
            s=t+s 
        else:
            s=s+t
print(s)
Problem p02760 (python)

Fixed submission:
#157 b
a=[]
call_num=[]
for i in range(3):
    x,y,z=map(int,input().split())
    a.append(x)
    a.append(y)
    a.append(z)
n=int(input())
for i in range(n):
    x=int(input())
    if x in a:
        call_num.append(a.index(x))
bingo=False
ans=[[0,1,2],[3,4,5],[6,7,8],[0,3,6],[1,4,7],[2,5,8],[0,4,8],[2,4,6]]
for x in ans:
    flag=True
    for y in x:
        if y not in call_num:
            flag=False
    if flag:
        print("Yes")
        bingo=True
        break
if bingo!=True:
    print("No")

Buggy submission (verdict: Runtime Error):
#157 b
a=[]
call_num=[]
for i in range(3):
    x,y,z=map(int,input().split())
    a.append(x)
    a.append(y)
    a.append(z)
n=int(input())
for i in range(n):
    x=int(input())
    if x in a:
        call_num.append(a.index(x))
bingo
ans=[[0,1,2],[3,4,5],[6,7,8],[0,3,6],[1,4,7],[2,5,8],[0,4,8],[2,4,6]]
for x in ans:
    flag=True
    for y in x:
        if y not in call_num:
            flag=False
    if flag:
        print("Yes")
        bing=True
        break
if bingo!=True:        
    print("No")

Buggy submission (verdict: Runtime Error):
#157 b 
a=[]
call_num=[]
for i in range(3):
    x,y,z=map(int,input().split())
    a.append(x)
    a.append(y)
    a.append(z)
n=int(input())
for i in range(n):
    x=int(input())
    if x in a:
        call_num.append(a.index(x))
bingo
ans=[[0,1,2],[3,4,5],[6,7,8],[0,3,6],[1,4,7],[2,5,8],[0,4,8],[2,4,6]]
for x in ans:
    flag=True
    for y in x:
        if y not in call_num:
            flag=False
    if flag:
        print("Yes")
        bing=True
        break
if bing!=True:        
    print("No")
Problem p02789 (python)

Fixed submission:
#a ac or wa
n,m=input().split()
ans="No"
if n==m:
    ans="Yes"
print(ans)

Buggy submission (verdict: Runtime Error):
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner scan=new Scanner(System.in);
    int i=scan.nextInt();
    int j=scan.nextInt();
    if (i!=j){
      System.out.println("No");
    }else
      System.out.println("Yes");
    scan.close();
  }
}
Problem p02801 (python)

Fixed submission:
#a 
c=input()
ans=ord(c)+1
print(chr(ans))

Buggy submission (verdict: Runtime Error):
#c welcome to atcoder
import sys
n,m=map(int,input().split())
ps=[]
num={}
#辞書
ac=0
pena=0
if m==0:
    print('0 0')
    sys.exit()
for i in range(m):
    result=input().split()
    ps.append(result)

for x in ps:
    print(x[0])
    if x[0] not in num:
        num[x[0]]=0
    print(num[x[0]])
    if x[1]=="WA" and num[x[0]]==0:
        pena+=1
    if x[1]=="AC" and num[x[0]]==0:
        ac+=1
        num[x[0]]=1

print(num)

print(ac,pena)
Problem p02823 (python)

Fixed submission:
n,a,b=map(int,input().split())
if (b-a)%2==0:
    print((b-a)//2)
else:
    print(min(a-1,n-b)+1+(b-a-1)//2)

Buggy submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
if (b-a)%2==0:
    print((b-a)//2)
else:
    print(min(a-1,n-B)+1+(b-a-1)//2)
Problem p02830 (python)

Fixed submission:
#b strings with the same length
n=int(input())
sentence=input().split()
ans=""
for i in range(n):
    ans=ans+sentence[0][i]+sentence[1][i]
print(ans)

Buggy submission (verdict: Runtime Error):
#b strings with the same length
n=int(input())
sentence=input().split()
ans=""
for i in range(2):
    ans=ans+sentence[0][i]+sentence[1][i]
print(ans)

Buggy submission (verdict: Runtime Error):
#b strings with the same length
n=int(input())
sentence=input().split()
ans=""
for i in range(n):
    ans+=sentence[i]
print(ans)
Problem p02843 (python)

Fixed submission:
x=int(input())
p=[100,101,102,103,104,105]
ans=[False]*2001
ans[0]=True
for i in range(2000):
    if ans[i]:
        for j in p:
            if i+j>2000:
                continue
            else:
                ans[i+j]=True
if x>2000:
    print(1)
elif ans[x]:
    print(1)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
x=int(input())
p=[100,101,102,103,104,105]
ans=[False]*2001
ans[0]=True
for i in range(2000):
    if ans[i]:
        for j in p:
            if i+j>2000:
                continue
            else:
                ans[i+j]=True
if x>2000:
    print(1)
elif ans(x):
    print(1)
else:
    print(0)
Problem p02888 (python)

Fixed submission:
from bisect import bisect_left
n=int(input())
l=list(map(int,input().split()))
l.sort()

ans=0
for a in range(n-2):
    for b in range(a+1,n-1):
        ans+=max(0,bisect_left(l, l[a] + l[b])-b-1)
        
        
print(ans)

Buggy submission (verdict: Runtime Error):
from bisect import bisect_left
n=int(input())
l=list(map(int,input().split()))
l.sort()

ans=0
for a in range(n-2):
    for b in range(a+1,n-1):
        r=bisect_left(l, l[a] + l[b], b + 1, n)
        l=b+1
        ans+=r-l
        
print(ans)
Problem p02995 (python)

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

def gcd(x,y):
    if y==0:
        return x
    return gcd(y,x%y)


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

e=lcm(c,d) #c,dの最小公倍数

def kosu(num):
    z=num
    nc=num//c
    nd=num//d
    ne=num//e
    return z-nc-nd+ne

ans=kosu(b)-kosu(a-1)

print(ans)

Buggy submission (verdict: Runtime Error):
#abc133 c
from fractions import gcd
a,b,c,d=map(int,input().split())

def gcd(x,y):
    if y==0:
        return x
    return gcd(y,x%y)


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

e=lcm(c,d) #c,dの最小公倍数

def kosu(num):
    z=num
    nc=num//c)
    nd=num//d)
    ne=num//e
    return z-nc-nd+ne

ans=kosu(b)-kosu(a-1)

print(ans)
Problem p03029 (python)

Fixed submission:
#128 a
a,p=map(int,input().split())
kakera=a*3+p
ans=int(kakera/2)
print(ans)

Buggy submission (verdict: Runtime Error):
#128 b
n=int(input())
res=[]
for i in range(n):
    a,b=list(input().split())
    b=-1*int(b)
    res.append([a,b,i+1])
res=sorted(res)
for x in res:
    print(x[2])

Buggy submission (verdict: Runtime Error):
#128 b 
n=int(input())
res=[]
for i in range(n):
    a,b=list(input().split())
    b=-1*int(b)
    res.append([a,b,i+1])
res=sorted(res)
for x in res:
    print(x[2])
Problem p03030 (python)

Fixed submission:
#128 b
n=int(input())
res=[]
for i in range(n):
    a,b=list(input().split())
    b=-1*int(b)
    res.append([a,b,i+1])
res=sorted(res)
for x in res:
    print(x[2])

Buggy submission (verdict: Runtime Error):
#128 b
n=int(input())
res=[]
for i in range(n):
    a,b=list(input().split())
    b=-1*int(b)
    res.append([a,b,i+1])
res=sorted(res)
for i in n:
    print(x[2])
Problem p03160 (python)

Fixed submission:
#dp educational contest a frog1 漸化式
n=int(input())
h=list(map(int,input().split()))
dp=[0]*n
for i in range(1,n):
    if i==1:
        dp[i]=abs(h[i]-h[i-1]) #０番目と１番目の差
    else:
        dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))
ans=dp[n-1]
print(ans)

Buggy submission (verdict: Runtime Error):
#dp educational contest a frog1
n=int(input())
h=list(map(int,input().split()))
dp=[0]*n
for i in range(1,n):
    if i==1:
        dp[i]=abs(h[i]-h[i-1]) #０番目と１番目の差
        else:
            dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))
ans=dp[n-1]
print(ans)
Problem p03260 (python)

Fixed submission:
#abc109 a
a,b=map(int,input().split())
flag=False
for c in range(1,4):
    x=a*b*c
    if x%2==1:
        flag=True
        break
if flag:
 	print("Yes")
else:
 	print("No")

Buggy submission (verdict: Runtime Error):
#abc109 a 
a,b=map(int,input().split())
flag=False
for c in range(1,4):
    x=a*b*c 
    if x%2==1:
        flag=True
        break
if flag:
 	print("Yes")
 else:
 	print("No")
Problem p03262 (python)

Fixed submission:
n,x=map(int,input().split())
z=list(map(int,input().split()))
z.sort()
def gcd(a,b):
    if b==0:
        return a 
    return gcd(b,a%b)
ans=abs(x-z[0])

for i in range(n-1):
    sa=z[i+1]-z[i]
    ans=gcd(sa,ans)
print(ans)

Buggy submission (verdict: Runtime Error):
n,x=map(int,input().split())
x=list(map(int,input().split()))
x.sort()
def lcm(a,b):
    if b==0:
        return a 
    return lcm(b,a%b)
ans=x[1]-x[0]

for i in range(n-1):
    sa=x[i+1]-x[i]
    ans=lcm(sa,ans)
print(ans)
Problem p03264 (python)

Fixed submission:
#abc108 a
k=int(input())
ans=0
for i in range(1,k+1):
    for j in range(1,k+1):
        if i%2==0 and j%2==1:
            ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
#abc108 a
k=int(input())
ans=0
for i in range(2,k+1):
    for j in range(2,k+1):
        if i%2==0 and j%2==1:
            cnt+=1
print(ans)
Problem p03285 (python)

Fixed submission:
n=int(input())
cake=n//4
donuts=n//7
flag=False
for i in range(cake+1):
    for j in range(donuts+1):
        s=i*4+j*7
        if s==n:
            flag=True
            break
print("Yes" if flag else "No")

Buggy submission (verdict: Runtime Error):
n=int(intput())
cake=4
donuts=7
flag=False
for i in range(n+1):
    if i%4==0:
        flag=True
        break
    elif (n-i)%7==0:
        flag=True
        break
print("Yes" if flag else "No")
Problem p03292 (python)

Fixed submission:
#abc103 a
a=list(map(int,input().split()))
a.sort()
ans=abs(a[0]-a[1])+abs(a[1]-a[2])
print(ans)

Buggy submission (verdict: Runtime Error):
#abc103 b
s=input()
t=input()
flag=False
for i in range(len(s)):
    new_t=t[-1]
    new_t+=t[:-1]
    if new_t==s:
        flag=True
        break
    t=new_t

print("Yes" if flag else "No" )
Problem p03293 (python)

Fixed submission:
#abc 103 b
s=input()
t=input()
flag=False
for i in range(-1,-len(s)-1,-1):
    new_t=""
    for j in range(len(s)):
        new_t+=t[i+j]
    #print(i,s,new_t)
    if new_t==s:
        flag=True
        break
if flag:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
#abc103 b
s=input()
t=input()
flag=False
for i in range(n):
    new_t=t[-1]
    new_t+=t[:-1]
    if new_t==s:
        flag=True
        break
    t=new_t

print("Yes" if flag else "No" )
Problem p03324 (python)

Fixed submission:
#abc100 b
d,n=map(int,input().split())

def func(x):
    if x%100!=0:
        return 0
    return func(int(x/100))+1
i=1
cnt=0
while True:
    if func(i)==d:
        cnt+=1
        if cnt==n:
            print(i)
            break
    i+=1

Buggy submission (verdict: Runtime Error):
#abc100 b
d,n=map(int,input(.split()))
ans=n*100**d
print(ans)
Problem p03369 (python)

Fixed submission:
#abc095 a
s=input()
print(700+s.count("o")*100)

Buggy submission (verdict: Runtime Error):
#abc095 a
s=input()
print(700+s.count"o"*100)
Problem p03415 (python)

Fixed submission:
#abc090 a
c=[]
for i in range(3):
    line=input()
    c.append(line)
print(c[0][0]+c[1][1]+c[2][2])

Buggy submission (verdict: Runtime Error):
#abc090 a
c=[]
for i in range(3):
    line=list(input().split())
    c.append(line)
print(c[0][0]+c[1][1]+c[2][2])

Buggy submission (verdict: Runtime Error):
#abc090 a 
c=[]
for i in range(3):
    line=list(input().split())
print(c[0][0]+c[1][1]+c[2][2])
Problem p03427 (python)

Fixed submission:
#AtCoder Grand Contest 021 a
n=input()
keta=len(n)
c=n[0]
ans=int(c)+9*(keta-1)
if n[1:]!=("9"*(keta-1)):
    ans-=1
print(ans)

Buggy submission (verdict: Runtime Error):
#AtCoder Grand Contest 021 a
def wa(x):
    x=str(x)
    s=0
    for i in x:
        s+=int(i)
    return s

n=int(input())
keta=len(str(n))
start=10**(keta-2)
start=max(0,start)
ans=0
print(start)
for i in range(start,n+1):
    ans=max(ans,wa(i))
print(ans)
Problem p03556 (python)

Fixed submission:
#abc077 b
import math 
n=int(input())
m=int(math.sqrt(n))
print(m*m)

Buggy submission (verdict: Runtime Error):
#abc077 b
import math 
n=int(input())
m=int(sqrt(n))
print(m*m)
Problem p03730 (python)

Fixed submission:
#abc056 b
a,b,c=map(int,input().split())
num=[]
i=1
n=a
while True:
    n=a*i
    x=n%b
    if x not in num:
        num.append(x)
    else:
        break
    i+=1

if c in num:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
#abc056 b 
a,b,c=map(int,input().split())
num=[]
i=1
n=a
while True:
    n=n*i 
    x=n%b 
    if x not in num:
        num.append(x)
    else:
        break
if c in x:
    print("YES")
else:
    print("NO")
Problem p03760 (python)

Fixed submission:
#abc058 b
o=input()
e=input()
ans=""
for i in range(len(e)):
        ans+=o[i]
        ans+=e[i]
if len(o)-len(e)==1:
    ans+=o[-1]
print(ans)

Buggy submission (verdict: Runtime Error):
#abc058 b
o=input()
e=input()
ans=""
for i in range(len(o)):
        ans+=o[i]
        ans+=e[i]
print(ans)
Problem p04045 (python)

Fixed submission:
#abc 042 c
def dfs(i,s):
    if i==n_keta:
        if s>=n:
            kouho.append(s)
        return 0
    for j in range(len(like)):
        dfs(i+1,s+like[j])
    return 0

n,k=input().split()
d=list(map(int,input().split()))
like=[]
for i in range(10):
    if i not in d:
        like.append(str(i))
kouho=[]
n_keta=len(n)
dfs(0,"")
ans=""
if kouho==[]:
    if like[0]=="0":
        ans+=like[1]
    else:
        ans+=like[0]
    for i in range(n_keta):
        ans+=like[0]
else:
    ans=min(kouho)
print(ans)

Buggy submission (verdict: Runtime Error):
#abc 042 c
def dfs(i,s):
    if i==n_keta:
        if s>=n:
            kouho.append(s)
        return 0
    for j in range(len(like)):
        dfs(i+1,s+like[j])
    return 0

n,k=input().split()
d=list(map(int,input().split()))
like=[]
for i in range(10):
    if i not in d:
        like.append(str(i))
kouho=[]
n_keta=len(n)
dfs(0,"")
if not kouho:
    n_keta+=1
    dfs(0,"")
print(min(kouho))

Buggy submission (verdict: Runtime Error):
#abc 042 c
def dfs(i,s):
    if i==n_keta:
        if s>=n:
            kouho.append(s)
        return 0
    for j in range(len(like)):
        dfs(i+1,s+like[j])
    return 0




n,k=input().split()
d=list(map(int,input().split()))
like=[]
for i in range(10):
    if i not in d:
        like.append(str(i))
kouho=[]
n_keta=len(n)
dfs(0,"")
print(min(kouho))
Problem p02556 (python)

Fixed submission:
n = int(input())

points = []

for i in range(n) :
    point = list(map(int, input().split(" ")))
    points.append(point)

z = []
w = []

for i in range(len(points)) :
    z.append(points[i][0] + points[i][1])

for i in range(len(points)) :
    w.append(points[i][0] - points[i][1])

max_z = max(z) - min(z)
max_w = max(w) - min(w)

if max_z > max_w :
    print(max_z)
else :
    print(max_w)

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

points = []

for i in range(n) :
    point = list(map(int, input(" ")))
    points.append(point)

z = []
w = []

for i in range(len(points)) :
    z.append(points[i][0] + points[i][1])

for i in range(len(points)) :
    w.append(points[i][0] - points[i][1])

max_z = max(z) - min(z)
max_w = max(w) - min(w)

if max_z > max_w :
    print(max_z)
else :
    print(max_w)
Problem p03555 (python)

Fixed submission:
c1 = input()
c2 = input()
if c1 == c2[::-1]:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
x,y,z = map(int, input().split())
ret = (x-z)//(y+z)
print(ret)
Problem p03574 (python)

Fixed submission:

h,w = map(int, input().split())
s = []
for i in range(h):
    s.append(list(input()))

mine_s = [[0]*w for i in range(h)]

def prt_bomb(a, b):
    if(s[a][b] == '#'):
        mine_s[a][b] = '#'
    else:
        ret = 0
        for i in range(max(0, a-1), min(a+1, h-1)+1):
            for j in range(max(0, b-1), min(b+1, w-1)+1):
                if(s[i][j] == '#'):
                    ret += 1
        mine_s[a][b] = str(ret)

for i in range(h):
    for j in range(w):
        prt_bomb(i, j)

for i in range(h):
    print(''.join(mine_s[i]))

Buggy submission (verdict: Runtime Error):
6 6
#####.
#.#.##
####.#
.#..#.
#.##..
#.#...