Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = list(map(int, input().split()))
plist = []
for i in range(n):
  plist.append(p[:i + 1])
count = 0
minn = n
for j in range(n):
  for k in plist[j]:
    if minn >= k:
      minn = k  
  if minn >= p[j]:
    count += 1
print(count)

Fixed submission:
n = int(input())
p = list(map(int, input().split()))
count = 0
minn = n
for j in range(len(p)):
  if minn >= p[j]:
    minn = p[j]
    count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
import heapq
n = int(input())
p = list(map(int, input().split()))
plist = []
for i in range(n):
  plist.append(p[:i + 1])
count = 0
for j in range(n):
  heapq.heapify(plist[j])
  mina = heapq.heappop(plist[j])
  if mina >= p[j]:
    count += 1
print(count)

Fixed submission:
n = int(input())
p = list(map(int, input().split()))
count = 0
minn = n
for j in range(len(p)):
  if minn >= p[j]:
    minn = p[j]
    count += 1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = list(map(int, input().split()))
plist = []
for i in range(n):
  plist.append(p[:i + 1])
count = 0
for j in range(n):
  if min(plist[j]) >= p[j]:
    count += 1
print(count)

Fixed submission:
n = int(input())
p = list(map(int, input().split()))
count = 0
minn = n
for j in range(len(p)):
  if minn >= p[j]:
    minn = p[j]
    count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = str(input())
alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
rot = []
for i in s:
  pos = alphabet.find(i)
  pos = int(pos) + n
  if pos > 26:
    pos = int(pos) - 26
  rot.append(alphabet[pos])
strout = "".join(rot)
print(strout)

Fixed submission:
n = int(input())
s = str(input())
alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
rot = []
for i in s:
  pos = alphabet.find(i)
  pos = int(pos) + n
  if pos >= 26:
    pos = int(pos) - 26
  rot.append(alphabet[pos])
strout = "".join(rot)
print(strout)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = str(input())
slist = []
for i in range(n):
  slist.append(s[i])
slime = slist[0]
fslist = [slime]
for i in range(1, n):
  if slime != slist[i]:
    fslist.append(slist[i])
    slime = slist[i]
print(len(fslist)

Fixed submission:
n = int(input())
s = str(input())
slist = []
for i in range(n):
  slist.append(s[i])
slime = slist[0]
fslist = []
fslist.append(slime)
for i in range(1, n):
  if slime != slist[i]:
    fslist.append(slist[i])
    slime = slist[i]
print(len(fslist))
Buggy python submission (verdict: Time Limit Exceeded):
n, k, q = map(int, input().split())
alist = []
for i in range(q):
  a = int(input())
  alist.append(a - 1)
pscore = [k] * n
for j in range(q):
  for k in range(n):
    if alist[j] != k:
      pscore[k] -= 1
for k in range(n):
  if pscore[k] <= 0:
    print('No')
  else:
    print('Yes')

Fixed submission:
n, k, q = map(int, input().split())
alist = []
for i in range(q):
  a = int(input())
  alist.append(a - 1)
pscore = [0] * n
for j in range(q):
  pscore[alist[j - 1]] += 1
for i in range(n):
  pscore[i] -= (q - k)
  if pscore[i] <= 0:
    print('No')
  else:
    print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
r = 0
for i in range(1, n):
  r += i
print(r)

Fixed submission:
n = int(input())
print(n * (n - 1) // 2)

Buggy python submission (verdict: Runtime Error):
n = int(input())
r = [0] * (n - 1)
for i in range(n - 1):
  r[i] = i
print(sum(r) + (n - 1))

Fixed submission:
n = int(input())
print(n * (n - 1) // 2)

Buggy python submission (verdict: Runtime Error):
n = int(input())
r = [0] * (n - 1)
for i in range(n - 1):
  r[i] = i + 1
print(sum(r))

Fixed submission:
n = int(input())
print(n * (n - 1) // 2)

Buggy python submission (verdict: Runtime Error):
n = int(input())
r = [0] * (n - 1)
for i in range(n - 1):
  r[i] = (i + 1) % (i + 2)
print(sum(r))

Fixed submission:
n = int(input())
print(n * (n - 1) // 2)

Buggy python submission (verdict: Runtime Error):
n = int(input())
p = [1] * n
q = [1] * n
r = [0] * n
for i in range(n):
  p[i] = i + 1
  q[i] = p[i] + 1
  r[i] = p[i] % q[i]
r[-1] = 0
print(sum(r))

Fixed submission:
n = int(input())
print(n * (n - 1) // 2)
Buggy python submission (verdict: Runtime Error):
s = str(input())
k = int(input())
if int(s[0]) == 1:
  print(s[1])
else:
  print(s[0])

Fixed submission:
s = str(input())
k = int(input())
i, count = 0, 0
while (i < len(s)):
  if int(s[i]) == 1:
    if (count >= k - 1):
      print('1')
      break
    count += 1
  else:
    print(s[i])
    break
  i += 1
Buggy python submission (verdict: Runtime Error):
x, y = map(int, input().split())
a = x
i = 0
al.append(a)
while (a < y):
  a *= 2
  i += 1
  if a >= y:
    break
print(i)

Fixed submission:
x, y = map(int, input().split())
a = x
i = 1
while (a <= y):
  a *= 2
  if a > y:
    break
  i += 1
print(i)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
w = max(a) - min(a) + 3
abucket = [0] * w
for i in range(n):
  abucket[a[i] - min(a)] += 1
  abucket[a[i] - 1 - min(a)] += 1
  abucket[a[i] + 1 - min(a)] += 1
print(max(abucket))

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
mina = min(a)
maxa = max(a)
w = maxa - mina + 3
abucket = [0] * w
for i in range(n):
  abucket[a[i] - mina] += 1
  abucket[a[i] - 1 - mina] += 1
  abucket[a[i] + 1 - mina] += 1
print(max(abucket))
Buggy python submission (verdict: Runtime Error):
import math
n = int(input())
f = []
for i in range(1, int(math.sqrt(n + 1))):
  if ((n % i) == 0):
    a = int(i)
    b = int(n / i)
    alen = len(str(a))
    blen = len(str(b))
    maxlen = max(alen, blen)
    f.append(maxlen)
print(min(f))

Fixed submission:
n = int(input())
f = []
for i in range(1, int(n ** 0.5) + 1):
  if ((n % i) == 0):
    a = int(i)
    b = int(n / i)
    alen = len(str(a))
    blen = len(str(b))
    maxlen = max(alen, blen)
    f.append(maxlen)
print(min(f))

Buggy python submission (verdict: Runtime Error):
import numpy as np
n = int(input())
f = []
for i in range(1, int(np.sqrt(n + 1))):
  if ((n % i) == 0):
    a = int(i)
    b = int(n / i)
    alen = len(str(a))
    blen = len(str(b))
    f.append(max(alen, blen))
print(min(f))


Fixed submission:
n = int(input())
f = []
for i in range(1, int(n ** 0.5) + 1):
  if ((n % i) == 0):
    a = int(i)
    b = int(n / i)
    alen = len(str(a))
    blen = len(str(b))
    maxlen = max(alen, blen)
    f.append(maxlen)
print(min(f))
Buggy python submission (verdict: Runtime Error):
alphabet = {0:"a",1:"b",2:"c",3:"d",4:"e",5:"f",6:"g",7:"h",8:"i",9:"j",10:"k",11:"l",12:"m",13:"n",14:"o",15:"p",16:"q",17:"r",18:"s",19:"t",20:"u",21:"v",22:"w",23:"x",24:"y",25:"z"}
N = int(input())
name = ""
while N != 0:
     index= int(N%26)
     name += alphabet[index-1]
     N = int(N/26)
print(name[::-1])


Fixed submission:
alphabet = {0:"a",1:"b",2:"c",3:"d",4:"e",5:"f",6:"g",7:"h",8:"i",9:"j",10:"k",11:"l",12:"m",13:"n",14:"o",15:"p",16:"q",17:"r",18:"s",19:"t",20:"u",21:"v",22:"w",23:"x",24:"y",25:"z"}
N = int(input())
name = ""
while N != 0:
     index= int(N%26)
     if index == 0:
         name += alphabet[25]
     else:
         name += alphabet[index-1]
     N = int((N-1)/26)
print(name[::-1])
Buggy python submission (verdict: Runtime Error):
import numpy

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(numpy.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

X = int(input())
result = 0
while result == 0:
    if is_prime(X):
        result = X
    else:
        X += 1
print(X)

Fixed submission:
import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

X = int(input())
result = 0
while result == 0:
    if is_prime(X):
        result = X
    else:
        X += 1
print(X)
Buggy python submission (verdict: Time Limit Exceeded):
def winList(t, r, s, p):
    if t == "r":
        return [0, 0, p]
    elif t == "s":
        return [r, 0, 0]
    else:
        return [0, s, 0]

N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()

dp = []
for i in range(N):
    wList = winList(T[i], R, S, P)
    if i <= K-1:
        if i == 0:
            dp.append(wList)
        else:
            dp.append([wList[0] + max(dp[i - 1]),
                       wList[1] + max(dp[i - 1]),
                       wList[2] + max(dp[i - 1])])
    else:
        tmpRPointList = []
        tmpSPointList = []
        tmpPPointList = []
        wKList = winList(T[i - K], R, S, P)
        for j in range(K):
            if dp[i - K][0] > dp[i - K][1] and dp[i - K][0] > dp[i - K][2]:
                tmpRPointList.append(wList[0] + max(dp[i - K + j]) - wKList[0])
            else:
                tmpRPointList.append(wList[0] + max(dp[i - K + j]))
            if dp[i - K][1] > dp[i - K][0] and dp[i - K][1] > dp[i - K][2]:
                tmpSPointList.append(wList[1] + max(dp[i - K + j]) - wKList[1])
            else:
                tmpSPointList.append(wList[1] + max(dp[i - K + j]))
            if dp[i - K][2] > dp[i - K][0] and dp[i - K][2] > dp[i - K][1]:
                tmpPPointList.append(wList[2] + max(dp[i - K + j]) - wKList[2])
            else:
                tmpPPointList.append(wList[2] + max(dp[i - K + j]))
        dp.append([max(tmpRPointList), max(tmpSPointList), max(tmpPPointList)])

print(max(dp[N-1]))


Fixed submission:
def winList(t, r, s, p):
    if t == "r":
        return [0, 0, p]
    elif t == "s":
        return [r, 0, 0]
    else:
        return [0, s, 0]

N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()

dp = []
for i in range(N):
    wList = winList(T[i], R, S, P)
    if i <= K-1:
        if i == 0:
            dp.append(wList)
        else:
            dp.append([wList[0] + max(dp[i - 1]),
                       wList[1] + max(dp[i - 1]),
                       wList[2] + max(dp[i - 1])])
    else:
        wKList = winList(T[i - K], R, S, P)
        tmpR = 0
        tmpS = 0
        tmpP = 0
        if dp[i - K][0] > dp[i - K][1] and dp[i - K][0] > dp[i - K][2]:
            tmpR = wList[0] + max(dp[i - 1]) - wKList[0]
        else:
            tmpR = wList[0] + max(dp[i - 1])

        if dp[i - K][1] > dp[i - K][0] and dp[i - K][1] > dp[i - K][2]:
            tmpS = wList[1] + max(dp[i - 1]) - wKList[1]
        else:
            tmpS = wList[1] + max(dp[i - 1])

        if dp[i - K][2] > dp[i - K][0] and dp[i - K][2] > dp[i - K][1]:
            tmpP = wList[2] + max(dp[i - 1]) - wKList[2]
        else:
            tmpP = wList[2] + max(dp[i - 1])
        dp.append([tmpR, tmpS, tmpP])

print(max(dp[N-1]))
Buggy python submission (verdict: Runtime Error):
N = int(input())
hList = list(map(int, input().split()))

if len(hList) == 1:
    print(hList[0])
    return

minimum = abs(hList[0] - hList[1])
for index in range(2, len(hList)):
    minimum = min(abs(hList[index] - hList[index-1]), abs(hList[index] - hList[index-2]))
print(minimum)

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

dp = [0] * N
dp[1] = abs(hList[1] - hList[0])
for index in range(2, N):
    dp[index] = min(dp[index-1] + abs(hList[index] - hList[index-1]),
                    dp[index-2] + abs(hList[index] - hList[index-2]))
print(dp[-1])
Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
X = int(input())

value = 0
for a in range(0, A+1):
	for b in range(0, B+1):
        for c in range(0, C+1):
            if 500*a + 100*b + 50*c == X:
                value += 1
print(value)

Fixed submission:
A = int(input())
B = int(input())
C = int(input())
X = int(input())

value = 0
for a in range(0, A+1):
    for b in range(0, B+1):
        for c in range(0, C+1):
            if 500*a + 100*b + 50*c == X:
                value += 1
print(value)

Buggy python submission (verdict: Runtime Error):
    A = int(input())
    B = int(input())
    C = int(input())
    X = int(input())

    value = 0
    for a in range(0, A+1):
        for b in range(0, B+1):
            for c in range(0, C+1):
                if 500*a + 100*b + 50*c == X:
                    value += 1
    print(value)

Fixed submission:
A = int(input())
B = int(input())
C = int(input())
X = int(input())

value = 0
for a in range(0, A+1):
    for b in range(0, B+1):
        for c in range(0, C+1):
            if 500*a + 100*b + 50*c == X:
                value += 1
print(value)
Buggy python submission (verdict: Runtime Error):
import sys
import collections as cc
import math as mt
I=lambda:list(map(int,input().split()))
a,b,c,d=I()
print(max(a*c,a*d,b*d,b*d))

Fixed submission:
import sys
import collections as cc
import math as mt
I=lambda:list(map(int,input().split()))
n,=I()
if n==1:
	print(0)
else:
	print(1)
Buggy python submission (verdict: Runtime Error):
34I=lambda:list(map(int,input().split()))
mod=10**9+7
n,=I()
l=I()
pre=l.copy()
suf=l.copy()
for i in range(n-2,-1,-1):
	suf[i]+=suf[i+1]
ans=0
#print(suf)
for i in range(n-1):
	ans+=(l[i]*suf[i+1])
	ans%=mod
print(ans)


Fixed submission:
I=lambda:list(map(int,input().split()))
mod=10**9+7
n,=I()
l=I()
pre=l.copy()
suf=l.copy()
for i in range(n-2,-1,-1):
	suf[i]+=suf[i+1]
ans=0
#print(suf)
for i in range(n-1):
	ans+=(l[i]*suf[i+1])
	ans%=mod
print(ans)
Buggy python submission (verdict: Runtime Error):
I=lambda:list(map(int,input().spilt()))
n,d=I()
def ch(a,b):
    return a**2+b**2
ans=0
for i in range(n):
    x,y=I()
    if ch(x,y)<=d:
        ans+=1
print(ans)
    
    

Fixed submission:
I=lambda:list(map(int,input().split()))
n,d=I()
def ch(a,b):
    return a**2+b**2
ans=0
for i in range(n):
    x,y=I()
    if ch(x,y)<=d*d:
        ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
Iimport math as mt
import sys
I=lambda:list(map(int,input().split()))
n,k=I()
l=sorted(I())
print(sum(l[:k]))


Fixed submission:
I=lambda:list(map(int,input().split()))
n,k=I()
l=sorted(I())
print(sum(l[:k]))
Buggy python submission (verdict: Runtime Error):
import math as mt
import collections as cc
I=lambda:list(map(int,input().split()))
ans=[]
prev=0
for i in range(1,15):
    ans.append(26**i+prev)
    prev+=26**i
    
n,=I()
p=0
s='abcdefghijklmnopqrstuvwxyz'
f={}
for i in range(1,27):
    f[i]=s[i-1]
for i in range(len(ans)):
    p+=1
    if n<=ans[i]:
        break
an=''
for i in range(p):
    an+=f[n%26]
    n//=26
print(an)
    

Fixed submission:
import math as mt
import collections as cc
I=lambda:list(map(int,input().split()))
ans=[]
prev=0
for i in range(1,15):
    ans.append(26**i+prev)
    prev+=26**i
    
n,=I()
p=0
s='abcdefghijklmnopqrstuvwxyz'
f={}
for i in range(1,27):
    f[i]=s[i-1]
for i in range(len(ans)):
    p+=1
    if n<=ans[i]:
        break
an=''
f[0]='z'
for i in range(p):

    an+=f[n%26]
    if n%26:
        n//=26
    else:
        n//=26
        n-=1
    
print(an[::-1])
Buggy python submission (verdict: Runtime Error):
import bisect as bi
import collections as cc
I=lambda:list(map(int,input().split()))
x,=I()
ar=[]
i=1

t=bi.bisect_left(ar,x)
for i in range(-100,100):
    for j in range(-100,100):
        if (i**5)-(j**5)==x:
            print(i,j)
            fl=0
            break
    if not fl:
        break

Fixed submission:
import bisect as bi
import collections as cc
I=lambda:list(map(int,input().split()))
x,=I()
ar=[]
i=1
fl=1

t=bi.bisect_left(ar,x)
for i in range(-1000,1000):
    for j in range(-1000,1000):
        if pow(i,5)-pow(j,5)==x:
            print(i,j)
            fl=0
            break
    if not fl:
        break
Buggy python submission (verdict: Runtime Error):
import bisect as bi
import collections as cc
I=lambda:list(map(int,input().split()))
f=cc.defaultdict(int)
n,=I()
l=I()
ans=0
for i in range(n):
    d[l[i]+i]+=1
    ans+=d[i-l[i]]
print(ans)
    
    
    

Fixed submission:
import bisect as bi
import collections as cc
I=lambda:list(map(int,input().split()))
d=cc.defaultdict(int)
n,=I()
l=I()
ans=0
for i in range(n):
    d[l[i]+i]+=1
    ans+=d[i-l[i]]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
I=lambda:list(map(int,input().split()))
p,n=I()
l=I()
mi=10**9+7
for i in range(n):
    te=0
    j=i
    while (j+1)%n!=i%n:
        if j==n-1:
            te+=abs(l[-1]-sum(l))
        else:
            te+=abs(l[j%n]-l[(j+1)%n])
        j+=1
    mi=min(te,mi)
l=l[::-1]
for i in range(n):
    te=0
    j=i
    while (j+1)%n!=i%n:
        if j==n-1:
            te+=abs(l[-1]-sum(l))
        else:
            te+=abs(l[j%n]-l[(j+1)%n])
        j+=1
    mi=min(te,mi)


print(mi)
        


Fixed submission:
I=lambda:list(map(int,input().split()))
p,n=I()
l=I()
ne=[]
ma=10**9+7
for i in range(n-1):
    ne.append(abs(l[i]-l[i+1]))
if l[-1]==p:
    ne.append(l[0]-l[-1])
else:    
    ne.append(l[0]+abs(p-l[-1]))
g=sum(ne)
for i  in ne:
    ma=min(ma,g-i)
print(ma)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
def fastio():
    from io import StringIO
    from atexit import register
    global input
    sys.stdin = StringIO(sys.stdin.read())
    input = lambda : sys.stdin.readline().rstrip('\r\n')
    sys.stdout = StringIO()
    register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()
import collections as cc
n=int(input())
l=list(map(int,input().split()))
ff=cc.Counter(l)
ff=dict(ff)
ans=[]
for i in range(n):
    f=ff.copy()
    f[l[i]]=max(0,f[l[i]]-1)
    t=0
    for i in f:
        x=f[i]
        t+=(x*(x-1))//2
    ans.append(t)
for i in ans:
    print(i)
    
    

Fixed submission:
import collections as cc
n=int(input())
l=list(map(int,input().split()))
ff=cc.Counter(l)
ff=dict(ff)
ans=0
for i in ff:
    x=ff[i]
    ans+=(x*(x-1))//2
v={}
for i in set(l):
    vv=max(ff[i]-1,0)
    te=ans-(ff[i]*(ff[i]-1))//2+(vv*(vv-1))//2
    v[i]=te
for i in l:
    print(v[i])

Buggy python submission (verdict: Time Limit Exceeded):
import collections as cc
n=int(input())
l=list(map(int,input().split()))
ff=cc.Counter(l)
ff=dict(ff)
ans=[]
for i in range(n):
    f=ff.copy()
    f[l[i]]=max(0,f[l[i]]-1)
    t=0
    for i in f:
        x=f[i]
        t+=(x*(x-1))//2
    ans.append(t)
for i in ans:
    print(i)
    
    


Fixed submission:
import collections as cc
n=int(input())
l=list(map(int,input().split()))
ff=cc.Counter(l)
ff=dict(ff)
ans=0
for i in ff:
    x=ff[i]
    ans+=(x*(x-1))//2
v={}
for i in set(l):
    vv=max(ff[i]-1,0)
    te=ans-(ff[i]*(ff[i]-1))//2+(vv*(vv-1))//2
    v[i]=te
for i in l:
    print(v[i])

Buggy python submission (verdict: Time Limit Exceeded):
import collections as cc
n=int(input())
l=list(map(int,input().split()))
ff=cc.Counter(l)
ff=dict(ff)
ans=[]
for i in range(n):
    f=ff.copy()
    f[l[i]]=max(0,f[l[i]]-1)
    t=0
    for i in f:
        x=f[i]
        t+=(x*(x-1))//2
    ans.append(t)
for i in ans:
    print(i)
    
    

Fixed submission:
import collections as cc
n=int(input())
l=list(map(int,input().split()))
ff=cc.Counter(l)
ff=dict(ff)
ans=0
for i in ff:
    x=ff[i]
    ans+=(x*(x-1))//2
v={}
for i in set(l):
    vv=max(ff[i]-1,0)
    te=ans-(ff[i]*(ff[i]-1))//2+(vv*(vv-1))//2
    v[i]=te
for i in l:
    print(v[i])
Buggy python submission (verdict: Time Limit Exceeded):

def minCost(cost, m, n): 
	if (n < 0 or m < 0): 
		return 10**9+7
	elif (m == 0 and n == 0): 
		return cost[m][n] 
	else: 
		return cost[m][n] + min(minCost(cost,m-1,n),minCost(cost,m,n-1)) 


n,m=map(int,input().split())
a=[]
x=0
for i in range(n):
    s=input().replace('.','0').replace('#','1')
    ss=[int(i) for i in s]
    a.append(ss)
x=minCost(a,n-1,m-1)
print(x)



Fixed submission:
n,m=map(int,input().split())
s=[list(input()) for i in range(n)]
ans=[[10**9+7]*m for i in range(n)]
ans[0][0]=int(s[0][0]=='#')
for i in range(n):
    for j in range(m):
        if i>0:
            #ans[i][j]=min(ans[i][j]+ans[i-1][j]+int(s[i-1][j]=='.' and s[i][j]=='#'))
            ans[i][j]=min(ans[i][j],ans[i-1][j]+int(s[i-1][j]=='.'and s[i][j]=='#'))
        if j>0:
            ans[i][j]=min(ans[i][j],ans[i][j-1]+int(s[i][j-1]=='.' and s[i][j]=='#'))
print(ans[n-1][m-1])
Buggy python submission (verdict: Runtime Error):
from collections import deque
ans=deque()
ans.append(input())
c=0
qu=[input().split() for i in range(int(input()))]
c=0
for i in qu:
    if i[0]=='1':
        c+=1
    else:
        if c%2==0:
            if i[1]=='1':
                ans.appendleft(i[2])
            else:
                ans.append(i[2])
        else:
            ans=ans[::-1]
            if i[1]=='1':
                ans.appendleft(i[2])
            else:
                ans.append(i[2])
            
print(''.join(ans))

Fixed submission:
from collections import deque
S = deque(input())
N = int(input())
is_inversed = False
for i in range(N):
    Q = input()
    if Q[0] == '1':
        is_inversed = not (is_inversed)
    else:
        if (Q[2] == '1' and is_inversed) or (Q[2] == '2' and not (is_inversed)):
            S.append(Q[4])
        else:
            S.appendleft(Q[4])
if is_inversed:
    print(''.join(list(S)[::-1]))
else:
    print(''.join(S))

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

Fixed submission:
from collections import deque
S = deque(input())
N = int(input())
is_inversed = False
for i in range(N):
    Q = input()
    if Q[0] == '1':
        is_inversed = not (is_inversed)
    else:
        if (Q[2] == '1' and is_inversed) or (Q[2] == '2' and not (is_inversed)):
            S.append(Q[4])
        else:
            S.appendleft(Q[4])
if is_inversed:
    print(''.join(list(S)[::-1]))
else:
    print(''.join(S))
Buggy python submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
f=1
for i in range(n-1):
	if l[i]==l[i+1]:
        f=0
        break
if f:
	print("YES")
else:
	print("NO")


Fixed submission:
n=int(input())
l=list(map(int,input().split()))
if len(set(l))==n:
    print("YES")
else:
    print("NO")

Buggy python submission (verdict: Runtime Error):
n=int(input())
l=list(map(int,input().split()))
f=1
for i in range(n-1):
	if l[i]==l[i+1]:
      f=0
      break
if f:
	print("YES")
else:
	print("NO")

Fixed submission:
n=int(input())
l=list(map(int,input().split()))
if len(set(l))==n:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
l=list(map(int,input().spliit()))
if max(l)>=a:
	print('Yes')
else:
	print("No")

Fixed submission:
a,b=map(int,input().split())
l=list(map(int,input().split()))
if sum(l)>=a:
	print('Yes')
else:
	print("No")

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input(.split()))
*aa,=map(int,input().split())
if max(aa)>=a:
    print("yes")
else:
    print('no')


Fixed submission:
a,b=map(int,input().split())
l=list(map(int,input().split()))
if sum(l)>=a:
	print('Yes')
else:
	print("No")

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input(.split()))
aa=max(map(int,input().split()))
if aa>=a:
    print("yes")
else:
    print('no')


Fixed submission:
a,b=map(int,input().split())
l=list(map(int,input().split()))
if sum(l)>=a:
	print('Yes')
else:
	print("No")

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input(.split()))
aa=max(map(int,input().split()))
if aa>=a:
    print("yes")
else:
    print('No')


Fixed submission:
a,b=map(int,input().split())
l=list(map(int,input().split()))
if sum(l)>=a:
	print('Yes')
else:
	print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
l=list(map(int,input().split()))
f={}
x=1
for i in range(n):
    f[x]=l[i]
    x+=1
    
ans=0   
for i in range(n):
    flag=1
    for j in range(i):
        if l[i]>l[j]:
            flag=0
    if flag:
        ans+=1
        
print(ans)

Fixed submission:
n=int(input())
l=list(map(int,input().split()))
f={}
x=1
   
ans=n
min=l[0]
c=0
for i in range(n):
    if l[i]<=min:
        #ans+=1
        min=l[i]
    else:
        c+=1
        #print(l[i])
        
    #print(min)
    
print(ans-c)
Buggy python submission (verdict: Runtime Error):
s=input()
print(char(ord(s)+1))

Fixed submission:
s=input()
print(chr(ord(s)+1))