akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.math.*;
import java.util.*;
public class Main { 
 
	public static void main(String[] args) { 
		FastScanner I = new FastScanner(); //Input
		OutPut O = new OutPut(); //Output
		int L = I.nextInt();
		int R = I.nextInt();
		int ans = 0;
		int d = I.nextInt();
		for (int i = L; i<= R; i++) {
			if (i%d==0) ans++;
		}
		O.pln(ans);
	}
	public static long ceil(long num, long den) {long ans = num/den; if (num%den!=0) 
	ans++; return ans;}
	public static long GCD(long a, long b) {
		if (a==0||b==0) return Math.max(a,b);
		return GCD(Math.min(a, b),Math.max(a, b)%Math.min(a, b));
	}
	public static long FastExp(long base, long exp, long mod) {
		long ans=1;
		while (exp>0) {
			if (exp%2==1) ans*=base;
			exp/=2;
			base*=base;
			base%=mod;
			ans%=mod;
		}
		return ans;
	}
	public static long ModInv(long num,long mod) {return FastExp(num,mod-2,mod);}
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		int nextInt() {return Integer.parseInt(next());}
		long nextLong() {return Long.parseLong(next());};
	}
	static class OutPut{
		PrintWriter w = new PrintWriter(System.out);
		void pln(int x) {w.println(x);w.flush();}
		void pln(long x) {w.println(x);w.flush();}
		void pln(String x) {w.println(x);w.flush();}
		void pln(char x) {w.println(x);w.flush();}
		void pln(StringBuilder x) {w.println(x);w.flush();}
		void p(int x) {w.print(x);w.flush();}
		void p(long x) {w.print(x);w.flush();}
		void p(String x) {w.print(x);w.flush();}
		void p(char x) {w.print(x);w.flush();}
		void p(StringBuilder x) {w.print(x);w.flush();}
	}
}


Measured memory_bytes: 25484
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;

int main()
{
    int a[5];
    cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];

    int max_wait_time = 0;
    int max_wait_idx = 0;

    for(int i=0;i<5;++i)
    {
        int wait_time = 10 - a[i] % 10;
        if(wait_time == 10)
            wait_time = 0;
            
        if(wait_time > max_wait_time)
        {
            max_wait_idx = i;
            max_wait_time = wait_time;
        }
    }

    int sum_time = 0;

    for(int i=0;i<5;++i)
    {
        if(i == max_wait_idx)
        {
            sum_time += a[i];
        }
        else if(a[i] % 10 == 0)
        {
            sum_time += a[i];
        }
        else
        {
            sum_time += a[i] + (10 - a[i] % 10);
        }               
    }

    cout << sum_time << endl;
    return 0;
}

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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair
#define F first
#define S second

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


int main() {
  i64 X, A;
  cin >> X >> A;
  if (X < A) cout << 0 << endl;
  else cout << 10 << endl;

  return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
int main(void)
{
	int data[3];
	int i,j,temp;
	for(i=0;i<3;i++){
		scanf("%d",&data[i]);
	}
	for(i=0;i<2;i++){
		for(j=2;j>=i+1;j--){
			if(data[j]<data[j-1]){
				temp=data[j];
				data[j]=data[j-1];
				data[j-1]=temp;
			}
		}
	}
	for(i=0;i<2;i++){
		printf("%d ",data[i]);
	}
	printf("%d\n",data[2]);
	return 0;
}


Measured memory_bytes: 2000
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, k int
	fmt.Scan(&n, &k)
	mp := make(map[int]int)
	for i := 0; i < n; i++ {
		var a int
		fmt.Scan(&a)
		mp[a] = mp[a] + 1
	}
	ps := make(pairs, 0)
	for k, v := range mp {
		ps = append(ps, pair{k, v})
	}
	sort.Sort(ps)
	count := 0
	for i := 0; i < len(ps) - k; i++ {
		count += ps[i].v
	}
	fmt.Println(count)
}

type pair struct {
	k, v int
}

type pairs []pair

func (p pairs) Len() int { return len(p) }
func (p pairs) Less(i, j int) bool { return p[i].v < p[j].v }
func (p pairs) Swap(i, j int){ p[i], p[j] = p[j], p[i] }

Measured memory_bytes: 24192
#pragma GCC optimize("O3")
#define _GLIBCXX_DEBUG

#include <algorithm>
#include <array>
#include <cassert>
#include <climits>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

#define endl '\n'
#define fcout cout << fixed << setprecision(15)

#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second

#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; (i) < (int)(n); i++)

using ll    = long long;
using ld    = long double;
using Pii   = pair<int, int>;
using Pll   = pair<ll, ll>;

constexpr int MOD       = (int)1e9 + 7;
constexpr int INF_int   = (int)(1 << 30);
constexpr ll INF_ll     = (ll)1e18 + 1;
constexpr ld PI         = 3.141592653589793L;

template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
//vector<int> dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };

/*追加部分*/



/*main関数*/

signed main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    
    int x; cin >> x;

    if(x == 0) cout << 1 << endl;
    if(x == 1) cout << 0 << endl;

return 0;
}

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

int64_t MOD = 1000000007;
double PI = 3.141592653589793;

vector<int64_t> mybit(int64_t p, int64_t q, int64_t N) //p bit探索 N桁
{
    vector<int64_t> bit;
    while (q >= p)
    {
        int64_t tmp = q % p;
        bit.push_back(tmp);
        q /= p;
    }
    bit.push_back(q % p);
    bit.resize(N);
    return bit;
}

int main()
{
    int H, W, K;
    cin >> H >> W >> K;
    vector<vector<char>> list(H, vector<char>(W));
    for (int i = 0; i < H; i++)
        for (int j = 0; j < W; j++)
            cin >> list[i][j];

    int ans = 0;
    for (int i = 0; i < pow(2, H); i++)
    {
        for (int j = 0; j < pow(2, W); j++)
        {
            int count = 0;
            auto h = mybit(2, i, H), w = mybit(2, j, W);
            for (int k = 0; k < H; k++)
                for (int l = 0; l < W; l++)
                    if (h[k] && w[l] && list[k][l] == '#')
                        count++;
            if (count == K)
                ans++;
        }
    }
    cout << ans;
}

Measured memory_bytes: 4104
/*
author: diradon
25-Aug-19
17:50:52
*/

#include<bits/stdc++.h>
typedef long long int ll;
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    int h[n+5];
    int a[n+5];
    for (int i = 1; i <= n; i++)
    {
         cin >> h[i];
         a[i] = 0;
    }

    a[1] = 0;
    a[2] = abs(h[2] - h[1]);
    for (int i = 3; i <= n; i++)
        a[i] = min(a[i-2] + abs(h[i] - h[i-2]), a[i-1] + abs(h[i-1] - h[i]));
    cout << a[n] << "\n";       

}

Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>

using namespace std;


int main(){
    int a,b;
    double c;
    cin >> a >> b;
    cout << a/b <<  " " << a%b << " ";
    cout << fixed;
    cout << setprecision(6) << (double)a/b << endl;
    return 0;
}


Measured memory_bytes: 3292
# coding: utf-8
 
class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n+1)]
        self.rank = [0] * (n+1) # 木の高さ
        self.n = [1] * (n+1)    # グループメンバー数
        
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]
    
    def find_n(self, x):
        return self.n[self.find(x)]
    
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
            self.n[y] = self.n[x] + self.n[y]
        else:
            self.par[y] = x
            self.n[x] = self.n[x] + self.n[y]
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
    
    def is_same(self, x, y):
        return self.find(x) == self.find(y)
    
# -----

N, M = [int(i) for i in input().split()]

bridges = [tuple(int(i) for i in input().split()) for j in range(M)]

bridges = bridges[::-1]

result = []

now = int(N * (N-1) / 2) #最終不便さ

uf = UnionFind(N)

for i in range(M):
    result.append(now)
    a = bridges[i][0]
    b = bridges[i][1]
    if uf.is_same(a, b): # 既に同じグループ
        pass
    else:
        now -= uf.find_n(a) * uf.find_n(b)
        uf.union(uf.find(a), uf.find(b))

result = result[::-1]

for i in result:
    print(i)

Measured memory_bytes: 24796
package main

import (
	"fmt"
	"regexp"
)

func main() {
	a()
}

func a() {
	var s string
	fmt.Scanf("%s", &s)
	r := regexp.MustCompile(`[A-Z]`)

	if r.MatchString(s) {
		fmt.Println("A")

	} else {
		fmt.Println("a")
	}
}


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

using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define vp vector<pair<int, int>>
#define vll vector<long long>
#define inf 1000000100
#define infll 1LL << 50

int main()
{
    int x, y;
    cin >> x >> y;
    bool solve = 0;
    for(int i = 0; i <= x; ++i)
    {
        if(i*2 + (x-i)*4 == y)
        {
            solve = 1;
            break;
        }
    }
    if(solve)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3632
n = int(input())
a = [int(i) for i in input().split()]

x = (sum([a[i] for i in range(0, len(a), 2)]) -
     sum([a[i] for i in range(1, len(a), 2)]))//2

prev = 0
res = []
for i in range(len(a)-1):
    if i == 0:
        tmp = x*2
        res.append(x*2)
        prev = x*2
    tmp = (a[i] - prev//2)*2
    res.append(tmp)
    prev = tmp

print(" ".join(map(str, res)))


Measured memory_bytes: 19096
def binarySearch(array, key, n)
  left = 0
  right = n
  while left < right
    mid = (left + right) / 2
    if array[mid] == key
      return true
    elsif key < array[mid]
      right = mid
    else
      left = mid + 1
    end
  end
  return false
end

n = gets.to_i
s = gets.chomp.split(' ').map(&:to_i)
q = gets.to_i
t = gets.chomp.split(' ').map(&:to_i)
count = 0

q.times do |i|
  count += 1 if binarySearch(s, t[i], n)
end
puts count

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

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

constexpr int dx[8] = { 1,1,0,-1,-1,-1,0,1 };
constexpr int dy[8] = { 0,1,1,1,0,-1,-1,-1 };


using namespace std;

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template <class T> bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
template <class T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a,b;
	cin>>a>>b;
	if(a%2!=b%2)cout<<"IMPOSSIBLE"<<endl;
	else cout<<(a+b)/2<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,k,v[100005];
int cnt[100005];
int main() {
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",v+i),cnt[v[i]]+=(i&1);
	int k1=1e9,x1,k11=1e9,k2=1e9,x2,k22=1e9;
	for(int i=1;i<=100000;i++) 
		if(n/2-cnt[i]<k1) x1=i,k11=k1,k1=n/2-cnt[i];
		else if(n/2-cnt[i]<k11) k11=n/2-cnt[i];
	memset(cnt,0,sizeof cnt);
	for(int i=1;i<=n;i++) cnt[v[i]]+=(i%2==0);
	for(int i=1;i<=100000;i++) 
		if(n/2-cnt[i]<k2) x2=i,k22=k2,k2=n/2-cnt[i];
		else if(n/2-cnt[i]<k22) k22=n/2-cnt[i];
	if(x1!=x2) printf("%d\n",k1+k2);
	else printf("%d\n",min(k1+k22,k2+k11));
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>

using namespace std;

int main () {
    // input
    char ch;
    int arr[1200] = {0};
    while (cin >> ch) {
        arr[tolower(ch) - 'a'] += 1;
    }

    // output
    string alphabet = "abcdefghijklmnopqrstuvwxyz";
    for (int i=0; i<26; i++) {
        cout
            << alphabet[i]
            << " : "
            << arr[i]
            << endl;
    }
}


Measured memory_bytes: 3240
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	int a, b, c;
	cin >> a >> b >> c;
	
	int ma = max({a, b, c});
	int mi = min({a, b, c});
	int mid = a + b + c - ma - mi;
	cout << ma * 10 + mid + mi << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
using namespace std;
const int inf=2147483647,dx[]={-1,0,1,0},dy[]={0,-1,0,1};// 上 左 下 右
const int N=100005,M=1000005,mod=1000000007;
const long long llinf=9223372036854775807ll;
int n,a[5][N],dp[5][N];
int main(){
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[1][i]>>a[2][i]>>a[3][i];
	for(int i=1;i<=3;i++)
		dp[i][1]=a[i][1];
	for(int i=2;i<=n;i++)
	{
		dp[1][i]=max(dp[2][i-1],dp[3][i-1])+a[1][i];
		dp[2][i]=max(dp[1][i-1],dp[3][i-1])+a[2][i];
		dp[3][i]=max(dp[1][i-1],dp[2][i-1])+a[3][i];
	}
	cout<<max(dp[1][n],max(dp[2][n],dp[3][n]));
	return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using ll = long long;

const long long INF = 1LL << 60;
const ll MOD = ll(1e9)+7;


int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

ll vector_finder(vector<ll> vec, ll number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  if (itr == vec.end()) {
    return -1;
  }
  size_t index = std::distance( vec.begin(), itr );
  return index;
}




vector<pair<ll, ll> > prime_factorization(ll N) {
    vector<pair<ll, ll> > res;
    for (ll a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        ll ex = 0;

        while (N % a == 0) {
            ++ex;
            N /= a;
        }

        res.push_back({a, ex});
    }

    if (N != 1) res.push_back({N, 1});
    return res;
}


int main() {
  ll N;
  cin >> N;

  vector<ll> div;
  ll num, count;

  const auto &vec = prime_factorization(N);

  ll ans = 0;

  for (auto p : vec) {

    num = p.second;
    count = 1;
    while(1) {
      num = num - count;

      if (num < 0) break;
      ans = ans + 1;
      count++;
      
    }
  }


  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3632
#include <iostream>

using namespace std;

int main()
{
    int n;
    cin >> n;

    string result = "No";
    while(n > 0)
    {
        if(n % 10 == 9)
        {
            result = "Yes";
            break;
        }

        n /= 10;
    }

    cout << result << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < (n); i++)

using namespace std;

void solve() {
  long N;
  cin >> N;
  long t = 0;
  long x = 0;
  long y = 0;
  rep (i, N) {
    long tt, xx, yy;
    cin >> tt >> xx >> yy;
    long tmp = abs(x - xx) + abs(y - yy);
    tt -= tmp;
    if (tt < 0 or tt % 2 != 0) {
      cout << "No" << endl;
      return;
    }
  }
  cout << "Yes" << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>

typedef int32_t i32;

#define ALLOC(size,type) ((type*)calloc((size),sizeof(type)))

void add (i32 *bit, i32 x, i32 v) {
  i32 n = bit[0];
  for (i32 i = x; i <= n; i += i & -i) {
    bit[i] += v;
  }
}

i32 get_sum (i32 *bit, i32 x) {
  i32 sum = 0;
  for (i32 i = x; i > 0; i -= i & -i) {
    sum += bit[i];
  }
  return sum;
}

void init_bit (i32 *bit) {
  i32 n = bit[0];
  for (i32 i = 1; i <= n; ++i) {
    bit[i] = 0;
  }
}

void run (void) {
  i32 n;
  scanf ("%" SCNi32, &n);
  i32 *w = ALLOC (n + 1, i32);
  i32 *b = ALLOC (n + 1, i32);
  for (i32 i = 1; i <= 2 * n; ++i) {
    char s[5];
    i32 a;
    scanf ("%s%" SCNi32, s, &a);
    if (s[0] == 'W') {
      w[a] = i;
    } else {
      b[a] = i;
    }
  }
  i32 *bit = ALLOC (2 * n + 1, i32);
  bit[0] = 2 * n;
  i32 *dp = ALLOC (n + 1, i32);
  for (i32 i = 1; i <= n; ++i) {
    add (bit, b[i], 1);
    dp[i] = dp[i - 1] + (i - get_sum (bit, b[i]));
  }
  for (i32 i = 1; i <= n; ++i) {
    init_bit (bit);
    dp[0] = 0;
    for (i32 j = 1; j <= i; ++j) {
      add (bit, w[j], 1);
      dp[0] += j - get_sum (bit, w[j]);
    }
    for (i32 j = 1; j <= n; ++j) {
      add (bit, b[j], 1);
      i32 x = dp[j - 1] + (i + j - get_sum (bit, b[j]));
      i32 y = dp[j] + (i + j - get_sum (bit, w[i]));
      dp[j] = x < y ? x : y;
    }
  }
  printf ("%" PRIi32 "\n", dp[n]);
}

int main (void) {
  run();
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
    using namespace std;
 
    #define EPS (1e-9)
    #define ll long long int
    #define ull unsigned long long
    #define pi (acos(-1.0))
    #define endl "\n"
    #define all(v) v.begin(),v.end()
    #define printa(a,L,R) for(int i=L;i<R;i++) cout<<a[i]<<(i==R-1?'\n':' ')
    #define precise(n) cout << fixed << setprecision(n)
    #define show(a) cout << (#a) << " is " << (a) << endl;
    #define pcase cout<<"Case "<<++cs<<": "
    #define FAST ios_base::sync_with_stdio(0); cin.tie(0);
    const int mod=1e9+5;
    const int mx=1e5+10;
    const int inf=1<<28;
    typedef pair< int,int > pii;
    ll binpow(ll base, ll exp){ll res = 1;while(1){ if(exp&1) res*=base;exp>>=1;if(!exp)break;base*=base;}return res;}
    bool cmp(const pii a,const pii b)
    {
        if(a.second==b.second) return a.first<b.first;
 
        return a.second>b.second;
    }
    	int n,k;
        vector<pii> v;
    ll dp[101][mx];
    ll func(int i,int w)
    {
        if(i>=n) return 0;
        if(dp[i][w]!=-1) return dp[i][w];
        ll ret=0,ret2=0;
        if(w-v[i].first>=0) ret=v[i].second+func(i+1,w-v[i].first);
        ret2=func(i+1,w);
        return dp[i][w]=max(ret,ret2);
    }
    int main(int argc, char const *argv[])
    {
    	FAST
    	cin >> n >> k;
        for (int i = 0; i < n; ++i)
        {
            int a,b;

            cin >> a >> b;
            v.emplace_back(a,b);
        }
    	
        memset(dp,-1,sizeof(dp));
        
        cout << func(0,k)<< endl;
 
    	
    	
 
    	return 0;
            }

Measured memory_bytes: 79232
import bisect

N,Q = map(int,input().split())
S = input()
a = [input().split() for l in range(Q)]
x = []
for i in range (0,N-1):
  if (S[i] == "A") and (S[i+1] == "C"):
    x.append(i)
for k in range (0,Q):
  l = int(a[k][0]) - 1
  r = int(a[k][1]) - 1
  p = bisect.bisect_left(x,l)
  q = bisect.bisect_left(x,r)
  print(q-p)

Measured memory_bytes: 35060
#include<bits/stdc++.h>
using namespace std;
#define int long long

signed main(){

  int n,k; cin >> n >> k;

  double ans = 0;
  for(int i = 1; i <= n; i++){
    int t = i,cnt = 0;
    while(t < k){
      t *= 2;
      cnt++;
    }
    ans += (1.0 / (double)pow(2,cnt)) * (1.0 / (double)n);
  }
  printf("%.10f\n",ans);

  return 0;
}


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

int main() {
	char b[5][5];

	while (cin >> b[0] ) {
		if (b[0][0] == '0')break;
		cin >> b[1] >> b[2];
		string x;
		if (b[0][0] == b[0][1] && b[0][1] == b[0][2] && b[0][0] != '+') { x = b[0][0]; }
		else if (b[1][0] == b[1][1] && b[1][1] == b[1][2] && b[1][0] != '+') { x = b[1][0]; }
		else if (b[2][0] == b[2][1] && b[2][1] == b[2][2] && b[2][0] != '+') { x = b[2][0]; }
		else if (b[0][0] == b[1][0] && b[1][0] == b[2][0] && b[0][0] != '+') { x = b[0][0]; }
		else if (b[0][1] == b[1][1] && b[1][1] == b[2][1] && b[0][1] != '+') { x = b[0][1]; }
		else if (b[0][2] == b[1][2] && b[1][2] == b[2][2] && b[0][2] != '+') { x = b[0][2]; }
		else if (b[0][0] == b[1][1] && b[1][1] == b[2][2] && b[0][0] != '+') { x = b[0][0]; }
		else if (b[0][2] == b[1][1] && b[1][1] == b[2][0] && b[0][2] != '+') { x = b[0][2]; }
		else x = "NA";
		cout << x << endl;
	}
	return 0;
}

Measured memory_bytes: 3136
#include <iostream>
#include <string>
using namespace std;
int main()
{
int l=0,f=0,a=0;
string S;
cin >> S;
for(int i=0;i<S.size();i++){
    if(islower(S[i])){
        l++;
    }
}
for(int j=2;j<S.size()-1;j++){
    if(S[j]=='C'){
        f++;
    }
}
if((S[a]!='A') || (f==0) || (f>1) || (l!=S.size()-2))
    cout<<"WA";
else
    cout<<"AC";
    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{
  public static void main(String[] args) throws IOException{
   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
   //??????????????¶??°?????\???
   int n = Integer.parseInt(br.readLine());
   int[][][] room = new int[4][3][10];//??¨?±?????????°
    
   for(int i = 0;i < 4;i++){
     for(int j = 0;j < 3;j++){ 
       for(int k = 0;k < 10;k++){
         room[i][j][k] = 0;//??????????????°???0????????????
       }
     }
   }
     
    for(int i = 0;i < n;i++){   
     String line = br.readLine();  
     String[] token = line.split(" ");
     int b, f, r, v; //?£?????????°?????¨?±???????,????????\?±?       
     b = Integer.parseInt(token[0]);
     f = Integer.parseInt(token[1]);
     r = Integer.parseInt(token[2]);
     v = Integer.parseInt(token[3]);
     room[b-1][f-1][r-1] += v;
 
    } 

    for(int i = 0;i < 4;i++){
     for(int j = 0;j < 3;j++){ 
       for(int k = 0;k < 10;k++){
         System.out.print(" " + room[i][j][k]);
       }
       System.out.println();
     }
      if(i != 3){   
       System.out.println("####################");
      }
    }

  }
}

Measured memory_bytes: 24696
#include <iostream>
#include <fstream>
#include <cstdio>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <stack>
#include <queue>
#include <algorithm>
#include <string.h>
#include <string>
#include <math.h>
#include <iomanip>
using namespace std;

#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define pb push_back

typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;

const int mod = (int)1e9 + 7;
const int mod2 = 998244353;

ll exp(ll taban, ll us, ll md) {
    ll carpan = taban % md;
	if(carpan == 0) return 0;
    ll temp = us;
    ll res = 1;
    while(temp){
        if(temp % 2) res = (res*carpan) % md;
        temp /= 2;
        carpan = (carpan*carpan) % md;
    }
    return res;
}
 
ll ebob(ll a, ll b){
    if(!a)return b;
    return ebob(b%a, a);
}

ll ekok(ll a, ll b){
    return (a*b)/ebob(a, b);
}

ll mul(ll a, ll b, ll md){
	return a*b % md;
}

vector<ll> fact;
vector<ll> inv_fact;
void fact_init(int n){
	fact.resize(n+5);
	inv_fact.resize(n+5);
	fact[0] = inv_fact[0] = 1;
	for(int i = 1; i <= n; i++){
		fact[i] = (fact[i-1] * i) % mod;
		inv_fact[i] = exp(fact[i], mod-2, mod);
	}
}

ll komb(ll a, ll b){
	if(a < b) return 0;
	return fact[a] * (inv_fact[a-b] * inv_fact[b] % mod) % mod;
}

const int N = 1e5+5;
int ans;

int main(){
	ios::sync_with_stdio(false); cin.tie(NULL);
	int n, m; cin>>n>>m;
	priority_queue<int> q;
	while(n--){
		int s; cin>>s; q.push(s);
	}
	while(m--){
		int cur = q.top();
		cur /= 2;
		q.pop();
		q.push(cur);
	}
	ll ans = 0;
	while(!q.empty()){
		ans += q.top();
		q.pop();
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
  int n;
  cin>>n;
  int a[n];
  vector<int>ve,vo;
  for(int i=0;i<n;i++)
  {
    int x;
    cin>>x;
     if(i&1)
     {
       vo.push_back(x);
     }
     else
     {
       ve.push_back(x);
     }
  }
 vector<int>v;
   reverse(vo.begin(), vo.end()); 
   for(auto it=vo.begin();it!=vo.end();it++)
   {
     v.push_back(*it);
     //cout<<*it<<" ";
   }
   for(auto it=ve.begin();it!=ve.end();it++)
   {
     v.push_back(*it);
     //cout<<*it<<" ";
   }
   if(n&1)
   {
     reverse(v.begin(),v.end());
   }
   for(auto it=v.begin();it!=v.end();it++)
   {
     cout<<*it<<" ";
   }
cout<<endl;
}

Measured memory_bytes: 5480
#include "bits/stdc++.h"
#define rep(i,a,n) for(int i = (a);i < (n);i++)
typedef unsigned long long ull;
typedef long long ll;
using namespace std;

int main(){
    
    int n,m,x,y;
  	cin >> n >> m >> x >> y;
  	int a[n],b[m];
  	bool flag = true;
  	
  	rep(i,0,n){
      cin >> a[i];
    }
  
  	rep(i,0,m){
      cin >> b[i];
    }
  
  	rep(i,x+1,y+1){
      flag = true;
      rep(j,0,n){
        if(a[j] >= i){
          flag = false;
        }
      }
      rep(j,0,m){
        if(b[j] < i){
          flag = false;
        }
      }
      
      if(flag){
        cout << "No War" << endl;
      	return 0;
      }
    }
  
  	cout << "War" << endl;
  
  	
  
  return 0;
  
}

Measured memory_bytes: 384
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int d = sc.nextInt();
        int[][] a = new int[n][d];
        for(int i = 0; i < n; i++) {
            for(int j = 0; j < d; j++) {
                a[i][j] = sc.nextInt();
            }
        }
        int count = 0;
        for(int i = 0; i < n; i++) {
            for(int j = i + 1; j < n; j++) {
              if(distance(a[i], a[j], d))count++;
            }
        }
        System.out.println(count);
    }

    public static boolean distance(int[] distA, int[] distB, int d) {
        double dist = 0;
        for(int i = 0; i < d; i++) {
            int num = Math.abs(distA[i] - distB[i]);
              dist += (num * num);
        }
        double root = Math.sqrt(dist);
        return root == (long)root;
    }
}


Measured memory_bytes: 21844
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace abc0211
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] tmp = Console.ReadLine().Split(' ');
            int Alice = int.Parse(tmp[0]);
            int Bob = int.Parse(tmp[1]);

            if (Alice == 1)
            {
                Alice = 14;
            }
            if(Bob == 1)
            {
                Bob = 14;
            }

            if (Alice - Bob > 0)
            {
                Console.WriteLine("Alice");
            }
            else if (Alice == Bob)
            {
                Console.WriteLine("Draw");
            }
            else
            {
                Console.WriteLine("Bob");
            }
        }
    }
}


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

int N,A[100010],B[100010],C[100010],dp[100010][3] = {};

int main(){
	cin >> N;
	for(int i=1;i<=N;i++){
		cin >> A[i] >> B[i] >> C[i];
	}
	dp[1][0] = A[1];
	dp[1][1] = B[1];
	dp[1][2] = C[1];
	for(int i=2;i<=N;i++){
		dp[i][0] = max(dp[i-1][1],dp[i-1][2])+A[i];
		dp[i][1] = max(dp[i-1][0],dp[i-1][2])+B[i];
		dp[i][2] = max(dp[i-1][1],dp[i-1][0])+C[i];
	}
	cout << max(dp[N][0],max(dp[N][1],dp[N][2])) << endl;
}

Measured memory_bytes: 2560
#include <iostream>

using namespace std;
int n,k;
int A[100001];
void solve(){
  int one;
  int right,left;
  int res = 0;
  //serch 1
  for(int i = 0; i < n; i++){
    if(A[i] == 1) one = i;
  }
  right = one;
  left = one;
  int resMin = 1000001;
  for(int i = 0; i < k; i++){//初動を決める
    res  = 1;
    left = max(0,one - i);
    right = min(n-1,one + k-1 - i);
    while(right != n-1 || left != 0){
      if(left != 0) {left = max(0,left - (k -1)); res++;}
      if(right != n-1) {right = min(n-1,right + (k -1)); res++;}
    }
    resMin = min(resMin,res);
  }
  cout <<  resMin << endl;
  return ;
}
int main(){
  cin >> n >> k;
  for(int i = 0; i <  n ; i++){
    cin >> A[i] ;
  }
  solve();
  return 0;
}


Measured memory_bytes: 640
//AtCoder ABC060 B - Choose Integers
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;

int main() {
    int A,B,C;
    cin>>A>>B>>C;
    bool ans=false;
    for(int i=1;i<=B;++i){
        if(i*A%B==C) {
            ans=true;
            break;
        }
    }
    cout<<(ans?"YES":"NO")<<endl;
    return 0;
}

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

using ll = long long;

int main() {	
	int n;
	cin >> n;
	vector<int> l(2 * n);
	for (int i = 0; i < 2 * n; i++) {
		cin >> l[i];
	}

	sort(l.begin(), l.end());

	ll ans = 0;
	for (int i = 0; i < 2 * n; i += 2) {
		ans += l[i];
	}

	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3592
n,m = (int(i) for i in input().split())
a = [-int(i) for i in input().split()]
import heapq
heapq.heapify(a)
for i in range(m):
  temp = -heapq.heappop(a)
  temp = temp // 2
  heapq.heappush(a, -temp)
print(-sum(a))

Measured memory_bytes: 14224
K = int(input())
A = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(A[K-1])

Measured memory_bytes: 3060
#include <iostream>

using namespace std;

int main() {
    
    int a, b;
    
    cin >> a >> b;
   
    if (a < b){
        cout << "a < b" << endl;
    }
    else if (a > b){
        cout << "a > b" << endl;
    }
    else{
        cout << "a == b" << endl;
    }
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 2e5 + 10;
#define fi first
#define se second
#define pb push_back
const LL mod=998244353;
int n,a[N],s;
LL dp[3333][3333],ans;
int main() {
  ios::sync_with_stdio(false);
  cin>>n>>s;
  for(int i=1;i<=n;i++)cin>>a[i];
  dp[0][0]=1;
  for(int i=1;i<=n;i++){
    for(int j=a[i];j<=s;j++){
      dp[i][j]+=dp[i-1][j-a[i]];
      dp[i][j]%=mod;
    }
    for(int j=0;j<=s;j++){
      dp[i][j]+=dp[i-1][j]*2;
      dp[i][j]%=mod;
    }
  }
  cout<<dp[n][s]<<'\n';
  return 0;
}

Measured memory_bytes: 81736
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define is(a, b) a == b
#define len(v) ll(v.size())

const ll mod=1e9+7;

//vector書き出し
template <class T>
void cout_vec(const vector<T> &vec1){
  rep(i,len(vec1)){
    cout<<vec1[i]<<' ';
  }
  cout<<'\n';
}

typedef pair<ll,ll> P;

int dp[110][10];//h列目の操作が終わった時の行
int h,w,k;

void dfs(int x,int d,vector<int> &ret,vector<bool> &check){
  //cout<<d<<' '<<w<<'\n';
  if(d==w){
    //cout<<' '<<check[1]<<' '<<check[2]<<'\n';
    if(check[x-1]){
      ret[0]++;//左に動く
    }else if(check[x]){
      ret[1]++;//右に動く
    }else{
      ret[2]++;//動かない
    }
    return ;
  }
  if(d>=2 && check[d-1]){
    dfs(x,d+1,ret,check);
    return ;
  }
  vector<bool> check2(check);
  check2[d]=true;
  dfs(x,d+1,ret,check);//dからの横線なし
  dfs(x,d+1,ret,check2);//あり
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin>>h>>w>>k;
    dp[0][1]=1;
    rep(i,h+1){
      FOR(j,1,w+1){
        vector<bool> check(10,false);
        vector<int> cnt(3,0);
        //cout<<i<<'\n';
        dfs(j,1,cnt,check);
        //cout<<i<<' '<<j<<'\n';
        //cout_vec(cnt);
        dp[i+1][j-1]+=(dp[i][j]*(cnt[0]%mod))%mod;
        dp[i+1][j+1]+=(dp[i][j]*(cnt[1]%mod))%mod;
        dp[i+1][j]+=(dp[i][j]*(cnt[2]%mod))%mod;
        dp[i+1][j-1]%=mod;
        dp[i+1][j+1]%=mod;
        dp[i+1][j]%=mod;
        /*
        if(i==0 && j==1){
          cout<<"  "<<dp[i][j]<<' '<<cnt[1]<<' '<<dp[i+1][j+1]<<'\n';
        }
        */
      }
    }
    /*
    cout<<dp[1][2]<<'\n';
    rep(i,h+1){
      rep(j,w+1){
        cout<<dp[i][j]<<' ';
      }
      cout<<'\n';
    }
    */
    cout<<dp[h][k]<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<math.h>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
const int N=10000;
const db pi=acos(-1.0);
#define lowbit(x) (x)&(-x)
#define sqr(x) (x)*(x)
#define rep(i,a,b) for (register int i=a;i<=b;i++)
#define per(i,a,b) for (register int i=a;i>=b;i--)
#define fir first
#define sec second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define maxd 998244353
#define eps 1e-8
int n,lim;
ll dp[100100];

int read()
{
    int x=0,f=1;char ch=getchar();
    while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
    while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
    return x*f;
}

int main()
{
	n=read();lim=read();
	rep(i,1,n)
	{
		int w=read(),v=read();
		per(j,lim-w,0) dp[j+w]=max(dp[j+w],dp[j]+v);
	}
	printf("%lld",dp[lim]);
	return 0;
}

Measured memory_bytes: 1024
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        while (true) {
            int n = scanner.nextInt(), x = scanner.nextInt();

            if (n == 0 && x == 0) break;

            int cnt = 0;
            for (int i = 1; i <= n; ++i) {
                for (int j = i + 1; j <= n; ++j) {
                    for (int k = j + 1; k <= n; ++k) {
                        if (i + j + k == x) ++cnt;
                    }
                }
            }
            System.out.println(cnt);
        }
    }
}


Measured memory_bytes: 26592
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

int main(){
    int n;
    cin >> n;

    if(n == 2){
            cout << 2 << endl;
            return 0;
    }

    if(n % 2 == 0) n++;

    for(int i = n;;i += 2){
        bool prime = true;
        for(int j = 3; j <= sqrt(i); j += 2){
            if(i % j == 0){
                prime = false;
                break;
            }
        }
        if(prime){
            cout << i << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
N = int(input())
A = [int(n) for n in input().split()]

cnt_A = [0]*(100001)

cnt_removed = 0
cnt_two = 0

for a in A:
  cnt_A[a] += 1
  if cnt_A[a] == 3:
    cnt_two -= 1
    cnt_A[a] -= 2
    cnt_removed += 2
  elif cnt_A[a] == 2:
    cnt_two += 1

cnt_removed += (cnt_two + 1)//2 * 2

print(N-cnt_removed)

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(n);(i)++)
#define repr(i,n) for(int (i)=(n)-1;(i)>=0;(i)--)
#define all(v) (v).begin(),(v).end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define pb push_back
#define mod 1000000007
#define inf 1000000000
#define llinf 1000000000000000


typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int,int> pint;
typedef pair<ll,ll> pll;
typedef vector<pint> vpint;



int main(){
    int x,a;
    cin>>x>>a;
    if(x<a){
        cout<<0<<endl;
    }
    else{
        cout<<10<<endl;
    }
}

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

using namespace std;

typedef long long ll;

ll test_cases;
int main()
{
    
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);

    /* cin >> test_cases; */
    test_cases = 1;

    while (test_cases > 0)
    {
        ll a;
        string b;

        cin >> a >> b;

        ll c = (b[0] - '0')*100 + (b[2] - '0')*10 + (b[3] - '0');

        cout << (ll)((a*c)/100) << endl;

        test_cases--;
    }

    
    return 0;
}

Measured memory_bytes: 3636
using System;
using System.Linq;
using System.Text;

class Program {
  static void Main() {
    var arr = Console.ReadLine().Split().Select(int.Parse).ToArray();
    var h = arr[0];
    var w = arr[1];
    var sb = new StringBuilder();
    for (int i = 0; i < h; i++) {
      var s = Console.ReadLine();
      sb.AppendLine(s + "\n" + s);
    }
    Console.Write(sb);
  }
}

Measured memory_bytes: 13316
//
// Created by mustafa on 15/07/19.
//
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std ;

#define ll long long
#define submitStage int TCF = 1 ;
#define testStage int TCF = 1000 ;
#define Start while(TCF--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (a); i >= (b); i--)
#define REP(i, n) FOR(i, 0, n)
#define FastInputOutput ios_base :: sync_with_stdio( 0 ) ; cin.tie( 0 ) ; cout.tie( 0 ) ;
#define ReadFromFile(x)  freopen( x, "rt" , stdin ) ;
#define WriteToFile(x)  freopen( "in.txt", "wt" , stdout ) ;
#define D(x) scanf("%d",&x);
#define LLD(X) scanf("%lld",&x);
#define in(x,...) scanf(x,__VA_ARGS__)
#define out(x,...) printf(x,__VA_ARGS__)
/// for debugging
string to_string(string s) {return '"' + s + '"';}string to_string(const char* s) {return to_string((string) s);}string to_string(bool b) {return (b ? "true" : "false");}template <typename A, typename B>string to_string(pair<A, B> p) {return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}template <typename A>string to_string(A v) {bool first = true;string res = "{";for (const auto &x : v) {if (!first) {res += ", ";}first = false;res += to_string(x);}res += "}";return res;}void debug_out() { cerr << endl; }template <typename Head, typename... Tail>void debug_out(Head H, Tail... T) {cerr << " " << to_string(H);debug_out(T...);}
#ifndef ONLINE_JUDGE
#define dbg(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define dbg(...) {}
#endif
/// start driven program
const int N=1e6+7;

int main(){
    submitStage Start{
        string a,b;
        cin>>a>>b;
        a+=b;
        int n=atoi(a.c_str());
        int flag=true;
        for(int i=1 ; i <= 1000 ; ++i){
            if(i*i==n){
                flag=false;
                break;
            }
        }
        puts(flag?"No":"Yes");
    }
}




Measured memory_bytes: 256
#define  _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#pragma comment (linker, "/STACK:526000000")

#include "bits/stdc++.h"

using namespace std;
typedef string::const_iterator State;
#define eps 1e-11L
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL

#define MOD 998244353LL
#define seg_size 262144 * 4LL
#define pb push_back
#define mp make_pair
typedef long long ll;
#define REP(a,b) for(long long (a) = 0;(a) < (b);++(a))
#define ALL(x) (x).begin(),(x).end()

void init() {
    iostream::sync_with_stdio(false);
    cout << fixed << setprecision(20);
}


#define int ll

unsigned long xor128() {
    static unsigned long x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    unsigned long t = (x ^ (x << 11));
    x = y; y = z; z = w;
    return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}

int dp[201][20000];

void solve(){
    int n, w;
    cin >> n >> w;
    vector<int>inputs;
    REP(i, n) {
        int a;
        cin >> a;
        inputs.push_back(a);
    }
    sort(ALL(inputs));
    dp[n][0] = 1;
    for (int q = n - 1; q >= 0; --q) {
        REP(i,w+1) {
            dp[q][i + inputs[q]] += dp[q + 1][i];
            dp[q][i] += dp[q + 1][i];
            dp[q][i] %= MAX_MOD;
            dp[q][i + inputs[q]] %= MAX_MOD;
        }
    }
    int ans = 0;
    int now = 0;
    for (int i = 0; i < n; ++i) {
        for (int q = 0; q <= w; ++q) {
            int geko = now + q;
            if (geko <= w && geko > w - inputs[i]) {
                ans += dp[i+1][q];
            }
        }
        now += inputs[i];
    }
    if (now <= w) ans++;
    ans %= MAX_MOD;
    cout << ans << endl;
}

#undef int
int main() {
    init();
    solve();
}


Measured memory_bytes: 24496
fun main(args: Array<String>) {
    val s = readLine()!!
    val t = readLine()!!

    val n = s.length
    val sArr = IntArray(26){0}
    val tArr = IntArray(26){0}
    repeat(n) {
        sArr[s[it] - 'a']++
        tArr[t[it] - 'a']++
    }

    sArr.sort()
    tArr.sort()

    var ans = true

    repeat(26) {
        if (sArr[it] != tArr[it]) ans = false
    }
    if (ans) println("Yes")
    else println("No")
}


Measured memory_bytes: 39304
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,b,n) for(int i=b;i<n;i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
const int MAX_N =100010;
int prime[MAX_N];//i番目の素数
bool is_prime[MAX_N+1];//is_prime[i]がtrueならiは素数

//n以下の素数の数を返す
int sieve(int n){
	int p = 0;
	for(int i = 0;i <=n;i++){
		is_prime[i] =true;
	}
	is_prime[0] = false;
	is_prime[1] = false;
	for(int i = 2;i <=sqrt(n);i++){
		if(is_prime[i]){
			for(int j = 2*i;j <=n;j +=i){
				is_prime[j] =false;
			}
		}
	}
	return p;
}
int main(){
	sieve(100008);
	double m,a,b;
	while(cin>>m>>a>>b,m||a||b){
		double k = a/b;
		int tmp = 0;
		int ans = 0;
		int ansx = 0;
		int ansy = 0;
		for(int i = 2;i <=sqrt(m);i++){
			if(!is_prime[i])
				continue;
			for(int j = i;j <=m/2;j++){
				if(!is_prime[j])
					continue;
				double l = (double)i/j;
				if(m>=i*j&&k<=l&&l<=1&&i*j>ans){
					ans = i*j;
					//cout <<k<<" "<<l<<endl;
					ansx = i;
					ansy = j;
				}
				if(i*j>m){
					break;
				}
			}
		}
		cout <<ansx<<" "<<ansy<<endl;
	}
	return 0;
}

Measured memory_bytes: 1316
import java.util.Scanner;

public class Main {

public static void main(String[] args) {
			Scanner sc = new Scanner(System.in);
			int a = sc.nextInt();
			int b = sc.nextInt();
			int c = sc.nextInt();
			int d = sc.nextInt();

			int left = a + b;
			int right = c + d;

			if (left > right) {
				System.out.println("Left");
			} else if (left == right) {
				System.out.println("Balanced");
			} else {
				System.out.println("Right");
			}

			sc.close();
		}
}

Measured memory_bytes: 22612
#include <iostream>
#include <string>

int main()
{
	std::string s;
	std::cin >> s;
	int nSum = 0;
	for (int i = 0;i < 3;i++) {
		if (s[i] == '1') {
			nSum += 1;
		}
		else {
			nSum += 0;
		}
	}
	std::cout << nSum << std::endl;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <iterator>
#include <functional>
#include <vector>
#include <math.h>
#include <typeinfo>
using namespace std;

int main(void) {
	
	int X, A, B;

	cin >> X >> A >> B;

	int tmp = X - A;
	
	cout << tmp % B << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.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)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define fi first
#define se second
#define INF 1000000009
#define LLINF 1000000000000000009LL
using ll = long long;

int main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  while(1){
    c-=b;
    if(c<=0){
      cout<<"Yes"<<endl;
      return(0);
    }
    a-=d;
    if(a<=0){
      cout<<"No"<<endl;
      return(0);
    }
  }
  return(0);
}


Measured memory_bytes: 3592
#include <iostream>
#include <string.h>
#include <stdio.h>
 
using namespace std;
const int N = 200005;
const double INF = 1e100;
 
int a[N][3];
int n;
 
int main()
{
    while(~scanf("%d",&n))
    {
        for(int i=0;i<n;i++)
           for(int j=0;j<2;j++)
               scanf("%d",&a[i][j]);
        int ans = 0,mi,mx,t;
        for(int s=1;s<(1<<2);s++)
        {
            mi = INF;
            mx = -INF;
            for(int i=0;i<n;i++)
            {
                t = 0;
                for(int j=0;j<2;j++)
                {
                    if((1<<j) & s) t += a[i][j];
                    else t -= a[i][j];
                }
                mi = min(mi,t);
                mx = max(mx,t);
            }
            ans = max(ans,mx-mi);
        }
        printf("%d\n",ans);
    }
    return 0;
}

Measured memory_bytes: 6168
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];

void cominit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long com(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    ll n, m;
    cin >> n >> m;

    if (m == 1) {
        cout << 1 << endl;
        return 0;
    }

    map<int, int> factor;
    int x = m;
    for (int i = 2; i * i <= x; i++) {
        while (m % i == 0) {
            factor[i]++;
            m /= i;
        }
    }
    if (m != 1) factor[m]++;

    ll ans = 1;
    cominit();
    for (auto i : factor) {
        ans *= com(i.second + n - 1, n - 1);
        ans %= MOD;
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 12160