Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
x=[]
cnt=0
for i in range(n):
  a="".join(sorted(input()))
  x.append(a)
  cnt+=x.count(a)-1
print(cnt)

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

for a in x:
  cnt+=x[a]*(x[a]-1)//2
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

n=int(input())
x=[]
cnt=0
for i in range(n):
  a=sorted(input())
  x.append(a)
  cnt+=x.count(a)-1
print(cnt)

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

for a in x:
  cnt+=x[a]*(x[a]-1)//2
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
x=[]
cnt=0
for i in range(n):
  a=sorted(input())
  x.append(a)
  cnt+=x.count(a)-1
print(cnt)

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

for a in x:
  cnt+=x[a]*(x[a]-1)//2
print(cnt)
Buggy python submission (verdict: Runtime Error):
print(3*input()**2)

Fixed submission:
print(3*int(input())**2)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[int(input()) for i in range(n)]
sorted(a)
for i in range(n):
  if a[i]==max(a):print(sorted(a)[-2])
  else:print(max(a))

Fixed submission:
import heapq
n=int(input())
a=[int(input()) for i in range(n)]
b=list(map(lambda x:x*(-1), a))
heapq.heapify(b)
max1=heapq.heappop(b)*(-1)
max2=heapq.heappop(b)*(-1)

for i in range(n):
  if a[i]==max1:print(max2)
  else:print(max1)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[int(input()) for i in range(n)]
sorted(a)
for i in range(n):
  if a[i]==sorted(a)[-1]:print(sorted(a)[-2])
  else:print(sorted(a)[-1])

Fixed submission:
import heapq
n=int(input())
a=[int(input()) for i in range(n)]
b=list(map(lambda x:x*(-1), a))
heapq.heapify(b)
max1=heapq.heappop(b)*(-1)
max2=heapq.heappop(b)*(-1)

for i in range(n):
  if a[i]==max1:print(max2)
  else:print(max1)
Buggy python submission (verdict: Time Limit Exceeded):
l,r=list(map(int,input().split()))
m=2018
for i in range(l,min(r+1,l+2019)):
  for j in range(i+1,r+1):
    m=min(m,i*j%2019)
print(m)

Fixed submission:
l,r=list(map(int,input().split()))
m=2018
for i in range(l,min(r+1,l+2019)):
  for j in range(i+1,min(r+1,l+2019)):
    m=min(m,i*j%2019)
print(m)

Buggy python submission (verdict: Runtime Error):
l,r=list(map(int,input().split()))
ans=[]
if r-l==1:print(r*l%2019)
else:
  for i in range(l,r-1):
    for j in range(l+1,r):
      ans.append(i*j%2019)
print(min(ans))
  

Fixed submission:
l,r=list(map(int,input().split()))
m=2018
for i in range(l,min(r+1,l+2019)):
  for j in range(i+1,min(r+1,l+2019)):
    m=min(m,i*j%2019)
print(m)
Buggy python submission (verdict: Runtime Error):
a,b,c,d=list(map(int,input().split()))
p=list(range(a,b+1))
q=list(filter(lambda x:x%c!=0 and x%d!=0,p))
print(len(q))

Fixed submission:
import fractions
a,b,c,d=list(map(int,input().split()))
a-=1
lcm=int((c*d)/fractions.gcd(c,d))
print((b-b//c-b//d+b//lcm)-(a-a//c-a//d+a//lcm))

Buggy python submission (verdict: Runtime Error):
a,b,c,d=list(map(int,input().split()))
p=list(range(a,b+1))
q=list(filter(lambda x:x%2!=0 and x%3!=0,p))
print(len(q))

Fixed submission:
import fractions
a,b,c,d=list(map(int,input().split()))
a-=1
lcm=int((c*d)/fractions.gcd(c,d))
print((b-b//c-b//d+b//lcm)-(a-a//c-a//d+a//lcm))
Buggy python submission (verdict: Runtime Error):
w,h,x,y=list(map(int,input().split()))
ans=0
if w/x>h/y:s=x*h
elif w/x<h/y:s=w*y
else:
  s=x*h
  ans=1
print(s,ans)


Fixed submission:
w,h,x,y=list(map(int,input().split()))
ans=1 if w/2==x and h/2==y else 0
print(w*h/2,ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,M=list(map(int,input().split()))
lr=[list(map(int,input().split())) for i in range(M)]
cnt=0
for i in range(1,n+1):
  sub=0
  for m in range(M):
    if i>=lr[m-1][0] and i<=lr[m-1][1]:sub+=1
    if sub==M:cnt+=1
#    print('i:',i,'l:',lr[m-1][0],'r:',lr[m-1][1],'sub:',sub)
print(cnt)


Fixed submission:
n,m=list(map(int,input().split()))
L,R=0,n
for _ in range(m):
  l,r=map(int,input().split())
  L,R=max(L,l),min(R,r)
print(max(R-L+1,0))
Buggy python submission (verdict: Time Limit Exceeded):
r,g,b,n = map(int,input().split())

cnt = 0
for i in range(n//r+1):
  for j in range(n//g+1):
    k = (n - i*r - j*g)/b
    if k>=0 and k.is_integer():
      cnt+=1
print(cnt)


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

cnt = 0
for i in range(n//r+1):
  for j in range(n//g+1):
    k = (n - i*r - j*g)/b
    if k>=0 and k.is_integer():
      cnt+=1
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
n,q=list(map(int,input().split()))
s=input()
cnt=0
t=[0]*n

for i in range(n-2):
  t[i]=s[i:i+2].count("AC")
#print(t)

for i in range(q):
  n,q=list(map(int,input().split()))
  print(sum(t[n-1:q-1]))
  

Fixed submission:
n,q=list(map(int,input().split()))
s=input()
cnt=0
t=[0]*n

for i in range(n-1):
  cnt+=s[i:i+2].count("AC")
  t[i+1]=cnt
##  t[-1]=cnt
##print(t)

for i in range(q):
  l,r=list(map(int,input().split()))
  print(t[r-1]-t[l-1])

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

for i in range(q):
  n,q=list(map(int,input().split()))
  print(s[n-1:q].count("AC"))
  

Fixed submission:
n,q=list(map(int,input().split()))
s=input()
cnt=0
t=[0]*n

for i in range(n-1):
  cnt+=s[i:i+2].count("AC")
  t[i+1]=cnt
##  t[-1]=cnt
##print(t)

for i in range(q):
  l,r=list(map(int,input().split()))
  print(t[r-1]-t[l-1])
Buggy python submission (verdict: Time Limit Exceeded):
n,k=list(map(int,input().split()))
h=[]
d=[0]*(n-1)
ans=10**9

for i in range(n):
  h.append(int(input()))
h=sorted(h)

for i in range(n-1):
  d[i]=h[i+1]-h[i]
  
for i in range(n-k+1):
  tmp=sum(d[i:i+k-1])
  ans=min(ans,tmp)

print(ans)

Fixed submission:
n,k=list(map(int,input().split()))
h=[int(input()) for i in range(n)]
h.sort()
print(min(h[i+k-1]-h[i] for i in range(n-k+1)))
Buggy python submission (verdict: Runtime Error):
x1,y1,x2,y2=list(map(int,input().split()))

if x2>x1 and y2>y1:
  x3=x2-abs(y2-y1);y3=y2+abs(x2-x1);x4=x3-abs(y3-y2);y4=y3-abs(x3-x2)

elif x2<x1 and y2>y1:
  x3=x2-abs(y2-y1);y3=y2-abs(x2-x1);x4=x3+abs(y3-y2);y4=y3-abs(x3-x2)

elif x2<x1 and y2<y1:
  x3=x2+abs(y2-y1);y3=y2-abs(x2-x1);x4=x3+abs(y3-y2);y4=y3+abs(x3-x2)

elif x2>x1 and y2<y1:
  x3=x2+abs(y2-y1);y3=y2+abs(x2-x1);x4=x3-abs(y3-y2);y4=y3+abs(x3-x2)

  
print(x3,y3,x4,y4)


Fixed submission:
x1,y1,x2,y2=list(map(int,input().split()))

if x2>=x1 and y2>=y1:
  x3=x2-abs(y2-y1);y3=y2+abs(x2-x1);x4=x3-abs(y3-y2);y4=y3-abs(x3-x2)

elif x2<=x1 and y2>=y1:
  x3=x2-abs(y2-y1);y3=y2-abs(x2-x1);x4=x3+abs(y3-y2);y4=y3-abs(x3-x2)

elif x2<=x1 and y2<=y1:
  x3=x2+abs(y2-y1);y3=y2-abs(x2-x1);x4=x3+abs(y3-y2);y4=y3+abs(x3-x2)

elif x2>=x1 and y2<=y1:
  x3=x2+abs(y2-y1);y3=y2+abs(x2-x1);x4=x3-abs(y3-y2);y4=y3+abs(x3-x2)

  
print(x3,y3,x4,y4)
Buggy python submission (verdict: Runtime Error):
import re
S=str(input())
k=int(input())
x=re.search(r'[2-9]',S).start()

if S[0]=='1':
  if k<=x:
    print(S[0])
  else:
    print(S[x])     
  
else:
  print(S[0])


Fixed submission:
import re
S=str(input())
k=int(input())

if set(S)=={'1'}:
  print(1)
  
else:
  x=re.search(r'[2-9]',S).start()
      
  if S[0]=='1':
    if k<=x:
      print(S[0])
    else:
      print(S[x])     
  else:
    print(S[0])

Buggy python submission (verdict: Runtime Error):
import re
S=str(input())
k=int(input())
x=re.search(r'[2-9]',S).start()

if S[0]=='1':
  if k<=x:
    print(1)
  else:
    print(S[x])     
  
else:
  print(S[0])


Fixed submission:
import re
S=str(input())
k=int(input())

if set(S)=={'1'}:
  print(1)
  
else:
  x=re.search(r'[2-9]',S).start()
      
  if S[0]=='1':
    if k<=x:
      print(S[0])
    else:
      print(S[x])     
  else:
    print(S[0])
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict
d = defaultdict(int)

h,w = map(int,input().split())

for hh in range(h):
  s = list(input())
  for ss in s:
    d[ss]+=1

dv  = list(d.values())
d2 = [i for i in dv if i%2 == 0 and i%4 !=0]
d2_2 = [i for i in d2 if i == 2]
d4 = [i for i in dv if i%4 == 0]
d2_e = [i for i in d2 if i != 2]
d_odd  = [i for i in list(d.values()) if i%2 == 1]


if h%2==0:
  if w%2==0:
    if len(dv)==len(d4):
      ans = "Yes"
    else:
      ans = "No"
else:
  if w%2==0:
    if len(d_odd)==0 and len(d2_2)<=1 and all(list(map(lambda x:x%(h*2)==0,d2_e))):
      ans = "Yes"
    else:
      ans = "No"
  else:
    ans = "Yes" if len(dv)==len(d4) else "No"
print(ans)



Fixed submission:
from collections import Counter
 
h, w = map(int, input().split())
a = Counter(''.join(input() for _ in range(h)))
 
center = h * w % 2 
side = (h//2) * (w%2) + (w//2) * (h%2)
corner = (h//2) * (w//2)

for _ in range(center):
    for i in a:
        if a[i] % 2 == 1:
            a[i] -= 1
            break
for _ in range(side):
    for j in a:
        if a[j] % 4 == 2:
            a[j] -= 2
            break

print('Yes' if sum(a[i]%4 for i in a) == 0 else 'No')
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
a_min=min(a)
a_max=max(a)

s=list(range(a_min,a_max+1))
t=[0]*(a_max+1)

for i in range(n):
  t[a[i]]+=1

x=0
for j in range(1,n-1):
  x=max(x,t[j-1]+t[j]+t[j+1])

print(x)
  

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a_min=min(a)
a_max=max(a)

s=list(range(a_min,a_max+1))
t=[0]*(a_max+1)

for i in range(n):
  t[a[i]]+=1

x=sum(t[:2]) #initialize
for j in range(1,len(t)-1):
  x=max(x,t[j-1]+t[j]+t[j+1])

print(x)
Buggy python submission (verdict: Runtime Error):
import collections
n = int(input())
a = list(map(int,input().split()))
c = sorted(collections.Counter(a).items(),reverse = True)

num2=[]
num4=[]

for k in c:
  if k[1]>=4:
    num4.append(k[0])
  if k[1]>=2:
    num2.append(k[0])

if len(num2)>=2 or len(num4)>=1:
  print(max(num2[0]*num2[1],num4[0]**2))
else:
  print(0) 

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

c = sorted(collections.Counter(a).items(),reverse = True)

tmp = 0
ans=[]

for k in c:
  if k[1]>=4:
    tmp = max(tmp,k[0]*k[0])
  if k[1]>=2:
    ans.append(k[0])
  else:
    continue

if len(ans)>=2:
  print(max(ans[0]*ans[1],tmp))
else:
  print(tmp)
Buggy python submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))
ans=10**9
sumA=sum(A)

for i in range(n-1):
  x+=A[i]
  ans=min(ans,abs(sumA-x*2))

print(ans)

Fixed submission:
n=int(input())
A=list(map(int,input().split()))
ans=10**20
sumA=sum(A)
x=0
for i in range(n-1):
  x+=A[i]
  ans=min(ans,abs(sumA-x*2))

print(ans)
Buggy python submission (verdict: Runtime Error):
from collections import deque

n = int(input())
a = list(map(int,input().split()))
d = deque(a)

tmp = []
cnt = 0
while d:
  v = d.popleft()
  tmp.append(v)
  if len(tmp)<=2:
    pass
  else:
    if not ( tmp[-1] >= tmp[-2] >= tmp[-3] or tmp[-1] <= tmp[-2] <= tmp[-3]):
      tmp = [tmp[-1]]
      cnt += 1
  
  print(d,tmp,cnt)
if tmp:
  cnt+=1
print(cnt)

Fixed submission:
from collections import deque
 
n = int(input())
a = list(map(int,input().split()))
d = deque(a)
 
tmp = []
cnt = 0
while d:
  v = d.popleft()
  if len(tmp)<=1:
    pass
  else:
    if not (v >= tmp[-1] >= tmp[-2] >= tmp[0] or v <= tmp[-1] <= tmp[-2] <= tmp[0]):
      tmp = []
      cnt += 1
  tmp.append(v)
#  print(d,tmp,cnt)
if tmp:
  cnt+=1
print(cnt)

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

flg = "default" #increase_flg
cnt = 0
for i in range(n-1):
  if a[i+1] > a[i]:
    if not flg:
      cnt+=1
      flg = "default"
    else:
      flg = True
  elif a[i+1] < a[i]:
    if flg:
      cnt+=1
      flg = "default"
    else:
      flg = False
#  print(a[i],a[i+1],flg,cnt)

if not a[i]>=a[i-1]>=a[i-2] or a[i]<=a[i-1]<=a[i-2]:
  cnt +=1 
print(cnt)

Fixed submission:
from collections import deque
 
n = int(input())
a = list(map(int,input().split()))
d = deque(a)
 
tmp = []
cnt = 0
while d:
  v = d.popleft()
  if len(tmp)<=1:
    pass
  else:
    if not (v >= tmp[-1] >= tmp[-2] >= tmp[0] or v <= tmp[-1] <= tmp[-2] <= tmp[0]):
      tmp = []
      cnt += 1
  tmp.append(v)
#  print(d,tmp,cnt)
if tmp:
  cnt+=1
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
cnt=0
A,B=[],[]
for i in range(n):
  a,b=list(map(int,input().split()))
  A.append(a)
  B.append(b)

for i in range(n)[::-1]:
  add=(B[i]*(A[i]//B[i]+1)-A[i]) if A[i]%B[i]!=0 else 0
  A[:i+1]=map(lambda x:x+add,A[:i+1])
  cnt+=add
print(cnt)


Fixed submission:
n=int(input())
cnt=0
A,B=[],[]
for i in range(n):
  a,b=list(map(int,input().split()))
  A.append(a)
  B.append(b)

for i in range(n)[::-1]:
  if (A[i]+cnt)%B[i]==0:
    continue
  else:
    cnt+=(B[i]*((A[i]+cnt)//B[i]+1)-(A[i]+cnt))
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
cnt=0
A,B=[],[]
for i in range(n):
  a,b=list(map(int,input().split()))
  A.append(a)
  B.append(b)

def f(a,b):
  if a%b==0:
    return 0
  else:
    return (b*(a//b+1)-a)

for i in range(n)[::-1]:
  add=f(A[i],B[i])
  A[:i+1]=map(lambda x:x+add,A[:i+1])
  cnt+=add
print(cnt)

Fixed submission:
n=int(input())
cnt=0
A,B=[],[]
for i in range(n):
  a,b=list(map(int,input().split()))
  A.append(a)
  B.append(b)

for i in range(n)[::-1]:
  if (A[i]+cnt)%B[i]==0:
    continue
  else:
    cnt+=(B[i]*((A[i]+cnt)//B[i]+1)-(A[i]+cnt))
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
def make_divisors(n):
    divisors = []
    # 試し割りで、かつ積でnを作るときの相方も同時に追加してる
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    return divisors

ans = 0
for c in range(1,N):
    p = N-c
    div_ls = make_divisors(p)
    ans += len(div_ls)
print(ans)



Fixed submission:
N = int(input())
# 1以上n未満の数について、それぞれ約数の個数を数える
i_Divs = [0] * (N+1)
base = 1
Max = int(N**0.5)+1
while base < Max:
    now = base
    while now <= N:
        if now//base >= Max:
            i_Divs[now] += 2
        else:
            #print(now,base,1)
            i_Divs[now] += 1
        now += base
    base += 1
#print(i_Divs)

ans = 0
for c in range(1,N):
    p = N-c
    ans += i_Divs[p]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = 0
base = 10
while n > 0:
    n,r = divmod(n,base)
    add = r
    s += add
    s %= 9
#print(s)
if s % 9 == 0:
    print('Yes')
else:
    print('No')

Fixed submission:
n = int(input())
if n % 9 == 0:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
def digit_sum(n):
    # 各桁の和を求める
    # 計算量: O(logN)
    ans = 0
    while n > 0:
        ans += n % 10
        n //= 10
    return ans
s = digit_sum(n)
if s % 9 == 0:
    print('Yes')
else:
    print('No')



Fixed submission:
n = int(input())
if n % 9 == 0:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = 0
base = 10
while n > 0:
    n,r = divmod(n,base)
    add = r
    s += add
#print(s)
if s % 9 == 0:
    print('Yes')
else:
    print('No')



Fixed submission:
n = int(input())
if n % 9 == 0:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
keta = len(str(n))
s = 0
base = 10**(keta-1)
while base > 0:
    r,n = divmod(n,base)
    s += r
    base //= 10
#print(s)
if s % 9 == 0:
    print('Yes')
else:
    print('No')



Fixed submission:
n = int(input())
if n % 9 == 0:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
keta = len(str(n))
s = 0
base = 10**(keta-1)
while base > 0:
    r,n = divmod(n,base)
    s += r
    base //= 10
#print(s)
if s % 9 == 0:
    print('Yes')
else:
    print('No')



Fixed submission:
n = int(input())
if n % 9 == 0:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
keta = len(str(n))
s = 0
for i in range(keta-1,-1,-1):
    r,n = divmod(n,10**i)
    s += r
#print(s)
if s % 9 == 0:
    print('Yes')
else:
    print('No')



Fixed submission:
n = int(input())
if n % 9 == 0:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
keta = len(str(k))
now = '7' * keta
ans = -1
while len(now) <= 999982:
    if int(now) % k == 0:
        ans = len(now)
        break
    now += '7'
print(ans)



Fixed submission:
import sys
k = int(input())
mod_k = [0] * (k+2)
mod_k[1] = 7 % k
if mod_k[1] == 0:
    print(1)
    sys.exit()
for i in range(2,k+2):
    nex = (mod_k[i-1]*10+7) % k
    if nex == 0:
        print(i)
        sys.exit()
    mod_k[i] = nex
print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
base = 1
i = 1
ans = -1
while i <= 10**6:
    if (7*base) % k == 0:
        ans = i
        break
    base += 10**i
    i += 1
print(ans)



Fixed submission:
import sys
k = int(input())
mod_k = [0] * (k+2)
mod_k[1] = 7 % k
if mod_k[1] == 0:
    print(1)
    sys.exit()
for i in range(2,k+2):
    nex = (mod_k[i-1]*10+7) % k
    if nex == 0:
        print(i)
        sys.exit()
    mod_k[i] = nex
print(-1)
Buggy python submission (verdict: Runtime Error):
alphabet = [chr(i) for i in range(97, 97+26)]
n = int(input())
keta = 1
rest = 0
while True:
    if n <= 26 ** keta + rest:
        break
    rest += 26 ** keta
    keta += 1  

ans = ''
for i in range(keta-1,-1,-1):
    # 「26**iをいくつ含むか」をループで求める
    # 必ず1以上含む
    contain = 1
    while True:
        if n < contain * 26**i:
            break
        contain += 1
    contain -= 1
    ans += alphabet[contain-1]
    n -= contain * 26 ** i


print(ans)



Fixed submission:
n = int(input())
alphabet = [chr(i) for i in range(97, 97+26)]
ans = ""
i = 0
while n - 26**i >= 0:
    n -= 26**i
    i += 1
# ここを抜けた時,iは桁数

for _ in range(i):
    q,r = divmod(n,26)
    n = q
    ans += alphabet[r]
print(ans[::-1])

Buggy python submission (verdict: Runtime Error):
alphabet = [chr(i) for i in range(97, 97+26)]
n = int(input())
keta = 1
rest = 0
while True:
    if n <= 26 ** keta + rest:
        break
    rest += 26 ** keta
    keta += 1  
print(keta)
ans = ''
for i in range(keta-1,-1,-1):
    # 「26**iをいくつ含むか」をループで求める
    # 必ず1以上含む
    contain = 1
    while True:
        if n < contain * 26**i:
            break
        contain += 1
    contain -= 1
    ans += alphabet[contain-1]
    n -= contain * 26 ** i


print(ans)



Fixed submission:
n = int(input())
alphabet = [chr(i) for i in range(97, 97+26)]
ans = ""
i = 0
while n - 26**i >= 0:
    n -= 26**i
    i += 1
# ここを抜けた時,iは桁数

for _ in range(i):
    q,r = divmod(n,26)
    n = q
    ans += alphabet[r]
print(ans[::-1])

Buggy python submission (verdict: Runtime Error):
import sys
n = int(input())
m = n

alphabet = [chr(i) for i in range(97, 97+26)]

keta = 1
while True:
    if n <= 26**(keta):
        break
    n -= 26**(keta)
    keta += 1
ans = ''

for i in range(keta-1, -1, -1):
    have = m // (26 ** i)
    ans += alphabet[have-1]
    m -= 26 ** i * have
    
print(ans)




Fixed submission:
n = int(input())
alphabet = [chr(i) for i in range(97, 97+26)]
ans = ""
i = 0
while n - 26**i >= 0:
    n -= 26**i
    i += 1
# ここを抜けた時,iは桁数

for _ in range(i):
    q,r = divmod(n,26)
    n = q
    ans += alphabet[r]
print(ans[::-1])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a_ls = list(map(int, input().split()))
ans = 1
for i in range(n):
    ans *= a_ls[i]
if ans > 10**18:
    print(-1)
else:
    print(ans)
        


Fixed submission:
import sys
n = int(input())
a_ls = list(map(int, input().split()))
ans = 1
if min(a_ls) != 0:
    for i in range(n):
        ans *= a_ls[i]
        if ans > 10**18:
            print(-1)
            sys.exit()
    if ans > 10**18:
        print(-1)
    else:
        print(ans)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
import math
import sys
a,b,h,m = map(int,input().split())
h_ = h*30 + (m/60) * 30
m_ = m*6
alpha = h_ - m_
if 0 < alpha < 180:
    pass
elif alpha == 180:
    print(h+m)
    sys.exit()
elif alpha == 0:
    prinnt(abs(a-b))
    sys.exit()
else:
    alpha = 360 - alpha
ans_2 = a**2 + b**2 - 2 * b * a * math.cos(math.radians(alpha))
print(ans_2 ** 0.5)

Fixed submission:
import math
import sys
a,b,h,m = map(int,input().split())
h_ = h*30 + (m/60) * 30
m_ = m*6
alpha = h_ - m_
if 0 < alpha < 180:
    pass
elif alpha == 180:
    print(a+b)
    sys.exit()
elif alpha == 0 or alpha == 360:
    print(abs(a-b))
    sys.exit()
else:
    alpha = 360 - alpha
ans_2 = a**2 + b**2 - 2 * b * a * math.cos(math.radians(alpha))
print(ans_2 ** 0.5)
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations
n = int(input())
a_ls = list(map(int, input().split()))
ans = 0
inds = [i for i in range(n)]
for ind_a, ind_b in combinations(inds, 2):
    Sum = a_ls[ind_a] + a_ls[ind_b]
    diff = abs(ind_a - ind_b)
    if Sum == diff:
        ans += 1
print(ans)

Fixed submission:
from collections import defaultdict
n = int(input())
a_ls = list(map(int, input().split()))
L_dict = defaultdict(int)
for i in range(n):
    Li = a_ls[i] + i + 1
    L_dict[Li] += 1

ans = 0
for j in range(n):
    Rj = j + 1 - a_ls[j]
    ans += L_dict[Rj]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations
n = int(input())
a_ls = list(map(int, input().split()))
ans = 0
inds = [i for i in range(n)]
for ind_a, ind_b in combinations(inds, 2):
    Sum = a_ls[ind_a] + a_ls[ind_b]
    diff = abs(ind_a - ind_b)
    if Sum == diff:
        ans += 1
print(ans)

Fixed submission:
from collections import defaultdict
n = int(input())
a_ls = list(map(int, input().split()))
L_dict = defaultdict(int)
for i in range(n):
    Li = a_ls[i] + i + 1
    L_dict[Li] += 1

ans = 0
for j in range(n):
    Rj = j + 1 - a_ls[j]
    ans += L_dict[Rj]
print(ans)

Buggy python submission (verdict: Runtime Error):
from itertools import combinations
n = int(input())
a_ls = list(map(int, input().split()))
ans = 0
inds = [i for i in range(n)]
for ind_a, ind_b in combinations(inds, 2):
    Sum = a_ls[ind_a] + a_ls[ind_b]
    diff = abs(a-b)
    if Sum == diff:
        ans += 1
print(ans)

Fixed submission:
from collections import defaultdict
n = int(input())
a_ls = list(map(int, input().split()))
L_dict = defaultdict(int)
for i in range(n):
    Li = a_ls[i] + i + 1
    L_dict[Li] += 1

ans = 0
for j in range(n):
    Rj = j + 1 - a_ls[j]
    ans += L_dict[Rj]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a_ls = list(map(int, input().split()))
ans = 0
for i in range(n):
    for j in range(i+1,n):
        target_ind = j
        target_h = a_ls[target_ind]
        diff = abs(target_ind - i)
        Sum = target_h + a_ls[i]
        if diff == Sum:
            ans += 1
print(ans)

Fixed submission:
from collections import defaultdict
n = int(input())
a_ls = list(map(int, input().split()))
L_dict = defaultdict(int)
for i in range(n):
    Li = a_ls[i] + i + 1
    L_dict[Li] += 1

ans = 0
for j in range(n):
    Rj = j + 1 - a_ls[j]
    ans += L_dict[Rj]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a_ls = list(map(int, input().split()))
ans = 0
for i in range(n):
    for j in range(i+1,n):
        target_ind = j
        target_h = a_ls[target_ind]
        diff = abs(target_ind - i)
        Sum = target_h + a_ls[i]
        if diff == Sum:
            ans += 1
print(ans)


Fixed submission:
from collections import defaultdict
n = int(input())
a_ls = list(map(int, input().split()))
L_dict = defaultdict(int)
for i in range(n):
    Li = a_ls[i] + i + 1
    L_dict[Li] += 1

ans = 0
for j in range(n):
    Rj = j + 1 - a_ls[j]
    ans += L_dict[Rj]
print(ans)