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

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

left=1
right=10**9
while left<right:
  cnt=0
  mid=(left+right)//2
  for i in range(n):
    cnt+=math.ceil(a[i]/mid)-1
  if cnt<=k:
    right=mid
  else:
    left=mid+1
print(left)

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

left=0
right=10**9+1
while left<right:
  cnt=0
  mid=(left+right)//2
  for i in range(n):
    cnt+=math.ceil(a[i]/mid)-1
  if cnt<=k:
    right=mid
  else:
    left=mid+1
print(left)

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

left=0
right=10**9
while left<right:
  cnt=0
  mid=(left+right)//2
  for i in range(n):
    cnt+=math.ceil(a[i]/mid)-1
  if cnt<=k:
    right=mid
  else:
    left=mid+1
print(left)

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

left=0
right=10**9
while left<right:
  cnt=0
  mid=(left+right)//2
  for i in range(n):
    cnt+=a[i]//mid
  if cnt<=k:
    right=mid
  else:
    left=mid+1
print(left)
Problem p02623 (python)

Fixed submission:
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=0

A,B=[0],[0]
for i in range(n):
  A.append(a[i]+A[i])
for i in range(m):
  B.append(b[i]+B[i])

for j in range(n+1):
  K=k-A[j]
  if K<0:
    break
  left=0
  right=m+1
  while left<right:
    mid=(left+right)//2
    if B[mid]>K:
      right=mid
    else:
      left=mid+1
  ans=max(ans,j+left-1)
print(ans)

Buggy submission (verdict: Runtime Error):
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
kotei=k
ans=0
cnt=0

if kotei>=sum(a):
  cnt+=len(a)
else:
  x=kotei
  i=0
  while x>=0:
    x-=a[i]
    i+=1
    cnt+=1
  n=i
  ans=max(ans,cnt-1)

for j in range(n):
  i=0
  x+=a[n-1-j]
  cnt-=1
  while x>=0:
    x-=b[i]
    i+=1
    cnt+=1
  ans=max(ans,cnt-1)
  
print(ans)
Problem p02629 (python)

Fixed submission:
import math
n=a=int(input())
len=0
while a>=1:
  a=math.ceil(a/26)
  a-=1
  len+=1
  n-=26**len
n+=26**len-1
dp=[0]*len

for i in range(len):
  s=26**(len-i-1)
  dp[i]=chr(n//s+ord("a"))
  n-=26**(len-i-1)*(n//s)
print("".join(dp))

Buggy submission (verdict: Runtime Error):
import sys
n = int(input())
dp = ["0"]*12

def main(p):
  count = 0
  m = p
  while (m-1)//26 >= 1:
    m = m//26
    count += 1
  dp[(-1)*count-1] = chr(m + 96)
  p -= 26**count*m
  if count == 0:
    #print(dp)
    a = "".join(dp)
    print(a.replace("0","")
    sys.exit()
  else:
    main(p)
main(n)
Problem p02970 (python)

Fixed submission:
import math
n,d=map(int,input().split())
print(math.ceil(n/(d*2+1)))

Buggy submission (verdict: Runtime Error):
import math
n,d=map(int,input().split())
print(math.ceil(n/(2d+1)))

Buggy submission (verdict: Runtime Error):
import math
n,d=map(int,input().split())
print(math.ceil(n/(2d-1)))
Problem p03013 (python)

Fixed submission:
import sys
input = sys.stdin.readline
n,m = map(int,input().split())
a = [0]*m
#for i in range(m):
 # a[i] = int(input())
a = set([int(input()) for i in range(m)])
dp = [0]*(n+1)
dp[0] = 1
if 1 in a:
  dp[1] = 0
else:
  dp[1] = 1

for j in range(2,n+1):
  dp[j] = (dp[j-1]+dp[j-2])%1000000007
  if j in a:
    dp[j] = 0
print(dp[n])

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
n,m = map(int,input().split())
a = [0]*m
for i in range(m):
  a[i] = int(input())
dp = [0]*(n+1)
dp[0] = 1
if 1 in a:
  dp[1] = 0
else:
  dp[1] = 1

for j in range(2,n+1):
  if j in a:
    dp[j] = 0
  else:
    dp[j] = dp[j-1]+dp[j-2]
  ans = dp[j]
  while ans >= 1000000007:
    ans -= 1000000007
print(ans)
Problem p03075 (python)

Fixed submission:
a,b,c,d,e,k=[int(input()) for i in range(6)]
print("Yay!" if e-a<=k else ":(")

Buggy submission (verdict: Runtime Error):
a,b,c,d,e,k=[int(input()) for i in range(5)]
print(e-a if e-a<=k else ":(")
Problem p03317 (python)

Fixed submission:
import math
n,k=map(int,input().split())
a=list(map(int,input().split()))
ans=math.ceil((n-1)/(k-1))
print(ans)

Buggy submission (verdict: Runtime Error):
8 2
7 3 1 8 4 6 2 5
Problem p03804 (python)

Fixed submission:
n,m=map(int,input().split())
a=[input() for i in range(n)]
b=[input() for i in range(m)]
ans="No"
for i in range(n-m+1):
  for j in range(n-m+1):
    if [line[j:j+m] for line in a[i:i+m]]==b:
      ans="Yes"
      break
  if ans=="Yes":
    break
print(ans)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[input() for i in range(n)]
b=[input() for i in range(m)]
ans="No"
for i in range(n-m+1):
  for j in range(n-m+1):
    if [line[j:j+m] for line in a[i:i+m]]==B:
      ans="Yes"
      break
  if ans=="Yes":
    break
print(ans)
Problem p03835 (python)

Fixed submission:
k,s=map(int,input().split())
ans=0
for i in range(k+1):
  for j in range(k+1):
    if 0<=s-i-j<=k:
      ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
k,s=map(int,input().split())
ans=0
for i in range(k+1):
  for j in range(k+1-i):
    if s-i-j<=2500
    ans+=1
print(ans)
Problem p02627 (python)

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

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

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

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

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

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

Buggy submission (verdict: Runtime Error):
a = str(input())
if a.isupper() == True:
  print(A)
else:
  print(a)
Problem p02629 (python)

Fixed submission:
N = int(input())
ans = ''
for i in range(1, 99):
    if N <= 26 ** i:
        N -= 1
        for j in range(i):
            ans += chr(ord('a') + N % 26)
            N //= 26
        break
    else:
        N -= 26 ** i
print(ans[::-1])

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = [0 for i in range(10)]
for i in range(10):
    if n < 26**(9-i):
        if i == 9:
            ans[i] = n
        continue
    else:
        s = n // 26**(9-i)
        n = n % 26**(9-i)
        ans[i] = s
al = "abcdefghijklmnopqrstuvwxyz"
answer = ""
for i in ans:
    if i == 0:
        continue
    answer += al[i-1]
print(answer)
Problem p02659 (python)

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

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

Buggy submission (verdict: Runtime Error):
import itertools
import copy
from collections import deque
import heapq
ab = input().split()
A = int(ab[0])
B = int(float(ab)*100)
ans = (A*B)//100
print(ans)
Problem p02688 (python)

Fixed submission:
n,k = map(int,input().split())
ans = [i for i in range(1,n+1)]
for i in range(k):
    d = int(input())
    a = list(map(int,input().split()))
    for j in a:
        if j in ans:
            ans.remove(j)
print(len(ans))

Buggy submission (verdict: Runtime Error):
import Foundation
 
let nk = readLine()!.split(separator:" ").map{Int($0)!}
var sets: Set<Int> = []
for _ in 1...nk[1]{
  let c = readLine()!
  let A = readLine()!.split(separator:" ").map{Int($0)!}
  for i in A{
  sets.insert(i)
  }
}
print(nk[0] - sets.count)
Problem p02699 (python)

Fixed submission:
s,w = map(int,input().split())
if s <= w:
    print("unsafe")
else:
    print("safe")

Buggy submission (verdict: Runtime Error):
s,w = map(int,input())
if s <= w:
    print("unsafe")
else:
    print("safe")
Problem p02711 (python)

Fixed submission:
s = list(input())
if "7" in s:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
s = list(input())
r = []
g = []
b = []
for i,j in enumerate(s):
    if j == "R":
        r.append(i)
    elif j == "G":
        g.append(i)
    else:
        b.append(i)
ans = 0
ss = [len(r),len(g),len(b)]
if max(ss) == len(b):
    for i in r:
        for j in g:
            sa = abs(i-j)
            if sa%2==0:
                p = (i+j)//2
                if p in b:
                    ans-=1
                    ans += len(b)
            if i<j:
                if (i-sa) in b:
                    ans -= 1
                if (j+sa) in b:
                    ans -= 1
            if i>j:
                if (j-sa) in b:
                    ans -= 1
                if (i+sa) in b:
                    ans -= 1
if max(ss) == len(g):
    for i in r:
        for j in b:
            sa = abs(i-j)
            if sa%2==0:
                p = (i+j)//2
                if p in g:
                    ans-=1
                    ans += len(g)
            if i<j:
                if (i-sa) in g:
                    ans -= 1
                if (j+sa) in g:
                    ans -= 1
            if i>j:
                if (j-sa) in g:
                    ans -= 1
                if (i+sa) in g:
                    ans -= 1
if max(ss) == len(r):
    for i in b:
        for j in g:
            sa = abs(i-j)
            if sa%2==0:
                p = (i+j)//2
                if p in r:
                    ans-=1
                    ans += len(r)
            if i<j:
                if (i-sa) in r:
                    ans -= 1
                if (j+sa) in r:
                    ans -= 1
            if i>j:
                if (j-sa) in r:
                    ans -= 1
                if (i+sa) in r:
                    ans -= 1

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = list(input())
r = []
g = []
b = []
for i,j in enumerate(s):
    if j == "R":
        r.append(i)
    elif j == "G":
        g.append(i)
    else:
        b.append(i)
ans = 0
for i in r:
    for j in g:
        for k in b:
            a=[i,j,k]
            a.sort()
            if a[2]-a[1] != a[1]-a[0]:
                ans+=1
print(ans)
Problem p02729 (python)

Fixed submission:
n = list(map(int,input().split()))
ans = 0
if n[0]>=2:
    ans += n[0]*(n[0]-1)//2
if n[1]>=2:
    ans += n[1]*(n[1]-1)//2
print(ans)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
n = int(input())
s = list(map(int,input().split()))
ans = {}
#各番号がいくつずつあるのかを整理
#keyに番号、valueにその番号が書かれてあるボールの数
for i in range(n):
    if not s[i] in ans.keys():
        ans[s[i]] = 1
    else:
        ans[s[i]] += 1
#iC2の総和
answer = 0
for i in ans.values():
    answer += i*(i-1)//2
#answer-nC2+(n-1)C2 = answer-n+1
#nはans[s[i]],よって以下の出力で求められる
for i in range(n):
    print(answer-ans[s[i]]+1)
Problem p02757 (python)

Fixed submission:
from collections import defaultdict
n,p = map(int,input().split())
s = list(map(int,list(input())))[::-1]
ans = 0
if p == 2 or p == 5:
    for i in range(n):
        if s[i]%p==0:
            ans += n-i
    print(ans)
else:
    d = defaultdict(int)
    check = 0
    ten = 1
    for i in range(n):
        check += s[i]*ten
        check %= p
        ans += d[check]
        if check == 0:
            ans+=1
        d[check] += 1
        ten *= 10
        ten %= p
    print(ans)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
n,p = map(int,input().split())
s = list(map(int,list(input())))[::-1]
ans = 0
if p == 2 or p == 5:
    for i in range(n):
        if s[i]%p==0:
            ans += n-i
    print(ans)
else:
    d = defaultdict(int)
    check = 0
    for i in range(n):
        check += s[i]*10**i
        check %= p
        ans += d[check]
        if check == 0:
            ans+=1
        d[check] += 1
        ten += 1
    print(ans)
Problem p02695 (python)

Fixed submission:
from itertools import combinations_with_replacement
def solve():
    n, m, q = map(int, input().split())
    l = [list(map(int, input().split())) for _ in range(q)]

    com = [int(x) for x in range(1, m+1)]
    ans = 0
    for i in combinations_with_replacement(com, n-1):
        cur = list(i)
        A = [1] + cur
        tot = 0
        for k in range(q):
            a, b, c, d = l[k]
            if A[b-1] - A[a-1] == c:
                tot += d
        ans = max(ans, tot)
    
    return ans


print(solve())

Buggy submission (verdict: Runtime Error):
import math
def solve():
    n, m, q = map(int, input().split())
    l = [list(map(int, input().split())) for _ in range(q)]

    ans = 0
    for i in range(2**(n-2)):
        cur = []
        for j in range(n-2):
            if (i>>j)&1:
                cur.append(i+1)
        A = [1] + cur + [n, m]
        print(A)
        tot = 0
        for k in range(q):
            a, b, c, d = l[k]
            if b+1 <= n and A[b] - A[a] == c:
                print(A[0], A[a])
                tot += d
        ans = max(ans, tot)
    
    return ans


print(solve())
Problem p02711 (python)

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

ans = 'No'
for i in range(len(n)):
  if n[i] == 7:
    ans = 'Yes'
    
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = tuple(input())

cnt = 0
w = {'R', 'G', 'B'}

for i in range(n-2):
  for j in range(i+1, n-1):
    for k in range(j+1, n):
        if {s[i], s[j], s[k]} == w and j-i != k-j:
          cnt += 1
      
print(cnt)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = list(input())

cnt = 0
for i in range(n):
  for j in range(i+1, n):
    for k in range(j+1, n):
      if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
        if j-i != k-j:
          cnt += 1
print(cnt)
Problem p02753 (python)

Fixed submission:
s = list(input())

if s[0] == s[1] and s[1] == s[2]:
  print('No')
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
s = list(input().split())

if s[0] == s[1] and s[1] == s[2]:
  print('No')
else:
  print('Yes')
Problem p02954 (python)

Fixed submission:
S = input()
 
def solve(S):
    buf = [1] * len(S)
 
    for i in range(len(buf) - 2):
        if S[i] == "R" and S[i+1] == "R":
            buf[i+2] += buf[i]
            buf[i] = 0
 
    for i in range(len(buf) - 1, 1, -1):
        if S[i] == "L" and S[i-1] == "L":
            buf[i-2] += buf[i]
            buf[i] = 0
 
    return " ".join(map(str, buf))
 
print(solve(S))

Buggy submission (verdict: Runtime Error):
def encode(message): 
    encoded_message = "" 
    i = 0
   
    while (i <= len(message)-1): 
        count = 1
        ch = message[i] 
        j = i 
        while (j < len(message)-1): 
            if (message[j] == message[j+1]): 
                count = count+1
                j = j+1
            else: 
                break
        encoded_message=encoded_message+str(count)+ch 
        i = j+1
    return encoded_message 

def solve():
    s = input()
    t = encode(s).split('L')

    ans = []
    for i in range(len(t)-1):
        l = t[i]
        if (int(l[0])-int(l[2]))%2 == 1:
            x = (int(l[0])+int(l[2]))//2
            if int(l[0])%2 == 0:
                ans = ans + ['0']*(int(l[0])-1) + [str(x)] + [str(x+1)] + ['0']*(int(l[2])-1)
            else:
                ans = ans + ['0']*(int(l[0])-1) + [str(x+1)] + [str(x)] + ['0']*(int(l[2])-1)
        elif (int(l[2])-int(l[0]))%2 == 1:
            x = (int(l[0])+int(l[2]))//2
            if int(l[2])%2 == 0:
                ans = ans + ['0']*(int(l[0])-1) + [str(x)] + [str(x+1)] + ['0']*(int(l[2])-1)
            else:
                ans = ans + ['0']*(int(l[0])-1) + [str(x+1)] + [str(x)] + ['0']*(int(l[2])-1)
        else:
            x = (int(l[0])+int(l[2]))//2
            ans = ans + ['0']*(int(l[0])-1) + [str(x)]*2 + ['0']*(int(l[2])-1)
        

    return ' '.join(ans)

print(solve())

Buggy submission (verdict: Runtime Error):
def encode(message): 
    encoded_message = "" 
    i = 0
   
    while (i <= len(message)-1): 
        count = 1
        ch = message[i] 
        j = i 
        while (j < len(message)-1): 
            if (message[j] == message[j+1]): 
                count = count+1
                j = j+1
            else: 
                break
        encoded_message=encoded_message+str(count)+ch 
        i = j+1
    return encoded_message 

def solve():
    s = input()
    t = encode(s).split('L')

    ans = []
    for i in range(len(t)-1):
        l = t[i]
        if int(l[0])-int(l[2]) == 1:
            if int(l[0])%2 == 0:
                ans = ans + ['0']*(int(l[0])-1) + [l[2]] + [l[0]] + ['0']*(int(l[2])-1)
            else:
                ans = ans + ['0']*(int(l[0])-1) + [l[0]] + [l[2]] + ['0']*(int(l[2])-1)
        elif int(l[2])-int(l[0]) == 1:
            if int(l[2])%2 == 0:
                ans = ans + ['0']*(int(l[0])-1) + [l[2]] + [l[0]] + ['0']*(int(l[2])-1)
            else:
                ans = ans + ['0']*(int(l[0])-1) + [l[0]] + [l[2]] + ['0']*(int(l[2])-1)
        else:
            x = (int(l[0])+int(l[2]))//2
            ans = ans + ['0']*(int(l[0])-1) + [str(x)]*2 + ['0']*(int(l[2])-1)
        

    return ' '.join(ans)

print(solve())
Problem p03013 (python)

Fixed submission:
def Fib(n):
    a, b = 0, 1
    if n == 1:
        return a
    elif n == 2:
        return b
    else:
        for i in range(n-2):
            a, b = b, a + b
        return b

def solve():
    n, m = map(int, input().split())
    a = [int(input()) for _ in range(m)]

    if m > 1:
        for i in range(m-1):
            if a[i+1]-a[i] <= 1:
                return 0
    elif m == 0:
        return Fib(n+2)%1000000007

    
    a = a + [n]
    l = [a[0]]
    for i in range(1, m):
        l.append(a[i]-a[i-1]-1)
    l = l + [a[-1]-a[-2]]
    ans = 1
    for i in l:
        ans *= Fib(i+1)

    return ans%1000000007


print(solve())

Buggy submission (verdict: Runtime Error):
def Fib(n):
    a, b = 0, 1
    if n == 1:
        return a
    elif n == 2:
        return b
    else:
        for i in range(n-2):
            a, b = b, a + b
        return b

def solve():
    n, m = map(int, input().split())
    a = [int(input()) for _ in range(m)]

    if len(a) > 1:
        for i in range(m-1):
            if a[i+1]-a[i] <= 1:
                return 0
    
    a = a + [n]
    l = [a[0]]
    for i in range(1, m):
        l.append(a[i]-a[i-1]-1)
    l = l + [a[-1]-a[-2]]
    ans = 1
    for i in l:
        ans *= Fib(i+1)

    return ans%1000000007


print(solve())
Problem p03137 (python)

Fixed submission:
#!/usr/bin/env python3
n, m, *x = map(int, open(0).read().split())
x.sort()
print(sum(sorted(j - i for i, j in zip(x, x[1:]))[-n::-1]))

Buggy submission (verdict: Runtime Error):
def solve():
    n, m = map(int, input().split())
    x = list(map(int, input().split()))

    x.sort()
    dx = [(i, x[i+1]-x[i]) for i in range(m-1)]
    dx.sort(key = lambda x: x[1], reverse = True)
    d = [0] + [dx[i][0] for i in range(n)] + [m-1]
    d.sort()

    ans = []
    for i in range(n+1):
        ans.append(x[d[i+1]] - x[d[i]])
    ans.sort()

    return sum(ans[:n])


print(solve())
Problem p03785 (python)

Fixed submission:
n, c, k = map(int, input().split())
T = [int(input()) for _ in range(n)]
T.sort()
cnt = 0
ans = 1
t = T[0]
for i in range(n):
    cnt += 1
    if cnt > c or T[i] > t + k:
        ans += 1
        cnt = 1
        t = T[i]
print(ans)

Buggy submission (verdict: Runtime Error):
import copy

n, c, k = map(int, input().split())
t = [int(i) for i in range(n)]

t.sort()
s = copy.copy(t)
ans = 0
for i in range(n):
  cnt = 1
  for j in range(i+1, n):
    if t[j] - t[i] <= k:
      cnt += 1
      t.remove(t[j])
      if cnt == c:
        ans += 1
        break
    else:
      ans += 1
      break
      
print(ans)
Problem p02594 (python)

Fixed submission:
a = int(input())
if a >= 30:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
import math
i = 1
z = 0
t = 0
n, d = map(int, input().split())
while i <= n:
    i += 1
    a, b = map(int, input().split())
    if math.sqrt(a**2 + b**2) <= d:
        t += 1

print(t)

Buggy submission (verdict: Runtime Error):
import math
i = 1
z = 0
t = 0
n, d = map(int, input().split())
while i <= n:
    i += 1
    a, b = map(int, input().split())
    if math.sqrt(a**2 + b**2) <= d:
        t += 1

print(t)
Problem p02577 (python)

Fixed submission:
strList = list(input())
intList = [int(s) for s in strList]
if sum(intList)%9 == 0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
strList = list(input())
intList = [int(s) for s in strList]
if sum(intList)%9 == 0:
  print(Yes)
else:
  print(No)

Buggy submission (verdict: Runtime Error):
strList = input()
intList = [int(s) for s in strList]
if sum(intList)%9 == 0:
  print(Yes)
else:
  print(No)

Buggy submission (verdict: Runtime Error):
strList = input()
intList = [int(s) for s in strList]
sum = sum(intList)
if sum%9 == 0:
  print(Yes)
else:
  print(No)
Problem p02833 (python)

Fixed submission:
n = int(input())
if n % 2 == 1:
    print(0)
else:
    print(sum(n // (2 * 5 ** d) for d in range(1, 25 + 1)))

Buggy submission (verdict: Runtime Error):
n = int(input())
if n mod 2 == 0 or n < 10:
    print(0)
else:
    k = n // 5
    print(k * (k + 1) / 2)
Problem p03315 (python)

Fixed submission:
s = raw_input()
print (s.count("+") - s.count("-"))

Buggy submission (verdict: Runtime Error):
s = raw_input()
print (s.count("+") - s.count("-"))
Problem p02547 (python)

Fixed submission:
N = int(input())
count = 0
for i in range(N):
  a,b = map(int,input().split())
  if a == b:
    count+=1
    if count == 3:
      print("Yes")
      break
  else:
    count = 0
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
count = 0
for i in range(N):
  a,b = map(int,input().sprit())
  if a == b:
    count+=1
    if count = 3:
      print("Yes")
      break
  else:
    count = 0
print("No")
Problem p02550 (python)

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

d = {X:0}
l = [X]
s = X

for i in range(1,N):
  l+=[(l[i-1]**2)%M]
  s += l[i]
  if l[i] in d:
    dl = l[d[l[i]]+1:]
    s += sum(dl)*((N-i-1)//len(dl))
    if (N-i-1)%len(dl) != 0:
      s += sum(dl[0:(N-i-1)%len(dl)])
    break
  d[l[i]] = i
print(s)

Buggy submission (verdict: Runtime Error):
N,X,M = map(int,input().split())

d = {X:0}
l = [X]

for i in range(1,N):
  l+=[(l[i-1]**2)%M]
  if l[i] in d:
    dl = l[d[l[i]]+1:]
    print(dl)
    l += dl*((N-i-1)//len(dl))
    if (N-i-1)%len(dl) != 0:
      l += dl[0:(N-i-1)%len(dl)]
    break
  d[l[i]] = i
print(l)
print(sum(l))
Problem p02766 (python)

Fixed submission:
n,k=map(int,input().split())
        
count=1
 
while n//k>0:
  n=n//k
  count+=1
  
print(count)

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

count=0

while n//k>0:
  n//k
  count+=1
Problem p03775 (python)

Fixed submission:
import math

N = int(input())

def f(a,b):
    if len(str(a)) < len(str(b)):
        return len(str(b))
    else:
        return len(str(a))

ans = 100000000000
for i in range(1,int(math.sqrt(N)+1)):
    if N % i == 0:
        ans = min(ans,f(i,N//i))
print(ans)

Buggy submission (verdict: Runtime Error):
import math

N = int(input())

def f(a,b):
    if len(str(a)) < len(str(b)):
        return len(str(b))
    else:
        return len(str(a))

ans = 100000000000
for i in range(1,math.sqrt(N)+1):
    if N % i == 0:
        ans = min(ans,f(i,N//i))
print(ans)

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

def f(a,b):
    if len(str(a)) < len(str(b)):
        return len(str(b))
    else:
        return len(str(a))

ans = 100000000000
for i in range(1,N**(1/2)):
    if N % i == 0:
        ans = min(ans,f(i,N//i))
print(ans)
Problem p02829 (python)

Fixed submission:
a = int(input())
b = int(input())
n = 6 - a - b
print(n)

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