Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
G,R = int(input())
A=2*G-R
print(A)

Fixed submission:
R = int(input())
G = int(input())
print(2*G-R)

Buggy python submission (verdict: Runtime Error):
R,G= map(int, input().split())
print(2*G-R)

Fixed submission:
R = int(input())
G = int(input())
print(2*G-R)

Buggy python submission (verdict: Runtime Error):
G,R= map(int, input().split())
print(2*R-G)

Fixed submission:
R = int(input())
G = int(input())
print(2*G-R)

Buggy python submission (verdict: Runtime Error):
G,R= map(int, input().split())
print(2*G-R)

Fixed submission:
R = int(input())
G = int(input())
print(2*G-R)

Buggy python submission (verdict: Runtime Error):
input R, G
output (2 * G – R)

Fixed submission:
R = int(input())
G = int(input())
print(2*G-R)

Buggy python submission (verdict: Runtime Error):
G,R= map(int, input().split())
print(str(2G-R))

Fixed submission:
R = int(input())
G = int(input())
print(2*G-R)

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
c=a+b
print(str(c/2))

Fixed submission:
R = int(input())
G = int(input())
print(2*G-R)

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
print((a+b)/2)

Fixed submission:
R = int(input())
G = int(input())
print(2*G-R)
Buggy python submission (verdict: Runtime Error):
N=int(input())
for i in range(N)
 l,n=map(int,input().split())
 	ans=l-n+1
print(ans)

Fixed submission:
N = int(input())
ans=0
for i in range(N):
    l,n= map(int, input().split())
    ans=ans+n-l+1
print(ans)

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

Fixed submission:
N = int(input())
ans=0
for i in range(N):
    l,n= map(int, input().split())
    ans=ans+n-l+1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
k,s=map(int,input().split())
ans=0
for x in range (k+1):
    for y in range (k+1):
        for z in range (k+1):
            if x+y+z==s:
                ans=ans+1
print(ans)

Fixed submission:
k,s=map(int,input().split())
ans=0
for x in range (k+1):
    for y in range (k+1):
        z=s-x-y
        if 0<=z<=k:
            ans=ans+1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):

def nthNum(nMinusOneNum):
    return nMinusOneNum*10 + 7

K = int(input())

crawler = 7
i = 0

if (K % 2 ==0):
    print(-1)
else:
    while True:
        if crawler%K == 0:
            print(i + 1)
            break
        temp = nthNum(crawler)
        crawler = temp;
        i += 1


Fixed submission:
def main():
    K = int(input())

    crawler = 7
    found = False
    i = 1

    if (K % 2 ==0) or (K % 5 == 0):
        print(-1)
    else:
        a = [0 for i in range (K+1)]
        a[0] = 7
        for i in range (1, K+1):
            a[i] = (a[i-1]*10 + 7) % K
        a[0] = a[0] % K
        for i in a:
            if i == 0:
                print(a.index(i) + 1)
                found = True
                break
        if not found:
            print(-1)
    
main()
Buggy python submission (verdict: Runtime Error):
t = int(input())
if t >=30 print("Yes")
else print("No")

Fixed submission:
t = int(input())
if t >= 30:
  print("Yes")
else :
  print("No")
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
n, d = map(int, input().split())
i = 0
num = 0
while i < n:
  x, y = map(int, input().split())
  srq = x*x + y*y
  _d = sqrt(sqr)
  if _d <= d:
    num += 1
  i += 1
 
print(num)

Fixed submission:
import math
# -*- coding: utf-8 -*-
n, d = map(int, input().split())
i = 0
num = 0
while i < n:
  x, y = map(int, input().split())
  _d = math.sqrt((x*x) + (y*y))
  if _d <= d:
    num += 1
  i += 1
 
print(num)

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
n, d = map(int, input().split())
i = 0
num = 0
while i < n:
  x, y = map(int, input().split())
  _d = sqrt((x*x) + (y*y))
  if _d <= d:
    num += 1
  i += 1
 
print(num)

Fixed submission:
import math
# -*- coding: utf-8 -*-
n, d = map(int, input().split())
i = 0
num = 0
while i < n:
  x, y = map(int, input().split())
  _d = math.sqrt((x*x) + (y*y))
  if _d <= d:
    num += 1
  i += 1
 
print(num)

Buggy python submission (verdict: Runtime Error):
n, d = map(int, input().split())
i = 0
num = 0
while i < n:
  x, y = map(int, input().split())
  _d = sqrt((x*x) + (y*y))
  if _d <= d:
    num += 1
  i += 1
 
print(num)

Fixed submission:
import math
# -*- coding: utf-8 -*-
n, d = map(int, input().split())
i = 0
num = 0
while i < n:
  x, y = map(int, input().split())
  _d = math.sqrt((x*x) + (y*y))
  if _d <= d:
    num += 1
  i += 1
 
print(num)

Buggy python submission (verdict: Runtime Error):
n, d = map(int, input().split())
i = 0
num = 0
while i < n:
  x, y = map(int, input().split())
  _d = sprt((x*x) + (y*y))
  if _d <= d:
    num += 1
  i += 1

print(num)

  

Fixed submission:
import math
# -*- coding: utf-8 -*-
n, d = map(int, input().split())
i = 0
num = 0
while i < n:
  x, y = map(int, input().split())
  _d = math.sqrt((x*x) + (y*y))
  if _d <= d:
    num += 1
  i += 1
 
print(num)
Buggy python submission (verdict: Time Limit Exceeded):
pos = 1
curr = 7
k = int(input())
while curr % k != 0:
  pos += 1
  k *= 10
  k += 7
print(pos)

Fixed submission:
k=int(input())
x=7
for i in range(1,k+1):
  if x%k==0:
    print(i)
    break
  x=(x*10+7)%k
else:
  print(-1)

Buggy python submission (verdict: Runtime Error):
pos = 0
curr = 7
k = int(input())
while true:
  pos += 1
  if curr % k == 0:
    break
  else : 
    k *= 10
    k += 7
print(pos)

Fixed submission:
k=int(input())
x=7
for i in range(1,k+1):
  if x%k==0:
    print(i)
    break
  x=(x*10+7)%k
else:
  print(-1)

Buggy python submission (verdict: Runtime Error):
pos = 0
curr = 7
k = int(input())
while true:
  pos += 1
  if curr % k == 0:
    break
  else : 
    k = k*10 
    k += 7
print(pos)

Fixed submission:
k=int(input())
x=7
for i in range(1,k+1):
  if x%k==0:
    print(i)
    break
  x=(x*10+7)%k
else:
  print(-1)
Buggy python submission (verdict: Runtime Error):
n = int(input())
AC = 0
WA = 0
TLE = 0
RE = 0
for i in range(0, n):
  if "AC" : AC += 1
  else if "WA" : WA += 1
  else if "TLE" : TLE += 1
  else if "RE" : RE += 1
print("AC x " + str(AC))
print("WA x " + str(WA))
print("TLE x " + str(TLE))
print("RE x " + str(RE))
  

Fixed submission:
n = int(input())
AC = 0
WA = 0
TLE = 0
RE = 0
for i in range(0, n):
    ni = input()
    if ni =="AC" : AC += 1
    elif ni =="WA" : WA += 1
    elif ni =="TLE" : TLE += 1
    elif ni =="RE" : RE += 1
print("AC x " + str(AC))
print("WA x " + str(WA))
print("TLE x " + str(TLE))
print("RE x " + str(RE))
Buggy python submission (verdict: Runtime Error):
a = int(input())
print(int(a+(a**2)+(a**3))

Fixed submission:
a = int(input())
s = a*a
c = a*a*a
t = a+s+c
print(int(t))
Buggy python submission (verdict: Time Limit Exceeded):

import collections


def main():
    k = int(input())
    kList = [0] * 10 ** 6
    cnt = 0
    if k % 2 == 0:
        print(-1)
        return
    for i in range(10000000):
        cnt += 1
        kList[i] = ((kList[max(0, i - 1)] + 7 * 10 ** (cnt - 1)) % k)
        if kList[i] == 0:
            break
    print(cnt)


def Base_10_to_n(X, n):
    X_dumy = X
    out = ''
    while X_dumy > 0:
        out = str(X_dumy % n)+out
        X_dumy = int(X_dumy/n)
    return out


def is_prime(q):
    q = abs(q)
    if q == 2:
        return True
    if q < 2 or q & 1 == 0:
        return False
    return pow(2, q-1, q) == 1


if __name__ == '__main__':
    main()


Fixed submission:

import collections


def main():
    k = int(input())
    a = 0
    ans = -1
    for i in range(1, 2 * 10 ** 6):
        a = 10 * a + 7
        a %= k
        if a == 0:
            ans = i
            break
    print(ans)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
import math
import sys
import collections
import bisect
import sympy
readline = sys.stdin.readline


def main():
    N = int(readline().rstrip())
    ans = 0
    for i in range(1, N+1):
        n = N // i
        ans += 0.5 * n * (2*i + i * (n-1))
    print(int(ans))


if __name__ == '__main__':
    main()


Fixed submission:
import math
import sys
import collections
import bisect
readline = sys.stdin.readline


def main():
    N = int(readline().rstrip())
    ans = 0
    for i in range(1, N+1):
        n = N // i
        ans += 0.5 * n * (2*i + i * (n-1))
    print(int(ans))


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
import math
import sys
import collections
import bisect
import sympy
readline = sys.stdin.readline


def main():
    n = int(readline().rstrip())
    sumN = 0
    for i in range(n):
        sumN += len(sympy.divisors(i + 1)) * (i + 1)
    print(sumN)


if __name__ == '__main__':
    main()


Fixed submission:
import math
import sys
import collections
import bisect
readline = sys.stdin.readline


def main():
    N = int(readline().rstrip())
    ans = 0
    for i in range(1, N+1):
        n = N // i
        ans += 0.5 * n * (2*i + i * (n-1))
    print(int(ans))


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
        aList[b - 1] = 0


Fixed submission:
import math
import sys
import collections
import bisect
readline = sys.stdin.readline


def main():
    n = int(readline().rstrip())
    A = list(map(int, readline().rstrip().split()))
    counter = collections.Counter(A)
    q = int(readline().rstrip())
    BCList = [list(map(int, readline().rstrip().split())) for _ in range(q)]
    aList = [0] * (10**5 + 10)
    sumA = sum(A)
    for i in range(n):
        aList[A[i] - 1] += 1

    for i in range(q):
        b, c = BCList[i][0], BCList[i][1]
        if aList[b - 1] == 0:
            print(sumA)
            continue
        sumA += (c - b) * aList[b - 1]
        aList[c - 1] += aList[b - 1]
        aList[b - 1] = 0
        print(sumA)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import math
import sys
readline = sys.stdin.readline


def main():
    n = int(readline().rstrip())
    aList = list(map(int, readline().rstrip().split()))
    ans = 1
    for a in aList:
        if aList.count(0) > 0:
            ans = 0
            break
        if ans * a > 10 ** 18:
            ans = -1
            break
        ans *= a
    print(ans)


if __name__ == '__main__':
    main()


Fixed submission:
import math
import sys
readline = sys.stdin.readline


def main():
    n = int(readline().rstrip())
    aList = list(map(int, readline().rstrip().split()))
    ans = 1

    if 0 in aList:
        print(0)
        return

    for a in aList:
        ans *= a
        if ans > 10 ** 18:
            ans = -1
            break
    print(ans)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import math
import sys
readline = sys.stdin.readline


def main():
    a, b, n = map(int, readline().rstrip().split())
    maxt = 0
    for x in range(n):
        maxt = max(maxt, math.floor(a * (x + 1) / b) -
                   a * math.floor((x+1) / b))
    print(maxt)


if __name__ == '__main__':
    main()


Fixed submission:
import math
import sys
import collections
import bisect


def main():
    a, b, n = map(int, input().split())
    i = max(b - 1 if n >= b else n, 1)
    print(math.floor(a * i / b) - a * math.floor(i / b))


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
readline = sys.stdin.readline


def main():
    n = int(readline().rstrip())
    aList = list(map(int, readline().rstrip().split()))
    aMax = max(aList)
    for i in range(n):
        if aMax >= i + 1:
            print(aList.count(i + 1))
        else:
            print(0)


if __name__ == '__main__':
    main()


Fixed submission:
import sys
import collections
import bisect
readline = sys.stdin.readline


def main():
    n = int(readline().rstrip())
    aList = sorted(list(map(int, readline().rstrip().split())))
    z = [0] * n
    for a in aList:
        z[a-1] += 1

    for i in range(n):
        print(z[i])


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
readline = sys.stdin.readline


def main():
    n = int(readline().rstrip())
    aList = list(map(int, readline().rstrip().split()))
    aMax = max(aList)
    for i in range(n):
        if aMax >= i + 1:
            print(aList.count(i + 1))
        else:
            print(0)


if __name__ == '__main__':
    main()


Fixed submission:
import sys
import collections
import bisect
readline = sys.stdin.readline


def main():
    n = int(readline().rstrip())
    aList = sorted(list(map(int, readline().rstrip().split())))
    z = [0] * n
    for a in aList:
        z[a-1] += 1

    for i in range(n):
        print(z[i])


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
readline = sys.stdin.readline


def main():
    n = int(readline().rstrip())
    aList = list(map(int, readline().rstrip().split()))
    for i in range(n):
        print(aList.count(i + 1))


if __name__ == '__main__':
    main()


Fixed submission:
import sys
import collections
import bisect
readline = sys.stdin.readline


def main():
    n = int(readline().rstrip())
    aList = sorted(list(map(int, readline().rstrip().split())))
    z = [0] * n
    for a in aList:
        z[a-1] += 1

    for i in range(n):
        print(z[i])


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import math
readline = sys.stdin.readline


def main():
    k = int(input())
    sumGCD = 0
    for a in range(1, k + 1):
        for b in range(1, k + 1):
            for c in range(1, k + 1):
                sumGCD += gcd(a, b, c)
    print(sumGCD)


def gcd(a, b, c):
    return math.gcd(math.gcd(a, b), c)


if __name__ == '__main__':
    main()


Fixed submission:
import sys
import math
import time
readline = sys.stdin.readline


def main():
    listSum = [1, 3, 6]
    k = int(input())
    sumGCD = 0
    for a in range(1, k + 1):
        for b in range(a, k + 1):
            for c in range(b, k + 1):
                sumGCD += gcd(a, b, c) * listSum[len(set([a, b, c])) - 1]
    print(sumGCD)


def gcd(a, b, c):
    return math.gcd(math.gcd(a, b), c)


if __name__ == '__main__':
    s = time.time()
    main()
    # print(time.time() - s)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import math
readline = sys.stdin.readline


def main():
    k = int(readline().rstrip())
    kSum = 0
    for a in range(1, k + 1):
        for b in range(1, k + 1):
            for c in range(1, k + 1):
                kSum += gcd(a, b, c)
    print(kSum)


def gcd(a, b, c):
    return math.gcd(math.gcd(a, b), c)


if __name__ == '__main__':
    main()


Fixed submission:
import sys
import math
import time
readline = sys.stdin.readline


def main():
    listSum = [1, 3, 6]
    k = int(input())
    sumGCD = 0
    for a in range(1, k + 1):
        for b in range(a, k + 1):
            for c in range(b, k + 1):
                sumGCD += gcd(a, b, c) * listSum[len(set([a, b, c])) - 1]
    print(sumGCD)


def gcd(a, b, c):
    return math.gcd(math.gcd(a, b), c)


if __name__ == '__main__':
    s = time.time()
    main()
    # print(time.time() - s)
Buggy python submission (verdict: Runtime Error):
import math
import sys
readline = sys.stdin.readline


def main():
    # input
    n = int(readline().rstrip())
    A = list(map(int, readline().rstrip().split()))
    B = [0] * n

    for a in A:
        B[a - 1] += 1

    total = 0
    for b in B:
        if b > 1:
            total += b * (b - 1) // 2

    C = [0] * n
    for i, b in enumerate(B):
        C[i] = total - b + 1

    for a in A:
        print(C[a-1])


if __name__ == '__main__':
    main()


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

Buggy python submission (verdict: Runtime Error):
import math
import sys
readline = sys.stdin.readline


def main():
    # input
    n = int(readline().rstrip())
    A = list(map(int, readline().rstrip().split()))
    B = [0] * n

    for a in A:
        B[a - 1] += 1

    total = 0
    for b in B:
        if b > 1:
            total += b * (b - 1) // 2

    C = [0] * n
    for i, b in enumerate(B):
        C[i] = total - b + 1

    for a in A:
        print(C[a-1])


if __name__ == '__main__':
    main()


Fixed submission:
n,m = map(int, input().split())
print((n*(n-1)+m*(m-1))//2)
Buggy python submission (verdict: Time Limit Exceeded):
import math
import sys
readline = sys.stdin.readline


def main():
    # input
    n = int(readline().rstrip())
    aList = list(map(int, readline().rstrip().split()))
    aAllList = set(aList)
    aConbiDic = {}
    aDic = {}
    aSum = 0
    for a in aAllList:
        aCount = aList.count(a)
        aDic[str(a)] = aCount
        aConbiDic[str(a)] = (aCount * (aCount - 1)) // 2
        aSum += (aCount * (aCount - 1)) // 2

    for a in aList:
        print(aSum - aDic[str(a)] + 1)


if __name__ == '__main__':
    main()


Fixed submission:
import math
import sys
readline = sys.stdin.readline


def main():
    # input
    n = int(readline().rstrip())
    A = list(map(int, readline().rstrip().split()))
    B = [0] * n

    for a in A:
        B[a - 1] += 1

    total = 0
    for b in B:
        if b > 1:
            total += b * (b - 1) // 2

    C = [0] * n
    for i, b in enumerate(B):
        C[i] = total + (b - 1) * (b - 2) // 2 - (b) * (b - 1) // 2

    for a in A:
        print(C[a-1])


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = list(input())
q = int(input())

for _ in range(q):
    a1, a2, a3 = input().split()

    # a1 = 1の時
    if a1 == "1":
        if s[int(a2) - 1] != a3:
            s[int(a2) - 1] = a3

    # a1 = 2の時
    else:
        print(len(set(s[int(a2) - 1:int(a3)])))


Fixed submission:
n, m = map(int, input().split())
ans = 0
num = ["a"] * n
for _ in range(m):
    s, c = map(int, input().split())
    if s == 1 and c == 0:
        ans = -1
        break
    if num[s - 1] != "a" and num[s - 1] != c:
        ans = -1
        break
    num[s - 1] = c

numStr = ""

if n == 1 and num[0] == "a":
    numStr = ""
    ans = 0

elif num[0] == "a":
    num[0] = "1"

for l in range(n):
    if num[l] == "a":
        numStr += "0"
    else:
        numStr += str(num[l])

print(ans if ans == -1 else numStr)

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = list(input())
q = int(input())

for _ in range(q):
    a1, a2, a3 = input().split()

    # a1 = 1の時
    if a1 == "1" and s[int(a2) - 1] != a3:
        s[int(a2) - 1] = a3

    # a1 = 2の時
    else:
        print(len(set(s[int(a2) - 1:int(a3)])))


Fixed submission:
n, m = map(int, input().split())
ans = 0
num = ["a"] * n
for _ in range(m):
    s, c = map(int, input().split())
    if s == 1 and c == 0:
        ans = -1
        break
    if num[s - 1] != "a" and num[s - 1] != c:
        ans = -1
        break
    num[s - 1] = c

numStr = ""

if n == 1 and num[0] == "a":
    numStr = ""
    ans = 0

elif num[0] == "a":
    num[0] = "1"

for l in range(n):
    if num[l] == "a":
        numStr += "0"
    else:
        numStr += str(num[l])

print(ans if ans == -1 else numStr)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
pList = list(map(int, input().split()))
pListMax = 0

for i in range(n-k+1):
    pListSlice = pList[i:k+i]
    sumA = (sum(pListSlice) + k)/2
    if sumA > pListMax:
        pListMax = sumA
print(pListMax)


Fixed submission:
n, k = map(int, input().split())
pList = list(map(int, input().split()))
pKList = [(1 + p)/2 for p in pList]
pListMax = 0

for i in range(n-k+1):
    if i == 0:
        res = sum(pKList[i:i+k])
    else:
        res = res - pKList[i-1] + pKList[i+k-1]
    pListMax = max(pListMax, res)
print(pListMax)

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
pList = list(map(int, input().split()))
pListMax = 0

for i in range(n):
    pList[i] = (pList[i] + 1) / 2

for i in range(n-k+1):
    pListSlice = pList[i:k+i]
    if sum(pListSlice) > pListMax:
        pListMax = sum(pListSlice)
print(pListMax)


Fixed submission:
n, k = map(int, input().split())
pList = list(map(int, input().split()))
pKList = [(1 + p)/2 for p in pList]
pListMax = 0

for i in range(n-k+1):
    if i == 0:
        res = sum(pKList[i:i+k])
    else:
        res = res - pKList[i-1] + pKList[i+k-1]
    pListMax = max(pListMax, res)
print(pListMax)
Buggy python submission (verdict: Time Limit Exceeded):
import math
import sys
import bisect
readline = sys.stdin.readline


def main():
    n = int(readline().rstrip())
    A = list(map(int, readline().rstrip().split()))
    listA = A
    k = 0

    if listA.count(1) == 0:
        print(-1)
        return

    for i in range(1, n + 1):
        cnt = listA.count(i)
        if cnt == 0:
            break

        idx = listA.index(i)
        listA = listA[idx: len(listA)]
        k += 1

        if len(listA) == 0:
            break
    print(n - k)


if __name__ == '__main__':
    main()


Fixed submission:
import math
import sys
import bisect
readline = sys.stdin.readline


def main():
    n = int(readline().rstrip())
    A = list(map(int, readline().rstrip().split()))
    k = 0

    if A.count(1) == 0:
        print(-1)
        return

    for i in range(n):
        if A[i] == k + 1:
            k += 1

    print(n - k)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
import math
import sys
readline = sys.stdin.readline


def main():
    x = int(readline().rstrip())
    ans = x // 100
    sur = x - ans * 100
    print(1 if sur / ans <= 5 else 0)


if __name__ == '__main__':
    main()


Fixed submission:
import math
import sys
readline = sys.stdin.readline


def main():
    x = int(readline().rstrip())
    ans = x // 100
    if ans == 0:
        print(0)
        return

    sur = x - ans * 100
    print(1 if sur / ans <= 5 else 0)


if __name__ == '__main__':
    main()