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

Fixed submission:
def solve():
    N = int(input())
    score = 0
    for i in range(1, N+1):
        score += i
        if score >= N:
            break
    x = score - N
    res = list(range(1, x)) + list(range(x+1, i+1))
    return '\n'.join(map(str, res))
    
print(solve())

Buggy submission (verdict: Runtime Error):
def solve():
    N = int(input())
    score = 0
    for i in range(1, n+1):
        score += i
        if score >= n:
            break
    x = score - n
    res = list(range(1, x)) + list(range(x+1, i+1))
    return '\n'.join(map(str, res))
    
print(solve())
Problem p04034 (python)

Fixed submission:
def solve():
    N, M = map(int, input().split())
    
    num = []
    red = []
    for i in range(N+1):
        num.append(1)
        red.append(0)
    red[1] = 1
    
    for _ in range(M):
        x, y = map(int, input().split())
        if red[x] == 1:
            red[y] = 1
        num[x] -= 1
        num[y] += 1
        if num[x] == 0:
            red[x] = 0
    
    return sum(red)

print(solve())

Buggy submission (verdict: Runtime Error):
def solve():
    N, M = map(int, input().split())
    
    num = []
    red = []
    for i in range(N+1):
        num.append(1)
        red.append(0)
    red[1] = 1
    
    for _ range(M):
        x, y = map(int, input().split())
        if red[x] == 1:
            red[y] = 1
        num[x] -= 1
        num[y] += 1
        if num[x] == 0:
            red[x] = 0
    
    return sum(red)

print(solve())
Problem p04044 (python)

Fixed submission:
N, L = map(int, input().split())
S = [input() for _ in range(N)]
S.sort()
print(''.join(S))

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

Fixed submission:
# from functools import reduce

N = int(input())
AL = list(map(int, input().split()))

R = True
for b in [n % 3 == 0 or n % 5 == 0 for n in AL if n % 2 == 0]:
    R = R and b

if R:
    print('APPROVED')
else:
    print('DENIED')

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

N = int(input())
AL = list(map(int, input().split()))

R = reduce(lambda x, y: x and y, [n % 3 == 0 or n % 5 == 0 for n in AL if n % 2 == 0])

if R:
    print('APPROVED')
else:
    print('DENIED')
Problem p02783 (python)

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

R1 = H // A
R2 = 1 if H % A > 0 else 0
print(R1 + R2)

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

def func(h):
    if h == 1:
        return 1
    else:
        return func(h // 2) * 2 + 1

r = func(H)
print(r)
Problem p03145 (python)

Fixed submission:
LL = list(map(int, input().split()))
LL.sort()
R = LL[0] * LL[1] // 2
print(R)

Buggy submission (verdict: Runtime Error):
LL = list(map(int, input().split())).sort()
R = LL[0] * LL[1] // 2
print(R)
Problem p03323 (python)

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

if A <= 8 and B <= 8:
    print('Yay!')
else:
    print(':(')

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

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

C = 0
while True:
    if len([n for n in A if n > 0 and n % 2 == 0]) == 0:
        break
    # 最大の偶数を探す
    odds3 = [n * 3 for n in A if n % 2 != 0]
    evens = sorted([n for n in A if n % 2 == 0])
    evens3 = [n * 3 for n in evens[:-1]]
    evens2 = [n // 2 for n in [evens[-1]]]
    A = odds3 + evens3 + evens2
    C += 1
print(C)
Problem p03359 (python)

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

r = a - 1 if b < a else a

print(r)

Buggy submission (verdict: Runtime Error):
from itertools import product

H, W = map(int, input().split())

s = []
for i in range(H):
    s.append(list(input()))

for h, w in [(h, w) for h, w in product(range(H), range(W)) if s[h][w] != '.']:
    R = False
    if h > 0 and s[h - 1][w] == '#':
        # 上
        R = True
    if h < H - 1 and s[h + 1][w] == '#':
        # 下
        R = True
    if w > 0 and s[h][w - 1] == '#':
        # 左
        R = True
    if w < W - 1 and s[h][w + 1] == '#':
        # 右
        R = True

    if not R:
        print('No')
        exit()

print('Yes')
Problem p03486 (python)

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

ss = list(s)
tt = list(t)

ss.sort()
tt.sort(reverse=True)

s1 = ''.join(ss)
t1 = ''.join(tt)

if s1 < t1:
    print('Yes')
else:
    print('No')

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

ss = list(s)
tt = list(input())

ss.sort()
tt.sort(reverse=True)

s1 = ''.join(ss)
t1 = ''.join(tt)

if s1 < t1:
    print('Yes')
else:
    print('No')
Problem p03697 (python)

Fixed submission:
A, B = map(int, input().split())
print('error' if A + B >= 10 else A + B)

Buggy submission (verdict: Runtime Error):
A, B = map(int, input())
print('error' if A + B >= 10 else A + B)
Problem p03997 (python)

Fixed submission:
a = int(input())
b = int(input())
h = int(input())
print((a + b) * h // 2)

Buggy submission (verdict: Runtime Error):
SA = list(input())
SB = list(input())
SC = list(input())

D = {'a': SA, 'b': SB, 'c': SC}
now = 'a'

while D[now]:
    now = D[now].pop()

print(now)
Problem p04030 (python)

Fixed submission:
S = list(input())

L = []

for i, ch in enumerate(S):
    if ch != 'B':
        L.append(ch)
    elif len(L) > 0:
        L = L[:-1]

print(''.join(L))

Buggy submission (verdict: Runtime Error):
S = list(input())

L = []

for i, ch in enumerate(S):
    if ch != 'B':
        L.append(ch)
    elif len(L) > 0:
        del L[i - 1]

R = ''.join(L)
print(R)

Buggy submission (verdict: Runtime Error):
S = list(input())

R = []

for i, ch in enumerate(S):
    if ch != 'B':
        R.append(ch)
    elif len(R) > 0:
        del R[i - 1]


print(''.join(R))
Problem p02621 (python)

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

Buggy submission (verdict: Runtime Error):
str1 = list(input())
str2 = list(input())
count = 0
for i in range(len(str1)):
  if str1[i] != str2[i]:
    count +=1
print(count)
Problem p03035 (python)

Fixed submission:
age, max_money = map(int, input().split())
if age>= 13:
  print(max_money)
elif age>=6 and age<=12:
  print(max_money//2)
elif age<=5:
  print("0")

Buggy submission (verdict: Runtime Error):
age, max_money = int(input().split())
if age>= 13:
  print(max_money)
elif age>=6 and age<=12:
  print(max_money//2)
elif age<=5:
  print("0")
Problem p03455 (python)

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

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

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

Fixed submission:
S = str(input())
if S == 'ABC':
    print('ARC')
elif S == 'ARC':
    print('ABC')

Buggy submission (verdict: Runtime Error):
X = int(input())
# A>=0で考えられる
div_list = []
for a in range(1, int(X**0.5)+1):
    if X % a == 0:
        div_list.append((a, X//a))

#print(div_list)
for x, y in div_list:
    for a in range(int(X**0.5)+1):
        b = a - x
        #print(a, b)
        y_hat = a**4 + b*a**3 + b**2*a**2 + b**3*a + b**4
        #print(y_hat)
        if y_hat == y:
            print(a, b)
            exit()
Problem p02717 (python)

Fixed submission:
x = [int(x) for x in input().split()]
print(x[2],x[0],x[1])

Buggy submission (verdict: Runtime Error):
x = map(int, input().split())
print(x[2],x[0],x[1])
Problem p02909 (python)

Fixed submission:
d = ['Sunny', 'Cloudy',"Rainy"]
a = input()
print(d[(d.index(a)+1)%3])

Buggy submission (verdict: Runtime Error):
a = input()
b = input()
c=0
for i in range(3):
      if (a[i]==b[i]):
            c+=1
print(c)
Problem p02999 (python)

Fixed submission:
x,y = [int(x) for x in input().split()]

if (x<y):
  print(0)
else:
  print(10)

Buggy submission (verdict: Runtime Error):
y = [int(z) for z in input().split()]
l = [int(z) for z in input().split()]
d = [0]*(y[0]+1)
c = 0
for i in range(1,y[0]+1):
      d[i] = d[i-1]+l[i-1]
      if (d[i]<=y[1]):
            c+=1
print(c)
Problem p03000 (python)

Fixed submission:
y = [int(z) for z in input().split()]
l = [int(z) for z in input().split()]
d = [0]*(y[0]+1)
c = 1
for i in range(1,y[0]+1):
      d[i] = d[i-1]+l[i-1]
      if (d[i]<=y[1]):
            c+=1
print(c)

Buggy submission (verdict: Runtime Error):
y = [int(z) for z in input().split()]
l = [int(z) for z in input().split()]
c = 0
d = 0
i=0
while (d<=y[1]):
      d = d+l[i]
      i+=1
if (i>y[0]+1):
      print(y[0]+1)
else:
      print(i)
Problem p02721 (python)

Fixed submission:
def main():
    n,k,c=map(int,input().split())
    S=input()
    l1=[[0,0] for _ in range(n)]
    l2=[0]*n
    memo=[0]*n
    x=0
    for i in range(n):
        if S[i]=="o" and memo[i]==0:
            x+=1
            l1[i][0]=x
            l1[i][1]=i+c+1
            for j in range(i,i+c+1):
                if j<n:
                    memo[j]=1
        elif S[i]=="o" and memo[i]==1:
            l1[i][0]=x
            l1[i][1]=l1[i-1][1]
        elif S[i]=="x" and memo[i]==0:
            l1[i][0]=x
            l1[i][1]=i+1
        else:
            l1[i][0]=x
            l1[i][1]=l1[i-1][1]
    S_=S[::-1]
    memo=[0]*n
    x=0
    for i in range(n):
        if S_[i]=="o" and memo[i]==0:
            x+=1
            l2[i]=x
            for j in range(i,i+c+1):
                if j<n:
                    memo[j]=1
        else:
            l2[i]=x
    l2=l2[::-1]
    ans=0
    for i in range(n):
        if S[i]=="o":
            x=0
            if i!=0:
                x+=l1[i-1][0]
            if i==0 and n!=1:
                x+=l2[1]
            else:
                if l1[i-1][1]<n and i<n-1:
                    x+=l2[max(l1[i-1][1],i+1)]
            if x<k:
                print(i+1)
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n,k,c=map(int,input().split())
    S=input()
    l1=[[0,0] for _ in range(n)]
    l2=[0]*n
    memo=[0]*n
    x=0
    for i in range(n):
        if S[i]=="o" and memo[i]==0:
            x+=1
            l1[i][0]=x
            l1[i][1]=i+c+1
            for j in range(i,i+c+1):
                if j<n:
                    memo[j]=1
        elif S[i]=="o" and memo[i]==1:
            l1[i][0]=x
            l1[i][1]=l1[i-1][1]
        elif S[i]=="x" and memo[i]==0:
            l1[i][0]=x
            l1[i][1]=i+1
        else:
            l1[i][0]=x
            l1[i][1]=l1[i-1][1]
    S_=S[::-1]
    memo=[0]*n
    x=0
    for i in range(n):
        if S_[i]=="o" and memo[i]==0:
            x+=1
            l2[i]=x
            for j in range(i,i+c+1):
                if j<n:
                    memo[j]=1
        else:
            l2[i]=x
    l2=l2[::-1]
    ans=0
    for i in range(n):
        if S[i]=="o":
            x=0
            if i!=0:
                x+=l1[i-1][0]
            if i==0:
                x+=l2[1]
            else:
                if l1[i-1][1]<n and i<n-1:
                    x+=l2[max(l1[i-1][1],i+1)]
            if x<k:
                print(i+1)
if __name__ == '__main__':
    main()
Problem p02734 (python)

Fixed submission:
def main():
    import sys
    input=sys.stdin.readline
    n,s=map(int,input().split())
    A=list(map(int,input().split()))
    mod=998244353
    dp=[[0]*(s+1) for _ in range(n+1)]
    dp[0][0]=1
    for i in range(1,n+1):
        for j in range(s+1):
            a=A[n-i]
            if j-a>0:
                dp[i][j]=(dp[i-1][j]+dp[i-1][j-a])%mod
            elif j==a:
                dp[i][j]=(dp[i-1][j]+i)%mod
            else:
                dp[i][j]=dp[i-1][j]
    ans=0
    for i in range(1,n+1):
        a=A[i-1]
        if s>a:
            ans=(ans+dp[n-i][s-a]*i)%mod
        elif s==a:
            ans=(ans+(n-i+1)*i)%mod
    print(ans)
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    import sys
    input=sys.stdin.readline
    n,s=map(int,input().split())
    A=list(map(int,input().split()))
    mod=998244353
    dp=[[0]*(s+1) for _ in range(n+1)]
    dp[0][0]=1
    for i in range(1,n+1):
        for j in range(s+1):
            a=A[n-i]
            if j-a>0:
                dp[i][j]=(dp[i-1][j]+dp[i-1][j-a])%mod
            elif j==a:
                dp[i][j]=(dp[i-1][j]+i)%mod
            else:
                dp[i][j]=dp[i-1][j]
    ans=0
    for i in range(1,n+1):
        a=A[i-1]
        ans=(ans+dp[n-i][s-a]*i)%mod
    print(ans)
if __name__ == '__main__':
    main()
Problem p02741 (python)

Fixed submission:
k=int(input())
l=[1 ,1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(l[k-1])

Buggy submission (verdict: Runtime Error):
a=input()
a_l=len(a)
b=input()
b_l=len(b)
c=input()
c_l=len(c)
def check(s1,s2):
    l1=len(s1)
    l2=len(s2)
    ret=[0]*(l1+l2-1)
    for i in range(l1+l2-1):
        flag=True
        if i-l2+1<0:
            for j in range(i+1):
                if s1[j]!="?" and s2[l2-i+j-1]!="?" and s1[j]!=s2[l2-i+j-1]:
                    flag=False
                    break
        elif i-l2+1>=0 and i<=l1-1:
            for j in range(l2):
                if s1[i-l2+j+1]!="?" and s2[j]!="?" and s1[i-l2+j+1]!=s2[j]:
                    flag=False
                    break
        else:
            for j in range(l1+l2-i-1):
                if s1[i-l2+j+1]!="?" and s2[j]!="?" and s1[i-l2+j+1]!=s2[j]:
                    flag=False
                    break
        ret[i]=flag
    return ret
ab=check(a,b)
ab_l=len(ab)
ac=check(a,c)
ac_l=len(ac)
bc=check(b,c)
bc_l=len(bc)
ans=a_l+b_l+c_l
for i in range(-3000,ab_l+3000):
    if i<0 or i>=ab_l or ab[i]:
        for j in range(-3000,ac_l+3000):
            if j<0 or j>=ac_l or ac[j]:
                if (0<=j-i+b_l+1<bc_l and bc[j-i+b_l+1]) or j-i+b_l+1<0 or j-i+b_l+1>=bc_l:
                    l=max(a_l-1,i,j)-min(0,i-b_l+1,j-c_l+1)+1
                    ans=min(ans,l)
print(ans)

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if c-a-b<=0:
    print("No")
else:
    l=a*b*4
    r=(c-a-b)**2
    if r>l:
        print("Yes")
    else:
        print("No")
Problem p02783 (python)

Fixed submission:
import math
h,a=map(int,input().split())
print(math.ceil(h/a))

Buggy submission (verdict: Runtime Error):
h=int(input())
ans=0
c=1
while h>1:
    ans+=c
    c*=2
    h//=2
ans+=c
print(ans)
Problem p02788 (python)

Fixed submission:
import math
n,d,a=map(int,input().split())
XH=[]
for _ in range(n):
    x,h=map(int,input().split())
    h=math.ceil(h/a)
    XH.append([x,h])
XH.sort()
if n==1:
    print(XH[0][1])
    exit()
l=0
r=0
ans=XH[0][1]
c=XH[0][1]
L=[c]
while l<=n-1:
    left=XH[l][0]
    right=left+2*d
    if XH[r+1][0]<=right:
        cc=max(0,XH[r+1][1]-c)
        L.append(cc)
        c+=cc
        ans+=cc
        r+=1
        if r>=n-1:
            r-=1
            l+=1
    else:
        c-=L[l]
        l+=1
print(ans)

Buggy submission (verdict: Runtime Error):
import math
n,d,a=map(int,input().split())
XH=[]
for _ in range(n):
    x,h=map(int,input().split())
    h=math.ceil(h/a)
    XH.append([x,h])
XH.sort()
l=0
r=0
left=XH[0][0]
right=left+2*d
ans=XH[0][1]
c=XH[0][1]
L=[c]
while l<=n-1:
    left=XH[l][0]
    right=left+2*d
    if XH[r+1][0]<=right:
        cc=max(0,XH[r+1][1]-c)
        L.append(cc)
        c+=cc
        ans+=cc
        r+=1
        if r>=n-1:
            r-=1
            l+=1
    else:
        c-=L[l]
        l+=1
print(ans)
Problem p02797 (python)

Fixed submission:
n,k,s=map(int,input().split())
ans=[]
if s==10**9:
    ans=[s]*k+[1]*(n-k)
else:
    ans=[s]*k+[s+1]*(n-k)
print(*ans)

Buggy submission (verdict: Runtime Error):
n,k,s=map(int,input().split())
ans=[]
if s==10**9:
    ans=[s]*k+[1]*[n-k]
else:
    ans=[s]*k+[s+1]*(n-k)
print(*ans)
Problem p02825 (python)

Fixed submission:
n=int(input())
if n%3==0:
    for i in range(n//3):
        print("a.."*(n//3))
        print("a.."*(n//3))
        print(".aa"*(n//3))
elif n%2==0 and n>=4:
    x="aacd"+"."*(n-4)
    y="bbcd"+"."*(n-4)
    for i in range(n//2):
        print(x)
        print(y)
        x=x[2:]+x[:2]
        y=y[2:]+y[:2]
elif n>=13:
    x="aacd"+"."*(n-13)
    y="bbcd"+"."*(n-13)
    for i in range((n-9)//2):
        print(x+"."*9)
        print(y+"."*9)
        x=x[2:]+x[:2]
        y=y[2:]+y[:2]
    for i in range(3):
        print("."*(n-9)+"a..a..a..")
        print("."*(n-9)+"a..a..a..")
        print("."*(n-9)+".aa.aa.aa")   
elif n==5:
    print("aabba")
    print("bc..a")
    print("bc..b")
    print("a.ddb")
    print("abbaa")
elif n==7:
    print("aabbcc.")
    print("dd.dd.a")
    print("..e..ea")
    print("..e..eb")
    print("dd.dd.b")
    print("..e..ec")
    print("..e..ec")
elif n==11:
    print("aabbcc.....")
    print("dd.dd.a....")
    print("..e..ea....")
    print("..e..eb....")
    print("dd.dd.b....")
    print("..e..ec....")
    print("..e..ec....")
    print(".......aacd")
    print(".......bbcd")
    print(".......cdaa")
    print(".......cdbb")
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
n=int(input())
if n%3==0:
    for i in range(n//3):
        print("a.."*n//3)
        print("a.."*n//3)
        print(".aa"*n//3)
else:
    if n%2==0 and n>=4:
        x="aacd"+"."*(n-4)
        y="bbcd"+"."*(n-4)
        for i in range(n//2):
            print(x)
            print(y)
            x=x[2:]+x[:2]
            y=y[2:]+y[:2]
    else:
        print(-1)
Problem p02850 (python)

Fixed submission:
import sys
sys.setrecursionlimit(500000)
n=int(input())
E=[[] for _ in range(n+1)]
for i in range(n-1):
    a,b=map(int,input().split())
    E[a].append([b,i])
    E[b].append([a,i])
k=0
for e in E:
    k=max(k,len(e))
ans=[0]*(n-1)
def dsf(v,p,vp_c):
    c=1
    for u,i in E[v]:
        if u!=p:
            if c==vp_c:
                c+=1
            ans[i]=c
            dsf(u,v,c)
            c+=1
dsf(1,0,0)
print(k)
for i in range(n-1):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
n=int(input())
E=[[] for _ in range(n+1)]
for i in range(n-1):
    a,b=map(int,input().split())
    E[a].append([b,i])
    E[b].append([a,i])
k=0
for e in E:
    k=max(k,len(e))
ans=[0]*(n-1)
def dsf(v,p,vp_c):
    c=1
    for u,i in E[v]:
        if u!=p:
            if c==vp_c:
                c+=1
            ans[i]=c
            dsf(u,v,c)
            c+=1
dsf(1,0,0)
print(k)
for i in range(n-1):
    print(ans[i])
Problem p02900 (python)

Fixed submission:
from fractions import gcd
import math
a,b=map(int,input().split())
g=gcd(a,b)
ans=1
for i in range(2,math.floor(g**.5)+1):
  if g%i==0:
    ans+=1
    while g%i==0:
      g//=i
if g!=1:
  ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
a,b=min(a,b),max(a,b)
ans=1
is_prime = [True]*(a+1)
is_prime[0]=False
is_prime[1]=False
for i in range(2,a+1):
  if is_prime[i]:
    if a%i==0 and b%i==0:
      ans+=1
    while a%i==0:
      a//=i
    if a==1:
      break
    for j in range(i*2,a+1,i):
      is_prime[j] = False
print(ans)
Problem p03086 (python)

Fixed submission:
s=input()
ans=0
for i in range(len(s)):
  l=0
  for j in range(i,len(s)):
    if s[j] in ["A","T","G","C"]:
      l+=1
    else:
      break
  ans=max(ans,l)
print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
ans=0
for i in range(len(s)):
  l=0
  for j in range(i:len(s)):
    if s[j] in ["A","T","G","C"]:
      l+=1
    else:
      break
  ans=max(ans,l)
print(ans)
Problem p03102 (python)

Fixed submission:
N,M,C=map(int,input().split())
B=list(map(int,input().split()))
right_answer=0
for i in range(N):
  A=list(map(int,input().split()))
  if sum(a*b for a,b in zip(A,B))+C>0:
    right_answer+=1
print(right_answer)

Buggy submission (verdict: Runtime Error):
N,M,C=map(int,input().split())
B=list(input().split())
right_answer=0
for i in range(N):
  A=list(input().split())
  if sum(a*b for a,b in zip(A,B))+C>0:
    right_answer+=1
print(right_answer)
Problem p03125 (python)

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

Buggy submission (verdict: Runtime Error):
a,b=map(int,input(),split())
print(a+b if b%a==0 else b-a)
Problem p03206 (python)

Fixed submission:
print("Christmas"+" Eve"*(25-int(input())))

Buggy submission (verdict: Runtime Error):
n=int(input())
price_list=[int(input()) for i in range(n)]
print(sum(price_list)-max(price_list)//2)
Problem p03212 (python)

Fixed submission:
n=int(input())
def dsf(s):
  if int(s)>n:
    return 0
  else:
    if all(s.count(c)>0 for c in "753"):
      x=1
    else:
      x=0
    for c in "753":
      x+=dsf(s+c)
    return x
print(dsf("0"))

Buggy submission (verdict: Runtime Error):
n=int(input())
def dsf(s):
  if int(s)>n:
    return0
  else:
    if all(s.count(c)>0 for c in "753"):
      x=1
    else:
      x=0
    for c in "753":
      x+=dsf(s+c)
    return x
print(dsf("0"))
Problem p03231 (python)

Fixed submission:
from fractions import gcd
N,M=map(int,input().split())
S=input()
T=input()
L=gcd(N,M)
print(N*M//L if all([S[i*N//L]==T[i*M//L] for i in range(L)]) else "-1")

Buggy submission (verdict: Runtime Error):
from fractions import gcd
n,m=map(int,input().split())
s=input()
t=input()
g=gcd(n,m)
l=n*m//g
ans=l
L=[0]*l
p=0
for i in s:
  L[p]=i
  p+=l//n
p=0
for j in t:
  if L[p]!=0 and L[p]!=j:
    ans=-1
    break
  p+=l//m
print(ans)
Problem p03238 (python)

Fixed submission:
if input()=="1":
  print("Hello World")
else:
  print(sum([int(input()) for i in range(2)]))

Buggy submission (verdict: Runtime Error):
n,t=map(int,input().split())
cost_list=[]
for i in range(n):
  cost,time=map(int,input().split())
  if time<=t:
    cost_list+=[cost]
if cost_list!=[]:
  print(min(cost_list))
else:
  print(TLE)
Problem p03239 (python)

Fixed submission:
n,t=map(int,input().split())
cost_list=[]
for i in range(n):
  cost,time=map(int,input().split())
  if time<=t:
    cost_list+=[cost]
if cost_list!=[]:
  print(min(cost_list))
else:
  print("TLE")

Buggy submission (verdict: Runtime Error):
n,t=map(int,input().split())
cost_list=[]
for i in range(n):
  cost,time=map(int,input().split())
  if time<=t:
    cost_list+=[cost]
if cost_list!=[]:
  print(min(cost_list))
else:
  print(TLE)

Buggy submission (verdict: Runtime Error):
n,t=map(int,input().split())
cost_list=[]
for i in range(n):
  cost,time=map(int,input().split())
  if time<=t:
    cost_list+=cost
if cost_list=![]:
  print(min(cost_list))
else:
  print(TLE)
Problem p03260 (python)

Fixed submission:
print("Yes" if eval(input().replace(" ","*"))%2 else "No")

Buggy submission (verdict: Runtime Error):
print("Yes" if (eval(input().replace(" ",*)))%2 else "No")

Buggy submission (verdict: Runtime Error):
print("Yes" if eval(input().replace(" ",*))%2 else "No")
Problem p03274 (python)

Fixed submission:
n,k=map(int,input().split())
X=list(map(int,input().split()))
ans=[]
for i in range(n-k+1):
  ans.append(X[i+k-1]-X[i]+min(abs(X[i+k-1]),abs(X[i])))
print(min(ans))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
X=list(map(int,input().split()))
ans=[]
for i in range(n-k+1):
  ans.append(X[i+k-1]-X[i]+min(abs(X[i+k+1]),abs(X[i])))
print(min(ans))
Problem p03285 (python)

Fixed submission:
n=int(input())
ans="No"
while n>=0:
  if n%4==0:
    ans="Yes"
    break
  else:
    n-=7
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
ans="No"
while n>=0
  if n%4==0:
    ans="Yes"
    break
  else:
    n-=7
print(ans)
Problem p03288 (python)

Fixed submission:
r=int(input())
print("ABC" if r<1200 else "ARC" if r<2800 else "AGC")

Buggy submission (verdict: Runtime Error):
r=int(input())
print("ABC" if r<1200 else "AGC" if r<2800)
Problem p03292 (python)

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

Buggy submission (verdict: Runtime Error):
*a=map(int,input().split())
print(max(a)-min(a))

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

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

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
n=b-a
print(n(n+1)//2-b)