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

Fixed submission:
s = input()

slist = s.split(" ")

left = int(slist[0]) + int(slist[1])

right = int(slist[2]) + int(slist[3])

if left > right:
	print("Left")
	
elif left == right:
	print("Balanced")
	
else:
	print("Right")

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

slist = s.split(" ")

left = int(slist[0]) + int(slist[1])

right = slist[2] + slist[3]

if left > right:
	print("left")
	
elif left == right:
	print("Balanced")
	
else:
	print("right")

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

slist = s.split(' ')

left = int(slist[0]) + int(slist[1])

right = int(slist[2]) + int(slist[3])

if left > right:
	print('left')
else if left == right:
	print('Balanced')
else:
	print('right')

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

slist = s.split(' ')

left = slist[0] + slist[1]

right = slist[2] + slist[3]

if left > right:
	print('left')
else if left == right:
	print('Balanced')
else:
	print('right')

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

slist = s.split(' ')

left = slist[0] + slist[1]

right = slist[2] + slist[3]

if left > right:
	print('left')
else if left == right:
	print('Balanced')
else:
	print('right)

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

slist = s.split(' ')

left = slist[0] + slist[1]

right = slist[2] + slist[3]

if left > right:
	print('left')
else if left == right:
	print('Balanced')
else:
	print('right

Buggy submission (verdict: Runtime Error):
str = args[1]
print(str)

Buggy submission (verdict: Runtime Error):
str = raw_inpur()
print(str)
Problem p03544 (python)

Fixed submission:
#!/user/bin/python
# coding: UTF-8

N = int(raw_input())

L = [2, 1, 3, 4,
7,
11,
18,
29,
47,
76,
123,
199,
322,
521,
843,
1364,
2207,
3571,
5778,
9349,
15127,
24476,
39603,
64079,
103682,
167761,
271443,
439204,
710647,
1149851,
1860498,
3010349,
4870847,
7881196,
12752043,
20633239,
33385282,
54018521,
87403803,
141422324,
228826127,
370248451,
599074578,
969323029,
1568397607,
2537720636,
4106118243,
6643838879,
10749957122,
17393796001,
28143753123,
45537549124,
73681302247,
119218851371,
192900153618,
312119004989,
505019158607,
817138163596,
1322157322203,
2139295485799,
3461452808002,
5600748293801,
9062201101803,
14662949395604,
23725150497407,
38388099893011,
62113250390418,
100501350283429,
162614600673847,
263115950957276,
425730551631123,
688846502588399,
1114577054219522,
1803423556807921,
2918000611027443,
4721424167835364,
7639424778862807,
12360848946698171,
20000273725560978,
32361122672259149,
52361396397820127,
84722519070079276,
137083915467899403,
221806434537978679,
358890350005878082,
580696784543856761,
939587134549734843]

print L[N]

Buggy submission (verdict: Runtime Error):
#!/user/bin/python
# coding: UTF-8

N = int(raw_input())

L = [2, 1]
flag = 0
i = 0
while flag == 0:
    l = 0
    l = L[i] + L[i + 1]
    L.append(l)
    i = i + 1
    print l
    if l > 86:
        flag = flag + 1

print L[N]
Problem p03555 (python)

Fixed submission:
#!/user/bin/python
# coding: UTF-8

c1 = str(raw_input())
c2 = str(raw_input())

c1_list = list(c1)
c1_list.reverse()
if list(c2) == c1_list :
    print 'YES'
else :
    print 'NO'

Buggy submission (verdict: Runtime Error):
#!/user/bin/python
# coding: UTF-8

N = int(raw_input())
A = map(int, raw_input().split())
B = map(int, raw_input().split())
C = map(int, raw_input().split())

A.sort()
B.sort()
C.sort()

n = 0
for i in range(N):
    for j in range(N):
        if A[i] < B[j]:
            for k in range(N):
                if B[j] < C[k]:
                    n = n + 1

print n
Problem p03477 (python)

Fixed submission:
import sys
a, b, c, d = map(int, sys.stdin.readline().split())
if a+b > c+d:
    print('Left')
elif a+b == c+d:
    print('Balanced')
else:
    print('Right')

Buggy submission (verdict: Runtime Error):
import sys
x, y = map(int,sys.stdin.readline().split())
cnt = 0
while x <= y:
    cnt += 1
    x *= 2
print(cnt)
Problem p03737 (python)

Fixed submission:
nums = input().split()
print(nums[0][0].upper()+nums[1][0].upper()+nums[2][0].upper())

Buggy submission (verdict: Runtime Error):
nums = input().split()
print(nums[0][0].upper()+nums[1][0].upper()+nums[2][0].upper
Problem p03773 (python)

Fixed submission:
import sys
a, b = map(int, sys.stdin.readline().split())

print((a+b)%24)

Buggy submission (verdict: Runtime Error):
import sys
a, b = sys.stdin.readline().split()

print((a+b)%24)
Problem p03962 (python)

Fixed submission:
import sys
a, b, c = map(int, sys.stdin.readline().split())
nums = []
nums.append(a)
nums.append(b)
nums.append(c)

counted = []
cnt = 0
for item in nums:
    if item in counted:
        continue
    else:
        cnt += 1
        counted.append(item)
print(cnt)

Buggy submission (verdict: Runtime Error):
import sys
nums = [for i in map(int, sys.stdin.readline().split())]
counted = []
cnt = 0
for item in nums:
    if item in counted:
        continue
    else:
        cnt += 1
        counted.append(item)

print(cnt)
Problem p03485 (python)

Fixed submission:
import math

a = list(map(lambda x: int(x),input().split()))
s = sum(a)
ave = math.ceil(sum(a)/len(a))

print(ave)

Buggy submission (verdict: Runtime Error):
import collections
import itertools

s = list(map(str, input()))
g = list(map(lambda x: int(x),input().split()))

seq = ('R', 'L')

ans = False

count_dict = collections.Counter(s)

g_sum = abs(g[0])+abs(g[1])
if g_sum > count_dict['F']:
    print('No')
else:
    patterns = list(itertools.product(seq, repeat=count_dict['T']))

    for _p in patterns:
        i = 0
        m = [0, 0]
        n = 3
        for _s in s:
            if _s == 'F':
                if n == 3:
                    m[0] = m[0] + 1
                elif n == 1:
                    m[0] = m[0] - 1
                elif n == 0:
                    m[1] = m[1] + 1
                elif n == 2:
                    m[1] = m[1] - 1
            else:
                i = i + 1
                if _p[i-1] == 'R':
                    if n == 0:
                        n = 3
                    else:
                        n = n - 1
                elif _p[i-1] == 'L':
                    if n == 3:
                        n = 0
                    else:
                        n = n + 1

        if m[0] == g[0] and m[1] == g[1]:
            ans = True
            break

    if ans:
        print('Yes')
    else:
        print('No')
Problem p03555 (python)

Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

str1 = input()
str2 = input()
c11, c12, c13 = [i for i in str1]
c21, c22, c23 = [i for i in str2]

if c11 == c23 and c12 == c22 and c13 == c21:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import math

def main():
    N = int(input())
    for i in reversed(range(N)):
        int_sqrt = int(math.sqrt(i))
        if i == int_sqrt ** 2:
            print(i)
            return None

if __name__ == "__main__":
    main()
Problem p03569 (python)

Fixed submission:
s = input()
len_s = len(s)
l_index = 0
r_index = len_s - 1
counter = 0
while l_index < r_index:
    if s[l_index] == s[r_index]:
        l_index += 1
        r_index -= 1
    elif s[l_index] == "x":
        counter += 1
        l_index += 1
    elif s[r_index] == "x":
        counter += 1
        r_index -=1
    else:
        counter = -1
        break
print(counter)

Buggy submission (verdict: Runtime Error):
s = input()
len_s = len(s)
l_index = 0
r_index = s - 1
counter = 0
while l_index < r_index:
    if s[l_index] == s[r_index]:
        l_index += 1
        r_index -= 1
    elif s[l_index] == "x":
        counter += 1
        l_index += 1
    elif s[r_index] == "x":
        counter += 1
        r_index -=1
    else:
        counter = -1
        break
print(counter)
Problem p03493 (python)

Fixed submission:
xs = input()
count = 0
for x in xs:
    if x == '1':
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
n = input()
xs = input().split(' ')
xs = [int(x) for x in xs]
xs = set(xs)
xs = list(xs)
xs.sort()
a = [x for x in xs if x % 2 == 1]
if len(a) > 0:
    print(0)
else:
    m = 10 ** 9
    for x, y in zip(xs[:-1], xs[1:]):
        q = y - x
        if q < m:
            m = q
    if m > xs[0]:
        m = xs[0]
    count = 0
    while m % 2 == 0:
        count += 1
        m = m / 2
    print(count)
Problem p03501 (python)

Fixed submission:
xs = input().split(' ')
[N, A, B] = [int(x) for x in xs]

a = N * A
b = B
if a > b:
    print(b)
else:
    print(a)

Buggy submission (verdict: Runtime Error):

def binarize(txt):
    xs = txt.split(' ')
    xs = [int(x) for x in xs]
    b = 0
    for i in range(10):
        b += xs[i] * (2 ** i)
    return b


def count1(b):
    b = b[2:]
    count = 0
    for i in range(len(b)):
        if b[i] == '1':
            count += 1
    return count


N = input()
N = int(N)

F = [0 for i in range(N)]

for i in range(N):
    txt = input()
    F[i] = binarize(txt)


P = [[] for i in range(N)]

for i in range(N):
    xs = input().split(' ')
    P[i] = [int(x) for x in xs]


m = - 10 ** 11

for i in range(1, 2**10):

    score = 0

    for j in range(N):
        b = bin(i & F[j])
        count = count1(b)
        score += P[j][count]

    if score > m:
        m = score

print(m)
Problem p03543 (python)

Fixed submission:
N = int(input())

counter = 0
current = 11
flag = False
while N > 0:
    tmp = N % 10
    if tmp == current:
        counter += 1
    else:
        counter = 0
        current = tmp
    if counter > 1:
        flag = True
    N = N // 10
if flag is True:
    print('Yes')
else:
    print('No')

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


def dijkstra(N, matrix, s):
    d = [np.inf for _ in range(N)]
    d[s] = 0
    prev = [-1 for _ in range(N)]
    Q = set([i for i in range(N)])

    def min_index():
        mi = np.inf
        mii = 0
        for i in Q:
            if d[i] < mi:
                mii = i
        return mii

    while Q:
        u = min_index()
        Q.remove(u)
        for v in range(N):
            if matrix[u][v] >= 0:
                alt = d[u] + matrix[u][v]
                if d[v] > alt:
                    d[v] = alt
                    prev[v] = u
    return d


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

c = []
for _ in range(10):
    c.append([int(x) for x in input().split()])

c_tmp = deepcopy(c)

for i in range(10):
    for j in range(10):
        c_tmp[i][j] = c[j][i]

c = c_tmp

k = [0 for _ in range(10)]
for i in range(H):
    xs = [int(x) for x in input().split()]
    for x in xs:
        if x > 0:
            k[x] += 1

d = dijkstra(10, c, 1)

count = 0
for i in range(10):
    if i != 1:
        count += d[i] * k[i]

print(count)
Problem p03544 (python)

Fixed submission:
N = int(input())

Lx = 2
Ly = 1

if N == 1:
    print(Ly)
else:
    for i in range(N - 1):
        tmp = Lx + Ly
        Lx = Ly
        Ly = tmp
    print(Ly)

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

Lx = 2
Ly = 1

if N == 1:
    print(Ly)
else:
    for i in range(N-1):
        tmp = Lx + Ly
        Lx = Ly
        Ly = tmp

print(tmp)
Problem p03943 (python)

Fixed submission:
seq = [int(x) for x in input().split()]
seq.sort()

a, b, c = seq

if a + b == c:
    print('Yes')
    
else:
    print('No')

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

seq.sort()

a, b, c = seq

if a + b == c:
    print('Yes')
    
else:
    print('No')

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

if a + b == c or b + c == a or c + a == b:
    print('Yes')
    
else:
    print('No')
Problem p03482 (python)

Fixed submission:
def main():
    s = input()

    ans = len(s)
    for i in range(0,len(s)-1):
        if s[i] != s[i+1]:
            ans = min(ans , max(i+1 , len(s)-i-1))
    print(ans)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    s = map(int,input().split())

    ans = len(s)
    for i in range(0,len(s)-1):
        if s[i] != s[i+1]:
            ans = min(ans , max(i+1 , len(s)-i-1))
    print(ans)

if __name__ == '__main__':
    main()
Problem p03551 (python)

Fixed submission:

def main():
    N,M = map(int,input().split())

    print((1900*M+100*(N-M))*2**M)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):

def main():
    N,M = map(int(input().split()))

    print((1900*M+100*(N-M))*2**M)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):

def main():
    N,M = int(input().split())

    print((1900*M+100*(N-M))*2**M)

if __name__ == '__main__':
    main()
Problem p03552 (python)

Fixed submission:

def main():
    N,Z,W = map(int,input().split())
    a = list(map(int,input().split()))

    print(max(abs(a[N-1]-W),abs(a[N-1]-a[N-2])))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):

def main():
    N,Z,W = map(int,input().split())
    a = list(map(int,input().split()))

    print(max(abs(a[N-1]-W,abs(a[N-1]-a[N-2]))))

if __name__ == '__main__':
    main()
Problem p03737 (python)

Fixed submission:
lines = input().split()
print(lines[0][0].upper()+lines[1][0].upper()+lines[2][0].upper())

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

if a == b:
    print("EQUAL")
if len(a) > len(b):
    print("GREATER")
elif len(a) < len(b):
    print("LESS")
else:
    for i in range(len(a)):
        if int(a[i]) > int(b[i]):
            print("GREATER")
            break
        elif int(a[i]) < int(b[i]):
            print("LESS")
            break

Buggy submission (verdict: Runtime Error):
lines = input().split()
print(str.upper(lines[0][0])+str.upper(lines[1][0]+str.upper(lines[2][0]))
Problem p04029 (python)

Fixed submission:
num = int(input())
sum = 0
for i in range(1,num+1):
    sum += i
print(sum)

Buggy submission (verdict: Runtime Error):
lines = list(input())
answers = []
out = ""
for line in lines:
    if line == "0" or line == "1":
        answers.append(line)
    else:
        answers.pop()
for answer in answers:
    out += answer
print(out)
Problem p04030 (python)

Fixed submission:
lines = list(input())
answers = []
out = ""
for line in lines:
    if line == "0" or line == "1":
        answers.append(line)
    elif answers:
        answers.pop()
for answer in answers:
    out += answer
print(out)

Buggy submission (verdict: Runtime Error):
lines = list(input())
answers = []
out = ""
for line in lines:
    if line == "0" or line == "1":
        answers.append(line)
    else:
        answers.pop()
for answer in answers:
    out += answer
print(out)
Problem p04043 (python)

Fixed submission:
go=0
nana=0
num = input().split()
for i in num:
  if i == "5":
    go+=1
  if i == "7":
    nana+=1
if (go==2) and (nana==1):
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
ns,k = input().split()
nlist = input().split()
nslist = list(ns)
while set(nslist) & set(nlist):
    ns = int(ns)+1
    ns = str(ns)
    nslist = list(ns)
print(ns)

Buggy submission (verdict: Runtime Error):
x,y = map(int,input().split())
list = [input() for i in range(x)]

if list[0]<=list[1] and list[0]<=list[2]:
    if list[1]<=list[2]:
        print(list[0]+list[1]+list[2])
    else:
        print(list[0]+list[2]+list[1])

if list[1]<=list[0] and list[1]<=list[2]:
    if list[0]<=list[2]:
        print(list[1]+list[0]+list[2])
    else:
        print(list[1]+list[2]+list[0])

if list[2]<=list[0] and list[2]<=list[1]:
    if list[0]<=list[1]:
        print(list[2]+list[0]+list[1])
    else:
        print(list[2]+list[1]+list[0])

Buggy submission (verdict: Runtime Error):
x,y = map(int,input().split())
list = [input() for i in range(x)]

if list[0]<list[1] and list[0]<list[2]:
    if list[1]<list[2]:
        print(list[0]+list[1]+list[2])
    else:
        print(list[0]+list[2]+list[1])

if list[1]<list[0] and list[1]<list[2]:
    if list[0]<list[2]:
        print(list[1]+list[0]+list[2])
    else:
        print(list[1]+list[2]+list[0])

if list[2]<list[0] and list[2]<list[1]:
    if list[0]<list[1]:
        print(list[2]+list[0]+list[1])
    else:
        print(list[2]+list[1]+list[0])

Buggy submission (verdict: Runtime Error):
go = 0
nana = 0
num = input().split()
for i in num:
  if i == "5":
    go+=1
  elif i == "7":
    nana+=1
if (go==2) and (nana==1):
  print(YES)
else:
  print(NO)
Problem p03605 (python)

Fixed submission:
num = int(input())
if num % 10 == 9 or num // 10 == 9:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
list = []
for i in range(n):
    a = bay(input())
    if a in list:
        list.remove(a)
    else:
        list.append(a)
print(len(list))

Buggy submission (verdict: Runtime Error):
n = int(input())
list = []
for i in range(n):
    a = str(input())
    if a in list:
        list.remove(a)
    else:
        list.append(a)
print(len(list))

Buggy submission (verdict: Runtime Error):
n = int(input())
list = []
for i in range(n):
    a = str(input())
    if a in list:
        list.remove(a)
    else:
        list.append(a)
print(len(list))
Problem p03624 (python)

Fixed submission:
import string

a = input()

f = False
for i in string.ascii_lowercase:
    if i not in a:
        print(i)
        f = True
        break

if not f:
    print("None")

Buggy submission (verdict: Runtime Error):
import string

for i in string.ascii_lowercase:
    if i not in a:
        print(i)
        break

Buggy submission (verdict: Runtime Error):
import string

for i in string.ascii_lowercase:
	if i not in a:
    	print(i)
		break
Problem p03962 (python)

Fixed submission:
a =list(map(int, input(). split()))
print(len(set(a)))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
print(k*(k-1)**(n-1))
Problem p03485 (python)

Fixed submission:
# -*- coding: utf-8 -*-
from math import ceil
a,b = map(int, input().split())
avg = ceil((a+b)/2.0)
print(avg)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys, argparse
from math import ceil

parser = argparse.ArgumentParser()
parser.add_argument('stdin', nargs=2)
args = parser.parse_args()
a,b = map(int, args.stdin)
avg = ceil((a+b)/2.0)
print(avg)
Problem p03485 (python)

Fixed submission:
import math

l = input().split()
a = int(l[0])
b = int(l[1])
c = float((a+b)/2)

print(math.ceil(c))

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

list_s = list(s)
list_s.sort()

list_t = list(t)
list_t.sort(reverse=True)

yes = False
if len(list_s) < len(list_t):
    yes = True

for i in range(len(list_s)):
    if len(list_t)-1 < i:
        break
    if list_s[i] < list_t[i]:
        yes = True
        break
    elif list_s[i] > list_t[i]:
        yes = False
        break

if yes:
    print("Yes")
else:
    print("No")
Problem p03486 (python)

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

list_s = list(s)
list_s.sort()

list_t = list(t)
list_t.sort(reverse=True)

yes = False
if len(list_s) < len(list_t):
    yes = True

for i in range(len(list_s)):
    if len(list_t)-1 < i:
        break
    if list_s[i] < list_t[i]:
        yes = True
        break
    elif list_s[i] > list_t[i]:
        yes = False
        break

if yes:
    print("Yes")
else:
    print("No")

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

list_s = list(s)
list_s.sort()

list_t = list(t)
list_t.sort(reverse=True)

yes = False
if len(list_s) < len(list_t):
    yes = True

for i in range(len(list_s)):
    if len(list_t) < i:
        break
    if list_s[i] < list_t[i]:
        yes = True
        break
    elif list_s[i] > list_t[i]:
        yes = False
        break

if yes:
    print("Yes")
else:
    print("No")
Problem p03485 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import math

a, b = map(int, input().split())
x = (a + b) / 2
print(math.ceil(x))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
a, b = map(int, input().split())
x = (a + b) / 2
if x > 0:
    return x + 1
else:
    return x

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
a, b = map(int,input().split())
x = (a + b) / 2
if x > 0:
	return x + 1
else:
	return x

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
a, b = int(input().split())
x = (a + b) / 2
if x > 0:
	return x + 1
else:
	return x

Buggy submission (verdict: Runtime Error):
a, b = input().split()
x = (a + b) / 2
if x > 0:
	return x + 1
else:
	return x
Problem p03486 (python)

Fixed submission:
s = sorted(raw_input())
t = sorted(raw_input())[::-1]
print "Yes" if s < t else "No"

Buggy submission (verdict: Runtime Error):
s = sorted(raw_input())
t = sroted(raw_input())[::-1]
print "Yes" if s < t else "No"
Problem p03632 (python)

Fixed submission:
list = input().split()
a = int(list[0])
b = int(list[1])
c = int(list[2])
d = int(list[3])
result = 0
if a < b and c < d:
    if (a >= c and b <= d) or (a <= c and b >= d):
        result = min(b-a,d-c)
    elif a <= c and c <= b:
        result = b - c
    elif c <= a and a <= d:
        result =  d - a
print(result)

Buggy submission (verdict: Runtime Error):
list = input().split()
a = list[0]
b = list[1]
c = list[2]
d = list[3]
result = 0
if a < b and c < d:
    if (a >= c and b <= d) or (a <= c and b >= d):
        result = min(b-a,d-c)
    elif a <= c and c <= b:
        result = b - c
    elif c <= a and a <= d:
        result =  d - a
print(result)
Problem p03486 (python)

Fixed submission:
a = raw_input()
b = raw_input()

a = "".join( sorted( list(a) ) )
b = "".join( sorted( list(b) ) )

yes = True
printed = False

if len(a) < len(b):
    i = 0
    while i < len(a):
        if a[i] != b[i]:
            yes = False
            break
        i += 1
    if yes:
        print "Yes"
        printed = True

if not printed and len(b) > 0:
    i = 0
    b = "".join( sorted( list(b), reverse = True ) )

    while i < len(a) and i < len(b):
        if a[i] < b[i]:
            print "Yes"
            printed = True
            break
        elif a[i] > b[i]:
            print "No"
            printed = True
            break
        i += 1
if not printed:
    print "No"

Buggy submission (verdict: Runtime Error):
a = raw_input()
b = raw_input()

a = "".join( sorted( list(a) ) )
b = "".join( sorted( list(b) ) )

yes = True
printed = False

if len(a) < len(b):
    i = 0
    while i < len(a):
        if a[i] != b[i]:
            yes = False
            break
        i += 1
    if yes:
        print "Yes"
        printed = True

if not printed and len(b) > 0:
    i = 0
    b = "".join( sorted( list(b), reverse = True ) )

    while i < len(a):
        if a[i] < b[i]:
            print "Yes"
            printed = True
            break
        elif a[i] > b[i]:
            print "No"
            printed = True
            break
        i += 1
if not printed:
    print "No"

Buggy submission (verdict: Runtime Error):
a = raw_input()
b = raw_input()

a = "".join( sorted( list(a) ) )
b = "".join( sorted( list(b) ) )

yes = True
printed = False

if len(a) < len(b):
    i = 0
    while i < len(a):
        if a[i] != b[i]:
            yes = False
            break
        i += 1
    if yes:
        print "Yes"
        printed = True

if not printed:
    i = 0
    b = "".join( sorted( list(b), reverse = True ) )

    while i < len(a):
        if a[i] < b[i]:
            print "Yes"
            printed = True
            break
        elif a[i] > b[i]:
            print "No"
            printed = True
            break
        i += 1
if not printed:
    print "No"

Buggy submission (verdict: Runtime Error):
a = raw_input()
b = raw_input()

a = "".join( sorted( list(a) ) )
b = "".join( sorted( list(b) ) )

yes = True
printed = False

if len(a) < len(b):
    i = 0
    while i < len(a):
        if a[i] != b[i]:
            yes = False
            break
        i += 1
    if yes:
        print "Yes"
        printed = True

if not printed:
    i = 0
    b = "".join( sorted( list(b), reverse = True ) )

    while i < len(a):
        if a[i] < b[i]:
            print "Yes"
            printed = True
            break
        elif a[i] > b[i]:
            print "No"
            printed = True
            break
        i += 1
    if not printed:
        print "No"

if not printed:
    print "Yes"
    printed = True