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

Fixed submission:
def solve():
  a,b,c = (int(i) for i in input().split())
  queue = [[a,b,c]] #mugencheck
  ct = 0
  while ct <100000000:
    if a%2 ==1 or b%2 ==1 or c%2 == 1: break
    #とりあえず交換simluration
    tmpa = a//2
    tmpb = b//2
    tmpc = c//2
    a = tmpb+tmpc
    b = tmpa+tmpc
    c = tmpa+tmpb
    if [a,b,c] in queue: 
      return -1
    else:
      ct += 1
      queue.append([a,b,c])
      #print(queue)
  return ct
                   
  
if __name__ == '__main__':
  print(solve())

Buggy submission (verdict: Runtime Error):
def solve():
  n,m = (int(i) for i in input().split())
  a = [0]*n
  for i in range(m):
    a1,b1 = (int(i) for i in input().split())
    a[a1-1]+=1
    a[b1-1]+=1
  ans = 'YES'
  for i in range(1,n+1):
   if a[i]%2 == 1:
    ans ='NO'
  return ans
                   
  
if __name__ == '__main__':
  print(solve())
Problem p03785 (python)

Fixed submission:
import bisect
def solve():
  n,c,k = (int(i) for i in input().split())
  t = [int(input()) for i in range(n)]
  t = sorted(t,reverse = True)
  ans = 0
  
  while t:
    ans += 1
    customer = t.pop(0)
    if len(t) >= 1:
     for i in range(c-1):
      if customer  <= t[0] + k:
        t.pop(0)
      else:
        break
      if len(t) == 0:
        break
  print(ans)
  
solve()

Buggy submission (verdict: Runtime Error):
import bisect
def solve():
  n,c,k = (int(i) for i in input().split())
  t = [int(input()) for i in range(n)]
  t = sorted(t,reverse = True)
  ans = 0
  
  while t:
    ans += 1
    customer = t.pop(0)
    if len(t) >= 1:
     for i in range(c-1):
      if customer  <= t[0] + k:
        t.pop(0)
      else:
        break
  print(ans)
  
solve()

Buggy submission (verdict: Runtime Error):
import bisect
def solve():
  n,c,k = (int(i) for i in input().split())
  t = [int(input()) for i in range(n)]
  t = sorted(t,reverse = True)
  ans = 0
  
  while t:
    ans += 1
    customer = t.pop(0)
    if len(t) >= 1:
     for i in range(c-1):
      if customer  <= t[0] + k:
        t.pop(0)
      else:
        break
  print(ans)
  
solve()

Buggy submission (verdict: Runtime Error):
import bisect
def solve():
  n,c,k = (int(i) for i in input().split())
  t = [int(input()) for i in range(n)]
  t.sort()
  ans = 0
  
  while t:
    ans += 1
    customer = t.pop(0)
    if len(t) >= 1:
     for i in range(c):
      if customer + k >= t[0]:
        t.pop(0)
      else:
        break
  print(ans)
  
solve()
Problem p02879 (python)

Fixed submission:
a,b = input().split()
a = int(a)
b = int(b)
if a >= 10 or b >=10:
  print ('-1')
else:
  print (a * b)

Buggy submission (verdict: Runtime Error):
N = int(input())
kuku = []
for i in range(1,10):
  for j in range(1,10):
    kuku.append(i*j)
    
if N in kuku:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
kuku = []
for x in range(1,10):
  for y in range(1,10):
    kuku.append(x*y)
    
if N in kuku:
  print('Yes')
else:
  print('No')
Problem p02771 (python)

Fixed submission:
x, y, z = input().split()
a = "No"
if x != y:
    if x == z:
        a = "Yes"
    elif y == z:
        a = "Yes"
    else:
        a = "No"
if x == y:
    if x == z:
        a = "No"
    elif y == z:
        a = "No"
    else:
        a = "Yes"
print(a)

Buggy submission (verdict: Runtime Error):
x, y, z = input.split()
a = "No"
if x != y:
	if y = z:
      a = "Yes"
      elif x = z:
        a = "Yes"
      else: a = "No"
if x = y:
  if y = z:
    a = "No"
    elif x = z:
      a = "No"
    else: a = "Yes"
print(a)

Buggy submission (verdict: Runtime Error):
x,y,z = input.split()
if x = y:
  if y = z:
    print('No')
  else print('Yes')
if y = z:
  if x = z:
    print('No')
  else print('Yes')
if x = z:
  if x = y:
    print('No')
  else print('Yes')
Problem p02659 (python)

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

Buggy submission (verdict: Runtime Error):
A,B=map(str,input().split())
A=int(A)
B=B.replase(".","")
print(int((A*B)/100))
Problem p02695 (python)

Fixed submission:
import itertools
from collections import defaultdict

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


seq = list(range(1, M+1))
dlist = defaultdict(list)
dres  = defaultdict(int)
Na    = 0

for i,v in enumerate(itertools.combinations_with_replacement(seq, N)):
    dlist[i] = v
    Na += 1


for i in range(Q):
    ai, bi, ci, di = map(int, input().split())
    for j in range(Na):
        tmp = dlist[j]
        if tmp[bi-1] - tmp[ai-1] == ci:
            dres[j] += di
print(max([dres[i] for i in range(Na)]))

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

import itertools
from collections import defaultdict

seq = list(range(1, M+1))
dlist = defaultdict(list)
dres  = defaultdict(int)
Na    = 0

for i,v in enumerate(itertools.combinations(seq, N)):
    dlist[i] = v
    Na += 1

#print(seq)
#print(dlist)

#import numpy as np

#X = np.r_[[dlist[i] for i in range(Na)]]

#Y = np.zeros((Q, 4), dtype=int)

for i in range(Q):
    ai, bi, ci, di = map(int, input().split())
    #Y[i] = [ai, bi, ci, di]
    #print(ai-1, bi-1, ci, di)
    for j in range(Na):
        tmp = dlist[j]
        if tmp[bi-1] - tmp[ai-1] == ci:
            dres[j] += di
print(max([dres[i] for i in range(Na)]))
Problem p02753 (python)

Fixed submission:
S = input()


if ('AB' in S) | ('BA' in S):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
S = str(input())
Q = int(input())

qs = [input().split() for i in range(Q)]

for q in qs:
    if q[0] == '1':
        S = S[::-1]
    else:
        if q[1] == '1':
            S = q[2] + S
        else:
            S = S + q[2]

print(S)
Problem p02682 (python)

Fixed submission:
a,b,c,k = map(int,input().split())
print(min([a,k])-max([0,k-a-b]))

Buggy submission (verdict: Runtime Error):
a,b,c,k = map(int,input().split())
l = [1]*a + [0]*b + [-1]*c
print(sum(l[:k]))

Buggy submission (verdict: Runtime Error):
a,b,c,k = map(int,input().split())
l = [1]*a + [0]*b + [-1]*c
print(sum(l[:k])
Problem p02688 (python)

Fixed submission:
n,k = map(int,input().split())
l=[]
for i in [0]*k:
  d = input()
  l+=list(map(int,input().split()))
print(n-len(set(l)))

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
s = set()
for i in [0]*n:
  _ = input()
  s|=set(map(int,input().split()))
print(k-len(s))
Problem p02819 (python)

Fixed submission:
n=int(input())
prime=0
tmp = n
while prime == 0:
  flag=True
  for i in range(2,int(tmp**0.5)+1):
    if tmp%i==0:
      flag=False
      break
  if flag:
    prime=tmp
  tmp+=1
print(prime)

Buggy submission (verdict: Runtime Error):
n=int(input())
prime=0
tmp = n
while prime == 0:
  flag=True
  for i in range(2,int(n**0.5)+1):
  	flag=False
    break
  if frag:
    prime=tmp
  tmp+=1
print(prime)
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 fractions
a,b = map(int,input().split())
print(a*b//gcd(a,b))
Problem p02832 (python)

Fixed submission:
n = int(input())
*l, = map(int,input().split())
ans = 0
tmp=1
for i in range(n):
  if l[i] == tmp:
    tmp+=1
  else:
    ans += 1
print(-1 if ans==n else ans)

Buggy submission (verdict: Runtime Error):
n = int(input().split())
*l, = map(int,input().split())
ans = 0
tmp=1
for i in range(n):
  if l[i] == tmp:
    tmp+=1
  else:
    ans += 1
print(-1 if ans==n else ans)
Problem p02835 (python)

Fixed submission:
a,b, c = map(int,input().split())
ans = 'win'
if a+b+c >21:
  ans = 'bust'
print(ans)

Buggy submission (verdict: Runtime Error):

#O(nm) = O(60n)で解けるはず・・・！
n = int(input())
*l, = map(int,input().split())
#2進数の桁の出現数をカウントする。
lone = [0]*60
for i in range(n):
  m = l[i]
  for j in range(60):
    lone[j] += m%2
    m=m>>1
    if m==0:
      continue
ans = 0
for i in range(len(lone)):
  ans += 2**i*lone[i]*(n-lone[i])
print(ans%(10**9+7))
Problem p02881 (python)

Fixed submission:
n = int(input())
for i in range(-int(-n**0.5//1),0,-1):
  if n%i==0:
    a=i
    b=n//i
    break
print(a+b-2)

Buggy submission (verdict: Runtime Error):
n = int(input())
for i in range(-int(-n**0.5//1),0,-1):
  if n%i=0:
    a=i
    b=n//i
print(a+b-2)
Problem p02935 (python)

Fixed submission:
n = int(input())
*l, = map(int,input().split())
l.sort()
ans=l[0]
for i in l:
  ans = ans/2 + i/2
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
*l, = map(int,input().split())
l = l.sort()
ans=l[0]
for i in l:
  ans = ans/2 + i/2
print(ans)
Problem p02948 (python)

Fixed submission:
from heapq import heappush,heappop
n,m = map(int,input().split())
l = [list(map(int,input().split())) for _ in [0]*n]
l.sort(key=lambda x:x[0])
ans = 0
tmpl = []
i = 0
for d in range(1,m+1):
  while i<=n-1 and l[i][0] <= d:
    #tmpl.append(l[i][1])
    heappush(tmpl,-l[i][1])
    i += 1
  if len(tmpl) > 0:
    #maxindex = tmpl.index(max(tmpl))
    #ans += tmpl[maxindex]
    #del tmpl[maxindex]
    ans -= heappop(tmpl)
print(ans)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
l = [list(map(int,input().split())) for _ in [0]*n]
l.sort(key=lambda x:x[1])
ans = 0
tmpl = []
d = 1
flag = True

while len(l)>=1 and d<=m:
  while l[0][0] <= d and len(l)>=1:
    tmpl.append(l[0][i])
    del l[0]
  maxindex = tmpl.index(max(tmpl))
  ans += tmpl[maxindex]
  del tmpl[maxindex]
print(tmp)
Problem p03013 (python)

Fixed submission:
n,m = map(int,input().split())
l = [int(input()) for _ in[0]*m]
l=set(l)
dp=[0]*(n+1)#0〜n段目までのn+1通り。
#1段目までは手動。
dp[0]=1
dp[1]=0 if 1 in l else 1
MOD =10**9+7
#dp 貰うタイプ
for i in range(2,n+1):
  if i not in l:#床が壊れてなければ
    dp[i] = (dp[i-1] + dp[i-2])%MOD
print(dp[n])

Buggy submission (verdict: Runtime Error):
n.m = map(int,input().split())
l = [int(input()) for _ in[0]*m]
l=set(l)
dp=[0]*(n+1)#0〜n段目までのn+1通り。
#1段目までは手動。
dp[0]=1
dp[1]=0 if 1 in l else 1
MOD =10**9+7
#dp 貰うタイプ
for i in range(2,n+1):
  if i not in l:#床が壊れてなければ
    dp[i] = (dp[i-1] + dp[i-2])%MOD
print(dp[n])
Problem p03073 (python)

Fixed submission:
#010101…と101010…の2通り
#2通りともコストを計算して小さい方を採用するだけ。
#文字列処理のほうが楽。if文注意
s = input()
even = True
ans1=0#010101…
ans2=0#101010…
for c in s:
  if even:
    even = False
    if c == '0':
      ans2 += 1
    else:
      ans1 += 1
  else:
    even = True
    if c == '0':
      ans1 += 1
    else:
      ans2 += 1
print(min([ans1,ans2]))

Buggy submission (verdict: Runtime Error):
#010101…と101010…の2通り
#2通りともコストを計算して小さい方を採用するだけ。
#文字列処理のほうが楽。if文注意
s = input()
even = true
ans1=0#010101…
ans2=1#101010…
for c in s:
  if even:
    if c == '0':
      ans2 += 1
    else:
      ans1 += 1
  else:
    if c == '0':
      ans1 += 1
    else:
      ans2 += 1
print(min([ans1,ans2]))
Problem p03265 (python)

Fixed submission:
x1, y1,x2,y2 = map(int,input().split())
x3 = x2 - (y2-y1)
y3 = y2 + (x2-x1)
x4 = x3 - (y3-y2)
y4 = y3 + (x3-x2)
print(x3,y3,x4,y4)

Buggy submission (verdict: Runtime Error):
x1, y1,x2,y2 = map(int,input().split())
x3 = x2 - (y2-y1)
y3 = y2 + (x2-x1)
x4 = x3 - (y3-y2)
y4 = y4 + (x3-x3)
print(x3,y3,x4,y4)
Problem p03012 (python)

Fixed submission:
n = int(input())

w = list(map(int,input().split()))
count = 0
min = 1000
for t in range(1,n):
  count =  abs(sum(w[:t]) - sum(w[t:n])) 
  if count < min:
    min = count
print(min)

Buggy submission (verdict: Runtime Error):
8
27 23 76 2 3 5 62 52
Problem p02970 (python)

Fixed submission:
n, d = map(int,input().split())
ans = n // (2*d + 1)
if n % (2*d + 1) == 0:
  print(ans)
else:
  print(ans+1)

Buggy submission (verdict: Runtime Error):
n = int(input())
d = int(input())
ans = n // (2*d + 1)
if n % (2*d + 1) != 0:
  print(ans+1)
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
d = int(input())
ans = n/(2*d + 1)
if n % (2*d + 1) != 0:
  print(ans+1)
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
d = int(input())
ans = n/(2*d + 1)
if n % (2*d + 1) != 0:
  print("{}".format(ans+1))
else:
  print("{}".format(ans))
Problem p03072 (python)

Fixed submission:
N = int(input().strip())
arrayH = list(map(int, input().strip().split(' ')))
ans = 1
for i in range(N - 1):
        yn = True
        for j in range(i+1):
                if arrayH[j] > arrayH[i+1]:
                        yn = False
        if yn:
                ans = ans + 1
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input().strip())
arrayH = list(map(int, input().strip().split(' ')))
ans = 1
i = 0
while arrayH[i] <= arrayH[i+1]:
                ans = i + 1
                i = i + i
                if i == N - 1:
                        break
print(ans)
Problem p03075 (python)

Fixed submission:
a = []
for i in range(5):
    a.append(int(input()))
k = int(input())

if a[4] - a[0] <= k:
    print("Yay!")
else:
    print(":(")

Buggy submission (verdict: Runtime Error):
a = []
for i in range(5):
    a.append(int(input()))
k = input()

if a[4] - a[0] <= k:
    print("Yay!")
else:
    print(":(")
Problem p02689 (python)

Fixed submission:
n,m = map(int,input().split())
h = list(map(int,input().split()))
q = [1]*n
for i in range(m):
    a,b = map(int,input().split())
    if h[a-1] < h[b-1]:
        q[a-1] = 0
    elif h[a-1] > h[b-1]:
        q[b-1] = 0
    else:
        q[a-1] = 0
        q[b-1] = 0
print(q.count(1))

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
h = list(map(int,input().split()))
q = [1]*1
for i in range(m):
    a,b = map(int,input().split())
    if h[a-1] < h[b-1]:
        q[a-1] = 0
    elif h[a-1] > h[b-1]:
        q[b-1] = 0
    else:
        q[a-1] = 0
        q[b-1] = 0
print(q.count(1))
Problem p02990 (python)

Fixed submission:
import math

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

n,k = map(int,input().split())
mod = 10**9 + 7
for i in range(1,k+1):
    if n-k+1 < i:
        print(0)
    elif k-i== 0:
        print(combinations_count(n-k+1,i)% mod)
    else:
        a = math.factorial(k-1)//(math.factorial(k-i)*math.factorial(i-1))
        print((combinations_count(n-k+1,i)*a) % mod)

Buggy submission (verdict: Runtime Error):
import math

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

n,k = map(int,input().split())
mod = 10**9 + 7
for i in range(1,k+1):
    if n-k+1 < i:
        print(0)
    elif k-i== 0:
        print(combinations_count(n-k+1,i)% mod)
    else:
        a = int(math.factorial(k-1)/(math.factorial(k-i)*math.factorial(i-1)))
        print((combinations_count(n-k+1,i)*a) % mod)

Buggy submission (verdict: Runtime Error):
import math

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

n,k = map(int,input().split())
mod = 10**9 + 7
for i in range(1,k+1):
    if k-i== 0:
        print(combinations_count(n-k+1,i)% mod)
    else:
        print((combinations_count(n-k+1,i)*combinations_count(k-i+1,i-1) ) % mod)

Buggy submission (verdict: Runtime Error):
import math

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

n,k = map(int,input().split())
mod = 10**9 + 7
for i in range(1,k+1):
    print((combinations_count(n-k+1,i)*i**(k-i) ) % mod)
Problem p03135 (python)

Fixed submission:
s = list(map(float ,input().split( )))
print(s[0]/s[1])

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

L_max = max(L)
L_sum = sum(L)

if L_max < L_sum - L_max:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s = input().split( )
print(s[0]/s[1])
Problem p03242 (python)

Fixed submission:
a = input()
b = []
for i in range(3):
    if a[i] == '1':
        b.append('9')
    else:
        b.append('1')
print(''.join(b))

Buggy submission (verdict: Runtime Error):
num = str(input())
for i in range(3):
    if num[i] == '1':
        num[i] = '9'
    else:
        num[i] = '1':
answer = num[0]+num[1]+num[2]
print(int(answer))
Problem p03315 (python)

Fixed submission:
s = sorted(input())
ans = 0
for i in s:
    if i == '+':
        ans+=1
    else:
        ans -=1
print(ans)

Buggy submission (verdict: Runtime Error):
s = sorted(input().split())
ans = 0
for i in s:
    if s[i] == '+':
        ans+=1
    else:
        ans -=1
print(ans)

Buggy submission (verdict: Runtime Error):
s = sorted(input().split())
ans = 0
for i in s:
    if s[i] == '+':
        ans+=1
    else:
        ans -=1
print('ans')

Buggy submission (verdict: Runtime Error):
s = sorted(input())
ans = 0
for i in s:
    if s[i] == '+':
        ans+=1
    else:
        ans -=1
print('ans')
Problem p02819 (python)

Fixed submission:
#C
x = int(input())
r = int(x**0.5)+1
l = len(str(x)) 
lst = [i for i in range(x,x+r)]

for i in range(2,r):
    for j in lst:
        if j % i == 0:
            lst.remove(j)
print(min(lst))

Buggy submission (verdict: Runtime Error):
#C
from sympy import sieve
x = int(input())
print(min([i for i in sieve.primerange(x,10**6)]))
Problem p02831 (python)

Fixed submission:
from fractions import gcd
a, b = list(map(int,input().split()))
print(int(a * b//gcd(a, b)))

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

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

Buggy submission (verdict: Runtime Error):
import math
a, b = list(map(int,input().split()))
print(int(a * b / math.gcd(a, b)))
Problem p02699 (python)

Fixed submission:
S, W = map(int,input().split())
if S <= W:
    print('unsafe')
else:
    print('safe')

Buggy submission (verdict: Runtime Error):
N = int(input())
S = []
for i in range(N):
    S.append(input())
print(set(S))
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):
N,M=map(int,input().split())

x=list(range(1,N+1,1))


if N%2==1:
    for i in range(M):
        print(x.pop(0),x.pop(-1))
        
else:
    x_f=x[1:int(N/2+1)]
    x_l=x[int(N/2+1):]
    
    
    count=0
    
    for i in range(M):
        if len(x_f)>1:
            print(x_f.pop(0),x_f.pop(-1))
            count+=1
            
        if count==M:
            break
        
        if len(x_l)>1:
            print(x_l.pop(0),x_l.pop(-1))
            count+=1
            
        if count==M:
            break

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

def g(t):
    return int(A*t/B)-A*int(t/B)

x=[i for i in range(0,N,1)]

y=[g(i) for i in x]

print(max(y))

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

def f(t):
    return int(t)

Max_x=0

for i in range(N):
    if f(A*i/B)-A*f(i/B)<f(A*(i+1)/B)-A*f((i+1)/B):
        Max_x=i+1
        
print(f(A*Max_x/B)-A*f(Max_x/B))
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=int(input())
W=int(input())

if S<=W:
    print('unsafe')
    
else:
    print('safe')

Buggy submission (verdict: Runtime Error):
if S<=W:
    print('unsafe')
    
else:
    print('safe')
Problem p02659 (python)

Fixed submission:
A,B = input().split()
A = int(A)
B = round(float(B)*100)

res = (A*B)//100
print(res)

Buggy submission (verdict: Runtime Error):

A,B = input.split()
A = int(A)
B = round(float(B)*100)

res = (A*B)//100
print(res)

Buggy submission (verdict: Runtime Error):
def main():
  A,B = input.split()
  A = int(A)
  B = round(float(B)*100)
 
  res = (A*B)//100
  print(res)
 
main()

Buggy submission (verdict: Runtime Error):
def main():
  A,B = input.split()
  A = int(A)
  B = round(float(B)*100)

  res = (A*B)//100
  print(res)
  return
 
main()

Buggy submission (verdict: Runtime Error):
def main():
  A,B = map(int,input.split())
  
  B*=100
  res = (A*B)/100
  print(res)
  return
 
main()

Buggy submission (verdict: Runtime Error):
def main():
  A,B = map(int,input.split())
  
  B*=100
  res = (A*B)//100
  print(res)
  return
 
main()

Buggy submission (verdict: Runtime Error):
def main():
  A,B = map(int,input.split())
  
  B*=100
  
  print((A*B)//100)
  return

main()
Problem p02847 (python)

Fixed submission:
# coding: utf-8
# Your code here!

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

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!

S = input()
if S == "MON":
    print(6)
elif S == "TUE":
    print(5)
elif S == "WED":
    print(4)
elif S == "THU":
    print(3)
elif S == "FRI":
    print(2)
elif S == "SAT":
    print(1)
else:
    print(7)
Problem p02990 (python)

Fixed submission:


# coding: utf-8
# Your code here!
from math import factorial

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

def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

for i in range(1, K + 1):
	if N - K + 1 < i:
        	print(0)
	else:
		print(cmb(K - 1,i -1) * cmb(N - K + 1, i) % (pow(10,9) + 7))

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
from math import factorial

N, K = map(int, input().split())
for i in range(1, K + 1):
        a = (factorial(K - 1) // factorial(K - 1 - (i - 1)) // factorial(i - 1)) * (factorial(N - K + 1) // factorial(N - K + 1 - i) // factorial(i)) % (pow(10,9) + 7)
        print(a)
Problem p03986 (python)

Fixed submission:
# coding: utf-8
# Your code here!

X = list(input())
num = len(X)
stack = []

for i in X:
    if i == "S":
        stack.append(i)
    else:
        if stack == [] or stack[-1] == "T":
            stack.append(i)
        else:
            stack.pop()
print(len(stack))

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!

X = list(input())
num = len(X)
stack = []

for i in X:
    if i == "S":
        stack.append(i)
    else:
        if stack[-1] == "T" or stack[0] == "":
            stack.append(i)
        else:
            stack.pop()
print(len(stack))

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!

X = list(input())
num = len(X)
stack = [X[0]]

for i in range(1, num):
    if X[i] == "S":
        stack.append("S")
    else:
        if stack[-1] == "T" or stack[0] == "":
            stack.append("T")
        else:
            stack.pop(-1)
print(len(stack))
Problem p03041 (python)

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

s = list(input())
s[k - 1] = s[k - 1].lower()

x = ''.join(s)
print(x)

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

s = list(input())

if n == 1:
    print(s.lower())
    break
else:
    l = []
    for x in s:
        if x == s[k - 1]:
            l.append(x.lower())
        else:
            l.append(x)
    a = ''.join(l)
    print(a)
Problem p02676 (python)

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

if len(S) <= K:
  print(S)
else:
  print(S[:K]+'...')

Buggy submission (verdict: Runtime Error):
K = int(input())
S = input()
if len(S) <= K:
  print(S)
else:
  l = S.split()
  for i in range(len(S)-K):
    l.pop(-1)
  print(''.join(l))

Buggy submission (verdict: Runtime Error):
K = int(input())
S = input()
if len(S) <= K:
  print(S)
else:
  l = S.split()
  l.pop(K:)
  print(''.join(l))