akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
 
 
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//pair sort
bool compare_by_b(pair<LL, LL> a, pair<LL, LL> b) {
    if(a.second != b.second) return a.second < b.second;
    else return a.first < b.first;
}
std::uint32_t euclidean_gcd(std::uint32_t a, std::uint32_t b){return b != 0 ? euclidean_gcd(b, a % b) : a;}

const string YES = "Yes";
const string NO = "No";

void solve(long long K, long long X){
    if(500*K>= X )cout<<YES<<endl;
    else cout<<NO<<endl;
}

int main(){
    long long K;
    scanf("%lld",&K);
    long long X;
    scanf("%lld",&X);
    solve(K, X);
    return 0;
}


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

const long long X = 1000000000;

long long S;
int main(){
	scanf("%lld", &S);
	
	if(S == X * X){
		printf("0 0 %lld 0 0 %lld\n", X, X);
	}else{
		printf("0 1 %lld 0 %lld %lld\n", X, S % X, S / X + 1);
	}
	
	return 0;
}


Measured memory_bytes: 256
n = int(input())
S = list(input())
ans = S.count('.')
s = S.count('#')
d = ans
ss = 0
dd = 0
for i in range(n):
    if (S[i] == '#'):
        ss += 1
    else:
        dd += 1
    ans = min(ss + d - dd, ans)


print(ans)

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

using namespace std;

typedef long long ll;

int main()
{
	std::ios::sync_with_stdio(false);
    cin.tie(0);
	int w,a,b;
	cin >> w >> a >> b;
	if(a>b) swap(a,b);
	int ans = max(0,b-(a+w));
	cout << ans << "\n";
    
	return 0;
}

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

int main() {
	int N;
	cin >> N  ;
	if (N >= 64 && 100 >= N)
	{
		cout << 64 << endl;
	}
	if (N >= 32 && 63 >= N)
	{
		cout << 32 << endl;
	}
	if (N >= 16 && 31 >= N)
	{
		cout << 16 << endl;
	}
	if (N >= 8 && 15 >= N)
	{
		cout << 8 << endl;
	}
	if (N >= 4 && 7 >= N)
	{
		cout << 4 << endl;
	}
	if (N >= 2 && 3 >= N)
	{
		cout << 2 << endl;
	}
	if (N == 1)
	{
		cout << 1 << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,m;
  cin >> n >> m;
  int k[10];
  int s[10][10];
  int p[10];
  
  for(int i=0; i<m; i++){
    cin >> k[i];
    for(int j=0; j<k[i]; j++){
      int x;
      cin >> x;
      s[i][j] = x-1;
    }
  }
  for(int i=0; i<m; i++){
    cin >> p[i];
  }
  
  int ans=0;
  for (int bits=0; bits < (1<<n); bits++) {
    bool flag = true;
    for(int i=0; i<m; i++){
      int sum=0;
      for(int j=0; j<k[i]; j++){
        sum += ((bits>>s[i][j])& 1);
      }
      //cout << bits << " " << sum << endl;
      if(sum%2 != p[i]) flag = false;      
     }
    if (flag) ans += 1;
   } 
  cout << ans;
}
 

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<tr1/unordered_map>
#define pb push_back
#define pii pair<int,int>
#define SZ(x) (int)x.size()
#ifdef __linux__
#define getchar getchar_unlocked
#endif
#define mem(a,b) memset(a,b,sizeof(a))
#define  For(i,a,b) for(int i=a,i##E=b;i<=i##E;++i)
#define rFor(i,a,b) for(int i=a,i##E=b;i>=i##E;--i)
typedef long long LL;
using namespace std;
const int inf=0x3f3f3f3f;
template<typename T>inline bool chkmin(T &a,const T &b){return a>b?a=b,1:0;}
template<typename T>inline bool chkmax(T &a,const T &b){return a<b?a=b,1:0;}
template<typename T>inline void read(T &x)
{
	x=0;int _f(0);char ch=getchar();
	while(!isdigit(ch))_f|=(ch=='-'),ch=getchar();
	while( isdigit(ch))x=x*10+ch-'0',ch=getchar();
	x=_f?-x:x;
}
inline void file()
{
#ifdef ztzshiwo
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
#endif
}
LL X,Y,ans;
int main()
{
	file();
	read(X),read(Y);
	ans=1;
	while(X*2<=Y)X*=2,ans++;
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 256
h, w, a, b = gets.split.map(&:to_i)
arr = Array.new(h).map{Array.new(w, 1)}

for i in 0..(2*b-1)
  for j in 0..(2*a-1)
    arr[i][j] = ((i/b) + j/a) % 2
  end
end

for i in 0..(b-1)
  for j in 2*a..(w-1)
    arr[i][j] = 0
  end
end
for i in 2*b..(h-1)
  for j in 0..(a-1)
    arr[i][j] = 0
  end
end

for i in 0..(h-1)
  puts arr[i].join
end

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

//--------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX/3

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

//--------------------------------------------

int main(){
  LL a,b,x;

  scanf("%lld %lld %lld",&a,&b,&x);

  if (a % x == 0) printf("%lld\n",(b / x) - (a / x) + 1);
  else printf("%lld\n",(b / x) - (a / x));
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define sqr(x) ((x)*(x))
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define ld long double
#define vi vector<int>
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define debuge cerr<<"isok"<<endl
#define debug(x) cerr<<#x<<"="<<x<<endl
#define SS second
#define FF first
#define ls (k<<1)
#define rs (k<<1|1)
#define inf 0x3f3f3f3f
#define clr(a,x) memset(a,x,sizeof(a))
#define cpy(a,x) memcpy(a,x,sizeof(a))
#define file(x) freopen(x".in","r",stdin),freopen(x".out","w",stdout);
using namespace std;

const int N=100005,M=100005,mod=1e9+7;
template<class T> inline void gmin(T &x,const T &y){if(x>y) x=y;}
template<class T> inline void gmax(T &x,const T &y){if(x<y) x=y;}
inline void ch(int &x,int y){x=(x+y)%mod;}
inline void read(int &x){
	x=0;char ch=getchar(),rev=0;
	while(ch>'9'||ch<'0') rev=(ch=='-'),ch=getchar();
	while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
	x=rev?-x:x;
}
inline int exp(int x,int y){
	int ans=1;
	while(y){
		if(y&1) ans=(ll)ans*x%mod;
		x=(ll)x*x%mod;y>>=1;
	}return ans;
}

int n,m,a[N],b[N],du[N],ans;
bool vis[N],isok;
vi g[N];
map<int,int> to,sum;

inline void dfs(int x){
	vis[x]=1;
	if(x==to[a[n]]) isok=1;
	for(int y:g[x])
		if(!vis[y]) dfs(y);
}

int main(){
#ifdef rqgao2014
	freopen("input.txt","r",stdin);
#endif
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	for(int i=1;i<=n;i++) scanf("%d",&b[i]);
	for(int i=1;i<=n;i++) a[n+1]^=a[i],b[n+1]^=b[i];
	++n;
	for(int i=1;i<=n;i++){
		sum[a[i]]++,sum[b[i]]--;
		if(!to[a[i]]) to[a[i]]=++m;
	}
	for(int i=1;i<=n;i++)
		if(sum[a[i]]){puts("-1");return 0;}
	for(int i=1;i<n;i++)
		if(a[i]!=b[i]){
			g[to[a[i]]].pb(to[b[i]]);
			du[to[a[i]]]++;du[to[b[i]]]++;
			ans++;
		}
	if(!ans){puts("0");return 0;}
	g[to[a[n]]].pb(to[b[n]]);
	du[to[a[n]]]++;du[to[b[n]]]++;
	ans++;
	for(int i=1;i<=m;i++)
		if(!vis[i]&&du[i]){
			isok=0;dfs(i);
			if(!isok) ans++; else ans--;
		}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 18432
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int x,y;
    cin>>x>>y;
    int sum=0;
    if(x==3)
    {
        sum=100000;
    }
    else if(x==2)
    {
        sum=200000;
    }
    if(y==3) sum+=100000;
    else if(y==2) sum+=200000;
    if(x==1 && y==1) sum=1000000;
    else if(x==1 && y!=1) sum+=300000;
    else if(x!=1 && y==1) sum+=300000;
    cout<<sum<<endl;
}


Measured memory_bytes: 384
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <deque>
#include <numeric>
#include <sstream>
#include <iomanip>
using lint = long long;

int main()
{
    lint n;
    scanf("%lld", &n);

    std::vector<lint> a(n);
    std::vector<lint> b(n);

    for (int i = 0; i < n; ++i)
    {
        scanf("%lld", &a[i]);
    }
    for (int i = 0; i < n; ++i)
    {
        scanf("%lld", &b[i]);
    }

    lint a_sum = std::accumulate(a.begin(), a.end(), 0ll);
    lint b_sum = std::accumulate(b.begin(), b.end(), 0ll);

    lint margin = b_sum - a_sum;

    if (margin < 0ll)
    {
        printf("No");
        return 0;
    }

    lint a_num = 0;
    lint b_num = 0;

    for (int i = 0; i < n; ++i)
    {
        lint ae = a[i];
        lint be = b[i];

        if (ae > be)
            b_num = b_num + ae - be;
        else if (ae < be)
        {
            if ((be - ae) % 2ll == 0)
            {
                a_num = a_num + (be - ae) / 2ll;
            }
            else
            {
                a_num = a_num + (be - ae) / 2ll + 1;
                b_num++;
            }
        }
        if (a_num > margin || b_num > margin)
        {
            printf("No");
            return 0;
        }
    }

    if ((margin - b_num) == (margin - a_num) * 2ll)
    {
        printf("Yes");
    }
    else
    {
        printf("No");
    }

    return 0;
}


Measured memory_bytes: 888
a = Array.new(3) {  gets.chomp.split.map(&:to_i) }.flatten
n = gets.to_i
c = Hash.new(false)
n.times do |_|
  b = gets.to_i
  i = a.find_index(b)
  c[1 + i] = true if !i.nil?
end
diag = (c[1] && c[5] && c[9]) || (c[3] && c[5] && c[7])
vert = (1..3).any? {|i| c[i] && c[i + 3] && c[i + 6] }
horizon = (0..2).any? {|i| c[3 * i + 1] && c[3 * i + 2] && c[3 * i + 3] }
puts (diag || vert || horizon)? "Yes" : "No"

Measured memory_bytes: 1788
// Author: Jinhai Chen
#include <cstring>
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
const int INF = 0x3f3f3f3f;
typedef long long ll;

char a[1000],b[1000],c[1000];

int main() {
#ifdef CJHCJH
	freopen("data.in","r",stdin);
#endif
	int n;
	scanf("%d",&n);
	scanf("%s",a);
	scanf("%s",b);
	scanf("%s",c);
	ll ans=0;
	for(int i=0;i<n;i++) {
		if(a[i]==b[i] && b[i]==c[i]) ;
		else if(a[i]==b[i] || b[i]==c[i] || a[i]==c[i]) ans++;
		else ans+=2;
	}
	cout<<ans<<endl;


	return 0;
}














Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <vector>
#include <iomanip>
#include <stdlib.h>

using namespace std;

#define LL long long
#define FOR(i,l,r) for(int i = l; i <= r; ++i)
#define REP(i,l,r) for(int i = l; i < r; ++i)
#define pi pair<int,int>
#define mp make_pair

const int maxN = 1e5 + 11;
const LL oo = 1e17 + 11;

int N,K,M = 0;
LL A,B,D[maxN];
vector <LL> listA,listCD;

int res = 0;
LL R[maxN];

LL gcd(LL x, LL y){
    if(y == 0) return x;
    return gcd(y,x % y);
}

int cur = 0;
LL temp[maxN];

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie();
    cout.tie();
    //
    cin >> A >> B;
    for(LL i = 2; i * i <= A; ++i){
        if(A % i == 0){
            listA.push_back(i);
            while(A % i == 0) A /= i;
        }
    }

    if(A > 1) listA.push_back(A);

    REP(i,0,listA.size()) if(B % listA[i] == 0) D[++M] = listA[i];
    //
    cout << M + 1;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <set>
#include <string>
#include <vector>
#include <algorithm>
#define rep(i, N) for (int i=0; i<(int)N; i++)
#define rep1(i, N) for (int i=1; i<(int)N; i++)

using namespace std;

int N;

int main() {
  cin >> N;
  int X[N];
  rep(i, N) {
    cin >> X[i];
  }
  
  int ans = int(1e7);
  int now;
  rep(i, 101) {
    now = 0;
    rep(j, N) {
      now += (X[j]-i)*(X[j]-i);
    }
    if (now < ans) ans = now;
  }
  cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

vector<int> to[200005];
vector<int> ans;

void dfs(int v, int p=-1){
  for (int u : to[v]){
    if (u == p) continue;
    ans[u] += ans[v];
    dfs(u,v);
  }
}

int main() {
  int n,q;
  cin >> n >> q;
  
  rep(i,n-1){
    int a,b;
    cin >> a >> b;
    a--, b--; //0-indexedにするために引いておく
    
    //双方向の隣接点を持たせる  
    to[a].push_back(b);
    to[b].push_back(a);
  }
  ans.resize(n);
  
  rep(i,q){
    int p,x;
    cin >> p >> x;
    p--;
    ans[p] += x;
  }
  
  dfs(0);
  rep (i,n){
    cout << ans[i] << endl;
  }
  
  return 0;
}

Measured memory_bytes: 23424
h, w = map(int,input().split())
s = [list(input()) for _ in range(h)]

for i in range(h):
    for j in range(w):
        count = 0
        if s[i][j] == '#':
            continue
        for n, m in ([-1,1],[-1,0],[-1,-1],[0,1],[0,-1],[1,1],[1,0],[1,-1]):
            if i + n < 0 or i + n >= h or j + m < 0 or j + m >= w:
                continue
            if s[i+n][j+m] == '#':
                count += 1
        s[i][j] = str(count)

ans = ''
for i in range(h):
    c = ''.join(s[i])
    ans += c
    if i != h-1:
        ans += '\n'
print(ans)

Measured memory_bytes: 3188
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#define ll long long
#define INF 0x3f3f3f3f
#define SIS std::ios::sync_with_stdio(false)
using namespace std;

int main()
{
    ll a,b;
    while(cin>>a>>b)
    {
        ll eight,ten=b*10;
        if((a*125)%10==0)
            eight=a*125/10;
        else
            eight=a*125/10+1;
        ll price=max(eight,ten);
        double x=price*0.08,y=price*0.1;
        if((ll)x==a&&(ll)y==b)
            cout<<price<<endl;
        else
            cout<<"-1"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;

const pii Dir[8] = { //?????????
	{ 0,1 },{ 1,0 },{ 0,-1 },{ -1,0 },
	{ 1,1 },{ 1,-1 },{ -1,-1 },{ -1,1 }
};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*) array, (T*) (array + N), val);
}

signed main() {	
	ll n, x;
	scanf("%lld %lld", &n, &x);

	ll bef;
	ll ans = 0;
	REP(i, n) {
		ll cur;
		scanf("%lld", &cur);

		if (i > 0) {
			if (bef + cur > x) {
				ans+= (bef + cur) - x;
				cur -= (bef+cur)-x;
				if (cur < 0) {
					cur = 0;
				}
			}
		}
		bef = cur;
	}
	
	printf("%lld\n", ans);

	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
 
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
typedef int ftype;
typedef complex<ftype> point;
 
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second 
#define debug(x)  do{cerr<<#x<<": "<<x<<"\n";}while(0)
#define debugv(x) do{cerr<<#x<<": ";for(auto&e: (x))cerr<<e<<" ";cerr<<"\n";}while(0)
#define fori(i, n) for (int i = 0; i < (int)(n); ++i)
#define forn(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n); i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define FAIL0 {cout << "0\n"; return 0;}
#define FAIL1 {cout << "-1\n"; return 0;}
#define FAILNO {cout << "No\n"; return 0;}
#define YES {cout << "Yes\n"; return 0;}

const int MAXN = 1e5+5;
const int MOD = 1e9+7;

int N;
double A[51];

int main() {
#ifdef OJ
    freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin >> N;
    fori(i,N) cin >> A[i];
    sort(A,A+N);
    
    double ans = (A[0]+A[1])/2;
    fore(i,2,N-1) ans = (ans + A[i])/2;

    cout << setprecision(10) << ans << endl;
    return 0;
}


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

N = int(input())
g = [0] * (N + 1)
for i in range(N):
    g[i + 1] = int(input())
cnt = 0
now = 1
for i in range(10 ** 5):
    cnt += 1
    now = g[now]
    if now == 2:
        print(cnt)
        sys.exit()
print(-1)


Measured memory_bytes: 7108
#include<stdio.h>
int dp[105][10051];
int main(void){
	int n,w;
	int i,j;
	scanf("%d %d",&n,&w);
	for(i=0;i<=n;i++){
		for(j=0;j<=w;j++){
			dp[i][j]=-1;
		}
	}
	dp[0][0]=0;
	for(i=0;i<=n;i++){
		int a,b;
		scanf("%d %d",&a,&b);
		for(j=0;j<=w;j++){
			if(dp[i][j]>=0 && dp[i+1][j+b]<dp[i][j]+a && j+b<=w){
				dp[i+1][j+b]=dp[i][j]+a;
			}
		}
		for(j=0;j<=w;j++){
			if(dp[i+1][j]<dp[i][j]){
				dp[i+1][j]=dp[i][j];
			}
		}/*
		for(j=0;j<=w;j++){
			printf("%d ",dp[i][j]);
		}
		printf("\n");*/
	}
	int max=0;
	for(j=0;j<=w;j++){
		if(dp[n][j]>max){
			max=dp[n][j];
		}
	}
	printf("%d\n",max);
	return 0;
}

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

using namespace std;

#define int long long
#define INF 21000000000

signed main(){
                int n,k;
                cin >> n >> k;
                int ans = 0;
                for(int i=0;i<n;i++){
                                int tmp;
                                cin >> tmp;
                                if(tmp >= k) ans++;
                }
                cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define all(x) (x).begin(), (x).end()
#define endl '\n'
const ll inf = LLONG_MAX;
const long double pi = M_PI;
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

int main() {
  string w;
  cin >> w;
  ll n = w.size();
  map<char, ll> m;
  for (ll i = 0; i < n; i++) {
    m[w[i]]++;
  }
  for (char c = 'a'; c <= 'z'; c++) {
    if (m[c] % 2 == 0) {
      //cout << c << " : " << m[c] << endl;
      continue;
    }
    No();
    return 0;
  }
  Yes();
}

Measured memory_bytes: 256
def input_from_console():
    a, b, h, m = map(int, input().split())
    return a, b, h, m

from math import pi, cos, sin, sqrt, degrees

dh = 2 * pi / 12
dm = 2 * pi / 60

def solve(a, b, h, m):
    long_theta = dm * m
    short_theta = dh * h + dm/12 * m
    ly, lx = b * cos(long_theta), b * sin(long_theta)
    sy, sx = a * cos(short_theta), a * sin(short_theta)
    return sqrt((lx - sx)**2 + (ly - sy)**2)


def main():
    a, b, h, m = input_from_console()
    print(solve(a, b, h, m))


if __name__ == "__main__":
    import sys

    if sys.gettrace():  # Check if the python interpreter is in debug mode or not.
        check_cases()
    else:
        main()

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

int main(){
int a,b,c,d;
  cin >> a >> b >> c >> d;
if(b<=c | a>=d)cout << 0 << endl;  
else{
int s=max(a,c);
int t=min(b,d);
  cout << t-s << endl;
}
}  


Measured memory_bytes: 3564
import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner stdIn = new Scanner(System.in);
        int N = stdIn.nextInt();
        int M = stdIn.nextInt();
        int[] A = new int[M];
        int Study_sum = 0;


        for (int i = 0; i<M; i++){
            A[i] = stdIn.nextInt();
        }
        
        for(int i=0; i<M; i++){
            Study_sum += A[i];
        }


        if ((N-Study_sum)>=0){
            System.out.print(N-Study_sum);
        }
        else{
            System.out.print("-1");
        }
    }
}

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

int main(){
    using namespace std;
    unsigned long A, B, C, D;
    cin >> A >> B >> C >> D;
    puts(2 * ((A + D - 1) / D) + 1 > 2 * ((C + B - 1) / B) ? "Yes" : "No");
    return 0;
}

Measured memory_bytes: 3636
N = int(input())

alList = list('abcdefghijklmnopqrstuvwxyz')

x = 1
y = 26
z = 0
while N > y:
	z += 26**x
	x += 1
	y += 26**x
if N > 26:
	tmp = N - (z+1)
else:
	tmp = N - 1
ans = []
while tmp > 0:
	ans.append(tmp%26)
	tmp = tmp//26
str = ''
for al in ans:
	str = alList[al] + str
while len(str) < x:
	str = 'a' + str
print(str)

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

int main() {
  int count=0;
  int K,X;
  cin>>K>>X;
  if(500*K<X){
    cout<<"No";
  }
  else{
    cout<<"Yes";
  }
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
	int L, R, d;
	cin >> L >> R >> d;

	int result = 0;
	for(int i = L; i <= R; i++) {
		if(i % d == 0) {
			result++;
		}
	}

	cout << result << endl;

	return 0;
}


Measured memory_bytes: 3616
def main():
    from collections import deque
    import sys

    input = sys.stdin.readline

    n,m,k = map(int,input().split())

    fre = [[] for i in range(n)]

    for i in range(m):
        a,b = map(int,input().split())
        fre[a-1].append(b-1)
        fre[b-1].append(a-1)

    group = [-1]*n
    def check():
        dic = {}
        count = 1
        for i in range(n):
            if group[i] == -1:
                a = dfs(i,count)
                dic[count] = a
                count += 1
        return group,dic

    def dfs(i,count):
        num = 0
        group[i] = count
        q = deque([])
        q.append(i)
        while q:
            bef = q.pop()

            for nex in fre[bef]:
                if group[nex] == -1:
                    group[nex] = count
                    q.append(nex)
                    num += 1
        return num
    group,dic = check()
    ans = []
    for i in range(n):
        a = group[i]
        ans.append([dic[a]-len(fre[i]),a])
    for i in range(k):
        a,b = map(int,input().split())
        a -= 1
        b -= 1
        if ans[a][1] == ans[b][1]:
            ans[a][0] -= 1
            ans[b][0] -= 1
    for i,j in ans:
        print(i,end=" ")

if __name__ == "__main__":
    main()



Measured memory_bytes: 39740
/* Great things never come from comfort zones,
"whatever the mind of a man can conceive and believe,it can achieve." */
 
#include <bits/stdc++.h>
#define ll long long
#define scf(n) scanf("%d",&n)
#define lscf(n) scanf("%lld",&n)
#define lpri(n) printf("%lld ",n)
#define pri(n) printf("%d ",(int)n)
#define prin(n) printf("%d\n",(int)n)
#define lprin(n) printf("%lld\n",n)
#define rep(i,ini,n) for(int i=ini;i<(int)n;i++)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define inf INT_MAX
#define ninf INT_MIN
#define gcd __gcd
#define bitcount(n) __builtin_popcount(n)
typedef double dd;
using namespace std;
const ll mod =1e9+7;
const int N = 1e6+7;
 
 
int main()
{
    int n,k;
    scf(n),scf(k);
    
    set<int>s;
    
    while(k--)
    {
        int d;
        scf(d);
        
        rep(i,0,d)
        {
            int t;
            scf(t);
            
            s.insert(t);
        }
        
        
    }
    
    int ans=n-s.size();
    
    prin(ans);
    
    

     
}

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

int main() {
    int n, k; cin >> n >> k;
    int x, sum = 0;
    rep(i, 0, n) {
        cin >> x;
        if (k / 2 >= x) {
            sum += x * 2;
        } else {
            sum += (k - x) * 2;
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
H, W, N = map(int, input().split())
sr, sc = map(int, input().split())
S = list(input())
T = list(input())

# 青木くんが左に動かせるということは、駒の生存可能範囲の右端を1つのばせる
# 高橋くんが左に動かせるということは、駒の生存可能範囲の左端を1つ縮める
l = 1
r = W
u = 1
d = H
for s, t in zip(S[::-1], T[::-1]):
    if t in ('L', 'R'):
        if t == 'L':
            r = min(r + 1, W)
        else:
            l = max(1, l - 1)
    else:
        if t == 'U':
            d = min(d + 1, H)
        else:
            u = max(u - 1, 1)

    if s in ('L', 'R'):
        if s == 'L':
            l += 1
        else:
            r -= 1
    else:
        if s == 'U':
            u += 1
        else:
            d -= 1
    if l > r or u > d:
        print('NO')
        exit()

if l <= sc <= r and u <= sr <= d:
    print('YES')
else:
    print('NO')


Measured memory_bytes: 10600
#include<iostream>
#include<algorithm>
#include<math.h>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<functional>
#include<map>
#include<set>
#include <string>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
map<string, int> mp;
#define ll long long

int main() {
    ll n, m;
    cin >> n >> m;
    int a[100000], b[100000];
    ll aa=0;
    ll ans=0;
    rep(i, n) {
        cin >> a[i];
        aa += a[i];
    }
    rep(i, m) {
        cin >> b[i];
    }
    rep(i, m) {
        ans += aa * b[i];
    }
    cout << ans << endl;
    return 0;
}


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

#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
#define rep2(i,s,n) for(long long i=(s); i<(long long)(n);i++)
#define mod 1000000007

int main() {

    string a,b;cin>>a>>b;
    int ans=0;

   rep(i,3){

       if(a[i]==b[i]){
           ans++;
       }
   }
   cout<<ans<<endl;

}



Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

use std::cmp::{max, min};
use std::collections::HashMap;

fn gcd(a: i64, b: i64) -> i64 {
  if a % b == 0 {
    b
  } else {
    gcd(b, a % b)
  }
}

fn lcm(a: i64, b: i64) -> i64 {
  a * b / gcd(a, b)
}

fn main() {
  let x = read::<i64>();
  let a = read::<i64>();
  let b = read::<i64>();
  println!("{}", (x - a) % b);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int main(){
    int k, x;
    cin >> k >> x;
    k *= 500;
    if (k >= x) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <vector>
#include <bitset>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <deque>
#include <string>
#include <list>
#include <iterator>
#include <algorithm>
#include <unordered_map>
#define int                long long
#define pb                 push_back
#define pi                 pair<int,int>
#define vi                 vector<int>
#define all(v)             v.begin(),v.end()
#define MOD                1000000007
#define F                  first
#define S                  second
#define FOR(i,r)           for(int i=0;i<r;i++)
#define REP(i,l,r)         for(int i=l;i<r;i++)
#define RER(i,l,r)         for(int i=l;i>=r;i--)
#define print(v)           for(auto i : v)cout << i << ' ';
#define FASTIO             ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mem(arr,k)         memset(arr,k,sizeof(arr));
#define pii                acos(-1.0)
#define PI                 3.1415926535897932385
#define Sin(a)             sin((pi*a)/180)
#define test()             int x;cin >> x;while(x--){solve();}
#define test2()            int x;cin >> x;for(int i=1;i<=x;i++){cout << "Case #" << i << " : ";solve();}
#define watch(x)           cout << (#x) << " is " << (x) << endl
using namespace std;


/* Mathematical Functions */
int power(int x,int y);
bool isPrime(int n);
int modInv(int a,int b);
int gcdExtended(int a,int b,int *x,int* y);
int mpower(int a,int b,int p);

const int inf = (int)1e17;
const int N = (int)3e5+5;
int rec(int h){
  if(h == 1)
    return 1;
  return 2*rec(h/2)+1;
}
int32_t main(){

  
  FASTIO;
  int n;
  cin >> n;
  cout << rec(n);
    return 0;

}
int modInv(int a, int m)
{
int x, y;
int g = gcdExtended(a, m, &x, &y);
int res = (x%m + m) % m;
return res;
}
 
int gcdExtended(int a, int b, int *x, int *y)
{
if (a == 0){
    *x = 0, *y = 1;
    return b;
  }
  int x1, y1;
  int gcd = gcdExtended(b%a, a, &x1, &y1);
  *x = y1 - (b/a) * x1;
  *y = x1;
  return gcd;
}
 
int mpower(int x, int y, int p)
{
int res = 1;
x = x % p;
while(y > 0){
    if(y & 1) res = (res*x) % p;
      y = y>>1;
      x = (x*x) % p;
    }
    return res;
}
int power(int x, int y)
{
int res = 1;
while (y > 0){
    if (y & 1) res = res*x;
      y = y>>1;
      x = x*x;
    }
    return res;
}
 
bool isPrime(int n)
{
if (n <= 1)  return false;
  if (n <= 3)  return true;
    if (n%2 == 0 || n%3 == 0) return false;
      int p=sqrt(n);
      for(int i=5;i<=p;i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
          return false;
      return true;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,i,e,f,g,n,m,k,l,A[100005],dp[100005][5],B[100005],C[100005];
int main()
{
           cin>>n;
           for(long long i=1;i<=n;i++)
           cin>>A[i]>>B[i]>>C[i];
           dp[1][1]=A[1]; dp[1][2]=A[2]; dp[1][3]=A[3];
           for(long long i=1;i<=n;i++)
           {
           dp[i][1]=max(dp[i-1][2],dp[i-1][3])+A[i];
           dp[i][2]=max(dp[i-1][1],dp[i-1][3])+B[i];
           dp[i][3]=max(dp[i-1][1],dp[i-1][2])+C[i];
           }
           cout<<max(dp[n][1],max(dp[n][2],dp[n][3]));
}

Measured memory_bytes: 6528
#include <iostream>
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;

struct CombInv{
                const long long MOD = 1e9+7;

                //nPrを返す
                long long Permutation(long long n, long long r){
                        long long tmp = 1;
                        long long i = n;
                        while(i!=n-r){
                                tmp *= i;
                                tmp %= MOD;
                                --i;
                        }
                        return tmp;
                }

                //x!を返す
                long long Factorial(long long x){
                        long long tmp = 1;
                        long long i = 1;
                        while(i<=x){
                                tmp *= i;
                                tmp %= MOD;
                                ++i;
                        }
                        return tmp;
                }

                //x^pを返す
                long long FastPow(long long x, long long p){
                        if(p==1) return x;
                        if(p%2==0){
                                long long sr = FastPow(x, p/2);
                                return (sr*sr)%MOD;
                        }else{
                                long long sr = FastPow(x, (p-1)/2);
                                return ((x*sr)%MOD*sr)%MOD;
                        }
                }

                //1/a≡a^(1e9+7-2)(mod 1e9+7)におけるa^(1e9+7-2)を返す
                long long InverseElement(long long a){
                        return FastPow(a, MOD-2);
                }

                //nCrを返す
                long long Combination(long long n, long long r){
                        return (Permutation(n,r)*(InverseElement(Factorial(r))))%MOD;
                }
};

int main(){
        ll n,a,b,ans;
        cin >> n >> a >> b;
        CombInv ci;
        ans = ci.FastPow(2, n) - 1;
        ans -= ci.Combination(n,a);
        if(ans<0) ans += MOD;
        ans -= ci.Combination(n,b);
        if(ans<0) cout << ans+MOD << endl;
        else cout << ans << endl;
        return 0;
}

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

const int vmax=110;
const ll inf=1LL<<60;

int N,M;
ll dist[vmax][vmax];

bool warshall_floyd(){
	rep(k,N)rep(i,N)rep(j,N){
		if(dist[i][k]==inf||dist[k][j]==inf) continue;
		dist[i][j]=min(dist[i][j],dist[i][k]+dist[k][j]);
	}
	rep(i,N) if(dist[i][i]<0) return true;
	return false;
}

int main(void){
	cin >> N >> M;
	rep(i,N)rep(j,N) dist[i][j]=(i==j)?0:inf;
	rep(i,M){
		int a,b,c;
		cin >> a >> b >> c;
		dist[a][b]=c;
	}
	if(warshall_floyd())
		cout << "NEGATIVE CYCLE" << endl;
	else{
		rep(i,N){
			rep(j,N){
				cout << (j==0?"":" ");
				if(dist[i][j]==inf)
					cout << "INF";
				else
					cout << dist[i][j];
			}
			cout << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1244
/*  CREATED BY
    STREAM_CIPHER
    7-aug-2020
*/
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define double long double
#define debug1(a) cout<<#a<<"="<<(a)<<"\n"
#define debug2(a,b) cout<<#a<<"="<<(a)<<","<<#b<<"="<<(b)<<"\n"
#define debug3(a,b,c) cout<<#a<<"="<<(a)<<","<<#b<<"="<<(b)<<","<<#c<<"="<<(c)<<"\n"
#define fix_precision(n) cout << fixed << setprecision(n)
#define all(a) a.begin(),a.end()
const double pi=acos(-1.0);
int inf=0x3f3f3f3f3f3f3f3f;
const int mod=1e9+7;
const int mx=5*1000000;
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        // freopen("output.txt","w",stdout);
    #endif
        int n,w;cin>>n>>w;
        vector<pair<int,int>>a(n+1);
        for(int i=1;i<=n;i++)
            cin>>a[i].first>>a[i].second;
        int dp[n+9][w+9];
        memset(dp,0,sizeof dp);
        for(int i=1;i<=n;i++)
            for(int j=1;j<=w;j++)
                dp[i][j]=(j-a[i].first>=0)?max(dp[i][j],max(dp[i-1][j],dp[i-1][j-a[i].first]+a[i].second)):max(dp[i][j],dp[i-1][j]);
        int ans=0;
        for(int i=1;i<=n;i++)
            for(int j=1;j<=w;j++)
                ans=max(ans,dp[i][j]);
        cout<<ans<<endl;
}

Measured memory_bytes: 88720
#include <iostream>
#include<cmath>
#include<string>
#include<algorithm>
#include<ctime>
#include<functional>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<map>
#include<set>
#include<tuple>
#include<cassert>
#include<bitset>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cctype>
#include<iomanip>
#include<climits>
#include<typeinfo>
#include<utility>
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n) for(ll i=0;i<n;i++)
#define For(i,m,n) for(int i=m;i<n;i++)
#define FOR(i,m,n) for(ll i=m;i<n;i++)
double pi = 3.141592653589793238;
using ll = long long;
using namespace std;

ll LGCD(ll x, ll y) { if (x % y == 0) return y;else return LGCD(y, x % y); }
ll LLCM(ll x, ll y) { return x * y / LGCD(x, y); }

int GCD(int x, int y) { if (x % y == 0) return y;else return GCD(y, x % y); }
int LCM(int x, int y) { return x * y / GCD(x, y); }
ll dpcombination[10000][10000];

ll modi = 1000000007;
ll combination(ll n, ll r) {
	if (n == r) { return dpcombination[n][n] = 1; }
	else if (r == 0) { return dpcombination[n][0] = 1; }
	else if (r == 1) { return dpcombination[n][1] = n; }
	else if (dpcombination[n][r]) { return dpcombination[n][r]; }
	else { return dpcombination[n][r] = combination(n - 1, r - 1) % modi + combination(n - 1, r) % modi; }
}

void clockman(int time1) {

	cout << 1.0*(clock() - time1) / CLOCKS_PER_SEC << endl;
	return;
}
//cout << fixed << setprecision(10)

void printVec(std::vector<int> &vec) {
	std::cout << "";
	for (auto it = vec.begin(); it != vec.end(); ++it) {
		std::cout << *it << " ";
	}
	std::cout << std::endl;
}


int main() {
	ll n,k;
	cin >> n >> k;
	vector<ll>a(n);
	vector<ll>A(n);
	vector<ll>b(0);
	vector<ll>c(n);
	vector<ll>loop(0);
	b.push_back(0);
	
	for (int i = 0;i < n;i++) {
		cin >> A[i];
		//indexと数字がマッチしてないのキモいので揃えた
		a[i] = A[i] - 1;
	}

	ll f = 0;//ループ前の長さ＋一周分
	ll t = 0;//ループの長さ
	ll tmp = 0;//現在地

	//方針は今まで通った場所にマーキングしてそいつが２回以上ならループが始まっており、３回目が出た時点で探索終了
	for (int i = 0;i < k;i++) {
		c[tmp]++;//マーキング
		if (c[tmp] == 2) {
			t++;
			loop.push_back(tmp);
		}
		if (c[tmp] == 3) {
			break;
		}
		f++;
		tmp = a[tmp];
		b.push_back(tmp);
	}
	if (k <= f) {
		cout << b[k] + 1 << endl;
	}
	else {
		cout << loop[(k - f) % t] + 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 13780
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<string.h>
#include<math.h>
#include<unordered_map>
using namespace std;



int main()
{
	int n, t=0, x=0, y=0;
	string res = "Yes";

	cin >> n;

	for (int i = 0; i < n; i++) {
		int tn, xn, yn, tt, xt, yt;
		cin >> tn >> xn >> yn;

		tt = tn - t;
		xt = xn - x;
		yt = yn - y;

		int sum = abs(xt) + abs(yt);
		if (sum > tt || (tt - sum) % 2 != 0) 
			res = "No";

		t = tn;
		x = xn;
		y = yn;
	}

	cout << res << endl;

	return 0;
}


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

int main() {
  int A, B;
  cin >> A >> B;
  int N = 0;
  for(int i = A; i <= B; i++) {
    if(i / 10000 == i % 10 && ((i - (i / 10000) * 10000) / 1000 == (i % 100) / 10)) {
      N++;
    }
  }
  cout << N << endl;
      
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<cstring>
#include<string>
#include<iomanip>
#include<map>
#include<fstream>
#include<queue>
#include<stack>
#include<set>

using namespace std;

int main()
{
	int n;
	int s[100];
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> s[i];

	sort(s, s + n);
	int ans = 0;
	for (int i = 0; i < n; i++)
		ans += s[i];

	int c = 0;
	while (ans % 10 == 0 &&c<n) {
		if (s[c] % 10 != 0) {
			ans -= s[c];
			break;
		}
		c++;
	}
	if (c == n)
		ans = 0;
	cout << ans << endl;
}

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

int main(){

	string str;
	int n;
	cin >> str >> n;

	while (n--){
		string command;
		int a, b;
		cin >> command >> a >> b;
		if (command == "print"){
			for (int i = a; i <= b; i++){
				cout << str[i];
			}
			cout<<endl;
		}
		else if (command=="reverse"){
			for (int i = a; i <= (a + b) / 2; i++){
				char memo = str[i];
				str[i] = str[a + b - i];
				str[a + b - i] = memo;
			}

			 
		}
		else{
			string p;
			cin >> p;
			for (int i = a; i <= b; i++){
				str[i] = p[i - a];
			}

		}
	}

}


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

int main() {
    int H, W;
    cin >> H >> W;
    vector<vector<char>> grid(H, vector<char>(W));
    vector<int> h(H), w(W);

    rep(i, H) rep(j, W) {
        cin >> grid[i][j];
        if (grid[i][j] == '#') h[i] = w[j] = 1;
    }

    rep(i, H) if (h[i]) {
        rep(j, W) if (w[j]) {
            cout << grid[i][j];
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 256
n = list(map(int, input().rstrip().split(" ")))
ans = 0
coor = []
for a in range(n[0]):
  coor.append(list(map(int, input().rstrip().split(" "))))
  
def dis(a,b):
  ans = 0
  for i in range(len(a)):
    ans += (a[i] - b[i])**2
  return ans**0.5
  
for a in range(len(coor)):
  for b in range(0,a):
    if coor[a]!=coor[b]:
      if dis(coor[a], coor[b]).is_integer():
        ans += 1
print(ans)

Measured memory_bytes: 3064
#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>;

char que(int x){
    printf("%d\n",x);
    fflush(stdout);
    char c[8];
    scanf("%s", c);
    if(c[0]=='V')exit(0);
    return c[0];
}

int main(){
    int n;
    scanf("%d", &n);
    int l=0,r=n;
    char bl=que(l);
    while(r-l>1){
        int mid=(l+r)/2;
        char br=que(mid);
        if((bl!=br&&(mid-l)%2==0)||(bl==br&&(mid-l)%2==1))r=mid;
        else l=mid,bl=br;
    }
    assert(false);
    return 0;
}

Measured memory_bytes: 3856
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, a, b) for(int i = (a); i <= (b); i++)
#define PER(i, a, b) for(int i = (a); i >= (b); i--)
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define all(S) (S).begin(), (S).end()
#define pf push_front
#define pb push_back
#define mk make_pair
#define S second
#define F first
typedef long long ll;
typedef long double lf;
typedef pair<int, int> ii;
int N, ans;

int main(int argc, char ** argv) {
	scanf("%d", &N);
	REP(i, 1, N)
		ans += ((int)log10(i)+1)&1;
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 256
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

void readV(T...)(ref T t){auto r=readln.splitter;foreach(ref v;t){v=r.front.to!(typeof(v));r.popFront;}}
void readA(T)(size_t n,ref T[]t){t=new T[](n);auto r=readln.splitter;foreach(ref v;t){v=r.front.to!T;r.popFront;}}

void main()
{
  int n, m, r; readV(n, m, r);
  int[] rs; readA(r, rs);
  rs[] -= 1;
  rs.sort();

  auto g = GraphM!()(n).init;
  foreach (_; 0..m) {
    int a, b, c; readV(a, b, c);
    --a; --b;
    g[a][b] = g[b][a] = c;
  }
  auto d = FloydWarshal!(typeof(g)).floydWarshal(g);

  auto t = 10^^9;
  foreach (rsi; rs.permutations) {
    auto u = 0;
    foreach (i; 0..rsi.length-1)
      u += d[rsi[i]][rsi[i+1]];
    t = min(t, u);
  }

  writeln(t);
}

struct GraphM(W = int, W i = 10^^9)
{
  alias Wt = W, inf = i;
  int n;
  Wt[][] g;
  alias g this;
  this(int n) { this.n = n; g = new Wt[][](n, n); }
  ref auto init() { foreach (i; 0..n) { g[i][] = inf; g[i][i] = 0; } return this; }
}

template FloydWarshal(Graph)
{
  import std.algorithm, std.array, std.traits;
  alias Wt = TemplateArgsOf!Graph[0];

  Wt[][] floydWarshal(ref Graph g)
  {
    Wt[][] dist;
    int[][] inter;
    floydWarshal(g, dist, inter);
    return dist;
  }

  void floydWarshal(ref Graph g, out Wt[][] dist, out int[][] inter)
  {
    auto n = g.n, sent = n;
    dist = g.g.map!(i => i.dup).array;

    inter = new int[][](n, n);
    foreach (i; 0..n) inter[i][] = sent;

    foreach (k; 0..n)
      foreach (i; 0..n)
        foreach (j; 0..n)
          if (dist[i][j] > dist[i][k] + dist[k][j]) {
            dist[i][j] = dist[i][k] + dist[k][j];
            inter[i][j] = k;
          }
  }
}


Measured memory_bytes: 1148
import math
import string
import collections
from collections import Counter
from collections import deque


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


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]

n = int(input())
h = readints()


# def func(n, h):
#    if n == 0:
#        return 0
#    if n == 1:
#        return abs(h[1]-h[0])
#    return min(abs(h[n]-h[n-1])+func(n-1, h), abs(h[n]-h[n-2])+func(n-2, h))

dp = [None]*n
dp[0] = 0
dp[1] = abs(h[1]-h[0])
for i in range(2, n):
    dp[i] = min(abs(h[i]-h[i-1])+dp[i-1], abs(h[i]-h[i-2])+dp[i-2])

print(dp[n-1])


Measured memory_bytes: 14736
#include <bits/stdc++.h>
using namespace std;
int n,x,ans;
map<int,int>m;
vector<int>v;
int main()
{
	ios::sync_with_stdio(false);
	cin>>n; 
	for (int i=1;i<=n;i++)
	{
		cin>>x;
		if (m[x]==0)
		v.push_back(x);
		m[x]++;
	}
	for (int i=0;i<=v.size();i++)
	{
		if (v[i]>m[v[i]])
		ans+=m[v[i]];
		else if (v[i]<m[v[i]])
		ans+=m[v[i]]-v[i];
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 5112
#include <stdio.h>

int main(){
	int W, H, x, y, r;
	scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
	
	if(x < -100 || x > 100){
		printf("error x= %d", x);
		return 0;
	}
	
	if(y < -100 || y > 100){
		printf("error y= %d", y);
		return 0;
	}
	
	if(W <= 0){
		printf("error W= %d", W);
		return 0;
	}

	if(H <= 0){
		printf("error H= %d", H);
		return 0;
	}

	if(r > 100){
		printf("error r= %d", r);
		return 0;
	}

	if(x-r >= 0 && x+r <= W && y-r >= 0 && y+r <= H){
		printf("Yes\n");
	}else{
		printf("No\n");
	}
	return 0;	
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using edge = pair<ll, P>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
using Graph = vector<vector<ll>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    int N, H;
    cin >> N >> H;
    vector<int> A(N), B(N);
    rep(i, N) cin >> A[i] >> B[i];
    sort(A.begin(), A.end(), greater<>());
    sort(B.begin(), B.end(), greater<>());
    int max_a = A[0];
    int ans = 0;
    rep(i, N) {
        int b = B[i];
        if (b >= max_a) {
            ans++;
            H -= b;
            if (H <= 0) {
                cout << ans << endl;
                return;
            }
        }
    }
    cout << ans + (H + max_a - 1) / max_a << endl;
}

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


Measured memory_bytes: 1024
#include<stdio.h>
int main()
{
	int angka1, angka2;
	scanf("%d %d", &angka1, &angka2);
	if (angka1==1 && angka2==2) printf("3\n");
	else if (angka1==3 && angka2==1) printf("2\n");
	else if (angka1==2 && angka2==3) printf("1\n");
	else if (angka1==1 && angka2==3) printf("2\n");
	else if (angka1==2 && angka2==1) printf("3\n");
	else if (angka1==3 && angka2==2) printf("1\n");
	return 0;
}

Measured memory_bytes: 1596
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
//#include <bits/stdc++.h>

#define ll unsigned long long int
#define pb push_back
#define llu unsigned long long int
#define fo(i,n) for(int i=0;i<n;i++)
#define eb emplace_back
#define M 1000000007
#define vi vector<int>
#define vlli vector<lli>
#define pi pair<int,int>
#define mp make_pair
#define mapi map<int,int>

using namespace std;
ll max(ll x,ll y)
{
	if(x>y)
		return x;
	return y;
}
ll min(ll x,ll y)
{
	if(x<y)
		return x;
	return y;
}
int binaryToDecimal(string n) 
{ 
    string num = n; 
    int dec_value = 0;
    int base = 1; 
    int len = num.length(); 
    for (int i = len - 1; i >= 0; i--) 
	{ 
        if (num[i] == '1') 
            dec_value += base; 
        base = base * 2; 
    } 
    return dec_value; 
} 
int main()
{
	ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //cin.ignore(numeric_limits<streamsize>::max(),'\n');
    //const unsigned ll M=1000000007;
    int a,b,c,k,itr=0;
    cin >> a >> b >> c >> k;
    bool flag=true;
    while(flag)
    {
    	if(b<=a) b = b*2,itr++;
    	else break;
	}
	while(flag)
	{
		if(c<=b) c=c*2,itr++;
		else break;
	}
	if(itr>k) cout << "No";
	else cout << "Yes";
    return 0;
}



Measured memory_bytes: 3664