Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
s = list(input())
q = int(input())
 
me = 1#1:sei  -1:gyaku
for i in range(q):
    t = input().split()
    if t[0] == '1':
        me *= -1
            
    else:# 0=2
        if t[1]=='1':#1=1
            s.insert(0,t[2]) if me == 1 else s.append(t[2])
        else:#1=2
            s.append(t[2]) if me == 1 else s.insert(0,t[2])
 
if me != 1:
    s = s[::-1]
print(''.join(s))

Fixed submission:
from collections import deque

s = deque(input())
q = int(input())
 
me = 1#1:sei  -1:gyaku
for i in range(q):
    t = input().split()
    if t[0] == '1':
        me *= -1
            
    else:# 0=2
        if t[1]=='1':#1=1
            s.appendleft(t[2]) if me == 1 else s.append(t[2])
        else:#1=2
            s.append(t[2]) if me == 1 else s.appendleft(t[2])
s= list(s) 
if me != 1:
    s = s[::-1]
print(''.join(s))

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

me = 1#1:sei  -1:gyaku
for i in range(q):
    t = input().split()
    if t[0] == '1':
        me *= -1
            
    else:# 0=2
        if t[1]=='1':#1=1
            if me == 1:
                s.insert(0,t[2])
            else:
                s.append(t[2])
        else:#1=2
            if me == 1:
                s.append(t[2])
            else:
                s.insert(0,t[2])

if me != 1:
    s = s[::-1]
print(''.join(s))

Fixed submission:
from collections import deque

s = deque(input())
q = int(input())
 
me = 1#1:sei  -1:gyaku
for i in range(q):
    t = input().split()
    if t[0] == '1':
        me *= -1
            
    else:# 0=2
        if t[1]=='1':#1=1
            s.appendleft(t[2]) if me == 1 else s.append(t[2])
        else:#1=2
            s.append(t[2]) if me == 1 else s.appendleft(t[2])
s= list(s) 
if me != 1:
    s = s[::-1]
print(''.join(s))

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

q = int(input())

me = 1#1:sei  -1:gyaku
for i in range(q):
    t = input().split()
    if t[0] == '1':
        me *= -1
            
    else:# 0=2
        if t[1]=='1':#1=1
            if me == 1:
                s.insert(0,t[2])
            else:
                s.append(t[2])
        else:#1=2
            if me == 1:
                s.append(t[2])
            else:
                s.insert(0,t[2])

if me == 1:
    print(''.join(s))
else:
    for i in range((len(s)-1),-1,-1):
        print(s[i],end='')

Fixed submission:
from collections import deque

s = deque(input())
q = int(input())
 
me = 1#1:sei  -1:gyaku
for i in range(q):
    t = input().split()
    if t[0] == '1':
        me *= -1
            
    else:# 0=2
        if t[1]=='1':#1=1
            s.appendleft(t[2]) if me == 1 else s.append(t[2])
        else:#1=2
            s.append(t[2]) if me == 1 else s.appendleft(t[2])
s= list(s) 
if me != 1:
    s = s[::-1]
print(''.join(s))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
b = []
wk = wk1 = 0

for i in range(n):
    if a[i]%2 == 0:
        b.append(a[i])

for j in range(len(b)):
    if b[j]%3 == 0 or b[j]%5 == 0:
        wk = 1
    else:
        wk1 = 1
if wk1 == 1:
    print('DENIED')
else:5
    print('APPROVED')

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

for i in range(n):
    if a[i]%2 == 0:
        b.append(a[i])

for j in range(len(b)):
    if b[j]%3 == 0 or b[j]%5 == 0:
        wk = 1
    else:
        wk1 = 1
if wk1 == 1:
    print('DENIED')
else:
    print('APPROVED')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
suuretu = list(map(int,input().split()))
nn = mm = 0
for nn in range(n-1):
    for mm in range(nn+1,n):
        if suuretu[nn] == suuretu[mm]:
            print('NO')
            exit()            
print('YES')

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

if len(li) == len(set(li)):
    print('YES')
else:
    print('NO')

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
suuretu = list(map(int,input().split()))
nn = frg = 0
while nn <= n-2:
    mm = nn+1
    while mm <= n-1:
        if suuretu[nn] == suuretu[mm]:
            frg = 1
            print('NO')
            break
        else:
            mm +=1
    nn += 1
if frg != 1:
    print('YES')

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

if len(li) == len(set(li)):
    print('YES')
else:
    print('NO')

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
suuretu = list(map(int,input().split()))
nn = frg = 0

while nn <= n-2:
    mm = nn+1
    while mm <= n-1:
        if suuretu[nn] == suuretu[mm]:
            frg = 1
            break
        else:
            mm +=1
    nn += 1
if frg == 1:
    print('NO')
else:
    print('YES')

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

if len(li) == len(set(li)):
    print('YES')
else:
    print('NO')

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
suuretu = list(map(int,input().split()))
nn = frg = 0
for nn in range(0,n-1):
    for mm in range(nn+1,n):
        if suuretu[nn] == suuretu[mm]:
            frg = 1
if frg == 1:
    print('NO')
else:
    print('YES')

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

if len(li) == len(set(li)):
    print('YES')
else:
    print('NO')

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
suuretu = list(map(int,input().split()))
nn = frg = 0

for nn in range(0,n-1):
    for mm in range(nn+1,n):
        if suuretu[nn] == suuretu[mm]:
            frg = 1
            break
    else:
        if frg == 1:
            break
if frg == 1:
    print('NO')
else:
    print('YES')

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

if len(li) == len(set(li)):
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
li = list(map(int,input().split()))
li = list(map(lambda x:(x+1)/2,li))
wk = 0
nn = n-k+1
kai = [None]*(nn)

for y in range(nn):
    wk = 0
    for x in range(y,k+y):
        wk = wk + li[x]
    kai[x] = wk
 
print(max(kai))

Fixed submission:
n,k = map(int,input().split())
li = list(map(int,input().split()))
li = list(map(lambda x:(x+1)/2,li))

wk = 0
nn = n-k

for i in range(0,k):
    wk += li[i]
kwk = wk
for j in range(nn):
    wk = wk - li[j]
    wk = wk + li[j+k]
    kwk = max(wk,kwk)
 
print(kwk)

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
li = list(map(int,input().split()))
li = list(map(lambda x:(x+1)/2,li))
wk = 0
kai = []
nn = n-k+1

for y in range(nn):
    wk = 0
    for x in range(y,k+y):
        wk = wk + li[x]
    kai.append(wk)
 
print(max(kai))

Fixed submission:
n,k = map(int,input().split())
li = list(map(int,input().split()))
li = list(map(lambda x:(x+1)/2,li))

wk = 0
nn = n-k

for i in range(0,k):
    wk += li[i]
kwk = wk
for j in range(nn):
    wk = wk - li[j]
    wk = wk + li[j+k]
    kwk = max(wk,kwk)
 
print(kwk)

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
sai = list(map(int,input().split()))
sai = list(map(lambda x:(x+1)/2,sai))
kai = []

for nn in range(n-k+1):
    kai.append(sum(sai[nn:nn+k]))

print(max(kai))

Fixed submission:
n,k = map(int,input().split())
li = list(map(int,input().split()))
li = list(map(lambda x:(x+1)/2,li))

wk = 0
nn = n-k

for i in range(0,k):
    wk += li[i]
kwk = wk
for j in range(nn):
    wk = wk - li[j]
    wk = wk + li[j+k]
    kwk = max(wk,kwk)
 
print(kwk)

Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
sai = list(map(int,input().split()))
kk = []
for x in range(len(sai)):
    sai[x] = ((sai[x]+1)*sai[x])/2/sai[x]
for y in range(n-k+1):
    kk.append(sum(sai[y:y+k]))
print(max(kk))

Fixed submission:
n,k = map(int,input().split())
li = list(map(int,input().split()))
li = list(map(lambda x:(x+1)/2,li))

wk = 0
nn = n-k

for i in range(0,k):
    wk += li[i]
kwk = wk
for j in range(nn):
    wk = wk - li[j]
    wk = wk + li[j+k]
    kwk = max(wk,kwk)
 
print(kwk)
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce


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


total = 0
N = int(input())
for i in range(1, N+1):
    for j in range(1, N+1):
        x = gcd(i, j)
        for k in range(1, N+1):
            total += gcd(x, k)

print(total)


Fixed submission:
import math
from functools import reduce


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


total = 0
N = int(input())
for i in range(1,N+1):
    for j in range(1,N+1):
        for k in range(1,N+1):
            total += gcd(i, j, k)

print(total)

Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce


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


total = 0
N = int(input())
for i in range(1,N+1):
    for j in range(1,N+1):
        for k in range(1,N+1):
            total += gcd(i, j, k)

print(total)


Fixed submission:
import math
from functools import reduce


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


total = 0
N = int(input())
for i in range(1,N+1):
    for j in range(1,N+1):
        for k in range(1,N+1):
            total += gcd(i, j, k)

print(total)
Buggy python submission (verdict: Time Limit Exceeded):
def fact(n):
    fact = 1
    for integer in range(1, n + 1):
        fact *= integer
    return fact
def combinations_count(n, r):
    return fact(n) // (fact(n - r) * fact(r))

ab = input().split()
a, b = int(ab[0]), int(ab[1])
sum=a+b
if sum % 3==0:
	n=int(sum/3)
	m=b-n
	print(int(combinations_count(n, m))%(10**9+7))
else:
	print("0")

Fixed submission:
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result % (10 ** 9 + 7)
ab = input().split()
a, b = int(ab[0]), int(ab[1])
sum = a + b
if a>(2*b) or b>(2*a):
	print("0")
elif sum % 3 == 0:
    n = int(sum / 3)
    m = b - n
    print(cmb(n, m))
else:
	print("0")

Buggy python submission (verdict: Runtime Error):
import math
ab = input().split()
a, b = int(ab[0]), int(ab[1])
n=int((a+b)/3)
m=a-n
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

print(combinations_count(n, m))

Fixed submission:
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result % (10 ** 9 + 7)
ab = input().split()
a, b = int(ab[0]), int(ab[1])
sum = a + b
if a>(2*b) or b>(2*a):
	print("0")
elif sum % 3 == 0:
    n = int(sum / 3)
    m = b - n
    print(cmb(n, m))
else:
	print("0")
Buggy python submission (verdict: Runtime Error):
[N,K]=L()

def L():
    return list(map(int, input().split()))
print(N-K+1)

Fixed submission:
def L():
    return list(map(int, input().split()))

[N,K]=L()


print(N-K+1)
Buggy python submission (verdict: Runtime Error):
def L():
    return list(map(int, input().split()))

[x,y]=L()

if x%y==0:
  print(-1)
else:
  print x

Fixed submission:
def L():
    return list(map(int, input().split()))

[x,y]=L()

if x%y==0:
  print(-1)
else:
  print(x)
Buggy python submission (verdict: Runtime Error):
import re

pattern = re.compile("R+")
print(len(re.search(pattern, input()).group(0)))

Fixed submission:
s = input()

if "RRR" in s:
    print(3)
elif "RR" in s:
    print(2)
elif "R" in s:
    print(1)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;

int main(){
    double sr;
    long long int lr;
    cin >> lr >> sr;

    cout << (long long int)(double(lr%1000) * sr)+(lr/1000)*((long long int)(sr*1000)) << endl;
}


Fixed submission:
a = int(input())
li = list(map(int,input().split()))
total = 1
i = 1
for i in range(a):
    total = total*li[i]
    if total > 1000000000000000000:
        total = -1
        break
for i in range(a):
    if li[i] == 0:
        total = 0

print(total)
Buggy python submission (verdict: Runtime Error):
import math
N,X,T=float(int,input().split())
B=math.ceil(N/X)
A=T*B
print(A)

Fixed submission:
import math
n, x, t = map(int, input().split())
if n % x == 0:
    c = n / x
else:
    b = n / x
    c = math.ceil(b)
a = int(c * t)
print(a)

Buggy python submission (verdict: Runtime Error):
from math import ceil,floor
N,X,T=input().split()
A=T*(ceil(N/X))
print(A)

Fixed submission:
import math
n, x, t = map(int, input().split())
if n % x == 0:
    c = n / x
else:
    b = n / x
    c = math.ceil(b)
a = int(c * t)
print(a)

Buggy python submission (verdict: Runtime Error):
import math
N,X,T=input().split()
B=math.ceil(N/X)
A=T*B
print(A)

Fixed submission:
import math
n, x, t = map(int, input().split())
if n % x == 0:
    c = n / x
else:
    b = n / x
    c = math.ceil(b)
a = int(c * t)
print(a)

Buggy python submission (verdict: Runtime Error):
import math
N,X,T=map(int,input().split))
B=math.ceil(N/X)
A=T*B
print(A)

Fixed submission:
import math
n, x, t = map(int, input().split())
if n % x == 0:
    c = n / x
else:
    b = n / x
    c = math.ceil(b)
a = int(c * t)
print(a)

Buggy python submission (verdict: Runtime Error):
import math
N,X,T=map(int,input().split))
A=T*(math.ceil(N/X))
print(A)

Fixed submission:
import math
n, x, t = map(int, input().split())
if n % x == 0:
    c = n / x
else:
    b = n / x
    c = math.ceil(b)
a = int(c * t)
print(a)
Buggy python submission (verdict: Runtime Error):
def digitSum(n):
    s = str(n)
    array = list(map(int, s))
    return sum(array)
a= int(input())
if digitSum(a) % 9 == 0:
    print(Yes)
else:
    print(No)

Fixed submission:
def digitSum(n):
    s = str(n)
    array = list(map(int, s))
    return sum(array)
N = int(input())
if digitSum(N) % 9 == 0:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
def digitSum(n):
    s = str(n)
    array = list(map(int, s))
    return sum(array)
a= int(input())
if digitsum(a) % 9 == 0:
    print(Yes)
else:
    print(No)

Fixed submission:
def digitSum(n):
    s = str(n)
    array = list(map(int, s))
    return sum(array)
N = int(input())
if digitSum(N) % 9 == 0:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
N=int(input())
if N%9==0:
    print(Yes)
else:
    print(No)

Fixed submission:
def digitSum(n):
    s = str(n)
    array = list(map(int, s))
    return sum(array)
N = int(input())
if digitSum(N) % 9 == 0:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
input_lines = raw_input().split()
a = int(input_lines[0])
b = int(input_lines[1])

print(a * b - (a + b - 1))


Fixed submission:
input_lines = input().split()
a = int(input_lines[0])
b = int(input_lines[1])

print(a * b - (a + b - 1))
Buggy python submission (verdict: Runtime Error):
X = int(input())

max = 1
for i in range(1,X+1):
    for j in range(2,i+1):
        for k in range(2,j+1):
            if j ** k == i:
                max = i
            if j ** k > i:
                break

print(max)


Fixed submission:
input_lines = input().split()
a = int(input_lines[0])
b = int(input_lines[1])
c = int(input_lines[2])
d = int(input_lines[3])

flag = 0
if abs(c - a) > d:
    if abs(b - a) > d or abs(c - b) > d:
        flag = 1

if flag == 0:
    print("Yes")
else:
    print("No")

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

max = 1
for i in range(1,X+1):
    for j in range(2,i+1):
        for k in range(2,j+1):
            if j ** k == i:
                max = i
            if j ** k > i:
                break

print(max)


Fixed submission:
input_lines = input().split()
a = int(input_lines[0])
b = int(input_lines[1])
c = int(input_lines[2])
d = int(input_lines[3])

flag = 0
if abs(c - a) > d:
    if abs(b - a) > d or abs(c - b) > d:
        flag = 1

if flag == 0:
    print("Yes")
else:
    print("No")

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

max = 1
for i in range(1,X+1):
    for j in range(2,i+1):
        for k in range(2,j):
            if j ** k == i:
                max = i
            if j ** k > i:
                break

print(max)


Fixed submission:
input_lines = input().split()
a = int(input_lines[0])
b = int(input_lines[1])
c = int(input_lines[2])
d = int(input_lines[3])

flag = 0
if abs(c - a) > d:
    if abs(b - a) > d or abs(c - b) > d:
        flag = 1

if flag == 0:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
input_lines = raw_input().split()
a = int(input_lines[0])
b = int(input_lines[1])
c = int(input_lines[2])
d = int(input_lines[3])

flag = 0
if abs(c - a) > d:
    if abs(b - a) > d or abs(c - b) > d:
        flag = 1

if flag == 0:
    print("Yes")
else:
    print("No")


Fixed submission:
input_lines = input().split()
a = int(input_lines[0])
b = int(input_lines[1])
c = int(input_lines[2])
d = int(input_lines[3])

flag = 0
if abs(c - a) > d:
    if abs(b - a) > d or abs(c - b) > d:
        flag = 1

if flag == 0:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
# coding: utf-8
input_lines = raw_input().split()
a = int(input_lines[0])
b = int(input_lines[1])
c = int(input_lines[2])
d = int(input_lines[3])

flag = 0
if abs(c - a) > d:
    if abs(b - a) > d or abs(c - b) > d:
        flag = 1

if flag == 0:
    print("Yes")
else:
    print("No")
    
        


Fixed submission:
input_lines = input().split()
a = int(input_lines[0])
b = int(input_lines[1])
c = int(input_lines[2])
d = int(input_lines[3])

flag = 0
if abs(c - a) > d:
    if abs(b - a) > d or abs(c - b) > d:
        flag = 1

if flag == 0:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N = int(input())
    S = [sorted(input()) for _ in range(N)]

    ans = 0
    for i in range(N):
        for j in range(i+1, N):
            if S[i]==S[j]:
                ans += 1
    print(ans)

if __name__ == "__main__":
    main()

Fixed submission:

def main():
    N = int(input())

    S = []
    d = {}
    ans = 0
    for _ in range(N):
        t = input()
        t = "".join(sorted(t))
        if t in d:
            ans += d[t]
            d[t] += 1
        else:
            d[t] = 1

    print(ans)

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N, M = [int(i) for i in input().split()]
    A = [int(i) for i in input().split()]

    for _ in range(M):
        b, c = [int(i) for i in input().split()]
        A += [c] * b

    A.sort()
    print(sum(A[-N:]))



if __name__ == "__main__":
    main()

Fixed submission:
def main():
    N, M = [int(i) for i in input().split()]
    A = [int(i) for i in input().split()]

    A.sort()


    bc = [[int(i) for i in input().split()] for _ in range(M)]
    bc.sort(key=lambda x: x[1])


    ai = N - 1
    mi = M - 1
    pos = 0
    ans = 0
    for _ in range(N):
        if (A[ai] > bc[mi][1]) | (mi < 0):
            pos += 1
            ans += A[ai]
            ai -= 1
        elif pos + bc[mi][0] >= N:
            ans += bc[mi][1] * (N - pos)
            break
        else:
            ans += bc[mi][0] * bc[mi][1]
            pos += bc[mi][0]
            mi -= 1
        if pos >= N:
            break

    print(ans)



if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))

L = [0]
R = [0]

for i in range(N):
    L.append(fractions.gcd(L[i], A[i]))
    R.append(fractions.gcd(R[i], A[N - i - 1]))

ans = 0
for i in range(N):
    t = fractions.gcd(L[i], R[N - i - 1])
    ans = max(t, ans)

print(ans)

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

L = [0]
R = [0]

for i in range(N):
    L.append(fractions.gcd(L[i], A[i]))
    R.append(fractions.gcd(R[i], A[N - i - 1]))

ans = 0
for i in range(N):
    t = fractions.gcd(L[i], R[N - i - 1])
    ans = max(t, ans)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# AtCoder Beginner Contest 097
#s = input()
#K = int(input())

N, M = input().split()
N = int(N)
M = int(M)

pdic = {i:[] for i in range(N)}
outidx = {}
pl = []

for i in range(M):
    p, y = input().split()
    p = int(p)-1
    y = int(y)
    pl.append(p)
    pdic[p].append(y)
    outidx[i] = y

for i in range(N):
    pdic[i] = sorted(pdic[i])

for i, j in enumerate(pl):
    #print(pdic[j])
    print('{:06}{:06}'.format(1+j, 1+pdic[j].index(outidx[i])))

Fixed submission:
N, M = input().split()
N = int(N)
M = int(M)

pdic = {i:[] for i in range(N)}
ppdic = {i:[] for i in range(N)}
outidx = {}
pl = []

for i in range(M):
    p, y = input().split()
    p = int(p)-1
    y = int(y)
    pl.append(p)
    pdic[p].append(y)
    outidx[i] = y

for i in range(N):
    if len(pdic[i]) ==0:
        continue

    pdic[i] = sorted(pdic[i])
    ppdic[i] = {jj : j for j, jj in enumerate(pdic[i])}
#print(ppdic)
#print(pdic)
for i, j in enumerate(pl):
    #print(pdic[j])
    ii = ppdic[j][outidx[i]]
    ##print(ii)
    print('{:06}{:06}'.format(1+j, ii+1))
Buggy python submission (verdict: Runtime Error):
N = int(input())
w = []
for i in range(N):
    w.append(input())
    if i ==0:
        continue
    if w[i][0] !=  w[i-1][-1]:
        print('No')
        return

if N == len(set(w)):
    print('Yes')
else:
    print('No')


Fixed submission:
def main():
    N = int(input())
    w = []
    for i in range(N):
        w.append(input())
        if i == 0:
            continue
        if w[i][0] != w[i-1][-1]:
            print('No')
            return

    if N == len(set(w)):
        print('Yes')
    else:
        print('No')

main()

Buggy python submission (verdict: Runtime Error):
N = int(input())
w = []
for i in range(N):
    w.append(input())
    if i ==0:
        continue
    if w[i][0] !=  w[i-1][-1]:
        print('No')
        return

if N == len(set(w)):
    print('Yes')
else:
    

Fixed submission:
def main():
    N = int(input())
    w = []
    for i in range(N):
        w.append(input())
        if i == 0:
            continue
        if w[i][0] != w[i-1][-1]:
            print('No')
            return

    if N == len(set(w)):
        print('Yes')
    else:
        print('No')

main()
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()

s1 = [ord(s) - ord('a') for s in S]
t1 = [ord(t) - ord('a') for t in T]

s1.sort()
t1.sort(reverse=True)

print(s1, t1)

for i, j in zip(s1, t1):
    if i < j:
        print('Yes')
        return

if (len(s1) < len(t1)) & (i > j):
    print('No')
    return
elif (len(s1) < len(t1)):
    print('Yes')
    return

print('No')

Fixed submission:

def main():
    S = input()
    T = input()

    s1 = [ord(s) - ord('a') for s in S]
    t1 = [ord(t) - ord('a') for t in T]

    s1.sort()
    t1.sort(reverse=True)


    for i, j in zip(s1, t1):
        if i < j:
            print('Yes')
            return

    if (len(s1) < len(t1)) & (i > j):
        print('No')
        return
    elif (len(s1) < len(t1)):
        print('Yes')
        return

    print('No')

main()