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

Fixed submission:
n,q=map(int, input().split())
go_list=[[] for i in range(n+1)]
cnt=[0]*(n+1)
Oya=[False]*(n+1)
Oya[1]=True
for i in range(n-1):
    a,b=map(int, input().split())
    go_list[a].append(b)
    go_list[b].append(a)

for i in range(q):
    p,x=map(int, input().split())
    cnt[p]+=x

from collections import deque
que=deque()

que.append(1)
sumi=[False]*(n+1)
sumi[1]=True
while que:
    ne=que.popleft()
    for i in go_list[ne]:
        if not sumi[i]:
            cnt[i]+=cnt[ne]
            sumi[i]=True
            que.append(i)

cnt.pop(0)
print(*cnt)

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

v = [[] for i in range(n)]
for i in range(n-1):
  a,b = map(int,input().split())
  a -= 1 # listのindex参照をそのまま使いたいので頂点id(1から始まっている)を-1しておく
  b -= 1 # aと同様
  v[a].append(b)
  v[b].append(a)

f = [0]*n
for i in range(q):
  p,x = map(int,input().split())
  p -= 1 # aと同様
  f[p] += x

def dfs(x,d,s): # x:計算する頂点（上側）, d:計算済み(0)か否か(1), s:頂点xの値
  for y in v[x]: # 頂点xとつながる各頂点yの計算を行う
    if d[y]: # 頂点yが計算未了の場合
      s += f[y] # 頂点xの値sに頂点yの値を足す
      ans[y] = s # 頂点yの値はsに確定
      d[y] = 0 # 頂点yの計算は終わったのでd[y]=0とする
      dfs(y,d,s) # 頂点yの下層についても再帰的に計算
      s -= f[y] # 頂点yの下層の計算が終わったので、sを頂点xの値に戻す

ans = [0]*n
d = [1]*n
d[0] = 0
ans[0] = f[0]
s = f[0]
dfs(0,d,s)
Z=[str(a) for a in ans]
Z=" ".join(Z)
print(Z)

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

v = [[] for i in range(n)]
for i in range(n-1):
  a,b = map(int,input().split())
  a -= 1 # listのindex参照をそのまま使いたいので頂点id(1から始まっている)を-1しておく
  b -= 1 # aと同様
  v[a].append(b)
  v[b].append(a)

f = [0]*n
for i in range(q):
  p,x = map(int,input().split())
  p -= 1 # aと同様
  f[p] += x

def dfs(x,d,s): # x:計算する頂点（上側）, d:計算済み(0)か否か(1), s:頂点xの値
  for y in v[x]: # 頂点xとつながる各頂点yの計算を行う
    if d[y]: # 頂点yが計算未了の場合
      s += f[y] # 頂点xの値sに頂点yの値を足す
      ans[y] = s # 頂点yの値はsに確定
      d[y] = 0 # 頂点yの計算は終わったのでd[y]=0とする
      dfs(y,d,s) # 頂点yの下層についても再帰的に計算
      s -= f[y] # 頂点yの下層の計算が終わったので、sを頂点xの値に戻す

ans = [0]*n
d = [1]*n
d[0] = 0
ans[0] = f[0]
s = f[0]
dfs(0,d,s)
print(*ans)
Problem p02947 (python)

Fixed submission:
S=[]
n = int(input())
for i in range(n):
    s=''.join(sorted(input()))
    S.append(s)
import collections
from scipy.special import comb
a=0
Sd=list(set(S))
c = collections.Counter(S)
for p in  range(len(Sd)):
    if c[Sd[p]] >=2:
        a  += comb(c[Sd[p]], 2, exact=True)
print(a)

Buggy submission (verdict: Runtime Error):
S=[]
cho=[0]
p=0
n = int(input())
for i in range(n):
    s=sorted(input())
    if s in S:
        cho[p]+=1
        p+=1
    S.append(s)
import collections
from scipy.special import comb
a=0
Sd=list(set(S))
c = collections.Counter(S)
for p in  range(len(Sd)):
    if c[Sd[p]] >=2:
        a  += comb(c[Sd[p]], 2, exact=True)
print(a)

Buggy submission (verdict: Runtime Error):
S=[]
cho=[0]
p=0
n = int(input())
for i in range(n):
    s=sorted(input())
    if s in S:
        cho[p]+=1
        p+=1
    S.append(s)
import collections
from scipy.special import comb
a=0
Sd=list(set(S))
c = collections.Counter(S)
for p in  range(len(Sd)):
    if c[Sd[p]] >=2:
        a  += comb(c[Sd[p]], 2, exact=True)
print(a)
Problem p03076 (python)

Fixed submission:
# B - Five Dishes
import numpy as np
n=[]
for i in range(5):
    t = int(input())
    n.append(t)
n = np.array(n)
dl = [0]
s = np.ceil(n/10)*10

if max(n%10)==0:
    print(int(np.sum(s)))
    exit()
m = [e for e in n%10 if e not in dl]
print(int(np.sum(s)-(10-min(m))))

Buggy submission (verdict: Runtime Error):
# B - Five Dishes
import numpy as np
n=[]
for i in range(5):
    t = int(input())
    n.append(t)
n = np.array(n)
dl = [0]
m = [e for e in n%10 if e not in dl]
s = np.ceil(n/10)*10
print(int(np.sum(s)-(10-min(m))))

Buggy submission (verdict: Runtime Error):
# B - Five Dishes
import numpy as np
n=[]
for i in range(5):
    t = int(input())
    n.append(t)
n = np.array(n)

m = [e for e in n%10 if e not in dl]
s = np.ceil(n/10)*10
print(int(np.sum(s)-min(m)))

Buggy submission (verdict: Runtime Error):
# B - Five Dishes
import numpy as np
n=[]
for i in range(5):
    t = int(input())
    n.append(t)
n = np.array(n)

m = [e for e in n%10 if e not in dl]
s = np.ceil(n/10)*10
print(int(np.sum(s)-min(m)))

Buggy submission (verdict: Runtime Error):
# B - Five Dishes
import numpy as np
n=[]
for i in range(5):
    t = int(input())
    n.append(t)
n = np.array(n)

m = [e for e in n%10 if e not in dl]
s = np.ceil(n/10)*10
print(int(np.sum(s)-min(m))

Buggy submission (verdict: Runtime Error):
# B - Five Dishes
import numpy as np
n=[]
for i in range(5):
    t = int(input())
    n.append(t)
n = np.array(n)

m = [e for e in n%10 if e not in dl]
s = np.ceil(n/10)*10
print(np.sum(s)-min(m))
Problem p03102 (python)

Fixed submission:
# その24
# ABC121 B - Can you solve this?

import numpy as np

n,m,c=map(int,input().split())
B = np.array(list(map(int,input().split())))
K=[]
for i in range(n):
    A = list(map(int,input().split()))
    K.append(A)

pp = np.array(K)
l = (pp*B).sum(axis=1)+c

t = 0
for i in range(len(l)):
    if l[i] > 0:
        t+=1
print(t)

Buggy submission (verdict: Runtime Error):
# その24
# ABC121 B - Can you solve this?

n,m,c=map(int,input().split())
B = np.array(list(map(int,input().split())))
K=[]
for i in range(n):
    A = list(map(int,input().split()))
    K.append(A)

import numpy as np
pp = np.array(K)
l = (pp*B).sum(axis=1)+c

t = 0
for i in range(len(l)):
    if l[i] > 0:
        t+=1
print(t)

Buggy submission (verdict: Runtime Error):
# その24
# ABC121 B - Can you solve this?

n,m,c=map(int,input().split())
B = np.array(list(map(int,input().split())))
K=[]
for i in range(n):
    A = list(map(int,input().split()))
    K.append(A)

import numpy as np
pp = np.array(K)
l = (pp*B).sum(axis=1)+c

t = 0
for i in range(len(l)):
    if l[i] > 0:
        t+=1
print(t)
Problem p03261 (python)

Fixed submission:
n =int(input())
W=[]
w=''
for i in range(n):
    s=str(input())
    if i !=0 and w[-1] != s[0]:
        print('No')
        exit()
    else:
        w=s
        W.append(w)
if len(W) != len(list(set(W))):
    print('No')
    exit()
print('Yes')

Buggy submission (verdict: Runtime Error):
n =int(input())
W=[]
w=''
for i in range(n):
    if i !=0 and w[-1] !=str(input())[0]:
        print('No')
        exit()
    else:
        w=str(input())
        W.append(w)
if len(W) != len(list(set(W))):
    print('No')
    exit()
print('Yes')
Problem p03285 (python)

Fixed submission:
n=int(input())
cnt=0
for x in range(n):
    for y in range(n):
        if x*4+y*7==n:
            print('Yes')
            exit()
print('No')

Buggy submission (verdict: Runtime Error):
n=int(input())
cnt=0
for x in range(n):
    for y in range(n):
        if x*4+y*7==n:
            print('Yes')
            exit'
print('No')
Problem p03471 (python)

Fixed submission:
n, y = map(int, input().split())
for i in range(n + 1):
    for j in range(n - i + 1):
        if i * 10000 + j * 5000 + (n - i - j) * 1000 == y:
            print(i, j, n - i - j)
            exit()
print("-1 -1 -1")

Buggy submission (verdict: Runtime Error):
N = int(input())
Y = int(input())
for x in range(N+1):
    for y in range(N+1):
        for z in range(N+1):
            if 10000*x+5000*y+1000*z == Y:
                print(x,y,z)
Problem p03478 (python)

Fixed submission:
N, A, B = map(int, input().split())
count = 0
for n in range(1,N+1):
    s = 0
    t = n
    while (n>0):
        s = s + n%10
        n = n//10
    if s >= A and s <= B:
        count +=t
print(count)

Buggy submission (verdict: Runtime Error):
N, A, B = [int(input()) for i in range(3)]
count = 0
for n in range(1,N+1):
    s = 0
    t = n
    while (n>0):
        s = s + n%10
        n = n//10
    if s >= A and s <= B:
        count +=t
print(count)
Problem p03760 (python)

Fixed submission:
#その10

O = str(input())
E = str(input())
P = []
for i in range(len(O)):
    P.append(O[i])
    if i < len(E):
        P.append(E[i])
print(''.join(P))

Buggy submission (verdict: Runtime Error):
#その10

O = str(input())
E = str(input())
P = []
for i in range(len(O)):
    P.append(O[i])
    if i <= len(E):
        P.append(E[i])
print(''.join(P))
Problem p03814 (python)

Fixed submission:
s =str(input())
for i in range(len(s)):
    if s[i]=='A':
        a=i
        break
for j in reversed(range(len(s))):
    if s[j]=='Z':
        b=j
        break
print(b-a+1)

Buggy submission (verdict: Runtime Error):
for i in range(len(s)):
    if s[i]=='A':
        a=i
        break
for j in reversed(range(len(s))):
    if s[j]=='Z':
        b=j
        break
print(b-a+1)
Problem p02583 (python)

Fixed submission:
n = int(input().strip())
x = list(map(int, input().strip().split()))
count=0
for i in range(0,n-2):
    for j in range(i,n-1):
        if(x[i]==x[j]):
            continue
        for k in range(j,n):
            if((x[i]==x[k])or(x[j]==x[k])):
                continue
            if ((x[i]+x[j]>x[k])and(x[i]+x[k]>x[j])and(x[j]+x[k]>x[i])):
                count+=1
print(count)

Buggy submission (verdict: Runtime Error):
x=[]
n=int(input())
for i in range(0,n):
    xa=int(input())
    x.append(xa)
count=0
for i in range(0,n-2):
    for j in range(i,n-1):
        if(x[i]==x[j]):
            continue
        for k in range(j,n):
            if((x[i]==x[k])or(x[j]==x[k])):
                continue
            if ((x[i]+x[j]>x[k])and(x[i]+x[k]>x[j])and(x[j]+x[k]>x[i])):
                count+=1
print(count)

Buggy submission (verdict: Runtime Error):
x=[]
n=int(input())
for i in range(0,n):
    xa=int(input())
    x.append(xa)
count=0
for i in range(0,n-2):
    for j in range(i,n-1):
        if(x[i]==x[j]):
            continue
        for k in range(j,n):
            if((x[i]==x[k])or(x[j]==x[k])):
                continue
            if ((x[i]+x[j]>x[k])and(x[i]+x[k]>x[j])and(x[j]+x[k]>x[i])):
                count+=1
print(count)

Buggy submission (verdict: Runtime Error):
x=[]
n=int(input())
for i in range(0,n):
    xa=int(input())
    x.append(xa)
count=0
for i in range(0,n-2):
    for j in range(i,n-1):
        if(x[i]==x[j]):
            continue
        for k in range(j,n):
            if((x[i]==x[k])or(x[j]==x[k])):
               continue
            if ((x[i]+x[j]>x[k])or(x[i]+x[k]>x[j])or(x[j]+x[k]>x[i])):
                count+=1
print(count)
Problem p02612 (python)

Fixed submission:
x=int(input())
x=1000-x%1000
if(x==1000):
    x=0
print(x)

Buggy submission (verdict: Runtime Error):
x=int(input())
x=1000-x%1000
if(x==1000):
    x=0
return(x)

Buggy submission (verdict: Runtime Error):
print('N')
x=int(input())
x=1000-x%1000
if(x==1000):
    x=0
return(x)
Problem p02613 (python)

Fixed submission:
x=int(input())
cac=0
cwa=0
ctle=0
cre=0

for i in range(0,x):
    moji=input()
    if(moji=='AC'):
        cac+=1
    if(moji=='WA'):
        cwa+=1
    if(moji=='TLE'):
        ctle+=1
    if(moji=='RE'):
        cre+=1
print('AC x ',cac)
print('WA x' ,cwa)
print('TLE x ',ctle)
print('RE x' ,cre)

Buggy submission (verdict: Runtime Error):
x=int(input())
cac=0
cwa=0
tle=0
cre=0

for i in range(0,x):
    moji=input()
    if(moji=='AC'):
        cac+=1
    if(moji=='WA'):
        cwa+=1
    if(moji=='TLE'):
        ctle+=1
    if(moji=='RE'):
        cre+=1
print('AC x ',cac)
print('WA x' ,cwa)
print('TLE x ',ctle)
print('RE x' ,cre)

Buggy submission (verdict: Runtime Error):
x=int(input())
cac=0
cwa=0
tle=0
cre=0

for i in range(0,x):
    moji=input()
    if(moji='AC'):
        cac+=1
    if(moji='WA'):
        cwa+=1
    if(moji='TLE'):
        ctle+=1
    if(moji='RE'):
        cre+=1
print('AC x',cac)
print('WA x',cwa)
print('TLE x',ctle)
print('RE x',cre)
Problem p02756 (python)

Fixed submission:
str = input()
times = int(input())
revers = 0
head = ""
tail = ""
for i in range(times):
    com = input().split()
    if com[0] == "1":
        if revers == 0:
            revers = 1
        else :
            revers = 0
        
    else :
        if com[1] == "1":
            if revers == 0:
                head = com[2]+head
            else :
                tail = tail + com[2]
        else : 
            if revers == 1:
                head = com[2]+head
            else :
                tail = tail + com[2]          
str = head + str + tail
if revers == 1:
    str = str[::-1]
                
print(str)

Buggy submission (verdict: Runtime Error):
str = input()
times = int(input())
revers = 0
head = ""
tail = ""
for i in range(times):
    com = input().split()
    if com[0] == "1":
        if revers == 0:
            revers = 1:
        else :
            revers = 0
        
    else :
        if com[1] == "1":
            if revers == 0:
                head = com[2]+head
            else :
                tail = tail + com[2]
        else : 
            if revers == 1:
                head = com[2]+head
            else :
                tail = tail + com[2]          
str = head + str + tail
if revers == 1:
    str = str[::-1]
                
print(str)
Problem p02541 (python)

Fixed submission:
def inv_gcd(a, b):
    a = (a + b) % b
    if a == 0:
        return (b, 0)
    s, t = b, a
    m0, m1 = 0, 1
 
    while t:
        u = s // t
        s -= t * u
        m0 -= m1 * u
 
        tmp = s
        s = t
        t = tmp
        tmp = m0
        m0 = m1
        m1 = tmp
    
    if m0 < 0:
        m0 += b // s
    return (s, m0)
 
 
def crt(r, m):
    n = len(r)
    r0, m0 = 0, 1
 
    for i in range(n):
        r1, m1 = (r[i] + m[i]) % m[i], m[i]
 
        if m0 < m1:
            m0, m1 = m1, m0
            r0, r1 = r1, r0
        
        if m0 % m1 == 0:
            if r0 % m1 != r1:
                return (0, 0)
            continue
        
        g, im = inv_gcd(m0, m1)
 
        u1 = m1 // g
        if (r1 - r0) % g:
            return (0, 0)
        
        x = (r1 - r0) // g % u1 * im % u1
 
        r0 += x * m0
        m0 *= u1
        if (r0 < 0):
            r0 += m0
        
    return (r0, m0)


def divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i:
        divisors.append(n//i)
  divisors.sort()
  return divisors


# print(divisors(z))

z=int(input())


ans = z-1 if z%2 else 2*z-1
for i in divisors(2*z):
  y=2*z//i
  if y == 1:
    continue
  a=[0,-1]
  b=[i,y]
  rem, mod = crt(a, b)
  #print(rem)
  #print(mod)
  if rem == mod == 0:
      continue
  ans = min(ans, rem)

print(ans if z-1 else 1)

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

def solv_quadratic_equation(a, b, c):
  """ 2次方程式を解く  """
  D = (b**2 - 4*a*c) ** (1/2)
  x_1 = (-b + D) / (2 * a)
  x_2 = (-b - D) / (2 * a)

  return x_1,x_2

ans=0

i=1

# print(10**15)

# a,b=solv_quadratic_equation(1,1,1000000000000000)

# print(a,b)

while True:

  a,b=solv_quadratic_equation(1,1,-2*z*i)

  if a>=b:
    if a.is_integer():
      # print(a)
      # print(b)
      ans=a
      break
  elif a=<b:
    if b.is_integer():
      # print(a)
      # print(b)
      ans=b
      break

  i+=1

print(int(ans))
Problem p02657 (python)

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

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

Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))
total_1 = 0
for i in range (n - 1):
    for j in range (i + 1, n):
        if a[i] > a[j]:
            total_1 += 1
total_2 = 0
for i in range (n):
    for j in range (n):
        if a[i] > a[j]:
            total_2 += 1
print((total_1 * k + (total_2 * k * (k - 1)) // 2) % (10 ** 9 + 7))

Buggy submission (verdict: Runtime Error):
#include <iostream>
#include <vector>
#include<algorithm>
#define intt long long
const intt NUM = 1000000007;

int main(){
	intt N{}, K{}, initi{}, initi2{}; std::cin >> N >> K;
	std::vector<intt> A(N); for (auto& r : A) { std::cin >> r; }
	for (intt i = 0; i < N - 1; ++i) for (intt j = i + 1; i < N; ++i) if (A[i] > A[j]) {++initi; initi %= NUM;}
	for (intt i = 0; i < N; ++i) for (intt j = 0; j < N; ++j) if (A[i] > A[j]) { ++initi2; initi2 %= NUM; }
	std::cout << ((((initi % NUM) * K) % NUM) + ((initi2 % NUM) * (((K * (K - 1)) % NUM) / 2) ) % NUM)<< std::endl;
	return 0;
}

Buggy submission (verdict: Runtime Error):
#include <iostream>
#include <vector>
#include<algorithm>
#define intt long long
const intt NUM = 1000000007;

int main(){
	intt N, K, initi, initi2{}; std::cin >> N >> K;
	std::vector<intt> A(N); for (auto& r : A) { std::cin >> r; }
	for (intt i = 0; i < N - 1; ++i) for (intt j = i + 1; i < N; ++i) if (A[i] > A[j]) {++initi; initi %= NUM;}
	for (intt i = 0; i < N; ++i) for (intt j = 0; j < N; ++j) if (A[i] > A[j]) { ++initi2; initi2 %= NUM; }
	std::cout << ((((initi % NUM) * K) % NUM) + ((initi2 % NUM) * (((K * (K - 1)) % NUM) / 2) ) % NUM)<< std::endl;
	return 0;
}

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
a = list(map(int, input().split()))
total_1 = 0
for i in range (n - 1):
    for j in range (i + 1, n):
        if a[i] > a[j]:
            total_1 += 1
total_2 = 0
for i in range (n):
    for j in range (n):
        if a[i] > a[j]:
            total_2 += 1
print((total_1 * k + (total_2 * k * (k - 1)) // 2) % (10 ** 9 + 7)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
a = list(map(int, input().split()))
total_1 = 0
for i in range (n - 1):
    for j in range (i, n):
        if a[i] > a[j]:
            total_1 += 1
total_2 = 0
for i in range (n):
    for j in range (i):
        if a[i] > a[j]:
            total_2 += 1
def factorial(n):
    total = 0
    while(n > 0):
        total += n
        n -= 1
    return total

print(total_1 * K + total_2 * factorial(K - 1))
Problem p03043 (python)

Fixed submission:
D, P = map(int, input().split())    
ans = 0.0
def func(i):
    t = 0
    while(i < P):
        i *= 2
        t += 1
    return t

for i in range(1, D + 1):
    ans += float((1/D)) * float(((1 / 2) ** func(i)))

print(ans)

Buggy submission (verdict: Runtime Error):
D = int(input())
P = int(input())
ans = 0.0
def func(i):
    t = 0
    while(i < P):
        i *= 2
        t += 1
    return t

for i in range(1, D + 1):
    ans += float((1/D)) * float(((1 / 2) ** func(i)))

print(ans)
Problem p03059 (python)

Fixed submission:
A,B,T = map(int,input().split())
x = T // A
y = B * x
print(y)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
T = int(input())
x = T // A
y = B * x
print(y)

Buggy submission (verdict: Runtime Error):
x = T % A
y = x * B
print(y)
Problem p03060 (python)

Fixed submission:
N = int(input())
list1 = input().split()
list2 = input().split()
x = 0
y = 0
for i in range(N):
    x = int(list1[i]) - int(list2[i])
    if x > 0:
         y += x
print(y)

Buggy submission (verdict: Runtime Error):
N = int(input())
list1 = map(int,input().split())
list2 = map(int,input().split())
x = 0
for i in range(N):
    x = list1[i] - list2[i]
    if x >> 0:
         y += x
print(y)

Buggy submission (verdict: Runtime Error):
N = int(input())
list1 = []
for i in range(N):
    list1.append(int(input))
list2 = []
for i in range(N):
    list2.append(int(input))
x = 0
for i in range(N):
    x = list1[i] - list2[i]
    if x >> 0:
         y += x
print(y)
Problem p04047 (python)

Fixed submission:
n = int(input())
list_L = list(map(int, input().split()))
list_L.sort()
sum = 0
for i in range(n):
    sum += list_L[2*i]
print(sum)

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

L.sort()
s = 0

for n in range(N):
    s += L[2*n}

print(s)

Buggy submission (verdict: Runtime Error):
N = int(input())
L = list(map(int,input().split())
 
L.sort()
 
s = 0
 
for n in range(N):
    s += L[2*n]
print(s)

Buggy submission (verdict: Runtime Error):
N = input()
L = list(map(int,input().split())
 
L.sort()
 
s = 0
 
for n in range(N):
    s += L[2*n]
print(s)

Buggy submission (verdict: Runtime Error):
N =int( input())
L = list(map(int,input().split())
 
L.sort
 
s = 0
 
for n in range(N):
    s += L[2*n]
print(s)

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

L.sort

s = 0

for n in range(N):
    s += L[2*n]
print(s)
Problem p04048 (python)

Fixed submission:
N,X = map(int,input().split(" "))
 
Y,X = sorted([N - X,X])
 
s = 0
while Y:
    s += (X//Y)*Y*3
    Y,X = [X%Y,Y]
 
print(s)

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


def para(a,b):
    if a == b:
        return a
    if a > b:
        return 2*b + para(b,a-b)
    if a < b:
        return 2*a + para(a,b-a)

print(N+para(X,N-X))

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


def para(a,b):
    if  b == 0:
        return a
    if a >= b:
        return a+b + para(b,a-b)
    if a < b:
        return 2*a + para(a,b-a)

print(X+para(X,N-X))

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


def para(a,b):
    if a > b:
        return a+b + para(b,a-b)
    if a < b:
        return 2*a + para(a,b-a)
    if a == b:
        return 3*a
print(X+para(X,N-X))

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

def para(a,b):
    if a > b:
        return a+b + para(b,a-b)
    if a < b:
        return 2*a + para(a,b-a)
    if a == b:
        return 3*a
print(X+para(X,N-X))

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

def para(a,b):
    if a > b:
        return 2*b + para(b,a-b)
    if a < b:
        return 2*a + para(b-a,a)
    if a == b:
        return a
print(N+para(X,N-X))
Problem p02548 (python)

Fixed submission:
n = int(input())

cnt = 0
for a in range(1, n):
    cnt +=(n -1)// a
print(cnt)

Buggy submission (verdict: Runtime Error):

cnt = 0
for a in range(1, n):
    cnt +=(n -1)// a
print(cnt)

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

cnt = 0
for r in range(1, n):
    for a in range(1, (a // 2) +1):
        if r % a == 0:
            cnt += 1
print(cnt)
Problem p02608 (python)

Fixed submission:
import math

n = int(input())
ans = [0] * (n+1)

f = int(math.sqrt(n)) + 1
for x in range(1, f):
    for y in range(1, f):
        for z in range(1, f):
            v = (x ** 2) + (y ** 2) + (z ** 2) + (x * y) + (y * z) + (z * x)
            if v < n + 1:
                ans[v] += 1
            
for i in range(n):
    print(ans[i+1])

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = [0] * (n+1)

f = int(math.sqrt(n)) + 1
for x in range(1, f):
    for y in range(1, f):
        for z in range(1, f):
            v = (x ** 2) + (y ** 2) + (z ** 2) + (x * y) + (y * z) + (z * x)
            if v < n + 1:
                ans[v] += 1
            
for i in range(n):
    print(ans[i+1])
Problem p02612 (python)

Fixed submission:
n = int(input())

if n >= 1000:
    n = int(str(n)[1:])

if n > 0:
    ans = 1000 - n
else:
    ans = 0

print(ans)

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

if n >= 1000:
    n = int(str(n[1:]))

if n > 0:
    ans = 1000 - n
else:
    ans = 0

print(ans)

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

n = int(n[1:])
if n > 0:
    ans = 1000 - n
else:
    ans = 0

print(ans)