Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03038 (python)

Fixed submission:
n, m = map(int, input().split())
a = sorted(list(map(int, input().split())), reverse = True)
b = [list(map(int, input().split())) for i in range(m)]
b.sort(key=lambda x: -x[1])

ct1 = 0
ct2 = 0
ans = 0
i = 0

while i in range(n):
    if ct2 < m:
        if a[ct1] < b[ct2][1]:
            j = min(n-i, b[ct2][0])
            ans += b[ct2][1] * j
            i += j
            ct2 += 1
        else:
            ans += a[ct1]
            ct1 += 1
            i += 1
    else:
        ans += a[ct1]
        ct1 += 1
        i += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = sorted(list(map(int, input().split())), reverse = True)
b = [list(map(int, input().split())) for i in range(m)]
b.sort(key=lambda x: -x[1])

ct1 = 0
ct2 = 0
ans = 0
i = 0

while i in range(n):
    if a[ct1] > b[ct2][1]:
        ans += a[ct1]
        ct1 += 1
        i += 1
    else:
        j = min(n-i, b[ct2][0])
        ans += b[ct2][1] * j
        i += j
        ct2 += 1

print(ans)
Problem p02552 (python)

Fixed submission:
x=int(input())
print(1 if x==0 else 0)

Buggy submission (verdict: Runtime Error):
N=int(input())
p=[]
for i in range(N):
    p.append(list(map(int, input().split())))
q=[]
for i in range(N):
    for j in range(N-i):
        q.append(abs(p[i][0]-p[i+j][0])+abs(p[i][1]-p[i+j][1]))
print(max(q))
Problem p02546 (python)

Fixed submission:
s = input()
if s[-1] == "s":
    s += "es"
else:
    s += "s"
print(s)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline.rstrip
sys.setrecursionlimit(10**6)
import decimal
from decimal import Decimal
decimal.getcontext().prec = 10

from heapq import heappush, heappop, heapify
import math
from math import gcd
import itertools as it
import collections
from collections import deque 

def inp():
    return int(input())
def inpl():
    return list(map(int, input().split()))
def _debug(obj):
    print(obj, file=sys.stderr)

# ---------------------------------------

s = input()
if s[-1] == "s":
    s += "es"
else:
    s += "s"
print(s)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline.rstrip()
sys.setrecursionlimit(10**6)
import decimal
from decimal import Decimal
decimal.getcontext().prec = 10

from heapq import heappush, heappop, heapify
import math
from math import gcd
import itertools as it
import collections
from collections import deque 

def inp():
    return int(input())
def inpl():
    return list(map(int, input().split()))
def _debug(obj):
    print(obj, file=sys.stderr)

# ---------------------------------------

s = input()
if s[-1] == "s":
    s += "es"
else:
    s += "s"
print(s)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
import decimal
from decimal import Decimal
decimal.getcontext().prec = 10
 
from heapq import heappush, heappop, heapify
import math
from math import gcd
import itertools as it
import collections
from collections import deque 
 
def inp():
    return int(input())
def inpl():
    return list(map(int, input().split()))
def _debug(obj):
    print(obj, file=sys.stderr)
 
# ---------------------------------------
 
n = inp()
cnt = 0
mx = 0
for i in range(n):
    d1, d2 = inpl()
    if d1 == d2:
        cnt += 1
    else:
        cnt = 0
    mx = max(mx, cnt)
 
if mx >= 3:
    print("Yes")
else:
    print("No")
Problem p02659 (python)

Fixed submission:
a, b = map(str, input().split())
a = int(a)
b1, b2 = b.split('.')
b = int(b1) * 100 + int(b2)
ans = a * b
print(ans//100)

Buggy submission (verdict: Runtime Error):
a, b = map(str, input().split())
b1, b2 = b.split('.')
bb = int(b1) * 100 + int(b2)
print(int((a *bb)/100))

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
print(int(a*b))

Buggy submission (verdict: Runtime Error):
def main():
  a, b = map(str, input().split())
  print(int(a)*floar(b))
 
main()

Buggy submission (verdict: Runtime Error):
def main():
  a, b = map(str, input().split())
  print(round(int(a)*floar(b)))

main()

Buggy submission (verdict: Runtime Error):
def main():
  a = int(input())
  b = float(input())
  print(a*b)

main()

Buggy submission (verdict: Runtime Error):
a = int(input())
b = float(input())

print(a*b)
Problem p02688 (python)

Fixed submission:
import sys
read = sys.stdin.readline
import time
import math
import itertools as it
def inp():
    return int(input())
def inpl():
    return list(map(int, input().split()))
start_time = time.perf_counter()
# ------------------------------

N, K = inpl()
dp = [False] * N
for i in range(K):
    d = inp()
    A = inpl()
    for a in A:
        dp[a-1] = True
cnt = 0
for bl in dp:
    if not bl:
        cnt += 1
print(cnt)

# -----------------------------
end_time = time.perf_counter()
print('time:', end_time-start_time, file=sys.stderr)

Buggy submission (verdict: Runtime Error):
import sys
read = sys.stdin.readline
import time
import math
import itertools as it
def inp():
    return int(input())
def inpl():
    return list(map(int, input().split()))
start_time = time.perf_counter()
# ------------------------------

N, K = inpl()
dp = [False] * N
for i in range(K):
    d = inp()
    A = inpl()
    for a in A:
        dp[A-1] = True
cnt = 0
for bl in dp:
    if not bl:
        cnt += 1
print(cnt)

# -----------------------------
end_time = time.perf_counter()
print('time:', end_time-start_time, file=sys.stderr)
Problem p02689 (python)

Fixed submission:
import sys
import time
import math
import itertools as it
def inpl():
    return list(map(int, input().split()))
st = time.perf_counter()
# ------------------------------

N, M = inpl()
H = inpl()
dp = [True] * N
for _ in range(M):
    A, B = inpl()
    if H[A-1] > H[B-1]:
        dp[B-1] = False
    elif H[A-1] < H[B-1]:
        dp[A-1] = False
    else:
        dp[A-1] = False
        dp[B-1] = False
ans = 0
for i in dp:
    if i:
        ans += 1
print(ans)

# ------------------------------
ed = time.perf_counter()
print('time:', ed-st, file=sys.stderr)

Buggy submission (verdict: Runtime Error):
import sys
import time
import math
import itertools as it
def inpl():
    return list(map(int, input().split()))
st = time.perf_counter()
# ------------------------------

N, M = inpl()
H = inpl()
dp = [True] * M
for _ in range(M):
    A, B = inpl()
    if H[A-1] > H[B-1]:
        dp[B-1] = False
    elif H[A-1] < H[B-1]:
        dp[A-1] = False
    else:
        dp[A-1] = False
        dp[B-1] = False
ans = 0
for i in dp:
    if i == True:
        ans += 1
print(ans)

# ------------------------------
ed = time.perf_counter()
print('time:', ed-st, file=sys.stderr)
Problem p02623 (python)

Fixed submission:
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
N,M,K = map(int, input().split())
Nnums = list(map(int, input().split()))
Mnums = list(map(int, input().split()))

Nmax=len(Nnums)
Mmax=len(Mnums)
Nsum=0
Ncnt=0

#Nのみの場合に何冊読めるか
for Ni,Nl in enumerate(Nnums):
  Nsum += Nl
  Ncnt = Ni
  if Nsum > K:
    Nsum -= Nl
    Ncnt = Ni-1
    break
    
chkSum = Nsum
chkCnt = Ncnt + 1
AnsCnt = Ncnt + 1

#Mを組み入れて最大数を探す
for Mi,Ml in enumerate(Mnums):
  chkSum += Ml
  chkCnt += 1
  if (chkSum > K):
    flg = 0
    while chkSum > K:
      if Ncnt >= 0:
        chkSum -= Nnums[Ncnt]
        chkCnt -= 1
        Ncnt -= 1
        flg = 1
      else:
        if flg == 0:
          #chkSum -= Ml
          chkCnt -= 1
          #AnsCnt -= 1
        break
  
  if (AnsCnt < chkCnt):
    AnsCnt = chkCnt
  

  
#  if (Ncnt < 0):
  if (chkSum > K):
    break
    
print(AnsCnt)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
N,M,K = map(int, input().split())
Nnums = list(map(int, input().split()))
Mnums = list(map(int, input().split()))

Nmax=len(Nnums)
Mmax=len(Mnums)
Nsum=0
Ncnt=0

#Nのみの場合に何冊読めるか
for Ni,Nl in enumerate(Nnums):
  Nsum += Nl
  Ncnt = Ni
  if Nsum > K:
    Nsum -= Nl
    Ncnt = Ni-1
    break
    
chkSum = Nsum
chkCnt = Ncnt + 1
AnsCnt = Ncnt + 1
  
#Mを組み入れて最大数を探す
for Mi,Ml in enumerate(Mnums):
  chkSum += Ml
  chkCnt += 1
  if (chkSum > K):
    if 
    while chkSum > K:
      if not Ncnt < 0:
        chkSum -= Nnums[Ncnt]
        chkCnt -= 1
        Ncnt -= 1
      elif:
        break
  
  if (AnsCnt < chkCnt):
    AnsCnt = chkCnt
  
  if (Ncnt < 0):
    break

print(AnsCnt)
Problem p02689 (python)

Fixed submission:
N,M =map(int,input().split())
H = list(map(int,input().split()))
ab = [map(int, input().split()) for _ in range(M)]
a, b = map(list, zip(*ab))

cnt = 0
removeList = []

for i in range(len(a)):
  if (H[a[i]-1] > H[b[i]-1]):
    removeList.append(b[i])
  elif (H[a[i]-1] < H[b[i]-1]):
    removeList.append(a[i])
  else:
    removeList.append(a[i])
    removeList.append(b[i])

set(removeList)
print(N - len(set(removeList)))

Buggy submission (verdict: Runtime Error):
N,M =map(int,input().split())
H = list(map(int,input().split()))
ab = [map(int, input().split()) for _ in range(M)]
a, b = map(list, zip(*ab))

cnt = 0

for i in range(N):
  Boolean = True
  # aの中からiへ続く道があるかを全件検索
  for j,k in enumerate(a):
    # aの中にiがあり、その道先の展望台の山が高かったらiは破棄して次へ
    if (i == k and H[i] <= H[b[j] - 1]):
      Boolean = False
      break

  for j,k in enumerate(b):
    # bの中にiがあり、その道先の展望台の山が高かったらiは破棄して次へ
    if (i == k and H[i] <= H[a[j]]):
      Boolean = False
      break
  # abを全件調査してセーフだった場合にcntをあげる
  if(Boolean):
    cnt += 1
print(cnt)
Problem p02570 (python)

Fixed submission:
D, T, S = map(int, input().split(" "))

A = S * T
if A >= D:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
D T S = map(int, input().split(" "))

A = S * T
if A >= D:
    print("Yes")
else:
    print("No")
Problem p02552 (python)

Fixed submission:
x = int(input())

if x == 1:
    print(0)
else:
    print(1)

Buggy submission (verdict: Runtime Error):
if x == 0:
    print(1)
else:
    print(0)
Problem p02701 (python)

Fixed submission:
N = int(input())
L = set({})
for i in range(N):
    L.add(input())
print(len(L))

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
 
bool check(vector<string> A, string S){
     for(string x : A) {
        if(S == x) return false;
    }
    return true;
}

int main(){
    int N, count = 0;
    string S;  
    cin >> N;
    vector<string> A(N);
    for(int i=0;i<N;i++){
        cin >> S;
        if(check(A,S)){
            A.push_back(S);   
            count++;
        }  
    }
    cout << count << endl;
}
Problem p02571 (python)

Fixed submission:
s = input()
t = input()
ans = 10 ** 10
ls = len(s)
lt = len(t)
for i in range(ls - lt + 1):
    cnt = 0
    for j in range(lt):
        if s[i + j] != t[j]:
            cnt += 1
    ans = min(ans, cnt)
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
from sys import stdin
input = stdin.readline

INF = 10**9

s = input()
t = input()
ans = 10**10
ls = len(s)
lt = len(t)
for i in range(ls - lt + 1):
  cnt = 0
  for j in range(lt:
    if (s[i+j] != t[j]): cnt += 1
  ans = min(cnt, ans)
print(ans)
Problem p02598 (python)

Fixed submission:
n,k=map(int,input().split())
A = list(map(int, input().split()))
r = max(A)
l = 0
while l+1<r:
  mid=(l+r)//2
  if sum([(a-1)//mid for a in A])>k:
    l=mid
  else:
    r = mid
print(r)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
A = list(map(int, input().split()))
r = max(A)
l = 0
while l+1<r:
  mid=(l+r)//2
  if sum([a-1]//mid for a in A)>k:
    l=mid
  else:
    r = mid
print(r)
Problem p02829 (python)

Fixed submission:
lst = [1,2,3]
l = [int(input()) for i in range(2)]
lst.remove(l[0])
lst.remove(l[1])
print(lst[0])

Buggy submission (verdict: Runtime Error):
lst = [1,2,3]
a,b=(int(x) for x in input().split())
lst.remove(a)
lst.remove(b)
print(lst)

Buggy submission (verdict: Runtime Error):
lst = [1,2,3]
l = list(map(int, input().split()))
lst.remove(l[0])
lst.remove(l[1])
print(lst)
Problem p02951 (python)

Fixed submission:
a = list(map(int,input().split()))
print(max(0,a[2]-(a[0]-a[1])))

Buggy submission (verdict: Runtime Error):
a = list(map(int.input().split()))
print(max(0,a[2]-(a[0]-a[1])))
Problem p03042 (python)

Fixed submission:
s = input()
n1 = int(s[:2])
n2 = int(s[2:])
if 1 <= n1 <= 12 and 1 <= n2 <= 12:
  print("AMBIGUOUS")
elif (n1 > 12 or n1 == 0) and 1 <= n2 <= 12:
  print("YYMM")
elif (n2 > 12 or n2 == 0) and 1 <= n1 <= 12:
  print("MMYY")
else:
  print("NA")

Buggy submission (verdict: Runtime Error):
s = input()
n1 = int(s[:2])
n2 = int(s[2:])
if 1 <= n1 <= 12 and 1 <= n2 <= 12:
  print("AMBIGUOUS)
elif (n1 > 12 or n1 == 0) and 1 <= n2 <= 12:
  print("YYMM")
elif (n2 > 12 or n2 == 0) and 1 <= n1 <= 12:
  print("MMYY")
else:
  print("NA")
Problem p02552 (python)

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

Buggy submission (verdict: Runtime Error):
print(1-int(input())
Problem p02570 (python)

Fixed submission:
d, t, s = map(int, input().split())

if d/s <= t:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
d, t, s = map(int, inport().split())

if t*s <= d:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
d, t, s = map(int, inport().split())

if t*s <= d:
  print("yes")
else:
  print("No")
Problem p02595 (python)

Fixed submission:
n, d = map(int, input().split())
ans = 0
for i in range(n):
  x, y = map(int, input().split())
  if x**2 + y**2 <= d**2:
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n, d = map(int, input())
ans = 0
for i in range(n):
  x, y = map(int, input())
  if x**2 + y**2 <= d**2:
    ans += 1
print(ans)
Problem p02627 (python)

Fixed submission:
alpha = input()
print('A' if alpha.isupper() else 'a')

Buggy submission (verdict: Runtime Error):
alph = input()
TF = alph.islower()
if TF == true:
  print("a")
else:
  print("A")
Problem p02723 (python)

Fixed submission:
cof = input()
if cof[2] == cof[3] and cof[4] == cof[5]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
cof = input()
if cof[2] == cof[3] & cof[4] == cof[5]:
  print("Yes")
else:
  print("No")
Problem p02729 (python)

Fixed submission:
n, m = map(int, input().split())
ans = n*(n - 1)/2 + m*(m - 1)/2
print(int(ans))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
print(n(n-1)/2 + m(m-1)/2)
Problem p02759 (python)

Fixed submission:
n = int(input())
if n % 2 == 1:
  print(n // 2 + 1)
else:
  print(int(n / 2))

Buggy submission (verdict: Runtime Error):
n = int(input())
if n % 2 = 1:
  print(n // 2 + 1)
else:
  print(n / 2)
Problem p02596 (python)

Fixed submission:
K = int(input())
mod = 7
index = 1
flag = 0

if K % 2 == 0:
  print(-1)
elif K % 5 == 0:
  print(-1)
else:  
  while(index<=K):
      mod=mod%K
      if mod==0:
          print(index)
          flag=1
          break
      mod=mod*10+7
      index+=1
  if flag==0:
      print(-1)

Buggy submission (verdict: Runtime Error):
k = int(input())

if k % 2 == 0:
  print(-1)
elif k % 5 == 0:
  print(-1)
else:
  if k % 7 == 0:
    l = k * 9 / 7
  else:
    l = k * 9
    
  tmp = 1
  for i in range(l):
    tmp = tmp * 10 % l
    if tmp == 1:
      flg == 1
      print(i+1)
      break
  
  if flg != 1
  	print(-1)

Buggy submission (verdict: Runtime Error):
k = int(input())

if k % 2 == 0:
  print(-1)
elif k % 5 == 0:
  print(-1)
else:
  if k % 7 == 0:
    l = k * 9 / 7
  else:
    l = k * 9
    
  tmp = 1
  for i in range(l):
    tmp = tmp * 10 % l
    if tmp == 1:
      print(i+1)
      break
  print(-1)

Buggy submission (verdict: Runtime Error):
k = int(input())

if k % 2 == 0:
  print(-1)
elif k % 5 == 0:
  print(-1)
else:
  if k % 7 == 0:
    l = k * 9 / 7
  else:
    l = k * 9
  
  tmp = 1
  for i in range(l):
    tmp = tmp * 10 % l
    if tmp == 1:
      print(i+1)
      break
Problem p02627 (python)

Fixed submission:
D=input()
if str.isupper(D):
	print("A")
else:
	print("a")

Buggy submission (verdict: Runtime Error):
while True:
	D=input()
	if str.isupper(D):
		print("A")
	else:
		print("a")

Buggy submission (verdict: Runtime Error):
D=input()
	if D.isupper():
		print("A")
	else:
		print("a")

Buggy submission (verdict: Runtime Error):

   D=input()
   
   if str.isupper(D):
       print("A")
   else:
        print("a")
Problem p02659 (python)

Fixed submission:
a,b=input().split()
a=int(a)
b=int("".join(b.split(".")))
print((a*b)//100)

Buggy submission (verdict: Runtime Error):
a,b=input().split();print((int(a)*int(b.strip(".")))//100)
Problem p02726 (python)

Fixed submission:
#そもそもO(N^2)の意識がなかった
#無理やり最短距離を求めようとして数え忘れたパターンがあった
#このパターンはしっかりサンプル見て実験していれば避けれていた
#自分の考察に自信を持つ姿勢はいいけど、詰まったら疑って実験する
n,x,y=map(int,input().split())
ans=[[1000000]*n for i in range(n)]
for i in range(n-1):
    ans[i][i+1]=1
ans[x-1][y-1]=1
for i in range(n-1):
    for j in range(i+1,n):
        ans[i][j]=min(j-i,abs(x-1-i)+1+abs(y-1-j))
_ans=[0]*(n-1)
for i in range(n-1):
    for j in range(i+1,n):
        _ans[ans[i][j]-1]+=1
for i in range(n-1):
    print(_ans[i])

Buggy submission (verdict: Runtime Error):
ans=[[1000000]*n for i in range(n)]
for i in range(n-1):
    for j in range(i+1,n):
        ans[i][j]=min(j-i,abs(x-1-i)+1+abs(y-1-j))
_ans=[0]*(n-1)
for i in range(n-1):
    for j in range(i+1,n):
        _ans[ans[i][j]-1]+=1
for i in range(n-1):
    print(_ans[i])
Problem p02792 (python)

Fixed submission:
n=int(input())
check1=[[i,i,0] for i in range(1,10)]
check2=[[i,j,0] for i in range(1,10) for j in range(i+1,10)]
l=len(check2)
check3=[[check2[i][1],check2[i][0],0] for i in range(l)]

for i in range(1,n+1):
    s=str(i)
    s1=int(s[0])
    s2=int(s[-1])
    if s2!=0:
        if s1==s2:
            check1[s1-1][2]+=1
        elif s1<s2:
            x=[0,8,15,21,26,30,33,35]
            check2[x[s1-1]+(s2-s1-1)][2]+=1
        else:
            x=[0,8,15,21,26,30,33,35]
            check3[x[s2-1]+(s1-s2-1)][2]+=1
cnt=0
for i in range(9):
    cnt+=(check1[i][2])*(check1[i][2])
for i in range(l):
    cnt+=2*(check2[i][2]*check3[i][2])
print(cnt)

Buggy submission (verdict: Runtime Error):
n=int(input())
check=[[0]*9 for i in range(9)]
for i in range(1,n+1):
    s=str(i)
    s1=int(s[0])-1
    s2=int(s[-1])-1
    check[s1][s2]+=1
for i in range(9):
    for j in range(9):
        cnt+=check[i][j]*check[j][i]
print(cnt)
Problem p03003 (python)

Fixed submission:
mod=10**9+7
n,m=map(int,input().split())
s=list(map(int,input().split()))
t=list(map(int,input().split()))
dp=[[0]*(m+1) for i in range(n+1)]
for i in range(n+1):
    dp[i][0]=1
for i in range(m+1):
    dp[0][i]=1
for i in range(n):
    for j in range(m):
        #答え見たらここの添字間違えてただけ…
        #だけど、適当にダブりを引きたくなっただけなので全然方針としてだめ、要復習
        if s[i]==t[j]:
            dp[i+1][j+1]=(dp[i+1][j]+dp[i][j+1])%mod
        else:
            dp[i+1][j+1]=(dp[i+1][j]+dp[i][j+1]-dp[i][j])%mod
print(dp[n][m])

Buggy submission (verdict: Runtime Error):
import numpy
mod=10**9+7
n,m=map(int,input().split())
s=list(map(int,input().split()))
t=list(map(int,input().split()))
dp=[[0]*(m+1) for i in range(n+1)]
for i in range(n+1):
    dp[i][0]=1
for i in range(m+1):
    dp[0][i]=1
for i in range(n):
    for j in range(m):
        #答え見たらここの添字間違えてただけ…
        #だけど、適当にダブりを引きたくなっただけなので全然方針としてだめ、要復習
        if s[i]==t[j]:
            dp[i+1][j+1]=(dp[i+1][j]+dp[i][j+1])%mod
        else:
            dp[i+1][j+1]=(dp[i+1][j]+dp[i][j+1]-dp[i][j])%mod
print(dp[n][m])
#print(numpy.array(dp))
Problem p03013 (python)

Fixed submission:
#フィボナッチ数列か…
#c問題も解けないのか…
#典型問題なんだろうな
#踏めない段の分は除いて考えれば良い
n,m=input().split()
n,m=int(n),int(m)
ax=[1]*(n+1)
for i in range(m):
    ax[int(input())]=0
bx=[1,1]
for i in range(2,n+1):
    if ax[i-1]==1:
        f1=bx[i-1]
    else:
        f1=0
    if ax[i-2]==1:
        f2=bx[i-2]
    else:
        f2=0
    bx.append((f1+f2)%(10**9+7))

print(bx[n])

Buggy submission (verdict: Runtime Error):
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r)*math.factorial(r))

n,m=map(int(i) ,input().split())
a1=[int(input()) for i in range(m)]
a1.append(n+1)
c1=1
a2=0
for i in a1:
    a3=i-1-a2
    c2=0
    for j in range(a3//2+1):
        c2+=combinations_count(a3-j,j)
    c1=(c1*c2)%(1000000007)
    a2=i+1
    if c1==0:
        break



print(c1)

Buggy submission (verdict: Runtime Error):
#フィボナッチ数列か…
#c問題も解けないのか…
#典型問題なんだろうな
#踏めない段の分は除いて考えれば良い
n,m=input().split()
n,m=int(n),int(m)
ax=[int(input()) for i in range(m)]
bx=[1,1]
if ax[0]==1:
    bx[1]=0
for i in range(2,n+1):
    if i in ax:
        bx.append(0)
    else:
        bx.append((bx[i-2]+bx[i-1])%1000000007)
print(bx)

Buggy submission (verdict: Runtime Error):
#一時間以上かかった
#一つだけTLE
#そっから30ぷん

from scipy.special import comb
n,m=[int(i) for i in input().split()]
a1=[int(input()) for i in range(m)]
a1.append(n+1)
c1=1
a2=0
for i in range(m+1):
    a3=a1[i]-1-a2
    c2=0
    for j in range(0,a3//2+1):
        c2+=comb(a3-j,j,exact=True)
    c1=(c1*c2)%(1000000007)
    a2=a1[i]+1
    if c1==0:
        break



print(c1)
Problem p03104 (python)

Fixed submission:
import math
import sys
a,b=map(int,input().split())
if b==0:
    print(0)
    sys.exit()
n=math.floor(math.log2(b))+1
ans=[0]*n
form="0"+str(n)+"b"
sa=format(a,form)
sb=format(b,form)
for i in range(n):
    if i==n-1:
        if (b-a+1)%2==0:
            ans[i]=((b-a+1)//2)%2
        else:
            if sa[i]=="1":
                ans[i]=((b-a+1)//2+1)%2
            else:
                ans[i]=((b-a+1)//2)%2
        break
    if sa[i]=="1" and sb[i]=="0":
        s_compa=sa[:i]+"1"*(n-i)
        cmpa=int(s_compa,2)
        ans[i]=(cmpa-a+1)%2
    elif sa[i]=="0" and sb[i]=="1":
        s_compb=sb[:i]+"1"+"0"*(n-i)
        cmpb=int(s_compb,2)
        ans[i]=(b-cmpb+1)%2
    elif sa[i]=="1" and sb[i]=="1":
        s_compa=sa[:i]+"1"*(n-i)
        cmpa=int(s_compa,2)
        s_compb=sb[:i]+"1"+"0"*(n-i)
        cmpb=int(s_compb,2)
        if cmpa>a:#cmpb<b
            ans[i]=((b-cmpb+1)+(cmpa-a+1))%2
        else:
            ans[i]=(b-a+1)%2
cnt=0
for i in range(n):
    cnt+=(ans[i]*2**(n-i-1))
print(cnt)

Buggy submission (verdict: Runtime Error):
import math
a,b=map(int,input().split())
n=math.floor(math.log2(b))+1
ans=[0]*n
form="0"+str(n)+"b"
sa=format(a,form)
sb=format(b,form)
for i in range(n):
    if i==n-1:
        if (b-a+1)%2==0:
            ans[i]=((b-a+1)//2)%2
        else:
            if sa[i]=="1":
                ans[i]=((b-a+1)//2+1)%2
            else:
                ans[i]=((b-a+1)//2)%2
        break
    if sa[i]=="1" and sb[i]=="0":
        s_compa=sa[:i]+"1"*(n-i)
        cmpa=int(s_compa,2)
        ans[i]=(cmpa-a+1)%2
    elif sa[i]=="0" and sb[i]=="1":
        s_compb=sb[:i]+"1"+"0"*(n-i)
        cmpb=int(s_compb,2)
        ans[i]=(b-cmpb+1)%2
    elif sa[i]=="1" and sb[i]=="1":
        s_compa=sa[:i]+"1"*(n-i)
        cmpa=int(s_compa,2)
        s_compb=sb[:i]+"1"+"0"*(n-i)
        cmpb=int(s_compb,2)
        if cmpa>a:#cmpb<b
            ans[i]=((b-cmpb+1)+(cmpa-a+1))%2
        else:
            ans[i]=(b-a+1)%2
cnt=0
for i in range(n):
    cnt+=(ans[i]*2**(n-i-1))
print(cnt)
Problem p03326 (python)

Fixed submission:
n,m=map(int,input().split())
xyz=[list(map(int,input().split())) for i in range(n)]
ans=[]
for i in [-1,1]:
    for j in [-1,1]:
        for k in [-1,1]:
            ans.append(sum(sorted([i*l[0]+j*l[1]+k*l[2] for l in xyz],reverse=True)[:m]))
print(max(ans))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
print(max([sum(sorted([i*l[0]+j*l[1]+k*l[2] for l in [list(map(int,input().split())) for i in range(n)]],reverse=True)[:m]) for i in [-1,1] for j in [-1,1] for k in [-1,1]]))
Problem p03775 (python)

Fixed submission:
import math
n=int(input())
l=math.floor(math.sqrt(n))
k=math.floor(math.log10(n))+1
#print(k)
#print(math.log10(n))
for i in range(2,l+1):
    if n%i==0:
        a,b=i,n//i
        x=max(math.floor(math.log10(a))+1,math.floor(math.log10(b))+1)
        k=min(x,k)
print(k)

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
l=math.floor(math.sqrt(n))

for i in range(l,1,-1):
    if n%i==0:
        a,b=i,n//i
        k=max(math.floor(math.log10(a))+1,math.floor(math.log10(b))+1)
        break
print(k)

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
l=math.floor(math.sqrt(n))

for i in range(l,1,-1):
    if n%i==0:
        a,b=i,n//i
        x=max(math.floor(math.log10(a))+1,math.floor(math.log10(b))+1)
        break
print(k)