akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    C = [list(map(int, input().split())) for _ in range(3)]

    b2_1 = C[0][1] - C[0][0]
    b3_1 = C[0][2] - C[0][0]

    if (any([b2_1 != C[x][1] - C[x][0] for x in [1, 2]]) or
            any([b3_1 != C[x][2] - C[x][0] for x in [1, 2]])):
        print("No")
    else:
        print("Yes")


if __name__ == "__main__":
    main()


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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define fst first
#define snd second
#define pb push_back
#define ALL(x) x.begin(),x.end()
#define EPS (1e-9)
#define equals(a,b) (fabs((a)-(b))<EPS)

using namespace std;

bool LT(double a,double b) { return !equals(a,b) && a < b; }
bool LTE(double a,double b) { return equals(a,b) || a < b; }

const string YES = "";
const string NO  = "";

typedef long long ll;
typedef pair<int,int> ii;

void solve() {

}


const int  MAX = 1100000;

vector<int> prime;
ll isntprime[MAX+1];
	
void init(){
  //isntprime[0] = isntprime[1] = 1;
  ll j;	
  for(ll i=1;i<=MAX;i++)
    //if(isntprime[i]==0)
      for(j=i;j<=MAX;j+=i)++isntprime[j];
}



//set<ll> getDiv(ll n){
ll getDiv(ll n){
  set<ll> res;
  for(ll i=1;i*i<=n;i++)
    if(n%i == 0)
	{
	  res.insert(i);
	  if(i*i != n) 
	    res.insert(n/i);
	}
  return (ll)res.size();
}


int main() {
  init();
  ll N;
  cin >> N;

  //init(N+10);
  
  ll ans = 0;
  for(ll C=1;C<=N;++C) {
    //ans += prime_factor(N-C).size();
    //ans += getDiv(N-C);
    ans += isntprime[N-C];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 12216
#include<bits/stdc++.h>
using namespace std;
int main(void){
	int a[4];
	for(int i=0;i<4;i++)	cin>>a[i];
	int e,f;
	cin>>e>>f;
	sort(a,a+4,greater<int>());
	if(e<f){
		cout<<a[0]+a[1]+a[2]+f<<endl;
	}
	else{
		cout<<a[0]+a[1]+a[2]+e<<endl;
	}
	return 0;
}


Measured memory_bytes: 3152
X, Y = map(int, input().split())
ans = 0

MOD = 10 ** 9 + 7
class modint:
    def __init__(self, x):
        self.x = x.x if isinstance(x, modint) else x % MOD
    def __str__(self): return str(self.x)
    __repr__ = __str__
    def __int__(self): return self.x
    __index__ = __int__
    def __add__(self, other): return modint(self.x + modint(other).x)
    def __sub__(self, other): return modint(self.x - modint(other).x)
    def __mul__(self, other): return modint(self.x * modint(other).x)
    def __pow__(self, other): return modint(pow(self.x, modint(other).x, MOD))
    def __floordiv__(self, other): return modint(self.x * pow(modint(other).x, MOD - 2, MOD))
    def __lt__(self, other): return self.x < modint(other).x
    def __gt__(self, other): return self.x > modint(other).x
    def __le__(self, other): return self.x <= modint(other).x
    def __ge__(self, other): return self.x >= modint(other).x
    def __eq__(self, other): return self.x == modint(other).x
    def __ne__(self, other): return self.x != modint(other).x
    def inv(self): return pow(self.x, MOD - 2, MOD)

def modC(n, r):  # nCr = n!/(n-r)!r!
    r = min(r, n - r)
    ans = modint(1)
    for i in range(n, n - r, -1):
        ans *= i
    for i in range(2, r + 1):
        ans //= i
    return ans

if (2 * Y - X) % 3 != 0 or (2 * X - Y) % 3 != 0:
    print(0)
else:
    a, b = (2 * Y - X) // 3, (2 * X - Y) // 3
    if a == 0 and b == 0:
        print(1)
    elif a < 0 or b < 0:
        print(0)
    else:
        print(modC(a + b, a))


Measured memory_bytes: 41840
/*ヽ｀、ヽ｀｀、ヽ｀ヽ｀、、ヽ ｀ヽ 、ヽ｀🌙｀ヽヽ｀ヽ、ヽ｀
ヽ｀、ヽ｀｀、ヽ 、｀｀、 ｀、ヽ｀ 、｀ ヽ｀ヽ、ヽ ｀、ヽ｀｀、
ヽ、｀｀、｀、ヽ｀｀、 、ヽヽ｀、｀、、ヽヽ、｀｀、 、 ヽ｀、 
ヽ｀｀、 ヽ｀ヽ｀、、ヽ ｀ヽ 、 🚶ヽ｀｀｀｀ヽヽヽ｀、、ヽ｀、、ヽ*/

// #pragma GCC optimize ("O3")
// #pragma GCC target ("sse4")

#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,b,a) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
 
#define bug(x) cout<<#x<<"="<<x<<endl; 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
 
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const ld pii=3.14159265359; 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 200001; //check the limits, dummy
 
int main() 
{
	ios_base::sync_with_stdio(0); cin.tie(0);    
	int T;cin>>T;
	cout<<1-T<<nl;
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343

Measured memory_bytes: 3612
#include "bits/stdc++.h"

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> veci;
typedef vector<ll> vecll;
typedef vector<string> vecs;
template<class T,class U> using Hash=unordered_map<T,U>;

#define REP(i, a, n) for(ll i = a; i < (ll)n; i++)
#define RREP(i, a, n) for(ll i = n-1; i >= a; i--)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, n) RREP(i, 0, n)
#define MD 1000000007
#define _SPLIT " "

template<class T> T read(){T a;cin >> a;return a;}
template<class T> void read(T& a){cin >> a;}
template<class T,class ...Args> void read(T& a, Args&... args){cin >> a; read(args...);} 
template<class T> void rarr(T a, int n){for(int i = 0; i < n; i++) {cin >> a[i];}}
template<class T> void write(T a){cout << setprecision(12) << a << endl;}
template<class T,class ...Args> void write(T a, Args... args){cout << setprecision(12) << a << _SPLIT; write(args...);}
template<class T> void warr(vector<T> a, const char* c = " "){cout << a[0];for(int i = 1; i < (int)a.size(); i++)cout << c << a[i];cout << endl;;}
template<class T> void warr(T a, int n, const char* c = " "){cout << a[0];for(int i = 1; i < n; i++)cout << c << a[i];cout << endl;}
void split(string s, string delim, veci& result){result.clear();string::size_type pos = 0;while(pos != string::npos){string::size_type p = s.find(delim, pos);if(p == string::npos){result.push_back(atoi(s.substr(pos).data()));break;}else {result.push_back(atoi(s.substr(pos, p - pos).data()));}pos = p + delim.size();}}
void split(string s, string delim, vecs& result){result.clear();string::size_type pos = 0;while(pos != string::npos){string::size_type p = s.find(delim, pos);if(p == string::npos){result.push_back(s.substr(pos));break;}else {result.push_back(s.substr(pos, p - pos));}pos = p + delim.size();}}
ll gcd(ll a, ll b){while(true){ll k = a % b;if(k == 0)return b;a = b;b = k;}}
ll comb(ll n, ll m){ll p=1;m=min(m,n-m);for(ll i=1;i<=m;i++){p*=n-i+1;p/=i;}return p;}

int main(void)
{
    int n;
    read(n);
    write(n*(n+1)/2);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
#define pb push_back
#define pii pair < int , int >
#define F first
#define S second
#define endl '\n'
#define int long long
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#define kill(x) return cout<<x<<'\n', 0;
using namespace std;
const int N=1e5+100;
vector <int> a;
vector <int> b;
int32_t main(){
    ll n,k;
    cin >> n >> k;
    for (int i=1;i<=n;i++){
        ll x;
        cin >> x;
        if (x==0){
            k--;
            continue;
        }
        if (x<0) a.pb(x);
        else b.pb(x);

    }
    if (k==0) kill(0);
    reverse(a.begin(),a.end());
    ll mi=(ll)1e10+100;
    if (k-1<a.size())
    mi=min(mi,-a[k-1]);
    if (k-1<b.size())
    mi=min(mi,b[k-1]);
    for (int i=0;i<min(k-1,(ll)a.size());i++){
        ll z=k-i-2;
        if (z<b.size())
        mi=min(mi,2*-a[i]+b[z]);
    }
    for (int i=0;i<min(k-1,(ll)b.size());i++){
        ll z=k-i-2;
        if (z<a.size())
        mi=min(mi,2*b[i]-a[z]);
    }
    cout << mi << endl;
}


Measured memory_bytes: 4448
#include<cstdio>
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<fstream>
using namespace std;
int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		int t,x,y;
		cin>>t>>x>>y;
		if(x+y>t)
		{
			cout<<"No"<<endl;
			return 0;
		}
		if((x+y)%2!=t%2)
		{
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}

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

int main(void){
    int x = 0,n;
    string s;
    cin >> n >> s;
    int max = 0;
    for(int i = 0;i < n;i++){
        if(s[i] == 'I')x++;
        else x--;
        if(max < x)max = x;
    }
    cout << max << endl;
}


Measured memory_bytes: 256
def parent(array, index)
	if(index != 1)
	  "parent key = #{array[index/2]}, "
	end
end
def keys(array, index)
	left = 2*index
	right = 2*index + 1
	if(left < array.length && right < array.length)
		"left key = #{array[left]}, right key = #{array[right]}, "
	elsif(left < array.length && right >= array.length)
		"left key = #{array[left]}, " 
	elsif(right < array.length && left >= array.length)
		"right key = #{array[right]}, " 
	end 
end
def read_tree(a)
  a.insert(0,0)
	for i in 1...(a.length)
   puts "node #{i}: key = #{a[i]}, #{parent(a, i)}#{keys(a, i)}"
  end
end

array = gets.chomp
array = gets.chomp
array = array.split().map(&:to_i)
read_tree(array);

Measured memory_bytes: 8688
#include<iostream>
using namespace std;
#include<algorithm>
#include<string>
#define REP(i,a) for(int  i=0;i<a;i++)
int A[101][101];
int B[101][101];
int main(){
	int a,b=0,c=0,d,n,m;	
	cin>>n>>m;
	while(n!=0||m!=0){
	REP(i,m){
		REP(j,m){
			A[i][j]=10001;
			B[i][j]=10001;
		}
		A[i][i]=0;
		B[i][i]=0;
	}
	REP(i,n){
	cin>>a>>b>>c>>d;
	A[a-1][b-1]=c;
	B[a-1][b-1]=d;	
	A[b-1][a-1]=c;
	B[b-1][a-1]=d;
	}
	REP(k,m){
		REP(i,m){
		if(i==k) continue;
	 		REP(j,m){
		if(i==j)continue;
		A[i][j]=min(A[i][j],A[i][k]+A[k][j]);
		B[i][j]=min(B[i][j],B[i][k]+B[k][j]);
			}
		}	
	}
	cin>>n;
	REP(i,n){
	cin>>a>>b>>c;
	if(c==0) cout<<A[a-1][b-1]<<endl;
	else cout<<B[a-1][b-1]<<endl;
	}
	cin>>n>>m;
	}
	return 0;
}

Measured memory_bytes: 1236
#include <iostream>
using namespace std;
int main(){
	int N;
	int K,P;
	cin>>N;
	for(int i=1;i<=N;i++){
		cin>>K>>P;
		if(K<P){
			cout<<K<<endl;
		}else if(K%P==0){
			cout<<P<<endl;
		}else if(K%P!=0&&K%P){
			cout<<K%P<<endl;
		}
	}
}

Measured memory_bytes: 1160
// tsukasa_diary's programing contest code template
#include <bits/stdc++.h>
using namespace std;
// define
#define for_(i,a,b) for(int i=a;i<b;++i)
#define for_rev(i,a,b) for(int i=a;i>=b;--i)
#define allof(a) a.begin(),a.end()
#define minit(a,b) memset(a,b,sizeof(a))
#define size_of(a) (int)a.size()
// typedef
typedef long long lint;
typedef double Double;
typedef pair<int, int> pii;
//
typedef vector< int > Array;
typedef vector< Array > Matrix;
typedef vector< Double > DArray;
typedef vector< DArray > DMatrix;
typedef vector< string > SArray;
typedef vector< pii > PArray;
// popcount
inline int POPCNT(int _x) { return __builtin_popcount(_x); }
inline int POPCNT(lint _x) { return __builtin_popcountll(_x); }
// inf
const int iINF = 1L << 30;
const lint lINF = 1LL << 60;
// eps
Double EPS = 1e-9;
// in range
inline bool in_range(int _v, int _mx, int _mi) { return _mi <= _v && _v < _mx; }
inline bool in_range(Double _v, Double _mi, Double _mx) { return -EPS < _v - _mi && _v - _mx < EPS; }
inline bool in_range(int _x, int _y, int _W, int _H) { return 0 <= _x && _x < _W && 0 <= _y && _y < _H; }
// neighbor clockwise
const int DX[4] = {0,1,0,-1}, DY[4] = {-1,0,1,0};
const int DX_[8] = {0,1,1,1,0,-1,-1,-1}, DY_[8] = {-1,-1,0,1,1,1,0,-1};

int n, k, s;

int dp[25][11][200];

void solve() {
	minit(dp, 0);
	
	dp[0][0][0] = 1;
	for_(i,0,n) {
		int add = i + 1;
		
		for_(j,0,k + 1) {
			
			for_(v,0,s+1) {
				dp[i + 1][j][v] += dp[i][j][v];
				dp[i + 1][j + 1][v + add] += dp[i][j][v];
			}
		}
	}
	
	cout << dp[n][k][s] << endl;
}

int main() {
	while (cin >> n >> k >> s, n) {
		solve();
	}
	return 0;
}

Measured memory_bytes: 1384
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>

using namespace std;

#define ll long long
#define P pair<int, int>
#define FOR(i, N) for (int i = 0; i < (int)N; i++)
#define FORIN(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define GI(name) \
  int(name);     \
  scanf("%d", &(name))
#define GI2(name1, name2) \
  int(name1), (name2);    \
  scanf("%d %d", &(name1), &(name2))
#define GI3(name1, name2, name3) \
  int(name1), (name2), (name3);  \
  scanf("%d %d %d", &(name1), &(name2), &(name3))
#define GVI(name, size)    \
  vector<int>(name)(size); \
  FOR(i, (size)) scanf("%d", &(name)[i])
#define GS(name) \
  string(name);  \
  cin >> (name);
#define MOD 1000000007
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

string to_string(string s) {
  return s;
}

template <class T>
string to_string(vector<T> v) {
  string ret = "{";
  FOR(i, v.size() - 1) { ret += to_string(v[i]) + ","; }
  if (v.size() > 0) {
    ret += to_string(v.back());
  }
  ret += "}";
  return ret;
}

void debug() {
  cerr << endl;
}

template <class Head, class... Tail>
void debug(Head head, Tail... tail) {
  cerr << to_string(head) << " ";
  debug(tail...);
}

void print() {
  cout << endl;
}

template <class Head, class... Tail>
void print(Head head, Tail... tail) {
  cout << to_string(head);
  print(tail...);
}

int main() {
  GI(N);
  GVI(A, N);
  ll ans = 0;
  vector<int> last_1(20, -1), last_last_1(20, -1);
  FOR(i, N) {
    int a = A[i];
    vector<int> counts(20);
    FOR(b, 20) {
      if ((a >> b) & 1) {
        counts[b] = i - last_1[b];
        last_last_1[b] = last_1[b];
        last_1[b] = i;
      } else {
        counts[b] = i - last_last_1[b];
      }
    }
    ans += *min_element(ALL(counts));
  }
  print(ans);
  return 0;
}

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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))

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

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

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

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

  LL N, K;
  cin >> N >> K;
  VL xs(N);
  REP(i,N) cin >> xs[i];
  SORT(xs);
  LL g = xs[0];
  REP(i,N) g = gcd(g, xs[i]);

  bool ok = false;
  REP(i,N){
	if(xs[i] >= K){
	  ok = ok || (xs[i] - K) % g == 0;
	}
  }
  cout << (ok?"POSSIBLE":"IMPOSSIBLE") << endl;

  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long i64;
const int MAX = 1e6 + 10;
const int MOD = 1e9 + 7;
const int oo = 1e9;
bool seen[MAX];
bool ff[MAX];
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	#define endl '\n'
	int n; cin >> n;
	vector<int> a(n);
	for(int i = 0; i <n ;i ++)
		cin >> a[i];
	int ans = 0;
	sort(a.begin(), a.end());
	vector<int> b;
	for(int i = 0; i <n; i++){
		if(i > 0 && a[i] == a[i - 1]){
			ans++;
			if(i == n - 1 or a[i] != a[i + 1])ans++;
			ff[a[i]] = true;
		}
		else b.push_back(a[i]);
		
	}
	for(auto e:b){
		if(!ff[e])
		for(int i = 1; i * i <= e; i++)
			if(e % i == 0 and (seen[i] or seen[e / i])){
				ans++; break;
			}
		seen[e] = true;
	}
	cout << n - ans << endl;

}


Measured memory_bytes: 6672
#include <bits/stdc++.h>
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FORD(i, a, b) for(int i = (a); i >= (b); --i)
#define VAR(v, i) __typeof(i) v=(i)
#define FORE(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define all(v) (v).begin(),(v).end()
 
#define PII pair<int,int>
#define mp make_pair
#define st first
#define nd second
#define pb push_back
#define lint long long int
#define VI vector<int>

using namespace std;

template<class TH> void _dbg(const char *sdbg, TH h){cerr<<sdbg<<"="<<h<<"\n";}
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;cerr<<"="<<h<<","; _dbg(sdbg+1, a...);
}

template<class T> ostream &operator<<(ostream &os, vector<T> V){
  os<<"[";for(auto vv:V)os<<vv<<",";return os<<"]";
} 

template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.st << "," << P.nd << ")";
}


#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
 
#define make( x) int (x); scanf("%d",&(x));
#define make2( x, y) int (x), (y); scanf("%d%d",&(x),&(y));
#define make3(x, y, z) int (x), (y), (z); scanf("%d%d%d",&(x),&(y),&(z));
#define make4(x, y, z, t) int (x), (y), (z), (t); scanf("%d%d%d%d",&(x),&(y),&(z),&(t));
#define makev(v,n) VI (v); FOR(i,0,(n)) { make(a); (v).pb(a);} 
#define IOS ios_base::sync_with_stdio(0)
#define HEAP priority_queue
 
#define read( x) scanf("%d",&(x));
#define read2( x, y) scanf("%d%d",&(x),&(y));
#define read3(x, y, z) scanf("%d%d%d",&(x),&(y),&(z));
#define read4(x, y, z, t) scanf("%d%d%d%d",&(x),&(y),&(z),&(t));
#define readv(v,n) FOR(i,0,(n)) { make(a); (v).pb(a);}
#define jeb fflush(stdout)

int n;
vector<pair<PII,int> > v;
vector<pair<PII,int> > w;
vector<pair<int, PII> > e;
const int max_n = 3e5+5;
int fu[max_n];

int fup(int v) {
	return (fu[v] == v) ? v : (fu[v] = fup(fu[v]));
}

int main () {
	read(n);
	FOR(i,0,n) {
		make2(a, b);
		v.pb(mp(mp(a,b),i));
		w.pb(mp(mp(b,a),i));
	}
	sort(all(v));
	sort(all(w));
	FOR(i,0,n-1) {
		int c = min(abs(v[i].st.st-v[i+1].st.st), abs(v[i].st.nd-v[i+1].st.nd));
		int cw = min(abs(w[i].st.st-w[i+1].st.st), abs(w[i].st.nd-w[i+1].st.nd));
		PII x = mp(v[i].nd, v[i+1].nd);
		PII xw = mp(w[i].nd, w[i+1].nd);
		e.pb(mp(c,x));
		e.pb(mp(cw,xw));
	}
	sort(all(e));
	FOR(i,0,n) fu[i] = i;
	lint cost = 0;
	FORE(i, e) {
		int v = i->nd.st;
		int w = i->nd.nd;
		v = fup(v);
		w = fup(w);
		if (v == w) continue;
		cost += i->st;
		fu[v] = w;
	}
	printf("%lld\n", cost);

	return 0;
}


Measured memory_bytes: 8364
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
    WRITER:kakitamasziru/OxOmisosiru
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
//#include <unordered_map> // unordered_map
//#include <unordered_set> // unordered_set
#include <bitset> // bitset
//#include <cctype> // isupper, islower, isdigit, toupper, tolower
//It is so troublesome that I include bits/stdc++.h !
using namespace std;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const long long INF = 100100100100100;
const int MOD = 1000000007;
typedef pair<int,int> P;
//NのM乗を求める(繰り返し二乗法)
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}

int main() {
    int N;cin >> N;
    vector<int> monster(N+1);
    vector<int> saver(N);
    for(int i = 0;i<N+1;i++) cin >> monster.at(i);
    for(int i = 0;i<N;i++) cin >> saver.at(i);
    long long ans = 0;
    for(int i = 0;i<N;i++){
        if(monster.at(i) <= saver.at(i)){
            ans += monster.at(i);
            saver.at(i) -= monster.at(i);
            ans += min(monster.at(i+1),saver.at(i));
            monster.at(i+1) -= min(monster.at(i+1),saver.at(i));
            
        }
        else {
            ans += saver.at(i);
            monster.at(i) -= saver.at(i);
        }
    }

    cout << ans << endl;

    // PLEASE GIVE ME THE "ACCEPTED" !
}

Measured memory_bytes: 1024
#include <stdio.h>

int main(){
  int a[251],h,i;
  scanf("%d",&h);
  for(i=1;i<=h;i++) scanf("%d",&a[i]);
  for(i=1;i<=h;i++){
    printf("node %d: key = %d, ",i,a[i]);
    if(i/2!=0) printf("parent key = %d, ",a[i/2]);
    if(h>=2*i) printf("left key = %d, ",a[i*2]);
    if(h>=2*i+1) printf("right key = %d, ",a[i*2+1]);
    printf("\n");
  }
  return 0;
}
  



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

#define REP(i, start, count) for(int i=(start); i<(int)(count); ++i)
#define rep(i, count) REP(i, 0, count)
#define ALLOF(c) (c).begin(), (c).end()

typedef long long ll;
typedef unsigned long long ull;

int N;

int main(void) {
    cin >> N;

    
    vector<pair<int, int>> town(N);
    rep(i, N) {
        int x, y;
        cin >> town[i].first >> town[i].second;
    }

    vector<int> order(N);
    rep(i, N) order[i] = i;

    long double res = 0;
    int comb_count = 0;
    do {
        REP(i, 1, N) {
            res += sqrtl(pow(town[order[i]].first - town[order[i - 1]].first, 2) + pow(town[order[i]].second - town[order[i - 1]].second, 2));
        }

        comb_count++;
    } while (next_permutation(ALLOF(order)));

    cout << fixed << setprecision(10) << res / comb_count << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define inf 0x3f3f3f3f
#define linf 0x3f3f3f3f3f3f3f3fll //9223372036854775807
#define pi acos(-1.0)
#define ms(a,b) memset(a,b,sizeof(a))
#define nl "\n"
#define FAST_IO ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
typedef long long ll;
const int mod = 998244353;
//ll qpow(ll x, ll y){ll s=1;while(y){if(y&1)s=s*x%mod;x=x*x%mod;y>>=1;}return s;}
ll qpow(ll a, ll b){ll s=1;while(b>0){if(b%2==1)s=s*a;a=a*a;b=b>>1;}return s;}
inline ll read(){ll x=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();return x*f;}
ll inve(ll x){return x==1?1:(mod-mod/x)*inve(mod%x)%mod;}

const int N = 1e6;

ll a, b, k;

int main()
{
    cin>>k>>a>>b;
    if(a>b) return cout<<(k+1)<<nl,0;
    if(k<=a) return cout<<(k+1)<<nl,0;
    ll ans = a;
    ll tk = k-a+1;
    ll tmp = tk/2;
    ans += (b-a)*tmp+(tk%2);
    ans = max(ans,k+1);

    cout<<ans<<nl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FASTIO ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define LL long long int
using namespace std;

const int N = 1e5 + 5;
const int oo = 1e9 + 5;
const int MOD = 1e9 + 7;

void solve() {
    LL a;
    cin >> a;
     cout  << a + a * a + a * a * a << '\n';
} 

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

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pairSS
#define int long long
int gcd(int a,int b){
  if(a==0){
    return b;
  }
  return gcd(b%a,a);
}
int lcm(int a,int b){
  return a*b/gcd(a,b);
}
signed main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  int cd = lcm(c,d);
  int bbb = b - b/c - b/d + b/cd;
  int aaa = a-1 - (a-1)/c - (a-1)/d + (a-1)/cd;
  cout << bbb - aaa << endl;
}


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

int main() {
    string s;
    cin >> s;
    int n = s.size();
    int cnt0 = 0, cnt1 = 0;
    for (int i = 0; i < n; i++) {
        if (s[i] == '0') cnt0++;
        else cnt1++;
    }

    cout << 2 * min(cnt0, cnt1) << endl;
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s, t;
  cin >> s >> t;
  rep(i, s.size()) {
    if (s[i] != t[i]) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}

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

#define all(x)        (x).begin(),(x).end()
#define mp            make_pair
#define pb            push_back
#define fi            first
#define se            second
#define sz(x)         ((int)(x).size())
#define rep(x,y,z)    for(int x=y;x<z;x++)
#define per(x,z,y)    for(int x=z-1;x>=y;x--)
#define trav(y,x)     for(auto& y:x)
#define pii           pair<int,int>
#define vi            vector<int>

int dbg = 0;
#define cri           if(0)
#define shame         cri cerr<<(++dbg)<<"\n\n";

// aaaaaaaaaaaaaaaa
const int N = 2e5 + 1;
const int lg = 20;
const ll mod = 0xfffff;


void solve() {
  int x; cin >> x;
  int y = 0;
  y += 1000 * (x / 500);
  x %= 500;
  y += 5 * (x / 5);
  x %= 5;
  cout << y << "\n";
}

int main() {
  // freopen("input.in", "r", stdin);
  // freopen("input.out", "w", stdout);
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	// cout<<setprecision(15);
	// int t; cin>>t; while(t--)
	solve();
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ll N;
  cin >> N;
  ll A[N];
  ll ans = 0;
  map<ll,ll> Mp;
  for (int i = 0;i < N; i++) {
    cin >> A[i];
  }
  for (int i = 0; i < N; i++) {
    ans += Mp[(i + 1) - A[i]];
    Mp[A[i] + (i + 1)]++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 27784
N = int(input())
H = list(map(int, input().split()))
flag = True
min_ = int(10**9 + 1)

for i in H[::-1]:
    if i <= min_:
        min_ = i
    elif i == min_ + 1:
        pass
    else:
        flag = False

if flag:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 14396
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
ans =0
B=[0]*N
K =abs(T-H[0]*0.006-A)
for i in range(N):
    B[i]=abs(T-H[i]*0.006-A)
    if B[i]<K:
        K=B[i]
        ans=i
print(ans+1)

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

using namespace std;
int main(){
    int a,b,c,d,e,k;
    cin >> a >> b >> c >> d >> e >> k;
    bool ans = (k<(e-a));
    if(ans) cout << ":(" << endl;
    else cout << "Yay!" << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;

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

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

int main() {
  string S;
  cin >> S;
  int ans = 0;
  rep(i, S.size() - 1) {
    if (S[i] != S[i + 1])
      ans++;
  }
  cout << ans << endl;
}

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

int main()
{
    int sx,sy,gx,gy;
    scanf("%d %d %d %d",&sx,&sy,&gx,&gy);
    for(int i=0;i<gx-sx;i++){
        cout << "R";
    }
    for(int i=0;i<gy-sy;i++){
        cout << "U";
    }
    for(int i=0;i<gx-sx;i++){
        cout << "L";
    }
    for(int i=0;i<gy-sy;i++){
        cout << "D";
    }
    cout << "D";
    for(int i=0;i<=gx-sx;i++){
        cout << "R";
    }
    for(int i=0;i<=gy-sy;i++){
        cout << "U";
    }
    cout << "LU";
    for(int i=0;i<=gx-sx;i++){
        cout << "L";
    }
    for(int i=0;i<=gy-sy;i++){
        cout << "D";
    }
    cout << "R\n";
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define in(x) cin >> x
#define out(str) cout << str << endl

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

int N,A;

int main(){
    cin>>N>>A;
    out((N%500<=A?"Yes":"No"));
}


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

char s[110];

int main() {
    scanf("%s", s+1);
    int len = strlen(s+1);
    int ans = 0;
    for(int i=1; i<=len/2; i++) {
        if(s[i]!=s[len-i+1])
            ans++;
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 256
integer,parameter :: p = 8
integer(p) :: n,i

read*,n

do i = ceiling(sqrt(real(n))),1,-1
  if( mod(n,i)==0 ) exit
end do

print*,max(digit(i),digit(n/i))

contains
function digit( n ) result( i )
  integer(p) :: i,n
  i = 0
  do while( n/=0 )
    n = n / 10
    i = i + 1
  end do
end function
    

end


Measured memory_bytes: 2844
import re

s = input()
n = len(s)
res = 0
for i in range(0, n):
    j = i
    tempres = 0
    while j < n and (s[j] == "A" or s[j] == "G" or s[j] == "C" or s[j] == "T"):
        j += 1
        tempres += 1
    res = max(res, tempres)

print(res)



Measured memory_bytes: 3188
//in the name of Allah
//#isart
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define S second
#define F first
#define MP make_pair
const int N = 1e5 + 10;
ll a[N], ps[N];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	for(int i = 0; i < n; i ++)
		cin >> a[i];
	sort(a, a + n);
	for(int i = 1; i <= n; i ++)
		ps[i] = ps[i - 1] + a[i - 1];
	int ans = n;
	for(int i = n - 1; i >= 0; i --)
		if(a[i] > 2 * ps[i]){
			ans = n - i;
			break;
		}
	cout << ans << endl;
	//system("pause");
	return 0;
}

Measured memory_bytes: 1792
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args) {
#if DEBUG
        //MyDebugger.MakeTestCase("../TextFile2.txt"); return;
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var spl = input.ReadLine().Split(' ');
        var a = long.Parse(spl[0]);
        var b = long.Parse(spl[1]);

        if (a > b) {
            var tmp = a;
            a = b;
            b = tmp;
        }

        List<long> list = soinsu(a);

        long count = 0;

        foreach(var v in list) {
            if (b % v == 0) count++;
        }
        return count+1;
    }

    static List<long> soinsu(long n) {
        var list = new List<long>();

        for (long i = 2; i <= Math.Sqrt(n); i++) {
            if (n % i == 0) {
                list.Add(i);
                while (n % i == 0) n /= i;
            }
        }

        if (n > 1) list.Add(n);

        return list;

        //if(n%2==0){
        //    list.Add(2);
        //}
    }
}


Measured memory_bytes: 13268
#include<bits/stdc++.h>
#define Fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int num1,num2;
string s[100];
int dx[4]={-1,0,1,0};
int dy[4]={0,1,0,-1};
map<pair<int,int>,int> am,vis;
int test;
int c=0;
bool valid(int x,int y){
    if(x>=0 && y>=0 && x<num1 && y<num2 && s[x][y]=='.'){
        return true;
    }
    else{
        return false;
    }
}
void bfs(int x,int y){
    queue<pair<int,int> >q;
    q.push({x,y});
    vis[{x,y}]=1;
    while(!q.empty()){
        pair<int,int>qq;
        qq=q.front();
        int xx=qq.first;
        int yy=qq.second;
        q.pop();
        for(int i=0;i<4;i++){
            int x1=xx+dx[i];
            int y1=yy+dy[i];
            if(vis[{x1,y1}]==0 && valid(x1,y1)==true){
                am[{x1,y1}]=am[{xx,yy}]+1;
                c=max(c,am[{x1,y1}]);
                vis[{x1,y1}]=1;
                q.push({x1,y1});
            }
        }
    }
}
int main()
{
    cin>>num1>>num2;
    for(int i=0;i<num1;i++){
        cin>>s[i];
    }
    int ans=0;
    for(int i=0;i<num1;i++){
        for(int j=0;j<num2;j++){
            if(s[i][j]=='.'){
                c=0;
                am.clear();
                vis.clear();
                bfs(i,j);
                ans=max(ans,c);
            }
        }
    }
    cout<<ans<<endl;
}


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

int main(){
    int k,s,x,y,z;
    int count = 0;
    cin >> k >> s;

    for(int x = 0; x <= k; x++){
        for(int y = 0; y <= k; y++){
            z = s - x - y;
            if(0 <= z && z <= k) count++;
        }
    }

    /*
    for(int x = 0; x <= k; x++){
        for(int y = 0; y <= k; y++){
            for(int z = 0; z <= k; z++){
                if(x+y+z == s){
                    count++;
                }
            }
        }
    }
    */
    cout << count << endl;
}

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


int main(){
  string str;
  cin >> str;
  
  string  outstr = "";
  for(int i = 0; i < str.length(); i++){
    if(i%2 == 0) outstr += str[i];
  }
  
  cout << outstr << endl;
}

Measured memory_bytes: 512
package main

import "fmt"

func main() {
	var s string
	var a, b int
	fmt.Scan(&s)

	for i:=0; i<len(s); i++ {
		if s[i] == 48 {
			a++
		} else {
			b++
		}
	}

	if a > b {
		fmt.Println(b*2)
	} else {
		fmt.Println(a*2)
	}

}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace         std;
#define                 int long long
#define                 pb push_back
#define                 mp make_pair
#define st(arr,a)       memset(arr,a,sizeof arr)
#define                 nl cout<<endl
#define                 real signed
#define                 endl '\n'              
#define bitcount(x)     __builtin_popcountll(x)
const int MOD = 1000000007ll;
#define forn(i,a,b)     for(int i=a;i<=b;i++)
#define rfor(i,a,b)     for(int i=a;i>=b;i--)
#define all(x)          x.begin() , x.end()
#define pi pair<int,int>
#define X first
#define Y second

//int m,n;



signed main() 
{
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); 
    int n;
    cin>>n;

    string s[3];

    forn(i,0,2)cin>>s[i];

    int ans=0;

    forn(i,0,n-1)
    {
        set<char>dc;
        forn(j,0,2)
            dc.insert(s[j][i]);
        ans+=dc.size()-1;    
    }

    cout<<ans;

    

    
     return 0;

}

//       g++ -g c.cpp ; ./a.exe

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string S;
  cin >> S;
  int res = 0;
  for (int i = 0; i < S.size() - 1; i++) {
    if (S[i] != S[i + 1]) res++;
  }
  cout << res << '\n';
  return 0;
}


Measured memory_bytes: 512
#include<stdio.h>
#include<math.h>

int main(void)
{
    int A, B, C, K, flag=0, i=0, j=0, k=0;

    scanf("%d %d %d", &A, &B, &C);
    scanf("%d", &K);

    for(i=0; i<=K; i++) {
        for(j=0; j<=K-i; j++) {
            for(k=0; k<=K-(i+j); k++) {
                if(A*pow(2,i) < B*pow(2,j) && B*pow(2,j) < C*pow(2,k)) {
                    printf("Yes\n");
                    flag = 1;
                    break;
                }
            }
            if(flag == 1) {
                break;
            }
        }
        if(flag == 1) {
            break;
        }
    }

    if(flag == 0) {
        printf("No");
    }

    return 0;
}

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

int main() {
  int N;
  string S;
  cin >> N >> S;
  if (S.substr(0, N / 2) == S.substr(N / 2, N - N / 2))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<queue>
#include<tuple>

int const MAXN = 60;
double const eps = 5e-7;

int x[MAXN], y[MAXN], c[MAXN], c2[MAXN], ix[MAXN], N, K;
double d2[MAXN];

double min_possible(double x1, double y1, double r1) {
  for(int i = 0; i < N; ++i) {
    double dx = x[i] - x1, dy = y[i] - y1;
    dx = std::max(std::fabs(dx) - r1, 0.0); // min of abs in [dx - r1, dx + r1]
    dy = std::max(std::fabs(dy) - r1, 0.0); // similar
    //d2[i] = (dx*dx + dy*dy)*c2[i];
    d2[i] = std::hypot(dx, dy)*c[i];
  }
  std::nth_element(d2, d2+K-1, d2+N);
  //return std::sqrt(d2[K-1]);
  return d2[K-1];
}

double calc(double xx, double yy) {
  for(int i = 0; i < N; ++i) {
    double dx = x[i] - xx, dy = y[i] - yy;
    //d2[i] = (dx*dx + dy*dy)*c2[i];
    d2[i] = hypot(dx, dy)*c[i];
  }
  std::nth_element(d2, d2+K-1, d2+N);
  //return std::sqrt(d2[K-1]);
  return d2[K-1];
}

int main() {
  std::cin >> N >> K;
  for(int i = 0; i < N; ++i) {
    std::cin >> x[i] >> y[i] >> c[i];
    c2[i] = c[i]*c[i];
  }
  std::queue<std::tuple<double, double, double>> q;
  q.emplace(0.0, 0.0, 1000.0);
  double ans = 1e9;
  while(q.size() > 0) {
    double xx, yy, rr;
    std::tie(xx, yy, rr) = q.front(); q.pop();
    double d = min_possible(xx, yy, rr);
    if((ans-d) <= eps*std::max(d, 1.0)) continue;
    ans = std::min(ans, calc(xx, yy));
    for(double rx:{-0.5, 0.5}) for(double ry:{-0.5, 0.5}) {
      q.emplace(xx+rx*rr, yy+ry*rr, rr*0.5);
    }
  }
  std::cout << std::setprecision(10) << std::fixed << ans << std::endl;
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
  ll N,K;
  cin>>N>>K;
  if(N%K==0) {
cout<<0<<endl;
  }
  else {
cout<<1<<endl;
  }
}

Measured memory_bytes: 3596
//#pragma warning disable
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System;
using System.Numerics;
using System.Threading.Tasks;
using static System.Math;
using static System.Console;
class Z { static void Main() => new K(); }
class K
{
	int F() => int.Parse(ReadLine());
	long FL() => int.Parse(ReadLine());
	int[] G() => ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();
	long[] GL() => ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();
	public const int MOD = 1000000007;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	void Solve()
	{
		var A = G();
		int N = A[0], P = A[1];
		A = G();
		var odd = 0;
		foreach (var a in A) if (a % 2 == 1) odd++;
		if (odd == 0) WriteLine(P == 0 ? 1L << N : 0);
		else WriteLine(1L << (N - 1));
	}
}


Measured memory_bytes: 11348
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define IFOR(i, m, n) for(ll i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main(){
  ll n; cin >> n;
  multiset<ll> st, power;
  REP(i,n){
    ll a; cin >> a;
    st.insert(a);
  }
  ll cur = 2;
  const ll MAX = 2e9;
  while(cur<MAX){
    power.insert(cur);
    cur *= 2;
  }

  ll ans = 0;
  while(!st.empty()){
    auto it = prev(st.end());
    ll now = *it;
    st.erase(it);
    ll target = *power.upper_bound(now) - now;
    it = st.find(target);
    if(it==st.end()) continue;
    ans++;
    st.erase(it);
  }
  cout << ans << endl;
}

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

int main()
{
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	
	while(a>=0 && b>=0)
	{
		c-=b;
		if(c<=0)
		{
			cout<<"Yes"<< endl;
			break;
		}
		a-=d;
		if(a<=0)
		{
			cout<<"No"<< endl;
			break;
		}
	}
	
	return 0;
}


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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

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

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


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

    int ans = 700;
    string S;
    cin >> S;

    for(int i = 0; i < 3; i++){
        if(S[i] == 'o') ans += 100;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
from itertools import combinations, permutations

N = int(input())

# 整数列の生成
# s = [1]
# while len(s) < 10 :
    # i = s[-1] + 1
    
    # while True :
        # path = s.copy() + [i]
        # flag = True
        # for comb in combinations(s + [i], 2) :
            # if not sum(comb) in path :
                # path.append(sum(comb))
            # else :
                # flag = False
                # break
        # if flag :
            # s.append(i)
            # break
        # else :
            # i += 1
            
s = [1, 2, 4, 7, 12, 20, 29, 38, 52, 73]

w = [[0] * 10 for _ in range(10)]
w[0][1] = w[1][0] = 1

for n in range(3, N + 1) :
    # 最長経路探索
    M = 0
    for perm in permutations(range(n-1), n-1) :
        tmp = 0
        for i in range(n-2) :
            tmp += w[perm[i]][perm[i+1]]
        M = max(M, tmp)
    
    M += 1
    
    # 新規割当
    for i in range(n-1) :
        w[i][n-1] = w[n-1][i] = M * s[i]
        
        
for i in range(N) :
    print(' '.join([str(j) for j in w[i][:N]]))

Measured memory_bytes: 40428
const lines: string[] = [];
const reader = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout,
});
reader.on("line", function (line: string) {
  lines.push(line);
});

reader.on("close", function () {
  const rule = lines.shift().split(" ").map(Number);
  const data: number[] = lines
    .shift()
    .split(" ")
    .map((int) => parseInt(int));

  const dp = new Array(data.length).fill(Infinity);
  dp[0] = 0;

  for (let i = 1; i < rule[0]; i++) {
    for (let j = i - rule[1]; j < i; j++) {
      if (j >= 0) {
        dp[i] = Math.min(dp[i], dp[j] + abs(data[j] - data[i]));
      }
    }
  }

  console.log(dp[rule[0] - 1]);
});

function abs(val: number) {
  return val < 0 ? -val : val;
}


Measured memory_bytes: 29248
#include<bits/stdc++.h>
#define rep(i, x) for(ll i = 0; i < x; i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;
const ll INF = 1000000000000000000;
const ll mod = 1000000007;
const ld pi = 3.141592653589793238;
//printf("%.10f\n", n);

ll res0[1234567], test[12][1234567];
signed main() {
    while(true){
	ll n, x, l, q, ans = 0; cin >> n >> x;
	if(n == 0 && x == 0){ break; }
	rep(i, 1234566){
	    res0[i] = 0;
	}
	rep(h, n) {
		rep(i, x) {
			cin >> test[h][i];
			if (test[h][i] == 0) { res0[i]++; }
		}
	}
	for (int i = 0; i <= (1 << n); i++) {
		vector<ll> sep = { }; ll cnt = 0;
		vector<ll> cn(x);
		for (int j = 0; j <= n - 1; j++) {
			if ((i & (1 << j)) > 0) {
				sep.push_back(j);
			}
		}
		rep(h, sep.size()) {
			rep(j, x) {
				if (test[sep[h]][j] == 1) { cn[j]++; }
				else { cn[j]--; }
			}
		}
		rep(i, x) {
			cnt += max(res0[i] + cn[i], n - res0[i] - cn[i]);
		}
		ans = max(ans, cnt);
	}
	cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 13632
// first second push_back unordered return continue break vector visited check flag bool while iterator begin end lower_bound upper_bound temp true false ll_MAX ll_MIN insert erase clear pop push compare ll64_MAX ll64_MIN  reverse replace stringstream string::npos length substr front priority_queue

#ifndef ONLINE_JUDGE
#include "debug.h"
#else
#include <bits/stdc++.h>
using namespace std;
#define debug(...) 42
#endif

typedef long long ll;

typedef struct node {
	ll s, e, val, pos;
	bool operator<(const node& n) const {
		if (e != n.e) return e < n.e;
		return val > n.val;
	}
	node() {};
	node(ll ss, ll ee, ll v, ll p) {
		s = ss, e = ee, val = v, pos = p;
	}
} node;
#define hell 2000007

ll occs[hell], tree[hell], n, ans[hell];

void update(ll x, ll val) {
	while (x <= n) {
		tree[x] += val;
		x += x & -x;
	}
}

ll query(ll x) {
	ll ret = 0;
	while (x > 0) {
		ret += tree[x];
		x -= x & -x;
	}
	return ret;
}

int main()
{
// #ifndef ONLINE_JUDGE
// 	freopen("in.in", "r", stdin);
// #endif

	ll q, s, e;
	vector<node> v;
	// scanf("%d", &n);
	cin >> n >> q;
	for (ll i = 1; i <= n; i++) {
		// scanf("%d", &s);
		cin >> s;

		v.push_back(node(i, i, s, -1));
	}
	for (ll i = 0; i < q; i++) {
		// scanf("%d %d", &s, &e);
		cin >> s >> e;
		v.push_back(node(s, e, 0, i));
	}

	sort(v.begin(), v.end());

	for (ll i = 0; i < v.size(); i++) {
		if (v[i].val == 0) {
			ans[v[i].pos] = query(v[i].e) - query(v[i].s - 1);
		} else {
			if (occs[v[i].val] != 0) update(occs[v[i].val], -1);
			update(v[i].s, 1);
			occs[v[i].val] = v[i].s;
		}
	}

	for (ll i = 0; i < q; i++) {
		cout << ans[i] << "\n";
		// printf("%d\n", ans[i]);
	}

	return 0;
}



Measured memory_bytes: 46944
import std.stdio;

void main() {
	int n, m;
	scanf("%d %d\n", &n, &m);
	auto add = new int[n];
	auto sub = new int[n];
	foreach (i; 0..m) {
		int l, r;
		scanf("%d %d\n", &l, &r);
		++add[l-1];
		++sub[r-1];
	}
	int y, cnt;
	foreach(i; 0..n) {
		y += add[i];
		if (y == m) ++cnt;
		y -= sub[i];
	}
	cnt.write;
}


Measured memory_bytes: 2940
import java.util.Scanner;

 
public class Main {
 
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		long k  = sc.nextLong();
		long count = 1;
		long m = 7 % k;

		if((k % 2 == 0) || (k % 5 == 0)) {
			System.out.println(-1);
			sc.close();
			return;
		}
		
		while(true) {
			if(m == 0) break;
			
			m *= 10;
			m += 7;
			m %= k;
			count++;
		}
		
		System.out.println(count);
		sc.close();
	}
	
}




Measured memory_bytes: 35620
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
#include <numeric>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
//#define MOD 998244353
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=100050;
//↑templete
signed main(){
	int X;
	cin>>X;
	int n=X/100, m=X%100;
	if(m<=5*n)
		cout<<1<<endl;
	else
		cout<<0<<endl;
	return 0;
}



Measured memory_bytes: 256