akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
using namespace std;

template <typename Tp> inline void getint(Tp &num){
	register int ch, neg = 0;
	while(!isdigit(ch = getchar())) if(ch == '-') neg = 1;
	num = ch & 15;
	while(isdigit(ch = getchar())) num = num * 10 + (ch & 15);
	if(neg) num = -num;
}

int deg[5];

int main(){
	for(register int i = 1; i <= 3; i++){
		int u, v; getint(u), getint(v);
		deg[u]++, deg[v]++;
	}
	for(register int i = 1; i <= 4; i++)
		if(deg[i] != 1 && deg[i] != 2) return puts("NO"), 0;
	return puts("YES"), 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
input:
6 9
0 1 1
0 2 3
1 2 1
1 3 7
2 4 1
1 4 3
3 4 1
3 5 1
4 5 6

output:
5
"""

import sys
import heapq as hp

WHITE, GRAY, BLACK = 0, 1, 2


def generate_adj_table(v_table):
    for each in v_table:
        v_from, v_to, edge_weight = map(int, each)
        init_adj_table[v_from][v_to] = edge_weight
        init_adj_table[v_to][v_from] = edge_weight

    return init_adj_table


def prim_span_tree():
    distance[init_v] = 0
    parent[init_v] = -1
    path_heap = []
    hp.heappush(path_heap, (distance[init_v], init_v))

    while len(path_heap) >= 1:
        current_vertex = hp.heappop(path_heap)[1]

        color[current_vertex] = BLACK

        for adj_vertex, adj_weight in adj_table[current_vertex].items():
            if color[adj_vertex] is not BLACK:
                if adj_weight < distance[adj_vertex]:
                    distance[adj_vertex] = adj_weight
                    parent[adj_vertex] = current_vertex
                    color[adj_vertex] = GRAY
                    hp.heappush(path_heap, (adj_weight, adj_vertex))

    return distance


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    vertices, edges = map(int, _input[0].split())
    v_info = map(lambda x: x.split(), _input[1:])

    parent = [-1] * vertices
    distance = [float('inf')] * vertices
    color = [WHITE] * vertices
    init_v = 0

    init_adj_table = tuple(dict() for _ in range(vertices))
    adj_table = generate_adj_table(v_info)
    print(sum(prim_span_tree()))

Measured memory_bytes: 38904
a, b, c, d = map(int, input().split())
if a <= 0 <= b:
    if c <= 0 <= d:
        print(max(a * c, b * d))
    elif c <= d <= 0:
        print(max(a * c, 0))
    else:
        print(b * d)
elif a <= b <= 0:
    if c <= 0 <= d:
        print(a * c)
    elif c <= d <= 0:
        print(a * c)
    else:
        print(b * c)
else:
    if c <= 0 <= d:
        print(b * d)
    elif c <= d <= 0:
        print(a * d)
    else:
        print(b * d)

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

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

  vector<int> l(n);
  for (auto &i : l) cin >> i;

  sort(l.begin(), l.end(), greater<int>());

  int ans = 0;
  for (int i = 0; i < k; ++i) ans += l[i];

  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>

using namespace std;

typedef long long ll;
 
int main(){
    int n;
 
    cin >> n;
    ll a[n];
    for(int i = 0 ; i < n ; i++){
	cin >> a[i];
    }
    sort(a,a+n);
 
    ll ans = 1;
    for(int i = 0 ; i < n ; i++){
	if(a[i] > ans) break;
	else ans += a[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3192
import java.util.Arrays;

public class Main {

  private static void solve() {
    int a = ni();
    int b = ni();
    int c = ni();
    int d = ni();

    int n = c - a;
    int m = d - b;

    long[][] dp = new long[n + 1][m + 1];
    dp[0][0] = 1;
    int mod = 998244353;

    for (int i = 0; i <= n; i++) {
      for (int j = 0; j <= m; j++) {
        if (i == 0 && j == 0)
          continue;
        int h = i + a;
        int w = j + b;
        if (i > 0)
          dp[i][j] += dp[i - 1][j] * w % mod;
        if (j > 0)
          dp[i][j] += dp[i][j - 1] * h % mod;

        if (i > 0 && j > 0)
          dp[i][j] += mod - dp[i - 1][j - 1] * (h - 1) % mod * (w - 1) % mod;
        dp[i][j] %= mod;
      }
    }
    System.out.println(dp[n][m]);

  }

  public static void main(String[] args) {
    new Thread(null, new Runnable() {
      @Override
      public void run() {
        long start = System.currentTimeMillis();
        String debug = args.length > 0 ? args[0] : null;
        if (debug != null) {
          try {
            is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
          } catch (Exception e) {
            throw new RuntimeException(e);
          }
        }
        reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
        solve();
        out.flush();
        tr((System.currentTimeMillis() - start) + "ms");
      }
    }, "", 64000000).start();
  }

  private static java.io.InputStream is = System.in;
  private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
  private static java.util.StringTokenizer tokenizer = null;
  private static java.io.BufferedReader reader;

  public static String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }

  private static double nd() {
    return Double.parseDouble(next());
  }

  private static long nl() {
    return Long.parseLong(next());
  }

  private static int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = ni();
    return a;
  }

  private static char[] ns() {
    return next().toCharArray();
  }

  private static long[] nal(int n) {
    long[] a = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = nl();
    return a;
  }

  private static int[][] ntable(int n, int m) {
    int[][] table = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[i][j] = ni();
      }
    }
    return table;
  }

  private static int[][] nlist(int n, int m) {
    int[][] table = new int[m][n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        table[j][i] = ni();
      }
    }
    return table;
  }

  private static int ni() {
    return Integer.parseInt(next());
  }

  private static void tr(Object... o) {
    if (is != System.in)
      System.out.println(java.util.Arrays.deepToString(o));
  }
}


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

int main(){
  int N;
  cin>>N;
  vector<int>a(N);
  for(int i=0; i<N; i++){
   cin>>a[i];  }
  
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  
  int Alice=0, Bob=0;
  for(int i=0; i<N; i+=2){
   Alice+=a[i];
   Bob+=a[i+1]; 
  }
  cout<<Alice-Bob;
  
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <set>
#include <vector>
#include <map>
#include <list>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
int main(void) {
    int i;
    vector<int> a;
    for(i=0; i<3; i++) {
        int tmp;
        cin >> tmp;
        a.push_back(tmp);
    }
    sort(a.begin(), a.end());
    int cnt=0;
    for(i=0; i<2; i++) {
        while(a[i]+2<=a[2]) {
            a[i]+=2;
            cnt++;
        }
    }
    
    if(a[0]==a[1]&&a[1]==a[2]);
    else if(a[0]==a[1])
        cnt++;
    else if(a[0]==a[2] || a[1]==a[2])
        cnt+=2;
    cout << cnt << endl;
}


Measured memory_bytes: 632
#include <iostream>
#include <algorithm>
#include <vector>
typedef int TInt;
typedef std::vector<TInt> TList;

TList Input()
{
    int Count;
    std::cin >> Count;
    TList List(Count);
    for(int i = 0; i < Count; ++i){
        std::cin >> List[i];
    }
    return List;
}
int insertionSort(TList& A, int g)
{
    int cnt = 0;
    for(int i = g; i < A.size(); ++i){
        TInt v = A[i];
        int j = i - g;
        while(j >= 0 && A[j] > v){
            A[j+g] = A[j];
            j = j - g;
            cnt++;
        }
        A[j+g] = v;
    }
    return cnt;
}
void Reverse(TList& List)
{
    TList R;
    for(TList::reverse_iterator It = List.rbegin();
        It != List.rend();
        ++It)
    {
        R.push_back(*It);
    }
    std::swap(R, List);
}
TList GetG(int Max)
{
    TList G;
    int h = 1;
    while(h <= Max){
        G.push_back(h);
        h *= 2;
    }
    std::reverse(G.begin(), G.end());
    return G;
    // TList G;
    // int h = 1;
    // while(h <= Max){
    //     G.push_back(h);
    //     h = 3 * h + 1;
    // }
    // // Reverse(G);
    // std::reverse(G.begin(), G.end());
    // return G;
}
int shellSort(TList& A, const TList& G)
{
    int cnt = 0;
    for(TList::const_iterator It = G.begin();
        It != G.end();
        ++It){
        cnt += insertionSort(A, *It);
    }
    return cnt;
}
void OutputLine(const TList& List)
{
    TList::const_iterator It = List.begin();
    std::cout << *(It++);
    for(; It != List.end(); ++It){
        std::cout << " " << *It;
    }
    std::cout << std::endl;
}
void Output(const TList& List)
{
    TList::const_iterator It = List.begin();
    // std::cout << *(It++);
    for(; It != List.end(); ++It){
        std::cout << *It << std::endl;
    }
}
int main()
{
    TList A = Input();
    TList G = GetG(A.size());
    int cnt = shellSort(A, G);
    std::cout << G.size() << std::endl;
    OutputLine(G);
    std::cout << cnt << std::endl;
    Output(A);
    return 0;   
}

Measured memory_bytes: 6680
import std.stdio : writeln;

void main() {
    import std.algorithm : sort;
    
    dchar[] s,t;
    scan(s);
    scan(t);

    s.sort();
    t.sort!"a > b"();

    writeln(s < t ? "Yes" : "No");
}




void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.array : split;
    import std.conv  : to;
    import std.range.primitives;

    string[] line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define uniq(v) v.erase(unique(v.begin(),v.end()),v.end())
#define lb(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define ub(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
using Pair = pair<ll,pair<int,int>>;
#define pq priority_queue<Pair, vector<Pair>, greater<Pair>> 
const ll mod=1000000007;
//const ll mod=998244353;
const ld pi=acos(-1.0);
const ll INF = 1LL<<61;
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; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる



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

  string s;
  cin>>s;
  int n=s.size();

  repo(i,n){
    if(s[i]==s[i-1]){
      cout << i << " " << i+1 << endl;
      return 0;
    }
  }

  for(int i=2;i<n;i++){
    if(s[i]==s[i-2]){
      cout << i-1 << " " << i+1 << endl;
      return 0;
    }
  }

  cout << "-1 -1" << endl;
}

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

int main() {
    int H, W;
    cin >> H >> W;
    vector <string> C(H);
    for (int i = 0; i < H; i++){
        cin >> C[i];
    }
    for (int i = 0; i < H; i++){
        cout << C[i] << endl;
        cout << C[i] << endl;
    }
    return 0;  
}

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#define maxn 100005
using namespace std;
int n;
int a[maxn],b[maxn],c[maxn];
int main()
{
	int i;
	scanf("%d",&n);
	for (i=1;i<=n;i++) scanf("%d",&a[i]);
	for (i=1;i<=n;i++) scanf("%d",&b[i]);
	for (i=1;i<=n;i++) scanf("%d",&c[i]);
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	sort(c+1,c+n+1);
	i=0;
	int j=1,k=0;
	long long ans=0;
	while(j<=n){
		while(a[i+1]<b[j]&&i+1<=n)i++;
		while(k+1<=n&&b[j]>=c[k+1])k++;
		if (b[j]>c[n]) break;
		ans=ans+(long long)i*(n-k);
		//printf("%d %d %d %lld\n",i,j,n-k,ans);
		j++;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N=1e5+5;

int32_t main()
{
    IOS;
    int n;
    cin>>n;
    int flag=0;
    int cur;
    cin>>cur;
    int ans=0;
    for(int i=1;i<n;i++)
    {
    	int a;
    	cin>>a;
    	if(cur!=a)
    		cur=a;
    	else 
    	{
    		ans++;
    		cur=0;
    	}
    }
    cout<<ans;

    return 0;
} 




Measured memory_bytes: 256
#include <iostream>

using namespace std;

int N;
long long A[200000];

void fun(long long nowLeft, long long sum, int start, int end, int *RightStart, long long *leftsum, long long *rightsum) {
	long long s = nowLeft;
	int Rstart = start+1;

	for (int i=start; i<=end; i++) {
		if (s > sum/2) {
			long long b1 = s - (sum - s);
			long long b2 = (sum - (s-A[i-1])) - (s-A[i-1]);
			Rstart = (b1 <= b2) ? i : i-1;
			if (Rstart < start) {
				Rstart = start;
			}
			break;
		}
		s += A[i];
	}


	if (Rstart > end-1) Rstart = end-1;
	*RightStart = Rstart;
	*leftsum = nowLeft;
	for (int i = start; i < Rstart; i++) {
		*leftsum += A[i];
	}
	*rightsum = sum - *leftsum;
}

long long absdiff(long long a, long long b) {
	if (a > b) return a - b;
	else return b -a ;
}

int main(){
	cin >> N;
	for (int i=0; i<N; i++) {
		cin >> A[i];
	}
	int Pstart = 0;
	int Qstart, Rstart, Sstart;
	long long P,Q,R,S;
	long long ans = -1;
	long long allsum = 0;
	for (int i = 0; i < N; i++) allsum += A[i];

	P = A[0];
	Q = A[1];
	R = A[2];
	S = allsum - A[0] - A[1] - A[2];
	Qstart = 1;
	Sstart = 3;
	long long leftsum = P + Q;
	long long rightsum = R + S;
	for (Rstart = 2; Rstart <= N-2; Rstart++) {
		if (Rstart == Sstart) {Sstart += 1; S -= A[Rstart];}
		fun(P, leftsum, Qstart, Rstart,  &Qstart, &P, &Q);
		fun(rightsum - S, rightsum, Sstart, N,  &Sstart, &R, &S);
		leftsum += A[Rstart];
		rightsum -= A[Rstart];

		long long max = -1;
		long long min = -1;

		if (max == -1 || max < P) max = P;
		if (min == -1 || min > P) min = P;

		
		if (max == -1 || max < Q) max = Q;
		if (min == -1 || min > Q) min = Q;

		if (max == -1 || max < R) max = R;
		if (min == -1 || min > R) min = R;

		if (max == -1 || max < S) max = S;
		if (min == -1 || min > S) min = S;
	
		//cout << Qstart << ":" <<  Rstart <<  ":" << Sstart << ":" << max - min << endl;
		if (ans == -1 || ans > max-min) ans = max-min;
	}

	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;
int mod = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0 ,-1};
signed main(){
    int N;
    cin >> N;
    vector<int>A(N);
    for(int i = 0; i < N; i++) {
        cin >> A[i];
    }
    int cnt = 1;
    int ans = 0;
    for(int i = 0; i < 60; i++) {
        int X = 0,Y = 0;
        for(int j = 0; j < N; j++) {
            if(1 & (A[j] >> i)) {
                X++;
            }
            else {
                Y++;
            }
        }
        ans+=X*Y%INF*cnt%INF;
        cnt = cnt*2%INF;
        ans%=INF;
    }
    cout << ans << endl;
}

Measured memory_bytes: 5628
#include <iostream>
#include <fstream>
#include <fstream>
#include <vector>
#include <cmath>
#include <limits>


using namespace std;

//4^n

void chmin(int &a,int b){if(a > b)a = b;}

int A,B,C,N;
vector <int> L;

int rec(int i,int a,int b,int c)
{
    //終端処理
    if(i == N)
    {
        
        //ofstream ofs("output.txt", ios::app);
        //ofs << a << " " << b << " " << c << endl;
        //ofs.close();
        
        //出力
        if(!a || !b || !c)
        {
            //a,b,cのいずれかに竹を使用していない場合は無効
            //return numeric_limits<int>::max();// 負の値になる
            return 10000000;
        }
        else
        {
            //竹と竹を合成した後の、足すか引いたMPを取得
            return (abs(a-A) + abs(b-B) + abs(c-C));
        }
    }

    //再帰で全探索

    //L[i] = 対象の竹

    //竹を使わない
    int res = rec(i+1 ,a,b,c);

    //(a ? 10 : 0)→合成にはMP10, 最初の追加は0
    //Aに使う
    chmin(res, rec(i+1, a+L[i],b,c) + (a ? 10 : 0));
    chmin(res, rec(i+1, a,b+L[i],c) + (b ? 10 : 0));
    chmin(res, rec(i+1, a,b,c+L[i]) + (c ? 10 : 0));

    return res;
}

int main(){
    int res;

    //std::ifstream in("input.txt");
    //std::cin.rdbuf(in.rdbuf());
    
    cin >> N;

    L.resize(N);

    cin >> A >> B >> C;

    for(int i = 0; i < N; i++ )
    {
        cin >> L[i];
    }
    //ofstream ofs("output.txt");
    //ofs << "Start" << endl;
    //ofs.close();
    //i=0,a,b,cのコスト0からスタート
    res = rec(0,0,0,0);

    cout << res << endl;
    return 0;
}



Measured memory_bytes: 256
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <iomanip>
#include <complex>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
using namespace std;
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<pii,int> ppiii ;
typedef unsigned long long ull ;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;
vi p;
long long int MOD = 1000000007;
int main(){
	int n;
	cin>>n;
	int a[114514]={0};
	int x;
	for(int i=0;i<n;i++){
		cin>>x;
		a[x]++;
	}
	bool flag=true;
	if(n%2==0){
		
		for(int k=0;k<n/2;k++){
			int kk = 2*k+1;
			if(a[kk]!=2)flag=false;
		}
		
	}else{
		if(a[0]!=1)flag=false;
		for(int k=1;k<n/2;k++){
			int kk = 2*k;
			if(a[kk]!=2)flag=false;
		}
		
	}
	
	if(flag){
		ll ans=1;
		rep(i,n/2)ans=(ans*(ll)2)%MOD;
		cout<<ans<<endl;
	}else{
		cout<<"0"<<endl;
	}
}

Measured memory_bytes: 768
a,b,c = map(int,input().split())
ans = 0
flag = True

while flag == True:
  if a%2 == 0 and b%2 == 0 and c%2 == 0:
    if (a==b==c):
      ans = -1
      break
    
    ans += 1
    at=a
    bt=b
    ct=c
    a = int(bt/2+ct/2)
    b = int(at/2+ct/2)
    c = int(at/2+bt/2)
  else:
    flag = False
    break
  
print(ans)

Measured memory_bytes: 3064
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!(
    n: f64,
    );
    let nn = n - 1.0;
    let sn = n.sqrt();
    let snn = nn.sqrt();
    let mut i = 1.0;
    let mut v = vec![];
    let mut ans = 0;
    while i <= snn {
        if nn % i == 0.0 {
            if i != 1.0 {
                ans += 1;
            }
            if i != nn / i {
                ans += 1;
            }
        }
        i += 1.0;
    }
    i = 1.0;
    while i <= sn {
        if n % i == 0.0 {
            if i != 1.0 {
                v.push(i as usize);
            }
            if i != n / i {
                v.push((n / i) as usize);
            }
        }
        i += 1.0;
    }
    let n = n as usize;
    for i in v {
        let mut r = n.clone();
        while r % i == 0 { r /= i }
        if r % i == 1 {
            ans += 1;
        }
    }
    println!("{}", ans);
}



Measured memory_bytes: 4352
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <math.h>
#include <sstream>
#include <numeric>
#include <string>
#include <cassert>
#include <bitset>

using namespace std;
typedef long long ll;

int main() {
  int H, W, K;
  cin >> H >> W >> K;
  vector<string> C(H);
  for (int i = 0; i < H; ++i) {
    cin >> C[i];
  }
  int success_count = 0;
  for (int a = 0; a < (1<<H); ++a) {
    for (int b = 0; b < (1<<W); ++b) {
      int cnt = 0;
      for (int i = 0; i < H; ++i) {
	for (int j = 0; j < W; ++j) {
	  if ((a&(1<<i)) == 0 and (b&(1<<j)) == 0 and C[i][j] == '#') {
	    ++cnt;
	  }
	}
      }
      if (cnt == K) {
	success_count++;
      }
    }
  }
  cout << success_count << endl;
  return 0;
}


Measured memory_bytes: 3160
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;

int main(void){
	string s; cin >> s;
	int now;
	int cnt = 0;
	if(s[0] == 'B') now = 0;
	else now = 1;
	reps(i, 1, s.size()){
		// printf("%d %d\n", i, now);
		if(s[i] == 'B' && now == 1){
			cnt++;
			now = 0;
		}else if(s[i] == 'W' && now == 0){
			cnt++;
			now = 1;
		}
	}

	int now1, cnt1 = 0;
	if(s[s.size() - 1] == 'B') now1 = 0;
	else now1 = 1;
	for (int i = s.size() - 2; i >= 0; --i){
		if(s[i] == 'B' && now1 == 1){
			cnt1++;
			now1 = 0;
		}else if(s[i] == 'W' && now1 == 0){
			cnt1++;
			now1 = 1;
		}
	}
	printf("%d\n", min(cnt, cnt1));
	return 0;
}

Measured memory_bytes: 512
#include "iostream"
#include "vector"
#include "set"

using namespace std;

int main() {
    string s;
    cin >> s;

    int n = s.size();
    vector< int> pre(n), post(n), dond(n);
    for (int i = 0; i < n; ++i) pre[i] = i - 1, post[i] = i + 1;

    int res = 0;
    for (int i = 1; i < n; i ++) {
        if (pre[i] == -1) {
            continue;
        }

        if (s[i] != s[pre[i]]) {
            res += 2;
            if(i + 1 < n) pre[i + 1] = pre[pre[i]];
        }
    }
    printf("%d\n", res);
}

Measured memory_bytes: 1664
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef vector<pair<ll,ll> > vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define drep(i,a,b) for(ll i=(a);i>=(b);--i)
#define SIZE(a) int((a).size())
const int INF=INT_MAX;


int main(){
  ll a,b,c;
  cin>>a>>b>>c;
  if(c>=a&&c<=b){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}


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

int main(){
	int n,a[6]={};
	float t;
	cin >> n;
	for(int i=0;i<n;i++){
		
	}
	for(int i=0;i<n;i++){
		 cin >> t;
		 if(t>=185.0){a[5]=a[5]+1;}
		 else if(t>=180.0){a[4]=a[4]+1;}
		 else if(t>=175.0){a[3]=a[3]+1;}
		 else if(t>=170.0){a[2]=a[2]+1;}
		 else if(t>=165.0){a[1]=a[1]+1;}
		 else {a[0]=a[0]+1;}
	}
	for(int r=0;r<6;r++){
		cout << r+1 << ":";
		for(int i=0;i<a[r];i++){
			cout << "*" ;
		}
		cout << endl;
	}

	return 0;
}

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

int main(){
	
  int x;
  cin >> x;
  int ans = 1;
  for(int i=2;i*i<=x;i++){
  	int cur = i;
    while(cur*i<=x){
    	cur*=i;
      	ans = max(ans,cur);
    }
  }
  cout << ans << endl;
 
  
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    N,K=map(int,input().split())
    A=list(map(int,input().split()))
    x=A.index(1)+1
    ans=0
    ans+=-(-(x-1)//(K-1))
    x=-(-(x-1)//(K-1))*(K-1)+1
    ans+=-(-(N-x)//(K-1))
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 52476
#include <bits/stdc++.h>
#define mp make_pair
#define F first
#define S second
#define ll long long
using namespace std;
const int LIM = 3e5+3;
int cost[LIM+3], d[LIM+3];
ll INF = 1e18;
ll Ans = 0;

void solve(int l,int r)
{
  if(l >= r)return;
  int mid = (l+r)/2;
  vector<pair<int,ll> > V,W;
  int mx = 0; ll cur = 0;
  for(int i = mid+1;i<=r;i++)
  {
    cur += cost[i];
    if(abs(d[i]-d[i-1]) > mx)
      mx = abs(d[i]-d[i-1]), V.push_back(mp(mx,cur));
    else 
      V[V.size()-1].S = min(V.back().S, cur);
  }
  for(int i = 1; i<V.size();i++)
    V[i].S = min(V[i].S, V[i-1].S);
  mx = 0, cur = cost[mid];
  W.push_back(mp(0,cur));
  for(int i = mid-1;i>=l;i--)
  {
    cur += cost[i];
    if(abs(d[i+1]-d[i]) > mx)
      mx = abs(d[i+1]-d[i]), W.push_back(mp(mx,cur));
    else 
      W[W.size()-1].S = min(W.back().S, cur);
    int ind = upper_bound(V.begin(), V.end(), mp(mx,0ll))-V.begin();
    ind--;
    if(ind < 0)continue;
    Ans = min(Ans, cur+1ll*mx*mx+V[ind].S); 
  }
  for(int i = 1; i<W.size();i++)
    W[i].S = min(W[i].S, W[i-1].S);
  mx = 0, cur = 0;
  for(int i = mid+1;i<=r;i++)
  {
    cur += cost[i];
    mx = max(mx,abs(d[i]-d[i-1]));
    int ind = upper_bound(W.begin(), W.end(), mp(mx,0ll))-W.begin();
    ind--;
    if(ind < 0)continue;
    Ans = min(Ans, cur+1ll*mx*mx+W[ind].S); 
  }
  solve(l, mid);
  solve(mid+1,r);
}
int arr[LIM+3];

int main(){
    int n;cin >> n;
    for(int i  =0;i<n; i++)
      cin >> arr[i];
    for(int i  = 0;i<n;i++)
      for(int j = i;j<n;j++)
      {
        swap(arr[i],arr[j]);
        bool ok = true;
        for(int i = 1;i<n;i++)
          if(arr[i] <= arr[i-1])ok = false;
        if(ok){puts("YES");return 0;}
        swap(arr[i],arr[j]);
      }
    puts("NO");
}

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

int main () {

    string S;
    cin >> S;

    int diff1 = 0, diff2 = 0;
    for (int i = 0; i < S.size(); i++) {
        if (i % 2 == 0) {
            if (S[i] != '0') diff1++;
            else diff2++;
        }
        if (i % 2 == 1) {
            if (S[i] != '1') diff1++;
            else diff2++;
        }
    }

    cout << min(diff1, diff2) << endl;

    return 0;
}

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

int main(){
    int N,M; cin >> N >> M;
    int AC_sum=0;
    int WA_sum=0;
    
    vector <bool> A(N);
    rep(i,N+1) A[i]=false;
    int WA[N];
    rep(i,N+1) WA[i]=0;
    
    rep(i,M){
        int p;
        string S;
        cin >> p >> S;
        
        if (S=="AC" && A[p]==false){
            A[p]=true;
            AC_sum++;
            WA_sum+=WA[p];
        }
        if (S=="WA" && A[p]==false) WA[p]++;
    }
    
    cout << AC_sum << " " << WA_sum << endl;
    return 0;
}

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

ll maxHappyness(ll a[], ll b[], ll c[], ll n){
  ll dp[n][3];
  dp[0][0] = a[0];
  dp[0][1] = b[0];
  dp[0][2] = c[0];
  for(ll i=1; i<n; i++){
    dp[i][0] = a[i]+ max(dp[i-1][1], dp[i-1][2]);
    dp[i][1] = b[i]+ max(dp[i-1][0], dp[i-1][2]);
    dp[i][2] = c[i]+ max(dp[i-1][1], dp[i-1][0]);
  }
  ll ans = max(dp[n-1][0], dp[n-1][1]);
  ans = max(ans, dp[n-1][2]);
  return ans;
}

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ll n;
  cin>>n;
  ll a[n], b[n], c[n];
  for(ll i=0; i<n; i++){
    cin>>a[i]>>b[i]>>c[i];
  }
  ll ans = maxHappyness(a, b, c, n);
  cout<<ans<<"\n";
  return 0;
}

Measured memory_bytes: 8192
#include<bits/stdc++.h>
using namespace std;
long long a[123456];
int n;
bool vis[1009];
map<long long,long long>Mp;
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
        Mp[a[i]]++;
    }
    long long Max=1;
    for(int i=0;i<=100010;i++){
            Max=max(Max,Mp[i]);
            if(Mp[i]&&Mp[i+1]&&Mp[i+2]){
               long long ans=Mp[i]+Mp[i+1]+Mp[i+2];
               Max=max(Max,ans);
            }
            if(Mp[i]&&Mp[i+1]){
               long long ans=Mp[i]+Mp[i+1];
               Max=max(Max,ans);
            }
            if(Mp[i]&&Mp[i+2]){
               long long ans=Mp[i]+Mp[i+2];
               Max=max(Max,ans);
            }
    }
    cout<<Max<<endl;
	return 0;
}


Measured memory_bytes: 7296
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i = n;i >= 0;--i)
#define FOR(i,m,n) for(int i = m, i##_len=(n);i <i##_len; ++i)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
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; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
const int INF = 1e9;
const ll LLINF = 1e16;

ll modinv(ll a, ll m) {
    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;
}

int main(void)
{
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> b(n);

    REP(i,n){
        cin >> a[i];
        b[i] = a[i];
    }

    sort(all(a));

    int max = a[n-1];
    int max2 = a[n-2];

    REP(i,n){
        if(b[i] == max){
            cout << max2 << endl;
        }
        else{
            cout << max << endl;
        }
    }

    

    return 0;
}

Measured memory_bytes: 3200
#include <bits/stdc++.h>
#define rep(i , n) for (int i = 0; i < (int)(n); i++)
const int INF = 1<<29;
using namespace std;
using ll = long long;
ll s , f[1000005] , a , b , n , q;
int main(){
	cin >> n;
	for(int i = 1; i <= n; i++){
		cin >> a;
		f[a]++;
		s += a;
	}
	cin >> q;
	while(q--){
		cin >> a >> b;
		f[b] += f[a];
		s = s - f[a] * a + f[a] * b;
		f[a] = 0;
		cout << s << endl;
	}
}


Measured memory_bytes: 4352
#define _GLIBCXX_DEBUG
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <map>
#include <list>
#include <cmath>
using namespace std;
typedef long long ll;
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define mp make_pair
#define pb push_back
const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 1e9+7;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	cin >> n;

	ll ans = LINF;
	for (ll i = 1; i*i <= n; i++) {
		if (n % i != 0) continue;
		ll j = n / i;
		ans = min(ans, i+j-2);
	}

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


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
using namespace std; using ll = long long; using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
//**デバッグ準備**//
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop//
//bitSearch, bitList, nod, gcdlcm, isPrime, primeFactorize, Npow, divisor, modinv, dfs, bfs, eratos//
//dijkstra, WarshallFloyd, BellmanFord, UnionFind, COM, digitDP ,RMQ//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z, R;
ll MOD = 1000000007; ll INF = 1LL << 62; ll ans = 1; ll z = 0, o = 1;
vl flag, color, D; vll path;
ll nod(ll F) { return log2(F) + 1; }
vl bitList(ll n, ll k, ll f) {
	vl bitList(k);
	for (ll i = 0; i < k; i++) {
		bitList[i] = f % n;
		f /= n;
	}
	return bitList;
}
int main() {
	cin >> L;
	N = nod(L);
	vector <tuple<ll, ll, ll>> Ans;
	for (i = 1; i < N; i++) {
		Ans.push_back(make_tuple(i, i + 1, pow(2, i - 1)));
		Ans.push_back(make_tuple(i, i + 1, 0));
	}
	for (i = N-1; i >= 1; i--) {
		if (L - pow(2, i - 1) >= pow(2, N - 1)) {
			Ans.push_back(make_tuple(i, N, L-pow(2, i - 1)));
			L -= pow(2, i - 1);
		}
	}
	cout << N << " " << Ans.size() << endl;
	for (i = 0; i < Ans.size(); i++) {
		cout << get<0>(Ans[i]) << " " << get<1>(Ans[i]) << " " << get<2>(Ans[i]) << endl;
	}
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int x,y,a,b,c,i,ans=0;
    cin >> x >> y >> a >> b >> c;
    long long int ar[a],ar1[b],ar2[c];
    for(i=0;i<a;i++)
    cin >> ar[i];
    for(i=0;i<b;i++)
    cin >> ar1[i];
    for(i=0;i<c;i++)
    cin >> ar2[i];
    sort(ar, ar+a, greater<int>());
    sort(ar1, ar1+b, greater<int>());
    sort(ar2, ar2+c, greater<int>());
    
    vector <long long int> v;
    
    for(i=0;i<x;i++)
    v.push_back(ar[i]);
    for(i=0;i<y;i++)
    v.push_back(ar1[i]);
    for(i=0;i<c;i++)
    v.push_back(ar2[i]);
    sort(v.begin(), v.end(), greater<long long int>());
    v.resize(x+y);
    for(auto i=v.begin();i!=v.end();i++)
    ans+=*i;
    cout << ans;
    return 0;
}


Measured memory_bytes: 8560
#include <iostream>
#include <cstring>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
ll L, a[200008], dpsr[200008][3], dpsl[200008][3];

int main(){
	cin >> L;
	ll ans = 0;
	for(ll i = 1; i <= L; i++){cin >> a[i]; ans += a[i];}
	
	memset(dpsr[0], 0, sizeof(dpsr[0]));
	for(ll i = 1; i <= L; i++){
		dpsr[i][0] = dpsr[i-1][0]+a[i];
		ll minsr = min(dpsr[i-1][0], dpsr[i-1][2]);
		if(a[i] == 0){
			dpsr[i][1] = min(minsr, dpsr[i-1][1])+1;
			dpsr[i][2] = minsr+2;
		}
		else{
			dpsr[i][1] = min(minsr, dpsr[i-1][1])+(a[i]+1)%2;
			dpsr[i][2] = minsr+a[i]%2;
		}
	}
	
	memset(dpsl[L], 0, sizeof(dpsl[L]));
	for(ll i = L-1; i >= 0; i--){
		dpsl[i][0] = dpsl[i+1][0]+a[i+1];
		ll minsl = min(dpsl[i+1][0], dpsl[i+1][2]);
		if(a[i+1] == 0){
			dpsl[i][1] = min(minsl, dpsl[i+1][1])+1;
			dpsl[i][2] = minsl+2;
		}
		else{
			dpsl[i][1] = min(minsl, dpsl[i+1][1])+(a[i+1]+1)%2;
			dpsl[i][2] = minsl+a[i+1]%2;
		}
	}
	
	for(ll i = 0; i <= L; i++){
		ll minsr = min(dpsr[i][0], dpsr[i][2]);
		ll minsl = min(dpsl[i][0], dpsl[i][2]);
		ans = min(minsr+min(minsl, dpsl[i][1]), ans);
		ans = min(min(minsr, dpsr[i][1])+minsl, ans);
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 11136
#include<stdio.h>

long long temp[51];
//Combination Table
long long C[51][51];//C[n][k] -> nCk

void comb_table(int N);
void MergeSort_re(long long x[],int left,int right);

int main(void){
  int N,A,B,i,same_value_num,same_value_pos;
  long long value[51],ans=0;
  double ave_max=0;
  scanf("%d %d %d",&N,&A,&B);
  for(i=0;i<N;i++) scanf("%lld",&value[i]);
  MergeSort_re(value,0,N-1);
  comb_table(51);
  for(i=0;i<A;i++){
    ave_max+=value[i];
  }
  ave_max/=A;
  printf("%f\n",ave_max);
  same_value_num=0;
  same_value_pos=0;
  for(i=0;i<N;i++){
    if(value[A-1]==value[i]){
      same_value_num++;
      if(i<A){
        same_value_pos++;
      }
    }
  }
  if(value[0]!=value[A-1]){
    ans=C[same_value_num][same_value_pos];
  }else{
    //same_value+=A-1;
    for(i=A;i<=B;i++){
      ans+=C[same_value_num][i];
      //printf("%d\n",ans);
    }
  }
  //printf("%d\n",same_value_num);
  printf("%lld\n",ans);
  return 0;
}


void comb_table(int N){
  int i,j;
  for(i=0;i<N;i++){
    for(j=0;j<=i;j++){
      if(j==0 || j==i){
        C[i][j]=1;
      }else{
        C[i][j]=C[i-1][j-1]+C[i-1][j];
      }
    }
  }
}



void MergeSort_re(long long  x[],int left,int right){
  int mid,i,j,k;
  if(left >= right) return;
  mid = (left+right)/2;
  MergeSort_re(x,left,mid);
  MergeSort_re(x,mid+1,right);

  for(i=left;i<=mid;i++) temp[i] = x[i];
  for(i=mid+1,j=right;i<=right;i++,j--) temp[i]=x[j];

  i=left;
  j=right;

  for(k=left;k<=right;k++){
    if(temp[i] >= temp[j]) x[k] = temp[i++];
    else x[k] = temp[j--];
  }
}


Measured memory_bytes: 128
import java.io.*;
import java.util.Scanner;


public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		String s = sc.next();
		int n = s.length();

		int min = Integer.MAX_VALUE;
		for (int i = 0; i + 3 <= n; i++) {
			String tmp = s.substring(i, i + 3);

			min = Math.min(min, Math.abs(753 - Integer.parseInt(tmp)));
		}

		pr.println(min);
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);
			
		solve();
			
		pr.close();
		sc.close();
	}

	static class Printer extends PrintWriter {
		Printer(OutputStream out) {
			super(out);
		}
	}
}


Measured memory_bytes: 21972
#include<bits/stdc++.h>
using namespace std;
int main()
{int a,b;
 cin>>a>>b;
 int x=1,t=b;
 while(t>0)
   {x*=10;
    t/=10;
   }
 t=sqrt(a*x+b); 
 if(t*t==a*x+b)
    cout<<"Yes"<<endl;
 else
    cout<<"No"<<endl;
}

Measured memory_bytes: 256
a,b,c,d=gets.split.map(&:to_i)

result=[]
x=[a,b]
y=[c,d]
for i in 0..1
    v=x[i]
    for j in 0..1
        vv=y[j]
        result<<v*vv
    end
end


p result.max
    

Measured memory_bytes: 14372
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <map>
#define pb push_back
using namespace std;
const int N=2e5+5;

map <int,int> has;

int n,m;
int t[N];



int main()
{
   int i;
   int x;

   cin>>n;
   for(i=1;i<=n;i++)
   {
       scanf("%d", &x);

       has[x]++;
   }
   cin>>m;
   for(i=1;i<=m;i++)
   {
       scanf("%d", &t[i]);
   }

   for(i=1;i<=m;i++)
   {
       if(!has[t[i]])
       {
           printf("NO\n");

           return 0;
       }
       else
        has[t[i]]--;
   }

   printf("YES\n");


   return 0;
}


Measured memory_bytes: 10368
#include <math.h>
#include <bits/stdc++.h>//一括で読み込み
typedef long long ll;
using namespace std;

ll n,q;
ll nums[600*600];
ll numSets[600];//600*600に分割
ll numSetsSub[600];

int WherePosition(int num)//左から何番目の分類に属するか
{
  return num / 600;
}

void PointChangeMinGetReady()
{//1点の値をchangeNumに変更し、区間以上以下の最小値を求める初期値前処理。
  for(int i = 0; i < 600*600; i++)
  {
    nums[i] = 2147483647;//初期値
  }
  for(int i = 0; i < 600; i++)
  {
    numSets[i] = 2147483647;
  }
}

void PointChangeMinGet(int pointNum, ll changeNum)
{//1点の値をchangeNumに変更し、区間以上以下の最小値を求める。入力側
  int pointPosition = WherePosition(pointNum);
  numSets[pointPosition] = 2147483647;

  nums[pointNum] = changeNum;
  for(ll i = 600*pointPosition; i < 600*(pointPosition+1); i++)
  {
    numSets[pointPosition] = fmin(numSets[pointPosition],nums[i]);
  }
}

ll PointChangeMaxMinGetAnswer(int leftNum, int rightNum, int minOrMax)
{//1点の値をchangeNumに変更し、区間以上以下の最大値1最小値-1を求める。出力側
  ll minMemo = 2147483647;
  ll maxMemo = -2147483647;
  int leftPosition = WherePosition(leftNum);
  int rightPosition = WherePosition(rightNum);

  if(leftPosition == rightPosition)
  {
    for(ll i = leftNum; i <= rightNum; i++)//左右が同じ分類のとき
    {
      minMemo = fmin(minMemo, nums[i]);
      maxMemo = fmax(maxMemo, nums[i]);
    }
  }else
  {
    for(ll i = leftNum; i < 600*(leftPosition+1); i++)//左区間内（左端より右だけ見る）
    {
      minMemo = fmin(minMemo, nums[i]);
      maxMemo = fmax(maxMemo, nums[i]);
    }
    for(ll i = 600*rightPosition; i <= rightNum; i++)//右区間内
    {
      minMemo = fmin(minMemo, nums[i]);
      maxMemo = fmax(maxMemo, nums[i]);
    }
    for(ll i = leftPosition+1; i < rightPosition; i++)//見ていない区間内
    {
      minMemo = fmin(minMemo, numSets[i]);
      maxMemo = fmax(maxMemo, numSets[i]);
    }
  }
  if(minOrMax == -1) return minMemo;
  return maxMemo;
}

ll PointChangeMaxGetAnswer(int leftNum, int rightNum)
{//1点の値をchangeNumに変更し、区間以上以下の最大値を求める。出力側
  return PointChangeMaxMinGetAnswer(leftNum, rightNum, 1);
}

ll PointChangeMinGetAnswer(int leftNum, int rightNum)
{//1点の値をchangeNumに変更し、区間以上以下の最小値を求める。出力側
  return PointChangeMaxMinGetAnswer(leftNum, rightNum, -1);
}

int main() 
{

  PointChangeMinGetReady();
    //1点の値をchangeNumに変更し、区間以上以下の最小値を求める初期値前処理。

  cin >> n >> q;

  for(ll question = 0; question < q; question++)
  {
    int howNum;
    cin >> howNum;
    int pointNum,leftNum,rightNum;
    ll changeNum;
        
    if(howNum == 0)//書き換え
    {
      cin >> pointNum >> changeNum;
      PointChangeMinGet(pointNum,changeNum);//変更処理の選択
    }
    if(howNum == 1)//値を求める
    {
      cin >> leftNum >> rightNum;
      cout << PointChangeMinGetAnswer(leftNum, rightNum) << endl;//取得（出力）処理の選択
    }
  }
}



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

using namespace std;

int main()
{
   int n, k;
   cin >> n >> k;
   int x;
   cin >> x;
   int h = x;
   int maxi = -1;
   for(int i = 1; i < k; i++)
   {
      int y; cin >> y;
      int tmp = y - x;
      if(tmp < 0)
      {
         tmp = n - x + y;
      }
      maxi = max(maxi, tmp);
      x = y;
   }
   maxi = max(maxi, h + n - x);
   cout << n - maxi;




}



Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()



int main(void){
    ll L, R, ans;
    cin >> L >> R;

    ans = 2019;

    if(R-L>=2018){
        ans = 0;
    }else{
        ll L1 = L%2019;
        ll R1 = R%2019;
        for(ll i = L1; i<L1+R-L; i++){
            for(ll j = 1; j<L1+R-L-i+1; j++){
                if(ans > (i*(i+j))%2019){
                    ans = (i*(i+j))%2019;
                }
            }
        }

    }

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ii pair<ll, ll>
#define vi vector<ll>
#define vii vector<ii>
#define vs vector<string>
#define si set<ll>
#define endl "\n"
#define pb push_back
#define x first
#define y second
//g++ -std=c++11 -Wall -Wextra -pedantic-errors main.cpp -o main
const int ms = 2*1e5 + 5, base = 31, mod = 1e9 + 7;
using namespace std;

int main(){
	ios::sync_with_stdio(false), cin.tie(0);
	
	string A, B; cin >> A >> B;
	int a, b; cin >> a >> b;
	
	string s; cin >> s;
	if (s==A) a--;
	else b--;
	
	cout << a << " " << b<< endl;
	
	return 0;
}

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

int main(){
  string S;
  cin >> S;
  const int N= int(S.size());

  int ans= 0;
  int offset= 0;
  for(int right=0; right<N; right++){
    if(S.at(right)=='R'){ continue; }
    else{
      ans= max(ans, right- offset);
      offset= right+1;
    }
  }
  ans= max(ans, N- offset);
  
  cout << ans << endl;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int a[110];
int main(){
	int n;
	cin>>n;
	int cnt=-101;
	int res=101;
	for(int i=0;i<n;i++){
		cin>>a[i];
		cnt=max(cnt,a[i]);
		res=min(res,a[i]);
	}
	int ans=1e9;
	for(int i=res;i<=cnt;i++){
		int cnt2=0;
		for(int j=0;j<n;j++){
			cnt2+=abs(a[j]-i)*abs(a[j]-i);
		}
		ans=min(ans,cnt2);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
//q1 abc064
#include <cstdio>
#include <algorithm>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <set>
#include <iostream>
#include <tuple>
#define pb push_back
#define mkt make_tuple
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
const int INF =  2147483647;
const ll INFLL = 9223372036854775807;



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

  int r, g, b;
  string ans;
  cin >> r >> g >> b;
  if ((r*100+g*10+b) % 4 == 0) {
    ans = "YES";
  } else {
    ans = "NO";
  }

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll MOD=1e9+7 ;
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; }

// Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){

    int n;
    cin >> n;
    cout << pow(n,3) << endl;
}


Measured memory_bytes: 384
#include "bits/stdc++.h"
using namespace std;

int main() {
    long long a, b, x;
    cin >> a >> b >> x;

    long long ans = 0;
    long long res = (a / x + 1) * x;
    if (a % x == 0) {
        ans++;
        ans += (b - a) / x;
    }
    else if (a % x != 0) {
        if (a <= res && res <= b) {
            ans++;
            ans += (b - res) / x;
        }
    }

    cout << ans << endl;
}

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

int gcd(int x, int y) {
    if (x > y) {
        while (x % y != 0) {
            int amr = x % y;
            x = y;
            y = amr;
        }
        return y;
    }
    else if (y > x) {
        while (y % x != 0) {
            int amr = y % x;
            y = x;
            x = amr;
        }
        return x;
    }
    else
        return x;
}

int main() {
    int K;
    cin >> K;
    
    int sum = 0;
    for (int i = 1; i <= K; i++) {
        for (int j = 1; j <= K; j++) {
            for (int k = 1; k <= K; k++) {
                sum += gcd(gcd(i, j), k);
            }
        }
    }
    
    cout << sum << endl;
    
    return 0;
}


Measured memory_bytes: 3580