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

Fixed submission:
import math

# K = 1
# A, B = 11, 11

K = int(input())
A, B = map(int, input().split())

a = math.ceil(A/K)
# b = B//K
C = K * (a)

# if K > B:
    # print ("NG")


if C <= B:
    print ("OK")
else:
    print ("NG")

Buggy submission (verdict: Runtime Error):
a = A//K
# b = B//K
C = K * (a+1)

# if K > B:
    # print ("NG")


if C <= B:
    print ("OK")
else:
    print ("NG")
Problem p02711 (python)

Fixed submission:
N = str(input())
flag = 0
for i in range(len(N)):
    if int(N[i]) == 7:
        print ('Yes')
        flag = 1
        break
if flag == 0:
    print ('No')

Buggy submission (verdict: Runtime Error):
N = str(input())
flag = 0
for i in range(len(N)):
    if int(N[i]) == 7:
        print ('Yes')
        flag = 1
        break
101if flag == 0:
    print ('No')

Buggy submission (verdict: Runtime Error):
N = str(input())
flag = 0
for i in range(len(N))
	if int(N[i]) == 7:
    	print ('Yes')
      	flag = 1
    	break
if flag == 0:
  print ('No')
Problem p02707 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
ans = [0]*N
for i in range(N-1):
    ans[A[i]-1] += 1
for i in range(N):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
ans = [0]*N
for i in range(N):
    ans[A[i]-1] += 1
for i in range(N):
    print(ans[i])
Problem p02711 (python)

Fixed submission:
N = int(input())
if(N%10 == 7 or (N//10)%10 == 7 or (N//100)%100 == 7):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N
Problem p02777 (python)

Fixed submission:
sp=input().split()
A,B=list(map(int,input().split()))
s=input()
if sp[0]==s:print(A-1,B)
elif sp[1]==s:print(A,B-1)

Buggy submission (verdict: Runtime Error):
ss=input().split()
a,b=list(map(int,input()))
s=input()
if s==ss[0]: print(a-1,b)
elif s==ss[1]:print(a,b-1)
Problem p02779 (python)

Fixed submission:
N=int(input())
a=list(map(int,input().split()))
a.sort()
for i in range(N-1):
  if a[i]==a[i+1]:
    print("NO")
    exit(0)
print("YES")

Buggy submission (verdict: Runtime Error):
N=int(input())
a=[int(input() ) for i in range(N)]
for i in range(N-1):
  if a[i]==a[i+1]:
    print("NO")
    exit(0)
print("YES")

Buggy submission (verdict: Runtime Error):
import collecttions
l=list(map(int,input().split()))
for i in l:
  if l.count(i)!=1:
    print("NO")
    exit(0)
print("YES")
Problem p02701 (python)

Fixed submission:
N = int(input())
str_list = [input() for _ in range(N)]

print(len(set(str_list)))

Buggy submission (verdict: Runtime Error):
N = input()
str_list = [input() for _ in range(N)]

print(len(set(str_list)))
Problem p02707 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
 
result = [0]*N
 
for i in range(N-1):
    result[A[i]-1] += 1
 
for i in range(N):
    print(result[i])

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

result = [0]*N

for i in range(N-1):
    result[A[i]-1] += 1

for i in range(N):
    print(result[i])
Problem p02753 (python)

Fixed submission:
import sys

s = input()

if s == 'AAA' or s == 'BBB':
    print('No')
    sys.exit()

print('Yes')

Buggy submission (verdict: Runtime Error):
import sys

s = input()

if s = 'AAA' or s = 'BBB':
  print('No')
  sys.exit()
 
print('Yes')
Problem p02779 (python)

Fixed submission:
import sys
N = int(input())
numlist = list(map(int, input().split()))

numlist.sort()
for i in range(N-1):
    if numlist[i] == numlist[i+1]:
        print('NO')
        sys.exit()

print('YES')

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

for i in range(N):
  if numlist[0] == numlist[i]:
    print('No')
    sys.exit()

print('Yes')
Problem p02835 (python)

Fixed submission:
#coding:utf-8
import bisect
from collections import deque
import sys
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = lambda *something : print(*something) if DEBUG else 0
DEBUG = True

def index(a,b):
    return str(min(a,b)) + "," +  str(max(a, b))

def main(given = sys.stdin.readline):
    input = lambda : given().rstrip()
    LMIIS = lambda : list(map(int,input().split()))
    II = lambda : int(input())
    XLMIIS = lambda x : [LMIIS() for _ in range(x)]

    a = LMIIS()

    if a[0] + a[1] + a[2] >= 22:
        print("bust")
    else:
        print("win")





if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
a,c,c,cafjdsiaof
Problem p02862 (python)

Fixed submission:
#coding:utf-8
import bisect
import sys
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = lambda *something : print(*something) if DEBUG else 0
DEBUG = True



def main(given = sys.stdin.readline):
    input = lambda : given().rstrip()
    LMIIS = lambda : list(map(int,input().split()))
    II = lambda : int(input())
    XLMIIS = lambda x : [LMIIS() for _ in range(x)]

    x, y = LMIIS()

    if (x+y)%3!=0:
      print(0)
      exit()
    n = (x+y)//3
    if 0 > x-n or 0 > y-n:
      print(0)
      exit()

    m = min(x-n,y-n)
    mod = 10**9 + 7

    a = 1
    b = 1
    c = 1
    for i in range(1, n+1):
        a = a * i % mod
    for i in range(1, n - m + 1):
        b = b * i % mod
    for i in range(1, m + 1):
        c = c * i % mod
    print(a * pow(b * c, mod - 2, mod) % mod)




if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
x, y = map(int,input().split())
if (x+y)%3!=0:
  print(0)
  exit()
n = (x+y)//3
if 0 > x-n or 0 > y-n:
  print(0)
  exit()

m = min(x-n,y-n)
mod = 1000000007
a=1
b=1

for i in range(1,m+1):
  a = a *(n+1-i) % mod
  b = b * i %mod
print(ans)

Buggy submission (verdict: Runtime Error):
x, y = map(int,input().split())
if (x+y)%3!=0:
  print(0)
  exit()
n = (x+y)//3
if 0 > x-n or 0 > y-n:
  print(0)
  exit()

m = min(x-n,y-n)
mod = 1000000007
ans = 1
for i in range(m):
  ans = (ans *(n-i) // i) % mod
print(ans)
Problem p02833 (python)

Fixed submission:
import math
n=int(input())
ans=0
if n==0 or n%2==1:
    print(ans)
else:
    m=math.ceil(math.log(n, 5))
    for i in range(1, m):
        ans +=(n//2)//(5**i)
    print(ans)

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
ans=0
if n%2==1:
    print(ans)
else:
    m=math.ceil(math.log(n, 5))
    for i in range(1, m):
        ans +=(n//2)//(5**i)
    print(ans)
Problem p03745 (python)

Fixed submission:
def main():
    import sys
    n=int(input())
    a=list(map(int, input().split()))
    ud=[]
    ans=1
    cnt=[0,0]
    if n==1:
        print(ans)
        sys.exit()
    for i in range(n-1):
        if a[i]==a[i+1]:
            ud.append('eq')
        elif a[i]<a[i+1]:
            ud.append('up')
        elif a[i]>a[i+1]:
            ud.append('down')
    if len(set(ud))==1 or (len(set(ud))==2 and 'eq' in set(ud)):
        print(ans)
        sys.exit()
    if ud[0]=='up':
        cnt[0]=1
    elif ud[0]=='down':
        cnt[1]=1
    for i in range(1,n-1):
        if (cnt[0]==cnt[1]==0 or cnt[0]!=0) and ud[i]=='up':
            cnt[0]+=1
        elif (cnt[0]==cnt[1]==0 or cnt[1]!=0) and ud[i]=='down':
            cnt[1]+=1
        elif cnt[0]!=0 and ud[i]=='down':
            ans+=1
            cnt[0]=0
        elif cnt[1]!=0 and ud[i]=='up':
            ans+=1
            cnt[1]=0
        elif cnt[0]!=0 and cnt[1]==0 and i==n-2:
            ans+=1
        elif cnt[1]!=0 and cnt[0]==0 and i==n-2:
            ans+=1
    print(ans)
    
if __name__=='__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n=int(input())
    a=list(map(int, input().split()))
    ud=[]
    ans=1
    cnt=[0,0]
    for i in range(n-1):
        if a[i]==a[i+1]:
            ud.append('eq')
        elif a[i]<a[i+1]:
            ud.append('up')
        elif a[i]>a[i+1]:
            ud.append('down')
    if ud[0]=='up':
        cnt[0]=1
    elif ud[0]=='down':
        cnt[1]=1
    for i in range(1,n-1):
        if (cnt[0]==cnt[1]==0 or cnt[0]!=0) and ud[i]=='up':
            cnt[0]+=1
        elif (cnt[0]==cnt[1]==0 or cnt[1]!=0) and ud[i]=='down':
            cnt[1]+=1
        elif cnt[0]!=0 and ud[i]=='down':
            ans+=1
            cnt[0]=0
        elif cnt[1]!=0 and ud[i]=='up':
            ans+=1
            cnt[1]=0
        elif cnt[0]!=0 and cnt[1]==0 and i==n-2:
            ans+=1
        elif cnt[1]!=0 and cnt[0]==0 and i==n-2:
            ans+=1
    print(ans)
    
if __name__=='__main__':
    main()
Problem p02682 (python)

Fixed submission:
s = input()
A, B, C, K = [int(v) for v in s.split(" ")]

if K <= A:
  print(K)
elif K <= A + B:
  print(A)
elif K <= A + B + C:
  print(A - (K - A - B))

Buggy submission (verdict: Runtime Error):
s = input()
A B C K = s.split(" ")

if K <= A:
  print(K)
elif K <= A + B:
  print(A)
elif K <= A + B + C:
  print(A - (K - A))
Problem p02835 (python)

Fixed submission:
#!/usr/bin/env python3
a, b, c = map(int, input().split())

if a + b + c >= 22:
  print('bust')
else:
  print('win')

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
s, t = input().split()
print(t+s)
Problem p02989 (python)

Fixed submission:
#!/usr/bin/env python3
n = int(input())
d = list(map(int, input().split()))

d.sort()
h = n // 2 - 1

a = d[h]
b = d[h + 1]

print(b - a)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
p
Problem p02847 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**6)
# input = sys.stdin.readline
ii = lambda: int(input())
mis = lambda: map(int,input().split())
lmis = lambda: list(mis())
INF = float('inf')

def main():
    S=input()
    days=['SUN','MON','TUE','WED','THU','FRI','SAT']
    print(7-days.index(S))


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**6)
# input = sys.stdin.readline
ii = lambda: int(input())
mis = lambda: map(int,input().split())
lmis = lambda: list(mis())
INF = float('inf')

def main():
    S=input()
    days=['SAN','MON','TUE','WED','THU','FRI','SAT']
    print(7-days.index(S))


if __name__ == "__main__":
    main()
Problem p02879 (python)

Fixed submission:
import sys
sys.setrecursionlimit(1000000000)
ii = lambda: int(input())
mis = lambda: map(int,input().split())
lmis = lambda: list(mis())
INF = float('inf')

def main():
    A,B=mis()
    print(A*B if 0<A<10 and 0<B<10 else '-1')


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(1000000000)
ii = lambda: int(input())
mis = lambda: map(int,input().split())
lmis = lambda: list(mis())
INF = float('inf')

def main():
    A,B=mis()
    print(A*b if 0<A<10 and 0<B<10 else '-1')


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(1000000000)
ii = lambda: int(input())
mis = lambda: map(int,input().split())
lmis = lambda: list(mis())
INF = float('inf')

def main():
    A,B=mis
    print(A*b if 0<A<10 and 0<B<10 else '-1')


if __name__ == "__main__":
    main()
Problem p02912 (python)

Fixed submission:
import heapq as hp

n,m=map(int,input().split())
a=list(map(lambda x: -x ,map(int,input().split())))
hp.heapify(a)
for _ in range(m):
    tmp=hp.heappop(a)
    tmp//=-2
    hp.heappush(a,-tmp)
print(-sum(a))

Buggy submission (verdict: Runtime Error):
import heapq as hq

def solve(m,a):
    v=hq.heapify(a)
    for _ in range(m):
        x=hq.heappop(v)
        x//=-2
        hq.heappush(v,x)
        return -sum(v)

n,m=map(int,input().split())
a=list(map(int,input().split()))
print(solve(m,a))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=sorted(map(int,input().split()),reverse=True)
i=0
for _ in range(m):
    a[i]//=2
    i=a.index(max(a))
    print(a)
print(sum(a))

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=sorted(map(int,input().split()),reverse=True)
cnt=0
i=0
for _ in range(m):
    if i==len(a): i=0
    a[i]//=2
    if a[i]<a[i+1]: i+=1
print(sum(a))
Problem p03803 (python)

Fixed submission:
a,b=map(int,input().split())
if a==b: print('Draw')
elif a==1: print('Alice')
elif b==1: print('Bob')
else: print('Alice' if a>b else 'Bob')

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a==b: print('Draw')
elif a==1: print('Alice')
elif b==1: print('Bob')
else print('Alice' if a>b else 'Bob')
Problem p02676 (python)

Fixed submission:
k = int(input())
s = input()
if len(s) <= k :
    print(s)
else :
    for i in range (k) :
        print(s[i],end="")
    print("...")

Buggy submission (verdict: Runtime Error):
k = int(input())
s = input()
if len(s) == k :
    print(s)
else :
    for i in range (k) :
        print(s[i],end="")
    print("...")
Problem p02725 (python)

Fixed submission:
#X = int(input().strip())

K, N = list(map(int, input().strip().split()))
A = list(map(int, input().strip().split()))
m = 0
ind = 0
ans = 0

for i in range(N-1):
  _m = A[i+1] - A[i]
  if _m > m:
    m = _m
    ind = i+1
    last = i

_m = K + A[0] - A[N-1]
if _m > m:
  m = _m
  ind = 0
  last = N-1

#print(m)
#print(ind)
#print(last)
i = ind
while i != last:
  #print(ans)
  if i < N-1:
    ans += A[i+1] - A[i]
    i += 1
  else:
    ans += K + A[0] - A[i]
    i = 0

print(ans)

Buggy submission (verdict: Runtime Error):
#X = int(input().strip())

K, N = list(map(int, input().strip().split()))
A = list(map(int, input().strip().split()))

ans = 0
p = A[0]
low_index = 1
high_index = N-1
Done = set([p])

while len(A) > len(Done):
  #print('p:' + str(p))
  #print(Done)
  #print(ans)
  if abs(A[low_index] - p) < abs(p - A[high_index]):
    #print('low')
    Done.add(A[low_index])
    ans += A[low_index] - p
    p = A[low_index]
    for i in range(1, N):
      if low_index + i not in Done:
        low_index += i
        break
  else:
    #print('high')
    Done.add(A[high_index])    
    ans += K - A[high_index]
    p = A[high_index]
    for i in range(1, N):
      if high_index - i not in Done:
        high_index -= i
        break

print(ans)
Problem p02693 (python)

Fixed submission:
k = int(input())
a, b = map(int, input().split())
flag = False
for i in range(a, b+1):
    if i % k == 0:
        flag = True
        break
if flag:
    print('OK')
else:
    print('NG')

Buggy submission (verdict: Runtime Error):
k = int(input())
a, b = map(int, input())
flag = False
for i in range(a, b+1):
    if i % k == 0:
        flag = True
        break
if flag:
    print('OK')
else:
    print('NG')
Problem p02753 (python)

Fixed submission:
a = input()
if a == "AAA" or a == "BBB":
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
# 未完成
import math
a = list(map(int, input().split()))

x = [a[0] / 0.08, (a[0] + 1) / 0.08]
y = [a[1] / 0.1, (a[1] + 1) / 0.1]
ans = [max([a[0] / 0.08, a[1] / 0.1]),
       min([(a[0] + 1) / 0.08, (a[1] + 1) / 0.1])]
if ((a[1] + 1) / 0.1 > (a[1] + 1) / 0.1) or (a[1] / 0.1 > (a[0] + 1) / 0.08):
    print(-1)
else:
    if math.ceil(ans[0]) > ans[1]:
        print(-1)
    else:
        print(math.ceil(ans[0]))
Problem p02831 (python)

Fixed submission:
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)


a, b = map(int, input().split())
if a < b:
    save = a
    a = b
    b = save
print(int(a*b/gcd(a, b)))

Buggy submission (verdict: Runtime Error):
import math

a, b = map(int, input().split())
print(int(a*b/math.gcd(a, b)))
Problem p02676 (python)

Fixed submission:
k=int(input())
s=list(str(input()))
if len(s)<=k:
  t=""
  for i in s:
    t=t+i   
  print(t)
else:
  t=""
  for i in range(0,k):
    t=t+s[i]
  t=t+"..."
  print(t)

Buggy submission (verdict: Runtime Error):
k=int(input())
s=list(str(input()))
if len(s)<=k:
  s=sum(s)
  print(s)
else:
  t=""
  for i in range(0,k):
    t=t+s[i]
  t=t+"..."
  print(t)
Problem p02707 (python)

Fixed submission:
import collections
n = int(input())
A = list(map(int, input().split()))
cnt = collections.Counter(A)
for i in range(1,n+1):
  print(cnt[i])

Buggy submission (verdict: Runtime Error):
import collections
n = int(input)
A = list(map(int, input().split()))
cnt = collections.Counter(A)
for i in range(n):
  print(cnt[i])

Buggy submission (verdict: Runtime Error):
import collections
n = input()
a = list(map(int, input().split()))
a = Counter(a)
for i in range(n):
  print(a[i])
Problem p02726 (python)

Fixed submission:
import copy

N, X, Y = map(int, input().split())
def check(num, distance):
    if num!=0:
        distance[num-1]=min(distance[num]+1, distance[num-1])
    if num!=N-1:
        distance[num+1]=min(distance[num+1], distance[num]+1)
    if num==X-1:
        distance[Y-1]=min(distance[Y-1], distance[X-1]+1)
    elif num==Y-1:
        distance[X-1] = min(distance[X-1], distance[Y-1]+1)
total_answer=[]
answer=[N]*N
for k in range(N):
    temp=copy.copy(answer)
    temp[k]=0
    #print(temp)
    for i in range(0, N):
        check(i, temp)
        #print(temp)
    #print(temp)
    for j in range(N-1,-1,-1):
        check(j, temp)
    #print(temp)
    #print('/n')

    for i in range(0, N):
        check(i, temp)

    for j in range(N - 1, -1, -1):
        check(j, temp)
    for i in range(0, N):
        check(i, temp)

    for j in range(N - 1, -1, -1):
        check(j, temp)

        #print(temp)
    #print(temp)
    total_answer+=temp
#print(total_answer)
import collections
dict=collections.Counter(total_answer)
#print(dict)
for i in range(1, N):
    print(dict[i]//2)

Buggy submission (verdict: Runtime Error):
import queue

N, X, Y = map(int, input().split())

G = [[] for _ in range(N + 1)]
for i in range(1, N):
    G[i].append(i + 1)
    G[i + 1].append(i)
G[Y].append(X)
G[X].append(Y)
#print(G)

seen = [False] * (N + 1)
todo = queue.Queue()
route = [0] * (N + 1)
def bfs(parent):
    seen[parent] = True
    #print(route)
    for child in G[parent]:
        if seen[child] == False:
            seen[child] = True
            route[child] = route[parent] + 1
            todo.put(child)
    if not todo.empty():
        bfs(todo.get())

bfs(1)
#print(route)

bucket = [0] * N
for i in range(1, N + 1):
    seen = [False] * (N + 1)
    route = [0] * (N + 1)
    bfs(i)
    for val in route:
        bucket[val] += 1
#print(bucket)
for i in range(1, N):
    print(bucket[i] // 2)
Problem p02771 (python)

Fixed submission:
st=set(map(int, input().split()))

if len(st)==2:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
'''
st=set(map(int, input().split()))

if len(st)==2:
    print('Yes')
else:
    print('No')
'''

print('Yes' if len(set(map(int, input().split())))==2 'No')
Problem p02793 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
import math
M = max(A)
MOD = 10 ** 9 + 7

def power_func(a, n, p):
    res = 1 #これは答え
    while n > 0:
        if n & 1:
            res = res * a % p
        a = a * a % p #1が立っているかどうかに関わらず次のaの累乗を用意しておく
        n = n >> 1
    return res

bucket = [0] * (M + 1)
for val in A:
    for i in range(2, math.floor(math.sqrt(val)) + 1):
        #print(val, i)
        temp = 0
        while val % i == 0:
            val //= i
            temp += 1
        bucket[i] = max(bucket[i], temp)
    if val != 1:
        bucket[val] = max(bucket[val], 1)
#print(bucket)

L = 1
for n in range(M + 1):
    L = (L * n ** bucket[n]) % MOD
#print(L)

ans = 0
for val in A:
    ans = (ans + power_func(val, MOD - 2, MOD))
ans = (ans * L) % MOD
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
MOD = 10 ** 9 + 7

import math
l = 1
for val in A:
    l = (l * val // math.gcd(val, l))
#print(l)

ans = 0
for val in A:
    ans = (ans + l // val) % MOD
print(ans)
Problem p02859 (python)

Fixed submission:
r=int(input())
print(r**2)

Buggy submission (verdict: Runtime Error):
r=int(input())
print(R**2)
Problem p02881 (python)

Fixed submission:
n=int(input())
lst=[]
for i in range(1,n):
    if i**2>n:
        break
    if n%i==0:
        lst.append(i+n//i)
print(min(lst)-2)

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
lst=[]
up=math.ceiling(math.sqrt(n))-1
for i in range(1,up+1):
    if i**2>n:
        break
    if n%i==0:
        lst.append(i+n//i)
print(min(lst)-2)
Problem p02891 (python)

Fixed submission:
S = input()
K = int(input())



def func(S):
    inner = 0
    S = list(S)
    for i in range(len(S) - 1):
        if S[i] == S[i + 1]:
            S[i + 1] = '#'
            inner += 1
    return inner

if len(set(list(S))) == 1:
    print(len(S) * K // 2)
else:
    inner = func(S)
    inter = func(S * 2) - func(S) * 2
    print(inner * K + inter * (K - 1))

Buggy submission (verdict: Runtime Error):
S = list(input())
K = int(input())

inter = 0
inner = 0

for i in range(len(S) - 1):
    if S[i] == S[i + 1]:
        S[i + 1] = '#' + S[i + 1]
        inner += 1
if S[0] == S[-1]:
    if S[-2] == '#' + S[-1]:
        pass
    else:
        inter += K - 1
# print(S)
# print(inter)
print(inter + inner * K)
Problem p02933 (python)

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

if a>=3200:
    print(s)
else:
    print('red')

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

if a>=3200:
    print(s)
else:
    print('red')
Problem p02954 (python)

Fixed submission:
S=input()

N=len(S)

lst=[0]*N
R_count=0
for i in range(N-1):
    if S[i]=='R' and S[i+1]=='R':
        R_count+=1
    if S[i]=='R' and S[i+1]=='L':
        R_count += 1
        lst[i]=R_count
        R_count=0
L_count=0
for i in range(N-1, 0, -1):
    if S[i]=='L' and S[i-1]=='L':
        L_count+=1
    if S[i]=='L' and S[i-1]=='R':
        L_count += 1
        lst[i]=L_count
        L_count=0
#print(lst)
i=0
while i < N:
    if lst[i] and lst[i+1]:
        mid=(lst[i]+lst[i+1])//2
        if (lst[i]-lst[i+1])%2==0:
            lst[i], lst[i+1] = mid, mid
        elif lst[i]>lst[i+1]:
            if lst[i]%2==1:
                lst[i], lst[i+1]= mid+1, mid
            else:
                lst[i], lst[i+1] =mid, mid+1
        elif lst[i]<lst[i+1]:
            if lst[i+1]%2==1:
                lst[i], lst[i + 1] = mid, mid + 1
            else:
                lst[i], lst[i + 1] = mid + 1, mid
        i+=1
    i+=1
print(' '.join(list(map(str, lst))))

Buggy submission (verdict: Runtime Error):
S=input()
N=len(S)
children=[1]*N
def next(children):
    new_children=[0]*N
    for i in range(N):
        if S[i]=='L':
            new_children[i-1]+=children[i]
        else:
            new_children[i+1]+=children[i]
    return new_children

change=[]
count=0
while True:

    #print(children)
    if children in change:
        start=change.index(children)
        break
    change.append(children)

    children=next(children)
    count += 1
#print(start, count)
if count==start:
    R=(10**100-4)%(count-start)
    print(' '.join(change[4+R]))
else:
    print(' '.join(change[start]))