Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N = int(input())
c = str(input())

left = 0
right = 0
Wcount = 0
Rcount = 0
for i in range(len(c)):
    while c[left] != 'W':
        left += 1
    while c[len(c)-1-right] != 'R':
        right += 1
    if (left + right) >= len(c):
        break
    Wcount += 1
    Rcount += 1
    left += 1
    right += 1

print(Wcount)

Fixed submission:
N = int(input())
c = str(input())

Rcount = 0
Wcount = 0
for i in range(len(c)):
    if c[i] == 'R':
        Rcount += 1
for i in range(Rcount):
    if c[i] == 'W':
        Wcount += 1

print(Wcount)

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

firstRidx = None
Rrenzoku = 0
Rcount = 0
flag = True
for i in range(len(c)):
    if c[i] == 'R':
        Rcount += 1
        if firstRidx is None:
            firstRidx = i
        if i != 0 and i != firstRidx and c[i-1] == 'W':
            flag = False
        if flag:
            Rrenzoku += 1

if firstRidx <= Rcount - Rrenzoku:
    print(Rcount - Rrenzoku)
elif firstRidx > Rcount - Rrenzoku:
    print(firstRidx)

Fixed submission:
N = int(input())
c = str(input())

Rcount = 0
Wcount = 0
for i in range(len(c)):
    if c[i] == 'R':
        Rcount += 1
for i in range(Rcount):
    if c[i] == 'W':
        Wcount += 1

print(Wcount)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))

A.sort()
A.reverse()

list = []
ans = 0
list.append(A[0])
for i in range(len(A)):
        ans += list[i]
        list.append(A[i + 1])
        list.append(A[i + 1])

print(ans)

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

A.sort()
A.reverse()

list = []
ans = 0
list.append(A[0])
for i in range(1, len(A)):
        ans += list[i - 1]
        list.append(A[i])
        list.append(A[i])

print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))

A.sort()
A.reverse()

list = []
ans = 0
list.append(A[0])
for i in range(1, len(A)):
        ans += list[i]
        list.append(A[i])
        list.append(A[i])

print(ans)

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

A.sort()
A.reverse()

list = []
ans = 0
list.append(A[0])
for i in range(1, len(A)):
        ans += list[i - 1]
        list.append(A[i])
        list.append(A[i])

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split(' ')))

A.sort()
A.reverse()

list = []
ans = 0
list.append(A[0])
for i in range(1, len(A)):
        ans += list[0]
        list.pop(0)
        list.append(A[i])
        list.append(A[i])

print(ans)

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

A.sort()
A.reverse()

list = []
ans = 0
list.append(A[0])
for i in range(1, len(A)):
        ans += list[i - 1]
        list.append(A[i])
        list.append(A[i])

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split(' ')))

A.sort()
A.reverse()

list = []
ans = 0
for i in range(len(A)):
    if i == 0:
        list.append(A[i])
    elif list:
        ans += list[0]
        list.pop(0)
        list.append(A[i])
        list.append(A[i])

print(ans)

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

A.sort()
A.reverse()

list = []
ans = 0
list.append(A[0])
for i in range(1, len(A)):
        ans += list[i - 1]
        list.append(A[i])
        list.append(A[i])

print(ans)
Buggy python submission (verdict: Runtime Error):
while True:
    rig=[int(i) for i in input().split(" ")]
    ke=rig[0]+rig[1]
    ans=1
    count=10
    while True:
        if ke<count:
            print(ans)
            break
        else:
            ans+=1
            count=count*10

Fixed submission:
rig=[int(i) for i in input().split(" ")]
while True:
    ke=rig[0]+rig[1]
    ans=1
    count=10
    while True:
        if ke<count:
            print(ans)
            break
        else:
            ans+=1
            count=count*10
    try:rig=[int(i) for i in input().split(" ")]
    except:break
Buggy python submission (verdict: Runtime Error):
def gcd(li):
    a=max(li)
    b=min(li)
    while b>0:
        a,b=b,a%b
    return a

def lcm(li):
    return li[0]*li[1]/gcd(li)

while True:
    li=[int(i) for i in input().split(" ")]
    print("%i %i"%(gcd(li),lcm(li)))

Fixed submission:
def gcd(li):
    a=max(li)
    b=min(li)
    while b>0:
        a,b=b,a%b
    return a

def lcm(li):
    return li[0]*li[1]/gcd(li)

while True:
    try:
        li=[int(i) for i in input().split(" ")]
        print("%i %i"%(gcd(li),lcm(li)))
    except:break
Buggy python submission (verdict: Runtime Error):
while True:
    st=list(input())
    if len(st)==0:break
    print("".join(reversed(st)))

Fixed submission:
st=list(input())
print("".join(reversed(st)))
Buggy python submission (verdict: Runtime Error):
w=input()
l=[i+1 for i in range(w)]
n=input()
for _ in range(n):
    a,b=[int(i)-1 for i in input().split(",")]
    t=l[a]
    l[a]=l[b]
    l[b]=t
for i in w:
    print(i)


Fixed submission:
w=int(input())
l=[i+1 for i in range(w)]
n=int(input())
for _ in range(n):
    a,b=[int(i)-1 for i in input().split(",")]
    t=l[a]
    l[a]=l[b]
    l[b]=t
for i in l:
    print(i)

Buggy python submission (verdict: Runtime Error):
w=int(input())
l=[i+1 for i in range(w)]
n=int(input())
for _ in range(n):
    a,b=[int(i)-1 for i in input().split(",")]
    t=l[a]
    l[a]=l[b]
    l[b]=t
for i in w:
    print(i)


Fixed submission:
w=int(input())
l=[i+1 for i in range(w)]
n=int(input())
for _ in range(n):
    a,b=[int(i)-1 for i in input().split(",")]
    t=l[a]
    l[a]=l[b]
    l[b]=t
for i in l:
    print(i)
Buggy python submission (verdict: Runtime Error):
n=int(input())
for _ in range(n):
    p=[float(i) for i in input().split()]
    if round((p[3]-p[1])/(p[2]-p[0]),5)==round((p[7]-p[5])/(p[6]-p[4]),5):print("YES")
    else:print("NO")


Fixed submission:
n=int(input())
for j in range(n):
    p=[float(i) for i in input().split()]
    if round((p[2]-p[0])*(p[7]-p[5])-(p[3]-p[1])*(p[6]-p[4]),10)==0:
        print("YES")
    else:
        print("NO")

Buggy python submission (verdict: Runtime Error):
n=int(input())
for _ in range(n):
    p=[float(i) for i in input().split()]
    if round((p[3]-p[1])/(p[2]-p[0]),5)==round((p[7]-p[5])/(p[6]-p[4]),5):
        print("YES")
    else:
        print("NO")


Fixed submission:
n=int(input())
for j in range(n):
    p=[float(i) for i in input().split()]
    if round((p[2]-p[0])*(p[7]-p[5])-(p[3]-p[1])*(p[6]-p[4]),10)==0:
        print("YES")
    else:
        print("NO")

Buggy python submission (verdict: Runtime Error):
n=int(input())
for j in range(n):
    p=[float(i) for i in input().split()]
    ab=round((p[3]-p[1])/(p[2]-p[0]),5)
    cd=round((p[7]-p[5])/(p[6]-p[4]),5)
    if ab==cd:
        print("YES")
    else:
        print("NO")



Fixed submission:
n=int(input())
for j in range(n):
    p=[float(i) for i in input().split()]
    if round((p[2]-p[0])*(p[7]-p[5])-(p[3]-p[1])*(p[6]-p[4]),10)==0:
        print("YES")
    else:
        print("NO")

Buggy python submission (verdict: Runtime Error):
n=int(input())
for j in range(n):
    p=[float(i) for i in input().split()]
    ab=(p[3]-p[1])/(p[2]-p[0])
    cd=(p[7]-p[5])/(p[6]-p[4])
    if ab==cd:
        print("YES")
    else:
        print("NO")



Fixed submission:
n=int(input())
for j in range(n):
    p=[float(i) for i in input().split()]
    if round((p[2]-p[0])*(p[7]-p[5])-(p[3]-p[1])*(p[6]-p[4]),10)==0:
        print("YES")
    else:
        print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
m=lambda x:max(map(max,[[sum(x[j:j+i+1]) for j in range(len(x)-i)] for i in range(len(x))]))
while True:
    n=int(input())
    if n==0:break
    print(m([int(input()) for i in range(n)]))


Fixed submission:
while True:
    n=int(input())
    if n==0:break
    l=[int(input()) for i in range(n)]
    s=0
    m=0
    for li in l:
        s=max(0,s+li)
        m=max(m,s)
    print(m if m else max(l))
Buggy python submission (verdict: Runtime Error):
while True:
    n=int(input())
    points=[]
    for i in range(n):
        points.append(int(input()))
    points.remove(max(points))
    points.remove(min(points))
    print(sum(points)/len(points))
    if int(input())==0:break

Fixed submission:
while True:
    n=int(input())
    if n==0:break
    points=[]
    for i in range(n):
        points.append(int(input()))
    points.remove(max(points))
    points.remove(min(points))
    print(int(sum(points)/len(points)))

Buggy python submission (verdict: Runtime Error):
while True:
    n=int(input())
    points=[]
    for i in range(n):
        points.append(int(input()))
    points.remove(max(points))
    points.remove(min(points))
    print(int(sum(points)/len(points)))
    if int(input())==0:break

Fixed submission:
while True:
    n=int(input())
    if n==0:break
    points=[]
    for i in range(n):
        points.append(int(input()))
    points.remove(max(points))
    points.remove(min(points))
    print(int(sum(points)/len(points)))
Buggy python submission (verdict: Runtime Error):
A = sorted([int(raw_input()) for _ in xrange(10)])
print A[9]
print A[8]
PRINT a[7]

Fixed submission:
A = sorted([int(raw_input()) for _ in xrange(10)])
print A[9]
print A[8]
print A[7]

Buggy python submission (verdict: Runtime Error):
A = sorted([int(raw_input()) for _ in xrange(10)])
print A[9]
print A[8]
Print a[7]

Fixed submission:
A = sorted([int(raw_input()) for _ in xrange(10)])
print A[9]
print A[8]
print A[7]
Buggy python submission (verdict: Runtime Error):
for line in sys.stdin:
    a, b = map(int, line.split())
    print len(str(a+b))

Fixed submission:
import sys
for line in sys.stdin:
    a, b = map(int, line.split())
    print len(str(a+b))
Buggy python submission (verdict: Runtime Error):
n = input()
a, b, c = sorted(map(int, raw_inpu().split()))
print 'YES' if a*a+b*b==c*c else 'NO'

Fixed submission:
n = input()
for i in xrange(n):
    a, b, c = sorted(map(int, raw_input().split()))
    print 'YES' if a*a+b*b==c*c else 'NO'
Buggy python submission (verdict: Runtime Error):
import sys
from fractions import gcd
for line in sys.stdin:
    a, b = map(int, raw_input().split())
    print gcd(a, b), a*b/gcd(a,b)

Fixed submission:
import sys
from fractions import gcd
for line in sys.stdin:
    a, b = map(int, line.split())
    print gcd(a, b), a*b/gcd(a,b)
Buggy python submission (verdict: Runtime Error):
import sys
for line in sys.stdin:
    N = int(raw_input())
    ans = 0
    for a in xrange(10):
        for b in xrange(10):
            for c in xrange(10):
                for d in xrange(10):
                    if a+b+c+d == D:
                        ans += 1
    print ans

Fixed submission:
import sys
for line in sys.stdin:
    N = int(line)
    ans = 0
    for a in xrange(10):
        for b in xrange(10):
            for c in xrange(10):
                for d in xrange(10):
                    if a+b+c+d == N:
                        ans += 1
    print ans

Buggy python submission (verdict: Runtime Error):
import sys
for line in sys.stdin:
    N = int(raw_input())
    ans = 0
    for a in xrange(10):
        for b in xrange(10):
            for c in xrange(10):
                for d in xrange(10):
                    if a+b+c+d == N:
                        ans += 1
    print ans

Fixed submission:
import sys
for line in sys.stdin:
    N = int(line)
    ans = 0
    for a in xrange(10):
        for b in xrange(10):
            for c in xrange(10):
                for d in xrange(10):
                    if a+b+c+d == N:
                        ans += 1
    print ans
Buggy python submission (verdict: Runtime Error):
import sys

for line in sys.stdin:
    x1, y1, x2, y2, x3, y3, xp, yp = map(float, raw_input().split())
    AB = [x2-x1, y2-y1]
    BP = [xp-x2, yp-y2]
    BC = [x3-x2, y3-y2]
    CP = [xp-x3, yp-y3]
    CA = [x1-x3, y1-y3]
    BP = [xp-x1, yp-y1]
    c1 = AB[0] * BP[1] - AB[1] * BP[0]
    c2 = BC[0] * CP[1] - BC[1] * CP[0]
    c3 = CA[0] * AP[1] - CA[1] * AP[0]
    if (c1>0 and c2>0 and c3>0) or (c1<0 and c2<0 and c3<0):
        print 'YES'
    else:
        print 'NO'

Fixed submission:
import sys

for line in sys.stdin:
    x1, y1, x2, y2, x3, y3, xp, yp = map(float, line.split())
    AB = [x2-x1, y2-y1]
    BP = [xp-x2, yp-y2]
    BC = [x3-x2, y3-y2]
    CP = [xp-x3, yp-y3]
    CA = [x1-x3, y1-y3]
    AP = [xp-x1, yp-y1]
    c1 = AB[0] * BP[1] - AB[1] * BP[0]
    c2 = BC[0] * CP[1] - BC[1] * CP[0]
    c3 = CA[0] * AP[1] - CA[1] * AP[0]
    if (c1>0 and c2>0 and c3>0) or (c1<0 and c2<0 and c3<0):
        print 'YES'
    else:
        print 'NO'

Buggy python submission (verdict: Runtime Error):
import sys

for line in sys.stdin:
    x1, y1, x2, y2, x3, y3, xp, yp = map(float, line.split())
    AB = [x2-x1, y2-y1]
    BP = [xp-x2, yp-y2]
    BC = [x3-x2, y3-y2]
    CP = [xp-x3, yp-y3]
    CA = [x1-x3, y1-y3]
    BP = [xp-x1, yp-y1]
    c1 = AB[0] * BP[1] - AB[1] * BP[0]
    c2 = BC[0] * CP[1] - BC[1] * CP[0]
    c3 = CA[0] * AP[1] - CA[1] * AP[0]
    if (c1>0 and c2>0 and c3>0) or (c1<0 and c2<0 and c3<0):
        print 'YES'
    else:
        print 'NO'

Fixed submission:
import sys

for line in sys.stdin:
    x1, y1, x2, y2, x3, y3, xp, yp = map(float, line.split())
    AB = [x2-x1, y2-y1]
    BP = [xp-x2, yp-y2]
    BC = [x3-x2, y3-y2]
    CP = [xp-x3, yp-y3]
    CA = [x1-x3, y1-y3]
    AP = [xp-x1, yp-y1]
    c1 = AB[0] * BP[1] - AB[1] * BP[0]
    c2 = BC[0] * CP[1] - BC[1] * CP[0]
    c3 = CA[0] * AP[1] - CA[1] * AP[0]
    if (c1>0 and c2>0 and c3>0) or (c1<0 and c2<0 and c3<0):
        print 'YES'
    else:
        print 'NO'
Buggy python submission (verdict: Runtime Error):
for i in xrange(input()):
    a, b = map(int, raw_input().split())
    print a+b if len(str(a+b)) <= 80 else 'overflow'

Fixed submission:
for i in xrange(input()):
    a = int(raw_input())
    b = int(raw_input())
    print a+b if len(str(a+b)) <= 80 else 'overflow'
Buggy python submission (verdict: Runtime Error):
print ' '.join(map(str, sorted(map(int, raw_input().split()))[::-1])))

Fixed submission:
print ' '.join(map(str, sorted(map(int, raw_input().split()))[::-1]))
Buggy python submission (verdict: Runtime Error):
print raw_input().to_upper()

Fixed submission:
print raw_input().upper()
Buggy python submission (verdict: Runtime Error):
while True:
    n = input()
    if n == 0:
        exit()
    A = [int(raw_input()) for _ in xrange(n)]
    if all(a<=0 for a in A):
        print max(a)
        exit()
    
    r = 0
    tmp = 0
    ans = 0
    while r < n:
        tmp += A[r]
        if tmp < 0:
            l = r
            tmp = 0
        else:
            ans = max(ans, tmp)
        r += 1
    print ans

Fixed submission:
while True:
    n = input()
    if n == 0:
        exit()
    A = [int(raw_input()) for _ in xrange(n)]
    if all(a <= 0 for a in A):
        print max(A)
        continue
    
    r = 0
    tmp = 0
    ans = 0
    while r < n:
        tmp += A[r]
        if tmp < 0:
            l = r
            tmp = 0
        else:
            ans = max(ans, tmp)
        r += 1
    print ans
Buggy python submission (verdict: Runtime Error):
N = int(raw_input())
D1 = 20*5 + 19*5
D2 = 20*10

for i in xrange(N):
    y, m, d = map(int, raw_input().split())
    ans = 0
    if d != 1:
        if y % 3 == 0 or m % 2 == 1:
            last = 20
        else:
            last = 19
        ans += last - d + 1
        d = 1
        if m < 10:
            m += 1
        else:
            y += 1
            m = 1
    if m != 1:
        while m < 11:
            if y % 3 == 0 or m % 2 == 1:
                ans += 20javascript:void(0);
            else:
                ans += 19
            m += 1
        m = 1
        y += 1
    while y < 1000:
        if y % 3 == 0:
            ans += D2
        else:
            ans += D1
        y += 1
    print ans

Fixed submission:
N = int(raw_input())
D1 = 20*5 + 19*5
D2 = 20*10

for i in xrange(N):
    y, m, d = map(int, raw_input().split())
    ans = 0
    if d != 1:
        if y % 3 == 0 or m % 2 == 1:
            last = 20
        else:
            last = 19
        ans += last - d + 1
        d = 1
        if m < 10:
            m += 1
        else:
            y += 1
            m = 1
    if m != 1:
        while m < 11:
            if y % 3 == 0 or m % 2 == 1:
                ans += 20
            else:
                ans += 19
            m += 1
        m = 1
        y += 1
    while y < 1000:
        if y % 3 == 0:
            ans += D2
        else:
            ans += D1
        y += 1
    print ans
Buggy python submission (verdict: Runtime Error):
from fractions import gcd
print gcd(*map(int, raw_input().split())

Fixed submission:
from fractions import gcd
a, b = map(int, raw_input().split())
print gcd(a, b)
Buggy python submission (verdict: Time Limit Exceeded):
N = input()
R = [int(raw_input()) for _ in xrange(N)]
ans = float('-inf')
for i in xrange(N):
    for j in xrange(i+1, N):
        ans = max(ans, R[j]-R[i])
print ans

Fixed submission:
N = input()
R = [int(raw_input()) for _ in xrange(N)]
S = [0 for i in xrange(N)]
S[N-1] = R[N-1]
for i in xrange(N-2, -1, -1):
    S[i] = max(R[i], S[i+1])
ans = float('-inf')
for i in xrange(N-1):
    ans = max(ans, S[i+1]-R[i])
print ans
Buggy python submission (verdict: Runtime Error):
print raw_input()**3

Fixed submission:
print int(raw_input()) ** 3
Buggy python submission (verdict: Runtime Error):
a, b = map(int, raw_input().split())
print min(a.b), max(a,b)

Fixed submission:
while True:
    a, b = map(int, raw_input().split())
    if a == 0 and b == 0:
        break
    print min(a,b), max(a,b)
Buggy python submission (verdict: Runtime Error):
src/volume_0/0000_QQ.py

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

def qq(limit=9):
    qq_str = ''
    for i in range(1, limit+1):
        for j in range(1, limit+1):
            qq_str += str(i) + 'x' + str(j) + '=' + str(i*j)
            if i != limit or j != limit:
                qq_str += '\n'
    return qq_str

def main():
    print(qq())

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

def qq(limit=9):
    qq_str += ''
    for i in range(limit):
        for j in range(limit):
            qq_str += str(i) + 'x' + str(j) + '=' + str(i*j) + '\n'
    return qq_str

def main():
    print(qq())

if __name__ == '__main__':
    main()

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

def qq(limit=9):
    qq_str = ''
    for i in range(1, limit+1):
        for j in range(1, limit+1):
            qq_str += str(i) + 'x' + str(j) + '=' + str(i*j)
            if i != limit or j != limit:
                qq_str += '\n'
    return qq_str

def main():
    print(qq())

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

import sys
import six

def top_k_sort(data, k=3, reverse=True):
    data.sort(reverse=True)
    return data[:k]

def main():
    data = map(int, raw_input().split())

    data = [int(v) for v in argv[1:]]
    for h in top_k_sort(data):
        print(h)

if __name__ == '__main__':
    main()

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

import sys

def top_k_sort(data, k=3, reverse=True):
    data.sort(reverse=True)
    return data[:k]

def main():
    data = []
    for line in sys.stdin:
        data.append(int(line))

    for h in top_k_sort(data):
        print(h)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

import sys

def top_k_sort(data, k=3, reverse=True):
    data.sort(reverse=True)
    return data[:k]

def main():
    data = map(int, raw_input().split())

    data = [int(v) for v in argv[1:]]
    for h in top_k_sort(data):
        print(h)

if __name__ == '__main__':
    main()

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

import sys

def top_k_sort(data, k=3, reverse=True):
    data.sort(reverse=True)
    return data[:k]

def main():
    data = []
    for line in sys.stdin:
        data.append(int(line))

    for h in top_k_sort(data):
        print(h)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

import sys

def top_k_sort(data, k=3, reverse=True):
    data.sort(reverse=True)
    return data[:k]

def main():
    data = []
    for line in sys.stdin:
        data.append(int(line))

    data = [int(v) for v in argv[1:]]
    for h in top_k_sort(data):
        print(h)

if __name__ == '__main__':
    main()

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

import sys

def top_k_sort(data, k=3, reverse=True):
    data.sort(reverse=True)
    return data[:k]

def main():
    data = []
    for line in sys.stdin:
        data.append(int(line))

    for h in top_k_sort(data):
        print(h)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

import sys

def top_k_sort(data, k=3, reverse=True):
    data.sort(reverse=True)
    return data[:k]

def main():
    data = []
    for line in sys.stdin:
        data.append(int(line))

    data = [int(v) for v in argv[1:]]
    for h in top_k_sort(data):
        print(h)

if __name__ == '__main__':
    main()

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

import sys

def top_k_sort(data, k=3, reverse=True):
    data.sort(reverse=True)
    return data[:k]

def main():
    data = []
    for line in sys.stdin:
        data.append(int(line))

    for h in top_k_sort(data):
        print(h)

if __name__ == '__main__':
    main()