akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REP(i,b) FOR(i,0,b)
#define INF 1e9

int main(){
  int K,S,X,Y,Z,answer;
  cin>>K>>S;

  for ( X = K; X >= 0 ; X--) {
    if (S-X >= 0) {
      if (S-X <= K*2) {
        for ( Y = K; Y >= 0 ; Y--) {
          if (S-X-Y >=0) {
            if (S-X-Y <= K) {
              answer++;
            }
          }
        }
      }
    }
  }

  cout<<answer;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
int cost(int x,int y){
    return (x-y) * (x-y);
}
int main(void){
    int N;
    cin >> N;
    int a[N];
    rep(i,N){
        cin >> a[i];
    }
    int ans = 1e9;
    for(int i=-100;i<=100;i++){
        int sum = 0;
        for(int j=0;j<N;j++){
            sum += cost(i,a[j]);
        }
        ans = min(ans,sum);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3216
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()


def make_grid(h, w, num): return [[int(num)] * w for _ in range(h)]


class BIT():
    def __init__(self, n):
        """
        1-index
        sum -> i番目までの和
        add -> i番目にxを足す
        :param n:
        """
        self.n = n
        self.data = [0]*(n+1)
        self.each = [0]*(n+1)

    def sum(self, i):
        s = 0
        while i > 0:
            s += self.data[i]
            i -= i & -i
        return s

    def add(self, i, x):
        self.each[i] += x
        while i <= self.n:
            self.data[i] += x
            i += i & -i

    def __str__(self):
        return str(self.each)



def main():
    N, Q = NMI()
    C = [0]+NLI()
    d_querys = [[i]+NLI() for i in range(Q)]
    querys = defaultdict(list)
    for qi, ql, qr in d_querys:
        querys[qr].append((qi, ql))

    ans = [0] * Q
    last_index = [-1] * (N+1)
    index_dict = defaultdict(list)
    tree = BIT(N)

    for i, color in enumerate(C):
        if color == 0: continue
        idx = last_index[color]
        if idx != -1:
            index_dict[i].append((idx, i))
        last_index[color] = i
        tree.add(i, 1)

    for i in range(1, N+1):
        for idx, _ in index_dict[i]:
            tree.add(idx, -1)
        for qi, ql in querys[i]:
            ans[qi] = tree.sum(i) - tree.sum(ql-1)

    for a in ans:
        print(a)




if __name__ == "__main__":
    main()

Measured memory_bytes: 359604
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.TreeSet;
 
 
 
public class Main {
  public static void main(String[] args) {
    InputReader sc = new InputReader(System.in);
 
    int n = sc.nextInt();
    String[] strs = new String[n];
    for(int i = 0; i < n; i++){
      strs[i] = sc.nextStr();
    }

    boolean check = true;
    for(int i = 1; i < n; i++){
      if(strs[i].charAt(0) != strs[i-1].charAt(strs[i-1].length()-1)){
        check = false;
      }
      for(int j = 0; j < i; j++){
        if(strs[j].equals(strs[i])){
          check = false;
        }
      }
    }

    if(check){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
   
 
  }
 
 //ここからテンプレ
  static class InputReader {
      private InputStream stream;
      private byte[] buf = new byte[1024];
      private int curChar;
      private int numChars;
      private SpaceCharFilter filter;
 
      public InputReader(InputStream stream) {
          this.stream = stream;
      }
 
      public int next() {
          if (numChars == -1)
              throw new InputMismatchException();
          if (curChar >= numChars) {
              curChar = 0;
              try {
                  numChars = stream.read(buf);
              } catch (IOException e) {
                  throw new InputMismatchException();
              }
              if (numChars <= 0)
                  return -1;
          }
          return buf[curChar++];
      }
 
      public String nextStr() {
        int c = next();
        while(isSpaceChar(c)){c = next();}
        StringBuffer str = new StringBuffer();
        do{
          str.append((char)c);
          c = next();
        }while(!isSpaceChar(c));
        return str.toString();
      }
 
      public char nextChar() {
        int c = next();
        while(isSpaceChar(c)){c = next();}
        char ret;
        do{
          ret = (char)c;
          c = next();
        }while(!isSpaceChar(c));
        return ret;
      }
 
      public int nextInt() {
          int c = next();
          while (isSpaceChar(c))
              c = next();
          int sgn = 1;
          if (c == '-') {
              sgn = -1;
              c = next();
          }
          int res = 0;
          do {
              if (c < '0' || c > '9')
                  throw new InputMismatchException();
              res *= 10;
              res += c - '0';
              c = next();
          } while (!isSpaceChar(c));
          return res * sgn;
      }
 
      public boolean isSpaceChar(int c) {
          if (filter != null)
              return filter.isSpaceChar(c);
          return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
      }
 
      public interface SpaceCharFilter {
          public boolean isSpaceChar(int ch);
      }
  }
}

Measured memory_bytes: 22612
#include <bits/stdc++.h>
 
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  map<int, int> s;
  int ans = 0;
  int cnt = 0;
  for (int i = 0; i < m; i++) {
    int x;
    string str;
    cin >> x >> str;
    if (s[x] == -1) {
      continue;
    }
    if (str == "AC") {
      ans += s[x];
      cnt++;
      s[x] = -1;
    } else {
      s[x]++;
    }
  }
  cout << cnt << " " << ans << '\n';
  return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
bool query(string s,string t){
	cout<<s<<endl<<t<<endl;
	string h;
	cin>>h;
	return h[0]=='T';
}
int main(){
	int N;
	cin>>N;
	string s[2];
	bool forward=1;
	rep(i,N){
		bool done=0;
		rep(j,4){
			string ns[2];
			if(forward){
				ns[0]=s[0]+(j%2==0?'#':'.');
				ns[1]=s[1]+(j/2==0?'#':'.');
			}else{
				ns[0]=(j%2==0?'#':'.')+s[0];
				ns[1]=(j/2==0?'#':'.')+s[1];
			}
			if(query(ns[0],ns[1])){
				done=1;
				s[0]=ns[0],s[1]=ns[1];
				break;
			}
		}
		if(!done){
			assert(forward);
			forward=0;
			i--;
		}
	}
}


Measured memory_bytes: 596
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define maxs(x, y) (x = max(x, y))
#define mins(x, y) (x = min(x, y))
#define limit(x, l, r) max(l, min(x, r))
#define lims(x, l, r) (x = max(l, min(x, r)))
#define isin(x, l, r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)), x.end())
#define show(x) cout << #x << " = " << x << endl;
#define PQ(T) priority_queue<T, v(T), greater<T>>
#define bn(x) ((1 << x) - 1)
#define dup(x, y) (((x) + (y)-1) / (y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() { 
  int n;
  cin >> n;
  vl a(n);
  rep(i,n) cin >> a[i];
  int ans = 1;
  vl q;
  q.push_back(a[0]);
  srep(i,1,n){
    int k = lower_bound(q.begin(), q.end(), a[i]) - q.begin();
    //show(k);
    if(k<=0) q.insert(q.begin(),a[i]);
    else{
      q[k-1] = a[i];
      //sort(rng(q));
    }
  }
  cout<<sz(q)<<endl;
  return 0;
}

Measured memory_bytes: 2168
n, m, x = list(map(int, input().split()))
a_list = list(map(int, input().split()))

left_sum = 0
right_sum = 0
for a in a_list:
    if a < x:
        left_sum += 1
    elif a > x:
        right_sum += 1

print(min(left_sum, right_sum))


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using ll = long long int;
using namespace std;

int main()
{
    int N, M, X;
    cin >> N >> M >> X;
    vector<vector<int>> A(N, vector<int>(M + 1, 0));
    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j <= M; j++)
        {
            cin >> A[i][j];
        }
    }
    int ans = 100000000;
    for (int i = 1; i < (1 << N); i++)
    {
        int score = 0;
        vector<int> x(M, 0);
        for (int j = 0; j < N; j++)
        {
            if ((i >> j) & 1)
            {
                for (int k = 0; k < M; k++)
                {
                    x[k] += A[j][k + 1];
                }
                score += A[j][0];
            }
        }
        bool flag = true;
        for (int j = 0; j < M; j++)
        {
            if (x[j] < X)
            {
                flag = false;
                break;
            }
        }
        if (flag)
        {
            ans = min(ans, score);
        }
    }
    if (ans == 100000000)
    {
        cout << -1 << endl;
    }
    else
    {
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'

ll cost = 0,n,ans=LLONG_MAX,x,m;
vector<ll> level(15,0);
vector<vector<ll>> ar(20,vector<ll>(20,0));

void choose(ll ind,ll cost,vector<ll> level)
{
    if(ind==n) return;
    
    //choose
    vector<ll> level1 = level;
    cost += ar[ind][0];
    ll f=1;
    for(ll i=0;i<m;i++)
    {
        level[i] += ar[ind][i+1];
        if(level[i]<x) f=0;
    }
    if(f && cost<ans)
    {
        ans=cost;
    }
    choose(ind+1,cost,level);
    
    cost -= ar[ind][0];
    
    //don't choose
    choose(ind+1,cost,level1);
    
}

int main()
{
    cin>>n>>m>>x;
    for(ll i=0;i<n;i++)
    {
        for(ll j=0;j<=m;j++) cin>>ar[i][j];
    }
    choose(0,0,level);
    if(ans==LLONG_MAX) cout<<"-1"<<endl;
    else cout<<ans<<endl;
}

Measured memory_bytes: 3640
##境界の処理が場当たり的すぎるが他を見てもコードの発想が理解できない
import bisect
n,k = map(int, input().split( ))
x = list(map(int, input().split( )))
inf = 10**15
x.append(inf)
start = bisect.bisect_left(x,0)

if x[start] == 0:
    k -= 1
    n -= 1
    x = [-inf]*k + x + [inf]*k###
else:
    x = [-inf]*k + x[:start] + [0] + x[start:] + [inf]*k###
#print(x)
ans = inf
start = bisect.bisect_left(x,0)
for i in range(k+1):###
    tmp1 = -x[start-i]
    tmp2 = x[start+k-i]
    #print(tmp1,tmp2)
    ans = min(ans, tmp1*2 + tmp2, tmp1 + tmp2*2)

print(ans)


Measured memory_bytes: 74008
#include<bits/stdc++.h>

using namespace std;

void test()
{
   int n,k;
   cin>>n>>k;

   long long res=k;

   for(int i=1;i<n;i++)
   {
       res*=(k-1);
   }

   cout<<res<<endl;
}

int main()
{
    ios::sync_with_stdio(NULL);
    cin.tie(0);
    cout.tie(0);

    test();

    return 0;
}


Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
int n,a[25],cnt=0;
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
		cin>>a[i];
	for(int i=1;i<n-1;i++)
		if((a[i]>=a[i-1]&&a[i]<=a[i+1])||(a[i]>=a[i+1]&&a[i]<=a[i-1]))
			++cnt;
	cout<<cnt<<endl; 
	return 0;
} 

Measured memory_bytes: 256
h,n=map(int,input().split())
ab=[list(map(int,input().split())) for _ in range(n)]

dp=[0]*h
for i in range(h):
    _min = 10**10
    for g in range(n):
        if i>=ab[g][0]:
            _min = min(ab[g][1]+dp[i-ab[g][0]], _min)
        else:
            _min = min(ab[g][1], _min)
    dp[i]=_min
print(dp[-1])

Measured memory_bytes: 42476
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;


signed main(){
    //ios::sync_with_stdio(false);
	//cin.tie(0);

    int n;
    cin>>n;
    double a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    double ans = 0;

    sort(a,a+n);

    double now = a[0] + a[1];
    now /=2;
    for(int i=2;i<n;i++){
        now = (now + a[i])/2;
    }
    cout<<now<<endl;


}

Measured memory_bytes: 256
N = int(input())
import random

def is_prime3(q,k=50):
    q = abs(q)

    if q == 2: return True
    if q < 2 or q&1 == 0: return False


    d = (q-1)>>1
    while d&1 == 0:
        d >>= 1


    for i in range(k):
        a = random.randint(1,q-1)
        t = d
        y = pow(a,t,q)

        while t != q-1 and y != 1 and y != q-1:
            y = pow(y,2,q)
            t <<= 1
        if y != q-1 and t&1 == 0:
            return False
    return True


def p_amari(start):
    num = start
    while num < 55555:
        if is_prime3(num) and num % 5==1:
            return num
        num += 1

A = []
t = 2
for j in range(N):
    ADD = p_amari(t)
    A.append(ADD)
    t = ADD + 1

moted = map(str, A)
print(" ".join(moted))

Measured memory_bytes: 3444
#include "bits/stdc++.h"

using namespace std;

typedef long double ld;
typedef long long ll;

#define sz(x) (int)(x).size()
#define pb push_back
#define mp make_pair
#define f first
#define s second

template<typename T, typename U> bool ckmin(T &a, U b){ return b < a ? a = b, true : false; }
template<typename T, typename U> bool ckmax(T &a, U b){ return b > a ? a = b, true : false; }

ll n, m, k, res = 0;
vector<ll> a, b;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n >> m >> k;
    a.assign(n, 0);
    b.assign(m, 0);
    for(int i = 0; i < n; ++i) cin >> a[i];
    for(int j = 0; j < m; ++j) cin >> b[j];
    ll pos = -1, cur = 0;
    while(cur <= k && pos < n - 1){
        pos++;
        cur += a[pos];
    }
    if(cur > k){
        cur -= a[pos];
        pos--;
    }
    ll pos2 = -1;
    while(cur <= k && pos2 < m - 1){
        pos2++;
        cur += b[pos2];
    }
    if(cur > k){
        cur -= b[pos2];
        pos2--;
    }
    res = pos + 1 + pos2 + 1;
    while(pos >= 0){
        cur -= a[pos];
        pos--;
        while(cur <= k && pos2 < m - 1){
            pos2++;
            cur += b[pos2];
        }
        if(cur > k){
            cur -= b[pos2];
            pos2--;
        }  
        res = max(res, pos + 1 + pos2 + 1); 
    }
    cout << res;
    return 0;
}

Measured memory_bytes: 6304
N = int(input())
A = {}
B = []
for n in range(N):
    a,b = list(map(int,input().split()))
    B.append(b)
    
    if b not in A.keys():
        A[b] = [a]
    else:
        A[b].append(a)

B=list(set(B))
B.sort()

time=0
ans='Yes'
break_flag = False

for b in B:
    if break_flag:
        break
    for a in A[b]:
        time += a 
#         print(b,a,time)
        if b < time:
            ans='No'
            break_flag = True
            break
        
print(ans)

Measured memory_bytes: 167828
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int N=53;
ll n,x,ans,f[53],g[53];
void solve(ll x,int n)
{
  // cout<<ans<<" "<<x<<" "<<n<<endl;
  // cout<<ans<<" "<<f[n]<<" "<<g[n]<<endl;
  if(x<=0 || n<0) return;
  // if(n==0) if(x>=g[n]) ans+=f[n],x-=g[n];
  if(n==0)
  {
    if(x==1) ans+=1;
    else if(x==2) ans+=2;
    else ans+=3;
  }
  else
  {
    if(x>=g[n]+1) ans+=f[n]+1,x-=g[n]+1;
    // cout<<
  }
  solve(x-1,n-1);
}
int main()
{
  cin>>n>>x;
  f[0]=g[0]=1ll;
  for(int i=1;i<N;i++) f[i]=1+2*f[i-1],g[i]=2*g[i-1]+3;
  solve(x-1,n-1);
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
a, b = [], []
for i in range(m):
  _, __ = map(int, input().split())
  _ -= 1
  __ -= 1
  a.append(_)
  b.append(__)
  
# union-find

# 誰の肩に手を置いているか（先頭の場合は-1）
parent = [-1 for i in range(n)]

# 列車の深さ
depth = [0 for i in range(n)]

# kさんの「運転手」が誰かを調べる関数
def find_root(k):
  while parent[k] != -1:
    k = parent[k]
  return k 

for i in range(m):
  # a[i] と b[i] の合併
  root_a = find_root(a[i])
  root_b = find_root(b[i])
  if root_a == root_b: continue
  
  # 浅い列車を持っている方が負けるようにする
  if depth[root_a] > depth[root_b]:
    root_a, root_b = root_b, root_a
  parent[root_a] = root_b
  depth[root_b] = max(depth[root_a]+1, depth[root_b])
  
group = [find_root(i) for i in range(n)]

from collections import Counter
print(Counter(group).most_common()[0][1])

Measured memory_bytes: 126632
#include <bits/stdc++.h>
#include <assert.h>

using namespace std;

struct data
{
	int p, y, n, x = -1;

	bool operator<(const data &right) const
	{
		return x == -1 ? y < right.y : n < right.n;
	}
};

int main()
{
	int n, m;
	cin >> n >> m;
	vector<data> v;
	for (int i = 0; i < m; i++)
	{
		int p, y;
		cin >> p >> y;
		data t = {p, y, i + 1};
		v.push_back(t);
	}
	sort(v.begin(), v.end());
	map<int, int> ma;
	for (int i = 0; i < m; i++)
	{
		v[i].x = ma[v[i].p] + 1;
		ma[v[i].p]++;
	}
	sort(v.begin(), v.end());
	for (int i = 0; i < m; i++)
		cout << setfill('0') << setw(6) << right << v[i].p << setfill('0') << setw(6) << right << v[i].x << endl;
	;

	return 0;
}


Measured memory_bytes: 7792
#include<bits/stdc++.h>
using namespace std;



using ll = long long;
const ll INF = 1e18l+5;

int main(){
    int n,W;
    cin>>n>>W;
    vector<ll> dp(100001, INF);
    dp[0]=0;
    for(int i=0; i<n; i++){
        int w,v;
        cin>>w>>v;

        for(int va=100001-v; va>=0; --va){
            dp[va+v]=min(dp[va+v],dp[va]+w);
        }
    }
    int ans=0;
    for(int i=0; i<100001; ++i){
        if(dp[i]<=W) ans=max(ans,i);
    }
    cout<<ans;
}

Measured memory_bytes: 4024
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ld, ld> pdd;

#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

int main(){
    fastIO;
    int n, d;
    cin >> n >> d;
    int x[n][d];
    for(int i = 0 ; i < n; i ++ ){
        for(int j = 0 ; j < d; j ++ ){
            cin >> x[i][j];
        }
    }
    int cur;
    int res = 0;
    int rt;
    for(int i = 0 ; i < n; i ++ ){
        for(int j = i + 1; j < n; j ++ ){
            cur = 0;
            for(int p = 0 ; p < d; p ++ ){
                cur += (x[i][p] - x[j][p]) * (x[i][p] - x[j][p]);
            }
            rt = sqrt(cur);
            rt *= rt;
            res += (cur == rt);
        }
    }
    cout << res;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
using namespace std;

// {
#define debug(var)  do{ std::cout << #var << " : "; view(var); }while(0)
using ll = long long;
using ld = long double;
inline int num (const std::string& S, int idx) noexcept { return S.at(idx) - '0'; }
inline int ctoi(char c) noexcept { return c - '0'; }
inline bool isNumber(char c) noexcept { return ('0'<c && c<'9'? true : false); }
inline int safeCtoi(char c) { if(isNumber(c)) { return ctoi(c); } else { throw 1; } }
inline char itoc(int i) noexcept { return i + '0'; }
inline unsigned int bitMask(int i) noexcept { return (1 << i); }
inline bool isTrue(unsigned int bit, int i) noexcept { return bit & bitMask(i); }
inline bool isEven(int num) noexcept { return !num%2; }
inline bool isOdd(int num) noexcept { return num%2; }
template<typename T> inline short sgn(T num) noexcept { return (num==0? 0 : (num>0? 1 : -1) ); }
template<typename T> inline bool isZero(T num) noexcept { return (num==0? true : false); }
template<typename T> inline bool isPositive(T num) noexcept { return (num>0? true : false); }
template<typename T> inline bool isNegative(T num) noexcept { return (num<0? true : false); }
template<typename T> void view(T e) noexcept { cout << e; }
template<typename T> void view(std::vector<T> v) noexcept { for(const auto& e : v) cout << e << " "; }
template<typename T> void view(std::vector<std::vector<T>> vv) noexcept { for(const auto& v : vv) view(v); }
//}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int x, y;
	cin >> x >> y;
	if( (y-2*x)%2 ){
		cout << "No" << endl;
		return 0;
	}
	int k = (y-2*x) / 2;
	if( k < 0 ){
		cout << "No" << endl;
		return 0;
	}
	if( x - k < 0 ){
		cout << "No" << endl;
		return 0;
	}
	cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 3644
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner input = new Scanner (System.in);
		int A,B,C;
		A = input.nextInt();
		B = input.nextInt();
		C = input.nextInt();
	if ((A==5&&B==5&& C== 7)|| (A==5&&B==7&& C== 5) || (A==7&&B==5&& C== 5) )
 { System.out.println("YES");}		
		else { System.out.println("NO");}

	}

}


Measured memory_bytes: 27080
// BEGINNING WITH NAME OF ALMIGHTY GOD ALLAH
// AUTHOR:: MOHAMMAD FAISAL
// ATCODER BEGINNERS PROBLEMS
//#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.flush();
    int n,a,b;
    cin >> n >> a >> b;
    if(abs(n-a) >= abs(n-b))
      cout<<'B';
    else
      cout<<'A';
    return 0;
    // Bye Bye 2019
}



Measured memory_bytes: 256
from itertools import combinations_with_replacement

n,m,q=map(int,input().split())
l=[list(map(int,input().split())) for _ in range(q)]

A=list(combinations_with_replacement(range(1,m+1),n))

res=0

for i in range(len(A)):
    tmp=0
    for j in range(len(l)):
        if A[i][l[j][1]-1]-A[i][l[j][0]-1]==l[j][2]:
            tmp+=l[j][3]

    res=max(res, tmp)

print(res)


Measured memory_bytes: 21620
#include <bits/stdc++.h>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <cstring>
    #include <chrono>
    #include <complex>
    #define ll long long int
    #define ld long double
    #define vi vector<int>
    #define vll vector<ll>
    #define vvi vector < vi >
    #define pii pair<int,int>
    #define pll pair<long long, long long>
    #define mod 1000000007
    #define inf 1000000000000000001;
    #define all(c) c.begin(),c.end()
    #define mp(x,y) make_pair(x,y)
    #define mem(a,val) memset(a,val,sizeof(a))
    #define eb emplace_back
    #define pb push_back
    #define f first
    #define s second
    
    using namespace std;
    int main()
    {
        std::ios::sync_with_stdio(false);
        int T;
        T=1;
        // cin.ignore(); must be there when using getline(cin, s)
        while(T--)
        {
            set<int> st[26];
            int n,i,j,q,a,b,c;
            cin>>n;
            string s;
            cin>>s;
            for(i=0;i<s.length();++i)
            {
                st[s[i]-'a'].insert(i+1);
            }
            cin>>q;
            char ch;
            while(q--)
            {
                cin>>a>>b;
                if(a==1)
                {
                    cin>>ch;
                    --b;
                    st[s[b]-'a'].erase(b+1);
                    s[b]=ch;
                    st[s[b]-'a'].insert(b+1);
                }
                else
                {
                    cin>>c;
                    int ans=0;
                    for(i=0;i<26;++i)
                    {
                        auto it=st[i].lower_bound(b);
                        if(it!=st[i].end() && *it<=c)
                            ++ans;
                    }
                    cout<<ans<<endl;
                }
            }
        }
        return 0;
    }


Measured memory_bytes: 26268
#include <cstdio>
using namespace std;
int n,i,f[100][2];
int main()
{
	f[0][0]=1;
	scanf("%d",&n);
	for (i=1;i<=n;i++){
		int x;scanf("%d",&x);
		if (x&1) f[i][0]=f[i-1][0],f[i][1]=f[i-1][0]*2+f[i-1][1]*3;
		else f[i][0]=f[i-1][0]*2,f[i][1]=f[i-1][0]+f[i-1][1]*3;
	}printf("%d\n",f[n][1]);
	return 0;
}

Measured memory_bytes: 128
// questionA.cpp : Defines the entry point for the application.
//

#include <iostream>
#include <map>

using namespace std;
std::map<string, int> dictionary{
	{"RRR", 3},
	{"SSS", 0},
	{"RRS", 2},
	{"SRR", 2},
	{"SSR", 1},
	{"RSR", 1},
	{"RSS", 1},
	{"SRS", 1}
};

int main()
{
	//cout << "Hello cmake!" << endl;
	string s;
	cin >> s;
	cout << dictionary[s];
	return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include "string.h"

using namespace std;
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string A,B;
	cin >> A;
	cin >> B;
	int lenA = A.length();
	int lenB = B.length();
	bool flag = true;
	if(lenA > lenB){
		cout << "GREATER" << endl;
		flag = false;
	}
	else if (lenA < lenB){
		cout << "LESS" << endl;
		flag = false;
	}else{
		for(int i = 0;i < lenA;i++){
			//int charA = ((int)(unsigned char) A[i]);
			int charA = (int)A[i];
			int charB = (int)B[i];
			if(charA > charB){
				cout << "GREATER" << endl;
				flag = false;
				break;
			}else if(charA < charB){
				cout << "LESS" << endl;
				flag = false;
				break;
			}
		}
	}
	if(flag) cout << "EQUAL" << endl;
	
	return 0;
}

Measured memory_bytes: 256
lst = list(map(int,input().split()))
if lst[0]>lst[1]:
  lst[0],lst[1] = lst[1],lst[0]
if lst[1]>lst[2]:
  lst[1],lst[2] = lst[2],lst[1]
if lst[0]>lst[1]:
  lst[0],lst[1] = lst[1],lst[0]
lst = [str(i) for i in lst]
print(" ".join(lst))


Measured memory_bytes: 5604
#include <iostream>
using namespace std;

int main() {
  int counter = 0;
  string s;
  cin >> s;
  for( int i = 0; i < 4; i++ ) {
    if( s[i] == '+' )
      counter += 1;
    else
      counter -= 1;
  }
  cout << counter << endl;
  return 0;
}

Measured memory_bytes: 256
namespace Test
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    public class Test
    {
        public static void Main(string[] args)
        {
            var test = new Test();
            var tmp = test.ConvertDoubleList(test.ReadInput());
            var ans = tmp[0] * tmp[1];
            var ans2 = (tmp[0] + tmp[1]) * 2;
            Console.WriteLine(ans+" "+ans2);
        }

        public string[] ReadInput()
        {
            return Console.ReadLine().Split(' ');
        }

        public List<int> ConvertIntList(string[] x)
        {
            var convertedList = new List<int>(x.Length);
            for (var i = 0; i < x.Length; i++)
            {
                convertedList.Add(int.Parse(x[i]));
            }

            return convertedList;
        }

        public List<double> ConvertDoubleList(string[] x)
        {
            var convertedList = new List<double>(x.Length);
            for (var i = 0; i < x.Length; i++)
            {
                convertedList.Add(double.Parse(x[i]));
            }

            return convertedList;
        }

        public List<long> ConvertLongList(string[] x)
        {
            var convertedList = new List<long>(x.Length);
            for (var i = 0; i < x.Length; i++)
            {
                convertedList.Add(long.Parse(x[i]));
            }

            return convertedList;
        }

        public int CountContainWords(string source, string word)
        {
            var count = 0;
            var loopCount = source.Length - (word.Length - 1);
            for (var i = 0; i < loopCount; i++)
            {
                if (source.Substring(i, word.Length) == word)
                {
                    count++;
                }
            }
            return count;
        }
    }
}


Measured memory_bytes: 15736
#include<bits/stdc++.h>
using namespace std;
char s[20];
int main()
{
	scanf(" %s",s);
	int len=strlen(s);
	if(len%2==1){
		printf("No\n");
		return 0;
	};
	for(int i=0;i<len;i++){
		if(i%2==0&&s[i]=='h'){
			continue;
		}else if(i%2==1&&s[i]=='i'){
			continue;
		}
		printf("No\n");
		return 0;
	}
	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

void debug_array(int *a, int count) {
  for(int i = 0; i < count; i++) cout << "a[" << i << "]" << " = " << a[i] << endl;
}

int main() {
  int a[200000];
  int b[200001];
  for(int i = 0; i <= 200000; i++) b[i] = -1;
  
  int dp[200001] = {0};
  int mod = 1000000007;
  dp[0] = 1;
  int n;

  cin >> n;
  for(size_t i = 0; i < n; i++) cin >> a[i];
  
  for(size_t i = 0; i < n; i++) {
    dp[i+1] = dp[i];
    if (0 <= b[a[i]] && b[a[i]] < i-1) dp[i+1] = (dp[i+1]+dp[b[a[i]]+1])%mod;
    b[a[i]] = i;
    //debug(b[a[i]]);
    //debug(i);
    //debug_array(dp, n+1);
    //cout << "------" << endl;
  }
  
  cout << dp[n] << endl;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define rep(i,e) for(int i= 0; i< (int)(e); i++)
#define reps(i,s,e) for(int i = s; i < (int)(e); i++)
#define repr(i,s,e) for(int i = s; i > (int)(e); i--)
typedef long long ll;
long bigp = 1000000007;


int main(){
	int n,k;
	cin >> n >> k;
	int p=0;
	double power = 1.0;
	double ans = 0.0;
	double upper = 0.0;
	double lower = 0.0;
	while(1){
		double tmp_ans = 0.0;
		if(power >= 1.0){
		upper = n+1;
		}else{
		upper = min(ceil(2*power*k),double(n+1));
		}
		lower = min(ceil(power*k),double(n+1));
		tmp_ans = power * max(0.0,upper-lower);
		ans += tmp_ans;
		power = power/2;
		if(power*k<0.5){
			break;
		}
	}
 cout << fixed << setprecision(12) << ans/n;
}


Measured memory_bytes: 256
import numpy as np
import math

def deg(rad):
    return (360 / 2 * np.pi) * rad
a,b,h,m = map(int, input().split(" "))
#h,m = map(int, input().split(" "))

hn = ((h/12) + (m/60)/12) * 360
mn = (m/60) * 360


#print(np.abs(theta2 - theta1))

#これ．時針にn分での動きを足してねえわ
#n分 = n/60時間である よってfh = m + n/60

#お手製radを信じるな
c = a**2 + b**2 - 2*a*b*math.cos(math.radians(hn - mn))

ans = c ** 0.5
print(ans)

Measured memory_bytes: 27124
#include <bits/stdc++.h>

using namespace std;
using ll =long long;
typedef pair<int,int> P;
#define SORT(a) sort((a).begin(),(a).end())
#define REV(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

void coY() {cout <<"Yes"<<endl;}
void coN(){cout <<"No"<<endl;}
 
//Write From this Line

//const ll mod = 1e9+7;
//const ll mod = 998244353;
int main()
{
	int n, l;
	cin >> n >> l;
	vector<int> a(n);
	int sum = 0;
	int memo = 0;
	int aaa = 0;
	rep(i,n){
		a[i] = l + i;
		if(i == 0) {
			memo = abs(a[i]);
			aaa = a[i];
		}
		sum += a[i];
		if(chmin(memo,abs(a[i]))){
			aaa = a[i];
		}
		a[i] = abs(a[i]) ;
	}
	cout << sum - aaa << endl;
}


Measured memory_bytes: 3604
#include	<stdio.h>
int	main(void)
{
	int a,b;
	char op;

	while(1){
	scanf("%d %c %d",&a,&op,&b);

		if(op=='?'){
			break;
		}else if(op=='+'){
			printf("%d\n",a+b);
		}else if(op=='-'){
			printf("%d\n",a-b);
		}else if(op=='*'){
			printf("%d\n",a*b);
		}else if(op=='/'){
			printf("%d\n",a/b);
		}
	}
	
	return	0;
}
	

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int x,k,cnt=0;
    vector<int> v;
    for(int i=0;i<5;i++)
    {
        cin>>x;
        v.push_back(x);
    }
    cin>>k;
    for(int i=0;i<5;i++){
        for(int j=i+1;j<5;j++){
            int ans=v[j]-v[i];
            if(-k<=ans && ans<=k)
            {
                cnt++;
            }
        }
    }
    if(cnt==10)
        cout<<"Yay!"<<endl;
    else
        cout<<":("<<endl;

}


Measured memory_bytes: 256
import java.util.*;
import java.math.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int a = -1;
        for(int i=1;i<=9;i++){
            for(int j=1;j<=9;j++){
                if(i*j==N) a = i*j;
            }
        }
        if(a==-1) System.out.println("No");
        else System.out.println("Yes");
    }
}


Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	string s;
	cin>>s;
	int dp[s.size()][3];
	for(int i=0;i<s.size();i++)
		dp[i][0]=0;
	for(int i=0;i<s.size();i++)
	{
		dp[i][0]=1;
		for(int j=i-1;j>=0;j--)
			if(s[i]==s[j])
				dp[i][0]=0;
	}



	for(int i=0;i<s.size();i++)
		dp[i][1]=0;
	for(int i=1;i<s.size();i++)
	{
		for(int j=i-1;j>=0;j--)
			if(s[i]==s[j])
			{
			//	cout<<i<<" "<<j<<endl;
				dp[i][1]+=dp[j][0];
				break;
			}
			else
			{
				dp[i][1]+=dp[j][0];
			}	
				
	}	


	for(int i=0;i<s.size();i++)
		dp[i][2]=0;
	for(int i=2;i<s.size();i++)
	{
		for(int j=i-1;j>=0;j--)
			if(s[i]==s[j])
			{
				dp[i][2]+=dp[j][1];
				break;
			}
			else
			{
				dp[i][2]+=dp[j][1];
			}	
				
	}		
	int sum=0;
	for(int i=0;i<s.size();i++)
	{
//		cout<<dp[i][0]<<" "<<dp[i][1]<<" "<<dp[i][2]<<endl;
		sum+=dp[i][2];
	}
	//cout<<endl;
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <math.h>
using namespace std;

#define ll long long

ll N;

int digit(ll x){
	int digit = 0;
	while(x != 0){
		x /= 10;
		digit++;
	}
	return digit;
}

int solve(){
	ll small;
	double n = sqrt(N);
	for(ll i=n; 0<i; i--){
		if(N%i == 0){
			small = N/i;
			break;
		}
	}

	cout << digit(small) << endl;
	return 0;
}


int main(){
	cin >> N;
	solve();
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <utility>
#include <algorithm>
#define REP(i,n) for(int i=0;i<(n);i++)
using namespace std;

typedef pair<int, int> pxy;

typedef struct{
  bool u, d, l, r;
}Wall;

int w, h;
Wall map[50][50];
int d[50][50];

bool bfs(int sx, int sy)
{
  queue<pxy> q;
  q.push(pxy(sx, sy));
  while(!q.empty()){
    int x, y;
    x = q.front().first;
    y = q.front().second;
    q.pop();
    if(x == h - 1 && y == w - 1) return true;
    if(!map[x][y].u && d[x-1][y] == -1){
        d[x-1][y] = d[x][y] + 1;
      q.push(pxy(x-1,y));
    }
    if(!map[x][y].l && d[x][y-1] == -1){
      d[x][y-1] = d[x][y] + 1;
      q.push(pxy(x,y-1));
    }
    if(!map[x][y].d && d[x+1][y] == -1){
      d[x+1][y] = d[x][y] + 1;
      q.push(pxy(x+1,y));
    }
    if(!map[x][y].r && d[x][y+1] == -1){
      d[x][y+1] = d[x][y] + 1;
      q.push(pxy(x,y+1));
    }
    map[x][y].u = map[x][y].d = map[x][y].l = map[x][y].r = true;
    if(x >= 1)
      map[x-1][y].d = true;
    if(y >= 1)
      map[x][y-1].r = true;
    map[x+1][y].u = map[x][y+1].l = true;
  }
  return false;
}

int main()
{
  while(1){
    cin >> w >> h;
    if(w == 0 && h == 0) break;
    fill(&d[0][0], &d[50][0], -1);
    d[0][0] = 1;
    REP(i,50){
      REP(j,50){
        map[i][j].u = map[i][j].d = map[i][j].l = map[i][j].r = false;
      }
    }
    REP(i,2*h-1){
      int x;
      if(i & 1){
        REP(j,w){
          cin >> x;
          if(x){
            map[i/2][j].d = map[i/2+1][j].u = true;
          }
        }
      }else{
        REP(j,w-1){
          cin >> x;
          if(x){
            map[i/2][j].r = map[i/2][j+1].l = true;
          }
        }
      }
    }
    REP(i,h)
      map[i][0].l = map[i][w-1].r = true;
    REP(i,w)
      map[0][i].u = map[h-1][i].d = true;
    if(bfs(0, 0))
      cout << d[h-1][w-1] << endl;
    else
      cout << "0" << endl;
  }
}

Measured memory_bytes: 1236
#include <bits/stdc++.h>
#include <math.h>

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<int, int> P;

const int MOD = 1000000007;
const int INF_32 = 1LL << 30;
const int64_t INF_64 = 1LL << 60;

const int mod = 1000000007;
struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0)
        : x((x % mod + mod) % mod)
    {
    }
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a)
    {
        if ((x += a.x) >= mod)
            x -= mod;
        return *this;
    }
    mint& operator-=(const mint a)
    {
        if ((x += mod - a.x) >= mod)
            x -= mod;
        return *this;
    }
    mint& operator*=(const mint a)
    {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const
    {
        if (!t)
            return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1)
            a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }

int main()
{
    int N, M;
    cin >> N >> M;
    vector<int> S(N);
    vector<int> T(M);
    vector<vector<mint>> dp(N + 5, vector<mint>(M + 5, 1));
    rep(i, N)
    {
        cin >> S[i];
    }
    rep(i, M)
    {
        cin >> T[i];
    }

    rep(i, N)
    {
        rep(j, M)
        {
            if (S[i] == T[j]) {
                dp[i + 1][j + 1] = dp[i + 1][j] + dp[i][j + 1];
            } else {
                dp[i + 1][j + 1] = dp[i][j + 1] + dp[i + 1][j] - dp[i][j];
            }
        }
    }

    cout << dp[N][M].x << endl;
    return 0;
}

Measured memory_bytes: 34656
n, m = map(int,input().split())
h = list(map(int,input().split()))
n_list = [1 for i in range(n)]

for i in range(m):
    a, b = map(int,input().split())
    if n_list[a-1] == 1 and h[a-1] <= h[b-1]:
        n_list[a-1] = 0
    if n_list[b-1] == 1 and h[b-1] <= h[a-1]:
        n_list[b-1] = 0

print(sum(n_list))


Measured memory_bytes: 20020
//NEVER LOSE HOPE 
#define fastio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#include <bits/stdc++.h>
#define int long long int
#define vi vector<int>
#define vc vector<char>
#define pi pair<int,int>
#define si set<int>
#define mi map<int,int>
#define um unordered_map<int,int>
#define ff first
#define ss second
#define pb push_back
#define all(v) v.begin(),v.end()
#define gi greater<int>()
#define cont continue
#define mp make_pair
#define endl "\n"
#define lb lower_bound //a,a+n,4 -a==index of 4  // returns pointer to the "first position of num" if number is present in the container. Returns pointer to the "position of next higher number greater than num" if num is not present.   
#define ub upper_bound // returns pointer to the "first position of the next higher number than last occurence of num" if num is present in the container. Returns pointer to the position of next higher number than num if container does not contain occurence of num.
#define REP(i,n) for(int i=0;i<n;i++)
#define REPM(i,n) for(int i=0;i<n-1;i++)
#define REPE(i,n) for(int i=1;i<=n;i++)
#define REPA(i,a,n) for(int i=a;i<n;i++)
 
#define ip(a) int n;cin>>n;int a[n];REP(i,n)cin>>a[i];
#define op(v) for(auto x:v) cout<<x<<" ";cout<<endl;
#define opp(a)  REP(i,n)cout<<a[i]<<" "; cout<<endl;
   
#define vs(s)  cout<<v.size()<<" "; 
//next_permutation(s.begin(),s.end())
//*max_element(a,a+n)
#define mod 1000000007
using namespace std;

// bool isPrime(int n)
// {if(n==1)return false;
// for(int i=2;i*i<=n;i++)
// {if(n%i==0)return false;}
// return true;
// } 

// int gcd(int a,int b)
// {
//     if(b==0)return a;
//     return gcd(b,a%b);
// }
// int lcm(int a,int b)
// {
//     return a/gcd(a,b)*b;
 
// }  
 void CSK(){
         int n,d,a,b,c=0;
         cin>>n>>d;
         while(n--)
         {
          cin>>a>>b;
          int x=pow(a,2)+pow(b,2);
          int y=ceil(sqrt(x));
          if(y<=d)
            c++;
         }
         cout<<c<<endl;















}
  
  
  
 

 
 
 
int32_t main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif 
    fastio;
    cout<<fixed;
    cout.precision(10);
    int __TESTCASES=1;
    //cin>>__TESTCASES;
    while(__TESTCASES--){
    CSK();  
}
 
}

Measured memory_bytes: 3740
#include <bits/stdc++.h>
using namespace std;

int main() {
	long  long int n,k,i;
	cin>>n>>k;
	long long int count=0;
	for(i=k+1;i<=n;i++)
	  {   //cout<<i<<" "<<n%i<<" ";
	     if(n%i==0)
	       {  //cout<<"a"<<" ";
	       	count+=(n/i)*1ll*(i-k);
	       }
	     else if(n%i < k)
	       {    //cout<<'b'<<" ";
	       	  count+=(n/i)*1ll*(i-k);
	       }
	     else if(n%i>=k)
	       {	  //cout<<'c'<<" ";
		if(k!=0)
	       	  count+=(n/i+1)*1ll*(n%i-k+1);
	       	else  
			count+=((n/i+1)*1ll*(n%i-k)+n/i);	
	       	  count+=(n/i)*1ll*(i-(n%i)-1);
	       }
	     //cout<<count<<"\n";  
	  }
	 cout<<count<<" "; 
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 200010;
int p[MAXN],dp[MAXN];
int main() {
	int n;
	cin >> n;
	for(int i = 1; i <= n;i++){
		cin >> p[i];
		//m[p[i]] = i;
	}
	int ans = 1;
        dp[0] = p[1];
        for(int i = 2; i <= n; ++i) {
            int k = lower_bound(dp, dp+ans, p[i]) - dp;
            if(p[i] < dp[ans-1]) dp[ans++] = p[i];
            else dp[k] = p[i];
        }
	cout << ans <<endl;
    return 0;
}

Measured memory_bytes: 1792
function Main(input) {

  	tmp = input.split(" ");
    var a = parseInt(tmp[0], 10);
    var b = parseInt(tmp[1], 10);
	var ans = Math.max((a+b),(a-b),(a*b))
    if(ans === -0) ans=0
	console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21064
using System;
using System.Linq;
class Program
{
    static void Main(string[] args)
    {
        //   while (true) { break; }
        bool flag = false;
        int[] jh = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int a = jh[0], b = jh[1];
        char[,] az = new char[a, a];
        char[,] bz = new char[b, b];
        for (int i = 0; i < a; i++)
        {
            var gh = Console.ReadLine();
            for (int k = 0; k < a; k++)

            {
                az[i, k] = gh[k];
            }
        }
        for (int i = 0; i < b; i++)
        {
            var gh = Console.ReadLine();
            for (int k = 0; k < b; k++)
            {
                bz[i, k] = gh[k];
            }
        }

        for (int i = 0; i < jh[0] - jh[1] + 1; i++)
        {
            if (!flag)
            {
                for (int l = 0; l < jh[0] - jh[1] + 1; l++)
                {
                    if (!flag)
                    {
                        int renzoku = 0;
                        for (int k = 0; k < jh[1]; k++)
                        {
                            for (int m = 0; m < b; m++)
                            {
                                if (az[i + k, l + m] == bz[k, m]) { renzoku++; }

                            }
                        }
                        if (renzoku == b * b) { flag = true; break; }
                    }
                }
            }
        }
        Console.WriteLine(flag ? "Yes" : "No");
        Console.ReadLine();
    }
}



Measured memory_bytes: 13396
def case_1 (S,size):
    count=0
    for i in range(0,size):
        if (i%2==0):
            if(int(S[i])==0):
                count+=1
        else:
            if(int(S[i])==1):
                count+=1
    return count

def case_2 (S,size):
    count=0
    for i in range(0,size):
        if (i%2==1):
            if(int(S[i])==0):
                count+=1
        else:
            if(int(S[i])==1):
                count+=1
    return count

S=str(input())
size=len(S)
can_1=case_1(S,size)
can_2=case_2(S,size)
print(min(can_1,can_2))

Measured memory_bytes: 3188
// URL : https://atcoder.jp/contests/practice2/tasks/practice2_f
#include "atcoder/convolution.hpp"
#include "atcoder/modint.hpp"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, n)    for (ll (i) = 0;   (i) < (n); ++(i))
#define FOR(i, a, b) for (ll (i) = (a); (i) < (b); ++(i))
using mint = atcoder::modint998244353;
int main() {
    int N, M;
    cin >> N >> M;
    vector<ll> A(N), B(M);
    REP(i, N) cin >> A[i];
    REP(i, M) cin >> B[i];
    auto C = atcoder::convolution<998244353>(A, B);
    int n = C.size();
    REP(i, n) {
        if (i != 0) cout << ' ';
        cout << C[i];
    }
}


Measured memory_bytes: 27272
#include <bits/stdc++.h>
#define mm(x,k) memset (x, k, sizeof(x));
#define ll long long
#define ff(i,a,b) for(ll i = a ; i  < b ; ++i)
#define fd(i,a,b) for(ll i = a ; i <= b ; ++i)
using namespace std;
#define mo 1000000007
ll mod(ll a , ll b){
    ll t = 1;
    while(b){
        if(b&1) t = a * t % mo;
        b >>= 1; a = a * a % mo;
    } return t;
}
ll a[200005];
ll C(ll n , ll m){
    return (a[n] * mod(a[n-m],mo-2)) % mo * mod(a[m],mo-2) %mo;
}
int main(){
    a[0] = 1;
    ff(i,1,200005) a[i] = a[i-1] * i % mo;
    ll n , m , k;
    cin >> n >> m >> k;
    cout<< C(n*m,k)*C(k,2)%mo*(n+m)%mo*mod(3,mo-2)%mo;
}

Measured memory_bytes: 1792
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#include<algorithm>//next_permutation
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
#define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define small "abcdefghijklmnopqrstuvwxyz"
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

ll gcd(ll a,ll b){
  if(b == 0) return a;
  return gcd(b , a % b);
}

const ll MOD = 1000000007;
const ll MAX = 2000001;

ll mod(ll a){
  return a % MOD;
}

ll lcm(ll a,ll b){
  return (a*b)/gcd(a,b);
}


vector<pair<ll,ll>> prime_factorize(ll n){
  vector<pair<ll,ll>> res;
  
  for(ll i=2; i*i <= n; i++){
    if(n % i != 0) continue;
    
    ll ex = 0;
    while(n % i == 0){
      ex++;
      n /= i;
    }
    
    res.push_back({i,ex});
  }
  
  if(n != 1) res.push_back({n,1});
  
  return res;
  
}



int main(){
  ll n; cin >> n;
  
  auto table = prime_factorize(n);
  
  ll cnt = 0;
  
  for(auto p : table){
    ll e = p.second;
    
    for(ll i=1; e >= i ; i++){
      cnt++;
      e -= i;
    }
  }
  
  cout << cnt << endl;
  
  
}

Measured memory_bytes: 3648