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

Fixed submission:
#coding: UTF-8
import math
N = int(input())
#print(N)

ans = [0]*10001

for x in range(1,101):
  for y in range(1,101):
    for z in range(1,101):
      a = x**2+y**2+z**2+x*y+y*z+z*x
      if a <=10000:
        ans[a] += 1
    
for i in range(1,N+1):
  print(ans[i])

Buggy submission (verdict: Runtime Error):
#coding: UTF-8
import math
N = int(input())
#print(N)

ans = [0]*N

for i in range(1,N+1):
  if i <=5:
    ans[i] = 0
    continue
  cnt = 0
  m = int(math.sqrt(i))
  #平方根までやればよい
  for x in range(1,m):
    if i - x**2 <= 4:
      continue
    for y in range(x,m):
      if i - x**2 -y**2 <= 3:
        continue
      for z in range(y,m):
        a = (x+y+z)**2 -x*y -y*z - z*x
        if a == i:
          if x==y==z:
            cnt += 1
          elif x==y or y==z:
            cnt += 3
          else:
            cnt += 6
  ans[i-1] = cnt
print('\n'.join(map(str, ans)))
Problem p03352 (python)

Fixed submission:
X=int(input())
li=[x**p for x in range(1,32) for p in range(2,35) if x**p<=X]
print(max(li))

Buggy submission (verdict: Runtime Error):
X=int(input())
li=[x**p for x in range(2,32) for p in range(2,35) if x**p<=X]
print(max(li))
Problem p03385 (python)

Fixed submission:


import numpy as np

s=sorted(input())

if(s==list("abc")):print("Yes")
else:print("No")

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;

#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
 
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}

void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
////////////////////////////

int main(){fastio
    
    return 0;
}
Problem p03597 (python)

Fixed submission:


import numpy as np

n=int(input())
a=int(input())
print(n*n-a)

Buggy submission (verdict: Runtime Error):


#import numpy as np

n,a=map(int,input().split())
print(n*n-a)

Buggy submission (verdict: Runtime Error):


import numpy as np

n,a=map(int,input().split())
print(n*n-a)
Problem p03633 (python)

Fixed submission:


import numpy as np

def gcd(a,b):
    if(a>b):
        a,b=b,a
    if(a==0):return b
    return gcd(b%a,a)

t=int(input())
ans=1
for _ in range(t):
    k=int(input())
    ans=ans*k//gcd(ans,k)
print(ans)

Buggy submission (verdict: Runtime Error):


import numpy as np
import fractions as fra

t=int(input())
ans=1
for _ in range(t):
    ans=ans*int(input())/fra.gcd(ans,int(input()))
print(ans)
Problem p03697 (python)

Fixed submission:

import numpy as np
import fractions as fra


h,w=map(int,input().split())
if(h+w>=10):
    print("error")
else:
    print(h+w)

Buggy submission (verdict: Runtime Error):


import numpy as np
import fractions as fra


h,w=map(int,input().split())
if(h+w>=10):
    print("error"):
else:
    print(h+w)
Problem p03711 (python)

Fixed submission:


import numpy as np
import fractions as fra



a=[0,3,1,3,2,3,2,3,3,2,3,2,3]

x,y=map(int,input().split())
if(a[x]==a[y]):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):


import numpy as np
import fractions as fra



a[13]={0,3,1,3,2,3,2,3,3,2,3,2,3}

x,y=map(int,input().split())
if(a[x]==a[y]):
    print("Yes")
else:
    print("No")
Problem p03730 (python)

Fixed submission:


import numpy as np
import fractions as fra

a,b,c=map(int,input().split())

g=fra.gcd(a,b)
if(c%g==0):
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):


import numpy as np
import math

a,b,c=map(int,input().split())

g=math.gcd(a,b)
if(c%g==0):
    print("YES")
else:
    print("NO")
Problem p03737 (python)

Fixed submission:


import numpy as np
import math


s=" "+input()
for i in range(len(s)):
    if(s[i]==" "):
        print(chr(ord(s[i+1])-32),end="")
print()

Buggy submission (verdict: Runtime Error):


import numpy as np
import math


s=" "+input()
for i in range(len(s)):
    if(s[i]==" "):
        print(char((ord)s[i+1]-(ord)'a'+(ord)'A'),end="")
print()
Problem p02584 (python)

Fixed submission:
x,k,d=map(int,input().split())
x=abs(x)
if x>k*d:
    print(x-k*d)
else:
    k-=x//d
    x-=(d*(x//d))
    ans=[x,abs(d-x)]
    print(ans[k%2])

Buggy submission (verdict: Runtime Error):
x, k, d = ma-(int, input().split())
x = abs(x)

if x>k*d:
    print(x-k*d)
else:
    k-=x//d
    x-=(d*(x//d))
    and=[x,abs(d-x)]
    print(ans[k%2])

Buggy submission (verdict: Runtime Error):
import math;

# input 現在座標ｘ, 移動回数k, 移動距離d
x, k, d = map(int, input().split())


a = math.floor(x / d);

if a > k:
    for i in range(k):
        if x > 0:
            x = x - d;
        elif x <= 0:
            x = x + d;

elif a <= k:
    # あまり
    s = k%a;
    
    for i in range(a+s):
        if x > 0:
            x = x - d;
        elif x <= 0:
            x = x + d;
            
# xが負の数の場合正の数に編集する
if x < 0:
    x = x * (-1);

print(x);
Problem p02922 (python)

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

c = 1
d = 0
while c < b:
    c = c+a-1
    d+=1
    
print(d)

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

c = 1
d = 0
for b >= c:
    c = c+a-1
    d++
    
print(d)
Problem p03246 (python)

Fixed submission:
a = [list(map(int, input().split())) for i in range(2)]

even = a[1][0::2]
odd = a[1][1::2]

evendic = {}
odddic = {}

evenmax = []
oddmax = []

ans = 0

for i in even:
    if i in evendic:
        evendic[i] += 1
    else:
        evendic[i] = 1
  
for i in odd:
    if i in odddic:
        odddic[i] += 1
    else:
        odddic[i] = 1

evennum = max(evendic.values())
oddnum = max(odddic.values())

for k, v in evendic.items():
    if v == evennum :
        evenmax.append(k)

for k, v in odddic.items():
    if v == oddnum:
        oddmax.append(k)

if len(set(even)) == 1 and len(set(odd)) == 1:
    if even == odd:
        ans = a[0][0] // 2

elif evennum == oddnum:
    if len(evenmax) >= 2 or len(oddmax) >= 2:
        ans = a[0][0] - evennum * 2
    elif max(evendic.items(), key = lambda x:x[1])[0] != max(odddic.items(), key = lambda x:x[1])[0]:
        ans = a[0][0] - evennum * 2
    else:
        ans = a[0][0] - evennum - max([sorted(odddic.values())[-2], sorted(evendic.values())[-2]])

else:
    if max(evendic.items(), key = lambda x:x[1])[0] != max(odddic.items(), key = lambda x:x[1])[0]:
        ans = a[0][0] - evennum - oddnum
    else:
        if evennum > oddnum:
            ans = a[0][0] - evennum - sorted(odddic.values())[-2]
        else:
            ans = a[0][0] - oddnum - sorted(evendic.values())[-2]

    
print(ans)

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

even = a[1][0::2]
odd = a[1][1::2]

evendic = {}
odddic = {}

evenmax = []
oddmax = []

ans = 0

for i in even:
    if i in evendic:
        evendic[i] += 1
    else:
        evendic[i] = 1
  
for i in odd:
    if i in odddic:
        odddic[i] += 1
    else:
        odddic[i] = 1

evennum = max(evendic.values())
oddnum = max(odddic.values())

for k, v in evendic.items():
    if v == evennum :
        evenmax.append(k)

for k, v in odddic.items():
    if v == oddnum:
        oddmax.append(k)

if evennum == oddnum:
    if len(evenmax) >= 2 or len(oddmax) >= 2:
        ans = a[0][0] - evennum * 2
    elif max(evendic.items(), key = lambda x:x[1])[0] != max(odddic.items(), key = lambda x:x[1])[0]:
        ans = a[0][0] - evennum * 2
    else:
        ans = a[0][0] - evennum - max([sorted(odddic.values())[-2], sorted(evendic.values())[-2]])

else:
    if max(evendic.items(), key = lambda x:x[1])[0] != max(odddic.items(), key = lambda x:x[1])[0]:
        ans = a[0][0] - evennum - oddnum
    else:
        if evennum > oddnum:
            ans = a[0][0] - evennum - sorted(odddic.values())[-2]
        else:
            ans = a[0][0] - oddnum - sorted(evendic.values())[-2]

    
print(ans)
Problem p02806 (python)

Fixed submission:
n=int(input())
s=list(input().strip().split() for _ in range(n))
x=input().strip()

ans=0
isis=False
for ss,tt in s:
  if isis:
    ans += int(tt)
  if ss==x:
    isis=True
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=list(input().strip().split() for _ in range(n))
x=input().strip()

ans=0
isis=False
for ss,tt in s:
  if isis:
    ans += (tt)
  if ss==x:
    isis=True
print(ans)
Problem p02936 (python)

Fixed submission:
import sys
sys.setrecursionlimit(pow(10, 6))
input = sys.stdin.readline

def dfs(i, d):
  visited[i] = True
  ans[i] = d + pp[i]
  for j in edges[i]:
    if not visited[j]:
      dfs(j, d + pp[i])

n, q = map(int, input().split())
ans = [0 for _ in range(n)]
visited = [False for _ in range(n)]
edges = [[] for _ in range(n)]
for _ in range(n-1):
  a, b = map(int, input().split())
  edges[a-1].append(b-1)
  edges[b-1].append(a-1)
pp = [0 for _ in range(n)]
for _ in range(q):
  p, x = map(int, input().split())
  pp[p-1] += x
dfs(0, 0)
print(*ans)

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

def dfs(i, d):
  visited[i] = True
  ans[i] = d + pp[i]
  for j in edges[i]:
    if not visited[j]:
      dfs(j, d + pp[i])

n, q = map(int, input().split())
ans = [0 for _ in range(n)]
visited = [False for _ in range(n)]
edges = [[] for _ in range(n)]
for _ in range(n-1):
  a, b = map(int, input().split())
  edges[a-1].append(b-1)
  edges[b-1].append(a-1)
pp = [0 for _ in range(n)]
for _ in range(q):
  p, x = map(int, input().split())
  pp[p-1] += x
dfs(0, 0)
print(*ans)
Problem p02960 (python)

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

MOD = pow(10, 9) + 7

def main():
  s = input().strip()
  sd = [[0 for _ in range(13)] for _ in range(len(s))]
  if s[-1] == '?':
    for i in range(10):
      sd[0][i] = 1
  else:
    sd[0][int(s[-1])] = 1

  for i, _s in enumerate(s[::-1]):
    if i == 0:
      continue
    if _s != '?':
      rem = int(_s) * pow(10, i, 13) % 13
      for j in range(13):
        sd[i][(j+rem)%13] = sd[i-1][j]
    else:
      for k in range(10):
        rem = k * pow(10, i, 13) % 13
        for j in range(13):
          sd[i][(j+rem)%13] += sd[i-1][j]
          sd[i][(j+rem)%13] %= MOD
  print(sd[len(s)-1][5])


if __name__ == '__main__':
  main()

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

MOD = pow(10, 9) + 7

def main():
  s = input().strip()
  sd = [[0 for _ in range(13)] for _ in range(len(s))]
  if s[-1] == '?':
    for i in range(10):
      sd[0]]i] = 1
  else:
    sd[0][int(s[-1])] = 1

  for i, _s in enumerate(s[::-1]):
    if i == 0:
      continue
    if _s != '?':
      rem = int(_s) * pow(10, i, 13) % 13
      for j in range(13):
        sd[i][(j+rem)%13] = sd[i-1][j]
    else:
      for k in range(10):
        rem = k * pow(10, i, 13) % 13
        for j in range(13):
          sd[i][(j+rem)%13] += sd[i-1][j]
          sd[i][(j+rem)%13] %= MOD
  print(sd[5])


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

Fixed submission:
def main():
  n = int(input())
  alist = list(sorted(map(int, input().split())))
  aset = set(alist)
  tmpal = list(aset)
  if len(aset) > 3:
    print('No')
  elif len(aset) == 1:
    if tmpal[0] == 0:
      print('Yes')
    else:
      print('No')
  elif n % 3 != 0:
    print('No')
  else:
    if len(aset) == 2:
      if alist.count(0) == n // 3:
        print('Yes')
      else:
        print('No')
    else:
      if tmpal[0] ^ tmpal[2] == tmpal[1]:
        nd = {tmpal[0]: 0, tmpal[1]: 0, tmpal[2]: 0}
        for a in alist:
          nd[a] += 1
        if nd[tmpal[0]] == nd[tmpal[1]] and nd[tmpal[1]] == nd[tmpal[2]]:
          print('Yes')
        else:
          print('No')
      else:
        print('No')


if __name__ == '__main__':
  main()

Buggy submission (verdict: Runtime Error):
def main():
  n = int(input())
  alist = list(sorted(map(int, input().split())))
  if n % 3 != 0:
    print('No')
  else:
    aset = set(alist)
    tmpal = list(aset)
    if tmpal[0] ^ tmpal[2] == tmpal[1]:
      print('Yes')
    else:
      print('No')


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

Fixed submission:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(pow(10, 7))

MOD = pow(10, 9) + 7
ans = 1
n, k = map(int, input().split())
visited = [False for _ in range(n)]
edges = {}

def dfs(i, c1, c2):
  global ans
  if visited[i]:
    return
  visited[i] = True
  ans = ans * (k-c1-c2) % MOD
  c0 = 0
  for e in edges[i]:
    if not visited[e]:
      dfs(e, 1, c1+c0)
      c0 += 1


def main():
  for _ in range(n-1):
    a, b = map(int, input().split())
    if a-1 not in edges:
      edges[a-1] = [b-1]
    else:
      edges[a-1].append(b-1)
    if b-1 not in edges:
      edges[b-1] = [a-1]
    else:
      edges[b-1].append(a-1)
  # start
  if n == 1:
    print(k)
  else:
    for i in range(n):
      if len(edges[i]) == 1:
        dfs(i, 0, 0)
    print(ans)


if __name__ == '__main__':
  main()

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(pow(10, 6))
from collections import deque

MOD = pow(10, 9) + 7
ans = 1
n, k = map(int, input().split())
visited = [False for _ in range(n)]
edges = {}

def dfs(i, c1, c2):
  global ans
  if visited[i]:
    return
  visited[i] = True
  ans = ans * (k-c1-c2) % MOD
  c0 = 0
  for e in edges[i]:
    if not visited[e]:
      dfs(e, 1, c1+c0)
      c0 += 1


def main():
  for _ in range(n-1):
    a, b = map(int, input().split())
    if a-1 not in edges:
      edges[a-1] = [b-1]
    else:
      edges[a-1].append(b-1)
    if b-1 not in edges:
      edges[b-1] = [a-1]
    else:
      edges[b-1].append(a-1)
  # start
  for i in range(n):
    if len(edges[i]) == 1:
      dfs(i, 0, 0)
  print(ans)


if __name__ == '__main__':
  main()

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
from collections import deque

MOD = pow(10, 9) + 7
ans = 1
n, k = map(int, input().split())
visited = [False for _ in range(n)]
edges = {}

def dfs(i, c1, c2):
  global ans
  if visited[i]:
    return
  visited[i] = True
  ans = ans * (k-c1-c2) % MOD
  c0 = 0
  for e in edges[i]:
    if not visited[e]:
      dfs(e, 1, c1+c0)
      c0 += 1


def main():
  for _ in range(n-1):
    a, b = map(int, input().split())
    if a-1 not in edges:
      edges[a-1] = [b-1]
    else:
      edges[a-1].append(b-1)
    if b-1 not in edges:
      edges[b-1] = [a-1]
    else:
      edges[b-1].append(a-1)
  # start
  for i in range(n):
    if len(edges[i]) == 1:
      dfs(i, 0, 0)
  print(ans)


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

Fixed submission:
n, x = map(int, input().split())
llist = [0] + list(map(int, input().split())) + [1e9]
for i in range(1, n+2):
  llist[i] += llist[i-1]

for i in range(n+2):
  if llist[i] > x:
    break
print(i)

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

d = 0
ans = 1
i = 0
while d <= x:
  d += llist[i]
  i += 1
  ans += 1
print(ans - 1)
Problem p03050 (python)

Fixed submission:
n = int(input())

if n == 1:
  print(0)
else:
  divl = [n]
  i = 2
  while i * i <= n:
    if n % i == 0:
      divl.append(i)
      divl.append(n // i)
    i += 1

  ans = 0
  for d in divl:
    if n == d * (n // (d - 1)):
      ans += d - 1
  print(ans)

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

divl = [n]
i = 2
while i * i <= n:
  if n % i == 0:
    divl.append(i)
    divl.append(n // i)
  i += 1

ans = 0
for d in divl:
  if n == d * (n // (d - 1)):
    ans += d - 1
print(ans)
Problem p03081 (python)

Fixed submission:
n, q = map(int, input().split())
s = '*' + input().strip() + '*'
td = [tuple(input().strip().split()) for _ in range(q)]

def fall_d(i):
  now = i
  for t, d in td:
    if s[now] == t:
      if d == 'L':
        now -= 1
      else:
        now += 1
    if now == 0:
      return 'Left'
    elif now == n + 1:
      return 'Right'
  return 'Remain'

ll, lr = 0, n + 1
while ll != lr:
  mid = (ll + lr) // 2
  if fall_d(mid) == 'Left':
    ll = mid + 1
  else:
    lr = mid

rl, rr = 0, n + 1
while rl != rr:
  mid = (rl + rr) // 2
  if fall_d(mid) == 'Right':
    rr = mid
  else:
    rl = mid + 1

print(rr - ll)

Buggy submission (verdict: Runtime Error):
n, q = map(int, input().split())
s = input().strip()
td = [tuple(input().strip().split()) for _ in range(q)]

def is_fall_l(i):
  now = i
  for t, d in td:
    if s[now] == t:
      if d == 'L':
        now -= 1
      else:
        now += 1
    if now == -1:
      return True
  return False

def is_fall_r(i):
  now = i
  for t, d in td:
    if s[now] == t:
      if d == 'L':
        now -= 1
      else:
        now += 1
    if now == n:
      return True
  return False

ll, lr = 0, n-1
while ll != lr:
  mid = (ll + lr) // 2
  if is_fall_l(mid):
    ll = mid + 1
  else:
    lr = mid

rl, rr = 0, n-1
while rl != rr:
  mid = (rl + rr) // 2
  if is_fall_r(mid):
    rr = mid
  else:
    rl = mid + 1

if rl == n-1:
  rl += 1
if lr == 0:
  lr -= 1

print(rl - lr)
Problem p03136 (python)

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

if sum(ll[:-1]) > ll[-1]:
  print('Yes')
else:
  print('No')

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

if sum(ll[:-1]) > sum[-1]:
  print('Yes')
else:
  print('No')
Problem p03157 (python)

Fixed submission:
h, w = map(int, input().split())
s = []
for _ in range(h):
  s.append(input().strip())

visited = [[False for _ in range(w)] for _ in range(h)]

ans = 0
for i in range(h):
  for j in range(w):
    if visited[i][j]:
      continue
    bc = 0
    wc = 0
    visited[i][j] = True
    node = [(i, j)]
    while node:
      ci, cj = node[0]
      node = node[1:]
      if s[ci][cj] == '#':
        bc += 1
      else:
        wc += 1
      if ci - 1 >= 0 and s[ci][cj] != s[ci-1][cj]:
        if not visited[ci-1][cj]:
          visited[ci-1][cj] = True
          node.append((ci-1, cj))
      if ci + 1 <= h-1 and s[ci][cj] != s[ci+1][cj]:
        if not visited[ci+1][cj]:
          visited[ci+1][cj] = True
          node.append((ci+1, cj))
      if cj - 1 >= 0 and s[ci][cj] != s[ci][cj-1]:
        if not visited[ci][cj-1]:
          visited[ci][cj-1] = True
          node.append((ci, cj-1))
      if cj + 1 <= w-1 and s[ci][cj] != s[ci][cj+1]:
        if not visited[ci][cj+1]:
          visited[ci][cj+1] = True
          node.append((ci, cj+1))
    ans += bc * wc

print(ans)

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().strip().split())
S = [input().strip() for _ in range(H)]
visited = [[False for _ in range(W)] for _ in range(H)]

def dfs(_i, _j, _S, _visited, _fs):
  if _i<H-1 and not _visited[_i+1][_j] and S[_i][_j]!=S[_i+1][_j]:
    if S[_i+1][_j] == '.':
      _fs.add((_i+1, _j))
    _visited[_i+1][_j] = True
    _fs |= dfs(_i+1, _j, _S, _visited, _fs)
    _visited[_i+1][_j] = False
  if _i>0 and not _visited[_i-1][_j] and S[_i][_j]!=S[_i-1][_j]:
    if S[_i-1][_j] == '.':
      _fs.add((_i-1, _j))
    _visited[_i-1][_j] = True
    _fs |= dfs(_i-1, _j, _S, _visited, _fs)
    _visited[_i-1][_j] = False
  if _j<W-1 and not _visited[_i][_j+1] and S[_i][_j]!=S[_i][_j+1]:
    if S[_i][_j+1] == '.':
      _fs.add((_i, _j+1))
    _visited[_i][_j+1] = True
    _fs |= dfs(_i, _j+1, _S, _visited, _fs)
    _visited[_i][_j+1] = False
  if _j>-0 and not _visited[_i][_j-1] and S[_i][_j]!=S[_i][_j-1]:
    if S[_i][_j-1] == '.':
      _fs.add((_i, _j-1))
    _visited[_i][_j-1] = True
    _fs |= dfs(_i, _j-1, _S, _visited, _fs)
    _visited[_i][_j-1] = False
  return _fs

ans = 0
for i in range(H):
  for j in range(W):
    if S[i][j] == '#':
      fs = set()
      visited[i][j] = True
      fs = dfs(i, j, S, visited, fs);
      ans += len(fs)
      for k in range(H):
        for l in range(W):
          visited[k][l] = False
          
print(ans)
Problem p03193 (python)

Fixed submission:
N, H, W = map(int, input().strip().split())
A, B = [], []
for _ in range(N):
  a, b = map(int, input().strip().split())
  A.append(a)
  B.append(b)

i = 0
for a, b in zip(A, B):
  if a >= H and b >= W:
    i += 1
print(i)

Buggy submission (verdict: Runtime Error):
N, H, W = map(int, input.strip().split())
A, B = [], []
for _ in range(N):
  a, b = map(int, input().strip().split())
  A.append(a)
  B.append(b)

i = 0
for a, b in zip(A, B):
  if a >= H and b >= W:
    i += 1
print(i)
Problem p03211 (python)

Fixed submission:
S=input().strip()

m =None
for i in range(len(S)-2):
  e=int(S[i:i+3])
  if m is None:
    m=abs(753-e)
  elif abs(753-e) <m:
    m=abs(753-e)
print(m)

Buggy submission (verdict: Runtime Error):
S=int(input().strip())

m =None
for i in range(len(S)-2):
  e=int(S[i:i+3])
  if m is None:
    m=abs(753-e)
  elif abs(753-e) <m:
    m=abs(753-e)
print(m)
Problem p03240 (python)

Fixed submission:
N = int(input().strip())
xyh = []
for _ in range(N):
  x, y, h = map(int, input().strip().split())
  xyh.append((x, y, h))

for i in range(101):
  for j in range(101):
    for k in range(N):
      if xyh[k][2] != 0:
        H = xyh[k][2] + abs(i-xyh[k][0]) + abs(j-xyh[k][1])
        break
    is_h = True
    for k in range(N):
      if max(0, H-abs(i-xyh[k][0])-abs(j-xyh[k][1])) != xyh[k][2]:
        is_h = False
        break
    if is_h:
      print(i, j, H)

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

xyh = []
for _ in range(N):
  x, y, h = map(int, input().strip().split())
  if h != 0:
    xyh.append((x, y, h))

for k in range(N):
  for i in range(101):
    for j in range(101):
      H = xyh[k][2] + abs(i-xyh[k][0]) + abs(j-xyh[k][1])
      is_h = True
      for _xyh in xyh:
        if H != _xyh[2] + abs(i-_xyh[0]) + abs(j-_xyh[1]):
          is_h = False
          break
      if is_h:
        mx, my, mh = i, j, H

print(mx, my, mh)
Problem p03241 (python)

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

i=1
while i <= M//N: 
  if M % i == 0:
    maxg = i
    if M//i <= M//N:
      maxg = M // i
      break
  i += 1

print(maxg)

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

i=1
while i*i < M and i <= M//N:
  if M % i == 0:
    maxg = i
  i += 1

print(maxg)

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

i=1
while i*i < M:
  if M % i == 0:
    maxg = M // N
  i += 1

print(maxg)