Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int, input().split()))
A=sorted(A)
s=0
for num in range(1, N+1):
  count = 0
  for i in range(s, N-1):
    if A[i] == num:
      count += 1
  s+=count
  print(count)

Fixed submission:
N=int(input())
A=list(map(int, input().split()))
A=sorted(A)
s=0
for num in range(1, N+1):
  count = 0
  for i in range(s, N-1):
    if A[i] == num:
      count += 1
    else:
      break
  s+=count
  print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int, input().split()))
for num in range(1, N+1):
  count = 0
  tmp = []
  for i in range(len(A)):
    if A[i] == num:
      count += 1
    else:
      tmp.append(A[i])
  A = tmp
  print(count)

Fixed submission:
N=int(input())
A=list(map(int, input().split()))
A=sorted(A)
s=0
for num in range(1, N+1):
  count = 0
  for i in range(s, N-1):
    if A[i] == num:
      count += 1
    else:
      break
  s+=count
  print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int, input().split()))
s=0
for num in range(1, N+1):
  count = 0
  for i in range(s, N-1):
    if A[i] == num:
      count += 1
  s+=count
  print(count)

Fixed submission:
N=int(input())
A=list(map(int, input().split()))
A=sorted(A)
s=0
for num in range(1, N+1):
  count = 0
  for i in range(s, N-1):
    if A[i] == num:
      count += 1
    else:
      break
  s+=count
  print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int, input().split()))
s=0
for num in range(N):
  count = 0
  for i in range(s, N-1):
    if A[i] == num+1:
      count += 1
    else:
      continue
  s+=count
  print(count)

Fixed submission:
N=int(input())
A=list(map(int, input().split()))
A=sorted(A)
s=0
for num in range(1, N+1):
  count = 0
  for i in range(s, N-1):
    if A[i] == num:
      count += 1
    else:
      break
  s+=count
  print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int, input().split()))
for num in range(N):
  count = 0
  for i in range(N-1):
    if A[i] == num+1:
      count += 1
  print(count)

Fixed submission:
N=int(input())
A=list(map(int, input().split()))
A=sorted(A)
s=0
for num in range(1, N+1):
  count = 0
  for i in range(s, N-1):
    if A[i] == num:
      count += 1
    else:
      break
  s+=count
  print(count)
Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
def gcd(i, j):
  if i<j:
    tmp=i
    i=j
    j=tmp
  if i%j==0:
    return j
  else:
    return gcd(j, i%j)
count = 0
for i in range(1, K+1):
  for j in range(1, K+1):
    x=gcd(i, j)
    for k in range(1, K+1):
      count += gcd(x, k)
print(count)


Fixed submission:
import math
K = int(input())
count = 0
for i in range(1, K+1):
  for j in range(1, K+1):
    x=math.gcd(i, j)
    for k in range(1, K+1):
      _gcd=math.gcd(x, k)
      count += _gcd
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
def gcd(i, j):
  if i%j==0:
    return j
  else:
    return gcd(j, i%j)
count = 0
for i in range(1, K+1):
  for j in range(1, K+1):
    x=gcd(i, j)
    for k in range(1, K+1):
      _gcd=gcd(x, k)
      count += _gcd
print(count)

Fixed submission:
import math
K = int(input())
count = 0
for i in range(1, K+1):
  for j in range(1, K+1):
    x=math.gcd(i, j)
    for k in range(1, K+1):
      _gcd=math.gcd(x, k)
      count += _gcd
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
import math
def gcd(i, j):
  if i<j:
    tmp=i
    i=j
    j=tmp
  if i%j==0:
    return j
  else:
    return gcd(j, i%j)
count = 0
for i in range(1, K+1):
  for j in range(1, K+1):
    x=gcd(i, j)
    for k in range(1, K+1):
      _gcd=gcd(x, k)
      count += _gcd
print(count)


Fixed submission:
import math
K = int(input())
count = 0
for i in range(1, K+1):
  for j in range(1, K+1):
    x=math.gcd(i, j)
    for k in range(1, K+1):
      _gcd=math.gcd(x, k)
      count += _gcd
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
import math
K = int(input())
count = 0
for i in range(1, K+1):
  for j in range(1, K+1):
    for k in range(1, K+1):
      _gcd=math.gcd(math.gcd(i, j), k)
      count += _gcd
print(count)

Fixed submission:
import math
K = int(input())
count = 0
for i in range(1, K+1):
  for j in range(1, K+1):
    x=math.gcd(i, j)
    for k in range(1, K+1):
      _gcd=math.gcd(x, k)
      count += _gcd
print(count)
Buggy python submission (verdict: Runtime Error):
l, r = map(int, list(input().split()))

if r - l >= 2018:
    print(0)

else:
    array = range(l, r + 1, 1)
    kouho = 2018
    for i in array:
        for j in array:
            if i != j:
                mod = (i * j) % 2019
                if kouho > mod:
                    kouho = mod

print(kouho)

Fixed submission:
l, r = map(int, list(input().split()))

if r - l >= 2018:
    print(0)

else:
    array = range(l, r + 1, 1)
    kouho = 2018
    for i in array:
        for j in array:
            if i != j:
                mod = (i * j) % 2019
                if kouho > mod:
                    kouho = mod

    print(kouho)
Buggy python submission (verdict: Runtime Error):
import fractions

abcd = list(map(int, input().split()))
a = abcd[0]
b = abcd[1]
c = abcd[2]
d = abcd[3]

aa = a - 1
lcm = (c * d) // fractinos.gcd(c, d)

a_count = aa - (aa // c) - (aa // d) + (aa // lcm)
b_count = b - (b // c) - (b // d) + (b // lcm)

print(b_count - a_count)

Fixed submission:
import fractions

abcd = list(map(int, input().split()))
a = abcd[0]
b = abcd[1]
c = abcd[2]
d = abcd[3]

aa = a - 1
lcm = (c * d) // fractions.gcd(c, d)

a_count = aa - (aa // c) - (aa // d) + (aa // lcm)
b_count = b - (b // c) - (b // d) + (b // lcm)

print(b_count - a_count)
Buggy python submission (verdict: Runtime Error):
nx = list(map(int, list(input().split())))
n = nx[0]
x = nx[1]

l = list(map(int, list(input().split())))

goukei = 0
for i in range(n + 1):
    if goukei > x:
        break
    goukei = goukei + l[i]

print(i)

Fixed submission:
nx = list(map(int, list(input().split())))
n = nx[0]
x = nx[1]

l = list(map(int, list(input().split())))

goukei = 0
for i in range(n + 1):
    if goukei > x:
        print(i)
        break
    if i == n:
        print(n + 1)
        break
    goukei = goukei + l[i]
Buggy python submission (verdict: Time Limit Exceeded):
nm = list(map(int, input().split()))
n = nm[0]
m = nm[1]
a = []
b = []

for i in range(n):
    ab = list(map(int, input().split()))
    a.append(ab[0])
    b.append(ab[1])

money = 0
count = 0

while count < m:
    minimum = min(a)
    num = a.index(minimum)
    money = money + minimum * b[num]
    count = count + b[num]
    if count > m:
        money = money - minimum * (count - m)
    del (a[num])
    del (b[num])

print(money)

Fixed submission:
nm = list(map(int, input().split()))
n = nm[0]
m = nm[1]
abs = []

for i in range(n):
    ab = list(map(int, input().split()))
    abs.append(ab)

abs = sorted(abs, key=lambda x: x[0])

money = 0
count = 0

for i in range(n):
    money = money + abs[i][0] * abs[i][1]
    count = count + abs[i][1]
    if count >= m:
        money = money - abs[i][0] * (count - m)
        break

print(money)

Buggy python submission (verdict: Time Limit Exceeded):
nm = list(map(int, input().split()))
n = nm[0]
m = nm[1]
a = []
b = []

for i in range(n):
    ab = list(map(int, input().split()))
    a.append(ab[0])
    b.append(ab[1])

money = 0
count = 0

while count < m:
    minimum = min(a)
    money = money + minimum

    num = a.index(minimum)
    b[num] = b[num] - 1
    if b[num] == 0:
        del(b[num])
        del(a[num])
    count = count + 1

print(money)

Fixed submission:
nm = list(map(int, input().split()))
n = nm[0]
m = nm[1]
abs = []

for i in range(n):
    ab = list(map(int, input().split()))
    abs.append(ab)

abs = sorted(abs, key=lambda x: x[0])

money = 0
count = 0

for i in range(n):
    money = money + abs[i][0] * abs[i][1]
    count = count + abs[i][1]
    if count >= m:
        money = money - abs[i][0] * (count - m)
        break

print(money)
Buggy python submission (verdict: Runtime Error):
n = int(input())
if n == 2:
    ab = list(map(int, input().split()))

if n == 1:
    print("Hello World")
if n == 2:
    print(ab[0] + ab[1])

Fixed submission:
n = int(input())
if n == 2:
    a = int(input())
    b = int(input())

if n == 1:
    print("Hello World")
if n == 2:
    print(a + b)

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

if n == 1:
    print("Hello World")
if n == 2:
    print(ab[0] + ab[1])



Fixed submission:
n = int(input())
if n == 2:
    a = int(input())
    b = int(input())

if n == 1:
    print("Hello World")
if n == 2:
    print(a + b)
Buggy python submission (verdict: Runtime Error):
n = int(input())
k = 1
kotae = []
kotae2 = []

if n != 0:
    while n != 0:
        if n % ((-2) ** k) == 0:
            kotae.append(0)
        else:
            kotae.append(1)
            n = n - ((-2) ** (k - 1))
        k = k + 1

    for i in kotae[::-1]:
        kotae2.append(i)

    print("".join(kotae2))
else:
    print(0)

Fixed submission:
n = int(input())
k = 1
kotae = []
kotae2 = []

if n != 0:
    while n != 0:
        if n % ((-2) ** k) == 0:
            kotae.append(0)
        else:
            kotae.append(1)
            n = n - ((-2) ** (k - 1))
        k = k + 1

    for i in kotae[::-1]:
        kotae2.append(str(i))

    print("".join(kotae2))
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
a_ = list(map(int,input().split()))

sum = sum(s_)
res = n - sum

if(res < 0):
    print(-1)
else:
    print(res)


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

sum = sum(a_)
res = n - sum

if(res < 0):
    print(-1)
else:
    print(res)
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

k=int(input())

cnt=0
for i in range(1,k+1):
    for j in range(1,k+1):
        for l in range(1,k+1):
            cnt += gcd(i,j,l)
print(cnt)

Fixed submission:
import math
from functools import reduce
import itertools

def gcd(*numbers):
    return reduce(math.gcd, numbers)

k=int(input())

l=[]
for i in range(1,k+1):
    l.append(i)

c_list = list(itertools.combinations_with_replacement(l,3))

cnt=0
for l in c_list:
    a = l[0]
    b = l[1]
    c = l[2]
    if a == b == c:
        d = 1
    elif a == b or b == c or c == a:
        d = 3
    else:
        d = 6
    cnt += gcd(a,b,c)*d
print(cnt)
Buggy python submission (verdict: Runtime Error):
x,y,z=list(map(int,input(),split()))

print(z,x,y)


Fixed submission:
x,y,z=list(map(int,input().split()))

print(z,x,y)

Buggy python submission (verdict: Runtime Error):
x,y,z=list(map(int,input(),splut()))

print(z,x,y)

Fixed submission:
x,y,z=list(map(int,input().split()))

print(z,x,y)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
q = int(input())

cnt = 0
for i in range(q):
    query = input().split()
    if query[0] == '1':
        cnt += 1
    else:
        if query[1] == '1':
            if cnt % 2 == 0:
                s = query[2] + s
            else:
                s = s + query[2]
        else:
            if cnt % 2 == 0:
                s = s + query[2]
            else:
                s = query[2] + s

if cnt % 2 == 0:
    print(s)
else:
    print(s[::-1])


Fixed submission:
s = input()
q = int(input())

t = ''
for i in range(q):
    query = input().split()
    if query[0] == '1':
        s,t = t,s
    else:
        if query[1] == '1':
            t += query[2] 
        else:
            s += query[2]

print(t[::-1] + s)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
q = int(input())

cnt = 0
for i in range(q):
    query = input().split()
    if query[0] == '1':
        cnt += 1
    else:
        if cnt % 2 == 0:
            if query[1] == '1':
                s = query[2] + s
            else:
                s = s + query[2]
        else:
            if query[1] == '1':
                s = s + query[2]
            else:
                s = query[2] + s
if cnt % 2 == 0:
    print(s)
else:
    print(s[::-1])


Fixed submission:
s = input()
q = int(input())

t = ''
for i in range(q):
    query = input().split()
    if query[0] == '1':
        s,t = t,s
    else:
        if query[1] == '1':
            t += query[2] 
        else:
            s += query[2]

print(t[::-1] + s)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
q = int(input())
for i in range(q):
    query = input().split()
    if query[0] == '1':
        s = s[::-1]
    else:
        if query[1] == '1':
            s = query[2] + s
        else:
            s = s + query[2]
print(s)


Fixed submission:
s = input()
q = int(input())

t = ''
for i in range(q):
    query = input().split()
    if query[0] == '1':
        s,t = t,s
    else:
        if query[1] == '1':
            t += query[2] 
        else:
            s += query[2]

print(t[::-1] + s)
Buggy python submission (verdict: Runtime Error):
n,r = map(int,input())

print(100 * (10 - n) + r)


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

if n < 10:
    print(100 * (10 - n) + r)
else:
    print(r)
Buggy python submission (verdict: Runtime Error):
n = int(input())
x_ = list(map(int,input().split()))

if n ==1:
    print(0)
else:
    cnt = 0
    res_ = []
    for i in range(x_[0],x_[n-1]):
        cnt = 0
        for j in range(len(x_)):
            cnt += (x_[j] - i)**2
        res_.append(cnt)

    print(min(res_))


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

if n ==1:
    print(0)
else:
    cnt = 0
    res_ = []
    for i in range(100):
        cnt = 0
        for j in range(len(x_)):
            cnt += (x_[j] - i)**2
        res_.append(cnt)

    print(min(res_))

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

cnt = 0
res_ = []
for i in range(1,x_[n-1]):
    cnt = 0
    for j in range(len(x_)):
        cnt += (x_[j] - i)**2
    res_.append(cnt)
print(min(res_))


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

if n ==1:
    print(0)
else:
    cnt = 0
    res_ = []
    for i in range(100):
        cnt = 0
        for j in range(len(x_)):
            cnt += (x_[j] - i)**2
        res_.append(cnt)

    print(min(res_))
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input())

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


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

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

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

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


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

if a == b != c or b == c != a or c == a != b:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
import collections
n = int(input())
s_ = [input() for i in range(n)]

cnt = collections.Counter(s_)
cntList = list(cnt.most_common())
cnt_f = cnt.most_common()[0][1]

resList = []
for i in range(n):
    if cntList[i][1] == cnt_f:
        resList.append(cntList[i][0])
    else:
        break

resList.sort()
for i in resList:
    print(i)


Fixed submission:
import collections
n = int(input())
s_ = [input() for i in range(n)]

cnt = collections.Counter(s_)
cntList = list(cnt.most_common())
cnt_f = cnt.most_common()[0][1]

resList = []
for i in range(len(cntList)):
    if cntList[i][1] == cnt_f:
        resList.append(cntList[i][0])
    else:
        break

resList.sort()
for i in resList:
    print(i)
Buggy python submission (verdict: Runtime Error):
s,t = input().split()
a,b = map(int,input().split())
u = input()

if u = s:
    print(a-1,b)
else:
    print(a,b-1)


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

if u == s:
    print(a-1,b)
else:
    print(a,b-1)
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
p_ = list(map(int,input().split()))
for i in range(n):
    p_[i] = p_[i]/2 +0.5

cnt,res =0,[]
for i in range(n-k+1):
    cnt = sum(p_[:i+k]) - sum(p_[:i])
    res.append(cnt)

print(max(res))


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

def calc_ex(x):
    return  x/2 + 0.5
p_ = list(map(calc_ex,p_))

res = sum(p_[:k])
cnt = sum(p_[:k])
for i in range(1,n-k+1):
    cnt = cnt - p_[i-1] + p_[i+k-1]
    res = max(res,cnt)
print(res)

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

def calc_ex(x):
    return  x/2 + 0.5
p_ = list(map(calc_ex,p_))

cnt,res =0,[]
for i in range(n-k+1):
    cnt = sum(p_[:i+k]) - sum(p_[:i])
    res.append(cnt)

print(max(res))


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

def calc_ex(x):
    return  x/2 + 0.5
p_ = list(map(calc_ex,p_))

res = sum(p_[:k])
cnt = sum(p_[:k])
for i in range(1,n-k+1):
    cnt = cnt - p_[i-1] + p_[i+k-1]
    res = max(res,cnt)
print(res)

Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
p_ = list(map(int,input().split()))

def calc_ex(x):
    return  x/2 + 0.5
p_ = list(map(calc_ex,p_))

cnt,res =0,[]
for i in range(2,n):
    cnt = sum(p_[i-k+1:i+1])
    res.append(cnt)

print(max(res))


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

def calc_ex(x):
    return  x/2 + 0.5
p_ = list(map(calc_ex,p_))

res = sum(p_[:k])
cnt = sum(p_[:k])
for i in range(1,n-k+1):
    cnt = cnt - p_[i-1] + p_[i+k-1]
    res = max(res,cnt)
print(res)
Buggy python submission (verdict: Runtime Error):
h,n = map(int,input().split())
a_ = list(map(int,input().split()))

a_.sort()
for i in range(n):
    a_[i] = 0
print(sum(a_))


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

if len(h_) <= k:
    print(0)
else:
    h_.sort(reverse = True)
    for i in range(k):
        h_[i] = 0
    print(sum(h_))
Buggy python submission (verdict: Runtime Error):
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)
a,b = map(int,input().split())

print(lcm(a,b))


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

def lcm(x, y):
    return (x * y) // gcd(x, y)
a,b = map(int,input().split())

print(lcm(a,b))

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

a,b=list(map(int,input().split()))

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

print(int(lcm(a, b)))

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

def lcm(x, y):
    return (x * y) // gcd(x, y)
a,b = map(int,input().split())

print(lcm(a,b))

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

a,b=list(map(int,input().split()))

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

print(lcm(a, b))

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

def lcm(x, y):
    return (x * y) // gcd(x, y)
a,b = map(int,input().split())

print(lcm(a,b))

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

a,b=list(map(int,input().split()))

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

print(lcm(a, b))


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

def lcm(x, y):
    return (x * y) // gcd(x, y)
a,b = map(int,input().split())

print(lcm(a,b))
Buggy python submission (verdict: Runtime Error):
X=input()
s=int(X[-1])+int(X[-2])*10

b=s//5
b_=s%5
c=b_//4
c_=b_%4
d=c_//3
d_=c_%3
e=d_//2
e_=d_%2
f=e_//1
f_=e_//1

sum=b+c+d+e+f
sum_=105*b+104*c+103*d+102*e+101*f

if 2100<int(X):
    print(1)
elif sum_>int(X):
    print(0)
else:
    print(1)

Fixed submission:
X=input()
if len(X)==1:
    s=int(X)
else:
    s=int(X[-1])+int(X[-2])*10
    

b=s//5
b_=s%5
c=b_//4
c_=b_%4
d=c_//3
d_=c_%3
e=d_//2
e_=d_%2
f=e_//1
f_=e_//1

sum=b+c+d+e+f
sum_=105*b+104*c+103*d+102*e+101*f

if sum_>int(X):
    print(0)
else:
    print(1)

Buggy python submission (verdict: Runtime Error):
X=input()
s=int(X[-1])+int(X[-2])*10

b=s//5
b_=s%5
c=b_//4
c_=b_%4
d=c_//3
d_=c_%3
e=d_//2
e_=d_%2
f=e_//1
f_=e_//1

sum=b+c+d+e+f
sum_=105*b+104*c+103*d+102*e+101*f

if sum_>int(X):
    print(0)
else:
    print(1)

Fixed submission:
X=input()
if len(X)==1:
    s=int(X)
else:
    s=int(X[-1])+int(X[-2])*10
    

b=s//5
b_=s%5
c=b_//4
c_=b_%4
d=c_//3
d_=c_%3
e=d_//2
e_=d_%2
f=e_//1
f_=e_//1

sum=b+c+d+e+f
sum_=105*b+104*c+103*d+102*e+101*f

if sum_>int(X):
    print(0)
else:
    print(1)
Buggy python submission (verdict: Runtime Error):
N=int(input())
S=input()
S_=[]
T=['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']

for j in range(len(S)):
    for i in range(len(T)):
        if S[j] == T[i]:
            S_.append(T[i+N])
            break

print(S_)

Fixed submission:
N=int(input())
S=input()
S_=[]
T=['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']

for j in range(len(S)):
    for i in range(len(T)):
        if S[j] == T[i]:
            if i+N>=len(T):
                S_.append(T[i+N-len(T)])
            else:
                S_.append(T[i+N])
            break

y=""
for x in S_:
    y+=x

print(y)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
l=list(map(int,input().split()))
l.sort()

cnt=0
for i in range(N-1):
    for j in range(i+1,N):
        k=j+1
        while k<N:
            if l[i]+l[j]>l[k]:
                cnt+=1
                k+=1
            else:
                cnt+=0
                k+=1
print(cnt)


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

cnt=0
for i in range(N-1):
    for j in range(i+1,N):
        ind = bisect.bisect_left(l,l[i]+l[j])
        cnt += ind - j-1

        # k=j+1
        # while k<N:
        #     if l[i]+l[j]>l[k]:
        #         cnt+=1
        #         k+=1
        #     else:
        #         cnt+=0
        #         k+=1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools as it

n=int(input())
l=list(map(int,input().split()))

com=list(it.combinations(l,3))
# print(com)
# print(len(com))

cnt=0
for i in com:
    if i[0]+i[1]>i[2] and i[1]+i[2]>i[0] and i[0]+i[2]>i[1]:
        cnt+=1
    else:
        cnt+=0
print(cnt)

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

cnt=0
for i in range(N-1):
    for j in range(i+1,N):
        ind = bisect.bisect_left(l,l[i]+l[j])
        cnt += ind - j-1

        # k=j+1
        # while k<N:
        #     if l[i]+l[j]>l[k]:
        #         cnt+=1
        #         k+=1
        #     else:
        #         cnt+=0
        #         k+=1
print(cnt)
Buggy python submission (verdict: Runtime Error):
N = input().split()
i = [int(input()) for i in range(int(N[0]))]

count=0
for j in i:
    if(j>=int(N[1])):
        count+=1

print(count)


Fixed submission:
N = input().split()
i = input().split()

count=0
for j in i:
    if(int(j)>=int(N[1])):
        count+=1

print(count)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=input().split()

j=1
result=[]
while j<=N:
    for i in range(len(A)):
        if int(A[i])==j:
            result.append(i+1)
            j+=1

print(*result)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
result = [0]*N
for i in range(N):
    result[A[i]-1] = i+1
print(*result)
Buggy python submission (verdict: Runtime Error):
N=int(input())
h=list(map(int,input().split()))

cnt=[]

for i in range(N-1):
    cnt_=0
    while h[i]>=h[i+1]:
        cnt_+=1
        if i==N-2:
            break
        else:
            i+=1
    cnt.append(cnt_)

print(max(cnt))

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

cnt=0
t=0
for i in range(N-1):
    if h[i]>=h[i+1]:
        t+=1
    else:
        t=0
    cnt=max(cnt,t)
print(cnt)