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

Fixed submission:
import sys
input = sys.stdin.readline
from fractions import gcd
from functools import reduce

def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2]!=1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    #[x,y]
    return [w[0],w[1]]
# aの逆元(mod m)を求める。(aとmは互いに素であることが前提)
def mod_inv(a,m):
    x = extgcd(a,m)[0]
    return (m+x%m)%m

def gcd_list(numbers):
    return reduce(gcd, numbers)
def lcm_base(x, y):
    return (x * y) // gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

def main():
    N = int(input())
    A = sorted([int(i) for i in input().split()])
    MOD = 10**9+7

    GCD = gcd_list(A)
    LCM = lcm_list(A) % MOD
    ans = 0
    if GCD != 1 and LCM == A[-1]:
        for i in range(N):
            ans = (ans + A[-1] * mod_inv(A[i],MOD)) % MOD
    else:
        for i in range(N):
            ans = (ans + LCM * mod_inv(A[i],MOD)) % MOD

    print(ans)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**5)
from fractions import gcd
from functools import reduce

def gcd_lcm(lists):
    LCM = lists[0]
    for i in range(1,len(lists)):
        if i == len(lists) - 1:
            GCD = gcd(LCM,lists[i])
        LCM = (LCM * lists[i]) // gcd(LCM,lists[i])
    return GCD,LCM

def main():
    N = int(input())
    A = sorted([int(i) for i in input().split()])
    MOD = 10**9+7

    GCD,LCM = gcd_lcm(A)
    ans = 0
    if GCD != 1 and LCM == A[-1]:
        for i in range(N):
            ans = (ans + A[-1] // A[i]) % MOD
    else:
        for i in range(N):
            ans = (ans + LCM // A[i]) % MOD

    print(ans)

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

Fixed submission:
S = input()

week = ["SUN","MON","TUE","WED","THU","FRI","SAT"]

print(len(week)-week.index(S))

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

week = ["SUN","MOM","TUE","WED","THU","FRI","SAT"]

print(len(week)-week.index(S))
Problem p03017 (python)

Fixed submission:
N,A,B,C,D = map(int,input().split())
# 1-indexed
S = ["$"] + list(input())

if A < B < D < C:
    flag = False

    for i in range(B+1,D+2):
        if S[i-2] == S[i-1] == S[i] == ".":
            flag = True
            break
    for i in range(A+1,C+1):
        if S[i] == S[i-1] == "#":
            flag = False
            break
    
    if flag:
        print("Yes")
    else:
        print("No")

elif A < B < C < D:
    flag = True
    for i in range(A+1,D+1):
        if S[i] == S[i-1] == "#":
            flag = False
            break
    
    if flag:
        print("Yes")
    else:
        print("No")
        
elif A < C < B < D:
    flag = True
    for i in range(A+1,C+1):
        if S[i] == S[i-1] == "#":
            flag = False
            break
    for i in range(B+1,D+1):
        if S[i] == S[i-1] == "#":
            flag = False
            break
    if flag:
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
N,A,B,C,D = map(int, input().split())
S = [""] + list(input())

def can(start, end):
    for i in range(start, end):
        if S[i] == S[i + 1] == "#":
            return False
    return True

def main():
    if not (can(A, C) and can(B, D)):
        return False

    if C < D:
        flag = False
        for i in range(B, D + 1):
            if S[i - 1] == S[i] == S[i + 1] == ".":
                flag = True
        if not flag:
            return False
    
    return True

if __name__ == "__main__":
    if main():
        print('Yes')
    else:
        print('No')
Problem p03242 (python)

Fixed submission:
n = list(input())

for i in range(3):
    if n[i] == "1":
        n[i] = "9"
    elif n[i] == "9":
        n[i] = "1"

print(*n,sep="")

Buggy submission (verdict: Runtime Error):
N = int(input())
V = [int(i) for i in input().split()]

Vodd = V[1::2]
Veven = V[::2]

from collections import Counter

Vodd = sorted(Counter(Vodd).items(), key=lambda x:x[1])
Veven = sorted(Counter(Veven).items(), key=lambda x:x[1])

if Vodd[-1][0] == Veven[-1][0]:
    if len(Vodd) == len(Veven) == 1:
        ans = N - Vodd[-1][1]
    elif len(Vodd) == 1:
        ans = N - Vodd[-1][1] - Veven[-2][1]
    elif len(Veven) == 1:
        ans = N - Vodd[-2][1] - Veven[-1][1]
    elif Vodd[-2][1] >= Veven[-2][1]:
        ans = N - Vodd[-2][1] - Veven[-1][1]
    else:
        ans = N - Vodd[-1][1] - Veven[-2][1]
else:
    ans = N - Vodd[-1][1] - Veven[-1][1]


print(ans)
Problem p02627 (python)

Fixed submission:
s = str(input())
if s.isupper():
    print("A")
else:
    print('a')

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip


def main():
    pass


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()
    
    
n = int(input())
a = list(map(int, input().split()))
for i in range(int(input())):
    x, y = map(int, input().split())
    for b in range(len(a)):
        if a[b] == x:
            a[b] = y
    print(sum(a))
Problem p02693 (python)

Fixed submission:
i=int(input())
j,k=(int(x) for x in input().split())
l=0
while True:
    if j<=l*i<=k:
        print("OK")
        break
    elif l*i>k:
        print("NG")
        break
    l+=1

Buggy submission (verdict: Runtime Error):
i=int(input())
j,k=int(input()).split()
l=0
while True:
    if j<=l*i<=k:
        print("OK")
        break
    elif l*i>k:
        print("NG")
        break
    l+=1

Buggy submission (verdict: Runtime Error):
i=int(input())
j,k=int(input()),int(input())
l=0
while True:
    if j<=l*i<=k:
        print("OK")
        break
    elif l*i>k:
        print("NG")
        break
    l+=1

Buggy submission (verdict: Runtime Error):
i=input(int())
j,k=input(int())
for l in range(k+1)
  if j<=l*i<=k:
    break
    print("OK")
  else:
    print("NG")
Problem p02570 (python)

Fixed submission:
inp = input()
inp_list = inp.split()
inp_list = [int(i) for i in inp_list] 
if inp_list[0] / inp_list[1] <= inp_list[2]:
    print("Yes") 
else:
    print("No")

Buggy submission (verdict: Runtime Error):
inp_ = input()
imp_list = imp_.spilt()
if inp_list[0] / inp_list[1] <= 80:
    print("Yes") 
else:
    print("No")

Buggy submission (verdict: Runtime Error):
inp_list = input().spilt()
if inp_list[0] / inp_list[1] <= 80:
    print("Yes") 
else:
    print("No")

Buggy submission (verdict: Runtime Error):
inp_list = input().spilt()
if (inp_list[0] / inp_list[1]) <= 80:
    print("Yes") 
else:
    print("No")
Problem p02570 (python)

Fixed submission:
D,T,S=map(int,input().split())
Max = 0

if D/S<=T:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
S = str(input())
T = str(input())
tempcount = 0
mincount = 0

if S in T:
    print("0")
    exit

for i in range(len(S) - len(T)+1):
    for j in range(len(T)):
        if S[i + j] != T[j]:
            tempcount += 1
    if i == 0:
        mincount = tempcount
    elif tempcount < mincount:
        mincount = tempcount
    tempcount = 0
    
print(mincount)
Problem p02571 (python)

Fixed submission:
S = str(input())
T = str(input())
tempcount = 0
mincount = 0

for i in range(len(S) - len(T)+1):
    for j in range(len(T)):
        if S[i + j] != T[j]:
            tempcount += 1
    if i == 0:
        mincount = tempcount
    elif tempcount < mincount:
        mincount = tempcount
    tempcount = 0
    
print(mincount)

Buggy submission (verdict: Runtime Error):
S = str(input())
T = str(input())
tempcount = 0
mincount = 0

if S in T:
    print("0")
    exit

for i in range(len(S) - len(T)+1):
    for j in range(len(T)+1):
        if S[i + j] != T[j]:
            tempcount += 1
    if i == 0:
        mincount = tempcount
    elif tempcount < mincount:
        mincount = tempcount
    tempcount = 0
    
print(mincount)
Problem p02570 (python)

Fixed submission:
def main():
    d, t, s = map(int, input().split())
    if d <= t * s:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()

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

    sum_ = 0
    for i in range(N - 1):
        for j in range(i + 1, N):
            sum_ += ((As[i] % (10 ** 9 + 7)) * (As[j] % (10 ** 9 + 7))) % (10 ** 9 + 7)

    sum_ %= 10 ** 9 + 7
    print(sum_)


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

Fixed submission:
d,t,s = map(int,input().split())
if (d - s*t <= 0):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):

d,t,s = map(int,input().split())

if (d − s*t <= 0):
  print('Yes')
else :
  print('No')

Buggy submission (verdict: Runtime Error):
d = int(input())
t,s = map(int,input().split())

if d − s*t <= 0:
  print('Yes')
else :
  print('No')

Buggy submission (verdict: Runtime Error):
d = int(input())
t,s = map(int,input().split())

if d − s*t <= 0:
  print('Yes')
else print('No')

Buggy submission (verdict: Runtime Error):
d = input().split()
t,s = map(int,input().split())

if d − s*t < 0:
  print('Yes')
else print('No')
Problem p02699 (python)

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

Buggy submission (verdict: Runtime Error):
S = int(input())
W = int(input())
if W >= S :
    print('unsafe')
else :
    print('safe')
Problem p02596 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import sys
k=int(input())
if k%2==0 or k%5==0:
  print(-1)
  sys.exit()
s=7
for i in range(k):
  m=s%k
  if m==0:
    print(i+1)
    break
  s=m*10+7

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys
k=int(input())
if k%2==0 or k%5==0:
  print(-1)
  sys.exit()
h=[-1]*k
s=7
for i in range(k):
  m=s%k
  if h[0]==m:
    l=i+1
    break
  h[i]=m
  s=m*10+7
for i in range(l):
  if h[i]==0:
    print(i+1)
    break

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys
k=int(input())
if k%2==0 or k%5==0:
  print(-1)
  sys.exit()
h=[-1]*k
s=7
for i in range(k):
  m=s%k
  if h[0]==m:
    l=i
    break
  h[i]=m
  s=m*10+7
for i in range(l):
  if h[i]==0:
    print(i+1)
    break

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys
k=int(input())
n=-1
if k%2==0:
  print(n)
  sys.exit()
l=1
while True:
  s=(7*(10**l-1))/9
  if s%k==0:
    print(l)
    break
  l+=1
Problem p02625 (python)

Fixed submission:
# -*- coding: utf-8 -*-
#nCをp(=10**9+7)で割ったときのあまり(モジュラ逆数)
def cmb(n,r,p):
  if r<0 or n<r:
    return 0
  r=min(r,n-r)
  return facto[n]*factoinv[r]*factoinv[n-r]%p
p=10**9+7
n,m=map(int,input().split())
#0,1の時の値をいれたn!のリスト(modp)
facto=[1,1]
#0,1の時の値をいれたn!の逆元のリスト(modp)
factoinv=[1,1]
#0,1の場合を入れたn!の逆元も求めるために使うnの逆元のリスト(modp)
inv=[0,1]
#2からスタート
for i in range(2,m+1):
  facto.append((facto[-1]*i)%p)
  inv.append((-inv[p%i]*(p//i))%p)
  factoinv.append((factoinv[-1]*inv[-1])%p)
if n==m:
  kosuub=0
  for i in range(n+1):
    kosuub+=(facto[(n-i)]*cmb(n,i,p)*((-1)**i))%p
  kosuu=(kosuub*facto[(n)])%p
  print(kosuu)
else:
  kosuub=0
  for i in range(n+1):
    kosuub+=(cmb((m-i),(n-i),p)*facto[(n-i)]*cmb(n,i,p)*((-1)**i))%p
  kosuu=(kosuub*cmb(m,n,p)*facto[n])%p
  print(kosuu)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
#階乗計算
from math import factorial
n,m=map(int,input().split())
nf=factorial(n)
mf=factorial(m)
mnf=factorial((m-n))
#n=mの時
def ko1(x):
  kosuu1=0
  for i in range(x+1):
    kf=factorial(i)
    kosuu1+=int((nf/kf)*((-1)**i))
  kosuu1*=nf
  return kosuu1
#n<mの時
def ko2(x,y):
  kosuu2=0
  for i in range(x+1):
    kf=factorial(i)
    mi=factorial((y-i))
    ni=factorial((x-i))
    kosuu2+=int((((-1)**i)*mi*nf)/(ni*mnf*kf))
  kosuu2*=int(mf/mnf)
  return kosuu2
if n==m:
  kosuu=int(ko1(n)/(10**9+1))
else:
  kosuu=int((ko2(n,m))%(10**9+1))
print(kosuu)
Problem p02629 (python)

Fixed submission:
# -*- coding: utf-8 -*-
n=int(input())
namelist=[]
name=''
while n>0:
  n-=1
  namelist.append(chr(ord('a')+n%26))
  n=int(n/26)
for i in namelist[::-1]:
  name+=i
print(name)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
n=int(input())
#アルファベットのリスト
alphlist=[chr(ord('a')+i)for i in range(26)]
l=0
maxnum=int((1.0e+15)+1)
numlist=[0]
#公比26の等比数列の和のリスト(numlist)
while True:
  l+=1
  numlist.append(numlist[l-1]+26**l)
  if numlist[l]>maxnum:
    break
#名前に使われる文字の個数(continum)
continum=0
for i in range(l):
  if numlist[i]<=n and numlist[i+1]>=n:
    continum=i+1
    break
#文字を決める(左から順に)
anslist=[]
for i in range(continum,0,-1):
  s=26**(i-1)
  num=int(n/s)
  n-=num*s
  anslist.append(alphlist[num-1])
ans=str()
for val in anslist:
  ans+=val
print(ans)
Problem p02723 (python)

Fixed submission:
s = input()
if(s[2:3]==s[3:4] and s[4:5]==s[5:6]):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
s = input()
if(s[1:2]==s[2:3] and s[3:4]==s[4:5]){print("Yes")}
else{print("No")}

Buggy submission (verdict: Runtime Error):
s = input()
if(s[2:3]==s[3:4] and s[4:5]==s[5:6]){print("Yes")}
else{print("No")}

Buggy submission (verdict: Runtime Error):
s = input()
if(s[2]==s[3] and s[4]==s[5]){print("Yes")}
else{print("No")}
Problem p02627 (python)

Fixed submission:
s = input()
if s.isupper():
  print("A")
else:
  print("a")

Buggy submission (verdict: Runtime Error):
s=input()
if s.isupper(){
  print("A")}else{
  print("a")}
Problem p02577 (python)

Fixed submission:
N = int(input())
if N ==0:
  print('Yes')
elif sum(list(map(int, str(N))))%9 ==0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
def digitSum(n):
    # 数値を文字列に変換
    s = str(n)
    # １文字ずつ数値化し配列にする。
    array = list(map(int, s))
    # 合計値を返す
    return sum(array)

if N ==0:
  print('Yes')
elif digitSum(N)%9 ==0:
  print('Yes')
else:
  print('No')
Problem p02723 (python)

Fixed submission:
# -*- coding: utf-8 -*-
x = input()
mylist = list(x)

if mylist[2] == mylist[3] and mylist[4] == mylist[5]:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
x = raw_input()
mylist = list(x)

if mylist[2] == mylist[3] and mylist[4] == mylist[5]:
  print('Yes')
else:
  print('No')
Problem p02759 (python)

Fixed submission:
# -*- coding: utf-8 -*-
num = input()
if int(num) % 2 == 0:
  print(int(num) // 2)
else:
  print(int(num) // 2 + 1)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
num = input()
if num % 2 == 0:
  print(num // 2)
else:
  print(num // 2 + 1)
Problem p02862 (python)

Fixed submission:
a,b = map(int, input().split())
tried = (a + b)//3
p = 10**9 +7

if a < tried or b < tried or (a+b)%3 != 0:
    print(0)
    quit()
one = int((2 * a -  b)/3)
n = tried
r = min(one, tried-one)
n_fac = 1
r_fac = 1
n_r_fac = 1

for i in range(2,n+1):
    n_fac *= i
    n_fac %= p
for i in range(2,r+1):
    r_fac *= i
    r_fac %= p
for i in range(2,n-r+1):
    n_r_fac *= i
    n_r_fac %= p
r_fac_inverse = pow(r_fac, p-2, p)
n_r_fac_inverse = pow(n_r_fac, p-2, p)

print((n_fac * r_fac_inverse * n_r_fac_inverse)%p)

Buggy submission (verdict: Runtime Error):
a,b = map(int, input().split())
tried = (a + b)//3
p = 10**9 +7

if a < tried or b < tried or (a+b)%3 != 0:
    print(0)
    quit()
one = (2/3)* a - (1/3)* b
n = tried
r = min(one, tried-one)
n_fac = 1
r_fac = 1
n_r_fac = 1

for i in range(2,n+1):
    n_fac *= i
    n_fac %= p
for i in range(2,r+1):
    r_fac *= i
    r_fac %= p
for i in range(2,n-r+1):
    n_r_fac *= i
    n_r_fac %= p
r_fac_inverse = pow(r_fac, p-2, p)
n_r_fac_inverse = pow(n_r_fac, p-2, p)

print((n_fac * r_fac_inverse * n_r_fac_inverse)%p)
Problem p02873 (python)

Fixed submission:
n = list(input())
counter = 1
directions = []
list = []
def add_up(x):
    added = (1/2) * x * (x + 1)
    return added
for i in range(len(n)-1):
    if n[i] == n[i+1]:
        counter += 1
    else:
        directions.append(counter)
        counter = 1
directions.append(counter)
if n[0] == "<":
    for i in range(0,len(directions)-1,2):
        if directions[i] >= directions[i+1]:
            directions[i+1] -= 1
        else:
            directions[i] -= 1
else:
    for i in range(1,len(directions)-1,2):
        if directions[i] >= directions[i+1]:
            directions[i+1] -= 1
        elif directions[i] < directions[i+1]:
            directions[i] -= 1
for direction in directions:
    list.append(add_up(direction))
print(round(sum(list)))

Buggy submission (verdict: Runtime Error):
n = list(input())
counter = 1
directions = []
list = []
def add_up(x):
    added = (1/2) * x * (x + 1)
    return added

for i in range(len(n)-1):
    if n[i] == n[i+1]:
        counter += 1
    else:
        directions.append(counter)
        counter = 1
if n[-1] == n[-2]:
    directions[-1] += 1
else:
    directions.append(1)
if n[0] == "<":
    for i in range(0,len(directions)-1,2):
        if directions[i] > directions[i+1]:
            directions[i+1] -= 1
        elif directions[i] < directions[i+1]:
            directions[i] -= 1
else:
    for i in range(1,len(directions)-1,2):
        if directions[i] > directions[i+1]:
            directions[i+1] -= 1
        elif directions[i] < directions[i+1]:
            directions[i] -= 1
for direction in directions:
    list.append(add_up(direction))
print(round(sum(list)))
Problem p02570 (python)

Fixed submission:
info=input().split()
 
D=int(info[0])
S=int(info[1])
T=int(info[2])
 
if D/S<=T:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
info=input().split()

D=info[0]
S=info[1]
T=info[2]

if D/S<=T:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
if D/S<=T:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
total_minute=D/S
 
if total_minute<=T:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
total_minute=D/S

if total_minute<=T:
  print("Yes")
else:
  print("No
Problem p02627 (python)

Fixed submission:
def main():
  s = input()
  ans = 'A' if s.upper() == s else 'a'
  print(ans)
    
    
    
 
if __name__ == '__main__':
  main()

Buggy submission (verdict: Runtime Error):
def main():
  s = input()
  ans = 'A' s.isupper() else 'a'
  print(ans)
  
  
  
if __name__ == '__main__':
  main()
Problem p02754 (python)

Fixed submission:
n, a ,b = list(map(int,(input().split())))
k = n//(a+b)
am = n%(a+b)

print(a*k+min(am,a))

Buggy submission (verdict: Runtime Error):
s = list(input())
n = int(input())
p = []
for i in range(n):
  i =(input().split())
  if i[0] == '1':
    s = s[::-1]
  elif i[0] =='2':
    if i[1] == '1':
      s.insert(0,i[2])
    else:
      s.append(i[2])
#  count +=1      
      
#print(s)      
      
s = ''.join(s)
print(s)
Problem p02829 (python)

Fixed submission:
m = [1,2,3]
a = int(input())
b = int(input())

m.pop(m.index(a))
m.pop(m.index(b))
print(m[0])

Buggy submission (verdict: Runtime Error):
m = [1,2,3]
a = int(input())
b = int(input())

m.pop(a-1)
m.pop(b-1)
print(m[0])
Problem p02987 (python)

Fixed submission:
s = list(input())
s_ = len(s)

a_ = len(set(s))

if s_ == a_*2:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
s = list(input())
s_ = len(s_)

a_ = len(set(s_))

if s_ > s_:
  print('Yes')
else:
  print('No')
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 = str(input)
S = input()
if len(S)<=K:
    print(S)
else:
    print(S[:K]+'...')
Problem p02682 (python)

Fixed submission:
a,b,c,k = map(int,input().split())
if k<a:
    print(k)
elif k < a+b:
    print(a)
else:
    print(2*a+b-k)

Buggy submission (verdict: Runtime Error):
a,b,c,k = map(int,input())
if k<a:
    print(k)
elif k < a+b:
    print(a)
else:
    print(2*a+b-k)
Problem p02729 (python)

Fixed submission:
N,M = map(int,input().split())
sum = 0
sum+=N*(N-1)/2
sum+=M*(M-1)/2
print(int(sum))

Buggy submission (verdict: Runtime Error):
N = int(input())
a = (input().split())
a_str = ''.join(a)
a_str2 = a_str
sum = 0
l_dict = {}
while len(a_str)>0:
    n = a.count(a_str[0])
    sum += int(n*(n-1)/2)
    l_dict[a_str[0]] = n
    a_str = a_str.replace(a_str[0],'')
for k in range(N):
    print(sum-l_dict[a_str2[k]]+1)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
sum = 0
sum+=N*(N-1)/2
sum+=M*(M-1)/2
print(int(sum)
Problem p02859 (python)

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

Buggy submission (verdict: Runtime Error):
r = input()
a = r*r
print(a)
Problem p02712 (python)

Fixed submission:
import numpy as np
N=list(range(1,int(input())+1))
a=np.asarray(N,dtype='int64')
b=a%3
c=a%5
d=np.array([a,b,c])
d=np.delete(d, np.where(d==0)[1], axis=1)
print(np.sum(d[0]))

Buggy submission (verdict: Runtime Error):
import  pandas as pd
N=list(range(1,int(input())+1))
df=pd.DataFrame(N,columns=["moto"])
df["3"]=df["moto"]%3
df["5"]=df["moto"]%5
print(df[(df['3']!=0) & (df['5']!=0)]["moto"].sum())
Problem p02729 (python)

Fixed submission:
import math
N,M=map(int, input().split())
def comb(N, r):
    return math.factorial(N) // (math.factorial(N - r) * math.factorial(r))
try :
    base = comb(N,2)
except:
    base=0
def comb2(M, r):
    return math.factorial(M) // (math.factorial(M - r) * math.factorial(r))
try:
    base2 = comb2(M,2)
except:
    base2=0

print(base+base2)

Buggy submission (verdict: Runtime Error):
N,M=map(int, input().split())
A=N*(N-1)/2
B=M*(M-1)/2
printint((A+B)

Buggy submission (verdict: Runtime Error):
import math

num=int(input())
target=list(map(int, input().split()))
def comb(N, r):
    return math.factorial(N) // (math.factorial(N - r) * math.factorial(r))

for i in range(num):
    A=target.copy()
    A.pop(i)
    B=[x for x in set(A) if A.count(x) > 1]
    out=0 
    for j in B:
        base = comb(A.count(j),2)
        out=out+base
    print(out)