Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
a, b, k = map(int, input().split())
l = [i for i in range(a, b+1)]

c = a
while c < a + k and c <= b:
    print(c)
    c += 1
c = max(b-k+1, c)
while c <= b:
    print(c)
    c += 1


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

c = a
while c < a + k and c <= b:
    print(c)
    c += 1
c = max(b-k+1, c)
while c <= b:
    print(c)
    c += 1

Buggy python submission (verdict: Time Limit Exceeded):
a, b, k = map(int, input().split())
l = [i for i in range(a, b+1)]

if len(l) <= 2*k:
    print('\n'.join(map(str,l)))
else:
    print('\n'.join(map(str, l[:k])))
    print('\n'.join(map(str, l[len(l)-k:])))

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

c = a
while c < a + k and c <= b:
    print(c)
    c += 1
c = max(b-k+1, c)
while c <= b:
    print(c)
    c += 1

Buggy python submission (verdict: Time Limit Exceeded):
a, b, k = map(int, input().split())
l = [i for i in range(a, b+1)]

for i in l[:k]:
    print(i)
for j in l[len(l)-k:]:
    if j <= i:
        continue
    print(j)

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

c = a
while c < a + k and c <= b:
    print(c)
    c += 1
c = max(b-k+1, c)
while c <= b:
    print(c)
    c += 1

Buggy python submission (verdict: Time Limit Exceeded):
a, b, k = map(int, input().split())
l = [i for i in range(a, b+1)]

for i in l[:k]:
    print(i)
for j in l[len(l)-k:]:
    if j <= i:
        continue
    print(j)

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

c = a
while c < a + k and c <= b:
    print(c)
    c += 1
c = max(b-k+1, c)
while c <= b:
    print(c)
    c += 1
Buggy python submission (verdict: Runtime Error):
s = input()
a = 'abcdefghijklmnopqrstuvwxyz'
ans = ''

if len(s) < 26:
    for w in a:
        if not w in s:
            ans = s + w
            break

r = ''.join(sorted(a, reverse=True))
if len(s) == 26:
    for i in range(len(s), -1, -1):
        if i == len(s) and r[:i] == s[-i:]:
            print('-1')
            exit()
        if r[:i] == s[-i:]:
            ele = i
            break
    ans = s[:-(ele+1)] + sorted(r[:ele])[0]

print(ans)

Fixed submission:
s = input()
a = 'abcdefghijklmnopqrstuvwxyz'

if len(s) < 26:
    for w in a:
        if not w in s:
            print(s + w)
            exit()

if len(s) == 26:
    for i in range(len(s)-2, -1, -1):
        for j in range(len(s)-1, i, -1):
            if s[i] < s[j]:
                print(s[:i]+s[j])
                exit()

print('-1')

Buggy python submission (verdict: Runtime Error):
s = input()
a = 'abcdefghijklmnopqrstuvwxyz'
ans = ''
if len(s) < 26:
    for w in a:
        if not w in s:
            ans = s + w
            break
elif s == 'zyxwvutsrqponmlkjihgfedcba':
    ans = '-1'
else:
    l = list(a)
    l.sort(reverse=True)
    l = ''.join(l)
    ele = 0
    for i in range(len(s)):
        if l[:i] == s[-i:]:
            ele = i
    if ele < 25:
        t = s[:-(ele+1)]
        u = l[:ele]+s[-(ele+1):-(ele)]
        u2 = sorted(u)
        ans = t + u2[1]
'''
        for w in a:
            if not w in t and t + w != s[:-ele]:
                ans = t + w
                break
'''
print(ans)

Fixed submission:
s = input()
a = 'abcdefghijklmnopqrstuvwxyz'

if len(s) < 26:
    for w in a:
        if not w in s:
            print(s + w)
            exit()

if len(s) == 26:
    for i in range(len(s)-2, -1, -1):
        for j in range(len(s)-1, i, -1):
            if s[i] < s[j]:
                print(s[:i]+s[j])
                exit()

print('-1')
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
c = [[0]*n for _ in range(m)]

ans = 0
if n == 1 and m == 1:
    ans = 1
elif n == 1:
    ans = m - 2
elif m == 1:
    ans = n - 2
else:
    ans = (n-2)*(m-2)

print(ans)

Fixed submission:
n, m = map(int, input().split())
# c = [[0]*n for _ in range(m)]

ans = 0
if n == 1 and m == 1:
    ans = 1
elif n == 1:
    ans = m - 2
elif m == 1:
    ans = n - 2
else:
    ans = (n-2)*(m-2)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

s_a = set(a)
c_a = []
for i in s_a:
    c_a.append(a.count(i))
d_a = list(zip(s_a, c_a))

ans = 0
for i in d_a:
    if i[0] > i[1]:
        ans += i[1]
    if i[1] > i[0]:
        ans += i[1] - i[0]

print(ans)

Fixed submission:
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
c = dict(Counter(a))

ans = 0
for i in c:
    if i > c[i]:
        ans += c[i]
    if c[i] > i:
        ans += c[i] - i

print(ans)
Buggy python submission (verdict: Runtime Error):
n = input()

if (n[0] == n[1] and n[1] == n[2]) or (n[2] == n[3] and n[1] == n[2]):
    print("Yes")
else
    print("No")

Fixed submission:
n = input()

if (n[0] == n[1] and n[1] == n[2]) or (n[2] == n[3] and n[1] == n[2]):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
import bisect as bis

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

ans = 0
for i in range(n):
    top = a[i]
    for j in range(n):
        mid = b[j]
        if top >= mid:
            continue
        k = bis.bisect_right(c, mid)
        ans += n - k

print(ans)

Fixed submission:
import bisect as bis

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

ans = 0
for b_e in b:
    n_top = bis.bisect_left(a, b_e)
    n_bottom = n - bis.bisect_right(c, b_e)
    ans += n_top * n_bottom

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = [int(input()) for _ in range(n)]

s.sort()
s_max = sum(s)

if s_max % 10 != 0:
    print(s_max)
else:
    for i in s if i % 10 != 0:
        print(s_max - i)
        exit()

print(0)

Fixed submission:
n = int(input())
s = [int(input()) for _ in range(n)]

s.sort()
s_max = sum(s)

if s_max % 10 != 0:
    print(s_max)
    exit()
else:
    for i in s:
        if i % 10 != 0:
            print(s_max - i)
            exit()

print(0)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = [int(input()) for _ in range(n)]

# bit全探索
s_max = 0
for bit in range(1<<n):

    s_tmp = 0
    for i in range(n):
        if bit >> i & 1:
            s_tmp += s[i]
    
    if s_tmp % 10 == 0:
        s_tmp = 0

    s_max = max(s_max, s_tmp)
    
print(s_max)

Fixed submission:
n = int(input())
s = [int(input()) for _ in range(n)]

s.sort()
s_max = sum(s)

if s_max % 10 != 0:
    print(s_max)
    exit()
else:
    for i in s:
        if i % 10 != 0:
            print(s_max - i)
            exit()

print(0)
Buggy python submission (verdict: Time Limit Exceeded):
import heapq as q

n, k = map(int, input().split())
l = []
q.heapify(l)

for i in range(n):
    a, b = map(int, input().split())
    for j in range(b):
        q.heappush(l, a)

for i in range(k):
    ans = q.heappop(l)
print(ans)

Fixed submission:
n, k = map(int, input().split())
l = [0]*(10**5+10)

for i in range(n):
    a, b = map(int, input().split())
    l[a] += b

sum = 0
for i in range(len(l)):
    sum += l[i]
    if sum >= k:
        print(i)
        break

Buggy python submission (verdict: Time Limit Exceeded):
import heapq as q

n, k = map(int, input().split())
l = []
for i in range(n):
    a, b = map(int, input().split())
    l += [a]*b
q.heapify(l)
for i in range(k):
    ans = q.heappop(l)
print(ans)

Fixed submission:
n, k = map(int, input().split())
l = [0]*(10**5+10)

for i in range(n):
    a, b = map(int, input().split())
    l[a] += b

sum = 0
for i in range(len(l)):
    sum += l[i]
    if sum >= k:
        print(i)
        break

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
l = []
for i in range(n):
    a, b = map(int, input().split())
    l += [a]*b
l.sort()
print(l[k-1])

Fixed submission:
n, k = map(int, input().split())
l = [0]*(10**5+10)

for i in range(n):
    a, b = map(int, input().split())
    l[a] += b

sum = 0
for i in range(len(l)):
    sum += l[i]
    if sum >= k:
        print(i)
        break

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a, b = [0]*n, [0]*n
for i in range(n):
    a[i], b[i] = map(int, input().split())

s = list()
for i in range(n):
    for j in range(b[i]):
        s.append(a[i])

s.sort()
print(s[k-1])

Fixed submission:
n, k = map(int, input().split())
l = [0]*(10**5+10)

for i in range(n):
    a, b = map(int, input().split())
    l[a] += b

sum = 0
for i in range(len(l)):
    sum += l[i]
    if sum >= k:
        print(i)
        break
Buggy python submission (verdict: Runtime Error):
x, y = map(int, input().split())

b = abs(abs(x)-abs(y))
if x * y < 0:
    print(b+1)
elif 0 =< y < x or y < x <= 0:
    print(b+2)
else:
    print(b) 

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

b = abs(abs(x)-abs(y))
if x * y < 0:
    print(b+1)
elif 0 < y < x or y < x < 0:
    print(b+2)
elif (y == 0 and x > 0) or (x == 0 and y < 0):
    print(b+1)
else:
    print(b)
Buggy python submission (verdict: Runtime Error):
from statistics import mean
n = int(input())
a = list(map(int, input().split()))
t = round(mean(a))

sum = 0
for t in a:
    sum += (i - t)**2

print(sum)

Fixed submission:
from statistics import mean
n = int(input())
a = list(map(int, input().split()))
t = round(mean(a))

sum = 0
for i in a:
    sum += (i - t)**2

print(sum)
Buggy python submission (verdict: Runtime Error):
A = int(input("a = "))
B = int(input("b = "))
C = A*B
print(C)
print(C/2)
if 1 <= A <= 10000 and 1 <= B <= 10000 and C%2 == 0:
    print("Even")
else:
    print("Odd")

Fixed submission:
a, b = map(int, input().split())
print("Even" if a*b % 2 == 0 else "Odd")
Buggy python submission (verdict: Runtime Error):
n, k = map(int,input().split())
ans = 0
if n < k:
    ans = n
else:
    ans = min(n%k,k-n%k))

print(ans)


Fixed submission:
n, k = map(int,input().split())
ans = 0
ans = min(n%k,abs(n%k-k))

print(ans)
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
f=int(input())
ans=0
arr=[b,c,d,e,f]
amari=0
gurupu=0
syou=0

for i in range(6):
    if i == 1:
        amari=a % b
        gurupu=a // b + 1
        syou=b
    elif arr[i-1]<arr[i]:
        if amari>arr[i]:
            amari=amari % arr[i]
            gurupu=syou // arr[i] + 1
        else:
            gurupu=syou // arr[i] + 1
            

print(gurupu + 4)

Fixed submission:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
f=int(input())
 
print((a-1) // min(b,c,d,e,f) + 5)

Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
f=int(input())
ans=0
arr=[b,c,d,e,f]
amari=0
gurupu=0
syou=0

for i in range(6):
    if i == 1:
        amari=a % b
        gurupu=a // b + 1
        syou=b
    elif arr[i-1]<arr[i]:
        if amari>arr[i]:
            amari=amari % arr[i]
            gurupu=syou // arr[i] + 1
        else:
            gurupu=syou // arr[i] + 1
            

print(gurupu + 4)

Fixed submission:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
f=int(input())
 
print((a-1) // min(b,c,d,e,f) + 5)

Buggy python submission (verdict: Time Limit Exceeded):
import sys

sys.setrecursionlimit(1000000000)

ap=a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
f=int(input())
bp=cp=dp=ep=fp=0
i=0
def idou(a,b,c,d,e,f,ap,bp,cp,dp,ep,fp):
    global i
    if a==fp:
        return i
    else:
        i+=1
        if ep != 0:
            if ep>=f:
                ep-=f
                fp+=f
            else:
                fp+=ep
                ep=0
        if dp != 0:
            if dp>=e:
                dp-=e
                ep+=e
            else:
                ep+=dp
                dp=0
        if cp != 0:
            if cp>=d:
                cp-=d
                dp+=d
            else:
                dp+=cp
                cp=0
        if bp != 0:
            if bp>=c:
                bp-=c
                cp+=c
            else:
                cp+=bp
                bp=0
        if ap != 0:
            if ap>=b:
                ap-=b
                bp=bp+b
            else:
                bp+=ap
                ap=0
        idou(a,b,c,d,e,f,ap,bp,cp,dp,ep,fp)
idou(a,b,c,d,e,f,ap,bp,cp,dp,ep,fp)
print(i)

Fixed submission:
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
f=int(input())
 
print((a-1) // min(b,c,d,e,f) + 5)
Buggy python submission (verdict: Runtime Error):
def tyoudo(a,b,c,x):
  ans=0
  for i in range(a):
    for ii in range(b):
      for iii in range(c):
        if x==500*i+100*ii+50*iii:
          ans+=1
          
  return ans
a=input()
b=input()
c=input()
x=input()
print(tyoudo(a,b,c,x))

Fixed submission:
def tyoudo(a,b,c,x):
  ans=0
  for i in range(a+1):
    for ii in range(b+1):
      for iii in range(c+1):
        if x==500*i+100*ii+50*iii:
          ans+=1
  return ans
a=int(input())
b=int(input())
c=int(input())
x=int(input())
print(tyoudo(a,b,c,x))
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
def seki(a,b):
    if a*b%2==1:
        return "Even"
    else:
        return "Odd"

a,b=input()
print(seki(a,b))

Fixed submission:
# -*- coding: utf-8 -*-
def seki(a,b):
    if a*b%2==1:
        return "Odd"
    else:
        return "Even"

a,b=map(int,input().split())
print(seki(a,b))
Buggy python submission (verdict: Runtime Error):
def heihou(a,b):
  c=a+b
  c=int(s)
  s=s**1/2
  if s%1==0:
    return "Yes"
  else:
    return "No"
a,b=map(str,input().split())
print(heihou(a,b))

Fixed submission:
def heihou(a,b):
  c=a+b
  s=int(c)
  s=pow(s,1/2)
  if s.is_integer():
    return "Yes"
  else:
    return "No"
a,b=map(str,input().split())
print(heihou(a,b))
Buggy python submission (verdict: Runtime Error):
def wa(n,a,b):
  hoge=0
  for i in range(1,n+1):
    s=str(i)
    for ii in s:
      hoge+=int(ii)
    if a<=hoge<=b:
      ans+=i
  return ans
n,a,b=map(int,input().split())
print(wa(n,a,b))  

Fixed submission:
def wa(n,a,b):
  hoge=0
  ans=0
  for i in range(1,n+1):
    s=str(i)
    hoge=0
    for ii in s:
      hoge+=int(ii)
    if a<=hoge<=b:
      ans+=i
  return ans
n,a,b=map(int,input().split())
print(wa(n,a,b))

Buggy python submission (verdict: Runtime Error):
def wa(n,a,b):
  for i in range(1,n+1):
    s=str(i)
    for ii in s:
      ss+=int(ii)
    if a<=ss<=b:
      ans+=i
  return ans
n,a,b=map(int,input().split())
print(wa(n,a,b))  

Fixed submission:
def wa(n,a,b):
  hoge=0
  ans=0
  for i in range(1,n+1):
    s=str(i)
    hoge=0
    for ii in s:
      hoge+=int(ii)
    if a<=hoge<=b:
      ans+=i
  return ans
n,a,b=map(int,input().split())
print(wa(n,a,b))

Buggy python submission (verdict: Runtime Error):
def wa(n,a,b):
  for i in range(1,n+1):
    s=str(i)
    for ii in s:
      ss+=int(ii)
    if a=<ss=<b:
      ans+=i
  return ans
n,a,b=map(int,input().split())
print(wa(n,a,b))  

Fixed submission:
def wa(n,a,b):
  hoge=0
  ans=0
  for i in range(1,n+1):
    s=str(i)
    hoge=0
    for ii in s:
      hoge+=int(ii)
    if a<=hoge<=b:
      ans+=i
  return ans
n,a,b=map(int,input().split())
print(wa(n,a,b))
Buggy python submission (verdict: Runtime Error):
def gu(n,a):
  ans=[0]*n
  for i in range(len(a)):
    ii=a[i]
    while True:
      if ii%2==0:
        ans[i]+=1
        ii=ii/2
      else:
        break
  return min(ans)
n=int(input())
a=list(map(int,input().split()))
print(gu(n,a))

Fixed submission:
def count_1(a):
  c=0
  for i in a:
    if i=="1":
      c+=1
  else:
    return c
a=input()
print(count_1(a))

Buggy python submission (verdict: Runtime Error):
def gu(n,a):
  ans=[0]*n
  for i in range(len(a)):
    ii=a[i]
    while True:
      if ii%2==0:
        ans[i]+=1
        ii=ii/2
      else:
        break
  return ans.min()
n=int(input())
a=list(map(int,input().split()))
print(gu(n,a))

Fixed submission:
def count_1(a):
  c=0
  for i in a:
    if i=="1":
      c+=1
  else:
    return c
a=input()
print(count_1(a))

Buggy python submission (verdict: Runtime Error):
def gu(n,a):
  ans=[0]*n
  for i in range(len(a)):
    ii=a[i]
    while True:
      if ii%2==0:
        ans[i]+=1
      else:
        break
  return ans.min()
n=int(input())
a=list(map(int,input().split()))
print(gu(n,a))

Fixed submission:
def count_1(a):
  c=0
  for i in a:
    if i=="1":
      c+=1
  else:
    return c
a=input()
print(count_1(a))

Buggy python submission (verdict: Runtime Error):
def gu(n,a):
  ans=[0]*n
  for i in len(len(a)):
    ii=a[i]
    while True:
      if ii%2==0:
        ans[i]+=1
      else:
        break
  return ans.min()
n=int(input())
a=list(map(int,input().split()))
print(gu(n,a))
def gu(n,a):
  ans=[0]*n
  for i in range(len(a)):
    ii=a[i]
    while True:
      if ii%2==0:
        ans[i]+=1
      else:
        break
  return ans.min()
n=int(input())
a=list(map(int,input().split()))
print(gu(n,a))


Fixed submission:
def count_1(a):
  c=0
  for i in a:
    if i=="1":
      c+=1
  else:
    return c
a=input()
print(count_1(a))
Buggy python submission (verdict: Runtime Error):
def gu(n,a):
  ans=[0]*n
  for i in len(len(a)):
    ii=a[i]
    while True:
      if ii%2==0:
        ans[i]+=1
      else:
        break
  return ans.min()
n=int(input())
a=list(map(int,input().split()))
print(gu(n,a))

Fixed submission:
def gu(n,a):
  ans=[0]*n
  for i in range(len(a)):
    ii=a[i]
    while True:
      if ii%2==0:
        ans[i]+=1
        ii=ii/2
      else:
        break
  return min(ans)
n=int(input())
a=list(map(int,input().split()))
print(gu(n,a))
Buggy python submission (verdict: Runtime Error):
K, X = map(int,input().split)
if 500*K >= X:
  print("Yes")
else:
  print("No")

Fixed submission:
K, X = map(int, input().split())
if 500*K >= X:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
S = str(input())
days = {"SUN":"7","MON":"6","TUE":"5","WED":"4","THU":"3","FRI":"2","SAT":"1"}
print(days{(S)})


Fixed submission:
S = str(input())
days = {"SUN":"7","MON":"6","TUE":"5","WED":"4","THU":"3","FRI":"2","SAT":"1"}
print(days[S])

Buggy python submission (verdict: Runtime Error):
S = str(input())
days = {"SUN":"7","MON":"6","TUE":"5","WED":"4","THU":"3","FRI":"2","SAT":"1"}
print(days(S))

Fixed submission:
S = str(input())
days = {"SUN":"7","MON":"6","TUE":"5","WED":"4","THU":"3","FRI":"2","SAT":"1"}
print(days[S])
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
# from itertools import accumulate
# from functools import reduce

def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())

## 数値
 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

N =  int(sys.stdin.readline())

print(sum(x - 1 for x in range(N, 0, -1)))

Fixed submission:
import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
# from itertools import accumulate
# from functools import reduce

def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())

## 数値
 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

N =  int(sys.stdin.readline())

print((N - 1) * N // 2)
Buggy python submission (verdict: Runtime Error):
# n=int(input())
# a,b=map(int, input().split())
# c=list(map(int, input().split()))
# s=[list(map(int,list(input()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# a=100
# b=0.987654321
# print('{0:06d}-{1:6f}'.format(a,b))  # 0埋めのときの出力
# 000100-0.987654

import numpy as np
import math
import copy

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

bound = 1
pos = 0

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

print(bound)

Fixed submission:
# n=int(input())
# a,b=map(int, input().split())
# c=list(map(int, input().split()))
# s=[list(map(int,list(input()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# a=100
# b=0.987654321
# print('{0:06d}-{1:6f}'.format(a,b))  # 0埋めのときの出力
# 000100-0.987654

import numpy as np
import math
import copy

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

bound = 1
pos = 0

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

print(bound)
Buggy python submission (verdict: Runtime Error):
# n=int(input())
# a,b=map(int, input().split())
# c=list(map(int, input().split()))
# s=[list(map(int,list(input()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# a=100
# b=0.987654321
# print('{0:06d}-{1:6f}'.format(a,b))  # 0埋めのときの出力
# 000100-0.987654

import numpy as np
import math
import copy
import itertools
from math import factorial

from operator import mul
from functools import reduce

"""
def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under
"""
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


div_num  = 1000000007

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

dmg = [int(input()) for _ in range(M)]

for i in range(M - 1):
    # 連番なら終了
    if dmg[i] + 1 == (dmg[i + 1]):
        print(0)
        exit()

comb_list = []
start = 0
for i in range(len(dmg) + 1):
    if i == len(dmg):
        interval = N - start
    else:
        interval = (dmg[i] - 1) - start
    j = 0
    comb_sum = 0
    while True:
        if (2 * j) > interval:
            break
        num_ptn_1_2 = j + (interval - (2 * j))
        r = j
        #comb_sum += int(factorial(num_ptn_1_2) / factorial(r) / factorial(num_ptn_1_2 - r))
        comb_sum += cmb(num_ptn_1_2,r)
        j += 1
    if i < len(dmg):
        # 壊れた階段の次を始点にする
        start = dmg[i] + 1
    comb_list.append(comb_sum)

result = 1

for elem in comb_list:
    result *= elem

print(result % div_num)

Fixed submission:
# n=int(input())
# a,b=map(int, input().split())
# c=list(map(int, input().split()))
# s=[list(map(int,list(input()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# a=100
# b=0.987654321
# print('{0:06d}-{1:6f}'.format(a,b))  # 0埋めのときの出力
# 000100-0.987654

import numpy as np
import math
import copy

n=int(input())

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

m = 1000000000

for i in range(n - 1):
    a = sum(w[:i + 1])
    b = sum(w[i+ 1:])
    m = min(abs(a-b), m)

print(m)