akhauriyash/Code-Regression huggingface dataset:
///mAAria...
#include<bits/stdc++.h>
 
using namespace std;
 
#define int long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(v) v.begin(),v.end()
#define ld long double
#define ff first
#define ss second
#define pii pair<int,int>
#define pi 3.1415926535897932384626433832
#define mod 1000000007
#define inf 1000000000
#define pr1(a) cout << a << endl
#define pr2(a,b)cout << a <<  " " <<b<< endl
#define pr3(a,b,c) cout << a <<" " << b << " " << c << endl

const long double PI = acos(-1);

int powm(int a, int b) {
    int res=1;
    while(b) {
        if(b&1)
            res=(res*a)%mod;
        a=(a*a)%mod;
        b>>=1;
    }
    return res;
}

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

const int maxn = 200050;

int ans;
int dp[200][200];

void solve(){
    
    int r,c;
    cin >> r >> c;

    char a[r+1][c+1];

    for(int i = 1;i<=r;i++){
        for(int j = 1;j<=c;j++){
            cin >> a[i][j];
        }
    }
    
    for(int i = 0;i<=r;i++){
        for(int j = 0;j<=c;j++){
            dp[i][j] = mod;
        }
    }
    dp[0][1] = 0, dp[1][0] = 0;

    for(int i = 1;i<=r;i++){
        for(int j = 1;j<=c;j++){

            dp[i][j] = min(dp[i-1][j],dp[i][j-1]);
            //if(dp[i-1][j]>=dp[i][j-1])ans++;
            
            if(a[i][j]=='#'){
                //dp[i][j] = min(dp[i-1][j]+1,dp[i][j-1]+1);
                dp[i][j]+=1;

                if(a[i-1][j]=='#')dp[i][j] = min(dp[i][j],dp[i-1][j]);
                if(a[i][j-1]=='#')dp[i][j] = min(dp[i][j], dp[i][j-1]);
            }
            //cout << dp[i][j] << " ";
        }
        
    }
    // for(int i = 1;i<=r;i++){
    //     for(int j = 1;j<=c;j++){
    //         cout << dp[i][j] << " ";
    //     }
    //     cout << endl;
    // }

    cout << dp[r][c]<< endl;
} 

signed main() 
{   
    IOS;
    int t = 1;
    //cin >> t;

    for(int i = 1;i<=t;i++){
        solve();
    }
    return 0;
} 

 


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

#ifdef LOCAL
  #include <contest/local.hpp>
#else
  #define LOG(...) do {} while (false)
#endif

#define REP(i,n) for (decay_t <decltype (n)> i = 0, i ## __len = (n); i < i ## __len; ++ i)
#define ALL(x) (x).begin (), (x).end ()

using namespace std;

auto main () -> int
{
  cin.tie (nullptr);
  ios::sync_with_stdio (false);

  unsigned n;
  cin >> n;

  vector <int> a (n + 1, 0);
  vector <int> b (n + 1, 0);

  REP (i, n)
  {
    cin >> a [i + 1];
  }

  b [n] = a [n];
  for (auto i = n - 1; i > 0; -- i)
  {
    b [i] = a [i];
    for (auto k = 2; k * i <= n; ++ k)
    {
      b [i] ^= b [k * i];
    }
  }

  vector <int> ans;
  for (auto i = 1; i <= n; ++ i)
  {
    if (b [i] == 1)
    {
      ans.push_back (i);
    }
  }

  LOG (b);

  cout << ans.size () << endl;
  REP (i, ans.size ())
  {
    cout << (i == 0 ? "" : " ") << ans [i];
  }
  cout << endl;
}



Measured memory_bytes: 3192
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b;
  char op;
  cin >> a >> op >> b;
  int answer = 0;
  if (op == '+') {
    answer  = a + b;
  } else {
    answer = a - b;
  }
  cout << answer << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,k;
    cin>>a>>b>>c>>k;

    if(k<=a)
        cout<<k<<endl;
    else if(k>a && k<=(a+b))
        cout<<a<<endl;
    else if(k>a+b && k<=a+b+c)
    {
        int x=k-(a+b);
        cout<<a-x<<endl;
    }
}


Measured memory_bytes: 3624
#include<stdio.h>
int p[100010]={0};
int d[100010]={0};
int S[100010]={0};//サイズ用配列 未実験
int Find(int a,int b){
  int r,n;
  for(r=a;p[r];r=p[r]);
  for(;n=p[a];a=n)p[a]=r;
  for(r=b;p[r];r=p[r]);
  for(;n=p[b];b=n)p[b]=r;
  return a-b?1:0;
}
void Union(int a,int b){
  if(Find(a,b)){
    for(;p[a];a=p[a]);
    for(;p[b];b=p[b]);
    d[a]<d[b]?(p[a]=b):(p[b]=a);
    if(d[a]==d[b])d[a]++;
    S[a]=S[b]=S[a]+S[b];
  }
}
int main(){
  int n,m,k,i,a,b,o,c[100010]={};
  for(i=0;i<100010;i++)S[i]=1;
  scanf("%d %d %d",&n,&m,&o);
  while(m--){
    scanf("%d %d",&a,&b);
    Union(a,b);
    c[a]++;
    c[b]++;
  }
  while(o--){
    scanf("%d %d",&a,&b);
    if(Find(a,b)==0){
      c[a]++;
      c[b]++;
    }
  }
  for(i=1;i<=n;i++){
    for(a=i;p[a];a=p[a]);
    S[i]=S[a];
  }
  ///for(i=0;i<n;i++)printf("%d %d\n",S[i+1],c[i+1]);printf("\n");
  for(i=1;i<=n;i++)printf("%d%c",S[i]-c[i]-1,n==i?'\n':' ');
  return 0;
}
      


Measured memory_bytes: 2304
def gcd(x,y):
        while y != 0:
                x, y = y, x%y
        return x

a, b, c, d = map(int, input().split())
g = gcd(c,d)
b_count = b - b//c - b//d + b//(c*d//g)
a_count = (a-1) - (a-1)//c - (a-1)//d + (a-1)//(c*d//g)
print(b_count-a_count)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
int main()
{
    // 整数の入力
    int n;
    cin >> n;
    vector<int> v;
 
	for (int i = 0; i < n; i++) {
      	int length;
        cin >> length;
        v.push_back(length);
    }
    std::sort(v.begin(), v.end(), std::greater<int>());
	int mLength = v.at(0);
    int tLength = 0;
    for (int i = 1; i < v.size(); i++) {
		tLength = tLength + v.at(i);
    }
  	if (mLength < tLength) {
    	cout << "Yes" << endl;
    } else {
    	cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const unsigned int MOD = 1000000007;
#define ll long long
#define PI 3.1416
string day[]={"SUN","MON","TUE","WED","THU","FRI","SAT"};
int main() {
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int n;
    string str;
    while(cin>>n){
        cin.ignore();
        cin>>str;
        if(n>=3200)cout<<str<<endl;
        else cout<<"red"<<endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ld eps = 1e-10;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll a, b, c; cin >> a >> b >> c;
  cout << min({(a-a/2*2)*b*c, (b-b/2*2)*a*c, (c-c/2*2)*a*b}) << "\n";
  return 0;
}


Measured memory_bytes: 3580
#import sys
MOD = 10 ** 9 + 7
#input = sys.stdin.readline
import math

import itertools

#import bisect

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def kingaku(a,b,n):
    keta=len(str(n))
    return a*n+b*keta

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default


#    h,w,a,b = map(int, input().split())
#    c = [[0 for j in range(n)] for i in range(n)]
def main():
    n,a,b=map(int,input().split())
    count=0
    if (b-a)%2==0:
        count=(b-a)//2
    else:
        if a-1<=n-b:
            count=(b-a-1)//2+a
        else:
            count=(b-a-1)//2+n-b+1
#    print(a-1,n-b,b-a-1)
    print(count)









if __name__ == "__main__":
    main()

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

int main()
{
	char o[50],e[50];
	int i,a,b;
	
	scanf("%s%s",&o,&e);
	
	a=strlen(o);
	b=strlen(e);
	
	for(i=0;i<a;i++){
		printf("%c",o[i]);
		if((i+1==a)&&((a-b)==1))break;
		printf("%c",e[i]);
	}
	
	return 0;
}

Measured memory_bytes: 128
p = 10**9+7
def pow(x,m):
    if m==0:
        return 1
    if m==1:
        return x%p
    if m%2==0:
        return (pow(x,m//2)**2)%p
    else:
        return (x*(pow(x,(m-1)//2)**2)%p)%p
A = [1 for _ in range(10**6+1)]
for i in range(1,10**6+1):
    A[i] = (A[i-1]*i)%p
B = [1 for _ in range(10**6+1)]
B[10**6] = pow(A[10**6],p-2)
for i in range(10**6-1,1,-1):
    B[i] = (B[i+1]*(i+1))%p

X,Y = map(int,input().split())
if (X+Y)%3!=0:
    cnt = 0
else:
    k = (X+Y)//3
    if X>Y:
        X,Y = Y,X
    n = X-k
    if X<k:
        cnt = 0
    else:
        cnt = (((A[k]*B[n])%p)*B[k-n])%p
print(cnt)

Measured memory_bytes: 146948
#include        <map>
#include      <cmath>
#include      <queue>
#include     <string>
#include     <cstdio>
#include     <vector>
#include    <cstring>
#include   <iostream>
#include  <algorithm>
using namespace std;
#define ll long long
const ll inf = 0x3f3f3f3f3f3f3f3f;
const int maxn = 1000000+5;
const ll mod = 1e9+7;

int main(){
    ll n, m;
    scanf("%lld%lld",&n,&m);
    if(n==1 && m == 1){
        puts("1");
    } else if(n==1){
        printf("%d\n",m-2);
    } else if(m==1){
        printf("%d\n",n-2);
    }else
        printf("%lld\n",(n-2)*(m-2));
    return 0;
}


Measured memory_bytes: 256
import sys
# sys.setrecursionlimit(100000)


def input():
    return sys.stdin.readline().strip()


def input_int():
    return int(input())


def input_int_list():
    return [int(i) for i in input().split()]


def main():
    from collections import defaultdict
    n = input_int()
    A = input_int_list()
    cusum = [0] * (n + 1)
    # 累積和をとり、それぞれの現れる合計値の回数をとる
    cnt = defaultdict(int)
    cnt[0] += 1
    for i in range(1, n + 1):
        cusum[i] = cusum[i - 1] + A[i - 1]
        cnt[cusum[i]] += 1
    # 合計値が同じになる２箇所を選ぶと総和が0になる
    # その組み合わせを数え上げる。
    ans = 0
    for _, v in cnt.items():
        if v > 1:
            ans += (v * (v - 1)) // 2
    print(ans)

    return


if __name__ == "__main__":
    main()


Measured memory_bytes: 120400
#include <stdio.h>

int main(void)
{
	int a[3];
	int min;
	int i, j;
	
	for (i = 0; i < 3; i++){
		scanf("%d", &a[i]);
	}
	
	for (i = 0; i < 3; i++){
		min = 0;
		for (j = 1; j < 3; j++){
			if (a[min] > a[j]){
				min = j;
			}
		}
		printf("%d", a[min]);
		if (i < 2){
			printf(" ");
		}
		a[min] = 10001;
	}
	printf("\n");

	return (0);
}



Measured memory_bytes: 2100
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  vector<int> a(5);
  for (int i = 0; i < 5; ++i) scanf("%d", &a[i]);
  sort(a.begin(), a.end());
  int k;
  scanf("%d", &k);
  if (k < a[4] - a[0]) {
    puts(":(");
  } else {
    puts("Yay!");
  }
  return 0;
}


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

int main() {
	ios::sync_with_stdio(false);

	int n, m;

	cin >> n >> m;

	vector<int> plice(n);

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

	priority_queue<int> q;

	for (int i = 0; i < n; i++) {
		q.push(plice[i]);
	}

	int num;

	for (int i = 0; i < m; i++) {
		num = q.top();
		q.pop();
		q.push(num / 2);
	}



	long long int r = 0;

	for (int i = 0; i < n; i++) {
		r += q.top();
		q.pop();
	}

	cout << r;

	return 0;
}

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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    int max = 0;
    int min = INT_MAX;
    for(int i=0;i<n;i++) {
        int a;
        cin>>a;
        if(a>max) max = a;
        if(a<min) min = a;
    }
    cout<<max-min;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<queue>
#include<algorithm>
#include<cstring>
#include<cctype>
#include<vector>
#include<ctime>
#include<cmath>
#include<set>
#include<map>
#define LL long long
#define pii pair<int,int>
#define mk make_pair
#define fi first
#define se second
using namespace std;
const int N = 5e5 + 3;
LL a[N];
LL b[N];
LL n,k;
inline LL read(){
	LL v = 0,c = 1;char ch = getchar();
	while(!isdigit(ch)){
		if(ch == '-') c = -1;
		ch = getchar();
	}
	while(isdigit(ch)){
		v = v * 10 + ch - 48;
		ch = getchar();
	}
	return v * c;
}
inline bool check(LL x){
//	printf("%lld \n",x);
	LL rest = k;
	int rr = n,ll = 1;
	for(int i = 1;i <= n;++i){
		if(a[i] * b[rr] <= x) {rr--;continue;}
		else{
			LL nd = a[i] * b[rr] - x;
			
			nd = nd % b[rr] == 0 ? nd / b[rr] : nd / b[rr] + 1; 
//			printf("%d %lld %lld %d\n",i,nd,rest,rr);
			if(nd >= a[i]) ll++,rest -= a[i]; 
			else rr--,rest -= nd;
			if(rest < 0) return 0;
		}
	}
	return 1;
}
int main(){
	n = read(),k = read();
	for(int i = 1;i <= n;++i) a[i] = read();
	for(int i = 1;i <= n;++i) b[i] = read();
	sort(a + 1,a + n + 1);reverse(a + 1,a + n + 1);
	sort(b + 1,b + n + 1);reverse(b + 1,b + n + 1);
//	for(int i = 1;i <= n;++i) printf("%lld ",a[i]);puts("");
//	for(int i = 1;i <= n;++i) printf("%lld ",b[i]);puts("");
	int cnt = 1;
	LL g = k;
	while(cnt <= n){
		if(a[cnt] > g) break;
		g -= a[cnt];
		cnt++;
	}
	if(cnt == n + 1){
		puts("0");
		return 0;	
	}
	LL l = 1,r = 1000000000000ll,ans;
	while(l <= r){
 		LL mid = (l + r) >> 1;
		if(check(mid))	ans = mid,r = mid - 1;
		else l = mid + 1;
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 5888
/*------------------------- Bism Allah Alruhmin Alrahim -------------------------------*/
#include <bits/stdc++.h>
#define forn(i, n) for (int i = 0; i < n; i++)
#define ford(i, n) for (int i = n - 1; i > -1; i--)
#define forl(i, l, r) for (int i = l; i <= r; i++)
#define vc vector
#define f first
#define s second
#define pb(i) push_back(i)
#define mx(ar, n) (*max_element(ar, ar + n))
#define mn(ar, n) (*min_element(ar, ar + n))

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;


int main()
{
    int n; 
    cin >> n ;
    int x[n] ;
    int w[n] = {0};
    int c = 0 ;
    forn(i,n){
        cin >> x[i] ;    
    }
    // sort(x,x+n);
    forn(i,n){
        c+=x[i];
        w[i] = c;
    }
    int m = INT_MAX;
    forn(i,n-1){
        // cout << w[i] << " - " <<  w[n-1] - w[i]  << " = " << << endl ;
        int d = max(w[i] , w[n-1] - w[i]) -  min(w[i] , w[n-1] - w[i]);
        m = min(d , m);
    }
    cout << m << endl ;
    return 0;
}

// 1 2 4 1 4 7
// 1 3 7 8 12 19
// 1 1 1 3

Measured memory_bytes: 256
n=int(input())
line1=list(map(int,input().split()))
line2=list(map(int,input().split()))
sum1=[0]
for i in line1:
    sum1.append(i+sum1[-1])
sum2=[0]
for i in line2:
    sum2.append(i+sum2[-1])
ans=0
for i in range(n):
    num=sum1[i+1]-sum2[i]+sum2[n]
    ans=max(ans,num)
print(ans)


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

int main() {
  int N, K, x, S = 0;
  
  cin >> N;
  cin >> K;
  
  for (int i = 0; i < N; i++) {
   cin >> x;
   if (x < K - x){
     S += x * 2;
  	}else {
    	S += 2 * (K - x); 
   	}
  }
  cout << S << endl;
}


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



int main() {
#ifndef ONLINE_JUDGE
	//for getting input from input.txt
	freopen("input.txt", "r", stdin);
	//for writing output to output.txt
	freopen("output.txt", "w", stdout);
#endif
	int n; cin >> n;
	vector<int> a(n, 0);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	vector<int> dp(n, 0);
	dp[0] = 0;
	dp[1] = abs(a[0] - a[1]);
	for (int i = 2; i < n; i++) {
		dp[i] = min(abs(a[i - 2] - a[i]) + dp[i - 2], abs(a[i - 1] - a[i]) + dp[i - 1]);
	}
	cout << dp[n - 1];

}

Measured memory_bytes: 4012
#include <iostream>
#include <numeric>
#include <algorithm>
typedef long long ll;
using namespace std;

int gcd(int k, int l){
    if(l % k == 0){
        return k;
    }
    else{
        return gcd(l % k, k);
    }
}

int main()
{
    int n;
    cin >> n;
    ll a[100001];
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    sort(a, a + n);
    for(int i = 1; i < n; i++){
        a[i] = gcd(a[i - 1], a[i]);
    }
    cout << a[n - 1] << endl;
}

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

int main() {
  int a;
  string s;
  cin >> a >> s;
  if (a >= 3200) {
    cout << s << endl;
  } else {
    cout << "red" << endl;
  }

  return 0;
}

Measured memory_bytes: 3588
import socket
import sys

hostnames = ['N551J', 'F551C', 'X553M']
input_file = 'b1.in'
if socket.gethostname() in hostnames:
    sys.stdin = open(input_file)


def read_int_list():
    return list(map(int, input().split()))


def read_int():
    return int(input())


def read_str_list():
    return input().split()


def read_str():
    return input()


def solve():
    n, k = read_int_list()
    res = 0
    while n > 0:
        n //= k
        res += 1
    return res


def main():
    res = solve()
    print(res)


if __name__ == '__main__':
    main()


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

int main() {
  int N;
  cin >> N ;
  string ans;
  
  for (int i = 0; i < N; i++) {
    string S;
    cin >> S;
    
    if(S == "Y"){
      ans ="Four";
      cout << ans << endl;
      break;
    }
  }  
  if(!(ans=="Four")){
    cout << "Three" << endl;}

}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>

using namespace std;

int main() {

    int A,B,C,X;
    cin >> A >> B >> C >> X;
    int out = 0;
    for(int i = 0; i <= A; i++){
        for(int j = 0; j <= B; j++){
            for(int k = 0; k <= C; k++){
                if(500*i + 100*j + 50*k == X) out++;
            }
        }
    }
    cout << out << endl;
    return 0;
}


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

int main() {

	int a, b, c, d;
	cin >> a >> b >> c >> d;
	cout << c - (d - b) << ' ' << d + (c - a) << ' ' << a - (d - b) << ' ' << b + (c - a) << endl;

}

Measured memory_bytes: 256
#[allow(unused_macros)]
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)*}
    };
}

#[allow(unused_macros)]
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)*}
    };

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

#[allow(unused_macros)]
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")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};
#[allow(unused_imports)]
use std::io::{stdout, stdin, BufWriter, Write};

pub fn combination(n: u64, mut k: u64) -> u64 {
    if k > n {
        return 0
    }

    if k * 2 > n {
        k = n - k
    }
    let mut ans = 1;
    for d in 1..k + 1 {
        ans *= n + 1 - d;
        ans /= d;
    }
    ans
}

fn main() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (writeln!(out,$($format)*).unwrap());
    }

    input!{
      a: chars,
    }

    use std::collections::HashMap;
    let mut map = HashMap::new();
    for &c in a.iter() {
        *map.entry(c).or_insert(0) += 1;
    }

    let mut skip = 0;
    for (&k, &v) in map.iter() {
        skip += combination(v, 2);
    }
    let total = combination(a.len() as _, 2);
    let ans = total + 1 - skip;
    puts!("{}", ans);
}


Measured memory_bytes: 4352
using System;
using System.Linq;

namespace atcoder_BegginerContest94_Question3
{
    class Program
    {
        static void Main(string[] args)
        {
            var input1 = int.Parse(Console.ReadLine());
            var input2 = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var array = input2
                    .OrderBy(c => c)
                    .ToArray();
            var m1 = array[input1 / 2 - 1];
            var m2 = array[input1 / 2];

            for (int i = 0; i < input1; i++)
            {
                Console.WriteLine((input2[i] <= m1) ? m2 : m1);
            }
        }
    }
}


Measured memory_bytes: 39004
#include<stdio.h>

int main(){
	int n;scanf("%d",&n);
	int a,i,sum=0;
	
	for(i=0;i<n;i++){
		scanf("%d",&a);
		while(a%2==0){sum++;a/=2;}
	}
	
	printf("%d",sum);
	
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint ungigned
#define db double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pli pair<ll,int>
#define vi vector<int>
#define vpi vector<pii >
#define IT iterator

#define PB push_back
#define MK make_pair
#define LB lower_bound
#define UB upper_bound
#define BG begin
#define ED end

#define For(i,j,k) for (int i=(j);i<=(int)k;i++)
#define Rep(i,j,k) for (int i=(j);i>=(int)k;i++)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));

#define LS3 k*2,l,mid
#define RS3 k*2+1,mid+1,r
#define LS5 k*2,l,mid,x,y
#define RS5 k*2+1,mid+1,r,x,y
#define GET pushdown(k);int mid=(l+r)/2
using namespace std;

const int BAS[5]={233,666,1234,19260817,2017};
const int mo=998244353;
const int N=250005;
struct wzp{
	int a[5];
	bool operator <(const wzp &x)const{
		For(i,0,4)
			if (a[i]!=x.a[i])
				return a[i]<x.a[i];
		return 0;
	}
	bool operator ==(const wzp &x)const{
		For(i,0,4)
			if (a[i]!=x.a[i])
				return 0;
		return 1;
	}
};
int P[5][N*2];
wzp hsh[N];
int pos[N];
long long ans;
map<wzp,int> mp;
char s[N];
int power(int x,int y){
	int s=1;
	for (;y;y/=2,x=1ll*x*x%mo)
		if (y&1) s=1ll*s*x%mo;
	return s;
}
int main(){
	For(i,0,4){
		P[i][0]=1;
		For(j,1,2*N-1)
			P[i][j]=1ll*P[i][j-1]*BAS[i]%mo;
	}
	int beg=N,l; pos[0]=N;
	scanf("%d%s",&l,s+1);
	for (int i=1;i<=l;i++){
		hsh[i]=hsh[i-1];
		if (s[i]=='+') For(j,0,4) hsh[i].a[j]=(hsh[i].a[j]+P[j][beg])%mo;
		if (s[i]=='-') For(j,0,4) hsh[i].a[j]=(hsh[i].a[j]+mo-P[j][beg])%mo;
		if (s[i]=='<') beg--; if (s[i]=='>') beg++; pos[i]=beg;
	}
	for (int i=0;i<=l;i++)
		mp[hsh[i]]++;
	for (int i=0;i<l;i++){
		wzp rpos=hsh[l]; mp[hsh[i]]--;
		For(j,0,4) rpos.a[j]=1ll*rpos.a[j]*power(BAS[j],(mo-1)+pos[i]-pos[0])%mo;
		For(j,0,4) rpos.a[j]=(rpos.a[j]+hsh[i].a[j])%mo;
		ans+=mp[rpos];
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 47360
#include<cstdio>
#include<algorithm>
#define maxn 505
#define LL long long
using namespace std;
int n,k,sum,ans,a[maxn],b[maxn];
inline char nc(){
	static char buf[100000],*L=buf,*R=buf;
	return L==R&&(R=(L=buf)+fread(buf,1,100000,stdin),L==R)?EOF:*L++;
}
inline int read(){
	int ret=0,f=1;char ch=nc();
	while (ch<'0'||ch>'9'){if (ch=='-') f=-1;ch=nc();}
	while (ch>='0'&&ch<='9') ret=ret*10+ch-'0',ch=nc();
	return ret*f;
}
inline bool check(int p){
	for (int i=1;i<=n;i++) b[i]=a[i]%p;
	sort(b+1,b+n+1);
//	LL sx=b[1],sy=p-b[n];
    LL sx=0,sy=0;
	for (int i=1;i<=n;i++)
	if (sx+b[i]<=k) sx+=b[i];
	else sy+=p-b[i];
	return sy<=k;
}
int main(){
	n=read();k=read();
	for (int i=1;i<=n;i++) a[i]=read(),sum+=a[i];
	for (int j=1;j*j<=sum;j++)
	if (sum%j==0){
		if (check(j)) ans=max(ans,j);
		if (check(sum/j)) ans=max(ans,sum/j);
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define all int i=0; i<n; i++
#define pb push_back
#define pf push_front
#define maxheap priority_queue<int>
#define minheap priority_queue<int,vector<int>,greater<int> >
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define endl '\n'
#define mod 1000000007
#define mp make_pair
#define pii pair<int,int>
#define T int t;cin>>t;while(t--)

typedef long long int ll;

bool sortinrev(const pair<ll,ll> &a,  
               const pair<ll,ll> &b) 
{ 
       return (a.first > b.first); 
}

int main(){ 
FAST_IO;
	int n,a,b;
	vector<pii>v;
	cin>>n;
	for(all){
		cin>>a>>b;
		v.pb({b,a});
	}
	sort(v.begin(), v.end());
	int time=0,flag=1;
	for(int i=0; i<n; i++){
		time+=v[i].second;
		if(time>v[i].first){
			flag=0;
			break;
		}
	}
	if(flag==0)cout<<"No"<<endl;
	else cout<<"Yes"<<endl;
}



Measured memory_bytes: 2420
#include<stdio.h>

int main(void){
    int a,b,i,sum=0;

    scanf("%d%d",&a,&b);

    for(i=0; i<2; i++){
        if(a>b){
            sum = sum + a;
            a--;
        }else{
            sum = sum + b;
            b--;
        }
    }
    printf("%d",sum);

    return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define ArraySizeOf(array)     (sizeof(array) / sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define REV(i,n) for(int i=n-1;i>0;i--)
#define req(i,n,m) for(int i=n;i<m;i++)
#define REQ(i,n,m,l) for(int i=n;i<m;i+=l) 
#define _GLIBCXX_DEBUG
int INF = 1e9 + 7;
unsigned NthDayOfWeekToDay(unsigned n, unsigned dow, unsigned dow1)
{
    unsigned day;
    if (dow < dow1) dow += 7;
    day = dow - dow1;
    day += 7 * n - 6;
    return day;
}
signed gcd(int x, int y) {
    if (y == 0)return x;
    return gcd(y, x % y);
}
signed lcm(int x, int y) {
    return x / gcd(x, y) * y;
}
unsigned DayToWeekNumber(unsigned day)
{
    return (day - 1) / 7 + 1;
}
unsigned AnotherDayOfWeek(unsigned day, unsigned day0, unsigned dow0)
{
    return (dow0 + 35 + day - day0) % 7;
}
using namespace std;
signed main() {
    string S; cin >> S;
    int w; cin >> w;
    rep(i, (S.size() + w - 1) / w)cout << S.at(i * w);
    cout << endl << endl;
}

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

int main() {
    char a;
    int N, c = 0, i = 0;
    long long ans = 0;
    while(~scanf("%c",&a)) {
        if(a == 'W') ans += i-c, ++c;
        ++i;
    }
    printf("%lld", ans);
}

Measured memory_bytes: 256
#include<iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>

using namespace std;

int gcd(int p, int q) {
    if (p % q == 0)return q;
    return gcd(q, p % q);
}

int main()
{

    int n, m;
    cin >> n >> m;
    vector<int> num(n, -1);

    vector<int> s(m, 0), c(m, 0);
    for (int i = 0; i < m; i++) {
        cin >> s[i] >> c[i];

        if (num[s[i] - 1] != -1 && num[s[i] - 1] != c[i]) {
            cout << -1;
            return 0;
        }
        num[s[i] - 1] = c[i];
    }


    switch (n) {
    case 1:
        if (num[0] == -1) num[0] = 0;
        cout << num[0];
        break;
    case 2:
        if (num[0] == 0) {
            cout << -1;
            return 0;
        }
        else if (num[0] == -1) {
            num[0] = 1;
        }

        if (num[1] == -1) num[1] = 0;
        cout << num[0] * 10 + num[1];
        break;
    case 3:
        if (num[0] == 0) {
            cout << -1;
            return 0;
        }
        else if (num[0] == -1) {
            num[0] = 1;
        }

        if (num[1] == -1) num[1] = 0;
        if (num[2] == -1) num[2] = 0;
        cout << num[0] * 100 + num[1] * 10 + num[2];
        break;
    }
    return 0;

}



Measured memory_bytes: 3644
using System;
using System.Linq;
using System.Collections.Generic;


class Program
{
    static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine());
        string[] Astr = Console.ReadLine().Split(' ');
        int A;

        string pass = "APPROVED";

        for(int i=0; i<N; i++){
            A = int.Parse(Astr[i]);
            if(A%2==0){
                if(A%3!=0 && A%5!=0) pass = "DENIED";
            }
        }

        Console.WriteLine(pass);
    }
}

Measured memory_bytes: 13140
#!/usr/bin/env python3
s = input()
n = len(s)
k = int(input())
if s.count(s[0]) == n:
    print(n * k // 2)
    exit()
# pre,post を数えた上で前から連続しているやつの長さを数えて和をとる
ans = 0  # k倍する前をおく
cnt = 1
pre, post = 0, 0
pre_bit = 1
for i in range(n - 1):
    if s[i] == s[i + 1]:
        cnt += 1
    else:
        ans += cnt // 2
        if pre_bit:
            pre = cnt
            pre_bit = 0
        cnt = 1

ans += cnt // 2
post = cnt
if s[0] != s[-1]:
    print(ans * k)
else:
    print(ans * k + (k - 1) * (-1 * (pre // 2 + post // 2) + (pre + post) // 2))


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

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

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

int main()
{
    int w,h,x,y,r;
    cin >> w >> h >> x >> y >> r;
    if(x-r<0 || x+r>w || y-r<0 || y+r>h)
    {
        cout << "No" << endl;
    }
    else
    {
        cout << "Yes" << endl;
    }
}


Measured memory_bytes: 3100
import sys
sys.setrecursionlimit(10**9)


N = int(input())
to = [[] for _ in range(N)]

for _ in range(N - 1):
    a, b, c = map(int, input().split())
    a, b, = a - 1, b - 1
    to[a].append((c, b))
    to[b].append((c, a))

Q, K = map(int, input().split())
K -= 1
query = [list(map(lambda x:int(x) - 1, input().split())) for _ in range(Q)]
depth = [0] * N

def dfs(v, d, p=-1):
    depth[v] = d
    for cost, nv in to[v]:
        if nv == p:
            continue
        dfs(nv, d + cost, v)


def main():
    dfs(K, 0)
    for x, y in query:
        print(depth[x] + depth[y])


if __name__ == "__main__":
    main()

Measured memory_bytes: 235996
#include <stdio.h>
#include <algorithm>

using namespace std;

int main(){
	int H,W;
	while(true){
		scanf("%d %d",&H,&W);
		if(H == 0 && W == 0) break;
		for(int i = 0; i < H; i++){
			for(int j = 0; j < W; j++){
				printf("#");
			}
			printf("\n");
		}
		printf("\n");
	}
}



Measured memory_bytes: 2612
#include <iostream>
#include <string>
#include <sstream>
#include <istream>
#include <vector>
using namespace std;

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

	bool flag = false;
	int N = S.size();

	string revS = "";
	for (int i = 0; i < N /2 ; i++)
	{
		revS += S[N -1 -i];
	}

	if (S.substr(0, N / 2) == revS){
		string subS = S.substr(0,(N-1)/2);
		int subS_Size = subS.size();
		string subSrev = "";
		for (int i = 0; i < subS_Size; i++)
		{
			subSrev += subS[subS_Size-1-i];
		}

		if(subS == subSrev){
			string subS2 = S.substr((N+3)/2 -1,N/2);
			int subS2_Size = subS2.size();
			string subS2rev = "";
			for (int i = 0; i < subS2_Size; i++)
			{
				subS2rev += subS2[subS2_Size - 1 - i];
			}
			flag = (subS2 == subS2rev);
		}
	}

	cout << (flag?"Yes":"No") << endl;
	

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    cin.tie(0);
    ios::sync_with_stdio(false);<- これら、printfとかと併用しない方が良さそう

*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);

    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };


// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b){
    double ax=a.first, ay=a.second, bx=b.first, by=b.second;
    return atan2(by-ay, bx-ax);
}

/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */


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

    int n; cin >> n;
    vector<int> a(n), b(n);
    rep(i, n) cin >> a[i];
    rep(i, n) cin >> b[i];

    int const inf = 1<<29;
    vector<vector<int>> dp((1<<n)+1, vector<int>(55, inf));
    dp[0][0] = 0;
    rep(mask, 1<<n) {
        int cnt = __builtin_popcount(mask);
        int itr = cnt;
        vector<pair<int, int>> rem;
        rep(i, n) if (!(mask>>i&1)) rem.emplace_back(i, itr++);

        rep(s, 51) {
            if (dp[mask][s] == inf) continue;
            for(auto p: rem) {
                int ns = -1;
                if (abs(p.first-cnt)%2 == 0) ns = a[p.first];
                else ns = b[p.first];

                if (ns >= s) { chmin(dp[mask | 1<<p.first][ns], dp[mask][s]+(p.second - cnt)); }
            }
        }
    }

    int ans = inf;
    rep(s, 51) chmin(ans, dp[(1<<n)-1][s]);
    cout << (ans==inf? -1:ans) << endl;
    

    return 0;
}

Measured memory_bytes: 67968
using System;

namespace B
{
    class Calc
    {
        public int matricChainOrder(int[] p)
        {
            int n = p.Length-1, i;
            int[,] m = new int[n+1, n+1];
            for (i = 1; i <= n; i++)
            {
                m[i, i] = 0;
            }
            int l, j=0, k, q;
            for (l = 2; l <= n; l++)
            {
                for (i = 1; i <= n - l + 1; i++)
                {
                    j = i + l - 1;
                    m[i, j] = int.MaxValue;
                    for (k = i; k < j; k++)
                    {
                        q = m[i, k] + m[k + 1, j] + p[i - 1] * p[k] * p[j];
                        m[i, j] = min(m[i, j], q);
                    }
                }
            }
            return m[1, n];
        }

        public int min(int m, int q)
        {
            if (m<q)
            {
                return m;
            }
            else
            {
                return q;
            }
        }
    }

    class B
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            int n = int.Parse(input), i;
            string[] input2 = new string[2];
            int[] p = new int[n+1];
            Calc calc = new Calc();
            for (i = 0; i < n; i++)
            {
                input2 = Console.ReadLine().Split(' ');
                p[i] = int.Parse(input2[0]);
                p[i+1] = int.Parse(input2[1]);
            }
            Console.WriteLine(calc.matricChainOrder(p));
        }
    }
}



Measured memory_bytes: 17924
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ALL(x) x.begin(), x.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
random_device rnd;
mt19937 mt(rnd());
using ll = long long;
using lld = long double;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
using PII = pair<int, int>;
const int IINF = 1 << 30;
const ll INF = 1ll << 60;
const ll MOD = 1000000007;

VL memo(2020, -1);

ll calc(int n)
{
    if (memo[n] != -1)
    {
        return memo[n];
    }
    if (n < 3)
    {
        memo[n] = 0;
        return memo[n];
    }
    memo[n] = 1;
    rep(i, 3, n)
    {
        memo[n] += calc(n - i);
        memo[n] %= MOD;
    }
    return memo[n];
}

int main()
{
    int n;
    cin >> n;
    cout << calc(n) << endl;
    return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define PI          acos(-1)
#define INF         100000000
#define sc(n)       scanf("%d",&n);
#define ssc(n)      scanf("%s",n);
#define lsc(n)      scanf("%lld",&n);
#define dsc(n)      scanf("%lf",&n);
#define csc(n)       scanf("%c",&n);
#define LL          long long int
#define UI          unsigned int
#define ULL         unsigned long long int
#define DB          double
#define pii         pair<int,int>
#define VI          vector<int>
#define MII         map<int,int>
#define PB          push_back
#define MP          make_pair
#define M(mx,a)     mx=max(mx,a)
#define IT          ::iterator
#define all(a)      a.begin(),a.end()
#define mems(a,b)   memset(a,b,sizeof(a))
#define F(i,a,b)    for(i=a;i<b;i++)
#define IN(n,aa)    for(i=0;i<n;i++)scanf("%d",&aa[i]);
#define PNT(n,aa)   for(i=0;i<n;i++)printf("%lld ",aa[i]);
#define mod         1000000007
#define NUM         10000009
#define NUM2        1000000000


int main()
{
    int T=1,QQ=0;
    //cin >> T ;
    while(T--)
    {
        int n,i,j,k,x=0,y=0;
        cin >> n ;
        int aa[n],bb[n];
        for(i=0;i<n;i++)sc(aa[i]);
        for(i=0;i<n;i++)sc(bb[i]);
        for(i=0;i<n;i++)if(aa[i]>bb[i])x+=aa[i]-bb[i];
        cout << x ;
    }
}

//printf("Case %d: ",++QQ);


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

int main() {
	int N, M, Q = 0;
	cin >> N >> M;

	for (int i = 0; i < M; i++) {
		int A;
		cin >> A;
		Q += A;
	}
	
	if (Q > N) {
		cout << -1 << endl;
	}
	else cout << N - Q << endl;
}

Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String a = sc.next(), b = sc.next();

		int s = Integer.parseInt(a + b);

		double sqrt = Math.floor(Math.sqrt(s));

		if (sqrt * sqrt == s) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

}

Measured memory_bytes: 22100
#include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
#include <tuple>

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P;

long long int INF = 1e18;
long long int mod = 1000000007;
double Pi = 3.1415926535897932384626;

vector<ll> G[500005];
vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop

int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "RULD";
//↓,→,↑,←

#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<x;
#define re(i,n) for(i=0;i<n;i++);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define deba(x) cout<< #x << " = " << x <<endl

ll rui(ll number1,ll number2){
    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){
    if(number1 > number2){
        swap(number1 , number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1 , number1);
    }
}

ll i,j,k,ii,jj,n,m,a,b,c,d,e,f,g,h,r,w,l;
ll num,ans,sum,ok,ng;
ll x[500005],y[500005],z[500005];
char s[500005],t[500005],u[500005];
bool dame,flag;

int main(){
	cin >> n;
	for(i=0;i<n;i++){
		cin >> x[i];
	}
	sort(x,x+n);
	for(i=0;i<n-1;i++){
		a += x[i];
	}
	if(x[n-1] >= a){
		p("No");
	}else{
		p("Yes");
	}
	return 0;
}


Measured memory_bytes: 26624
#include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
  cin >> s;
int ans=0;
  for(int i=0;i<s.size()-1;++i)
  {
  if(s.at(i)!=s.at(i+1)) ans++;
  }
  cout << ans;
return 0;}

Measured memory_bytes: 3736
#include <bits/stdc++.h>
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
using i64 = int64_t;
using f80 = __float80;
static const int dy[4] = {0,1,0,-1}, dx[4] = {1,0,-1,0};
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
#define _overload3(_1,_2,_3,name,...) name
#define repi(i,start,end) for(i64 i=(start);i<(end);++i)
#define _rep(i,n) repi(i,0,n)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,start,end) for(i64 i=(start);i>end;--i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define v(T) vector<T>
#define vv(T) v(v(T))
typedef v(i64) vi;
typedef v(vi) vvi;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream &operator<<(ostream &os, const vector< T > &v){
  rep(i,v.size()) os << v[i] << (i + 1 != v.size() ? " " : "");
  return os;
}
template<typename T> istream &operator>>(istream &is, vector< T > &v){
  for(T &in : v) is >> in;
  return is;
}

void Main()
{
  i64 H, W;
  cin >> H >> W;
  v(string) ans;
  ans.emplace_back(string(W+2,'#'));
  string s;
  rep(i,H){
    cin >> s;
    ans.emplace_back("#" + s + "#");
  }
  ans.emplace_back(string(W+2,'#'));
  rep(i,H+2){
    cout << ans[i] << "\n";
  }
}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

def main():
    N = int(input())
    s = input().strip()

    ans = 0
    tmp = 0
    for i in range(N):
        if s[i] == "I":
            ans += 1
        else:
            ans -= 1
        tmp = max(tmp, ans)
    print(tmp)


if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//#include<boost/multiprecision/cpp_dec_float.hpp>
//namespace mp=boost::multiprecision;
//#define mulint mp::cpp_int
//#define mulfloat mp::cpp_dec_float_100
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
//constexpr int MOD=1000000007;
constexpr int MOD=998244353;
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcountll(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
#define fi first
#define se second
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};
const int MAX_N=2e5+5;
//struct edge{lint to,num;};
//vector<int> bucket[MAX_N/1000];

int main(void){
    int A,B,C;
    cin >> A >> B >> C;
    if(A==B) cout << C << endl;
    else if(B==C) cout << A << endl;
    else cout << B << endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
using ll = int_fast64_t;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;
#define fast() ios::sync_with_stdio(false), cin.tie(nullptr)
#define digit(N) cout << fixed << setprecision((N))
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

// 1 - indexed
template <typename T>
struct BIT
{
   vector<T> bit;

   BIT(int sz) : bit(sz + 1, 0) {}

   // sum of [1, k]
   T sum(int k)
   {
      T res = 0;
      for (int x = k; x > 0; x -= x & -x)
         res += bit[x];
      return res;
   }

   void add(int k, T w)
   {
      for (int x = k; x < bit.size(); x += x & -x)
         bit[x] += w;
   }

   // sum of [x, y)
   T getSum(int x, int y)
   {
      return sum(y - 1) - sum(x - 1);
   }

   // find an index i s.t. a[1] + a[2] + ⋯ + a[x] ≧ w
   T lower_bound(T w)
   {
      if (w <= 0)
         return 0;

      T x = 0;
      int p = 1, N = bit.size();

      while (2 * p <= N)
         p *= 2;

      for (T k = p; k > 0; k /= 2)
      {
         if (x + k <= N && bit[x + k] < w)
         {
            w -= bit[x + k];
            x += k;
         }
      }

      return x + 1;
   }
};

int main()
{
   fast();

   int N, Q;
   cin >> N >> Q;
   vector<int> c(N + 1);
   for (int i = 0; i < N; i++)
   {
      cin >> c[i + 1];
   }

   vector<vector<pair<int, int>>> queries(N + 1, vector<pair<int, int>>());

   for (int i = 0; i < Q; i++)
   {
      int l, r;
      cin >> l >> r;
      queries[l].emplace_back(r, i);
   }

   vector<priority_queue<int, vector<int>, greater<int>>> pos(N + 1);

   for (int i = 1; i <= N; i++)
   {
      pos[c[i]].push(i);
   }

   BIT<int> bit(N + 1);

   for (int i = 1; i <= N; i++)
   {
      if (pos[i].empty())
         continue;
      bit.add(pos[i].top(), 1);
      pos[i].pop();
   }

   vector<int> ans(Q);

   for (int l = 1; l <= N; l++)
   {
      for (auto q : queries[l])
      { // 左端がlのクエリ
         int R = q.first + 1, ind = q.second;
         ans[ind] = bit.getSum(l, R);
      }

      bit.add(l, -1);
      if (pos[c[l]].empty())
         continue;

      int nxt = pos[c[l]].top();
      pos[c[l]].pop();
      bit.add(nxt, 1);
   }

   for (int i = 0; i < Q; i++)
   {
      cout << ans[i] << "\n";
   }
}

Measured memory_bytes: 62588
#include<iostream>
#include<vector>

using namespace std;

int main(){
    int n, m, a, b;
    cin >> n >> m;

    vector<int> city(n+1);
    for(int i = 0; i < m; i++){
        cin >> a >> b;
        city[a]++;
        city[b]++;
    }

    for(int i = 1; i < n + 1; i++) cout << city[i] << endl;
}

Measured memory_bytes: 3632