akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <iterator>
#include <iostream>
#include <sstream>
#include <bitset>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <time.h>
#include <limits>
#include <math.h>
#include <climits>
#include <numeric>
#include <utility>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <functional>
#include<unordered_map>
#include<unordered_set>

using namespace std;
const double pi=acos(-1.0);
//memset ( a , 0 , n * sizeof(ll) ) ;

#define 	boost  		ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); // don't use if small inpts
#define 	endl 		'\n'
#define 	sl(n) 		scanf("%lld",&n)
#define		mp 			make_pair
#define 	pb 			push_back
#define 	ppb 		pop_back
#define 	fi 			first
#define 	se 			second
#define 	ll 			long long
#define 	ull 		unsigned long long
#define 	pii 		pair<int, int>
#define 	f(i,a,b) 	for(ll i = (ll)(a); i < (ll)(b); i++)
#define 	rf(i,a,b) 	for(ll i = (ll)(a); i > (ll)(b); i--)
#define 	ms(a,b) 	memset((a),(b),sizeof(a))
#define 	max(a,b) 	((a>b)?(a):(b))
#define 	min(a,b) 	((a<b)?(a):(b))
#define 	vec(g1) 	int temp;cin>>temp;g1,push_back(temp);
#define 	abs(x) 		((x<0)?(-(x)):(x))
#define 	MAX 		1000005
#define 	inf 		LLONG_MAX
#define 	MIN 		INT_MIN

//typedef
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<int,int> MPII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;


int mod = 1e9 + 7 ;
ll gcd(ll a , ll b){return b==0?a:gcd(b,a%b);}
ll powmod(ll a,ll b) {ll res=1;if(a>=mod)a%=mod;for(;b;b>>=1){if(b&1)res=res*a;if(res>=mod)res%=mod;a=a*a;if(a>=mod)a%=mod;}return res;}
// ll fac[200005];
// ll inverse(ll n){return powmod(n, mod-2);}
// ll nCr(ll n, ll r){return (fac[n] * inverse(fac[r]) % mod * inverse(fac[n-r]) % mod) % mod;}
////****************************************************************************************************************************************************************************************************************////

int main(){
    string s;
    cin>>s;
      s[5]=32;
      s[13]=32;
      cout<<s;
        }

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

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef long double ld;
#define mp make_pair
#define pb push_back

#define rep(i, N) for(ll i = 0; i < N; i++)
#define repa(i, a, N) for(ll i = a; i < N; i++)
#define repr(i, N) for(ll i = N-1; i >= 0; i--)

#define drep(i, N, j, M) rep(i, N) rep(j, M)
#define trep(i, N, j, M, k, L) rep(i, N) rep(j, M) rep(k, L)

#define all(A) A.begin(), A.end()

const double PI = 3.141592653589793;

// const ll mod = 1e9 + 7;
const ll mod = 998244353;

const ll LLMAX = numeric_limits<long long>::max();

void No() {
	cout << "No" << endl;
}

void Yes() {
	cout << "Yes" << endl;
}

ll id(char c) {
	return c - 'a';
}

bool isOK(vi& a, ll k, ll index) {
	return a[index] < k * (index + 1);
}

ll binary_search(vi& a, ll k) {
	ll left = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	ll right = (ll)a.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()

	/* どんな二分探索でもここの書き方を変えずにできる！ */
	while (right - left > 1) {
		ll mid = left + (right - left) / 2;

		if (isOK(a, k, mid))
			right = mid;
		else left = mid;
	}

	/* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
	return right;
}

template<class t, class u>
ostream& operator<<(ostream& os, const pair<t, u>& p) {
	return os << "{" << p.first << "," << p.second << "}";
}

template<class t> ostream& operator<<(ostream& os, const vector<t>& v) {
	os << "{";
	for (auto e : v)os << e << ",";
	return os << "}";
}

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

	vector<double> X(N);
	vector<double> Y(N);

	rep(i, N) {
		cin >> X[i] >> Y[i];
	}
	
	double sum = 0.0;
	rep(i, N-1) {
		repa(k, i + 1, N){
			sum += sqrt(
				(X[i] - X[k])*(X[i] - X[k])
				+ (Y[i] - Y[k])*(Y[i] - Y[k])
			);
		}
	}
	sum /= (double)N / 2.0;

	printf("%.10f", sum);
	
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>

#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class CSwaps {
public:
    static constexpr int kStressIterations = 0;

    static void generateTest(std::ostream& test) {
    }

    void solve(std::istream& cin, std::ostream& cout) {
        int n;
        cin >> n;
        vector<int> a(n), b(n);
        REP(i, n) cin >> a[i];
        REP(i, n) cin >> b[i];

        vector<P> tmpa(n), tmpb(n);
        REP(i, n) tmpa[i] = {a[i], i};
        REP(i, n) tmpb[i] = {b[i], i};
        sort(tmpa.begin(), tmpa.end());
        sort(tmpb.begin(), tmpb.end());

        bool ok = true;
        REP(i, n) {
            if (tmpa[i].first > tmpb[i].first) ok = false;
        }
        if (!ok) {
            cout << "No" << endl;
            return;
        }
        map<int, int> pos;
        REP(i, n) {
            pos[tmpa[i].second] = tmpb[i].second;
        }

        set<int> found;
        int cur = 0;
        while (!found.count(cur)) {
            found.insert(cur);
            cur = pos[cur];
        }

        if (found.size() < n) {
            cout << "Yes" << endl;
            return;
        }

        ok = false;
        REP(i, n - 1) {
            if (tmpa[i + 1].first <= tmpb[i].first) ok = true;
        }
        if (ok) {
            cout << "Yes" << endl;
            return;
        } else {
            cout << "No" << endl;
        }
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    CSwaps solver;
    solver.solve(in, out);
    return 0;
}


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

int main(void)
{
    int ans = 0, cnt = 0;
    for (int i = 0; i < 3; i++){
        char x;
        cin >> x;
        if (x == 'R'){
            cnt++;
        }
        else{
            ans = max(ans, cnt);
            cnt = 0;
        }
    }
    ans = max(ans, cnt);

    cout << ans << endl;

    return 0;
}


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

int main()
{
	string S;
	cin >> S;
	int count = 0;
	for (int i = 0; i < 6; i++) {
		if (S[i] == '1') {
			count++;
		}
	}
	cout << count << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<fstream>
#include<string.h>
using namespace std;


int main() {

	char * ch = new char[13];

	cin >> ch;

	for (int i = 0; i < 12; i++) {
		if (i != 4) {
			cout << ch[i];
		} else {
			cout << " " << ch[i];
		}
	}
	cout << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <tuple>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#define MP(a, b) make_pair(a, b)
#define POWER9 1000000000
#define MOD POWER9+7
#define PI 3.14159265359

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << setprecision(9);

	int N,M,C;
	cin >> N >> M >> C;
	int B[20];
	for(int i=0; i<M; i++) cin >> B[i];
	int ans = 0;
	for(int i=0; i<N; i++){
		int sum = C;
		for(int j=0; j<M; j++){
			int A;
			cin >> A;
			sum += A*B[j];
		}
		if(sum > 0) ans++;
	}
	cout << ans << endl;

	return 0;
}

/*

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
cout << setprecision(9);



return 0;
}
*/

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 9e18
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
ll mod = 1e9+7;
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b){a=b; return true;} return false; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a){a=b; return true;} return false; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill((T*)array, (T*)(array+N), val);}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

class debug
{
public:
    template<typename T> void vdeb(T vec);
    template<typename T1, typename T2> void adeb(T1 *arr, T2 n);
    template<typename T> void mdeb(T mp);
};

#endif //INCLUDE_DEBUG_HPP

template<typename T> void debug::vdeb(T vec)
{
    cout << "#vector set debug" << endl;
    for(auto vv : vec) cout << vv << " ";
    cout << endl;
}

template<typename T1, typename T2> void debug::adeb(T1 *arr, T2 n)
{
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}

template<typename T> void debug::mdeb(T mp)
{
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
debug dbg;

class AAtCoDeerAtCoDeerAndPaintCans {
public:
	void solve(std::istream& in, std::ostream& out)
	{
	    int a, b, c;
	    in >> a >> b >> c;
	    set<int> res{a, b, c};
	    out << res.size() << endl;
	}
};


int main() {
	AAtCoDeerAtCoDeerAndPaintCans solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
int I,O,T,J,L,S,Z,x;
int main(){
	scanf("%d%d%d%d%d%d%d",&I,&O,&T,&J,&L,&S,&Z);
	x=(I%2+J%2+L%2)%3;
	if(I&&J&&L&&x==2) x=1;
	printf("%lld\n",1ll*I+J+L+O-x);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
int main(){
  ll n,m;
  cin>>n>>m;
  if(n==m) COUT("Yes");
  else COUT("No");
}

Measured memory_bytes: 764
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
using namespace std;
typedef long long int lli;
const lli inf = 1e17;
const lli def = 1000000000000000;

vector<lli> dijkstra(lli start, vector<vector<pair<lli, lli> > > &adj){
    priority_queue<pair<lli, lli> > wait;
    wait.push(make_pair(0LL, start));
    vector<lli> mincost(adj.size(), inf);
    mincost[start] = 0;
    while(!wait.empty()){
        lli v = wait.top().second;
        lli cost = -wait.top().first;
        wait.pop();
        if(cost > mincost[v]) continue;

        for(auto& next :adj[v]){
            lli nv = next.first;
            lli ncost = cost +next.second;
            if(ncost < mincost[nv]){
                mincost[nv] = ncost;
                wait.push(make_pair(-ncost, nv));
            }
        }
    }
    return mincost;
}

int main(){
    int n,m,s,t;
    cin >> n >> m >> s >> t;
    s--; t--;
    vector<vector<pair<lli, lli> > > adja(n);
    vector<vector<pair<lli, lli> > > adjb(n);
    for(int i=0; i<m; i++){
        lli u,v,a,b;
        cin >> u >> v >> a >> b;
        u--; v--;
        adja[u].push_back(make_pair(v,a));
        adja[v].push_back(make_pair(u,a));
        adjb[u].push_back(make_pair(v,b));
        adjb[v].push_back(make_pair(u,b));
    }

    vector<lli> sa = dijkstra(s, adja);
    vector<lli> gb = dijkstra(t, adjb);

    vector<lli> ans(n+1, 0);
    for(int i=n-1; i>=0; i--){
        ans[i] = max(ans[i+1], def -sa[i] -gb[i]);
    }
    for(int i=0; i<n; i++){
        cout << ans[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 19012
import math
a,b,x = map(int,input().split())

if x==a*a*b:
  tanθ = 90
elif a*a*b>x>=a*a*b/2:
  tanθ = math.degrees(math.atan(a**2/(2*(a*b-x/a))))
else:
  tanθ = math.degrees(math.atan(2*x/(a*b*b)))

print(90-tanθ)

Measured memory_bytes: 38512
n,m=map(int,input().split())                       
h =list(map(int,input().split()))
cnt = 0
l = [[] for i in range(n)]
for i in range(m):
    a,b=map(int,input().split()) 
    l[a-1].append(h[b-1])
    l[b-1].append(h[a-1])

for i in range(n):
    if l[i] == []:
        cnt+=1

    elif h[i] > max(l[i]):
        cnt +=1
    

print(cnt)

Measured memory_bytes: 23068
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <climits>
#include <cmath>
#include <vector>
#include <string>

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

using namespace std;

int N;
int dp[100001];
vector<int> a;

int main()
{
    scanf("%d", &N);
    int i = 1;
    while(true) {
        if(pow(6, i)<100000)
            a.push_back(pow(6, i));
        else
            break;
        i++;
    }
    i = 1;
    while(true) {
        if(pow(9, i)<100000)
            a.push_back(pow(9, i));
        else
            break;
        i++;
    }
    a.push_back(1);
    sort(a.begin(), a.end());
    //REP(i, a.size())
    //    printf("%d ", a[i]);

    dp[0] = 0;
    dp[1] = 1;
    FOR(i, 2, 100001)
        dp[i] = 100000000;
    FOR(i, 2, 100001){
        REP(j, a.size()){
            if(i>=a[j])
                dp[i] = min(dp[i], dp[i-a[j]]+1);
            else
                break;
        }
    }
    printf("%d\n", dp[N]);


    return 0;
}


Measured memory_bytes: 896
#include<bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define rep(i, j, k) for (auto i = j; i < k; i++)
#define rrep(i, j, k) for (auto i = j; i > k; i--)
using namespace std;

void solve(int &n, int &m) {
  int a[101];
  fill(a, a + 101, 0);
  rep(i, 0, n) {
    int d, v; cin >> d >> v; d--;
    a[d] = max(a[d], v);
  }
  int ans = 0;
  rep(i, 0, m) ans += a[i];
  cout << ans << endl;
}

int main() {
  int n, m;
  while (cin >> n >> m, n) solve(n, m);
}



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

using namespace std;

int n, m;
vector<vector<int>> g;
vector<bool> vis;
int SZ;
void dfs(int node) {
  vis[node] = true;
  SZ++;
  for (const auto& x : g[node]) {
    if (vis[x]) {
      continue;
    }
    dfs(x);
  }
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  g.resize(n);
  vis = vector<bool> (n, false);
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    --u; --v;
    g[u].emplace_back(v);
    g[v].emplace_back(u);
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (vis[i]) {
      continue;
    }
    SZ = 0;
    dfs(i);
    ans = max(ans, SZ);
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 20324
#pragma comment(linker, "/stack:200000000")
 #pragma GCC optimize("Ofast")
 #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 #include<bits/stdc++.h>
 #define int long long
 using namespace std;
int mod=1e9+7;
int fac[2000005];


int modInverse(int a, int m) 
{   
    int m0 = m; 
    int y = 0, x = 1; 
  
    if (m == 1) 
      return 0; 
  
    while (a > 1) 
    { 
        // q is quotient 
        int q = a / m; 
        int t = m; 
  
        // m is remainder now, process same as 
        // Euclid's algo 
        m = a % m, a = t; 
        t = y; 
  
        // Update y and x 
        y = x - q * y; 
        x = t; 
    } 
  
    // Make x positive 
    if (x < 0) 
       x += m0; 
  
    return x; 
} 

signed main()
{
     ios_base::sync_with_stdio(false);
     cin.tie(NULL);  
//  #ifndef ONLINE_JUDGE
//     freopen ("INPUT.txt" , "r" , stdin);
//     freopen ("OUTPUT.txt" , "w" , stdout);
//  #endif

 
// -------------------------------------Code starts here--------------------------------------------------------------------- 
    

    int k1,k2;
    cin>>k1>>k2;
    fac[0]=1;
    for(int i=1;i<=2000004;i++)
    {
        fac[i]=(fac[i-1]*i)%mod;
    }

    if(2*k1<k2||2*k2<k1)
    {
        cout<<0;
        return 0;
    }
    if((2*k1-k2)%3==0 && (2*k2-k1)%3==0)
    {
    int z1=(2*k1-k2)/3;
    int z2=(2*k2-k1)/3;        
    int ans=(fac[z1+z2]);
    ans=(ans*modInverse(fac[z1],mod))%mod;
    ans=(ans*modInverse(fac[z2],mod))%mod;
    cout<<ans;
    }
    else
    {
        cout<<0;
    }
    


// -------------------------------------Code ends here------------------------------------------------------
     clock_t clk;
 	clk = clock();
 
     clk = clock() - clk;
 	cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << "\n";
 	return 0;
 }

Measured memory_bytes: 15872
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  int count=0,count1=0;
  for(int i=0;i<s.length();i++){
    if(i%2==0){
        if(s[i]!='0')
            count++;
    }
    else {
        if(s[i]!='1')
            count++;
    }
  }
for(int i=0;i<s.length();i++){
    if(i%2==0){
        if(s[i]!='1')
            count1++;
    }
    else {
        if(s[i]!='0')
            count1++;
    }
  }
cout<<min(count ,count1)<<endl;


}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define ri register int
typedef long long ll;
namespace io {
	const int SIZE = (1 << 21) + 1;
	char ibuf[SIZE], *iS, *iT, obuf[SIZE], *oS = obuf, *oT = oS + SIZE - 1, c, qu[55]; int f, qr;
	// getchar
	#define gc() (iS == iT ? (iT = (iS = ibuf) + fread (ibuf, 1, SIZE, stdin), (iS == iT ? EOF : *iS ++)) : *iS ++)
	// print the remaining part
	inline void flush () {
		fwrite (obuf, 1, oS - obuf, stdout);
		oS = obuf;
	}
	// putchar
	inline void putc (char x) {
		*oS ++ = x;
		if (oS == oT) flush ();
	}
	// input a signed integer
	template <class I>
	inline void gi (I &x) {
		for (f = 1, c = gc(); c < '0' || c > '9'; c = gc()) if (c == '-') f = -1;
		for (x = 0; c <= '9' && c >= '0'; c = gc()) x = (x << 1) + (x << 3) + (c & 15); x *= f;
	}
	// input a letter
	template <class I>
	inline void get (I &x) {
		for (c = gc(); c < 'A' || c > 'Z'; c = gc()) ;
		x = c;
	}
	// input a string
	inline void read (char *s){
		for(c = gc(); c < 'A' || c > 'Z'; c = gc()) ;
		for(; c >= 'A' && c <= 'Z'; c = gc()) *++s = c;
		*++s = '\0';
	}
	// print a signed integer
	template <class I>
	inline void print (I x) {
		if (!x) putc ('0'); if (x < 0) putc ('-'), x = -x;
		while (x) qu[++ qr] = x % 10 + '0',  x /= 10;
		while (qr) putc (qu[qr --]);
	}
	//no need to call flush at the end manually!
	struct Flusher_ {~Flusher_(){flush();}}io_flusher_;
}
using io :: gi;
using io :: get;
using io :: read;
using io :: putc;
using io :: print;
const int N=1e5+5;
ll d[N];
int sz[N];
struct node{
	int x;
	ll nowd;
	node(){}
	node(int _x,ll _nowd) : x(_x) , nowd(_nowd) {}
	inline bool operator <(const node &rhs)const{
		return nowd>rhs.nowd;
	}
};
multiset<node> s;
vector<int> e[N];
int n;
inline void dfs2(ri x,ll now){
	if(d[x]!=now)
		puts("-1"),exit(0);
	for(int o:e[x])
		dfs2(o,now-sz[o]+n-sz[o]);
}
int main(){
	ri i;
	ll res;
	gi(n);
	for(i=1;i<=n;++i) gi(d[i]),s.insert(node(i,d[i]));
	res=0;
	while(s.size()>1){
		node o=*s.begin();
		s.erase(s.begin());
		++sz[o.x];
		set<node> ::iterator it=s.find(node(0,d[o.x]-n+2*sz[o.x]));
		if(it==s.end())
			return puts("-1"),0;
		sz[it->x]+=sz[o.x];
		e[it->x].push_back(o.x);
		res+=sz[o.x];
	}
//	printf("res = %lld\n",res);
	dfs2(s.begin()->x,res);
	for(i=1;i<=n;++i)
		for(auto o:e[i])
			print(i),putc(' '),print(o),putc('\n');
	return 0;
}

Measured memory_bytes: 15616
#
import sys
import math
import numpy as np
import itertools

# いくつか入力
a,b,n = (int(i) for i in input().split())

#p = a//b
#q = a-b*p
#print(p,q)
#m=0
#for x in range(0,n+1):
#    m= max(m, (a*x // b - a* (x//b) ) )#, q*x//b,q*(x//b))
#    print((a*x // b - a* (x//b) ))
#print(m)
if n >= b:
    n=b-1
m = a*n // b - a* (n//b) 

print(m)



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

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var h = long.Parse(line[0]);
        var w = long.Parse(line[1]);
        if (h % 3 == 0 | w % 3 == 0) { Console.WriteLine(0); goto end; }
        var r1 = Math.Min(getDD3(h, w), getDD3(w, h));
        var r2 = Math.Min(getD3(h, w), getD3(w, h));
        var r3 = Math.Min(r1, r2);
        Console.WriteLine(r3);
        end:;
    }
    public static long getDD3(long a, long b)
    {
        var b1 = b / 2;
        var b2 = b - b1;
        var ret = 9999999999999999L;
        for (int i = 1; i < a; i++)
        {
            var x = getABSmin(b1 * (a - i), b2 * (a - i), b * i);
            ret = Math.Min(ret, x);
        }
        return ret;
    }
    public static long getABSmin(long a, long b, long c)
    {
        var ar = new long[3];
        ar[0] = a; ar[1] = b; ar[2] = c;
        return ar.Max() - ar.Min();
    }
    public static long getD3(long a, long b)
    {
        var ret = 9999999999999L;
        for (int i = 1; i <= b - 2; i++)
        {
            var w1 = (b - i) / 2;
            var w2 = b -  i -  w1;
            ret = Math.Min(ret, getABSmin(w1, w2, i));
        }
        return ret * a;
    }
}

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

using namespace std;
typedef long long ll;
#define FOR(i,n) for(int i=0; i<int(n); i++)
#define FOR1(i,m,n) for(int i=int(m); i<int(n); i++)

int main(int argc, char *argv[])
{
    int N, T, prev_t, t;
    ll sum;

    cin >> N >> T;
    cin >> prev_t;
    FOR1(i,1,N) {
        cin >> t;
        if (t - prev_t >= T)
            sum += T;
        else
            sum += t - prev_t;
        prev_t = t;
    }
    sum += T;

    cout << sum << endl;
    
    return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))

cnt = 0
l = []
for i in A:
    if i % 2 == 0:
        l.append(i)
        cnt += 1

ans = 0
for i in l:
    if i % 3 == 0 or i % 5 == 0:
        ans += 1

if ans == cnt:
    print("APPROVED")
else:
    print("DENIED")

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

#define int long long

int32_t main()
{
    int n;
    cin >> n;
    int arr[n];
    int idx=1;
    int c=0;
    for(int i=0;i<n;++i)
    {
        cin >> arr[i];
        if(arr[i]!=idx) c++;
        idx++;
    }
    if(c==0 || c==2)
    {
        cout << "YES" <<endl;
    }
    else cout << "NO" <<endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <list>
#include <ctime>
#include <sstream>
#include <queue>
#include <stack>
#include <bitset>
#include <numeric>
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;
#define FOR(x, b, e) for(int x=(b); x<=(e); ++x)
#define FORD(x, b, e) for(int x=((int)(b))-1; x>=(e); --x)
#define REP(x, n) for(int x=0; x<(n); ++x)
#define ALL(c) c.begin(),c.end()
#define SIZE(x) ((int)((x).size()))
#define PB push_back
#define ST first
#define ND second
#define mp(x,y) make_pair(x,y)
#define DEBUG 1
#define debug(x) {if (DEBUG)cerr <<#x <<" = " <<x <<endl; }
#define debugv(x) {if (DEBUG) {cerr <<#x <<" = "; FOREACH(it, (x)) cerr <<*it <<", "; cout <<endl; }}
typedef short int sint;

int main() {
	ios_base::sync_with_stdio(false);
	string s;
	cin >> s;
	map<int, int> ileMod;
	ileMod[0] = 1;
	long long res = 0;
	int currMod = 0;
	int mod = 2019;
	int mn = 1;
	FORD(i, SIZE(s), 0) {
		currMod = (currMod + mn*(s[i] - '0')) %mod;
		// cout << " i: " << i << ' ' << currMod << endl;
		mn = (mn * 10) % mod;
		res += ileMod[currMod];
		++ileMod[currMod];
	}
	cout << res << endl;
}

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

typedef long long ll;
const int MAXN = 200010;

int c0[MAXN], c1[MAXN], p[MAXN], v[MAXN];
int n, tl[MAXN], nxt[MAXN]; ll ans;

struct Node
{
	int id;
	bool operator < (const Node &j) const
	{
		if((ll)c0[id] * c1[j.id] == (ll)c0[j.id] * c1[id]) return id < j.id;
		else return (ll)c0[id] * c1[j.id] > (ll)c0[j.id] * c1[id];
	}
};
set<Node> S;

int fa[MAXN];

inline int Get(int x)
{
	if(x == fa[x]) return x;
	return fa[x] = Get(fa[x]);
}

int main()
{
	scanf("%d", &n);
	for(int i = 2; i <= n; ++i) scanf("%d", &p[i]);
	for(int i = 1; i <= n; ++i)
	{
		fa[i] = tl[i] = i;
		scanf("%d", &v[i]);
		if(v[i]) c1[i] = 1;
		else c0[i] = 1;
		if(i != 1) S.insert((Node){i});
	}
	for(int i = 1; i < n; ++i)
	{
		Node now = *S.begin();
		S.erase(S.begin());
		int x = now.id, y = Get(p[x]);
		nxt[tl[y]] = x, tl[y] = tl[x], fa[x] = y;
		if(y != 1) S.erase((Node){y});
		c1[y] += c1[x], c0[y] += c0[x];
		if(y != 1) S.insert((Node){y});
	}
	int p = 1, num = v[1];
	for(int i = 1; i < n; ++i)
	{
		p = nxt[p];
		if(!v[p]) ans += num;
		else ++num;
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 15104
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
typedef long long ll;
typedef vector<vector<int>> vvi;
typedef vector<int> vi;
typedef vector<vector<char>> vvc;
typedef vector<char> vc;

int main() {
  string s;
  cin >> s;
  int n=s.size();
  bool can=true;
  rep(i,n/2) {
    if(s[i]!=s[n-i-1]) can=false;
    if(!can)break;
  }
  int m=(n-1)/2;
  rep(i,m/2){
    if(s[i]!=s[m-1-i])can=false;
    if(!can)break;
  }
  reverse(s.begin(),s.end());
  rep(i,m/2){
    if(s[i]!=s[m-1-i])can=false;
    if(!can)break;
  }
  can ? cout << "Yes" : cout << "No";
  cout << endl;
}


Measured memory_bytes: 256
n = int(input())
P = list(map(int,input().split()))
ans = 0
for i in range(1,n-1):
    if P[i-1] < P[i] < P[i+1]:
        ans += 1
    elif P[i-1] > P[i] > P[i+1]:
        ans += 1
print(ans)

Measured memory_bytes: 3060
import sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = 10**10
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    n = I()
    A = [I() for _ in range(n)]

    def insertionSort(A, n, g):
        cnt = 0
        for i in range(g, n):
            v = A[i]
            j = i-g
            while j>=0 and A[j]>v:
                A[j+g] = A[j]
                j -= g
                cnt += 1
            A[j+g] = v
        return cnt

    # shellSort(A, n)
    cnt = [0]

    G = []
    h = 1
    while h<=n:
        G.append(h)
        h = 3*h+1
    G = list(reversed(G))
    m = len(G)

    for i in range(m):
        cnt[0] += insertionSort(A, n, G[i])

    print(m)
    print(*G)
    print(cnt[0])
    for i in A:
        print(i)

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 45532
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define N 100000
#define mindiff 1.0e-6
typedef long long ll;
int main(){
	double w,h,x,y,flag;
	cin>>w>>h>>x>>y;
	double ans;
	ans=(w*h/2);
	w/=2;
	h/=2;
	if((abs(w-x)<mindiff)&&(abs(h-y)<mindiff)){
		flag=1;
	}else{
		flag=0;
	}
	cout<<ans<<" "<<flag<<endl;
	return 0;
}	

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace abc123_a
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());
            int b = int.Parse(Console.ReadLine());
            int c = int.Parse(Console.ReadLine());
            int d = int.Parse(Console.ReadLine());
            int e = int.Parse(Console.ReadLine());
            int k = int.Parse(Console.ReadLine());

            if (b - a > k || c - a > k || d - a > k || e - a > k || c - b > k || d - b > k || e - b > k || d - c > k || e - c > k || e - d > k)
            {
                
                Console.WriteLine(":("); 
            }
            else
            {
                Console.WriteLine("Yay!");
            }
            Console.ReadLine();
        }
    }
}


Measured memory_bytes: 11092
/*
	Name:
	Author: xiaruize
	Date:
*/

#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define MOD 1000000007
#define ALL(a) (a).begin(), (a).end()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define ll long long
#define form(i,j,n) for(int i=int(j);i<=int(n);i++)
#define pb push_back
#define mk make_pair
#define pii pair<int,int>
#define pis pair<int,string>
#define sec second

int main()
{
 	ios::sync_with_stdio(false);
	cin.tie(0);
 	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int n;
	cin>>n;
	cout<<(n+1)/2<<endl;
	return 0;
}

Measured memory_bytes: 256
from math import gcd
N=int(input())
A=list(map(int,input().split()))

L=[A[0]]
R=[A[-1]]

for i in range(1,N):
    L.append(gcd(L[-1],A[i]))
    R.append(gcd(R[-1],A[-1-i]))
R=R[::-1]
#print(L)
#print(R)

ans=1
for j in range(N):
    if j==0:
        tmp = R[1]
    elif j==N-1:
        tmp = L[N-2]
    else:
        tmp = gcd(L[j-1],R[j+1])
    #print(j,tmp)
    ans=max(ans,tmp)
    
print(ans)

Measured memory_bytes: 22548
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <queue>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

int main()
{
	string S;
	cin >> S;
	string ans = "Good";
	for (int i = 0; i + 1 < S.length(); i++)
	{
		if (S[i] == S[i + 1])
		{
			ans = "Bad";
			break;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
N = int(input())
dict = {}
for _ in range(N):
    t = int(input())
    if t not in dict:
        dict[t] = 1

def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)

def lcm(a, b):
    return a // gcd(a, b) * b

ans = 1
for k in dict.keys():
    ans = lcm(ans, k)

print(ans)



Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update

using namespace std;
using namespace __gnu_pbds;

//find_by_order gives kth-largest element
//order_of_key gives the number of items in the set that are strictly smaller!!

// OT.find_by_order(k-1)
// 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define db4(x, y, z, w) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << "," << #w << "=" << w << endl
#define ll long long
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define X first
#define Y second
#define sz(x) (int)((x).size())
#define pii pair<int,int>
#define MOD (ll)(1e9 + 7)
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
typedef vector<int> vi;
#define inf (ll)(1e18)
#define double long double
#define int long long

//////////////////////
const int N = 1005;

void p0() {
	cout << "0\n";
	exit(0);
}

int power(int base, int exp) {
	int ans = 1;
	while(exp) {
		if(exp&1)
			ans = (ans * base) % MOD;
		base = (base * base) % MOD;
		exp /= 2;
	}
	return ans;
}

int32_t main() {

    ios::sync_with_stdio(false);
    cin.tie(0); 
    cout.tie(0);
    
    int x,y,tx,ty;
    cin >> x >> y >> tx >> ty;

    int up = ty-y, right = tx-x;

    string one(up,'U'), down(up,'D');
    string sec(right,'R'), third(right,'L');
    cout << (one+sec) << (down+third);

    one += 'U';
    sec += 'R';
    down += 'D';
    third += 'L';

    cout << 'L' << (one + sec) << 'D';
    cout << 'R' << (down + third) << 'U'; 

    // db2(sz(a),sz(b));
}	

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

ll dp[3005][3005];

int main(){
  string s,t;
  cin>>s>>t;
  ll ns=s.size();
  ll nt=t.size();
//  cout<<ns<<" "<<nt<<endl;
  rep(i,3005)rep(j,3005)dp[i][j]=0;
  rep(i,ns)rep(j,nt){
    dp[i+1][j+1]=max(dp[i+1][j+1],dp[i][j]);
    dp[i+1][j+1]=max(dp[i+1][j+1],dp[i+1][j]);
    dp[i+1][j+1]=max(dp[i+1][j+1],dp[i][j+1]);

    if (s[i]==t[j])dp[i+1][j+1]=max(dp[i+1][j+1],dp[i][j]+1);
    //if (s[i]==t[j-1] and j>0)dp[i+1][j]=max(dp[i+1][j],dp[i][j]+1);
  //  if (s[i-1]==t[j] and i>0)dp[i][j+1]=max(dp[i][j+1],dp[i][j]+1);
  //  cout<<dp[i+1][j+1]<<"i"<<(i+1)<<"j"<<(j+1)<<endl;
  //  cout<<dp[i+1][j]<<"i"<<(i+1)<<"j"<<j<<endl;

  //  cout<<dp[i][j+1]<<"i"<<i<<"j"<<(j+1)<<endl;

  }
  string ans="";
  ll nows=ns;
  ll nowt=nt;
  //cout<<dp[1][4]<<" "<<dp[0][3]<<endl;
  while (nows>0 and nowt>0){
  //  cout<<nows<<" "<<nowt<<endl;

    if (s[nows-1]==t[nowt-1]){
      //cout<<"y"<<endl;
      ans=ans+s[nows-1];
      nows--;
      nowt--;
  }
  else if (dp[nows][nowt]==dp[nows-1][nowt]) nows--;
  else if (dp[nows][nowt]==dp[nows][nowt-1]) nowt--;
//cout<<nows<<" "<<nowt<<endl;
}
reverse(ans.begin(),ans.end());
cout<<ans;
}


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

int main(){
    int N;
    cin >> N;
    vector<int> t(N+1),x(N+1),y(N+1);
    t[0] = x[0] = y[0] = 0;
    rep(i,N)
    {
        cin >> t[i+1] >> x[i+1] >> y[i+1];
    }

    bool can = true;
    rep(i,N)
    {
        int dt = t[i+1] - t[i];
        int dist = std::abs(x[i+1]-x[i]) + std::abs(y[i+1]-y[i]);
        if(dt < dist)
        {
            can = false;
        }

        if(dt%2 != dist%2)
        {
            can = false;
        }

    }
    if(can)
    {
        std::cout << "Yes" << std::endl;
    }else{
        std::cout << "No"  << std::endl;
    }

    return 0;
}




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

template<class T> inline void cmin(T &a, T b) {
  if (a > b) a = b;
}

int main() {
  int N;
  cin >> N;
  vector<int> X(N), Y(N), P(N), AX(N), AY(N);
  for (int i = 0; i < N; i++) {
    cin >> X.at(i) >> Y.at(i) >> P.at(i);
    AX.at(i) = abs(X.at(i));
    AY.at(i) = abs(Y.at(i));
  }
  
  vector PX(1 << N, AX), PY(1 << N, AY);
  for (int bit = 0; bit < 1 << N; bit++) {
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < N; j++) {
        if (bit >> j & 1) {
          cmin(PX.at(bit).at(i), abs(X.at(i) - X.at(j)));
          cmin(PY.at(bit).at(i), abs(Y.at(i) - Y.at(j)));
        }
      }
    }
  }

  vector ans(N + 1, LONG_MAX);
  for (int bit = 0; bit < 1 << N; bit++) {
    for (int i = bit; i >= 0; i--) {
      i &= bit;
      long sum = 0;
      for (int j = 0; j < N; j++) {
        if (!(bit >> j & 1)) {
          long d = min(PX.at(i).at(j), PY.at(bit - i).at(j));
          sum += d * P.at(j);
        }
      }
      int bp = __builtin_popcount(bit);
      cmin(ans.at(bp), sum);
    }
  }
  for (auto a : ans) cout << a << "\n";
}

Measured memory_bytes: 9812
using System;

namespace ABC068_B
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            double ans = 0;
            for(var i=0;i<=n;i++)
            {
                if (n < Math.Pow(2, i))
                {
                    ans = Math.Pow(2, i - 1);
                    break;
                }
            }
            Console.WriteLine(ans);
        }
    }
}


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

int main(){
  string s, t;
  cin >> s >> t;
  map<char, char>mst, mts;
  for(int i=0; i<s.length(); i++){
    if(!mst.count(s[i]))mst[s[i]] = t[i];
    else if(mst[s[i]] != t[i]){
      cout << "No";
      return 0;
    }
    if(!mts.count(t[i]))mts[t[i]] = s[i];
    else if(mts[t[i]] != s[i]){
      cout << "No";
      return 0;
    }
  }
  cout << "Yes";
  return 0;
}

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

#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define ll long long
#define ii pair<int,int>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<ii>

using namespace std;

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n,ans=0;
	cin>>n;
	vi v(n),c(n);
	for(int &x:v) cin>>x;
	for(int &x:c) cin>>x;
	for(int i=0;i<(1<<n);++i){
		int x=0,y=0;
		for(int j=0;j<n;++j){
			if((i&(1<<j))){
				x+=v[j];
				y+=c[j];
			}
		}
		ans = max(ans,x-y);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * Lesson8D 図のようなリング状の文字列 s の任意の位置から、 時計回りに連続した文字をいくつか選んで、 文字列 p が作れるかを判定するプログラム
 * 
 * @author Internship
 * 
 */
public class Main{

	/**
	 * プログラムのエントリポイント
	 * 
	 * @param args
	 */
	public static void main(String[] args) {

		// 1行読み込む
		try {
			BufferedReader insBR = new BufferedReader(new InputStreamReader(
					System.in));

			String strLine = insBR.readLine();

			// char型に分解 文字列s
			char[] chaAryLineS = strLine.toCharArray();

			char[] chaAryLineSAfter = new char[chaAryLineS.length * 2];

			strLine = insBR.readLine();

			// char型に分解 文字列p
			char[] chaAryLineP = strLine.toCharArray();

			System.arraycopy(chaAryLineS, 0, chaAryLineSAfter, 0,
					chaAryLineS.length);
			System.arraycopy(chaAryLineS, 0, chaAryLineSAfter,
					chaAryLineS.length, chaAryLineS.length);

			// 終了条件
			int intlength = chaAryLineSAfter.length - chaAryLineP.length + 1;

			int intCount = 0;

			boolean booYes = false;

			for (int i = 0; i < intlength; i++) {

				for (int j = 0; j < chaAryLineP.length; j++) {
					if (chaAryLineSAfter[i + j] == chaAryLineP[j]) {
						intCount++;

						if (intCount == chaAryLineP.length) {
							booYes = true;
						}
					}
				}
				intCount = 0;
			}

			if (booYes) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}

		} catch (IOException e) {
			System.out.println(e);
		}
	}
}

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

long long a[10000005],ans=0;

int main()
{
	long long n;
	scanf("%lld",&n);
	for (int i=1;i<=n;i++) scanf("%lld",&a[i]);
	for (int i=2;i<=n;i++)
	{
		if (a[i]<a[i-1])
		{
			ans+=a[i-1]-a[i];
			a[i]=a[i-1];			
		}
	}
	printf("%lld",ans);
}

Measured memory_bytes: 5288
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 

ll n,cnt,ans,a,b,c,d,tmp[4],tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

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

    rep(i,3)cin>>tmp[i];
    sort(tmp,tmp+3);
    if(tmp[0]==tmp[1])Cout(tmp[2]);
    else Cout(tmp[0]);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cassert>
#include <functional>
#include <set>
#include <cmath>

using namespace std;
#define get(x) if (DEBUG) cout << #x << " : " << x << endl;
#define print(x) if (DEBUG) cout << x << endl;
#define int long long
#define double long double

void fast() {
    ios::sync_with_stdio(false);
    cin.tie(0);
}

const int MAX = (int)1e6;
const long long INF = 1e18;

signed main() {
    fast();
#ifdef DEBUG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int n, k;
    cin >> n >> k;
    int a[n];
    for (int i = 0; i < n; ++i) cin >> a[i];
    bool dp[k + 1][2];
    for (int i = 0; i <= k; ++i) {
        for (int j = 0; j < 2; ++j) dp[i][j] = false;
    }
    for (int i = 1; i <= k; ++i) {
        for (int p = 0; p < 2; ++p) {
            for (int j = 0; j < n; ++j) {
                dp[i][p] = dp[i][p] || ((i - a[j] >= 0) ? !dp[i - a[j]][p ^ 1] : false);
            }
        }
    }
    cout << (dp[k][0] ? "First" : "Second");

    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
  
using namespace std;
using namespace __gnu_pbds;
 
#define ll long long
#define uint unsigned int
#define ull  unsigned long long
#define pb push_back
#define mk make_pair
#define ins insert
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define X first
#define Y second
#define umap unordered_map
#define speed() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define setvalue(d,s,e,n) for(int qwe = s; qwe < e; ++qwe) d[qwe] = n
#define mset multiset
#define pqueue priority_queue
   
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
        
const int  N = 2e5 + 314;
const int INF = 1e9;
const double PI = acos(-1);
const int MOD = 1e9 + 7;
const double eps = 1e-9;
int sz[N];
vector <int> g[N];
vector <int> v[N];
int c[N];
int used[N];
int idx = 1;
void dfs(int i) {
    used[i] = 1;
    c[i] = idx;
    sz[idx] ++;
    
    for(int f : g[i]) {
        if(!used[f]){
        
            dfs(f);
        }
    }
}
void solve(){
    int n, m, k;
    cin >> n >> m >> k;
    for(int i = 1; i <= m; ++i) {
        int a, b;
        cin >> a >> b;
        g[a].pb(b);
        g[b].pb(a); 
    }
    for(int i = 1; i <= k; ++i) {
        int a, b;
        cin >> a >> b;
        v[a].pb(b);
        v[b].pb(a); 
    }
    for(int i = 1; i <= n; ++i) {
        if(!used[i]) {
            dfs(i);
            idx++;

        }
    }
    map <int,int> mp;
    for(int i = 1; i <= n; ++i) {
        for(int f : g[i]) {
            mp[i] += c[f] == c[i];
        }
        for(int f : v[i]) {
            mp[i] += c[f] == c[i];
        }
    }
    // for(int i = 1; i < idx; ++i) {
    //     cout << sz[i] << " ";
    // }
    for(int i = 1; i <= n; ++i) {
        cout << sz[c[i]] - 1 - mp[i] << " ";
    }
}


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

Measured memory_bytes: 22144
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <iomanip>
#include <math.h>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <functional>
#include <stdio.h>

using namespace std;

typedef long long int ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, int> pli;
typedef std::pair<ll, ll> pll;

#define FOR(i,n,m) for(ll i=(ll)(m);i<(ll)(n);++i)
#define REP(i,n) FOR(i,n,0)
#define IREP(i,n) for(ll i=(ll)(n);i>=0;--i)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int a[30];

int main()
{

	while (true)
	{
		int c = getchar();
		if (c == EOF)break;

		int n = tolower((char)c) - 'a';
		if (n >= 0 && n < 26)
		{
			a[n]++;
		}
	}

	REP(i, 26)
	{
		cout << (char)('a' + i) << " : " << a[i] << endl;
	}
	return 0;
}


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

int main(){
  int N = 0;
  cin >> N;
  int a,b,c,d;
  a = N%10;
  N/=10;
  b = N%10;
  N/=10;
  c = N%10;
  N/=10;
  d = N%10;
  if( a == b && b == c){
    cout << "Yes" << endl;
  }else if(b == c && c == d){
    cout << "Yes" <<endl;
  }else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i < (n);i++)
typedef long long ll;
typedef pair<int,int> P;
const int MOD = 1000000007;
const int nmax = 8;
bool graph[nmax][nmax];

int dfs(int now, int n,bool visited[]){
    bool all_visited = true;
    visited[now] = true;
    //全てのノートを通ったパスを発見した時の分岐条件
    rep(i,n){
        if(visited[i] == false)all_visited = false;
    }
    if(all_visited)return 1;

    int rtn = 0;
    rep(i,n){
        if(graph[now][i] == false)continue;
        if(visited[i])continue;
        rtn += dfs(i,n,visited);
        //なぜfalseにする？
        visited[i] = false;
    }
    return rtn;
}


int main(){
    int n,m;
    cin >> n >> m;
    rep(i,m){
        int a,b;
        cin >> a >> b;
        graph[a-1][b-1] = true;
        graph[b-1][a-1] = true;
    }

    bool visited[n];
    rep(i,n)visited[i] = false;
    int ans = dfs(0,n,visited);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256