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

Fixed submission:
N = int(input())
out = 0
for i in range(1,N+1):
    if i%3 == 0 and i%5 == 0 or i%3==0 or i%5==0:
       continue
    out += i
print(out)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = 0
for i in range(1, N+1):
  if i%3==0 or i%5==0 or (i%3==0 and i%5==0):
	continue
  S+=i
print(S)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = 0
for i in range(1, N+1):
  if i%3==0 or i%5==0 or i%3==0 and i%5==0
		continue
  S+=i
print(S)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = 0
for i in range(1, N+1):
  if i%3==0 or i%5==0 or i%3==0 and i%5==0
	continue
  S+=i
print(S)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = 0
for i in range(1,N+1):
  if i%3==0 or i%5==0 or i%3==0 and i%5==0
	continue
  S +=i
print(S)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = 0
for in in range(1,N+1):
  if i%3==0 or i%5==0 or i%3==0 and i%5==0
	continue
  S +=i
print(S)

Buggy submission (verdict: Runtime Error):
N = int(input())
out = 0
for in in range(1,N+1):
  if i%3==0 and i%5==0 or i%3==0 or i%5==0
	continue
  out +=i
print(out)
Problem p02754 (python)

Fixed submission:
n, a, b = map(int, input().split())
period = a+b
times = n//period
k = n%period
n =  a if k >a else k
print(times*a + n)

Buggy submission (verdict: Runtime Error):
a, b = [int(x) for x in input().split()]
 
if (b < a):
    temp = b
    b = a
    a = temp
 
 
x = 1
while True:
    if (int(x*0.08) == a and int(x*0.1) == b):
        print(x)
        break
    else:
        if (x > 1500):
            print(-1)
            break
        else:
            x += 1
Problem p02835 (python)

Fixed submission:
a = [int(x) for x in input().split(" ")]
print("bust") if sum(a)>=22 else print("win")

Buggy submission (verdict: Runtime Error):
a = input("Enter number of a:")
b = input("Enter number of b:")
c = input("Enter number of c:")
if(int(a+b+c)>=int(22)):
    print("bust")
else:
    print("win")
Problem p02572 (python)

Fixed submission:
#標準入力
N = int(input())
A = list(map(int, input().split()))

#累積和
S = [0]*N
for n in range(N):
  S[n] = S[n-1] + A[n]

_sum = int(0)
for i in range(N-1):
  _sum = _sum + (A[i] * (S[-1] - S[i]))

#modulo
_sum = _sum % (1000000000+7)
  
print(_sum)

Buggy submission (verdict: Runtime Error):
#標準入力
N = int(input())
A = list(map(int, input().split()))
 
#累積和
S = [0]*N
for n in range(N):
  S[n] = S[n-1] + A[n]
  
_sum = int(0)
for i in range(N-1):
  _sum = _sum + int((A[i] * (S[N] - S[i])))

#modulo
_sum = _sum % (1000000000+7)
  
print(_sum)

Buggy submission (verdict: Runtime Error):
#標準入力
N = int(input())
A = list(map(int, input().split()))
 
#累積和
S = [0]*N
for n in range(N):
  S[n] = S[n-1] + A[n]
  
_sum = 0
for i in range(N-1):
  _sum = _sum + (A[i] * (S[N] - S[i+1]))

#modulo
_sum = _sum % (1000000000+7)
  
print(_sum)

Buggy submission (verdict: Runtime Error):
#標準入力
N = int(input())
A = list(map(int, input().split()))
 
#累積和
S = [0]*N
for n in range(N):
  S[n] = S[n-1] + A[n]
  
_sum = 0
for i in range(N-1):
  _sum = _sum + (A[i] * (S[N] - S[i+1]))
  _sum = _sum % (1000000000+7)
  
print(_sum)

Buggy submission (verdict: Runtime Error):
#標準入力
N = int(input())
A = list(map(int, input().split()))

#累積和
S = [0]*N
for n in range(N):
	S[n] = S[n-1] + A[n]

_sum = 0
for i in range(N-1):
  _sum = _sum + (A[i] * (S[N] - S[i+1]))
  _sum = _sum % (1000000000+7)
  
print(_sum)

Buggy submission (verdict: Runtime Error):
import numpy as np
 
N = int(input())
A = np.array(map(int, input().split()))
 
A %= (1000000000+7)
_sum = 0
 
for n in range(N-1):
  for i in range(n+1):
    _sum += A[n+1] * A[i]
    _sum %= (1000000000+7)
    
print(_sum)

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

N = int(input())
A = np.array(map(int, input().split()))

A %= (1000000000+7)
_sum = 0

for n in range(N-1):
  for i in range(n+1):
    _sum += A[n+1] * A[i]
    _sum = %= (1000000000+7)
    
print(_sum)
Problem p02577 (python)

Fixed submission:
N = str(input())
 
a = []
for n in range(len(N)):
  a.append(int(N[n]))
  
if sum(a) % 9 == 0:
  print('Yes')
else:
  print('No')

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

a = []
for n in range(N):
  a.append(int(N[n]))
  
if sum(a) % 9 == 0:
  print('Yes')
else:
  print('No')
Problem p02596 (python)

Fixed submission:
K = int(input())
 
sevens = 7 % K
count = 1
 
while(sevens % K !=0):
  sevens = sevens * (10 % K) + (7 % K)
  sevens = sevens % K
  count += 1
  if count > K:
    count = -1
    break
    
print(count)

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

sevens = 7
count = 0

while(sevens % K !=0):
  count += 1
  sevens = sevens * 10 + 7
  if count > K:
    print(-1)
	break
    
print(count)
Problem p02685 (python)

Fixed submission:
# E - Colorful Blocks
import sys
sys.setrecursionlimit(10**8)

MOD = 998244353
N,M,K = map(int,input().split())
inv_M = pow(M-1,-1,MOD) if M>1 else 0
ans = 0
tmp = pow(M-1,N-1,MOD) if M>1 else 0
comb = 1
for i in range(K+1):
    ans = (ans+M*comb*tmp)%MOD
    if i==K:
        break
    tmp = (tmp*inv_M)%MOD
    comb = (comb*(N-1-i)*pow(i+1,-1,MOD))%MOD
if M==1 and K==N-1:
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
# E - Colorful Blocks
import sys
sys.setrecursionlimit(10**8)

MOD = 998244353
N,M,K = map(int,input().split())
inv_M = pow(M-1,-1,MOD)
ans = 0
tmp = pow(M-1,N-1,MOD)
comb = 1
for i in range(K+1):
    ans = (ans+M*comb*tmp)%MOD
    if i==K:
        break
    tmp = (tmp*inv_M)%MOD
    comb = (comb*(N-1-i)*pow(i+1,-1,MOD))%MOD
print(ans)

Buggy submission (verdict: Runtime Error):
# E - Colorful Blocks
import sys
sys.setrecursionlimit(10**7)

MOD = 998244353
N,M,K = map(int,input().split())
inv_M = pow(M-1,-1,MOD)
ans = 0
tmp = pow(M-1,N-1,MOD)
comb = 1
for i in range(K+1):
    ans = (ans+M*comb*tmp)%MOD
    if i==K:
        break
    tmp = (tmp*inv_M)%MOD
    comb = (comb*(N-1-i)*pow(i+1,-1,MOD))%MOD
print(ans)

Buggy submission (verdict: Runtime Error):
# E - Colorful Blocks
import sys
sys.setrecursionlimit(10**7)
MOD = 998244353
N,M,K = map(int,input().split())
inv_M = pow(M-1,-1,MOD)
ans = 0
tmp = pow(M-1,N-1,MOD)
comb = 1
for i in range(K+1):
    ans = (ans+M*comb*tmp)%MOD
    if i==K:
        break
    tmp = (tmp*inv_M)%MOD
    comb = (comb*(N-1-i)*pow(i+1,-1,MOD))%MOD
print(ans)

Buggy submission (verdict: Runtime Error):
# E - Colorful Blocks
MOD = 998244353
N,M,K = map(int,input().split())
inv_M = pow(M-1,-1,MOD)
ans = 0
tmp = pow(M-1,N-1,MOD)
comb = 1
for i in range(K+1):
    ans = (ans+M*comb*tmp)%MOD
    if i==K:
        break
    tmp = (tmp*inv_M)%MOD
    comb = (comb*(N-1-i)*pow(i+1,-1,MOD))%MOD
print(ans)

Buggy submission (verdict: Runtime Error):
# E - Colorful Blocks
MOD = 998244353
N,M,K = map(int,input().split())
inv_M = pow(M-1,-1,MOD)
ans = 0
tmp = pow(M-1,N-1,MOD)
comb = 1
for i in range(K+1):
    ans = (ans+M*comb*tmp)%MOD
    tmp = (tmp*inv_M)%MOD
    comb = (comb*(N-1-i)*pow(i+1,-1,MOD))%MOD
print(ans)
Problem p02711 (python)

Fixed submission:
# A - Lucky 7
N = input()
if '7' in N:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
# A - Lucky 7
N = input()
if '7' in a:
    print('Yes')
else:
    print('No')
Problem p02723 (python)

Fixed submission:
# A - Coffee
S = input()
if S[2]==S[3] and S[4]==S[5]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
# A - Coffee
S = int(input())
if S[2]==S[3] and S[4]==S[5]:
    print('Yes')
else:
    print('No')
Problem p02762 (python)

Fixed submission:
# D - Friend Suggestions

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def root(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.root(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.root(x)
        y = self.root(y)

        if x == y:
            return
        
        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x
    
    def same(self, x, y):
        return self.root(x) == self.root(y)

    def size(self, x):
        return -self.parents[self.root(x)]

N,M,K = map(int,input().split())
friend = UnionFind(N+1)
block = [1]*(N+1)
for _ in range(M):
    x,y = map(int,input().split())
    block[x] += 1
    block[y] += 1
    friend.union(x,y)
for _ in range(K):
    x,y = map(int,input().split())
    if friend.same(x,y):
        block[x] += 1
        block[y] += 1
ans = [friend.size(i)-block[i] for i in range(1,N+1)]
print(*ans)

Buggy submission (verdict: Runtime Error):
# D - Friend Suggestions

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def root(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.root(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.root(x)
        y = self.root(y)

        if x == y:
            return

        self.parents[x] += self.parents[y]
        self.parents[y] = x
    
    def same(self, x, y):
        return self.root(x) == self.root(y)

    def size(self, x):
        return -self.parents[self.root(x)]

N,M,K = map(int,input().split())
friend = UnionFind(N+1)
block = [1]*(N+1)
for _ in range(M):
    x,y = map(int,input().split())
    block[x] += 1
    block[y] += 1
    friend.union(x,y)
for _ in range(K):
    x,y = map(int,input().split())
    if friend.same(x,y):
        block[x] += 1
        block[y] += 1
ans = [friend.size(i)-block[i] for i in range(1,N+1)]
print(*ans)
Problem p03705 (python)

Fixed submission:
# A - A+...+B Problem

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

if A>B or (N==1 and A!=B):
    print(0)
else:
    print((N-2)*(B-A)+1)

Buggy submission (verdict: Runtime Error):
# A - A+...+B Problem

N, A, B = map(int, input())

if A>B or (N==1 and A!=B):
    print(0)
else:
    print((N-1)*B+A - (N-1)*A+B + 1)
Problem p02546 (python)

Fixed submission:
S=input()
s="s"
es="es"

if S[len(S)-1]==s:
    S=S+es
else:
    S=S+s

print(S)

Buggy submission (verdict: Runtime Error):
N=int(input()) #縦2列
XY=[map(int, input().split()) for _ in range(N)]
X,Y=[list(i) for i in zip(*XY)]
ans="No"

for j in range(0,N-2):
    if X[j]==Y[j] and X[j+1]==Y[j+1] and X[j+2]==Y[j+2]:
        ans="Yes"
        break

print(ans)
Problem p02594 (python)

Fixed submission:
X=int(input())
ans=None

if X>=30:
    ans="Yes"
else:
    ans="No"

print(ans)

Buggy submission (verdict: Runtime Error):
X=int(input())
ans=None

if X>=30:
    ans=Yes
else:
    ans=No

print(ans)

Buggy submission (verdict: Runtime Error):
X=int(input())
ans=None

if X>=30:
  ans=Yes
else:
  ans=No

print(ans)
Problem p02552 (python)

Fixed submission:
s=int(input())

if 0 == s:
    print(1)
else:
    print(0)

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

if s > 0:
    print(1)
else:
    print(0)
Problem p02659 (python)

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

for i in range(len(b)):
    if b[i] == '.':
        t = 10 ** (len(b)-1-i)
        nb = int(b[:i] + b[i+1:])

print(a*nb//t)

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

Fixed submission:
import copy

def cnt(a, m, i):
    if a[i] < m:
        a[i] += 1
    else:
        a = cnt(a, m, i-1)
        a[i] = copy.deepcopy(a[i-1])
    return a

def check(a, ab):
    score = 0
    for i in range(q):
        ai, bi = ab[i][0], ab[i][1]
        if a[bi] - a[ai] == ab[i][2]:
            score += ab[i][3]
    return score
  
n, m, q = map(int,input().split())
ab = []
for i in range(q):
    ab.append(list(map(int,input().split())))

a = [1] * (n+1)
a[0] = 0
ans = 0
while a[0] == 0:
    x = check(a, ab)
    ans = max(ans, x)
    # print(a, ans)
    a = cnt(a, m, -1)
print(ans)

Buggy submission (verdict: Runtime Error):
import copy

def cnt(a, m, i):
    if a[i] < m:
        a[i] += 1
    else:
        a = cnt(a, m, i-1)
        a[i] = copy.deepcopy(a[i-1])
    return a

def check(a, ab):
    score = 0
    for i in range(q):
        ai, bi = ab[i][0], ab[i][1]
        if a[bi] - a[ai] == ab[i][2]:
            score += ab[i][3]
    return score
  
n, m, q = map(int,input().split())
ab = []
for i in range(q):
    ab.append(list(map(int,input().split())))

a = [1] * (n+1)
ans = 0
while a[0] == 1:
    x = check(a, ab)
    ans = max(ans, x)
    # print(a, ans)
    a = cnt(a, m, -1)
print(ans)

Buggy submission (verdict: Runtime Error):
import copy

def cnt(a, m, i):
    if a[i] < m:
        a[i] += 1
    else:
        a = cnt(a, m, i-1)
        a[i] = copy.deepcopy(a[i-1])
    return a

def check(a, ab):
    score = 0
    for i in range(q):
        ai, bi = ab[i][0], ab[i][1]
        if a[bi] - a[ai] == ab[i][2]:
            score += ab[i][3]
    return score
  
n, m, q = map(int,input().split())
ab = []
for i in range(q):
    ab.append(list(map(int,input().split())))
ab = sorted(ab, key=lambda x:(x[3]), reverse=True)
# print(ab)
a = [1] * (n+1)
ans = 0
while a[0] == 1:
    x = check(a, ab)
    ans = max(ans, x)
    # print(a, ans)
    a = cnt(a, m, -1)
print(ans)
Problem p02725 (python)

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

ans = 10**6 + 1
for i in range(n):
    ans = min(ans, a[-1] - a[i])
    a.append(a[i]+k)
print(ans)

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

ans = 10**6 + 1
for i in range(n):
    ans = min(a[-1] - a[i])
    a.append(a[i]+k)
print(ans)
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()
print('YES')

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

cnt = [0]*(10**9+1)

for i in a:
    cnt[i] += 1
    if cnt[i] > 1:
        print('NO')
        exit()
print('YES')
Problem p02833 (python)

Fixed submission:
n = int(input())
if n % 2 != 0:
    print(0)
    exit()

m = 10
a = []
b = []
while m <= n:
    a.append(n // m)
    m *= 5
    if len(a) > 1:
      b.append(a[-2] - a[-1])
if a:
    b.append(a[-1])

ans = 0
for i in range(len(b)):
    ans += (i+1)*b[i]
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
if n % 2 != 0:
    print(0)
    exit()

m = 10
a = []
b = []
while m <= n:
    a.append(n // m)
    m *= 5
    if len(a) > 1:
      b.append(a[-2] - a[-1])
b.append(a[-1])

ans = 0
for i in range(len(b)):
    ans += (i+1)*b[i]
print(ans)
Problem p02955 (python)

Fixed submission:
import numpy as np

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

n, k = map(int,input().split())
a = list(map(int,input().split()))

asum = sum(a)
adiv = make_divisors(asum)
adiv.reverse()

a = np.array(a)
ans = 1
flg = False
for i in adiv:
    a_ = np.sort(a % i)
    # print(i, a_)
    msum = a_.sum()
    msum_ = 0
    for j in range(-1, -n-1, -1):
        msum -= a_[j]
        msum_ += i - a_[j]
        if msum_ > k:
            break
        if msum < msum_:
            break
        if msum == msum_ :
            ans = i
            flg = True
            break
    if flg:
        break

print(ans)

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

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

n, k = map(int,input().split())
a = list(map(int,input().split()))

asum = sum(a)
adiv = make_divisors(asum)
adiv.reverse()

a = np.array(a)
flg = False
for i in adiv:
    a_ = np.sort(a % i)
    # print(i, a_)
    msum = a_.sum()
    msum_ = 0
    for j in range(-1, -n-1, -1):
        msum -= a_[j]
        msum_ += i - a_[j]
        if msum > k:
            break
        if msum < msum_:
            break
        if msum == msum_ :
            ans = i
            flg = True
            break
    if flg:
        break

print(ans)
Problem p03013 (python)

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

MOD = 10**9+7

dp = [0]*(n+1)
ng = [False]*(n+1)
for i in a:
    ng[i] = True
    
dp[0] = 1
if not ng[1]:
    dp[1] = 1
for i in range(2, n+1):
    if ng[i]:
        continue
    else:
        dp[i] = (dp[i-1] + dp[i-2]) % MOD
print(dp[n])

Buggy submission (verdict: Runtime Error):
n, m  = map(int,input().split())
a = [int(input()) for _ in range(m)]

MOD = 10**9+7

dp = [0]*(n+1)
ng = [False]*(n+1)
for i in a:
    ng[a] = True
    
dp[0] = 1
if not ng[1]:
    dp[1] = 1
for i in range(2, n+1):
    if a[i]:
        continue
    else:
        dp[i] = (dp[i-1] + dp[i-2]) % MOD
print(dp[n])
Problem p03317 (python)

Fixed submission:
n, k = map(int,input().split())
a = [int(i) for i in input().split()]

if n == k:
    cnt = 1
else:
    cnt = (n - 2) // (k-1) + 1
print(cnt)

Buggy submission (verdict: Runtime Error):
n, k = map(int,input().split())
a = [int(i) for i in input().split()]

if n == k:
    cnt == 1
else:
    cnt = (n - k) // (k-1) + 2
print(cnt)
Problem p03834 (python)

Fixed submission:
s = input()
a = [s[0:5], s[6:13], s[14:]]
print(' '.join(a))

Buggy submission (verdict: Runtime Error):
K, S = map(int, input().split())
 
cnt = 0
for i in range(K+1):
    for j in range(K+1):
        k = S - i - j
        if k >= 0 and k <= K:
            cnt += 1
print(cnt)
Problem p02623 (python)

Fixed submission:
def A(x):
  return x + x**2 + x**3


def B(s, t):
  ans = 0
  for i in range(len(s)):
    if s[i] != t[i]:
      ans += 1
  return ans


def C(n, m, k, a, b):

  def _get_acc(x):
    acc = [0]
    for idx in range(len(x)):
      acc.append(x[idx] + acc[idx])
    return acc

  acc_a = _get_acc(a)
  acc_b = _get_acc(b)

  pa = 0
  pb = 0

  while pa <= n and acc_a[pa] <= k:
    pa += 1
  pa -= 1

  max_num = 0
  while True:
    if pa < 0 or pb > m:
      break
    if acc_a[pa] + acc_b[pb] <= k:
      if max_num < pa + pb:
        max_num = pa + pb
      pb += 1
    else:
      pa -= 1

  return max_num


def main():
  n, m, k = map(int, input().split())
  a = list(map(int, input().split()))
  b = list(map(int, input().split()))
  print(C(n, m, k, a, b))


if __name__ == '__main__':
  main()

Buggy submission (verdict: Runtime Error):
def A(x):
  return x + x**2 + x**3


def B(s, t):
  ans = 0
  for i in range(len(s)):
    if s[i] != t[i]:
      ans += 1
  return ans


def C(n, m, k, a, b):
  ans = 0
  while k > 0:
    if a and b:
      if a[0] < b[0]:
        k -= a[0]
        a.pop()
      else:
        k -= b[0]
        b.pop()
    elif a:
      k -= a[0]
      a.pop()
    elif b:
      k -= b[0]
      b.pop()
    else:
      break
    if k >= 0:
      ans += 1
  return ans


def C2(n, m, k, a, b):

  def _dfs(pa, pb, acc_b, acc_t, k):
    go_a = _dfs(pa + 1, pb, acc_b + 1, acc_t + a[pa + 1], k)
    go_b = _dfs(pa, pb + 1, acc_b, acc_t, k)
    return go_a if go_a > go_b else go_b

  return _dfs(pa=0, pb=-1, acc_b=0, acc_t=0, k=k)


def C3(n, m, k, a, b):

  kl = [k]
  def _get_pa_init():
    pa = 0
    while pa < len(a):
      if kl[0] > a[pa]:
        kl[0] -= a[pa]
        pa += 1
      else:
        break
    return pa - 1

  pa = _get_pa_init()
  pb = -1

  k = kl[0]
  max_read = pa + pb + 2
  while True:
    while pb + 1 < len(b) and k >= b[pb + 1]:
      k -= b[pb + 1]
      pb += 1
    if pa <= -1 and k < b[pb + 1]:
      break
    # print(k, pa, pb, pa + pb + 2)
    if pa + pb + 2 > max_read:
      max_read = pa + pb + 2
    if pa > -1:
      pa -= 1
      k += a[pa + 1]
    # print(k, pa, pb, pa + pb + 2)
    if pa + pb + 2 > max_read:
      max_read = pa + pb + 2
    if pb >= len(b) - 1:
      break
  return max_read


def main():
  n, m, k = map(int, input().split())
  a = list(map(int, input().split()))
  b = list(map(int, input().split()))
  print(C3(n, m, k, a, b))


if __name__ == '__main__':
  main()

Buggy submission (verdict: Runtime Error):
def A(x):
  return x + x**2 + x**3


def B(s, t):
  ans = 0
  for i in range(len(s)):
    if s[i] != t[i]:
      ans += 1
  return ans


def C(n, m, k, a, b):
  pa = 0
  pb = 0
  ans = 0
  while k > 0:
    if pa < len(a) and a[pa] < b[pb]:
      k -= a[pa]
      pa += 1
    elif pb < len(b):
      k -= b[pb]
      pb += 1
    else:
      break
    if k >= 0:
      ans += 1
  return ans


def main():
  n, m, k = map(int, input().split())
  a = list(map(int, input().split()))
  b = list(map(int, input().split()))
  print(C(n, m, k, a, b))


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

Fixed submission:
def func(x):
  if ord(x) - ord('a') >= 0:
    print('a')
  else:
    print('A')


def main():
  letter = input()
  func(letter)
  # for x in ['A', 'Z', 'a', 'z']:
  #   func(x)


if __name__ == '__main__':
  main()

Buggy submission (verdict: Runtime Error):
def func(x):
  if ord(x) - ord('a') >= 0:
    print('a')
  else:
    print('A')


def main():
  letter = raw_input()
  func(letter)
  # for x in ['A', 'Z', 'a', 'z']:
  #   func(x)


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

Fixed submission:
def gcd(a, b):
    if not b:
        return a
    return gcd(b, a % b)

a, b = map(int, input().split())
print(a//gcd(a, b)*b)

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


def gcd(a, b):
    if not b:
        return a
    return gcd(b, a % b)

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


def gcd(a, b):
    if not b:
        return a
    return gcd(b, a % b)

Buggy submission (verdict: Runtime Error):
import math

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

Buggy submission (verdict: Runtime Error):
import math

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

Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 29 22:19:15 2020

@author: naoki
"""

N = int(input())

A = list(map(int,input().split()))

count1 = 0
count2 = 0
count = 10**9 +7
for i in A:
    count1+=i

for j in A:
    count2 = (j*(count1-j) + count2)%count
    count1 = count1 -j 
    
print(count2%count)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 29 22:19:15 2020

@author: naoki
"""

N = int(input())

A = list(map(int,input().split()))

count1 = 0
count2 = 0
count = 10**9 +7
for i in A:
    count1+=i
	count1=count1%count
for j in A:
    count2 = j*(count1-j)%count + count2
    count1 = count1 -j 
    
print(count2%count)
Problem p02572 (python)

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

sum = [0 for i in range(n+1)]
for i in range(n - 1, -1, -1):
    sum[i] = sum[i + 1] + a[i]
ans = 0
for i in range(n):
    ans = (ans+(a[i]*sum[i+1])) % 1000000007
print(ans)

Buggy submission (verdict: Runtime Error):
i = 0
j = i+1
ans = 0
while i != n - 1:
    ans = (ans+(a[i] * a[j])) % 1000000007
    j += 1
    if j == n:
        i += 1
        j = i + 1
print(ans)

Buggy submission (verdict: Runtime Error):
i = 0
j = i+1
ans = 0
while i != n - 1:
  ans += a[i] * a[j]
  j += 1
  if j == n:
    i += 1
    j = i + 1
print(ans % 1000000007)
Problem p02829 (python)

Fixed submission:
A=int(input())
B=int(input())
if A==1 and B==2:
  print(3)
elif A==2 and B==3:
  print(1)
elif A==3 and B==1:
  print(2)
elif A==1 and B==3:
  print(2)
elif A==3 and B==2:
  print(1)
else:
  print(3)

Buggy submission (verdict: Runtime Error):
A=int(input())
B=int(input())
if A==1 and B==2:
  print(3)
elif A==2 and B==3:
  print(1)
else A==3 and B==1:
  print(2)