Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=list(input())
a=[chr(i) for i in range(65,65+26)]

for i in range(n):
  for j in range(26):
    if s[i]==a[j]:
      s[i]=a[(j+n)%26]
print(''.join(s))

Fixed submission:
n=int(input())
s=list(input())
a=[chr(i) for i in range(65,65+26)]

for i in range(len(s)):
  for j in range(len(a)):
    if s[i]==a[j]:
      if j+n<26:
        s[i]=a[j+n]
      else:
        s[i]=a[j+n-26]
      break

print(''.join(s))
Buggy python submission (verdict: Time Limit Exceeded):
n,k,q=map(int,input().split())
a=[int(input()) for _ in range(q)]
p=[k]*n

for i in range(q):
  seikai=a[i]-1
  for j in range(n):
    p[j]-=1
  p[seikai]+=1

for j in range(n):
  if p[j]>0:
    print('Yes')
  else:
    print('No')

Fixed submission:
n,k,q=map(int,input().split())
a=[int(input()) for _ in range(q)]
p=[k-q]*n

for i in range(q):
  p[a[i]-1]+=1

for j in range(n):
  if p[j]>0:
    print('Yes')
  else:
    print('No')
Buggy python submission (verdict: Runtime Error):
n=int(input())
print(sum(list(range(n))))

Fixed submission:
n=int(input())
ans=n*(n-1)//2
print(int(ans))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=[]
for i in range(n):
  s.append(sorted(input()))
ans=0
for i in range(n):
  for j in range(n):
    if i>j:
      if s[i]==s[j]:
        ans+=1
print(ans)

Fixed submission:
n=int(input())
ans=0
slist={}
for i in range(n):
  s=''.join(sorted(input()))
  if s in slist:
    ans+=slist[s]
    slist[s]+=1
  else:
    slist[s]=1

print(ans)
Buggy python submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
cwari=b//c-(a-1)//c
dwari=b//d-(a-1)//d
import math
cd=math.gcd(c,d)
cdwari=b//cd-(a-1)//cd
ans=(b-a)+1-cwari-dwari+cdwari
print(ans)

Fixed submission:
a,b,c,d=map(int,input().split())
cwari=b//c-(a-1)//c
dwari=b//d-(a-1)//d
import fractions
l=int(c*d/fractions.gcd(c,d))
cdwari=b//l-(a-1)//l
ans=(b-a)+1-cwari-dwari+cdwari
print(ans)

Buggy python submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
cwari=b//c-(a-1)//c
dwari=b//d-(a-1)//d
import math
cd=math.gcd(c,d)
cdwari=b//cd-(a-1)//cd
print(cwari)

ans=(b-a)+1-cwari-dwari+cdwari
print(ans)

Fixed submission:
a,b,c,d=map(int,input().split())
cwari=b//c-(a-1)//c
dwari=b//d-(a-1)//d
import fractions
l=int(c*d/fractions.gcd(c,d))
cdwari=b//l-(a-1)//l
ans=(b-a)+1-cwari-dwari+cdwari
print(ans)
Buggy python submission (verdict: Runtime Error):
w,h,x,y=map(int,input().split())
huku=0
if w/x==2 and h/y==2:
  huku=1
print(w*h/2,huku)

Fixed submission:
w,h,x,y=map(int,input().split())
huku=0
if w/2==x and h/2==y:
  huku=1
print(w*h/2,huku)
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
a=[0]*n
for i in range(m):
  l,r=map(int,input().split())
  for k in range(l-1,r):
    a[k]+=1
ans=0
for i in range(n):
  if a[i]==m:
    ans+=1
print(ans)

Fixed submission:
n,m=map(int,input().split())
low=1
high=n
for i in range(m):
  l,r=map(int,input().split())
  if l>low:
    low=l
  if r<high:
    high=r
if high>=low:
  print(high-low+1)
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
#import math

# 整数の入力
station = input()

if(station[0] != station[1] || station[0] != station[2]):
  print("No")
else:
  print("Yes")


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

# 整数の入力
station = input()

if(station[0] != station[1] or station[0] != station[2]):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

# 整数の入力
#a = int(input())

# スペース区切りの文字列の入力
st = input().split()
#商
div = int(st[0]) // (int(st[1]) + int(st[2]))
#余り
rem = int(st[0]) % (int(st[1]) + int(st[2]))

if(rem < int(st[1])):
  print(div * int(st[1]) + rem)
else:
  print(div * int(st[1]) + st[1])
  

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

# 整数の入力
#a = int(input())

# スペース区切りの文字列の入力
st = input().split()
#商
div = int(st[0]) // (int(st[1]) + int(st[2]))
#余り
rem = int(st[0]) % (int(st[1]) + int(st[2]))

if(rem < int(st[1])):
  print(div * int(st[1]) + rem)
else:
  print(div * int(st[1]) + int(st[1]))
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import math

# 整数の入力
#a = int(input())
# スペース区切りの文字列の入力
st = input().split()
st_list = []
st_list = [int(st) for st in st]

# スペース区切りの数値の入力
a, b = map(int, input().split())

# 文字列の入力
s = input()

# スペース区切りの文字列の入力
#a,b = map(input().split())

if(str(s) == st_list[0]):
  a = a-1
elif(str(s) == st_list[1]):
  b = b-1
# 出力

print(a,b)



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

# 整数の入力
#a = int(input())
# スペース区切りの文字列の入力
st = input().split()
st_list = []
st_list = [str(st) for st in st]

# スペース区切りの数値の入力
a, b = map(int, input().split())

# 文字列の入力
s = input()

# スペース区切りの文字列の入力
#a,b = map(input().split())

if(str(s) == st_list[0]):
  a = a-1
elif(str(s) == st_list[1]):
  b = b-1
# 出力

print(a,b)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# 整数の入力
#a = int(input())
# スペース区切りの整数の入力
b, c = map(int, input().split())
# 文字列の入力
#s = input()
#連結
#aaa = str(b) + str(c)
#print(aaa)
aaa = ''
bbb = ''
for num in range(c):
	aaa += str(b)
	
for num in range(b):
	bbb += str(c)
#一桁目取得
testa = aaa[1]
testb = bbb[1]

# 出力
if(testa < testb):
	print(aaa)
else:
	print(bbb)


Fixed submission:
# -*- coding: utf-8 -*-
# 整数の入力
#a = int(input())
# スペース区切りの整数の入力
#while True:
b, c = map(int, input().split())
#	if(b < 10 and c < 10):
#		break
# 文字列の入力
#s = input()
#連結
#aaa = str(b) + str(c)
#print(aaa)
aaa = ''
bbb = ''
for num in range(c):
	aaa += str(b)
	
for num in range(b):
	bbb += str(c)


#一桁取得
testa = aaa[0]
testb = bbb[0]

# 出力
if(testa < testb):
	print(aaa)
else:
	print(bbb)
Buggy python submission (verdict: Runtime Error):
N = int(input())
L = list("abcdefghijklmnopqrstuvwxyz")
a = 1
while N > 26**a:
    N = N - 26**a
    a += 1

pre = []
for i in reversed(range(1,a)):
    r = N // 26**i
    pre.append(r)
    N = int(N%(26**i))

ans = ''
for i in pre:
    ans += L[i]
print(ans+L[N-1])

Fixed submission:
N = int(input())
L = list("abcdefghijklmnopqrstuvwxyz")
a = 1
while N > 26**a:
    N = N - 26**a
    a += 1

pre = []
for i in reversed(range(1,a)):
    r = (N-1) // 26**i
    pre.append(r)
    N = int(N%(26**i))

ans = ''
for i in pre:
    ans += L[i]
print(ans+L[N-1])
Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
n = int(input())
A = list(map(int,input().split()))
S = reduce(lambda x, y: x * y, A)
if S > 10**18:
    print(-1)
else:
    print(S)

Fixed submission:
import sys
l = 10**18
n = int(input())
A = list(map(int,input().split()))
S = 1
if 0 in A:
    print(0)
    sys.exit()
for i in range(n):
    S = S * A[i]
    if S > l:
        print(-1)
        break
if S <= l:
    print(S)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = list(map(int,input().split()))
S = 1
for i in range(n):
    S = S * A[i]
if S > 10**18:
    print(-1)
else:
    print(S)

Fixed submission:
import sys
l = 10**18
n = int(input())
A = list(map(int,input().split()))
S = 1
if 0 in A:
    print(0)
    sys.exit()
for i in range(n):
    S = S * A[i]
    if S > l:
        print(-1)
        break
if S <= l:
    print(S)
Buggy python submission (verdict: Runtime Error):
N = list(input())
hon = [2,4,5,7,9]
pon = [0,1,6,8]
if int(N[2]) in hon:
    print("hon")
elif int(N[2]) in pon:
    print("pon")
else:
    print("bon")

Fixed submission:
N = list(input())
hon = [2,4,5,7,9]
pon = [0,1,6,8]
if int(N[-1]) in hon:
    print("hon")
elif int(N[-1]) in pon:
    print("pon")
else:
    print("bon")

Buggy python submission (verdict: Runtime Error):
N = list(input())
hon = [2,4,5,7,9]
pon = [0,1,6,8]
if int(N[2]) in hon:
    print("hon")
elif int(N[2]) in pon:
    print("pon")
else:
    print("bon")

Fixed submission:
N = list(input())
hon = [2,4,5,7,9]
pon = [0,1,6,8]
if int(N[-1]) in hon:
    print("hon")
elif int(N[-1]) in pon:
    print("pon")
else:
    print("bon")
Buggy python submission (verdict: Runtime Error):
Town = []
N, K = map(int, input().split())
A = list(map(int, input().split()))
vis = [0]*N
p = 1
while vis[p-1]==0:
    Town.append(p)
    vis[p-1] = 1
    p = A[p-1]

l = Town.index[p]

if K < len(Town):
    print(Town[K])
else:
    print(Town[l + (K-l)%(len(Town[l:]))])

Fixed submission:
N, K = map(int, input().split())
A = list(map(int, input().split()))
vis = [0]*N
p = 1
Town = []

while vis[p-1] == 0:
    Town.append(p)
    vis[p-1] = 1
    p = A[p-1]

l = Town.index(p)

if K < len(Town):
    print(Town[K])
else:
    print(Town[l + (K-l)%(len(Town[l:]))])

Buggy python submission (verdict: Runtime Error):
# ABC167D
Town = []
C = 0
N, K = map(int, input().split())
A = list(map(int, input().split()))
def dfs(a, i, town, c):
    if i-1 in town:
        L = len(town) - len(town[:town.index(i-1)])
        c += (K-c) - ((K-c)%L)
        town = []
    else:
        town.append(i-1)
        c += 1
    if c >= K:
        return print(i)
    nx = a[i-1]
    dfs(a, nx, town, c)

dfs(A, 1, Town, C)

Fixed submission:
N, K = map(int, input().split())
A = list(map(int, input().split()))
vis = [0]*N
p = 1
Town = []

while vis[p-1] == 0:
    Town.append(p)
    vis[p-1] = 1
    p = A[p-1]

l = Town.index(p)

if K < len(Town):
    print(Town[K])
else:
    print(Town[l + (K-l)%(len(Town[l:]))])

Buggy python submission (verdict: Runtime Error):
Town = []
C = 0
N, K = map(int, input().split())
A = list(map(int, input().split()))
def dfs(a, i, town, c):
    if i-1 in town:
        L = len(town) - len(town[:town.index(i-1)])
        c += (K - c) - (K%L)
        town = []
        town.append(i-1)
    else:
        town.append(i-1)
        c += 1
    if c == K:
        return print(a[i-1])
    nx = a[i-1]
    dfs(a, nx, town, c)

dfs(A, 1, Town, C)

Fixed submission:
N, K = map(int, input().split())
A = list(map(int, input().split()))
vis = [0]*N
p = 1
Town = []

while vis[p-1] == 0:
    Town.append(p)
    vis[p-1] = 1
    p = A[p-1]

l = Town.index(p)

if K < len(Town):
    print(Town[K])
else:
    print(Town[l + (K-l)%(len(Town[l:]))])
Buggy python submission (verdict: Time Limit Exceeded):
import sys
def input():
    return sys.stdin.readline().rstrip()

n = int(input())
h = [int(i) for i in range(n)]

print(sum(h[:n]))


Fixed submission:
import sys
def input():
    return sys.stdin.readline().rstrip()

n = int(input())
s = int((n*(n-1))//2)

print(s)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(float, input().split()))
c = 1
for i in range(n):
    c = c * a[i]
print(float(c) / sum(a))

Fixed submission:
a = int(input())
s = input()
if a >= 3200:
    print(s)
else:
    print('red')
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(100000)
nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]

N = int(input())
s = [''.join(sorted(input())) for i in range(N)]
ns = []
ans = 0
for i in range(len(s)):
    if ns.count(s[i]) == 0:
        aas = s.count(s[i])
        if aas > 0:
            ns.append(s[i])
        abs = cmb(aas,2)
        ans += int(abs)
print(ans)

Fixed submission:
from collections import Counter

N = int(input())
s = Counter()
for i in range(N):
    s[''.join(sorted(input()))] += 1
ans = 0
for kw, count in s.most_common():
    for i in range(1, int(count)):
        ans += i
    if int(count) < 2:
        break
print(ans)

Buggy python submission (verdict: Runtime Error):
nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]

N = int(input())
s = [''.join(sorted(input())) for i in range(N)]
ns = []
ans = 0
for i in range(len(s)):
    if ns.count(s[i]) == 0:
        aas = s.count(s[i])
        if aas > 0:
            ns.append(s[i])
        abs = cmb(aas,2)
        ans += int(abs)
print(ans)

Fixed submission:
from collections import Counter

N = int(input())
s = Counter()
for i in range(N):
    s[''.join(sorted(input()))] += 1
ans = 0
for kw, count in s.most_common():
    for i in range(1, int(count)):
        ans += i
    if int(count) < 2:
        break
print(ans)

Buggy python submission (verdict: Runtime Error):
from math import factorial
N = int(input())
s = [''.join(sorted(input())) for i in range(N)]
ns = []
ans = 0
for i in range(len(s)):
    if ns.count(s[i]) == 0:
        aas = s.count(s[i])
        if aas > 0:
            ns.append(s[i])
        abs = int(factorial(aas) / factorial(2) / factorial(aas - 2 ))
        ans += abs
print(ans)

Fixed submission:
from collections import Counter

N = int(input())
s = Counter()
for i in range(N):
    s[''.join(sorted(input()))] += 1
ans = 0
for kw, count in s.most_common():
    for i in range(1, int(count)):
        ans += i
    if int(count) < 2:
        break
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
s = [''.join(sorted(input())) for i in range(N)]
ns = []
ans = 0
for i in range(len(s)):
    if ns.count(s[i]) == 0:
        aas = s.count(s[i])
        if aas > 0:
            ns.append(s[i])
        for j in range(1, aas):
            ans += j
print(ans)

Fixed submission:
from collections import Counter

N = int(input())
s = Counter()
for i in range(N):
    s[''.join(sorted(input()))] += 1
ans = 0
for kw, count in s.most_common():
    for i in range(1, int(count)):
        ans += i
    if int(count) < 2:
        break
print(ans)
Buggy python submission (verdict: Runtime Error):
n, x = map(int, input().split())
l = list(map(int, input().split()))
d = [0]
for i in range(1, n+2):
    d.append(d[i-1] + l[i-1])
    if d[i] > x :
        print(len(d)-1)
        exit()

Fixed submission:
n, x = map(int, input().split())
l = list(map(int, input().split()))
d = [0]
for i in range(1, n+1):
    d.append(d[i-1] + l[i-1])
    if d[i] > x :
        print(len(d) - 1)
        exit()
print(len(d))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
ans = []
for i in range(n):
    ans.append(s.count('W', 0, i) + s.count('E', i+1, n))
print(min(ans))

Fixed submission:
n = int(input())
s = input()
num = s[1:].count('E')
ans = [num]

for i in range(1,n):
    if s[i] == 'E':
        num -= 1
    if s[i-1] == 'W':
        num += 1
    ans.append(num)
print(min(ans))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(input())
ans = []
for i in range(n):
    ans.append(s[:i].count('W') + s[i+1:].count('E') )
print(sorted(ans)[0])

Fixed submission:
n = int(input())
s = input()
num = s[1:].count('E')
ans = [num]

for i in range(1,n):
    if s[i] == 'E':
        num -= 1
    if s[i-1] == 'W':
        num += 1
    ans.append(num)
print(min(ans))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input()))
ans = 0
for i in range(n):
    if a[i]%2:
        a[i] = a[i]//2
    else:
        print(ans)
        exit()
    ans += 1

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ans = 0
while True:
    i = 0
    while i <= n -1:
        if a[i]%2:
            print(ans)
            exit()
        else:
            a[i] = a[i]//2
        i += 1
    ans += 1
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = 1
for i in range(1, n+1):
    p = p * i
print(p % 1000000007)

Fixed submission:
n = int(input())
p = 1
for i in range(1, n+1):
    p = p * i
    p = p % 1000000007
print(p)
Buggy python submission (verdict: Time Limit Exceeded):
firstvar = input()
l = int(firstvar.split(" ")[0])
r = int(firstvar.split(" ")[1])
i = l
min = 2019
for i in range(l,r + 1):
    for j in range(i + 1, r + 1):
        mod = (i*j)%2019
        if mod < min:
            min = mod
            if mod == 0:
                break;
        j = j + 1
    i = i + 1
print(min)

Fixed submission:
firstvar = input()
l = int(firstvar.split(" ")[0])
r = int(firstvar.split(" ")[1])
i = l
min = 2019
if (r/2019 - l/2019) >= 1:
    print(0)
else:
    for i in range(l,r + 1):
        for j in range(i + 1, r + 1):
            mod = (i*j)%2019
            if mod < min:
                min = mod
                if mod == 0:
                    break;
    print(min)

Buggy python submission (verdict: Time Limit Exceeded):
firstvar = input()
l = int(firstvar.split(" ")[0])
r = int(firstvar.split(" ")[1])
i = l
min = 2019
while i <= r:
    j = i + 1
    while j <= r:
        mod = (i*j)%2019
        if mod < min:
            min = mod
            if mod == 0:
                break;
        j = j + 1
    i = i + 1
print(min)

Fixed submission:
firstvar = input()
l = int(firstvar.split(" ")[0])
r = int(firstvar.split(" ")[1])
i = l
min = 2019
if (r/2019 - l/2019) >= 1:
    print(0)
else:
    for i in range(l,r + 1):
        for j in range(i + 1, r + 1):
            mod = (i*j)%2019
            if mod < min:
                min = mod
                if mod == 0:
                    break;
    print(min)

Buggy python submission (verdict: Time Limit Exceeded):
firstvar = input()
l = int(firstvar.split(" ")[0])
r = int(firstvar.split(" ")[1])
i = l
min = 2019
while i <= r:
    j = i + 1
    while j <= r:
        mod = (i*j)%2019
        if mod < min:
            min = mod
        j = j + 1
    i = i + 1
print(min)

Fixed submission:
firstvar = input()
l = int(firstvar.split(" ")[0])
r = int(firstvar.split(" ")[1])
i = l
min = 2019
if (r/2019 - l/2019) >= 1:
    print(0)
else:
    for i in range(l,r + 1):
        for j in range(i + 1, r + 1):
            mod = (i*j)%2019
            if mod < min:
                min = mod
                if mod == 0:
                    break;
    print(min)

Buggy python submission (verdict: Time Limit Exceeded):
import copy
firstvar = input()
l = int(firstvar.split(" ")[0])
r = int(firstvar.split(" ")[1])
i = copy.deepcopy(l)
min = 2019
while i <= r:
    j = copy.deepcopy(i) + 1
    while j <= r:
        mod = (i*j)%2019
        if mod < min:
            min = copy.deepcopy(mod)
        j = j + 1
    i = i + 1
print(min)

Fixed submission:
firstvar = input()
l = int(firstvar.split(" ")[0])
r = int(firstvar.split(" ")[1])
i = l
min = 2019
if (r/2019 - l/2019) >= 1:
    print(0)
else:
    for i in range(l,r + 1):
        for j in range(i + 1, r + 1):
            mod = (i*j)%2019
            if mod < min:
                min = mod
                if mod == 0:
                    break;
    print(min)
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!

num = int(input())

qm = 1000000000000001

alf = [chr(i) for i in range(97, 97+26)]
#print(alf)

ans = []
f = False

for i in reversed(range(12)):
    if (num-num//26)//26**i >= 1:
        f = True

    if f:
        ans.append(alf[(num-i)//26**i-1])
        num = num % 26**i
print("".join(ans))


Fixed submission:
# coding: utf-8
# Your code here!

num = int(input())

qm = 1000000000000001

alf = [chr(i) for i in range(97, 97+26)]
#print(alf)

ans = []
f = False

for i in range(12):
    c = (num-1) % 26
    ans += alf[c]
    num = (num-1) // 26
    if num < 1:
        break

print("".join(reversed(ans)))

Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!

num = int(input())

qm = 1000000000000001

alf = [chr(i) for i in range(97, 97+26)]
#print(alf)

ans = []
f = False

for i in reversed(range(12)):
    if (num-i*26)//26**i >= 1:
        f = True
    if f:
#            print((num-i)//26**i)
        ans.append(alf[(num-i)//26**i-1])
        num = num % 26**i
print("".join(ans))



Fixed submission:
# coding: utf-8
# Your code here!

num = int(input())

qm = 1000000000000001

alf = [chr(i) for i in range(97, 97+26)]
#print(alf)

ans = []
f = False

for i in range(12):
    c = (num-1) % 26
    ans += alf[c]
    num = (num-1) // 26
    if num < 1:
        break

print("".join(reversed(ans)))

Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!

num = int(input())

qm = 1000000000000001

alf = [chr(i) for i in range(97, 97+26)]
#print(alf)

ans = []
f = False

for i in reversed(range(12)):
    if (num-i*26)//26**i >= 1:
        f = True
    if f:
#            print((num-i)//26**i)
        ans.append(alf[(num-i*26)//26**i-1])
        num = num % 26**i
print("".join(ans))



Fixed submission:
# coding: utf-8
# Your code here!

num = int(input())

qm = 1000000000000001

alf = [chr(i) for i in range(97, 97+26)]
#print(alf)

ans = []
f = False

for i in range(12):
    c = (num-1) % 26
    ans += alf[c]
    num = (num-1) // 26
    if num < 1:
        break

print("".join(reversed(ans)))
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!

num = int(input())

qm = 1000000000000001

alf = [chr(i) for i in range(97, 97+26)]
#print(alf)

ans = []
f = False

for i in reversed(range(12)):
    if (num-num//26)//26**i >= 1:
        f = True

    if f:
        ans.append(alf[(num-i)//26**i-1])
        num = num % 26**i
print("".join(ans))


Fixed submission:
# coding: utf-8
# Your code here!

import numpy as np

x,n = map(int,input().split())

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

m = np.array(list(range(-200,400)))
m = (m-x)**2
for i in (np.argsort(m)-200):
    if p.count(i) == 0:
        print(i)
        break
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
from collections import Counter

n,q = map(int,input().split())

a,b = [],[]

for i in range(n-1):
    _a,_b = map(int,input().split())
    a.append(_a)
    b.append(_b)

p,x = [],[]

for i in range(q):
    _p,_x = map(int,input().split())
    p.append(_p)
    x.append(_x)

class ki:
    def __init__ (self,n):
        self.name = n
        self.num = 0
        self.node = []
    
    def add(self,n,ne):
        if self.name == n:
            self.node.append(ki(ne))
            return 0
        else:
            for i in self.node:
                i.add(n,ne)
            return 0
            
    def add_num(self,n,num,f):
        if self.name == n or f:
            self.num += num
            f = True
        else:
            f = False
            
        for i in self.node:
            i.add_num(n,num,f)
    
    def out(self):
        d = {self.name:self.num}
        for i in self.node:
            d = dict(Counter(d) + Counter(i.out()))
        return(d)

Ki = ki(1)

for i,j in zip(a,b):
    Ki.add(i,j)
for i,j in zip(p,x):
    Ki.add_num(i,j,False)

d = Ki.out()
print(" ".join([str(d[i+1]) for i in range(n)]))
    
    

Fixed submission:
# coding: utf-8
# Your code here!
from collections import Counter

n,q = map(int,input().split())

d = {}

for i in range(n-1):
    _a,_b = map(int,input().split())
    d[_b] = _a

ans = [0]*n

for i in range(q):
    _p,_x = map(int,input().split())
    ans[_p-1]+=_x


for i in range(1,n):
    ans[i] += ans[d.get(i+1)-1]

#print(ans)
print(" ".join(map(str,ans)))
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!

import math
a, b, c, d = map(int,input().split())
a = a-1
dc = b//c
dc -= a//c

dd = b//d
dd -= a//d

lcm = c*d//math.gcd(c,d)
dcd = b//lcm
dcd -= a//lcm

ans = b-a-dc-dd+dcd

print(ans)



Fixed submission:
# coding: utf-8
# Your code here!

from fractions import gcd

a, b, c, d = map(int,input().split())
a = a-1
dc = b//c
dc -= a//c

dd = b//d
dd -= a//d

lcm = c*d//gcd(c,d)
dcd = b//lcm
dcd -= a//lcm

ans = b-a-dc-dd+dcd

print(ans)
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
n,k = map(int,input().split())

s = input()

now = s[0]
tmp = 0

h = []
if s[0]=="0":
    h.append(0)

for i in s:
    if i != now:
        now = i
        h.append(tmp)
        tmp=0
    tmp+=1
h.append(tmp)

ans = 0

for i in range(0,max(len(h),len(h)-k),2):
    ans = max(ans,sum(h[i:i+k*2+1]))

print(ans)


Fixed submission:
# coding: utf-8
# Your code here!

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

ans = 0

if a>b:
    ans+=a
    a-=1

else:
    ans+=b
    b-=1


if a>b:
    ans+=a

else:
    ans+=b

print(ans)