Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
Created on Sat Jul 25 17:57:31 2020

@author: Paras
"""

n,k = map(int, input().split())
marks = list(map(int, input().split()))
score_curr = 1
for i in range(k):
  score_curr*=marks[i]
  
f = marks[0]
score_prev = score_curr
j = 0
for i in range(k,n):
    score_curr = (score_prev//f)*marks[i]
    if score_curr>score_prev:
        print("Yes")
    else:
        print("No")
    score_prev = score_curr
    j+=1
    f = marks[j]

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sat Jul 25 17:57:31 2020

@author: Paras
"""

n,k = map(int, input().split())
marks = list(map(int, input().split()))
i = 0
j = i+k
while j<n:
    if marks[j]>marks[i]:
        print("Yes")
    else:
        print("No")
    i+=1
    j+=1
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = []
b = []
for i in range(n):
    c,d = map(int,input().split())
    a.append(c)
    b.append(d)

#下限
all_time = 0
f = n

while(True):
    #上限
    up = min(b)
#    print("up:"+str(up))
#    print(b)
    for i in range(n):
#        print(i)
        if b[i] == up:
            all_time += a[i]
            del b[i]
            del a[i]
#            print(b)
            f -= 1
        if i >= f-1:
            break
            # if i != n-1:
            #     i -= 1
    
    if all_time > up:
        print("No")
#        print(all_time)
        break

#    print("length:"+str(len(b)))
    if len(b) == 0:
        print("Yes")
        break


Fixed submission:
n = int(input())
l = []
for i in range(n):
    c,d = map(int,input().split())
    l.append([c,d])

l.sort(key = lambda x:x[1])

time = 0
ans = "Yes"
for i in range(n):
    limit = l[i][1]
    time += l[i][0]
    if time > limit:
        ans = "No"
        break

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = []
b = []
for i in range(n):
    c,d = map(int,input().split())
    a.append(c)
    b.append(d)

#下限
all_time = 0
f = n

while(True):
    #上限
    up = min(b)
#    print("up:"+str(up))
    s_time = 0
#    print(b)
    for i in range(n):
#        print(i)
        if b[i] == up:
            s_time += a[i]
            del b[i]
            del a[i]
#            print(b)
            f -= 1
        if i >= f-1:
            break
            # if i != n-1:
            #     i -= 1
    
    all_time += s_time
    if all_time > up:
        print("No")
#        print(all_time)
        break

#    print("length:"+str(len(b)))
    if len(b) == 0:
        print("Yes")
        break


Fixed submission:
n = int(input())
l = []
for i in range(n):
    c,d = map(int,input().split())
    l.append([c,d])

l.sort(key = lambda x:x[1])

time = 0
ans = "Yes"
for i in range(n):
    limit = l[i][1]
    time += l[i][0]
    if time > limit:
        ans = "No"
        break

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = []
b = []
for i in range(n):
    c,d = map(int,input().split())
    a.append(c)
    b.append(d)

down = 0
#下限
all_time = 0
stack = 0

while(True):
    up = 100000000
    #上限
    for i in range(n):
        if b[i] < up and b[i]>down:
            up = b[i]

#    print("up:"+str(up))
    s_time = 0
    for i in range(n):
        if b[i] == up:
            s_time += a[i]
            stack += 1
    
    all_time += s_time
    if all_time > up:
        print("No")
#        print(all_time)
        break

    if stack == n:
        print("Yes")
        break
    down = up

Fixed submission:
n = int(input())
l = []
for i in range(n):
    c,d = map(int,input().split())
    l.append([c,d])

l.sort(key = lambda x:x[1])

time = 0
ans = "Yes"
for i in range(n):
    limit = l[i][1]
    time += l[i][0]
    if time > limit:
        ans = "No"
        break

print(ans)
Buggy python submission (verdict: Runtime Error):
n,x = map(int,input().split())
l = list(map(int,input().split()))
d = 0
i = 0
while(True):
    if d <= x:
        d += l[i]
        i += 1
    else:
        break
print(i)

Fixed submission:
n,x = map(int,input().split())
l = list(map(int,input().split()))
#print(len(l))
a = len(l)
d = 0
i = 0
while(i<=a):
    if d <= x:
        if i == a:
            i += 1
            break
        d += l[i]
        i += 1
    else:
        break
print(i)
Buggy python submission (verdict: Runtime Error):
n=int(input())
#s = input().split()
print(s)
r = 0
b = 0
for i in s:
    if i == "R":
        r += 1
    if i == "B":
        b += 1

if r <= b:
    print("No")
else:
    print("Yes")

Fixed submission:
n=int(input())
s = input()
#print(s)
r = 0
b = 0
for i in s:
    if i == "R":
        r += 1
    if i == "B":
        b += 1

if r <= b:
    print("No")
else:
    print("Yes")
Buggy python submission (verdict: Runtime Error):
l=map(int,input().split())
l.remove(max(l))
print(l[0]*l[1])


Fixed submission:
l=list(map(int,input().split()))
l.remove(max(l))
print(l[0]*l[1]//2)
Buggy python submission (verdict: Runtime Error):
n,t = int(input().split())
m = 10000
for i in range(n):
    c,d = int(input().split())
    if d <= t:
        if m > c:
            m = c
if m = 10000:
    print('TLE')
else:
    print(m)

Fixed submission:
n,t = map(int,input().split())
m = 10000
for i in range(n):
    c,d = map(int,input().split())
    if d <= t:
        if m > c:
            m = c
if m == 10000:
    print('TLE')
else:
    print(m)

Buggy python submission (verdict: Runtime Error):
n,t = map(int,input().split())
m = 10000
for i in range(n):
    c,d = map(int,input().split())
    if d <= t:
        if m > c:
            m = c
if m = 10000:
    print('TLE')
else:
    print(m)

Fixed submission:
n,t = map(int,input().split())
m = 10000
for i in range(n):
    c,d = map(int,input().split())
    if d <= t:
        if m > c:
            m = c
if m == 10000:
    print('TLE')
else:
    print(m)

Buggy python submission (verdict: Runtime Error):
n,t = [x for x in int(input())]
m = 10000
for i in range(n):
    c,d = [x for x in int(input())]
    if d <= t:
        if m > c:
            m = c
if m = 10000:
    print('TLE')
else:
    print(m)

Fixed submission:
n,t = map(int,input().split())
m = 10000
for i in range(n):
    c,d = map(int,input().split())
    if d <= t:
        if m > c:
            m = c
if m == 10000:
    print('TLE')
else:
    print(m)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))


def cal(n):
    result = 0
    totyu = 1
    for _ in range(n-1):
        if a[totyu] % 2 !=0:
            result += 1
            totyu += 2
        else :
            totyu += 2
    return result

if n % 2 == 0:
    n /= 2
else:
    n = n//2 +1 

print(cal(n))

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

result = 0

for i in range(n):
    if (i+1) % 2 != 0 and a[i] % 2 != 0:
        result +=1
print(result)
Buggy python submission (verdict: Runtime Error):
n = int(input())n = int(input())
n = n + n**2 + n**3
print(n)

Fixed submission:
n = int(input())
n = n + n**2 + n**3
print(int(n))
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
c = 0
fi = list(S)
for i in range(N):
    if S[i] == "A":
        if S[i+1] == "B":
            if S[i+2] == "C":
                c += 1
print(c)

Fixed submission:
N = int(input())
S = input()
c = 0
fi = list(S)
for i in range(N-2):
    if S[i] == "A":
        if S[i+1] == "B":
            if S[i+2] == "C":
                c += 1
print(c)

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
c = 0
fi = list(S)
for i in range(N):
    if S[i] == "A":
        if S[i+1] == "B":
            if S[i+2] == "C":
                c += 1
print(c)

Fixed submission:
N = int(input())
S = input()
c = 0
fi = list(S)
for i in range(N-2):
    if S[i] == "A":
        if S[i+1] == "B":
            if S[i+2] == "C":
                c += 1
print(c)
Buggy python submission (verdict: Runtime Error):
A = list(map(int,input().split()))
for i in range(A[2]):
    if A[0] > 0:
        A[0] -= 1
    elif A[1] > 1:
        A[1] -=1
print(A[0],A[1])


Fixed submission:
S,T= map(str,input().split())
print(T+S)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
x = list(map(int,input().split()))
lis = sorted(x)
for i in x:
    key = lis.index(i)
    keylist = lis[:key]+lis[key+1:]
    ans = keylist[n//2-1]
    print(ans)


Fixed submission:
n = int(input())
x = list(map(int,input().split()))
lis = sorted(x)
key1 = lis[n//2-1]
key2 = lis[n//2]
for i in x:
    if i > key1:
        print(key1)
    else:
        print(key2)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
x = list(map(int,input().split()))
lis = sorted(x)

#ans = []
for i in x:
    keylist = lis[:lis.index(i)]+lis[lis.index(i)+1:]
    #print(keylist)
    ans = keylist[n//2-1]
    print(ans)


Fixed submission:
n = int(input())
x = list(map(int,input().split()))
lis = sorted(x)
key1 = lis[n//2-1]
key2 = lis[n//2]
for i in x:
    if i > key1:
        print(key1)
    else:
        print(key2)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
lis = []
for _ in range(n):
    x = int(input())
    if x in lis:
        lis.remove(x)
    else:
        lis.append(x)

print(len(lis))

Fixed submission:
n = int(input())
lis = [0]*n
for i in range(n):
    lis[i] = int(input())

import collections

ans = 0
lis = collections.Counter(lis)

for i in lis.values():
    if i%2 == 1:
        ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
p = [int(x) for x in input().split()]

ans = 0
index = 0

while index <= n-1:
    if p[index] == index+1:
        if p[index+1] != index+2:
            index += 1
        else:
            index += 2
        ans += 1
    else:
        index += 1

print(ans)

Fixed submission:
n = int(input())
p = [int(x) for x in input().split()]

ans = 0
cnt = 0
'''
index = 0
while index <= n-1:
    if p[index] == index+1:
        if p[index+1] != index+2:
            index += 1
        else:
            index += 2
        ans += 1
    else:
        index += 1
'''

for i in range(n-1):
    if p[i] == i+1:
        p[i], p[i+1] = p[i+1], p[i]
        cnt += 1

if p[-1] == n:
    cnt += 1

print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

lis = []

for i in set(a):
    if 2 <= a.count(i) <= 3:
        lis.append(i)
    elif 4 <= a.count(i):
        lis.append(i)
        lis.append(i)


lis.sort(reverse=True)
if len(lis) <= 1:
    ans = 0
else:
    ans = lis[0]*lis[1]

print(ans)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
from collections import Counter
a = Counter(a)
lis = []

for i,j in a.items():
    lis += [i]*(j//2)

#print(lis)

lis.sort(reverse=True)
if len(lis) <= 1:
    ans = 0
else:
    ans = lis[0]*lis[1]

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

lis = []

for i in set(a):
    if 2 <= a.count(i) <= 3:
        lis.append(i)
    elif 4 <= a.count(i):
        lis.append(i)
        lis.append(i)


lis.sort(reverse=True)
if len(lis) <= 1:
    ans = 0
else:
    ans = lis[0]*lis[1]

print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
from collections import Counter
a = Counter(a)
lis = []

for i,j in a.items():
    lis += [i]*(j//2)

#print(lis)

lis.sort(reverse=True)
if len(lis) <= 1:
    ans = 0
else:
    ans = lis[0]*lis[1]

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a = [0] * m
b = [0] * m
for i in range(m):
    a[i], b[i] = map(int, input().split())

check = 0


for i in range(m):
    if a[i] == 1:
        check = b[i]
        for j in range(m):
            if a[j] == check and b[j] == n:
                print("POSSIBLE")
                exit()

print("IMPOSSIBLE")


Fixed submission:
n, m = map(int, input().split())
a = [0] * m
b = [0] * m
for i in range(m):
    a[i], b[i] = map(int, input().split())
'''
check = 0


for i in range(m):
    if a[i] == 1:
        check = b[i]
        for j in range(m):
            if a[j] == check and b[j] == n:
                print("POSSIBLE")
                exit()

print("IMPOSSIBLE")

'''
start = []
leave = []
for i in range(m):
    if a[i] == 1:
        start.append(b[i])
    elif b[i] == n:
        leave.append(a[i])

if set(start) & set(leave):
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a = [0] * m
b = [0] * m
for i in range(m):
    a[i], b[i] = map(int, input().split())

check = 0


for i in range(m):
    if a[i] == 1:
        check = b[i]
        for j in range(m):
            if a[j] == check and b[j] == n:
                print("POSSIBLE")
                exit()

print("IMPOSSIBLE")


Fixed submission:
n, m = map(int, input().split())
a = [0] * m
b = [0] * m
for i in range(m):
    a[i], b[i] = map(int, input().split())
'''
check = 0


for i in range(m):
    if a[i] == 1:
        check = b[i]
        for j in range(m):
            if a[j] == check and b[j] == n:
                print("POSSIBLE")
                exit()

print("IMPOSSIBLE")

'''
start = []
leave = []
for i in range(m):
    if a[i] == 1:
        start.append(b[i])
    elif b[i] == n:
        leave.append(a[i])

if set(start) & set(leave):
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

b = []

front = False
for i in a:
    if front:
        b.insert(0, i)
        front = False
    else:
        b.append(i)
        front = True



if front:
    b.reverse()


b = list(map(str, b))
b = " ".join(b)
print(b)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
'''
b = []

front = False
for i in a:
    if front:
        b.insert(0, i)
        front = False
    else:
        b.append(i)
        front = True




if front:
    b.reverse()


b = list(map(str, b))
b = " ".join(b)
print(b)
'''


first = a[0:n:2]
last = a[1:n:2]
last = last[::-1]
answer = last + first
if n%2 != 0:
    answer = answer[::-1]

print(*answer, sep=" ")

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

b = []

front = False
for i in a:
    if front:
        b.insert(0, i)
        front = False
    else:
        b.append(i)
        front = True

if front:
    b.reverse()


b = list(map(str, b))
b = " ".join(b)
print(b)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
'''
b = []

front = False
for i in a:
    if front:
        b.insert(0, i)
        front = False
    else:
        b.append(i)
        front = True




if front:
    b.reverse()


b = list(map(str, b))
b = " ".join(b)
print(b)
'''


first = a[0:n:2]
last = a[1:n:2]
last = last[::-1]
answer = last + first
if n%2 != 0:
    answer = answer[::-1]

print(*answer, sep=" ")
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = [0] * n
b = [0] * n
for i in range(n):
    a[i], b[i] = map(int ,input().split())

#愚直な実装だけどいけるかなって感じ
lis = []

for i in range(n):
    for j in range(b[i]):
        lis.append(a[i])

lis.sort()
print(lis[k-1])

Fixed submission:
n, k = map(int, input().split())
a = [0] * n
b = [0] * n
for i in range(n):
    a[i], b[i] = map(int ,input().split())


judge = 0
dic = {}


for i in range(n):
    if a[i] in dic:
        dic[a[i]] += b[i]
    else:
        dic[a[i]] = b[i]
#print(dic)
dic = list(dic.items())
dic.sort()
#print(dic)


for i in range(10**9):
    if judge >= k:
        print(dic[i-1][0])
        break
    else:
        judge += int(dic[i][1])
    #print(judge)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

mod = 10**9+7
ans = 1

for i in range(n):
    ans *= (i+1)



print(ans%mod)

Fixed submission:
n = int(input())

mod = 10**9+7
ans = 1

for i in range(n):
    ans *= (i+1)
    ans %= mod



print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
k, s  = map(int, input().split())

ans1 = 0
ans2 = 0
ans3 = 0

for i in range(k+1):
    for j in range(i, k+1):
        for l in range(j, k+1):
            if i + j + l == s:
                if i == j == l:
                    ans1 +=1
                elif i == l or i == j or j == l:
                    ans2 += 1
                else:
                    ans3 += 1
                    

print(ans1+ans2*3+ans3*6)


Fixed submission:
k, s  = map(int, input().split())

ans1 = 0
ans2 = 0
ans3 = 0

for i in range(k+1):
    for j in range(i, k+1):    
        if 0 <= s-i-j <= k and j <= s-i-j:
            if i == j == s-i-j:
                ans1 +=1
            elif i == s-i-j or i == j or j == s-i-j:
                ans2 += 1
            else:
                ans3 += 1
                    

print(ans1+ans2*3+ans3*6)
#print(ans1, ans2, ans3)

Buggy python submission (verdict: Time Limit Exceeded):
k, s  = map(int, input().split())

ans1 = 0
ans2 = 0
ans3 = 0

for i in range(k+1):
    for j in range(i, k+1):
        for l in range(j, k+1):
            if i + j + l == s:
                if i == j == l:
                    ans1 +=1
                elif i == l or i == j or j == l:
                    ans2 += 1
                else:
                    ans3 += 1
                    

print(ans1+ans2*3+ans3*6)

Fixed submission:
k, s  = map(int, input().split())

ans1 = 0
ans2 = 0
ans3 = 0

for i in range(k+1):
    for j in range(i, k+1):    
        if 0 <= s-i-j <= k and j <= s-i-j:
            if i == j == s-i-j:
                ans1 +=1
            elif i == s-i-j or i == j or j == s-i-j:
                ans2 += 1
            else:
                ans3 += 1
                    

print(ans1+ans2*3+ans3*6)
#print(ans1, ans2, ans3)

Buggy python submission (verdict: Time Limit Exceeded):
k, s  = map(int, input().split())

ans = 0

for i in range(k+1):
    for j in range(k+1):
        for l in range(k+1):
            if i + j + l == s:
                ans += 1

print(ans)

Fixed submission:
k, s  = map(int, input().split())

ans1 = 0
ans2 = 0
ans3 = 0

for i in range(k+1):
    for j in range(i, k+1):    
        if 0 <= s-i-j <= k and j <= s-i-j:
            if i == j == s-i-j:
                ans1 +=1
            elif i == s-i-j or i == j or j == s-i-j:
                ans2 += 1
            else:
                ans3 += 1
                    

print(ans1+ans2*3+ans3*6)
#print(ans1, ans2, ans3)
Buggy python submission (verdict: Runtime Error):
s = str(input())


a, b = 0, 0

for i in range(len(s)-1):
    if s[i] == s[i+1]:
        a, b = i+1, i+2
        break
    elif i != len(s)-1:
        if s[i] == s[i+2]:
            a, b = i+1, i+3
            break
        
if a == 0:
    print(-1, -1)
else:
    print(a, b)

Fixed submission:
s = str(input())


a, b = 0, 0

for i in range(len(s)-1):
    if s[i] == s[i+1]:
        a, b = i+1, i+2
        break
    elif i < len(s)-2:
        if s[i] == s[i+2]:
            a, b = i+1, i+3
            break
        
if a == 0:
    print(-1, -1)
else:
    print(a, b)

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


a, b = 0, 0

for i in range(len(s)-1):
    if s[i] == s[i+1]:
        a, b = i+1, i+2
        break
    if i != len(s)-1:
        elif s[i] == s[i+2]:
            a, b = i+1, i+3
            break
        
if a == 0:
    print(-1, -1)
else:
    print(a, b)

Fixed submission:
s = str(input())


a, b = 0, 0

for i in range(len(s)-1):
    if s[i] == s[i+1]:
        a, b = i+1, i+2
        break
    elif i < len(s)-2:
        if s[i] == s[i+2]:
            a, b = i+1, i+3
            break
        
if a == 0:
    print(-1, -1)
else:
    print(a, b)

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


a, b = 0, 0

for i in range(len(s)):
    if s[i] == s[i+1]:
        a, b = i+1, i+2
        break
        
if a == 0:
    print(-1, -1)
else:
    print(a, b)

Fixed submission:
s = str(input())


a, b = 0, 0

for i in range(len(s)-1):
    if s[i] == s[i+1]:
        a, b = i+1, i+2
        break
    elif i < len(s)-2:
        if s[i] == s[i+2]:
            a, b = i+1, i+3
            break
        
if a == 0:
    print(-1, -1)
else:
    print(a, b)
Buggy python submission (verdict: Runtime Error):
N = int(input())
xyh = []
for i in range(N):
    xyh.append(list(map(int,input().split())))

for cx in range(101):
    for cy in range(101):
        flag = True
        tmpH = 0
        for i in range(N):
            X = xyh[i][0]
            Y = xyh[i][1]
            h = xyh[i][2]
            if i == 0:
                tmpH = abs(X-cx) + abs(Y-cy) + h
            else:
                if tmpH != abs(X-cx) + abs(Y-cy) + h:
                    flag = False
        if flag:
            answer_cx = cx
            answer_cy = cy
            answer_h = tmpH
            answer_string = str(cx) + " " + str(cy) + " " + str(tmpH)
            break
print(answer_string)

Fixed submission:
N = int(input())

xyh = []
for i in range(N):
    xyh.append(list(map(int,input().split())))

xyh_sorted = sorted(xyh, key=lambda x: x[2], reverse=True)

answer = [0, 0, 0]
for cy in range(0, 101):
    for cx in range(0, 101):
        H = xyh_sorted[0][2] + abs(xyh_sorted[0][0] - cx) + abs(xyh_sorted[0][1] - cy)
        flag = True
        for i in range(1,N):
            h2 = max(H - abs(xyh_sorted[i][0] - cx) - abs(xyh_sorted[i][1] - cy), 0)
            if h2 != xyh_sorted[i][2]:
                flag = False
                break
        if flag:
            answer = [cx, cy, H]
            break
    if flag:
        break

answerString = str(answer[0]) + " " + str(answer[1]) + " " + str(answer[2])
print(answerString)
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
T = input()
for i in range(len(T)):
    x = S[i]
    y = T[i]
    S = S.replace(x, 'X')
    S = S.replace(y, 'Y')
    S = S.replace('X', y)
    S = S.replace('Y', x)
if S == T:
    print('Yes')
else:
    print('No')

Fixed submission:
S = input()
T = input()
N = len(S)
count = 0
R_1 = [-1 for i in range(26)]
R_2 = [-1 for i in range(26)]

answer = "Yes"
for i in range(N):
    r1 = ord(S[i]) - 97
    r2 = ord(T[i]) - 97
    if R_1[r1] >= 0:
        if r2 != R_1[r1]:
            answer = "No"
            break
    if R_2[r2] >= 0:
        if r1 != R_2[r2]:
            answer = "No"
            break
    if R_1[r1] < 0:
        R_1[r1] = r2
    if R_2[r2] < 0:
        R_2[r2] = r1
print(answer)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
f = [ i for i in range(1, N + 1)]
for i in f:
  ans = 0
  for x in range(1, i + 1):
    for y in range(1, i + 1):
      for z in range(1, i + 1):
        if (x**2 + y**2 + z**2 + x*y + y*z + z*x) == i:
          ans += 1
  print(ans)

Fixed submission:
N = int(input())
ans = [ 0 for _ in range(10500)]
for i in range(1, 105):
  for j in range(1, 105):
    for k in range(1, 105):
      v = i**2 + j**2 + k**2 + i*j + j*k + k*i
      if v < 10500:
        ans[v] += 1
for i in range(N):
  print(ans[i + 1])
Buggy python submission (verdict: Runtime Error):
import re
import sys
S = input()
T = input()
w = 0
if not re.match(r'^[a-z]+$', S) or not re.match(r'^[a-z]+$', T) or len(S) != len(T) or (10 ** 5 * 2) < len(S):
  sys.exit()
if S != T:
  i = 0
  for l in S:
    if l != T[i]:
      w = w + 1
    i = i + 1
print(w)

Fixed submission:
import re
import sys
try:
  a = int(input())
  if not 1 <= a <= 10:
    sys.exit()
  print(a+(a**2)+(a**3))
except:
  sys.exit()
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split(' ')))
ans = 1
for l in A:
    ans *= l
if 10**18 < ans:
    print(-1)
else:
    print(ans)

Fixed submission:
N = int(input())
A = list(map(int, input().split(' ')))
ans = 1
if 0 in A:
    ans = 0
else:
    for l in A:
        ans *= l
        if 10**18 < ans:
            ans = -1
            break
print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()
res = 0

if s[0] == s[1]:
  res += 1
if s[1] == s[2]:
  res += 1

print(res)
  

Fixed submission:
s = input()
res = 1
 
if s[0] == "R" and s[1] == "R":
  res += 1
if s[1] == "R" and s[2] == "R":
  res += 1
  
if "R" in s:
  print(res)
else:
  print(0)