akhauriyash/Code-Regression huggingface dataset:
# -*- coding: utf-8 -*-

H,W,K = map(int, input().split())
x1,y1,x2,y2 = map(int, input().split())

C = [input() for _ in range(H)]
T = [[-1 for _ in range(W)] for _ in range(H)]
T[x1-1][y1-1] = 0

que = set([(x1-1,y1-1)])
step = 1

while len(que)>0:
  que_next = set()
  for q in que:
    x,y = q[0],q[1]
    for i in range(1,K+1):
      if x-i<0:
        break
      if C[x-i][y]=='@' or T[x-i][y]==1:
        break
      que_next.add((x-i,y))
    for i in range(1,K+1):
      if x+i>H-1:
        break
      if C[x+i][y]=='@' or T[x+i][y]==1:
        break
      que_next.add((x+i,y))
    for i in range(1,K+1):
      if y-i<0:
        break
      if C[x][y-i]=='@' or T[x][y-i]==1:
        break
      que_next.add((x,y-i))
    for i in range(1,K+1):
      if y+i>W-1:
        break
      if C[x][y+i]=='@' or T[x][y+i]==1:
        break
      que_next.add((x,y+i))
  que = que_next
  for q in que:
    if q[0]==x2-1 and q[1]==y2-1:
      print(step)
      exit()
    T[q[0]][q[1]] = 1
  step += 1

print(-1)

Measured memory_bytes: 36312
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
using namespace std;
#define DEBUG(x) cout<<#x<<"="<<x<<endl
#define DEBUG2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<endl
typedef long long ll;
// #define LOCAL
const int MAXN=10;
const ll MOD=7;
ll _gcd(ll a,ll b){if(b==0)return a;return _gcd(b,a%b);}
ll gcd(ll a,ll b){a=abs(a),b=abs(b);if(a<b)swap(a,b);return _gcd(a,b);}
ll qpow(ll a,ll n){ll rt=1;while(n){if(n&1)rt=(rt*a)%MOD;a=a*a%MOD;n>>=1;}return rt;}
ll factor[MAXN];
void cal_factor(){factor[0]=1;for(int u=1;u<MAXN;u++){factor[u]=(factor[u-1]*u)%MOD;}}
ll C(ll n,ll k){return factor[n]*qpow(factor[n-k],MOD-2)%MOD*qpow(factor[k],MOD-2)%MOD;}
int N;
void generate(string s,char mx){
    if(s.size()==N){
        cout<<s<<"\n";
        return;
    }
    for(char c='a';c<=mx;c++){
        if(c==mx){
            generate(s+c,char(mx+1));
        }else {
            generate(s+c,mx);
        }
    }
}
void solve(){
    cin>>N;
    generate("",'a');
}
int main()
{
#ifdef LOCAL
    freopen("in.txt","r",stdin);
#endif
    solve();
}

Measured memory_bytes: 3608
//#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const long long INF= 1e+18+1;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main(){
  string s;cin>>s;
  ll ans=0;
  ll n=s.size();
  vl a(n+1);
  ll cnt=0;
  rep(i,s.size()){
    if(s[i]=='<'){
      cnt++;
    }
    else cnt=0;
    a[i+1]=cnt;
  }
  ll count=0;
  for(ll j=n-1;j>=0;j--){
    if(s[j]=='>'){
      count++;
    }
    else count=0;
    a[j]=max(count,a[j]);
  }
  rep(i,n+1)ans+=a[i];
  cout<<ans<<endl;
}
      

Measured memory_bytes: 4740
def beki(n,X):
    # the maximum of the form n**k under X
    x = 1
    while x*n <= X:
        x *= n
    if x == n:
        return 1
    else:
        return(x)

X = int(input())
a = 1

for n in range(X)[2:]:
    b = beki(n,X)
    if b > a:
        a = b

print(a)

Measured memory_bytes: 2940
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 998244353;
const ll INF = mod * mod;
typedef pair<int, int>P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef pair<ll, ll> LP;
typedef vector<ll> vec;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-6;
const ld pi = acos(-1.0);
typedef vector<vector<ll>> mat;
typedef vector<ll> vec;



void solve() {
	int n; cin >> n;
	vector<int> a(n);
	int ans = 1;
	rep(i, n) {
		cin >> a[i];
	}
	rep1(i, n - 1) {
		if (a[i] <= a[i - 1])ans++;
	}
	cout << ans << endl;
	cout << n << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(4);
	//init();
	solve();
	stop
		return 0;
}



Measured memory_bytes: 3328
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <algorithm>
using namespace std;

#define forn(i, n) for(int i = 0; i < (int)(n); i++)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define forab(i, a, b) for(int i=(a);i<(b);++i)
#define foreach(i, n) for (__typeof(n.begin()) i = n.begin(); i != n.end(); ++i)
#define sqr(x) ((x)*(x))
#define clr(a, b) memset(a, b, sizeof(a))
#define MP make_pair
#define PB push_back
#define SZ(a) ((int)a.size())
#define all(a) (a).begin(),(a).end()
#define inf 0x3f3f3f3f
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
const double eps = 1e-8;
int dcmp(double x) { if (x < -eps) return -1; else return x > eps;}
#define se(x) cout<<#x<<" = "<<x<<endl

#ifdef CHEN_PC
	#define debug(...) printf(__VA_ARGS__)
#else 
	#define debug(...)
#endif

const int N = 100010;
const int mod = 1000000007; // 10^9+7

// Mod int
struct mint {
	ll x;
	mint():x(0){}
	mint(ll x):x((x%mod+mod)%mod){}
	mint& fix() { x = (x%mod+mod)%mod; return *this;}
	mint operator-() const { return mint(0) - *this;}
	mint& operator+=(const mint& a){ if((x+=a.x)>=mod) x-=mod; return *this;}
	mint& operator-=(const mint& a){ if((x+=mod-a.x)>=mod) x-=mod; return *this;}
	mint& operator*=(const mint& a){ (x*=a.x)%=mod; return *this;}
	mint operator+(const mint& a)const{ return mint(*this) += a;}
	mint operator-(const mint& a)const{ return mint(*this) -= a;}
	mint operator*(const mint& a)const{ return mint(*this) *= a;}
	bool operator<(const mint& a)const{ return x < a.x;}
	bool operator==(const mint& a)const{ return x == a.x;}
    mint pow(ll n) const {
        mint x = *this, r = 1;
        while (n) {
            if (n & 1) r *= x;
            x *= x;
            n >>= 1;
        }
        return r;
    }
};
typedef vector<mint> vm;

mint dp[N];
int sum[N];
int nxt[N][3];

int trans(char c) {
	return c == 'a' ? 1 : 2;
}

int solve(char *s, int n) {
	bool flag = true;
	forn (i, n-1) {
		if (s[i] == s[i+1]) {
			flag = false;
		}
	}
	if (flag) {
		return 1;
	}

	sum[n] = 0;
	nxt[n][0] = nxt[n][1] = nxt[n][2] = n + 5;
	ford (i, n) {
		sum[i] = sum[i + 1] + trans(s[i]);
		sum[i] %= 3;
		forn (j, 3) {
			nxt[i][j] = nxt[i + 1][j];
		}
		nxt[i][sum[i + 1]] = i + 1;
	}
	clr(dp, 0);
	dp[0] = 1;
	forn (i, n) {
		dp[i + 1] += dp[i];
		int tag = 3 - trans(s[i]);
		tag = sum[i] - tag;
		tag = (tag % 3 + 3) % 3;
		dp[nxt[i][tag]] += dp[i];
	}
	mint ret = 0;
	forab (i, 1, n+1) {
		if (sum[i] == 0) {
			ret += dp[i];
		}
	}
	return ret.x;
}

int main(int argc, char *argv[]) {
#ifdef CHEN_PC
	freopen("E.in", "r", stdin);
#endif

	char str[N];
	int n;
	while (scanf("%s", str) != EOF) {
		n = strlen(str);
		int ret = solve(str, n);
		printf("%d\n", ret);
	}
	return 0;
}



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

const ll MOD = 1e9 + 7;

int mpow(int base, int exp);
typedef  vector<int> vi;
typedef  vector<ll> vll;
typedef  vector<pair<ll,ll>> vpll;
typedef  vector<pair<int, int>> vpii;
typedef  pair<int, int> pii;
typedef  pair<ll, ll> pll;
typedef  unordered_map<ll, ll> umpll;
typedef  unordered_map<int, int> umpii;
typedef  unordered_map<ll, int> umpli;
typedef  unordered_set<int> usi;
typedef  unordered_set<ll> usll;
typedef  set<int> si;
typedef  set<ll> sll;
typedef  set<pair<int, int>> spii;
typedef  set<pair<ll, ll>> spll;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define fo(i,n) for(i = 0;i < n; i++)
#define Fo(i,k,n) for(i = k;k < n ? i < n : i > n; k < n ? i += 1 : i -= 1)
#define deb(x) cout << #x << " = " << x << endl
#define deb2(x, y) cout << #x << " = " << x << ", " << #y << " = " << y << endl
#define deb3(x, y, z) cout << #x << " = " << x << ", " << #y << " = " << y << ", "<< #z << " = " << z << endl

ll randGen(ll lower, ll upper) { return (rand() % (upper - lower + 1)) + lower; }
ll dir[4][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
// cout << fixed;
// cout.precision(10);
//******************          Function here          *********************//

   void test_case() {
      int n;
      cin >> n;
      vector<ll> a, b;
      for(int i = 0; i < n; i++) {
         ll x, y;
         cin >> x >> y;
         a.pb(x + y);
         b.pb(x - y);
      }
      sort(a.begin(), a.end());
      sort(b.begin(), b.end());
      cout << max(a[a.size() - 1] - a[0], b[b.size() - 1] - b[0]) << endl;
   }

//*********************************************************************//

int main()
{
    #ifndef ONLINE_JUDGE
      string inputFile, outputFile;
      inputFile = "input.txt";
      outputFile = "output.txt";
      freopen(inputFile.c_str(), "r", stdin);
      freopen(outputFile.c_str(), "w", stdout);
    #endif

    int t = 1;
    // cin>>t;
    while(t-- >0){
      test_case();
    }
    return 0;
}



/**********************   Utility Functions  *****************************/
   int mpow(int base, int exp) {
     base %= MOD;
     int result = 1;
     while (exp > 0) {
       if (exp & 1) result = ((ll)result * base) % MOD;
       base = ((ll)base * base) % MOD;
       exp >>= 1;
     }
     return result;
   }
/***********************************************************************/


Measured memory_bytes: 6640
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>
#include <set>
#include <map>
#include <stdio.h>
#include <numeric>
#include <cstring>

#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define MOD 1000000007 //10^9+7
#define ALL(a)  (a).begin(),(a).end()
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using PLL = pair<long long, long long>;
const int INF = numeric_limits<int>::max();
const ll INFL = numeric_limits<ll>::max();
constexpr ll TEN(int n) { return (n==0) ? 1 : 10*TEN(n-1); }

// 負の数にも対応した % 演算
long long mod(long long val, long long m) {
    long long res = val % m;
    if (res < 0) res += m;
    return res;
}

//greatest common divisor
long long gcd(ll a, ll b) 
{
    if (a % b == 0) {
        return b;
    } else {
        return gcd(b, a % b);
    }
}

//least common multiple
long long lcm(ll a, ll b)
{
    return a / gcd(a, b) * b ;
}

ll factorial(ll n) {
    ll res = 1;
    for (ll i = 1; i <= n; i++) {
        res *= i;
    }
    return res;
}

bool fn_is_prime(ll n) {
    for (ll i = 2; i * i <= n; i++) {
        if (n % i == 0) return false;
    }
    return n != 1;
}

bool isOK(int index, int key, vector<ll>& a) {
    if (a[index] >= key) return true;
    else return false;
}

int binary_search(int key, vector<ll>& a) {
    int ng = -1;
    int ok = a.size();

    while (abs(ok - ng) > 1) {
        int mid = (ok + ng) / 2;

        if (isOK(mid, key, a)) ok = mid;
        else ng = mid;
    }
    return ok;
}

struct UnionFind {
    vector<int> r;

    UnionFind(int N) {
        r = vector<int>(N, -1);
    }

    int root(int x) {
        if (r[x] < 0) return x;
        return r[x] = root(r[x]);
    }

    bool unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (r[x] > r[y]) swap(x, y);
        r[x] += r[y];
        r[y] = x;
        return true;
    }

    int size(int x) {
        return -r[root(x)];
    }

    bool same(int x, int y) {
        return root(x) == root(y);
    }
};

int main()
{
    int n; cin >> n;
    set<int> s;
    rep(i,n) {
        int d; cin >> d;
        s.insert(d);
    }
    cout << s.size() << endl;
}


Measured memory_bytes: 3632
n = int( input() )
p = list( map( int, input().split() ) )
count = 0
for i in range(1,n-1):
    if ( p[i-1] < p[i] and p[i] < p[i+1] ) or ( p[i+1] < p[i] and p[i] < p[i-1] ):
        count += 1
print(count)

Measured memory_bytes: 3064
#include <cstdio>

int main()
{
	int age;
	std::scanf("%d", &age);

	switch (age) {
	case 1:
		std::printf("Hello World\n");
		return 0;
	case 2:
		int a, b;
		std::scanf("%d %d", &a, &b);
		std::printf("%d\n", a + b);
		return 0;
	}
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define watch(x); cout<<#x<<"="<<x<<endl;
#define watch2(x,y); cout<<#x<<"="<<x<<" "<<#y<<"="<<y<<endl;
#define endl "\n"
#define int long long
using namespace std;    


int32_t main(){

    fast
    int x;
    cin>>x;
    map<int,int>mp;
    for(int i=-150;i<=150;i++){
        //s.insert(pow(i,5));
        mp[pow(i,5)]=i;
    }
    for(int i=-150;i<=150;i++){
        if(mp.find(x+pow(i,5))!=mp.end()){
            cout<<mp[x+pow(i,5)]<<" "<<i<<endl;
            return 0;
        }
    }


    return 0;
}



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

using namespace std;

typedef long long int ll;

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

  ll n, k;
  cin >> n >> k;
  vector < ll > cnt(n + 1, 0);
  for(int i = 0; i < k; i++){
    ll d;
    cin >> d;
    for(int i = 0; i < d; i++){
      ll a;
      cin >> a;
      cnt[a]++;
    }
  }

  ll ans = 0;
  for(int i = 1; i <= n; i++){
    if(cnt[i] == 0) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3664
while True:
    H,W = map(int,input().split())
    if H == 0 and W == 0:
        break
    for i in range(H):
        for k in range(W):
            if i == 0 or i == H-1 or k == 0 or k == W-1:
                print("#",end = "")
            else:
                print(".",end = "")
        print()
 
    print()


Measured memory_bytes: 7004
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,NAME,...) NAME
#define pr(...) GET_MACRO(__VA_ARGS__,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__)
#define pr1(a) (#a)<<"="<<(a)
#define pr2(a,b) pr1(a)<<", "<<pr1(b)
#define pr3(a,b,c) pr2(a,b)<<", "<<pr1(c)
#define pr4(a,b,c,d) pr3(a,b,c)<<", "<<pr1(d)
#define pr5(a,b,c,d,e) pr4(a,b,c,d)<<", "<<pr1(e)
#define int long long
#define double long double
using namespace std;
const int N = 1010;
const int INF = 1LL<<55;
const int mod = (1e9)+7;
const double EPS = 1e-8;
const double PI = 6.0 * asin(0.5);
typedef pair<int,int> P;
typedef long long ll;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
ostream& operator<<(ostream& o,P p){return o<<"("<<p.first<<","<<p.second<<")";}
istream& operator>>(istream& i,P &p){return i>>p.first>>p.second;}
ostream& operator<<(ostream& o,vector<auto> &a){int i=0;for(auto t:a)o<<(i++?" ":"")<<t;return o;}
istream& operator>>(istream& i,vector<auto> &a){for(auto &t:a)i>>t;return i;}
void prArr(auto a,string s=" "){int i=0;for(auto t:a)cout<<(i++?s:"")<<t;cout<<endl;}

ll mod_pow(ll x,ll n){
  ll res=1;
  while(n){
    if(n%2) res=res*x%mod;
    x=x*x%mod;
    n/=2;
  }
  return res;
}

ll factorial(int i){
  static vector<ll> k(1e6);
  if(!k[0]){k[0]=1;for(int i=1;i<(int)k.size();i++)k[i]=i*k[i-1]%mod;}
  return k[i];
}

ll nCr(ll n,ll r){
  ll a = mod_pow( factorial(r) * factorial(n-r) % mod ,mod-2);
  return factorial(n) * a % mod;
}


int calc(int n,int i,int f){
  int a = factorial(n);
  int b = factorial(n-i*f);
  int c = mod_pow(factorial(i),f);
  return (a * mod_pow(b,mod-2)%mod) * mod_pow(c,mod-2) % mod;
}

int A,B,C,D;
int dfs(int n,int i){
  static int mem[N][N],used[N][N]={};
  if(n == 0) return 1;
  if(i > B) return 0;
  if(used[n][i]++) return mem[n][i];
  int res = dfs(n,i+1);
  for(int F=C;F<=D;F++){
    if(n - i * F < 0) break;
    int r = calc(n,i,F) * mod_pow(factorial(F),mod-2) % mod;
    res = (res + dfs(n-i*F,i+1) * r % mod) % mod;
  }
  return mem[n][i] = res;
}

signed main(){
  int n;
  cin>>n;
  cin>>A>>B>>C>>D;

  int ans = dfs(n,A);
  cout<<ans<<endl;
  
  return 0;
}


Measured memory_bytes: 24064
#include <iostream>
#include <algorithm>
#include <map>
#include <utility>
#include <vector>
#include <cstdio>
#include <iomanip>
#include <cmath>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < n; i++)


int main() {
    int A, B;
    cin >> A >> B;

    if (A - 2*B <= 0) {
        cout << 0 << endl;
    } else {
        cout << A - 2*B << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <algorithm>
#include <cstring>
#include <iostream>
#include <cstdio>
#include <ctype.h>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#define INF 0x3fffffff
#define DEBUG 1
#define MAXSIZE 100005
using namespace std;
typedef long long LL;


int a[3] = { 3,5,7 };
int b[10] = { 0 };
LL com(int k[]) {
	LL ans = 0;
	int i = 0;
	LL tem = 1;
	while (k[i] != 0) {
		ans += k[i] * tem;
		tem *= 10;
		i++;
	}
	return ans;
}
bool judge(int k[]) {
	int ha[10] = { 0 };
	int i = 0;
	while (k[i] != 0) ha[k[i++]]++;
	return ha[3] && ha[5] && ha[7];
}
void jw(int k[]) {
	if (k[0] != 7) {
		if (k[0] == 3) k[0] = 5;
		else if (k[0] == 5) k[0] = 7;
		return ;
	}
	else {
		k[0] = 3;
		int i = 1;
		while (k[i] == 7) {
			k[i++] = 3;
		}
		if (k[i] == 3) k[i] = 5;
		else if (k[i] == 5) k[i] = 7;
		else k[i] = 3;
	}
}
int main() {
	int n;
	scanf("%d", &n);
	b[3] = 0; b[5] = 1; b[7] = 2;
	int k[11] = {0};
	k[0] = 7; k[1] = 5; k[2] = {3};
	int ans = 0;
	while (com(k) <= n) {
		ans++;
		jw(k);
		while (!judge(k)) jw(k);
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
<?php 

fscanf(STDIN,"%d",$n);
$a_li = explode(" ",trim(fgets(STDIN)));
$dis_li = array();
$sum_tmp = 0;
$min = 10**9;

for($i=-100;$i<=100;$i++){
	foreach($a_li as $a){
      $sum_tmp+=($a-$i)**2;
    }
  	$min = min($sum_tmp,$min);
  	$sum_tmp = 0;
}

echo $min;

Measured memory_bytes: 4604
#include <bits/stdc++.h>
#define repz(i, z, n) for (decltype(n) i = (z); i < (n); i++)
#define rep(i, n) for (decltype(n) i = 0; i < (n); i++)

#define REPZ(i, z, n) for (decltype(n) i = (z); i <= (n); i++)
#define REP(i, n) for (decltype(n) i = 0; i <= (n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) (*max_element(ALL(v)))
#define MIN(v) (*min_element(ALL(v)))
#define INF 1000000000000  // 1E+12

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<
#define PYES cout << "Yes" << endl;
#define POK cout << "OK" << endl;
#define PNO cout << "No" << endl;
#define PNG cout << "NG" << endl;

using namespace std;

// デバッグ用
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

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

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

// typedef
typedef long long ll;
typedef unsigned long long ul;
typedef long double ld;
typedef pair<ll, ll> pl;

// const
// 円周率
const ld pi = acos(-1);
// mod用
// 1E+9 +7
const ll mod = (int)1e+9 + 7;
// 1s間で可能なループ回数2E+8回
// int        最大値2147483647         〜2E+9
// long long  最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<type> push_back
// 連想配列map<key,value> insert,
// 集合set<type>
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// deep copy v1->v2 copy(v1.begin(), v1.end(), back_inserter(v2) );
// 大文字65-90(-32)
// 小文字97-122(+32)
//  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>>
//  ba;
int main() {
  // faster
  // C言語流の入出力は使用できない
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int n;
  cin >> n;
  vector<ll> a(n + 1);
  vector<ll> res(n);
  ll sum = 0;
  rep(i, n) {
    cin >> a[i];
    sum += a[i];
  }
  ll temp = 0;
  a[n] = a[0];
  for (ll i = 1; i < n; i += 2) {
    temp += a[i];
  }
  res[0] = sum - 2 * temp;
  repz(i, 1, n) { res[i] = 2 * a[i-1] - res[i - 1]; }
  rep(i, n) {
    cout << res[i];
    if (i == n - 1)
      cout << endl;
    else
      cout << " ";
  }

  return 0;
}


Measured memory_bytes: 2944
program main 
 implicit none 
 integer,allocatable ::  b(:)
 integer :: a(3,3)
 integer :: n,i,same,j,k
  do i=1,3
   read *, a(i,:)
  end do
   read *, n
   allocate (b(n))
  do i=1,n
   read *, b(i)
  end do
  
  do i=1,3
   do j=1,3
    do k=1,n
    if (a(i,j)==b(k)) then
     a(i,j)=same
    end if
    end do
   end do
  end do
  
   if (a(1,1)==same.and.a(2,2)==same.and.a(3,3)==same) then
    write (*,*) 'Yes' 
    stop
   else if (a(1,3)==same.and.a(2,2)==same.and.a(3,1)==same) then
    write (*,*) 'Yes'
    stop
   end if
   
  do i=1,3
   if (a(1,i)==same.and.a(2,i)==same.and.a(3,i)==same) then
    write (*,*) 'Yes'
    stop
   else if (a(i,1)==same.and.a(i,2)==same.and.a(i,3)==same) then
    write (*,*) 'Yes'
    stop
   end if
  end do
    write (*,*) 'No'
    stop
    
 end program main


Measured memory_bytes: 256
#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)
def input():
  return sys.stdin.readline()[:-1]

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
  read_all = [tuple(map(int, input().split())) for _ in range(N)]
  return map(list,zip(*read_all))

#################

N,M = II()

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

ans = 1
kouho = make_divisors(M)
for i in kouho:
  if M%i==0 and i*N<=M:
    ans = i
print(ans)

Measured memory_bytes: 38640
N=int(input())
*A, = map(int,input().split())
*B, = map(int,input().split())
D = sorted(a-B[i] for i,a in enumerate(A))
S = 0
for ans,d in enumerate(D):
    if d>=0:break
    S += d
if S==0:ans = -1
for i,d in enumerate(D[::-1],1):
    S += d
    if S>=0:break
ans = (-1) if S<0 else (ans+i)
print(ans)

Measured memory_bytes: 18396
#include <bits/stdc++.h>
using namespace std;
#define intMax 2147483647
#define rep(i, a, b) for (int i = a; i < b; i++)
#define repp(i, a, b) for (int i = a; i >= b; i--)
#define be(a) (a.begin(), a.end())
#define rbe(p) (p.rbegin(), p.rend())
#define pb push_back

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin >> n;
    int k = n*n;
    cout << 3*k;
}

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

int main(){
	char a[20] = "AC";
	char b[20] = "WA";
	char c[20] = "TLE";
	char d[20] = "RE";
	int tc;
	int ac = 0;
	int wa = 0;
	int tle = 0;
	int re = 0;
	char s[100];
	scanf("%d", &tc);
	for(int i=0; i<tc; i++){
		scanf("%s", s);
		if(strcmp(s,a) == 0){
			ac++;
		}
		else if(strcmp(s,b) == 0){
			wa++;
		}
		else if(strcmp(s,c) == 0){
			tle++;
		}
		else if(strcmp(s,d) == 0){
			re++;
		}
	}	
		printf("AC x %d\n", ac);
		printf("WA x %d\n", wa);
		printf("TLE x %d\n", tle);
		printf("RE x %d\n", re);
	return 0;
}

Measured memory_bytes: 1680
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            String a = in.nextString();
            String b = in.nextString();

            int n = Integer.parseInt(a + b);
            for (int i = 1; i * i <= n; i++) {
                if (i * i == n) {
                    out.println("Yes");
                    return;
                }
            }

            out.println("No");
        }

    }

    static class InputReader {
        BufferedReader br;
        StringTokenizer st;

        public InputReader(InputStream inputStream) {
            br = new BufferedReader(new InputStreamReader(inputStream));
            st = new StringTokenizer("");
        }

        public String nextString() {
            while (!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return st.nextToken();
        }

    }
}



Measured memory_bytes: 21460
#include <stdio.h>
 
int main(void){
int A, B, C, K, max, p, q;

   scanf("%d %d %d %d",&A,&B,&C,&K);  
    
   if(A>K){
     max=K;
   }
   else{
     p=K-A;
     if(B>p) 
       max=A;
     else{
       q=p-B;
       if(C>q){
         max=A-q;
       }
       else{
         max=A-C;
       }
     }
   }
   
printf("%d\n",max);
  return 0;
}


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

#define Fast ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define FO freopen("in.txt", "r", stdin)
#define FC freopen("out.txt", "w", stdout)
#define aise cout<<"aise"<<endl
#define pb push_back
#define mp make_pair
#define ll long long
#define mset(v, a) memset(v, a, sizeof(v))
#define pll pair< ll, ll >
#define ff first
#define ss second
#define pi acos(-1.0)
#define mxN 100010
#define inf 1e9

int main()
{


    ll a, b;
    cin >> a >> b;
    for(ll i = 0; i <= 1000; i++)
    {

        ll x = i*.08;
        ll y = i*.10;
        if(x == a && y == b)
        {

            cout << i;
            return 0;
        }
    }
    cout << -1;
}


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

int main() {
	
	int n,a;
	cin >> n >> a;
	vector<int> x(n);
	for(auto &i:x) cin >> i;
	vector<vector<vector<int64_t>>> dp(n+1,vector<vector<int64_t>>(n+1,vector<int64_t>(2501)));
	
	dp.at(0).at(0).at(0)=1;
	for(int i=0; i<n; i++){
		for(int j=0; j<n; j++){
			for(int k=0; k<=2500; k++){
				if(dp.at(i).at(j).at(k)>=1) dp.at(i+1).at(j+1).at(k+x.at(i)) +=  dp.at(i).at(j).at(k);
				dp.at(i+1).at(j).at(k) += dp.at(i).at(j).at(k);
			}
		}
	}
	int64_t cnt=0;
	for(int j=1; j<n+1; j++){
		cnt += dp.at(n).at(j).at(j*a);
	}
	cout << cnt << endl;
}

Measured memory_bytes: 52224
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout

	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
		if len(os.Args) > 2 {
			wfp, _ = os.Open(os.Args[2])
		}
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)

	k := getNextInt(scanner)
	aa := make([]int64, k)

	for i := k - 1; i >= 0; i-- {
		aa[i] = getNextInt64(scanner)
	}

	dpmn := make([]int64, k+1)
	dpmx := make([]int64, k+1)

	dpmx[0] = 2
	dpmn[0] = 2

	for i := 0; i < k; i++ {
		dpmx[i] -= dpmx[i] % aa[i]
		dpmx[i+1] = dpmx[i] + aa[i] - 1
		if dpmx[i+1] < aa[i] {
			fmt.Fprintln(writer, -1)
			writer.Flush()
			return
		}
		dpmn[i+1] = ((dpmn[i]-1)/aa[i] + 1) * aa[i]
	}
	if dpmn[k] > dpmx[k] {
		fmt.Fprintln(writer, -1)
		writer.Flush()
		return
	}

	fmt.Fprintln(writer, fmt.Sprintf("%d %d", dpmn[k], dpmx[k]))

	writer.Flush()
}


Measured memory_bytes: 5248
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>

int main(void){
    int n,ans;
    double t,a,h,tmp=1e9;
    scanf("%d%lf%lf",&n,&t,&a);
    for (int i=0; i<n; i++){
        scanf("%lf",&h);
        if (fabs(a-(t-h*0.006))<fabs(a-tmp)){
            tmp=t-h*0.006;
            ans=i+1;
        }
    }
    printf("%d\n",ans);
	return 0 ;
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int main()
{
    int n,m;
    cin>>n>>m;
    vector< vector<int> > t(m);
    vector<int> p(m);
    rep(i,m)
    {
        int k;
        cin>>k;
        rep(j,k)
        {
            int s;
            cin>>s;
            t[i].push_back(s);
        }
    }
    rep(i,m) cin>>p[i];

    int sum=0;
    for (int bit = 0; bit < (1<<n); bit++)
    {
        bool flag=true;
        rep(i,t.size())
        {
            int cnt=0;
            rep(j,t[i].size())
            {
                if(bit & (1<<(t[i][j])-1)) cnt++;
            }
            if(cnt%2!=p[i])
            {
                flag=false;
                break;
            }
        }
        if(flag)sum++;
    }
    cout<<sum<<endl;

    return 0;
}

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

int main()
{
    int n;
    cin >> n;
    vector<long> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    
    long ans=0;
    for (int i = 1; i < n; i++)
    {
        if (a[i-1]>a[i])
        {
            ans += a[i-1] - a[i];
            a[i] = a[i-1];
        }
        
    }
    cout << ans << endl;
}

Measured memory_bytes: 4776
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
 
int main()
{
  double N,M;
  long long int i,j,k;
  char buff[256];
  
  scanf("%lf",&N);
  double PI = 3.141592;
 
  M = 2*N*PI;
  printf("%f\n",M);
   
  return 0; 
  
}

Measured memory_bytes: 2220
///////////////////////////////////////////////////////////
#include <algorithm>
#include <array>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
///////////////////////////////////////////////////////////
#define ll long long
#define ull insigned lon long
///////////////////////////////////////////////////////////
int absolute(int n);
void input(vector<int>& vec);
void print(vector<int> vec);
void upsort(vector<int>& vec);
void downsort(vector<int>& vec);
int maxvec(vector<int> vec);
int minvec(vector<int> vec);
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
int main()
{
    int a,x;
    cin>>x>>a;
    if(x<a){
        cout<<0<<endl;
    }else{
        cout<<10<<endl;
    }
    return 0;
}
///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
int absolute(int n)
{
    if (n < 0) {
        return (-n);
    }
    return n;
}

void input(vector<int>& vec)
{
    for (size_t i = 0; i < vec.size(); ++i) {
        cin >> vec.at(i);
    }
}

void print(vector<int> vec)
{
    for (size_t i = 0; i < vec.size(); ++i) {
        cout << vec.at(i) << " ";
    }
    cout << endl;
}

void upsort(vector<int>& vec)
{
    sort(vec.begin(), vec.end());
}

void downsort(vector<int>& vec)
{
    sort(vec.begin(), vec.end(), greater<int>());
}

int maxvec(vector<int> vec)
{
    int m = vec.at(0);
    for (size_t i = 0; i < vec.size(); ++i) {
        m = max(m, vec.at(i));
    }
    return m;
}

int minvec(vector<int> vec)
{
    int m = vec.at(0);
    for (size_t i = 0; i < vec.size(); ++i) {
        m = min(m, vec.at(i));
    }
    return m;
}
///////////////////////////////////////////////////////////

Measured memory_bytes: 256
// Sakhiya07 - Yagnik Sakhiya
 
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long int
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define bp __builtin_popcountll
#define MOD  1000000007
const int N = 100005;
 
#define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);srand(time(NULL));
 
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>

int main()
{
    ll m,n;
    cin >> m >>n ;
    if(m==n)    cout<<"Yes";
    else        cout<<"No";
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#define llong long long
#define ldouble long double
#define uint unsigned int
#define ullong unsigned long long
#define udouble unsigned double
#define uldouble unsigned long double
#define modinc(x) {if(x>=P) x-=P;}
#define pii pair<int,int>
#define piii pair<pair<int,int>,int>
#define piiii pair<pair<int,int>,pair<int,int> >
#define pli pair<llong,int>
#define pll pair<llong,llong>
using namespace std;

const int N = 1e5;
char s[N+2];
int a[N+2];
int b[N+2];
int n,m;

int main()
{
	scanf("%s",s+1); n = strlen(s+1);
	for(int i=1; i<=n; i++) a[i] = s[i]=='1' ? 1 : 0;
	if(a[1]==0 || a[n]==1) {printf("-1\n"); return 0;}
	for(int i=1; i<=n; i++)
	{
		if(a[i]!=a[n-i]) {printf("-1\n"); return 0;}
	}
	for(int i=1; i<=n; i++) if(a[i]==1) {m++; b[m] = i;}
	m++; b[m] = n;
	for(int i=1; i<=m; i++)
	{
		for(int j=b[i-1]+1; j<b[i]; j++)
		{
			printf("%d %d\n",j,b[i]);
		}
		if(i>1) printf("%d %d\n",b[i-1],b[i]);
	}
	return 0;
}

Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,s,cnt=0;
  cin>>n>>s;
  for(int i=0;i<n+1;i++){
    for(int j=0;j<n+1;j++){
      int k=s-i-j;
        if(k>=0&&k<=n)cnt++;
      }
  }
  cout<<cnt<<endl;
}

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

using str = string;
using ss = stringstream;

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

    int n;
    cin>>n;

    map<str,int> m;

    for(int i=0;i<n;i++)
    {
        str s;
        cin>>s;

        m[s]++;
    }

    int ma=0;

    vector<str> ans;

    for(const auto& x : m)
    {
        if(ma<x.second)
        {
            ma=x.second;
            ans.clear();
            ans.push_back(x.first);
        }
        else if(ma==x.second)ans.push_back(x.first);
    }

    for(int i=0;i<ans.size();i++)cout<<ans[i]<<"\n";

    return 0;
}


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

using namespace std;

int main(){
	int n;
	string slime;
	int p= 0;
	int count = 0;
	cin>>n;
	cin>>slime;
	for(int i = 0; i< n-1 ;i++){
		(slime[i]!=slime[i+1])? count++: p++;
		
		}
	cout<<count+1;	
	
	return 0;
	}


Measured memory_bytes: 512
a = input()
b = 0
bt = 0
w = 0
wt = 0
for i in range(len(a)):
    if a[i] == "B":bt = 1
    if bt == 1 and a[i] == "B":b+=1
    if a[i] =="W":
        w+=b
        wt +=1
print(w)

Measured memory_bytes: 3500
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
const int INF = 2147483647;
const ll MOD = 1000000007;

using namespace std;

int main() {
  int n;
  map<char, ll> ma;
  cin >> n;
  REP(i, n) {
    string po;
    cin >> po;
    ma[po[0]]++;
  }

  string s = "MARCH";

  ll ans = 0;
  REP(i, 5) {
    FOR(j, i + 1, 5) {
      FOR(k, j + 1, 5) { ans += ma[s[i]] * ma[s[j]] * ma[s[k]]; }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const long double PI  = acos(-1.0L);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a,b) a = (((a)<(b))?(b):(a))
#define chmin(a,b) a = (((a)>(b))?(b):(a))

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}


// 階乗や組合わせの場合の数を求める
ll mpow(ll a, ll b, ll p){
  if(b==0) return 1;
  else if(b%2==0){ll memo = mpow(a,b/2,p); return memo*memo%p;}
  else return mpow(a,b-1,p)*a%2019;
}


signed main(){
	int n; ll p; cin>>n>>p;
	string s; cin>>s;

	if(p==2||p==5){
		ll ans=0;
		rep(i,n){
			if((s[i]-'0')%p==0) ans+=i+1;
		}
		return cout<<ans<<endl,0;
	}

	VL cnt(p,0LL);
	ll keta = 1;
	ll cur = 0;
	rep(i,n){
		cur = (cur+(s[n-i-1]-'0')*keta)%p;
		keta = (keta*10)%p;
		cnt[cur]++;
	}

	ll ans = 0;
	rep(i,p) ans += cnt[i]*(cnt[i]-1)/2;
	ans += cnt[0];
	cout<<ans<<endl;

	return 0;
}


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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pii;

struct UnionFind {
    vector<int> d;      // d[i] < 0 : i は根. -d[i] はサイズ 
                        // d[i] >= 0 : d[i] は i の親の番号
                        // サイズ情報と親情報を同時に持つことができる. beautiful!

    UnionFind(int N) : d(N, -1){} // 全て根として初期化

    int root(int x) { // x の木の根を再帰で得る
        if (d[x] < 0) return x;
        return d[x] = root(d[x]);
    }

    bool unite(int x, int y) { // x と y の木を併合. 併合した場合 true
        x = root(x); y = root(y); // x <- x の根, y <- y の根
        if (x == y) return false; 
        // merge technique（データ構造をマージするテク. 大に小をくっつける）
        if (d[x] > d[y]) swap(x, y);    // x の木のサイズ > y の木のサイズにする. d[x], d[y] < 0 に注意.
        d[x] += d[y];   // x の木のサイズ += y の木のサイズ
        d[y] = x;   // y の親を x にする
        return true;
    }

    bool same(int x, int y) { // x, y が同じ木に属するなら true
        return root(x) == root(y);
    }
    
    int size(int x) { // x を含む木のサイズ
        return -d[root(x)]; // d[root(x)] < 0 に注意.
    }
};

void Main(){
	int n, m, k;
	cin >> n >> m >> k;
	
	UnionFind tree(n);
	vvi fri, ene;
	fri.resize(n);
	ene.resize(n);
	rep(i,m) {
	    int a, b;
	    cin >> a >> b;
	    a--; b--;	   
	    fri[a].pb(b);
	    fri[b].pb(a);
	    tree.unite(a,b);
	}
	rep(i,k){
	    int c, d;
	    cin >> c >> d;
	    c--; d--;
	    ene[c].pb(d);
	    ene[d].pb(c);
	}
	
	rep(i,n){
	    int ans = tree.size(i) - fri[i].size() - 1; 
	    for(auto j : ene[i]) if(tree.same(i,j)) ans--;
	    cout << ans << " ";
	}
	return;
}

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

Measured memory_bytes: 12280
#include<iostream>
using namespace std;
int main(void)
{
	int h,r,a;
	cin>>h>>r;
	if(h==r) cout<<"1"<<endl;
	else{
		a=h+r;
		if(a==0) cout<<"0"<<endl;
		else if(1<=a) cout<<"1"<<endl;
		else cout<<"-1"<<endl;
	}
	return 0;
}


Measured memory_bytes: 3104
#include <iostream>
#include <string>
using namespace std;
int main(){
  string a,b,c;
  cin>>a>>b>>c;
  a[0]=a[0]-32;
  b[0]=b[0]-32;
  c[0]=c[0]-32;
  cout<<a[0]<<b[0]<<c[0]<<endl;
  return 0;
}


Measured memory_bytes: 256
// C.

#include <iostream>
#include <algorithm>
#include <sstream>
#include <cstdio>
#include <cstring>

using namespace std;
typedef long long LL;

int main(int argc, char *argv[])
{
	string s;
	cin >> s;
	int ans = 0;
	for (int i = 1; i != s.length(); ++i) {
		ans += s[i - 1] != s[i];
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 512
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define mod 10000000000000007
int main()
{
    ll n,k;
    cin>>n>>k;
    ll a[n];
    for(int i=0;i<n;i++)
    cin>>a[i];
    int p=0;
    for(int i=k;i<n;i++)
    {
        ll x=a[i];
        ll y=a[p++];
        
        if(x>y)
        cout<<"Yes"<<endl;
        else
        cout<<"No"<<endl;


    }

    return 0;
}


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

c = dict()
for a in A:
    if a not in c:
        c[a] = 1
    else:
        c[a] += 1

tmp = 0
for k, v in c.items():
    if v < k:
        tmp += v
    else:
        tmp += (v - k)
print(tmp)

Measured memory_bytes: 17780
///supercalifragilisticexpialidocious.
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cassert>
#include <cstdlib>
#include <cctype>
#include <ctime>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <numeric>
#include <utility>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <list>
#include <bitset>
#include <complex>
using namespace std;
#define f first
#define s second
#define PB pop_back
#define pb push_back
#define mp make_pair
#define int long long
#define sz(s) (int)s.size()
#define seper(n) setprecision(n)
#define all(v) v.begin(),v.end()
#define mem(a,b) memset(a,b,sizeof a)
#define IOS ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
typedef long long ll;
typedef map<int , int> mii;
typedef pair<int , int> pii;
typedef map<string , int> msi;
typedef pair<int , string> pis;
typedef pair<int , pair<int , int> > piii;
const int MAXN = 3e5 + 10;
int n , a[MAXN] , sum;
int32_t main()
{
        cin >> n;
        for(int i = 0 ; i < 3 * n ; i ++)
                cin >> a[i];
        sort( a , a + 3 * n , greater<int>());
        for(int i = 1 ; i < 2 * n ; i += 2)
                sum += a[i];
        return cout << sum << endl , 0;
}

Measured memory_bytes: 2560
#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 1e9+7;
#define inf 1e18+7;

typedef long long ll;

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

   if(a!=1&&b!=1){
       cout<<1<<endl;

   }
   else if (a!=2&&b!=2) {
       cout<<2<<endl;
   }

   else {
       cout<<3<<endl;
   }


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll          long long int
#define uu          first
#define vv          second
#define pii         pair<int,int>
#define pll         pair<ll,ll>
#define plp         pair<ll,pll>
#define ppp         pair<pll,pll>
#define INF         1e18
#define fastRead    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;

const int MAX = 1e4 + 5;
int n , m  ,s , c[MAX] , d[MAX];
vector<plp>edg[MAX];

ll dist[60][MAX] , ans[MAX];


struct node {

    int id ;
    ll _time , coin;
    node(int a ,ll  b ,ll c) {
        id = a;
        _time = b;
        coin = c;
    }
    
    
};

struct CompareAge {
    bool operator()(node const & p1, node const & p2) {
        // return "true" if "p1" is ordered before "p2", for example:
        return p1._time > p2._time;
    }
};

void dijk() {

    priority_queue<node , vector<node> , CompareAge > pq;
    
    for(int i = 0 ; i < MAX ; i++ ) {
        for(int j =1 ; j <=n ; j++ ) {
            dist[j][i] = INF;
        }
    }
    
    for(int i =2 ; i <=n ; i++ ) ans[i] = INF;
    
    s= min(s , MAX-1);
    dist[1][s] = 0;
    
    pq.push(node(1 , 0 , s));
    
    while(!pq.empty()) {
        
        
        node top = pq.top();
        pq.pop();
        
        int idNow = top.id;
        ll timeNow = top._time;
        ll coinNow = top.coin;
        if(timeNow < 0) continue;
        
        if(timeNow > dist[idNow][coinNow]) continue;
        
        
//        cout<<idNow<<" "<<timeNow<<" "<<coinNow<<'\n';
        
        ans[idNow] = min(ans[idNow] , timeNow);
                    
                    
        if(coinNow < MAX ) {
                
            ll newCoin = coinNow + c[idNow] ;
            ll newTm = timeNow + d[idNow];
            
            newCoin = min(newCoin , 1LL*MAX-1);
            
            
            if(dist[idNow][newCoin] > newTm) {
                dist[idNow][newCoin] = newTm;
                pq.push(node(idNow , newTm , newCoin ));
            }
        }
        
        for(auto x : edg[idNow]) {
            
            int id = x.uu;
            ll cst = x.vv.uu;
            ll tm = x.vv.vv;
            
            ll newCoin = coinNow - cst;
            ll newTm = timeNow + tm;
            
            if(newCoin < 0 ) continue;
            
            if(dist[id][newCoin] > newTm) {
               dist[id][newCoin] = newTm;
               pq.push(node(id , newTm , newCoin)) ;
            }
            
        }
    }
}



int main()
{
    fastRead;
    cin>>n>>m>>s;
    for(int i = 0 ; i < m ; i++ ) {
        int u , v , a , b;
        cin>>u>>v>>a>>b;
        edg[u].push_back({v , {a,b}});
        edg[v].push_back({u , {a,b}});
    }
    for(int i =1 ; i<=n ; i++ ) cin>>c[i]>>d[i];
    dijk();
    
    for(int i =2 ; i <=n ; i++ ) cout<<ans[i]<<'\n';
    return 0;
    
}

Measured memory_bytes: 19672