akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define MAX 510000
#define rrep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define dcout cout<<fixed<<setprecision(15);
#define mp make_pair
#define pb push_back

using namespace std;
typedef long long int  ll;
typedef pair<ll, ll> P;

constexpr int MOD = 1e9 + 7;
constexpr ll inf = 1LL << 60;

template< typename S, typename T >
inline void chmax(S &a, const T &b) { if(a < b) a = b; }
 
template< typename S, typename T >
inline void chmin(S &a, const T &b) { if(a > b) a = b; }
 

//lcm//
ll gcd(ll x, ll y) {
	if (x == 0) return y;
	return gcd(y%x, x);
}
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }

//a^n mod p//
ll modpow(ll a, ll n, ll p) {
  if (n == 1) return a % p;
  if (n % 2 == 1) return (a * modpow(a, n - 1, p)) % p;
  ll t = modpow(a, n / 2, p);
  return (t * t) % p;
}

//inversemod//
ll modinv(ll a, ll m) {
	if(m==0)return (ll)1;
	ll b = m, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//Cmonp//
ll 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;
	}
}

// 
ll COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

//LARGE n
ll com(ll n,ll m){
    if(n<m || n<=0 ||m<0){
		return 0;
	}
	if( m==0 || n==m){
		return 1;
	}
	ll k=1;
	for(ll i=1;i<=m;i++){
       k*=(n-i+1); 
	   k%=MOD;
	   k*=modinv(i,MOD);
	   k%=MOD;
	}
	return k;
}

//radP
ll rad(ll u, ll p){
ll cnt=0;
	while(u%p==0){
		u/=p;
		cnt++;
	}
	return cnt;
}


////////////////////////////////////////////////////////////////////

int main() {
ll a,b;
cin>>a>>b;
cout<<a*b<<endl;
return 0;


}




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

using namespace std;
using ll = long long;

const int MOD = 1e9 + 7;
#define REP(i, n)  for(int i = 0; i < n; ++i)
#define FOR(i, t, n)  for(ll i = t; i <= (ll)n; ++i)
struct edge {
    int from, to;
    ll cost;
};


class Eratosthenes {
public:
    vector<bool> prime;

    Eratosthenes(int size) {
        prime.resize(size + 1, 1);
        prime[0] = 0;
        prime[1] = 0;
        FOR(i, 2, size) {
            if (prime[i]) {
                for (int j = 2 * i; j <= size; j += i) {
                    prime[j] = 0;
                }
            }
        }
    }

};


class Combination {
    vector<ll> fac; //n!(mod M)
    vector<ll> ifac; //k!^{M-2} (mod M)
public:
    Combination(ll size) {
        fac.resize(size);
        ifac.resize(size);
        fac[0] = 1;
        ifac[0] = 1;
        for (ll i = 0; i < size; i++) {
            fac[i + 1] = fac[i] * (i + 1) % MOD;
            ifac[i + 1] = ifac[i] * mpow(i + 1, MOD - 2) % MOD;
        }
    }

    ll mpow(ll x, ll n) {
        ll ans = 1;
        while (n != 0) {
            if (n & 1) ans = ans * x % MOD;
            x = x * x % MOD;
            n = n >> 1;
        }
        return ans;
    }

    ll comb(ll a, ll b) {
        if (a == 0 && b == 0)return 1;
        if (a < b || a < 0)return 0;
        ll tmp = ifac[a - b] * ifac[b] % MOD;
        return tmp * fac[a] % MOD;
    }
};


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

ll LCM(ll a, ll b) {
    ll gcd = GCD(a, b);
    return a / gcd * b;
}

ll N;

int main() {
    cin >> N;
    vector<ll> c(5);
    REP(i, N) {
        string s;
        cin >> s;
        if (s[0] == 'M')c[0]++;
        if (s[0] == 'A')c[1]++;
        if (s[0] == 'R')c[2]++;
        if (s[0] == 'C')c[3]++;
        if (s[0] == 'H')c[4]++;
    }
    ll res = 0;
    REP(i, 4) {
        FOR(j, i + 1, 4) {
            FOR(k, j + 1, 4) {
                res += c[i] * c[j] * c[k];
            }
        }
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    char c;
    cin>>c;
    if(c=='a'||c=='e'||c=='u'||c=='i'||c=='o'){
        cout<<"vowel"<<endl;
    }else{
        cout<<"consonant"<<endl;
    }
    
}


Measured memory_bytes: 256
package main

import (
    "fmt"
    "os"
    "bufio"
    "sort"
    "strconv"
    "math"
)

var (
    read = bufio.NewReader(os.Stdin)
    write = bufio.NewWriter(os.Stdout)
    sc = bufio.NewScanner(os.Stdin)
)

func main() {
    defer write.Flush()

    sc.Split(bufio.ScanWords)
    //var n int
    //fmt.Fscan(read, &n)

    n := nextInt()

    s := make(map[string]int)

    max := 0
    for i := 0; i < n; i++ {
        //var str string
        //fmt.Fscan(read, &str)
        str := nextStr()
        _, ok := s[str]
        if ok {
            s[str]++
        } else {
            s[str] = 1
        }
        if max < s[str] {
            max = s[str]
        }
    }

    var a []string
    for key := range s {
        a = append(a, key)
    }


    sort.Strings(a)

    for i := 0; i < len(a); i++ {
        if s[a[i]] == max {
            fmt.Printf("%s\n", a[i])
        }
    }

}



//===========================
//
// Library
//
//===========================

//====================
//  round(12.54, 0) -> 13.0
//  round(12.54, -1) -> 12.5
//====================

func round(num float64, digit uint) float64 {
    d := float64(digit)
    return float64(int(num * math.Pow(10, d) + 0.5)) / math.Pow(10, d)
}

func max(a, b int) int {
    return int(math.Max(float64(a), float64(b)));
}

func min(a, b int) int {
    return int(math.Min(float64(a), float64(b)));
}

func gcd(x, y int) int {
    if y == 0 {
        return x
    }

    return gcd(y, x%y)
}

//====================
//  var q Queue
//  q.Enqueue(n)
//  n := q.Dequeue()
//====================
type Queue struct {
    data []int
}

func (q *Queue) Enqueue(n int) {
    q.data = append(q.data, n)
}

func (q *Queue) Dequeue() int {
    tmp := q.data[0]
    q.data = q.data[1:]
    return tmp
}

// 数値を桁区切りのスライスにする
func digit(n int, list []int) []int {
   if n > 0 {
       return digit(n/10, append(list, n%10))
   }
   return list
}

func sortIntsRev(list []int) {
    sort.Sort(sort.Reverse(sort.IntSlice(list)))
}

func strReverse(s string) string {
    runes := []rune(s)
    for i := 0; i < len(s)/2; i++ {
        runes[i], runes[len(s)-1-i] = runes[len(s)-1-i], runes[i]
    }
    return string(runes)
}

func nextInt() int {
    sc.Scan()
    i, _ := strconv.Atoi(sc.Text())
    return i
}

func nextStr() string {
    sc.Scan()
    return sc.Text()
}



Measured memory_bytes: 30720
def height(level):
    hei = 1
    for i in range(level):
        hei = 3 + 2 * hei
    return hei

def patty(level):
    pat = 1
    for i in range(level):
        pat = 1 + 2 * pat
    return pat

def ans(level, under):
    if under == 1:
        if level == 0:
            return 1
        else:
            return 0
    elif under <= 1 + height(level - 1):
        return ans(level - 1, under - 1)
    elif under == 2 + height(level - 1):
        return 1 + patty(level - 1)
    elif under <= 2 + 2 * height(level - 1):
        return 1 + patty(level - 1) + ans(level - 1, under - 2 - height(level - 1))
    else:
        return 1 + 2 * patty(level - 1)
    
n, x = map(int, input().split())
print(ans(n, x))

        

Measured memory_bytes: 3064
h,w = map(int,input().split())
n = int(input())
a = [int(s) for s in input().split()]
ans = []

for x in range(n):
  for iter in range(a[x]):
    ans.append(str(x+1))

for y in range(h):
  inp = ans[w * y:w * (y+1)]
  if y % 2 == 0:
    inp.reverse()
  print(' '.join(inp))

Measured memory_bytes: 3700
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF = 1LL<<60;

ll GCD(ll x,ll y){
    if(y == 0) return x;
    else return GCD(y,x%y);
}

ll LCM(ll a,ll b){
    return a / GCD(a,b) * b;
}

const int MOD = 1000000007;



int main() {
    int n; cin >> n;
    string ans = "No";
    for(int i = 1;i <= 9;i++){
        for(int j = 1;j <= 9;j++){
            if(i * j == n) ans = "Yes";
        }
    }
    cout << ans;
}


Measured memory_bytes: 3580
import java.util.*;

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

		int n = sc.nextInt();
		int k = sc.nextInt();
		int s = sc.nextInt();

		if(s == 1e9){
			for(int i = 0 ; i < n ; i++){
				if(i < k){
					System.out.printf(""+s+" ");
				}else{
					System.out.printf(""+1+" ");
				}
			}
		}else{
			for(int i = 0 ; i < n ; i++){
				if(i < k){
					System.out.printf(""+s+" ");
				}else{
					System.out.printf(""+(int)1e9+" ");
				}
			}
		}

		System.out.println("");
	}

}

Measured memory_bytes: 50192
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(n); ++i)
#define repr(i, a, b) for (int i=a; i<(b); ++i)
#define reprev(i, n) for (int i=n-1; i>=0; --i)
#define reprrev(i, a, b) for (int i=b-1; i>=(a); --i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
    cout << fixed << setprecision(10);
    
    int X; cin >> X;

    set<ll> facts;
    facts.insert(0);
    repr(i, 1, 200) {
        facts.insert(pow(i, 5));
        facts.insert(-pow(i, 5));
    }

    for (auto i: facts) {
        if (facts.count(X + i)) {
            // cout << i << " " << X+i << endl;

            if (X + i < 0) {
                cout << -int(pow(-(X+i), 0.2)) << " ";
            } else {
                cout << int(pow((X+i), 0.2)) << " ";
            }

            if (i < 0) {
                cout << -int(pow(-i, 0.2)) << endl;
            } else {
                cout << int(pow(i, 0.2)) << endl;
            }
            // cout << int(pow(i, 0.2)) << " " << int(pow((X+i), 0.2)) << endl;
            return 0;
        } 
    }
    return 0;
}

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

bool bfs(const vector<vector<int>> &G, int s, vector<int> &d) {
  d[s] = 0;
  queue<int> q;
  q.push(s);
  while (!q.empty()) {
    int v = q.front();
    q.pop();
    for (int i = 0; i < G[v].size(); i++) {
      if (d[G[v][i]] == -1) {
        d[G[v][i]] = d[v] ^ 1;
        q.push(G[v][i]);
        continue;
      }
      else if (d[G[v][i]] == d[v]) return false;
    }
  }
  return true;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  while (true) {
    // 無向(有向)グラフの隣接リスト
    int n, m; // n:頂点数 m:辺数
    cin >> n >> m;
    if (n + m == 0) return 0;
    
    vector<vector<int>> G(n); // G:頂点数nのグラフの隣接リスト
    
    for (int i = 0; i < m; i++) {
      int u, v;
      cin >> u >> v;
      u--;
      v--;
      G[u].emplace_back(v);
      G[v].emplace_back(u); // 有向グラフではコメントアウト
    }
    
    vector<int> d(n, -1);
    if (!bfs(G, 0, d)) {
      cout << "0\n";
      continue;
    }
    
    int count_0 = 0, count_1 = 0;
    set<int> ans;
    for (int i = 0; i < n; i++) {
      if (d[i] == 0) count_0++;
      else count_1++;
    }
    if (count_0 % 2 == 0) ans.insert(count_0 / 2);
    if (count_1 % 2 == 0) ans.insert(count_1 / 2);
    
    if (ans.size() == 0) {
      cout << 0 << '\n';
    }
    else if (ans.size() == 1) {
      cout << 1 << '\n';
      cout << *ans.begin() << '\n';
    }
    else {
      cout << 2 << '\n';
      cout << *ans.begin() << '\n';
      cout << *ans.rbegin() << '\n';
    }
  }
}


Measured memory_bytes: 3180
read = input 
rn = lambda :list(map(int, read().split()))
n, m  = rn()
M = []
P = 1000000007
for i in range(m):
    M.append(int(read()))
M = set(M)
dp = [0 for i in range(n + 1000)]
dp[0] = 1
for i in range(n+1):
    for nxt in range(i+1, i+3):
        if(nxt not in M):
            dp[nxt] += dp[i]
            dp[nxt] %= P
print(dp[n])

Measured memory_bytes: 13216
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <complex>

using namespace std;

const double PI=3.14159265;

int main()
{
	int v[5];

	srand((unsigned)time(NULL));

	for(int i=0;i<5;i++) cin>>v[i];

	do{
		for(int i=0;i<5;i++) swap(v[i],v[rand()%5]);

	}while(!( (v[0]>=v[1])&&(v[1]>=v[2])&&(v[2]>=v[3])&&(v[3]>=v[4]) ));

	for(int i=0;i<4;i++) cout<<v[i]<<" ";
	cout<<v[4]<<endl;

	return 0;
}

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

#define ull unsigned long long int
#define ll long long int
#define pb push_back
#define MOD (ull)(double)(1e9 + 7)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pull pair<ull, ull>
#define m_p make_pair

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	ull n,a,b;
	cin >> n >> a >> b;
	
	if(a > b)swap(a, b);
	
	ull d = b - a;
	
	if(!(d%2)){
		cout << d / 2;
	}
	else{
		ull cnt=0;
		if(a-1 < n-b){
			cnt += (a-1);
			a = 1;
			b -= (a-1);
		}
		else{
			cnt += (n-b);
			b = n;
			a += (n-b);
		}
		
		cout << cnt + (d-1) / 2 + 1;
	}
}


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

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

	int ans = 1;
	rep(i, 0, n) {
		if (ans * 2 < ans + k) ans *= 2;
		else ans += k;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
import copy
N = int(input())
t = [int(x) for x in input().split()]
p = []
for _ in range(int(input())):
	p.append([int(x) for x in input().split()])

result = []
ori_t = copy.deepcopy(t)
for i in p:
	t = copy.deepcopy(ori_t)
	t[i[0]-1] = i[1]
	result.append(sum(t))

for i in result:
	print(i)

Measured memory_bytes: 3444
#include "bits/stdc++.h"
using namespace std;
using ll = long long;

int main() {
    int n, d, x;
    cin >> n >> d >> x;
    d--;
    for(int i = 0; i < n; ++i) {
        int b; cin >> b;
        x += d / b;
    }
    cout << x + n << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VRSORT(v) sort(v.rbegin(), v.rend());//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;

typedef tuple<ll, int, int> T;

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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  string a,b,c;
  cin>>n>>a>>b>>c;
  int ans=0;
  REP(i,n){
      int tmp1=0,tmp2=0,tmp3=0;
      if(a[i]!=b[i]){
          tmp1++;
          tmp2++;
      }
      if(a[i]!=c[i]){
          tmp1++;
          tmp3++;
      }
      if(b[i]!=c[i]){
          tmp2++;
          tmp3++;
      }
    ans+=min(tmp1,min(tmp2,tmp3));
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
import bisect

while True:
    max_S = 0
    p = [0]
    pp = []
    n, m = map(int, input().split())
    if n == 0 and m == 0:
        break

    for _ in range(n):
        p.append(int(input())) 

    # 最初にダーツ2本を投げた状態にする
    for i in range(n+1):
        for j in range(i, n+1):
            pp.append(p[i] + p[j])
    
    pp.sort()
    # t: ppの中でm以下の数字の位置
    t = bisect.bisect_left(pp, m)
    # h: ppの中でm/2以下の数字の位置
    h = bisect.bisect_left(pp, m//2, 0, t)

    if t < len(pp):
        if pp[t] == m:
            print(m)
            continue
        pp = pp[:t]
    max_S = 0

    for i in range(len(pp)):
        t = bisect.bisect_left(pp, m-pp[i])
        if pp[i] + pp[t-1] > max_S:
            max_S = pp[i] + pp[t-1]

    print(max_S)



Measured memory_bytes: 27840
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}
func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}
func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n := iScan()
	time := iScan()
	t := iSScan(n)
	ans := time
	for i := 0; i < n-1; i++ {
		ans += smaller(time, t[i+1]-t[i])
	}
	fmt.Println(ans)
}


Measured memory_bytes: 5836
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();String s1 = sc.next();char[] c1 = s1.toCharArray();String s2=sc.next();char[] c2=s2.toCharArray();
        char[] array = new char[2*n];int tmp1=0;int tmp2=0;
        for(int i=0;i<array.length;i+=2){
            array[i]=c1[tmp1];
            tmp1++;
        }
        for(int i=1;i<array.length;i+=2){
            array[i]=c2[tmp2];
            tmp2++;
        }
        for(int i=0;i<array.length;i++)
            System.out.print(array[i]);
        }
    }

Measured memory_bytes: 21716
import Data.Maybe
import Data.Array.IArray
import Data.Array.ST
import Control.Monad.ST

solve :: Array (Int,Int) Char -> Bool
solve a = notElem '#' . elems $ runSTArray $ thaw a >>= go (1,1)
  where
    (_,(bh,bw)) = bounds a
    cand (h,w) = [ p | p@(ph,pw) <- [(h+1,w), (h,w+1)]
                 , ph <= bh, pw <= bw, a!p == '#' ]
    next p = case cand p of
               []  -> Nothing
               [x] -> Just x
               _   -> Nothing
    go :: (Int,Int) -> STArray s (Int,Int) Char
          -> ST s (STArray s (Int,Int) Char)
    go p m = do
        writeArray m p '.'
        maybe (return m) (`go` m) $ next p

main :: IO ()
main = do
    [h,w] <- map read . words <$> getLine :: IO [Int]
    a <- listArray ((1,1),(h,w)) . concat . lines
         <$> getContents :: IO (Array (Int,Int) Char)
    putStrLn $ if solve a then "Possible" else "Impossible"

Measured memory_bytes: 508
import sys
sys.setrecursionlimit(10**7) #再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque
#deque(l), pop(), append(x), popleft(), appendleft(x)
##listでqueの代用をするとO(N)の計算量がかかってしまうので注意
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
import itertools#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone
#import fractions#古いatcoderコンテストの場合GCDなどはここからimportする
from functools import lru_cache#pypyでもうごく
#@lru_cache(maxsize = None)#maxsizeは保存するデータ数の最大値、2**nが最も高効率
from decimal import Decimal

def input(): 
    x=sys.stdin.readline()
    return x[:-1] if x[-1]=="\n" else x
def printl(li): _=print(*li, sep="\n") if li else None
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
#ABC145-E
def main():#s(str)以下の非負整数で条件をK桁満たすものの個数
    N=int(input())
    A=(0,3,5,7)
    ans=0
    for x in itertools.product(A, repeat=9):
        num=0
        for i,xi in enumerate(x):
            num+=10**i*xi
        sn=str(num)
        if num>N or "0" in sn:
            continue
        if "3" in sn and "5" in sn and "7" in sn:
            ans+=1
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 78880
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int[] a = new int[n];
		int[] b = new int[n];
		for(int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
			b[i] = sc.nextInt();
		}
		int[] c = new int[m];
		int[] d = new int[m];
		int diff;
		int[][] min = new int[2][n];
		for(int i = 0; i < m; i++) {
			c[i] = sc.nextInt();
			d[i] = sc.nextInt();
			for(int  j= 0; j < n; j++) {
				diff = Math.abs(a[j] - c[i]) + Math.abs(b[j] - d[i]);
				//System.out.println(diff);
				if(i==0) {
					min[1][j] = diff;
					min[0][j] = 1;
				}else if(min[1][j] > diff) {
					min[1][j] = diff;
					min[0][j] = i + 1;
				}
			}
		}
		for(int i = 0; i < n; i++) {
			System.out.println(min[0][i]);
		}
		
	}
}



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

int main()
{
    int i, N;
    int x = 0;
    cin >> N;
    string S = "YES";
    vector<int> A(N);
    for (i = 0; i < N; i++)
    {
        cin >> A.at(i);
    }
    sort(A.begin(), A.end());
    for (i = 0; i < N - 1; i++)
    {
        if (A.at(i) == A.at(i + 1))
        {
            S = "NO";
            x = 1;
            break;
        }
        if (x == 1)
        {
            break;
        }
    }
    cout << S << endl;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <string.h>

#define M 1046257
#define NIL (-1)
#define L 14

char H[M][L];

// 文字から数値に変換
int getChar(char ch) {
  if ( ch == 'A' ) return 1;
  else if ( ch == 'C' ) return 2;
  else if ( ch == 'G' ) return 3;
  else if ( ch == 'T' ) return 4;
  return 0;
}

// 文字列から数値へ変換して key を生成する
long long getKey(char str[]) {
  long long sum =0, p = 1, i;
  for(i=0;i<strlen(str);i++) {
    sum += p*(getChar(str[i]));
    p*= 5;
  }
  return sum;
}

int h1(int key){ return key % M; }
int h2(int key){ return 1 + (key % (M-1)); }

int find(char str[]) {
  long long key, i, h;
  key = getKey(str); // 文字列を数値に変換
  for(i=0; ;i++) {
    h = (h1(key) + i*h2(key)) %M;
    if( strcmp(H[h],str) == 0) return 1;
    else if ( strlen(H[h]) == 0 ) return 0;
  }
  return 0;
}

int insert(char str[]) {
  long long key, i, h;
  key = getKey(str); // 文字列を数値に変換
  for(i=0; ; i++) {
    h = (h1(key) + i * h2(key)) %M;
    if(strcmp(H[h],str) == 0) return 1;
    else if(strlen(H[h]) == 0) {
      strcpy(H[h],str);
      return 0;
    }
  }
  return 0;
}

int main(void) {
  int i, n;
  char str[L], com[9];
  for(i=0;i<M;i++) H[i][0] = '\0';
  scanf("%d",&n);
  for(i=0;i<n;i++) {
    scanf("%s %s",com,str); // より高速なscanfを使用
    if(com[0] == 'i') {
      insert(str);
    } else {
      if(find(str)){
        printf("yes\n");
      } else {
        printf("no\n");
      }
    }
  }
  return 0;
}


Measured memory_bytes: 16024
#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++)

int main() {
    int64_t N, K;
    cin >> N >> K;

    cout << min(N % K, abs((N % K) - K)) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int data[2];
	int i, j;
	
	while(1){
		scanf("%d %d", &data[0], &data[1]);
		if(data[0] == 0 && data[1] == 0){
			return 0;
		}
		
		for(i=0 ; i < data[0] ; i++){
			for(j=0 ; j < data[1] ; j++){
				if(i == 0 || i == data[0] - 1){
					printf("#");
				}
				else if(j == 0 || j == data[1] - 1){
					printf("#");
				}
				else{
					printf(".");
				}
			}
			printf("\n");
		}
		printf("\n");
	}
}

Measured memory_bytes: 572
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Scanner;

@SuppressWarnings("unchecked")
class MinCostFlow{
    class Edge{
        int to,cap,cost,rev;
        Edge(int to,int cap,int cost,int rev){this.to=to;this.cap=cap;this.cost=cost;this.rev=rev;}
    }
    List<Edge> edges[];
    void add_edge(int from,int to,int cap,int cost){
        edges[from].add(new Edge(to,cap,cost,edges[to].size()));
        edges[to].add(new Edge(from,0,-cost,edges[from].size()-1));
    }
    int[] dis;
    int[] h;
    int[] prevv;
    Edge[] preve;
    MinCostFlow(int V){
        edges = new ArrayList[V];
        dis =new int[V];
        h = new int[V];
        prevv=new int[V];
        preve=new Edge[V];
        for(int i=0;i<V;++i)edges[i]=new ArrayList<>();
    }

    int get(int s,int t,int f){
        int res = 0;
        class Node{
            int v,cost;
            Node(int v,int cost){this.v=v;this.cost=cost;}
        }
        Arrays.fill(h,0);
        while(f>0){
            Arrays.fill(dis, Integer.MAX_VALUE);
            dis[s]=0;
            PriorityQueue<Node> que = new PriorityQueue<>((a,b)->a.cost-b.cost);
            que.add(new Node(s,0));
            while(!que.isEmpty()){
                Node node = que.poll();
                if(dis[node.v]<node.cost)continue;
                for(Edge e : edges[node.v])if(dis[node.v]+e.cost + (h[e.to]-h[node.v]) <dis[e.to] && e.cap>0){
                    dis[e.to] = dis[node.v]+e.cost + (h[e.to]-h[node.v]);
                    prevv[e.to]=node.v;
                    preve[e.to]=e;
                    que.add(new Node(e.to, dis[e.to]));
                }
            }
            if(dis[t]==Integer.MAX_VALUE)return -1;
            for(int i=0;i<h.length;++i)h[i] -= dis[i];
            int d = f;

            for(int v=t;v!=s;v=prevv[v])d=Math.min(d, preve[v].cap);
            res += d * -h[t];
            f-=d;
            for(int v=t;v!=s;v=prevv[v]){
                preve[v].cap-=d;
                edges[v].get(preve[v].rev).cap+=d;
            }
        }
        return res;
    }

    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int V = scan.nextInt();
        int E = scan.nextInt();
        int F = scan.nextInt();
        MinCostFlow mcf = new MinCostFlow(V);
        while(E-->0){
            int u = scan.nextInt();
            int v = scan.nextInt();
            int c = scan.nextInt();
            int d = scan.nextInt();
            mcf.add_edge(u, v, c, d);
        }
        System.out.println(mcf.get(0,V-1,F));
    }
}

class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int V = scan.nextInt();
        int E = scan.nextInt();
        int F = scan.nextInt();
        MinCostFlow mcf = new MinCostFlow(V);
        while(E-->0){
            int u = scan.nextInt();
            int v = scan.nextInt();
            int c = scan.nextInt();
            int d = scan.nextInt();
            mcf.add_edge(u, v, c, d);
        }
        System.out.println(mcf.get(0,V-1,F));
    }
}


Measured memory_bytes: 38408
#include <bits/stdc++.h>
using namespace std;
using pii = pair<int,int>;

int solve() {
    int N, K, a, b;
    cin >> N >> K;
    vector<vector<int>> G(N);
    for ( int i = 0; i < N-1; i++ ) {
        cin >> a >> b;
        a--, b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    // v から距離 k-1, k 以内にある点の数
    function<pii(int,int,int)> dfs = [&](int v, int p, int k) {
        pii r;
        if ( k == 0 ) {
            r.second++;
        } else {
            r.first++;
            r.second++;
            for ( int u : G[v] ) {
                if ( u == p ) continue;
                auto x = dfs(u, v, k-1);
                r.first += x.first;
                r.second += x.second;
            }
        }
        return r;
    };

    int ans = 100000;
    if ( K % 2 == 0 ) {
        for ( int i = 0; i < N; i++ ) {
            pii x = dfs(i, -1, K / 2);
            ans = min(ans, N - x.second );
        }
    } else {
        for ( int i = 0; i < N; i++ ) {
            int s = 1, md = 0;
            for ( int j : G[i] ) {
                auto x = dfs(j, i, (K-1)/2 );
                s += x.first;
                md = max(md, x.second - x.first);
            }
            s += md;
            ans = min(ans, N - s );
        }
    }
    return ans;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 512
using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {

            string[] s = Console.ReadLine().Split(' ');
            int a = int.Parse(s[0]);
            for (int i = 1; i <= a; i++)
            {
                int x = i;
                if (x % 3 == 0)
                {
                    Console.Write(" " + i);
                    continue;
                }
                for (; x != 0; x /= 10)
                {
                    if (x % 10 == 3)
                    {
                        Console.Write(" " + i);
                        break;
                    }
                }
            }
            Console.WriteLine("");
        }
    }
}

Measured memory_bytes: 9284
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define FOR(i,k,n) for(int(i)=(k);(i)<(n);++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v),end(v)
#define debug(x) std::cerr<<#x<<": "<<x<<"\n"
#define debug2(x,y) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<"\n"
#define debug3(x,y,z) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<", "<<#z<<": "<<z<<"\n"

using ll=long long;
using vi=std::vector<int>;
using vvi=std::vector<vi>;
using vll=std::vector<ll>;
using vvll=std::vector<vll>;
template<typename T> using vvec=std::vector<std::vector<T>>;
template<typename T>
auto make_v(size_t sz){return std::vector<T>(sz);}
template<typename T,typename... Ts>
auto make_v(size_t sz,Ts...ts){return std::vector<decltype(make_v<T>(ts...))>(sz,make_v<T>(ts...));}
template<typename T>
void fill_v(T&var,const T&x){var=x;}
template<typename V,typename T>
void fill_v(V&v,const T&x){for(auto&& w:v){fill_v(w,x);}}

template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<std::vector<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<std::deque<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s, const std::set<T>&v){
  s<<"\n";for(auto&& elm:v){s<<elm<<"\t";}s<<"\n";return s;}

inline void scan(int&a){scanf("%d",&a);}
inline void scan(ll&a){scanf("%lld",&a);}
inline void scan(char&a){scanf(" %c",&a);}
inline void scan(double&a){scanf("%lf",&a);}
inline void scan(std::string&s){char BUF[3000000];scanf(" %s",BUF);s=std::string(BUF);}
template<typename T>
inline void scan(std::vector<T>&v){for(auto&& sv:v){scan(sv);}}
template<typename First,typename...Args>
inline void scan(First&f,Args&...args){scan(f);scan(args...);}
inline void print(int a){printf("%d\n",a);}
inline void print(ll a){printf("%lld\n",a);}
inline void print(double a){printf("%.12f\n",a);}
inline void print(std::string s){std::cout<<s<<"\n";}

using namespace std;

int main() {
  int n;
  scan(n);
  vll s(n);
  scan(s);
  ll ans = 0;
  FOR (d, 1, n/2) {
    ll sum = 0;
    for (int i = 1; d < n-1 - i*d; ++i) {
      if (i*d == n-1 - i*d) { break; }
      sum += s[i*d];
      sum += s[n-1 - i*d];
      ans = max(ans, sum);
      if (i*d + d == n-1 - i*d) { break; }
    }
  }
  print(ans);

  return 0;
}


Measured memory_bytes: 1024
A, B, C, D = map(int, input().split())

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def ans(x):
    return x - (x // C + x // D - x // (C * D // gcd(C, D)))

print(ans(B) - ans(A - 1))

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long int lld;
typedef pair<int,int> P;
typedef pair<lld,P> Pi;

int n;
int m[111];
Pi T[222];

bool solve(){
  int M = 0;
  for(int i=0;i<n*2;i++){
    if(T[i].second.second == 1) M += m[T[i].second.first];
    else M -= m[T[i].second.first];
    if(i!=n*2-1&&T[i].first != T[i+1].first) {
      if(M > 150) {
	return false;
      }
    }
  }
  return true;
}

int main(){
  while(cin >> n , n){
    for(int i=0;i<n;i++){
      cin >> m[i] >> T[i*2].first >> T[i*2+1].first;
      T[i*2].second.first = i;
      T[i*2+1].second.first = i;
      T[i*2].second.second = 1;
      T[i*2+1].second.second = 2;
    }
    sort(T,T+n*2);
    if(solve()) cout << "OK" << endl;
    else cout << "NG" << endl;
  } 
}

Measured memory_bytes: 3076
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
int main(void){
    // Your code here!
    char a,b;
    cin >> a >> b;
    if(a - b > 0){
        cout << ">" << endl;
    }
    else if(a == b){
        cout << "=" << endl;
    }
    else{
        cout << "<" << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(v,n) for(int i=0;i<n;i++){cin >> v.at(i);} //配列vにn個の要素を入力する


int main(){
    ll n,m;
    cin >> n >> m;
    ll ans;
    if(m<=n*2){ans = m/2;}else{ans = (m-n*2)/4+n;}
    cout << ans;
}

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

const char nl = '\n';

void solve()
{
    int d; cin >> d;
    vector<int> c;
    for (int i = 0; i < 26; ++i) {
        int val; cin >> val;
        c.push_back(val);
    }
    for (int i = 0; i < d; ++i) {
        map<int, int, greater<int>> m;
        for (int j = 0; j < 26; ++j) {
            int val; cin >> val;
            m[val / max(c[j], 1)] = j + 1;
        }
        cout << m.begin()->second << nl;
    }
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    solve();
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

#define CHMIN(a, b) a=min((a), (b))
#define CHMAX(a, b) a=max((a), (b))

const ll MOD=1000000007ll;
// const ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int y[114514];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, m, x[114514];
	cin>>n>>m;
	REP(i, m){
		cin>>x[i];
	}
	if(n>=m){
		cout<<0<<'\n';
		return 0;
	}
	sort(x, x+m);
	REP(i, m-1){
		y[i]=x[i+1]-x[i];
	}
	sort(y, y+m-1);
	int ans=0;
	REP(i, m-n){
		ans+=y[i];
	}
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<limits>
#include<iomanip>
#include<string>

using namespace std;
 
int main(void) {
  long long int a[3];
  cin >> a[0] >> a[1] >> a[2];
  sort(a, a+3);

  if(a[0]==a[1] && a[0] != a[2]) cout << "Yes" << endl;
  else if(a[1]==a[2] && a[0]!=a[1]) cout << "Yes" << endl;
  else cout << "No" << endl;
}


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

int main(void) {
	int A1,B1,H,M;
	scanf("%d %d %d %d",&A1,&B1,&H,&M);
	double A = (double)A1,B = (double)B1;//時針がAcm,分針がBcm
	double a,b;//aが時針の角度(rad),bが分針の角度(rad)
	a = ((double)H*60 + (double)M) * M_PI /360;
	b = (double)M * M_PI / 30;
	double c;
	if(a == b){
		printf("%.20f\n",fabs(B-A));
	}else if(b > a){
		double gumma = b-a;
		c = pow(A,2.0) + pow(B,2.0) - 2.0*A*B*cos(gumma);
		printf("%.20f\n",sqrt(c));
	}else{
		double gumma = a-b;
		c = pow(A,2.0) + pow(B,2.0) - 2.0*A*B*cos(gumma);
		printf("%.20f\n",sqrt(c));
	}
	return 0;
}

Measured memory_bytes: 2560
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0;i < (int)(n);i++)
using ll = long long;
const ll MOD=1000000007;
const long long INF = 1LL << 60;
const double pi=acos(-1.0);

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; }

ll N;
vector<ll> a;

//dp
vector<vector<bool>> checked;
vector<vector<ll>> table;

ll dp(ll i,ll j){
  if(i==j) return 0;
  if(checked.at(i).at(j)) return table.at(i).at(j);
  
  checked.at(i).at(j)=true;
  if((N-(j-i))%2==0){
    table.at(i).at(j)=-INF;
    chmax(table.at(i).at(j),dp(i+1,j)+a.at(i));
    chmax(table.at(i).at(j),dp(i,j-1)+a.at(j-1));
  }
  else{
    table.at(i).at(j)=INF;
    chmin(table.at(i).at(j),dp(i+1,j)-a.at(i));
    chmin(table.at(i).at(j),dp(i,j-1)-a.at(j-1));
  }
  
  return table.at(i).at(j);
}

int main()
{
  cin>>N;
  a=vector<ll>(N); rep(i,N) cin>>a.at(i);
  
  //dp
  checked=vector<vector<bool>>(N+1,vector<bool>(N+1,false));
  table=vector<vector<ll>>(N+1,vector<ll>(N+1));
  
  cout<<dp(0,N)<<endl;
  return 0;
}

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

    divisors.sort(reverse=True)
    return divisors


N = int(input())
A = sorted([int(x) for x in input().split()])

ans = 1
for i in range(2):
    div_list = make_divisors(A[i])

    for div_i in div_list:
        wrong_count = 0

        for A_i in A:
            if A_i % div_i != 0:
                wrong_count += 1

        if wrong_count <= 1 and div_i > ans:
            ans = div_i

print(ans)


Measured memory_bytes: 14052
#include <algorithm>
#include <array>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;

int main() {
    int X, Y, A, B, C;
    cin >> X >> Y >> A >> B >> C;
    int XX = X;
    int YY = Y;
    vector<int> VA(A);
    vector<int> VB(B);
    vector<int> VC(C);
    rep(i, A)
        cin >> VA[i];
    rep(i, B)
        cin >> VB[i];
    rep(i, C)
        cin >> VC[i];
    
    sort(VA.rbegin(), VA.rend());
    sort(VB.rbegin(), VB.rend());
    sort(VC.rbegin(), VC.rend());

    X -= 1;
    Y -= 1;
    int idx_c = 0;
    while(idx_c < C) {
        bool flag_a = VA[X] < VC[idx_c];
        bool flag_b = VB[Y] < VC[idx_c];
        if( !(flag_a || flag_b) )
            break;

        if(VA[X] <= VB[Y]) {
            VA[X] = VC[idx_c++];
            if(X > 0) X--;
        } else {
            VB[Y] = VC[idx_c++];
            if(Y > 0) Y--;
        }
    }
//        } else if (Y != 0 && VB[Y] <= VA[X]) {
    long long ret = 0;
    for(int i=0; i < XX; ++i) {
        ret += VA[i];
    }
    for(int i=0; i < YY; ++i) {
        ret += VB[i];
    }
    cout << ret << endl;
    return 0;
}


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

int main() {
  int a,b;
  cin>>a>>b;
  int c=b;
  int d=0;
  while(b>0){
    b=b/10;
    d++;
  }
  for(int i=0;i<d;i++){
    a=a*10;
  }
  for(long  i=0;i<1000;i++){
    if(i*i==c+a){
      cout<<"Yes"<< endl;
      return 0;
    }
  }
  cout<<"No"<< endl;
}




Measured memory_bytes: 256
use proconio::input;
use proconio::marker::Chars;

fn main() {
    input! {
        h: usize,
        w: usize,
        _: usize,
        s: [Chars; h],
    };
    let mut i = 1;
    let mut d = vec![vec![0; w]; h];
    let mut done = vec![false; h];
    for r in 0..h {
        let mut first = true;
        for c in 0..w {
            if s[r][c] == '#' {
                if first {
                    first = false;
                } else {
                    i += 1;
                }
            }
            d[r][c] = i;
        }
        if !first {
            i += 1;
            done[r] = true;
        }
    }
    let mut first = true;
    let mut skip = 0;
    let mut o = 0;
    for r in 0..h {
        if first {
            if done[r] {
                first = false;
                o = r;
            } else {
                skip += 1;
            }
        } else {
            if done[r] {
                o = r;
            } else {
                for c in 0..w {
                    d[r][c] = d[o][c];
                }
                done[r] = true;
            }
        }
    }
    for r in (0..skip).rev() {
        for c in 0..w {
            d[r][c] = d[skip][c];
        }
    }
    for r in 0..h {
        for c in 0..w {
            print!("{}{}", d[r][c], if c == w - 1 { "\n" } else { " " });
        }
    }
}


Measured memory_bytes: 2996
#include <stdio.h>
int a[100][100],b[100];
int main(void){
    int i,j,k,m,n;
    scanf("%d%d",&n,&m);
    for(i=0;i<n;i++){
        for(j=0;j<m;j++){
            scanf("%d",&a[i][j]);
        }
    }
    for(k=0;k<m;k++){
        scanf("%d",&b[k]);
    }
    for(i=0;i<n;i++){
        int c=0;
        for(j=0;j<m;j++){
            c+=a[i][j]*b[j];
        }
        printf("%d\n",c);
    }
    return 0;
}


Measured memory_bytes: 2736
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
from heapq import heapify, heappop, heappush
import math
import random
import string
from copy import deepcopy
from itertools import combinations, permutations, product
from operator import mul, itemgetter
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

#############
# Main Code #
#############

A, B = getNM()
que = []
heapify(que)
heappush(que, -A)
heappush(que, -B)

ans = 0
for i in range(2):
    u = heappop(que)
    ans += -u
    heappush(que, u + 1)
print(ans)

Measured memory_bytes: 83532
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <climits>
#include <ctime>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <set>
#include <map>
#include <iostream>
#include <deque>
#include <complex>
#include <string>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <valarray>
#include <unordered_map>
#include <iterator>
#include <functional>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef unsigned int uint;
typedef unsigned char uchar;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();i++)
#define ALL(container) (container).begin(), (container).end()
#define RALL(container) (container).rbegin(), (container).rend()
#define SZ(container) ((int)container.size())
#define mp(a,b) make_pair(a, b)
#define pb push_back
#define eb emplace_back
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

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 (a>b) { a=b; return 1; } return 0; }
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"["; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"]"; return os;
}
template<class T> ostream& operator<<(ostream &os, const set<T> &t) {
os<<"{"; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class S, class T> pair<S,T> operator+(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first+t.first, s.second+t.second);}
template<class S, class T> pair<S,T> operator-(const pair<S,T> &s, const pair<S,T> &t){ return pair<S,T>(s.first-t.first, s.second-t.second);}

const int INF = 1<<28;
const double EPS = 1e-8;
const int MOD = 1000000007;

int n;

int main(int argc, char *argv[]){
	ios::sync_with_stdio(false);
	vector<pair<int, double>> ans(2, mp(-1, .0));
	cin >> n;
	int pt = -1;
	int pf = 0;
	int pa = 0, px, py;
	REP(i, n){
		int f, a, t, x, y;
		cin >> f >> a >> t >> x >> y;
		if(pt == t && pa != a){
			ans[t] = max(ans[t], mp((x-px)*(x-px)+(y-py)*(y-py), (pf-f)/60.0));
		}
		pt = t;
		pf = f;
		pa = a;
		px = x;
		py = y;
	}
	REP(i, 2){
		if(ans[i].first < 0) printf("-1 -1\n");
		else printf("%.11f %.11f\n", sqrt(ans[i].first), -ans[i].second);
	}
	return 0;
}

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

#define F first
#define S second 
#define mp make_pair
#define pb push_back
#define pf push_front
#define speed_up ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define sz(x) (int)x.size()
#define szc(x) (int)strlen(x)
#define all(x) x.begin(), x.end()
#define debug cerr << "OK\n";
#define ub upper_bound
#define lb lower_bound 
#define y1 y_1
#define x1 y_2
 
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef set <int> si;
typedef set <ll> sll;
typedef multiset <int> msi;
typedef multiset <ll> msll;
typedef map <int, int> mi;
typedef map <ll, int> mll;
 
const int N = 2e5 + 20;
const int M = 1e6 + 2;
const int mod = 1e9 + 7;
const int inf = 2e9 + 3;
const ll INF = 1e16;

void data() {
	#ifdef PC
		freopen("main.in", "r", stdin);
		freopen("main.out", "w", stdout);
	#endif
}

/*
	BIN POISK EBANA V ROT
	DP EBANA V ROT
	DO EBANA V ROT
*/

int n, m, u[N], ans;
vi g[N];

int dfs(int v) {
	u[v] = 1;
	int sz = 1;
	for (auto to : g[v])
		if (!u[to])
			sz += dfs(to);
	return sz;
}

int main() {
	data();
	cin >> n >> m;
	while (m--) {
		int a, b;
		cin >> a >> b;
		g[a].pb(b);
		g[b].pb(a);
	}
	for (int i = 1; i <= n; ++i)
		if (!u[i])
			ans = max(ans, dfs(i));
	cout << ans;
}

Measured memory_bytes: 24724