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

Fixed submission:
import sys
sys.setrecursionlimit(1000000)  # RecursionError対策

def fibonacci(n):
    if n == 0:
        return 0 # F0
    elif n == 1:
        return 1 # F1
    return fibonacci_sub2(n-2, 1, 0) #F2以降

def fibonacci_sub2(n, fibo_minus1, fibo_minus2):
    return fibo_minus1 if n==0 else fibonacci_sub2(n-1, fibo_minus1+fibo_minus2, fibo_minus1)

N,M = map(int,input().split())
a = [int(input()) for i in range(M)]
a.append(N+1)
anser = 1
start = 0
for i in range(M+1):
    Bre = a.pop(0)
    if Bre == start:
        anser = 0
        break
    anser = anser * fibonacci(Bre - start + 1)
    start = Bre + 1

print(anser % 1000000007)

Buggy submission (verdict: Runtime Error):
def fibonacci(n):
    if n == 0:
        return 0 # F0
    elif n == 1:
        return 1 # F1
    return fibonacci_sub2(n-2, 1, 0) #F2以降

def fibonacci_sub2(n, fibo_minus1, fibo_minus2):
    return fibo_minus1 if n==0 else fibonacci_sub2(n-1, fibo_minus1+fibo_minus2, fibo_minus1)

N,M = map(int,input().split())
a = [int(input()) for i in range(M)]
a.append(N+1)
anser = 1
start = 0
for i in range(M+1):
    Bre = a.pop(0)
    if Bre == start:
        anser = 0
        break
    anser = anser * fibonacci(Bre - start + 1)
    start = Bre + 1

print(anser % 1000000007)
Problem p03036 (python)

Fixed submission:
s = input().split()
r = int(s[0])
D = int(s[1])
x = int(s[2])

for i in range(10):
    x = r * x - D
    print(int(x))

Buggy submission (verdict: Runtime Error):
s = input.split()
r = int(s[0])
D = int(s[1])
x = int(s[2])

for i in range(10):
    x = r * x - D
    print(x)

Buggy submission (verdict: Runtime Error):
r = int(input())
D = int(input())
x = int(input())

for i in range(10):
    x = r * x - D
    print(x)
Problem p02711 (python)

Fixed submission:
#ABC162A
import sys
N = sys.stdin.readline().rstrip()
 
if '7' in N:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
#ABC162A
import sys
N = sys.stdin.readline().rstrip()

if '7' in N:
    print('Yes')
else:
    print('No')

#ABC162B
import sys
N = int(sys.stdin.readline())
total=0
for i in range(1, N+1):
    if i%3 !=0 and i%5 !=0:
        total+=i
    
print(total)
Problem p02777 (python)

Fixed submission:
#ABC154A
import sys
from collections import OrderedDict
d = OrderedDict()
s,t = sys.stdin.readline().split()
n1, n2 = map(int, sys.stdin.readline().split())
d[s] = n1
d[t] = n2

d[sys.stdin.readline().rstrip()] -=1

print(*d.values())

Buggy submission (verdict: Runtime Error):
#ABC154A
import sys
from collections import OrderedDict
d = OrderedDict()
s,t = sys.stdin.readline().split()
n1, n2 = map(int, sys.stdin.readline().split())
d[s] = n1
d[t] = n2

d[sys.stdin.readline()] -=1

print(*d.values())
Problem p02832 (python)

Fixed submission:
import sys

n = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))
cnt=0
i=1
for a in A:
    if a ==i:
        i+=1
 
ans =n-i+1
if ans ==n:
    print(-1)
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
import sys

n = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))
cnt=0
while True:
    for i, a in enumerate(A):
        if a > i+1:
            A.pop(i)
            cnt+=1
        if A[i] != i+1:
            A.pop(i)
            cnt+=1
            break
    else:
        break

if len(A)==0:
    print(-1)
else:
    print(cnt)
Problem p02862 (python)

Fixed submission:
#ABC145D
def main():
    import sys, math
    X, Y = map(int, sys.stdin.readline().split())
    '''
    i +2*j ==X
    2*i +j ==Y
    '''
    if (2*Y-X)%3==0:
        i = (2*Y-X)//3
        j = Y-2*i
    else:
        i,j=0,0
    #print(i, j)
    mod = 10**9+7
    def calc(n):
        ans = 1
        for i in range(n, 1, -1):
            ans *= i
            ans %= mod
        return ans
    
    ans = calc(i+j)
    #print(calc(-1))
    #print(ans)
    
    #calc2(calc(i), mod-2)
    gg1 = pow(calc(i), mod-2, mod)
    gg2 = pow(calc(j), mod-2, mod)
    
    if i<0 or j<0:
        print(0)
    elif i==0 and j==0:
        print(0)
    else:
        print(ans*gg1*gg2%mod)

if __name__=='__main__':
    main()

Buggy submission (verdict: Runtime Error):
#ABC145D
def main():
    import sys, math
    X, Y = map(int, sys.stdin.readline().split())
    '''
    i +2*j ==X
    2*i +j ==Y
    '''
    if (2*Y-X)%3==0:
        i = (2*Y-X)//3
        j = Y-2*i
    else:
        ans =0
    #print(i, j)
    mod = 10**9+7
    def calc(n):
        ans = 1
        for i in range(n, 1, -1):
            ans *= i
            ans %= mod
        return ans
    
    ans = calc(i+j)
    #print(calc(-1))
    #print(ans)
    
    #calc2(calc(i), mod-2)
    gg1 = pow(calc(i), mod-2, mod)
    gg2 = pow(calc(j), mod-2, mod)
    
    if i<0 or j<0:
        print(0)
    elif i==0 and j==0:
        print(0)
    else:
        print(ans*gg1*gg2%mod)

if __name__=='__main__':
    main()
Problem p02897 (python)

Fixed submission:
import sys

n = int(sys.stdin.readline())
odd =0
for i in range(1, n+1):
    if i %2 ==1:
        odd +=1
print(odd/n)

Buggy submission (verdict: Runtime Error):
import sys
from collections import deque
A, B = map(int, sys.stdin.readline().split())

a, b = deque([]), deque([])
for i in range(A, 0, -1):
    if A%i ==0:
        a.append(i)
    
for i in range(B, 0, -1):
    if B%i ==0:
        b.append(i)

a,b = set(a), set(b)
L = a&b
#print(L)
cnt =0
for l in L:
    tmp = 0
    for i in range(l-1, 1, -1):
        if l%i==0:
            tmp +=1
            break
    if tmp ==0:
        cnt+=1
print(cnt)
Problem p02915 (python)

Fixed submission:
import sys
import itertools
n = int(sys.stdin.readline())
L = [i for i in range(1,n+1)]
a = list(itertools.product(L, repeat=3))
print(len(a))

Buggy submission (verdict: Runtime Error):
import sys
n, k = map(int, sys.stdin.readline().split())
S = sys.stdin.readline()

score = 0
for i in range(len(S)-1):
    if S[i]==S[i+1]:
        score+=1
#print(S)
idx = []
for i in range(n):
    if S[i] == 'R':
        idx.append(i)
idx.append(-10)

s =-1
e =-1
ten = []
for i in range(len(idx)-1):
    if s ==-1:
        s = idx[i]
    if idx[i]+1 != idx[i+1]:
        e = idx[i]
        if e-s == n-1:
            pass
        elif s ==-1 or e==-1:
            pass
        elif s ==0 or e ==n-1:
            ten.append(1)
        else:
            ten.append(2)
        s =-1
ten = sorted(ten, reverse=True)
#print(score, ten)
print(score+ sum(ten[0:k]))
Problem p02948 (python)

Fixed submission:
import sys
from collections import defaultdict
import heapq
input = sys.stdin.readline
n, limit = map(int, input().split())
dic = defaultdict(list)

for _ in range(n):
    a, b = map(int, input().split())
    dic[a].append(b)

L = []
ans = 0
for i in range(limit+1):
    for val in dic[i]:
        heapq.heappush(L, -val)
    if len(L):
        ans -= heapq.heappop(L)
print(ans)

Buggy submission (verdict: Runtime Error):
#137D
def main():
    import sys
    import heapq as h
    from collections import defaultdict
    N, M = map(int, sys.stdin.readline().split())
    L = tuple([tuple(map(int, sys.stdin.readline().split())) for _ in range(N)])
    #print(L)
    D = defaultdict(list)
    for i in range(N):
        D[L[i][0]-1].append(-L[i][1])
    
    #print(D)
    ans = 0
    tmp=[]
    h.heapify(tmp)
    for d in range(M):
        for b in D[d]:
            h.heappush(tmp, b)
        #print(tmp)
        ans += h.heappop(tmp)
        
    print(-ans)



if __name__=='__main__':
    main()
Problem p02951 (python)

Fixed submission:
import sys
input = sys.stdin.readline
limit, nowl, addl = map(int, input().split())
print(max(0, nowl+addl-limit))

Buggy submission (verdict: Runtime Error):
import sys
from collections import deque
input = sys.stdin.readline
n = int(input())
hL = list(map(int, input().split()))
flag = 'Yes'
for i in range(n-1):
    for j in range(i+1, n) :
        if hL[i] -hL[j]>=2:
            flag = 'No'
            break
    if flag =='No':
        break
print(flag)
Problem p02873 (python)

Fixed submission:
def do_left(s, v, idx):
  while idx > 0 and s[idx] == '>':
    v[idx - 1] = max(v[idx] + 1, v[idx - 1])
    idx -= 1

def do_right(s, v, idx):
  while idx < len(v) - 1 and s[idx + 1] == '<':
    v[idx + 1] = max(v[idx] + 1, v[idx + 1])
    idx += 1
    
def main():
  s = '>' + input().strip() + '<'
  v = [-1] * (len(s) - 1)
  
  for i, (b, a) in enumerate(zip(s[:-1], s[1:])):
    if b == '>' and a == '<':
      v[i] = 0
      do_left(s, v, i)
      do_right(s, v, i)

  #print(v)
  print(sum(v))
  
if __name__ == '__main__':
  main()

Buggy submission (verdict: Runtime Error):
def flood(s, v, idx, val):
  v[idx] = max(val, v[idx])
  
  if idx < len(v) - 1 and s[idx + 1] == '<':
    flood(s, v, idx + 1, val + 1)
  if idx > 0 and s[idx] == '>':
    flood(s, v, idx - 1, val + 1)

def main():
  s = '>' + input().strip() + '<'
  v = [-1] * (len(s) - 1)
  
  for i, (b, a) in enumerate(zip(s[:-1], s[1:])):
    if b == '>' and a == '<':
      flood(s, v, i, 0)

  #print(v)
  print(sum(v))
  
if __name__ == '__main__':
  main()
Problem p03055 (python)

Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import collections


class Node(object):

  def __init__(self):
    self.edges = set()
    self.distance = 1


def main():
  N = int(input())
  nodes = [Node() for _ in range(N)]

  if N == 0:
    print('Second', flush=True)
    return
  elif N == 1:
    print('First', flush=True)
    return

  for _ in range(N - 1):
    a, b = map(int, input().split())
    nodes[a - 1].edges.add(nodes[b - 1])
    nodes[b - 1].edges.add(nodes[a - 1])

  leaves = collections.deque(n for n in nodes if len(n.edges) == 1)

  while True:
    leaf = leaves.popleft()
    parent = leaf.edges.pop()

    if len(parent.edges) == 1:
      size = leaf.distance + parent.distance
      break

    parent.distance = max(parent.distance, leaf.distance + 1)
    parent.edges.remove(leaf)

    if len(parent.edges) == 1:
      leaves.append(parent)

  if size % 3 == 2:
    print('Second', flush=True)
  else:
    print('First', flush=True)


if __name__ == '__main__':
  main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-


class Node(object):

  def __init__(self):
    self.edges = []
    self.distance = 1


def main():
  N = int(input())
  nodes = [Node() for _ in range(N)]

  for _ in range(N - 1):
    a, b = map(int, input().split())
    nodes[a - 1].edges.append(nodes[b - 1])
    nodes[b - 1].edges.append(nodes[a - 1])

  leaves = [n for n in nodes if len(n.edges) == 1]

  while True:
    leaf = leaves.pop(0)
    parent = leaf.edges[0]

    if len(parent.edges) == 1:
      size = leaf.distance + parent.distance
      break

    parent.distance = max(parent.distance, leaf.distance + 1)
    parent.edges.remove(leaf)

    if len(parent.edges) == 1:
      leaves.append(parent)

  if size % 3 == 2:
    print('Second', flush=True)
  else:
    print('First', flush=True)


if __name__ == '__main__':
  main()
Problem p02847 (python)

Fixed submission:
a = input()


if  a  == "TUE":
  print(5)
elif a  == "WED":
  print(4)
elif a  == "THU":
  print(3)
elif a  == "FRI":
  print(2)
elif a  == "SAT":
  print(1)
elif a  == "SUN":
  print(7)
else:
  print(6)

Buggy submission (verdict: Runtime Error):
a = input()


if  a  == "TUE":
  print(5)
elif a  == "WED":
  print(4)
elif a  == "THU":
  print(3)
elif a  == "FRI":
  print(2)
elif a  == "SAT":
  print(1)
elif a  == "SUN":
  print(0)
else a  == "MON":
  print(6)

Buggy submission (verdict: Runtime Error):
a = input()

if a == "SUN":
  print(0)
elif a  == "MON":
  print(6)
elif a  == "TUE":
  print(5)
elif a  == "WED":
  print(4)
elif a  == "THU":
  print(3)
elif a  == "FRI":
  print(2)
else a  == "sat":
  print(1)
Problem p02859 (python)

Fixed submission:
import sys

sys.setrecursionlimit(500005)
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip() 

r = ni()
print(r*r)

Buggy submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(500005)
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip() 

r = list(input())
print(r*r)
Problem p02879 (python)

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

print(a[0]*a[1] if a[0] <= 9 and a[1] <= 9 else -1)

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

f = 0
for i in range(1,10):
  for j in range(1,10):
    if i*j == N:
      f = 1
      break
  if f == 1:
    break
if f == 0:
  print("NO")
else:
  print("YES")

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

print(a[0]*a[1] if a[0],a[1]<=9 else -1)
Problem p03041 (python)

Fixed submission:
n, k = map(int, input().split())
s = input()
tmp = ord(s[k-1])
tmp1 = (chr(tmp+32))
ans = []

for i in range(len(s)):
    if i == k-1:
        ans.append(tmp1)
    else:
        ans.append(s[i])

print("".join(map(str, ans)))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
s = input()
tmp = ord(s[k])
tmp1 = (chr(tmp+32))
ans = []

for i in range(len(s)):
    if i == k:
        ans.append(tmp1)
    else:
        ans.append(s[i])

print("".join(map(str, ans)))
Problem p03042 (python)

Fixed submission:
S = input()
s01 = int(S[0]+S[1])
s23 = int(S[2]+S[3])
if (0 < s01 and s01 <= 12) and (0 < s23 and s23 <= 12):
    print('AMBIGUOUS')

elif (0 < s01 and s01 <= 12) and (s23 > 12 or s23 == 0):
    print('MMYY')

elif (s01 > 12 or s01 == 0) and (0 < s23 and s23 <= 12):
    print('YYMM')
else:
    print('NA')

Buggy submission (verdict: Runtime Error):
S = input()
s01 = int(S[0]+S[1])
s23 = int(S[2]+S[3])
if (0 < s01 and s01 <= 12) and (0 < s23 and s23 <= 12):
    print('AMBIGUOUS')

elif (0 < s01 and s01 <= 12) and (s23 > 12 or s23 == 0):
    print('MMYY')

elif (s01 > 12 or s12 == 0) and (0 < s23 and s23 <= 12):
    print('YYMM')
else:
    print('NA')
Problem p03265 (python)

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

x3 = x2-y
y3 = y2+x
x4 = x1-y
y4 = y1+x

print(x3, y3, x4, y4)

Buggy submission (verdict: Runtime Error):
x1, y1, x2, y2, = map(int, input().split())
abs_x = abs(x2-x1)
abs_y = abs(y2-y1)


if x1 >= x2 and y2 > y1:
    x3 = x2-abs_x-1
    x4 = x1-abs_x-1
    y3 = y2+abs_y-1
    y4 = y1+abs_y-1

elif x1 >= x2 and y1 > y2:
    x3 = x2-abs_x+1
    x4 = x1-abs_x+1
    y3 = y2+abs_y-1
    y4 = y1+abs_y-1

elif x2 >= x1 and y2 > y1:
    x3 = x2-abs_x+1
    x4 = x1-abs_x+1
    y3 = y2+abs_y+1
    y4 = y1+abs_y+1

elif x2 >= x1 and y1 > y2:
    x3 = x2-abs_x-1
    x4 = x1-abs_x-1
    y3 = y2+abs_y+1
    y4 = y1+abs_y+1
print(x3, y3, x4, y4)
Problem p02831 (python)

Fixed submission:
import fractions

A, B = map(int, input().split())
print((A * B) // fractions.gcd(A, B))

Buggy submission (verdict: Runtime Error):
import math

A, B = map(int, input().split())
print((A * B) // math.gcd(A, B))
Problem p02659 (python)

Fixed submission:
from decimal import Decimal
A,B = map(Decimal,input().split())
print(int(A*B))

Buggy submission (verdict: Runtime Error):
import math
from fractions import Fraction

A, B = map(str,input().split())
#print(A,B)

A = float(A)
B = float(B)

#B = format(B,"f")
#print(A,B)

X = Fraction(A,B)
Y = Fraction(B,A)

Z = X * Y

print(math.floor(Z))
Problem p02693 (python)

Fixed submission:
K = int(input())
A,B = map(int,input().split())
ans = 'NG'
for i in range(A,B+1):
    if i % K == 0:
        ans = 'OK'
        break
print(ans)

Buggy submission (verdict: Runtime Error):
A,B,N = map(int,input().split())
ans = []
if N < 15:
    for x in range(N+1):
        tmp = (A * x // B) - A * (x//B)
        ans.append(tmp)
        #print(tmp)
else:
    for x in range(N-1000,N+1):
        tmp = (A * x // B) - A * (x//B)
        ans.append(tmp)
        #print(tmp)
print(max(ans))
Problem p02711 (python)

Fixed submission:
N = str(input())
if N[0] == '7' or N[1] == '7' or N[2] == '7':
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
if N[0] == '7' or N[1] == '7' or N[2] == '7':
    print('Yes')
else:
    print('No')
Problem p02753 (python)

Fixed submission:
S = str(input())
if S == 'AAA' or S == 'BBB':
    print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split())
ans = -1

for i in range(1,10**4+1):
    if int(i * 0.08) == A and int(i * 0.10) == B:
        ans = i
        break
print(ans)
Problem p02759 (python)

Fixed submission:
N = int(input())
print( -(-N // 2))

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
li=[0]*N
for i in range(M):
    si,ci=map(int,input().split())
    if li[si-1] != 0 and li[si-1] !=ci:
        print(-1)
        exit(0)
    if si==1 and ci==0:
        if N>1:
            print(-1)
            exit(0)
    li[si-1]=ci
if N>1 and li[0]==0:
    li[0]=1
for i in range(N):
    print(li[i],end="")
Problem p02819 (python)

Fixed submission:
import math
X = int(input())
key = 0

def prim(N):
    sqt = int(math.sqrt(N))
    for i in range(2,sqt+1):
        if N%i == 0:
            return False
    return True

while key == 0:
    if prim(X):
        key = 1
        break
    X += 1

print(X)

Buggy submission (verdict: Runtime Error):
import math
from goto import goto, label

X = int(input())
max = 10 ** 5

for i in range(X,max):
    sqt = math.sqrt(i)
    for j in range(1, math.ceil(sqt)):
        cal = i % j
        if cal == 0:
            print(i)
            goto .END
label .END
Problem p02835 (python)

Fixed submission:
A, B, C = map(int, input().split())
if A+B+C > 21:
    print('bust')
else:
    print('win')

Buggy submission (verdict: Runtime Error):
N = int(input())
A = []
XY = []
honest_count = []

for i in range(N):
    a = int(input())
    A.append(a)
    inter = []
    for x in range(a):
        xy = list(map(int,input().split()))
        inter.append(xy)
    XY.append(inter)

for i in range(2**N):
    pt = [0]*N
    ck = 1
    for j in range(N):
        if (i>>j)&1:
            pt[N-j-1]=1
    for k in range(N):
        if pt[k] ==1:
            for l in range(A[k]):
                if XY[k][l][1] != pt[XY[k][l][0] -1]:
                    ck = 0
    if ck == 1:
        honest_count.append(sum(pt))
print(max(honest_count))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = []
XY = []
honest_count = []

for i in range(N):
    a = int(input())
    A.append(a)
    inter = []
    for x in range(a):
        xy = list(map(int,input().split()))
        inter.append(xy)
    XY.append(inter)

for i in range(2**N):
    pt = [0]*N
    ck = 1
    for j in range(N):
        if (i>>j)&1:
            pt[N-j-1]=1
    for k in range(N):
        if pt[k] ==1:
            for l in range(A[k]):
                if XY[k][l][1] != pt[XY[k][l][0] -1]:
    if ck == 1:
        honest_count.append(sum(pt))
print(max(honest_count))
Problem p02959 (python)

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

ans = 0
for i in range(n):
    town_a = a[i]
    town_b = a[i+1]
    power = b[i]
    if power > town_a:
        ans += town_a
        power -= town_a
    else:
        ans += power
        continue
    if power > town_b:
        ans += town_b
        a[i+1] = 0
    else:
        ans += power
        a[i+1] -= power
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
ans = 0
for i in range(n):
    town_a = a[i]
    town_b = b[i+1]
    power = b[i]
    if power > town_a:
        ans += town_a
        power -= town_a
    else:
        ans += power
        continue
    if power > town_b:
        ans += town_b
        a[i+1] = 0
    else:
        ans += power
        a[i+1] -= power
print(ans)
Problem p03072 (python)

Fixed submission:
N=int(input())
H=list(map(int,input().split()))

cnt=0

for i in range(0,N):
  if max(H[0:i+1]) <= H[i]:
    cnt+=1
print(cnt)

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

cnt=0

for i in range(0,N):
  if max(H[0:i+1] <= H[i]:
    cnt+=1
print(cnt)

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

cnt=1

for i in range(N+1):
  if H[i] < H[i+1]:
    cnt+=1
print(cnt)
Problem p03242 (python)

Fixed submission:
N = input()
L = list(N)

for i in range(3):
  if L[i] == "1":
    L[i] = "9"
  else:
    L[i] = "1"
print("".join(L))

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

print(N.replace('1', '9').replace('9', '1')
Problem p03835 (python)

Fixed submission:
K,S = map(int,input().split())
cnt = 0

for i in range(K+1):
  for j in range(K+1):
      if (S - i - j) <= K:
        if S - i - j >= 0:
          cnt+=1
          
print(cnt)

Buggy submission (verdict: Runtime Error):
K,S=map(int,input())
cnt = 0
for x in range(K+1):
  for y in range(K+1):
    if 0 <= S-x-y <= K:
      cnt += 1
print(cnt)
Problem p03835 (python)

Fixed submission:
K,S = list(map(int,input().split()))

count = 0

if K>S: n=S
else: n=K
x=0
for i in range(n+1):
	if K>S-x: m=S-x
	else: m=K
	y=0
	for j in range(m+1):
		if S-x-y<=K: count +=1
		y+=1
	x+=1

print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
cards = []
for i in range(N):
	cards.append(list(map(int,input().split())))

points = []
for i in range(N):
	points.append(0)

for i in range(3):
	for j in range(N):
		flag = 0
		for k in range(j):
			if cards[j][i] == cards[k][i]:
				flag = 1
				break
		if j+1<N:
			for k in range(j+1,N):
				if cards[j][i] == cards[k][i]:
					flag = 1
					break
		if flag==0: points[j] += cards[j][i]

for i in range(N):
	print(points[i])
Problem p02676 (python)

Fixed submission:
k = int(input())
s = input()

if len(s) <= k:
    print(s)
else:
    t_s = s[:k] + "..."
    print(t_s)

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

if len(s) <= k:
    print(S)
else:
    t_s = s[:k] + "..."
    print(t_s)
Problem p02689 (python)

Fixed submission:
import copy
n, m =map(int, input().split())  #複数数値入力
list_h=list(map(int, input().split()))  #リスト入力
# 繰り返しリスト入力
a = []
for i in range(m):
    ai = list(map(int, input().split()))  #リスト入力
    a.append(ai)

for i in a:
    i.sort()
a = list(map(list, set(map(tuple, a))))

booler = [True] * n
for j in a:
    if list_h[j[0]-1] < list_h[j[1]-1]:
        booler[j[0]-1] = False
    elif list_h[j[0]-1] > list_h[j[1]-1]:
        booler[j[1]-1] = False
    else :
        booler[j[0]-1] = False
        booler[j[1]-1] = False
print(booler.count(True))

Buggy submission (verdict: Runtime Error):
x = int(input())
for i in range(-118, 119):
    for j in range(-119, 118):
        if i**5 - j**5 == x:
            print(i,j)
            break
    else:
        continue
    break

Buggy submission (verdict: Runtime Error):

n, m =map(int, input().split())  #複数数値入力
list_h=list(map(int, input().split()))  #リスト入力
# 繰り返しリスト入力
a = []
for i in range(m):
    ai = list(map(int, input().split()))  #リスト入力
    a.append(ai)

booler = [True] * n
for i in range(n):
    a_copy = copy.deepcopy(a)
    for j in range(m):
        if i in a_copy[j] :
            a_copy[j].remove(i)
#             print(a_copy)
            if list_h[i] > list_h[a_copy[j][0]-1]:
                continue
            else:
                booler[i] = False
        else:
            continue

print(booler.count(True))