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

Fixed submission:
n = int(input())
if n == 1:
    print('Hello World')
else:
    a, b = [int(input()) for i in range(2)]
    print(a+b)

Buggy submission (verdict: Runtime Error):
n, a, b = [int(input()) for i in range(3)]
if n==1:
  print('Hello World')
else:
  print(a+b)
Problem p03239 (python)

Fixed submission:
N,T=map(int,input().split())
ans=100000000
for i in range(N):
  c,t=map(int,input().split())
  if t>T: continue
  ans=min(c,ans)
print(ans if ans<100000000 else 'TLE')

Buggy submission (verdict: Runtime Error):
N,T=map(int,input())
ans=100000000
for i in range(n):
  c,t=map(int,input().split())
  if t>T: continue
  ans=min(c,ans)
print(ans if ans<100000000 else 'TLE')
Problem p03260 (python)

Fixed submission:
a, b = map(int, input().split())
print('No' if a%2==0 or b%2==0 else 'Yes')

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
print'No' if a%2==0 or b%2==0 else 'Yes'

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
print(a%2==0 or b%2==0 ? 'No' : 'Yes')
Problem p03261 (python)

Fixed submission:
n=int(input())
w=[input() for _ in range(n)]
ans='Yes'
for i in range(1,n):
  if w[i-1][-1]!=w[i][0]:
    ans='No'
    break
  for j in range(i):
    if w[i]==w[j]:
      ans='No'
      break
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
w=[int(x) for x in input().split()]
ans='Yes'
for i in range(1,n):
  if w[i-1][-1]!=w[i][0]:
    ans='No'
    break
  for j in range(i):
    if w[i]==w[j]:
      ans='No'
      break
print(ans)
Problem p03264 (python)

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

Buggy submission (verdict: Runtime Error):
k = input()
if k % 2 == 1:
    print(k//2 * (k//2+1))
else:
    print(k//2 * k//2)

Buggy submission (verdict: Runtime Error):
k = input()
if k % 2 == 1:
    print((k//2) * (k//2+1))
else:
    print((k//2) * (k//2))

Buggy submission (verdict: Runtime Error):
k = map(int, input().split())
if k%2==1:
  print((k//2) * (k//2+1))
else:
  print((k//2) * (k//2))

Buggy submission (verdict: Runtime Error):
k = map(int, input().split())
if k%2==1:
  print((k//2) * (l//2+1))
else:
  print((k//2) *(k//2))
Problem p03273 (python)

Fixed submission:
h,w=map(int,input().split())
a=[]
for i in range(h):
  tmp=input()
  if len(tmp)!=tmp.count('.'):
    a.append(tmp)
  else:
    h-=1

b=[]
for i in range(w):
  cnt=0
  for j in range(h):
    if a[j][i]=='.':
      cnt+=1
  if cnt==h:
    b.append(0)
  else:
    b.append(1)

for i in range(h):
  for j in range(w):
    if b[j]:
      print(a[i][j], end='')
  print()

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
a=[]
for i in range(h):
  tmp=input()
  if len(tmp)!=tmp.count('.'):
    a.append(tmp)
  else:
    h-=1
    
a=list(zip(*a))
for i in range(w):
  if len(a[i])==a[i].count('.'):
    del a[i]
    w-=1
    i-=1
    
a=list(zip(*a))
for i in range(h):
  print(a[i])
Problem p03293 (python)

Fixed submission:
s=input()
t=input()
for i in range(1,len(s)+1):
  if t==s[-i:]+s[:-i]:
    print('Yes')
    exit()
print('No')

Buggy submission (verdict: Runtime Error):
s,t=input().split()
for i in range(1,len(s)+1):
  if t==s[-i:]+s[:-i]:
    print('Yes')
    exit()
print('No')
Problem p03308 (python)

Fixed submission:
n=int(input())
a=[int(x) for x in input().split()]
ans=0 
for i in range(n):
  for j in range(i+1, n):
    ans=max(ans, abs(a[i]-a[j]))
print(ans)

Buggy submission (verdict: Runtime Error):
n=input()
a=list(map(int, input().split()))
ans=0 
for i in range(n):
  for j in range(i+1, n):
    ans=max(ans, abs(a[i]-a[j]))
print(ans)

Buggy submission (verdict: Runtime Error):
n=input()
a=[int(x) for x in input().split()]
ans=0
for i in range(n):
  for j in range(i+1, n):
    ans=max(ans, abs(a[i]-a[j]))
print(ans)
Problem p03316 (python)

Fixed submission:
s=input()
n=0
for x in s: n += int(x)
print('Yes' if int(s)%n==0 else 'No')

Buggy submission (verdict: Runtime Error):
s=input()
n=0
for x in s: n += int(x)
print('Yes' if s%n==0 else 'No')
Problem p03360 (python)

Fixed submission:
a=list(map(int,input().split()))
k=int(input())
for _ in range(k):
  a.sort()
  a[2]*=2
print(sum(a))

Buggy submission (verdict: Runtime Error):
a=list(map(int,input().split()))
for _ in range(int(input()):
  a.sort()
  a[2]*=2
print(sum(a))
Problem p03377 (python)

Fixed submission:
a, b, x = map(int, input().split())
if a==x:
  print('YES')
elif a<x and a+b>=x:
  print('YES')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
a, b, x = map(int, input())
if a<=x:
  print('YES')
elif a+b>=x:
  print('YES')
else:
  print('NO')
Problem p03378 (python)

Fixed submission:
n,m,x=map(int,input().split())
a=[0]*(n+1)
for i in input().split(): a[int(i)]=1
print(min(sum(a[x:n]),sum(a[0:x])))

Buggy submission (verdict: Runtime Error):
n,m,x=map(int,input().split())
a=[0]*(n+1)
for i in input().split(): a[int(i)]=1
print(min(sum(a[x:n]),sum(a[0:x]))
Problem p03385 (python)

Fixed submission:
s = input()
print('Yes' if ('a' in s) and ('b' in s) and ('c' in s) else 'No')

Buggy submission (verdict: Runtime Error):
s = input()
print((s in 'a') and (s in 'b') and (s in 'c') ? 'Yes' : 'No')
Problem p03399 (python)

Fixed submission:
a = [int(input()) for i in range(4)]
print(min(a[0], a[1])+min(a[2], a[3]))

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int, input().split())
print(min(a,b)+min(c,d))
Problem p03425 (python)

Fixed submission:
comp='MARCH'
cnt=[0,0,0,0,0]

n=int(input())
for i in range(n):
  word=input()
  for j in range(len(comp)):
    if word[0]==comp[j]: cnt[j]+=1

ans = 0
for i in range(len(cnt)):
  for j in range(i+1, len(cnt)):
      for k in range(j+1, len(cnt)):
        ans += cnt[i]*cnt[j]*cnt[k]
        
print(ans)

Buggy submission (verdict: Runtime Error):
import math

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

d={'M':0,'A':0,'R':0,'C':0,'H':0}
n=int(input())
for i in range(n):
  word=input()
  if word[0] in d: d[word[0]]+=1

m = sum(d.values())
max = combinations_count(m,3)

if m<3:
  print(0)
  exit()

sub = 0
for i in d.values():
  if i>=3: sub += combinations_count(i, 3)
  if i>=2: sub += combinations_count(i, 2) * (m-2)

print(max - sub)

Buggy submission (verdict: Runtime Error):
import math

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

d={'M':0,'A':0,'R':0,'C':0,'H':0}
n=int(input())
for i in range(n):
  word=input()
  if word[0] in d:d[word[0]]+=1

m = sum(d.values())
max = combinations_count(m,3) if m!=0 else 0
sub = 0
for i in d.values():
  if i>2: sub += combinations_count(i, 3)
  elif i>1: sub += combinations_count(i, 2) * (m-2)

print(max - sub)
Problem p03609 (python)

Fixed submission:
x,t=map(int,input().split())
ans = x - t
print(ans if ans>0 else 0)

Buggy submission (verdict: Runtime Error):
ans = int(input())-int(input())
print(ans if ans>0 else 0)
Problem p03635 (python)

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

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

Fixed submission:
x,a,b=map(int,input().split())
print('delicious' if b-a<=0 else 'safe' if b-a<x+1 else 'dangerous')

Buggy submission (verdict: Runtime Error):
x,a,b=map(int,input().split())
print('delicious' if b-a<=0 else 'safe' if b-a<x+1 else 'dangerous
')
Problem p03693 (python)

Fixed submission:
r,g,b=input().split()
print('YES' if int(r+g+b)%4==0 else 'NO')

Buggy submission (verdict: Runtime Error):
r,g,b=input().split()
print('YES' if eval('r+g+b%4==0') else 'NO')
Problem p03737 (python)

Fixed submission:
a,b,c=input().split()
print((a[0]+b[0]+c[0]).upper())

Buggy submission (verdict: Runtime Error):
a,b,c=input().split()
print(upper(a[0]+b[0]+c[0])
Problem p03773 (python)

Fixed submission:
a,b=map(int,input().split())
sum=a+b
print(sum if sum<24 else sum-24)

Buggy submission (verdict: Runtime Error):
a,b=input().split()
sum=a+b
print(sum if sum<24 else sum-24)
Problem p02993 (python)

Fixed submission:
s = input()
a = 13
c = 0
for i in s:
  if int(i) == a:
    c = 1
    break 
  a = int(i)
 
if c==1:
  print("Bad")
else:
  print("Good")

Buggy submission (verdict: Runtime Error):
S=input()
if S[0]==S[1] or S[1]==S[2] or S[2]==S[3]:
  print("Bad")
 else:
  print("Good")
Problem p04043 (python)

Fixed submission:
A, B, C = map(int, input().split())
if A*B*C == 5*5*7:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
A, B, C = map(int, input().split())
if sum(A,B,C) == 17:
  print("YEAS")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
nums = list(input().split())
if sum(nums) == 17:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
numlist = list(input())
if sum(numlist) == 17:
  print("YES")
else:
  print("NO")
Problem p03162 (python)

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

if n > 1:
    for _ in range(n-1):
        a_, b_, c_ = list(map(int, input().split()))
        a_ += max(b, c)
        b_ += max(a, c)
        c_ += max(a, b)
        a, b, c = a_, b_, c_

print(max(a, b, c))
"""
ちゃんと解いたVer
"""

Buggy submission (verdict: Runtime Error):
import os, sys
import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")
 
sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10**18
MOD = 10**9 + 7

def n(): return int(sys.stdin.readline())
def li(): return list(map(int, sys.stdin.readline().split()))
def bulk_li(): return list(map(lambda s: list(map(int, s.split())), sys.stdin.readlines()))

N = n()
abc = bulk_li()  # [[a_i, b_i, c_i]...]

dp = np.zeros((N, 3), dtype='int32')  # [[Ai, Bi, Ci]...]
# fl = np.zeros((N, 3), dtype='int32')  # [[fl_ai, fl_bi, fl_ci]...]
choice = np.ones((3,3)) - np.diag([1]*3)

S = [
    [0, 1],
    [0, 2],
    [1, 0],
    [1, 2],
    [2, 0],
    [2, 1],
]

T = [
    [[1, 1], [2, 2]],
    [[0, 0], [2, 2]],
    [[0, 0], [1, 1]]
]

for j in range(3):
    dp[0][j] = abc[0][j]
    dp[1][j] = max(abc[0]) + abc[1][j]

for i in range(N-2):
    for j in range(3):
        pattern = S + T[j]
        next = [dp[i][j] + abc[i+1][j_] for j, j_ in pattern]
        # print(i, j, next)
        dp[i+2][j] = max(next) + abc[i+2][j]

# print(abc)
# print(dp)
print(max(dp[N-1]))


"""

"""
Problem p03164 (python)

Fixed submission:
import numpy as np
N, W = map(int, input().split())
ndp = np.full(1000*100+1, 10**11, dtype=np.int64)
ndp[0] = 0

for _ in range(N):
    w, v = map(int,input().split())

    np.minimum(ndp[:-v] + w, ndp[v:], out = ndp[v:])

print(np.max(np.where(ndp<=W)))

"""
https://atcoder.jp/contests/dp/submissions/6646897
から失敬

貪欲法はこの手の書き方で表現できるっぽい。
価値テープのなかで同価値のindexでは、より少ない重量の物品で済む方を残していく。
したがってテープの初期化は擬似infで行い、価値0の部分は重さも0で始める。

"""

Buggy submission (verdict: Runtime Error):
import numpy as np
N, W = map(int, input().split())
ndp = np.zeros(W+1, dtype= np.int64)
for _ in range(N):
    w, v = map(int,input().split())

    # 離散より連続で扱った方が問題が簡単になる。
    np.maximum(ndp[:-w] + v, ndp[w:], out = ndp[w:])
print(ndp[-1])
Problem p03732 (python)

Fixed submission:
# coding: utf-8

if __name__ == "__main__":
	n, w = map(int, input().split())
	vs, ws = [], []

	for i in range(n):
		w_, v_ = map(int, input().split())
		ws.append(w_)
		vs.append(v_)

	nap_memo = {}
	def nap(i, j):
		key = str(i)+':'+str(j)

		if key in nap_memo:
			return nap_memo[key]

		r = 0
		if i == n:
			r = 0
		elif j < ws[i]:
			r = nap(i+1, j)
		else:
			r = max(nap(i+1, j),
					nap(i+1, j-ws[i]) + vs[i])

		nap_memo[key] = r
		return r

	print(nap(0, w))

Buggy submission (verdict: Runtime Error):
# coding: utf-8

if __name__ == "__main__":
	n, w = map(int,input().split())
	v, w = [], []

	for i in range(n):
		w_, v_ = map(int,input().split())
		w.append(w_)
		v.append(v_)

	nap_memo = {}
	def nap(i,j):
		key = str(i)+':'+str(j)

		if key in nap_memo:
			return nap_memo[key]

		r = 0
		if i == n:
			r = 0
		elif j < w[i]:
			r = nap(i+1,j)
		else:
			r = max(nap(i+1, j),
					nap(i+1, j-w[i]) + v[i])

		nap_memo[key] = r
		return r

	print(nap(0,w))
Problem p03796 (python)

Fixed submission:
import math
n = int(input())
print(math.factorial(n)%int(10**9+7))

Buggy submission (verdict: Runtime Error):
n = int(input())
import sys
sys.setrecursionlimit(100000)
def fa(n, memo=dict()):
	if n==0 or n == 1:
		return 1
	elif n in memo.keys():
		return memo[n]
	else:
		temp = fa(n-1)*n %int(10**9+7)
		memo[n] = temp
		return temp

print(fa(n))

Buggy submission (verdict: Runtime Error):
n = int(input())
import sys
sys.setrecursionlimit(100000)
def fa(n, memo=dict()):
	if n==0 or n == 1:
		return 1
	elif n in memo.keys():
		return memo[n]
	else:
		temp = fa(n-1)*n
		memo[n] = temp
		return temp

print(fa(n))

Buggy submission (verdict: Runtime Error):
def f(n, memo = dict()):
	if n == 0 or n == 1:
		return 1
	elif n in memo.keys():
		return memo[n]
	else:
		temp = (f(n-1) * n) % int(10e9+7)
		memo[n] = temp
		return temp

n = int(input())
print(f(n))
Problem p03797 (python)

Fixed submission:
s, c = input().split()
s = int(s); c = int(c)
if s >= c//2:
	print(c//2)
else:
	print(s+(c-s*2)//4)

Buggy submission (verdict: Runtime Error):


# if a > b return true
def compare(a, b): # a also b are both string
	l = max(len(a), len(b))
	a_ = a.rjust(l, '0')
	b_ = b.rjust(l, '0')
	return a_ > b_


def divide(num, den): # den is integer
	quo = ''; resi = 0
	digit = len(num) if int(num[0]) >= den else len(num)-1
	for i in range(len(num)):
		temp = (int(num[i])+resi*10)//den
#		print('temp', temp)
		resi = (int(num[i])+resi*10)%den
#		print('resi', resi)
		quo += str(temp) if temp != 0 else ''
	return quo.ljust(digit, '0')

def multi(a, n):
	s = ''; resi = 0
	for i in range(len(a))[::-1]:
		temp = (int(a[i])*n + resi)%10
#		print('temp', temp)
		resi = (int(a[i])*n + resi)//10
#		print('resi', resi)
		s = str(temp) + s
	return s


def plus(a, b):
	l = max(len(a), len(b))
	a_ = a.rjust(l, '0')
	b_ = b.rjust(l, '0')

	s = ''; resi = 0
	for i in range(l)[::-1]:
		temp = (int(a_[i]) + int(b_[i]) + resi)%10
#		print('temp', temp)
		resi = (int(a_[i]) + int(b_[i]) + resi)//10
#		print('resi', resi)
		s = str(temp) + s
	return s

# a is higher than b
def minus(a, b):
	l = max(len(a), len(b))
	a_ = a.rjust(l, '0')
	b_ = b.rjust(l, '0')

	s = ''; bollow = 0
	for i in range(l)[::-1]:
		temp = int(a_[i]) - int(b_[i]) - bollow
#		print('temp', temp)
		bollow = 0
		if temp >= 0:
			s = str(temp) + s
		else:
			bollow = 1
			s = str(temp + 10) + s
	return s

if compare(s, divide(c, 2)) or s == c:
	print(divide(c, 2))
else:
	print(plus(s, divide(minus(c, multi(s, 2)), 4)))

Buggy submission (verdict: Runtime Error):
s, c = map(int, ip().split())
if s >= c//2:
	print(c//2)
else:
	print(s + (c-s*2)//4)
Problem p02817 (python)

Fixed submission:
s = input().split()
print(s[1]+s[0])

Buggy submission (verdict: Runtime Error):
a=input()
print(input()+a)
Problem p02789 (python)

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

n,m = map(int, input().split())

if n == m:
    print('Yes')
else:
    print('No')

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

n,m = map(int, input.split())

if n == m:
    print('Yes')
else:
    print('No')
Problem p02924 (python)

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

Buggy submission (verdict: Runtime Error):
n = int(input())+1
l1 = range(1,n+1)
l2 = list(l1[1:n-1])
l2.append(1)
total = 0
for a,b in zip(l1,l2):
    total += a%b
print(total)
Problem p02957 (python)

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

if (a+b) % 2 != 0:
    print('IMPOSSIBLE')
else:
    print((a+b)//2)

Buggy submission (verdict: Runtime Error):
N = int(input())
ps = list(map(int, input().split()))
 
count = 0
 
for p,n in zip(ps,range(N)):
    if p != n:
        count += 1
if count == 2:
    print('YES')
else:
    print('NO')
Problem p02982 (python)

Fixed submission:
def solve():
    n,d = map(int, input().split())
    L = [[int(x) for x in input().split()] for _ in range(n)]
    count = 0
    for i in range(n):
        y = L[i]
        for z in L[i+1:]:
            total = 0
            for a,b in zip(y,z):
                total += (a-b)**2
            if total**0.5 == int(total**0.5):
                count += 1
    return count
    
if __name__ == '__main__':
    print(solve())

Buggy submission (verdict: Runtime Error):
import sys

def solve():
    n,d = map(int, input().split())
    l = [[int(x) for x in sys.stdin.readlines()] for _ in range(n)]
    count = 0
    for i in range(n):
        Y = l[i]
        for Z in l[i+1:]:
            total = 0
            for y,z in zip(Y,Z):
                total += (y-z)**2
            d = total**0.5
            if d == int(d):
                count += 1
    return count

if __name__ == '__main__':
    print(solve())
Problem p02983 (python)

Fixed submission:
def solve():
    l,r = map(int, input().split())
    if r-l<2019:
        arr = [i*j%2019 for i in range(l,r) for j in range(i+1,r+1)]
        return min(arr)
    else:
        return 0


if __name__ == '__main__':
    print(solve())

Buggy submission (verdict: Runtime Error):
def solve():
    x = int(input())
    l = [i**j for i in range(1,x+1) for j in range(1,x+1) if i**j<=x]
    return max(l)
        
if __name__ == '__main__':
    print(solve())
Problem p03238 (python)

Fixed submission:
n = input()
if n == '1':
    print('Hello World')
else:
    a = int(input())
    b = int(input())
    print(a+b)

Buggy submission (verdict: Runtime Error):
Hello World
Problem p03324 (python)

Fixed submission:
d,n = map(int, input().split())
if n == 100:
    n += 1
a = n*100**d
print(a)

Buggy submission (verdict: Runtime Error):
l = [i*100**d for i in range(1,n+1) if i*100**d % 100 != 0]

Buggy submission (verdict: Runtime Error):
d,n = map(int, input().split())
l = [i*100**d for i in range(1,n+1) if i*100**d%100!=0]
print(l[-1])
Problem p03352 (python)

Fixed submission:
def solve():
    x = int(input())
    if x < 4:
        return 1
    elif x < 8:
        return 4
    elif x < 9:
        return 8
    l = [i**j for i in range(1,x+1) for j in range(2,int(x**0.5)) if i**j<=x]
    return max(l)
        
if __name__ == '__main__':
    print(solve())

Buggy submission (verdict: Runtime Error):
def solve():
    x = int(input())
    l = [i**j for i in range(1,x+1) for j in range(2,x+1) if i**j<=x]
    return max(l)
        
if __name__ == '__main__':
    print(solve())
Problem p03386 (python)

Fixed submission:
a,b,k = map(int, input().split())
if b-a+1>k*2:
    for i in range(a,a+k):
        print(i)
    for i in range(b-k+1,b+1):
        print(i)
else:
    for i in range(a,b+1):
        print(i)

Buggy submission (verdict: Runtime Error):
a,b,k = map(int, input().split())
for i in sorted(set(list(range(a,b+1))[:k]+list(range(a,b+1))[-k:])):
    print(i)

Buggy submission (verdict: Runtime Error):
a,b,k = map(int, input().split())
l = list(range(a,b+1))
for i in sorted(set(l[:k]+l[-k:])):
    print(i)
Problem p03401 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
total = 0
p = 0
for a in A:
    total += abs(p-a)
    p = a
total += abs(p)

print(total - abs(A[0]) - abs(A[0]-A[1]) + abs(A[1]))
for n in range(1,N-1):
    print(total - abs(A[n-1]-A[n]) - abs(A[n]-A[n+1]) + abs(A[n-1]-A[n+1]))
print(total - abs(A[N-2]-A[N-1]) - abs(A[N-1]) + abs(A[N-2]))

Buggy submission (verdict: Runtime Error):
6
-679 -2409 -3258 3095 -3291 -4462
Problem p03501 (python)

Fixed submission:
n,a,b = map(int, input().split())
print(min(a*n,b))

Buggy submission (verdict: Runtime Error):
n,a,b = map(int, input().split())
print(min(a*t,b))
Problem p03555 (python)

Fixed submission:
a = input()
b = input()
print('YES' if a==b[::-1] else 'NO')

Buggy submission (verdict: Runtime Error):
a = input()
b = input()
print('YES' if a==b[::-1])
Problem p03636 (python)

Fixed submission:
a,*b,c = input()
print(a,len(b),c, sep='')

Buggy submission (verdict: Runtime Error):
a,*b,c = input()
print(a,*b,c, sep='')
Problem p03672 (python)

Fixed submission:
s = input()
l = len(s)
h = l//2
if l%2==0:
    for i in range(1,h):
        if s[0:h-i] == s[h-i:-2*i]:
            print(len(s[:-2*i]))
            break
else:
    for i in range(1,h):
        if s[0:h-i+1] == s[h-i+1:-2*i+1]:
            print(len(s[:-2*i+1]))
            break

Buggy submission (verdict: Runtime Error):
s = input()
while len(s)!=0:
    s.pop()
    if len(s)%2==0 and s[:len(s)//2]==s[len(s)//2:]:
        print(len(s))
        exit()

Buggy submission (verdict: Runtime Error):
s = input()
while True:
    s.pop()
    if len(s)%2==0 and s[:len(s)//2]==s[len(s)//2:]:
        print(len(s))
        exit()
Problem p03796 (python)

Fixed submission:
import math
N = int(input())
print(math.factorial(N)%(10**9+7))

Buggy submission (verdict: Runtime Error):
N = int(input())
power_r = 1
for n in range(2,N+1):
    power_r = power_r*n % (10**9+7)
print(factorial(N))
Problem p02765 (python)

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

if(N<10):
  print(R+100*(10-N))
else:
  print(R)

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

if(N<10):
  print(R+100*(10-N))
else:
  print(R)

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

if(N<10):
  print(R+(100*(10-N)))
else:
  print(R)
Problem p02780 (python)

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

ans = 0
for i in range(k):
    ans += (p[i] + 1) / 2
t = ans
for i in range(k, n):
    t += (p[i] + 1) / 2 - (p[i - k] + 1) / 2
    ans = max(ans, t)

print(ans)

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

def S(n):
    return n * (n + 1) // 2

for i in range(k):
    ans += S(p[i]) / p[i]

for i in range(k, n):
    ans = max(ans, ans + S(p[i]) / p[i] - S(p[i - k]) / p[i - k])
    
print(ans)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
p = list(map(int, input().split()))
 
def S(n):
  return n * (n + 1) // 2

for i in range(k):
  ans += S(p[i]) / p[i]

for i in range(k, n):
  ans = max(ans, ans + S(p[i]) / p[i] - S(p[i - k] / p[i - k])
  
print(ans)

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

def S(n):
  return n * (n + 1) // 2

b = 0
s = sum(p[:k])
for i in range(k, n):
  tmp = s - p[i - k] + p[i]
  if tmp > s:
    s = tmp
    b = i
ans = 0
for i in range(b, b + k):
  ans += S(p[i]) / p[i]
  
print(ans)
Problem p02787 (python)

Fixed submission:
h, n = map(int, input().split())
p = [0] * n
c = [0] * n

inf = 1e9 + 1

for i in range(n):
    pp, cc = map(int, input().split())
    p[i] = pp
    c[i] = cc
    
dp = [inf] * (h + max(p))
dp[0] = 0

for i in range(n):
    for j in range(h):
        dp[j + p[i]] = min(dp[j + p[i]], dp[j] + c[i])
    
print(min(dp[h:]))

Buggy submission (verdict: Runtime Error):
h, n = map(int, input().split())
p = [0] * n
c = [0] * n

inf = 1e9 + 1

for i in range(n):
    pp, cc = map(int, input().split())
    p[i] = pp
    c[i] = cc
    
dp = [inf] * (h + max(p))
dp[0] = 0

for i in range(n):
    for j in range(h):
        dp[j + p[i]] = min(dp[j + p[i]], dp[j] + c[i])
    
print(min(dp[h:]))