akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include<string>
#include<algorithm>
#include<queue>
#include<cmath>
#include<set>
#include<map>
typedef long long int ll;
using namespace std;

int main(){
    int N,L;
    string str[100];
    cin >> N >> L;
    for(int i=0;i<N;i++){
        cin >> str[i];
    }
    
    for(int i=0;i<N-1;i++){
        for(int j=N-1;j>i;j--){
            if(str[j]<str[j-1]){
                string t = str[j];
                str[j]=str[j-1];
                str[j-1]=t;
            }
        }
    }
    string ans;
    for(int i=0;i<N;i++){
        ans += str[i];
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Created on Sun Mar 17 09:02:00 2019
DPF3
@author: maezawa
"""

s = input()
t = input()

ns = len(s)
nt = len(t)

dp = [[0 for _ in range(nt+1)] for _ in range(ns+1)]

for si in range(ns):
    for ti in range(nt):
        if s[si] == t[ti]:
            dp[si+1][ti+1] = max(dp[si][ti]+1, dp[si+1][ti], dp[si][ti+1])
        else:
            dp[si+1][ti+1] = max(dp[si+1][ti], dp[si][ti+1])

ans = ''
si = ns
ti = nt
while si > 0 and ti > 0:
    if dp[si][ti] == dp[si-1][ti]: 
        si -= 1
    elif dp[si][ti] == dp[si][ti-1]:
        ti -= 1
    else:
        ans = s[si-1] + ans
        si -= 1
        ti -= 1

print(ans)



Measured memory_bytes: 120156
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF (1LL<<57)
#define MV 200001
#define LMV 21
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define emp emplace
#define whoami(x) cerr<<#x<<" "<<x<<"\n";
#define mp make_pair
#define ins insert
#define sz size

void FLASH() {ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);}
void SETF() {cout.ios_base::setf(ios_base::fixed);}
void UNSETF() {cout.ios_base::unsetf(ios_base::fixed);}

typedef long long ll;
typedef long double ld;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef pair<PII, int> PPII;
typedef pair<PLL, ll> PPLL;
typedef map<int, int> MII;

struct h_llint {
  static uint64_t splitmix64(uint64_t x) {    // http://xorshift.di.unimi.it/splitmix64.c
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};

struct h_pair{
  size_t operator()(const PLL&x)const{
    return hash<ll>()(((ll)x.ff)^(((ll)x.ss)<<32));
  }
};

typedef map<ll, ll> MLL;
typedef map<PII, int> MPII;
typedef map<PLL, ll> MPLL;
typedef set<int> SI;
typedef set<ll> SL;
typedef unordered_map<ll, int, h_llint> UMLI;
typedef unordered_map<ll, ll, h_llint> UMLL;
typedef unordered_map<PLL, int, h_pair> UMPI;
typedef unordered_map<PLL, ll, h_pair> UMPL;

int ar[MV];
ll arr[MV];

void solve(int T)
{
	int a,b;
	cin>>a>>b;
	if(a < b)
	{
		for(int i=0;i<b;i++)
		cout<<a;
		cout<<"\n";	
	}	
	else
	{
		for(int i=0;i<a;i++)
		cout<<b;
		cout<<"\n";	
	}
	return;
}

int main(void)
{
	FLASH();
	int T;
	T = 1;

// #ifndef ONLINE_JUDGE
// 	time_t time_t1, time_t2;
// 	time_t1 = clock();
// #endif

	while(T--)
	solve(T);

// #ifndef ONLINE_JUDGE
// 	time_t2 = clock();
// 	SETF();
// 	cout<<"Time taken: "<<setprecision(7)<<(time_t2 - time_t1)/(double)CLOCKS_PER_SEC<<"\n";
// 	UNSETF();
// #endif

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iterator>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <numeric>
#include <iomanip>
#include <limits>
#include <set>
#include <map>
#include <type_traits>
#include <cstdint>

typedef long long ll;

using namespace std;

//素因数分解
void factoring(ll n, map<ll, ll>& mp) {
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			mp[i]++;
			n /= i;
		}
	}
	if (n != 1) mp[n]++;
}

//絶対値
template<class T, class U = std::make_unsigned_t<T>>
U SafeAbs( T x ) {
    return x < 0 ? -static_cast<uintmax_t>(x) : x;
}

//最大・最小
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(){

	ll n;
	cin>>n;

	ll ans=1;

	const ll MOD=1000000007;

	for(ll i=1;i<=n;i++){
		ans*=(i%MOD);
		ans%=MOD;
	}

	cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){

  int n=0;
  char hina[101]={0};
  int i=0;
  int cnt=0;

  scanf("%d", &n);
  for(i=0; i<n; i++){
    scanf("%c", hina+i);
  }
  i=0;
  
  while(hina[i]!='\0'){
    if(hina[i]=='Y')
      cnt++;
    i++;
  }
  
  if(cnt>0)
    printf("Four\n");
  else
    printf("Three\n");

  return 0;
}

Measured memory_bytes: 128
/* Bismillahirrahmanirrahim */
/* Author : Jehian Norman Saviero (@Reiva5) */
#include <bits/stdc++.h>

// MACROS SAMPAH
#define Jehian using
#define Norman namespace
#define Saviero std

Jehian Norman Saviero;

// MACROS TYPE
typedef long l;
typedef long long ll;
typedef unsigned long ul;
typedef unsigned long long ull;
typedef double ld;
typedef pair<int,int> pi;
typedef pair<l,l> pl;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<l> vl;
typedef vector<ll> vll;

// MACROS FOR PRINT
#define nl printf("\n")
#define sp printf(" ")

// MACROS FOR ATTRIBUTE
#define fi first
#define se second

// MACROS FOR FUNCTION AND METHOD
#define eb emplace_back
#define mp make_pair
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define ALL(x) (x).begin(), (x).end()
#define ALLN(x,n) (x), (x)+(n)
#define CUBE(x) (SQR(x)*(x))
#define SET(x,y) for (int _qwe = sizeof(x)/sizeof(x[0]); _qwe; ) x[--_qwe] = (y)
#define SQR(x) ((x)*(x))
#define SSORT(x,sz) sort(ALLN(x,sz))
#define RESET(x) memset((x), 0, sizeof(x))
#define VSORT(x) sort(ALL(x))

// MACROS READ INPUT
#define sci(x) scanf("%d", &x)
#define scl(x) scanf("%ld", &x)
#define scll(x) scanf("%lld", &x)
#define scul(x) scl(x)
#define scull(x) scll(x)

int main() {
	map<string, int> cnt;
	int N;
	sci(N);
	int MAX = 0;
	for (int i = 0; i < N; ++i) {
		string tmp;
		cin >> tmp;
		++cnt[tmp];
		MAX = max(MAX, cnt[tmp]);
	}
	vector<string> dat;
	for (auto &it : cnt) {
		if (it.se == MAX) {
			dat.pb(it.fi);
		}
	}
	VSORT(dat);
	for (auto &it : dat) {
		cout << it << '\n';
	}
	return 0;
}

Measured memory_bytes: 26868
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<bitset>
#include<string>
#include<iostream>
using namespace std;
typedef long long ll;
ll mod = 998244353;
typedef bitset<4096>bi;
bi gcd(bi a, bi b)
{
	bi emp;
	if (a == emp)return b;
	if (b == emp)return a;
	int la = 0, lb = 0;
	for (int i = 0; i < 4096; i++)
	{
		if (a[i])la = i;
		if (b[i])lb = i;
	}
	for (;;)
	{
		if (la < lb)swap(la, lb), swap(a, b);
		a ^= b << (la - lb);
		bool f = false;
		for (int i = la; i >= 0; i--)
		{
			if (a[i])
			{
				f = true;
				la = i;
				break;
			}
		}
		if (!f)return b;
	}
}
int main()
{
	int num;
	scanf("%d", &num);
	string s;
	cin >> s;
	reverse(s.begin(), s.end());
	bi mok;
	for (int i = 0; i < s.size(); i++)mok[i] = (s[i] == '1');
	bi g;
	for (int i = 0; i < num; i++)
	{
		bi b;
		string z;
		cin >> z;
		reverse(z.begin(), z.end());
		for (int i = 0; i < z.size(); i++)b[i] = (z[i] == '1');
		g = gcd(g, b);
	}
	int x = 0;
	for (int i = 0; i < 4096; i++)if (g[i])x = i;
	ll ans = 0;
	for (int i = 4095; i >= x; i--)
	{
		ans *= 2;
		ans += mok[i];
		ans %= mod;
	}
	bi r;
	for (int i = 4095; i >= x; i--)
	{
		if (r[i] != mok[i])r ^= g << (i - x);
	}
	for (int i = x - 1; i >= 0; i--)
	{
		if (r[i] == mok[i])continue;
		if (r[i] < mok[i])ans = (ans + 1) % mod;
		break;
	}
	if (r == mok)ans = (ans + 1) % mod;
	printf("%lld\n", ans);
}

Measured memory_bytes: 256
n,m,k = map(int, input().split())

# ---------------------------------------
# nCr(n, r, m) テンプレ
mod = 998244353

fac = [1,1] # 階乗 n!
inv = [0,1] # 逆元 1/n
finv = [1,1] # 逆元の階乗 (n^-1)! = (1/n)!

for i in range(2, n+1):
    fac.append( (fac[-1] * i ) % mod )
    inv.append( (-inv[mod%i] * (mod//i)) % mod )
    finv.append( (finv[-1] * inv[-1]) % mod )

def nCr(n, r, m):
    if (n<0 or r<0 or n<r): return 0
    r = min(r, n-r)
    return fac[n] * finv[n-r] * finv[r] % m
# ----------------------------

ans = 0
colors = m
for p in range(n-1, -1, -1):
    if p <= k:
        ans += colors * nCr(n-1, p, mod) % mod
    colors *= m - 1
    colors %= mod
ans %= mod
print(ans)


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

#define ms(s, n) memset(s, n, sizeof(s))
#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 FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define sp system("pause")
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
const int N = (int) 1e5 + 10;
void TimeExecution() {
    cout << "\n\n===>> Time Execution: " << clock() / (double)1000 << " sec(s).";
}
int t;
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    /*
    #ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    */
    string s;
    cin >> s;
    int a = 0, b = 0;
    FOR(i, 0, s.size() - 1) if(s[i] == 'A') a++;else b++;
    if(a && b) cout << "Yes";
    else cout << "No";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>


using namespace std;
int main(int argc, char const *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int c5 = 0;
  int c7 = 0;
  for (int i = 0; i < 3; ++i)  {
    int tmp;
    cin >> tmp;
    if (tmp == 5) c5++;
    else if (tmp == 7) c7++;
  }
  bool ans = (c5 == 2 && c7 == 1);

  if (ans) cout << "YES" << "\n"; else cout << "NO" << "\n";
  return 0;
}

Measured memory_bytes: 256
N=int(input())
TA=input().split(" ")
T = int(TA[0])
A = int(TA[1])
H=input().split(" ")
ans = 1
diff = abs(T - int(H[0]) * 0.006 - A)
for i in range(N):
    # print(i)
    if( diff > abs(T - int(H[i]) * 0.006 - A) ):
        diff = abs(T - int(H[i]) * 0.006 - A)
        ans  = i + 1
print(ans)

Measured memory_bytes: 3064
/***
        ***Fresher***
    Md Mahfujur Rahman Khan(So..a;)
    Dept. of CSE
    CSE-28 Batch
    JU-48 Batch
    Jahangirnagar University

    FSTREAM10573

***/
#include<iostream>
#include<fstream>
#include<cstdio>
#include<string>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<deque>
#include<sstream>
#include<cmath>
#include<algorithm>
#include<iomanip>
#include<functional>
#include<array>
#include<set>
#include<map>
#include<unordered_map>
#include<climits>
#include<numeric>
#include<utility>
using namespace std;
/***PAIR***/
#define pll pair<ll,ll>
#define pcl pair<char,ll>
#define psl pair<string, ll>
#define pls pair<ll,string>
#define plc pair<ll, char>
/***MAP***/
#define mll map<ll,ll>
#define msl map<string, ll>
#define mls map<ll, string>
#define mlb map<ll,bool>
#define msb map<string,bool>
#define mcl map<char, ll>
/***VECTOR***/
#define vl vector<ll>
/*** FAST ***/
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
/***FUNCTIONS AND MACROS***/
#define IT_ ::iterator
#define F first
#define S second
#define M_P(x, y) make_pair(x, y)
#define PB(v,x) v.push_back(x)
#define PP(x) push(x)
#define RSZ(a , n) a.resize(n)
#define POB pop_back()
#define P_ pop()
#define CL_ clear()
#define LEN(s,cst) (cst)s.length()
#define SZ(s, a) (ll)s.size()
#define CNT(x) count(x)
#define FF first.first
#define FS first.second
#define SF second.first
#define SS second.second
#define B_ begin()
#define E_ end()
#define F_ front()
#define t_ top()
#define IN(s, a) s.insert(a)
#define ER_  erase
#define GT(x) getline(cin , x)
#define NL_   "\n"
#define SP_ " "
#define R_0 return 0
#define R_ return

#define ul unsigned long long int
#define ll long long int
/***
//bit prime
#define most_prime_loop 1001
#define most_prime_number 1000010
#define prime_MAX_arr 1000010/64 +1
ll PRIME[prime_MAX_arr];
void Set(ll n){ll m= n%64;n/=64;ll x = 1;x <<=m;PRIME[n] |=x;return ;}
bool check(ll n){if(n==2) return true;if(n%2==0) return false;ll m= n%64;n/=64;ll x = 1;x <<=m;return !(x&PRIME[n]);}
void seivee(){fa(x, PRIME)x = 0;Set(2);for(ll i= 3; i <=most_prime_loop; i+=2){if(check(i)){for(ll j = i*i; j <=most_prime_number; j+=i){Set(j);}}}}
***/
#define TEST      ll test; cin >> test; while(test--)

/**template<typename T>inline T POW(T b, T p){T res = 1;while(p){if(p%2)res*=b;b*=b;p/=2;}return res;}**/

#define lcm(a, b) (a/__gcd(a,b))*b
#define INT(dp, v) memset(dp,v, sizeof(dp))
#define all(v) v.B_,v.E_
#define rall(v) v.rbegin(),v.rend()

#define fr(i ,a,  n) for( ll i = a; i <= n; i++)
#define fe(x, n) for( ll i = x; i <= n; i++)
#define fa(x,a)    for(auto &x : a)

#define mod(a) a%1000000007
#define pi acos(-1)
#define SFL(a) scanf("%lld",&a)
#define SFS(a) scanf("%s",&a)
//#define SFD(a) scanf("%lf",&a)
#define PFS(s) printf("%s",s)
#define PFL(s) printf("%lld",s)
#define PFC(s) printf("%c",s)
//#define PFD(s) printf("%lf",s)
#define UMP unordered_map


int main()
{
    FAST;
   ll n;
   cin >> n;
   for(ll i = 1; i<= 9; i++)
   {
       if(n%i ==0 && n/i <=9)
       {
           cout <<"Yes";
           return 0;
       }
   }
   cout << "No";



}



Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int a[4],b[2];
  for(int i=0;i<4;i++) cin>>a[i];
  for(int i=0;i<2;i++) cin>>b[i];
  int s=0;
  for(int i=0;i<4;i++) s+=a[i];
  sort(a,a+4);
  sort(b,b+2);
  s=s-a[0]+b[1];
  cout<<s<<endl;
  return 0;
}

Measured memory_bytes: 3152
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>
#include <string>
#include <time.h>

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }

int N, A[212345];

int main() {

	scanf("%d", &N);
	rep(i, N) scanf("%d", &A[i]);

	int ans = 0;
	multiset<int> cm;

	rep(i, N) {
		if (cm.upper_bound(-A[i]) == cm.end()) {
			cm.insert(-A[i]);
		}
		else {
			cm.erase(cm.upper_bound(-A[i]));
			cm.insert(-A[i]);			
		}
	}

	printf("%d\n", (int)cm.size());

	return 0;
}


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

int main (){

    char A[12],B[12],C[12];
    scanf("%s %s %s", A, B ,C);
    
    
    if (A[strlen(A)-1] == B[0] && B[strlen(B)-1] == C[0]){
        printf("YES\n");
    }else {
        printf("NO\n");
    }


    return 0;
}

Measured memory_bytes: 1648
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cinttypes>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<string>
#include<stack>


#define FSCNd64 "%" SCNd64
#define FPRId64 "%" PRId64

using namespace std;

using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
using vll=vector<ll>;
using vvll=vector<vll>;
using vpii=vector<pii>;

#define PI 3.1415926535897932384626433832795

template<typename X>
bool max_u(X&m, X v)
{
	if(m<v)
	{
		m=v;
		return true;
	}
	return false;
}


template<typename X>
bool min_u(X&m, X v)
{
	if(m>v)
	{
		m=v;
		return true;
	}
	return false;
}


struct solve
{
	solve(){}
	ll operator()() {
		return 0;
	}
};

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

	for(;;)
	{
		ll x, k, d;
		cin >> x >> k >> d;
		if(cin.fail()) break;

		if(x<0) x=-x;
		ll nk=min(k, x/d);
		ll ans=x-nk*d;

		if(k<nk)
		{
			ans=x-k*d;
		}
		else if((k-nk)&1)
		{
			ans=d-ans;
		}

		cout << ans << "\n";
	}
	return 0;
}


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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	long long n, k;
	cin >> n >> k;
	map<int, long long> mp;
	for(int i = 0; i < n; i++) {
		int a, b;
		cin >> a >> b;
		mp[a] += b;
	}
	long long cur = 0;
	for(auto i : mp) {
		cur += i.second;
		if(cur >= k) {
			cout << i.first << endl;
			return 0;
		}
	}
	return 0;	
}


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

ll sum(string s) {
  stringstream ss(s);
  string buf;
  ll res = 0;
  while (getline(ss, buf, '+')) res += stoll(buf);
  return res;
}

ll dfs(string s, int p) {
  if (p > s.length() - 1) return sum(s);
  string sp(s);
  sp.insert(begin(sp) + p, '+');
  return dfs(s, p + 1) + dfs(sp, p + 2);
}

main() {
  string S; cin >> S;
  cout << dfs(S, 1) << endl;
}


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

using namespace std;

#define sz(a) int(a.size())

typedef long long Long;
#define MOD 1000000007

struct Matrix {
	vector<vector<int> > MAT;

	Matrix(int N, int M) {
		MAT = vector<vector<int> >(N, vector<int>(M, 0));
	}

	static Matrix identity(int N) {
		Matrix A(N, N);
		for (int i = 0; i < N; ++i)
			A[i][i] = 1;
		return A;
	}

	Matrix operator+(const Matrix &M) const {
		Matrix A(this->rows(), M.cols());
		for (int i = 0; i < this->rows(); ++i) {
			for (int j = 0; j < this->cols(); ++j) {
				A[i][j] = (MAT[i][j] + M.MAT[i][j]) % MOD;
			}
		}
		return A;
	}

	Matrix operator*(const Matrix &M) const {
		Matrix A(this->rows(), M.cols());
		if (this->cols() != M.rows())return A;
		for (int i = 0; i < this->rows(); ++i) {
			for (int j = 0; j < M.cols(); ++j) {
				A[i][j] = 0;
				for (int k = 0; k < this->cols(); ++k) {
					Long m = 1LL * MAT[i][k] * M.MAT[k][j];
					m %= MOD;
					if (m < 0)m += MOD;
					A[i][j] = (A[i][j] + m) % MOD;
				}
			}
		}
		return A;
	}

	Matrix operator*(int &n) {
		Matrix A(this->rows(), this->cols());
		for (int i = 0; i < this->rows(); ++i) {
			for (int j = 0; j < this->cols(); ++j) {
				A[i][j] = (1LL * n * (*this)[i][j]) % MOD;
			}
		}
		return A;
	}

	Matrix pow(long long n) {
		Matrix A = identity((*this).rows());
		long long hb = 1;
		while (hb < n)hb <<= 1;
		for (long long b = hb; b >= 1; b >>= 1) {
			A = A * A;
			if (b & n) A = A * (*this);
		}
		return A;
	}

	vector<int> &operator[](int i) { return MAT[i]; }

	int rows() const { return MAT.size(); }

	int cols() const { return MAT[0].size(); }

	string toString() {
		string ans = "{\n";
		for (int i = 0; i < this->rows(); ++i) {
			ans += "[";
			for (int j = 0; j < this->cols(); ++j) {
				char arr[30];
				string app = (j == 0 ? "" : " ");
				sprintf(arr, "%d", (*this)[i][j]);
				app += arr;
				ans += app;
			}
			ans += "]\n";
		}
		ans += "}";
		return ans;
	}
	
};

int main() {
	int n;
	long long k;
	cin >> n >> k;
	Matrix M (n, n);
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) cin >> M[i][j];
	}
	M = M.pow(k);
	Long ans = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			ans += M[i][j];
			if (ans >= MOD) ans -= MOD;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#define rep(i,n) for (int i = 0; i <= (n); ++i)
#define rip(i,n) for (int i = 1; i <= (n); ++i)
using namespace std;
int main() {
	int a, b; cin >> a >> b;
	int x =0 ;
	if (a >= 13) {
		x = b;
	}
	else if (a >= 6) {
		x = b / 2;
	}
	else
		x = 0;
	cout << x << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<stack>

using namespace std;

vector<int> G[100];
int n;
int t;
int vn,un;
int s[100],f[100];
int inf = 1<<21;
int tim=1;

void dfs(int u){
    //cout << u << " " << s[u] << " " << f[u] << endl;
    s[u] = tim;
    tim++;
    for(int i=0;i<G[u].size();i++){
        int v = G[u][i];
        if(s[v] == inf){
            dfs(v);
        }
    }
    f[u] = tim;
    tim++;
}

int main(){
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> vn >> un;
        vn--;
        for(int j=0;j<un;j++){
            cin >> t;
            t--;
            //cout << t << " " << vn << endl;
            G[vn].push_back(t);
        }
    }
    fill(s,s+n,inf);
    fill(f,f+n,inf);
    //cout << s[2] << " " << f[3] << endl;
    for(int i=0;i<n;i++){
        if(f[i] == inf) dfs(i);
    }
    for(int i=0;i<n;i++){
        cout << i+1 << " " << s[i] << " " << f[i] << endl;
    }
    return 0;

}



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

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

    int p1 = 0, p2 = 0, p3 = 0;
    while (n--) {
        int p; cin >> p;
        p1 += p <= a;
        p2 += a + 1 <= p && p <= b;
        p3 += b + 1 <= p;
    }

    int ans = 0;
    while (p1-- && p2-- && p3--) {
        ++ans;
    }

    cout << ans << endl;
}



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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  if (A + B > C + D) {
    cout << "Left" << endl;
  } else if (A + B == C + D) {
    cout << "Balanced" << endl;
  } else {
    cout << "Right" << endl;
  }
}


Measured memory_bytes: 256
import sys
from itertools import combinations, permutations

def solve():
    input = sys.stdin.readline
    M1, D1 = map(int, input().split())
    M2, D2 = map(int, input().split())
    if M1 != M2: print(1)
    else: print(0)

    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 3060
n = input()
n = n[::-1]
n += '0'
cnt = 0
tmp = 0
for i in range(len(n)):
    a = int(n[i])
    a += tmp
    if a == 5:
        cnt += a
        if int(n[i + 1]) >= 5:
            tmp = 1
        else:
            tmp = 0
    elif a < 5:
        cnt += a
        tmp = 0
    else:
        cnt += 10 - a
        tmp = 1
print(cnt)

Measured memory_bytes: 5492
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text.RegularExpressions;
using System.Diagnostics;
using static System.Math;

//var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
namespace AtCoderSolve
{

    class Solve
    {
        const int mod = 1000000007;
        const int INF = 2147483647;
        const long SINF = 9223372036854775807;

        static int N;
        static int[] A;

        public static void Input()
        {
            var cin = new Solve();
            N = int.Parse(Console.ReadLine());
            A = cin.SplitReader();
        }

        static void Main(string[] args)
        {
            Input();
            //var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            //Console.SetOut(sw);

            long ans = INF;
            for(var i = 0; i < N; i++)
            {
                long num = 0;
                while (A[i] % 2 == 0)
                {
                    num++;
                    A[i] /= 2;
                }
                ans = Min(num, ans);
            }

            Console.WriteLine(ans);

            //Console.Out.Flush();
        }

        public int[] SplitReader()
        {
            int[] array = Console.ReadLine().Split().Select(int.Parse).ToArray();
            return array;
        }
        public long[] SplitReaderL()
        {
            long[] array = Console.ReadLine().Split().Select(long.Parse).ToArray();
            return array;
        }
    }
}

    



Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 100000000



int main(){
	
	int M,D;
	cin>>M>>D;
	
	int ans = 0;
	
	for(int i=1;i<=M;i++){
		for(int j=1;j<=D;j++){
			int d1 = j%10;
			int d2 = j/10;
			if(d1>=2&&d2>=2&&d1*d2==i)ans++;
		}
	}
	
	cout<<ans<<endl;
		
	
	return 0;
}


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

#define mod 1000000007

using namespace std;
 
int main(void){
	
	int N;
	long long int C, K, sum = 0, time, num, k;
	
	cin >> N >> C >> K;
	
	long long int T[N];
	
	for(int i=0; i<N; i++)
		cin >> T[i];
	
	sort(T, T+N);
	
	for(int i=0; i<N; i++){
		time = T[i+1] - T[i];
		num = 1;
		k = T[i];
		while(time <= K && num < C){
			i++;
			time = T[i+1] - k;
			num++;
		}
		sum++;
	/*	if(i == N)
			sum++;*/
	}
	
	cout << sum;
	
	return 0;
}

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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (a+b+c > 21) cout << "bust" << endl;
  else cout << "win" << endl;
  return 0;
}

Measured memory_bytes: 3020
import io.StdIn._
object Main extends App {
  val n = readInt
  val ws = readLine.split(" ").map(_.toInt)

  def rec(separator_index: Int, min: Int): Int = {
    val r_sum = ws.take(separator_index).sum
    val l_sum = ws.drop(separator_index).sum
    val diff = (r_sum - l_sum).abs

    if (diff == min) min
    else if (r_sum < l_sum) rec(separator_index+1, math.min(diff, min))
    else rec(separator_index-1, math.min(diff, min))
  }
  val result = rec(n/2, ws.max)
  println(result)
}

Measured memory_bytes: 55012
N,M=map(int,input().split())
c= [ 0 for _ in range(M)]
for i in range(N):
  A = list(map(int, input().split()))
  for j in range(A[0]):
    c[A[j+1]-1]+=1
ans=0
for i in range(M):
  if c[i] == N:
    ans += 1
print(ans)
    

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main(){
	int i,j,d[100][100],e[100];cin>>i>>j;
	for(int a=0;a<i;a++)for(int b=0;b<j;b++)cin>>d[a][b];
	for(int a=0;a<j;a++)cin>>e[a];
	for(int a=0;a<i;a++){
		int sum=0;
		for(int b=0;b<j;b++)sum+=d[a][b]*e[b];
		cout<<sum<<endl;
	}
}

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

void maxHeapify(int *A, int i, int H){
    int l = 2*i;
    int r = 2*i+1;
    int largest;
    l<=H && A[l]>A[i]?largest = l:largest = i;
    if(r<=H && A[r]>A[largest])
        largest = r;
    if(largest != i){
        swap(A[i],A[largest]);
        maxHeapify(A,largest,H);
    }
}

int main(void) {
    int H,i;
    cin >> H;
    int A[H];
    rep(i,H){
    cin >> A[i];
    }
    for(i=H/2;i>0;i--){
        maxHeapify(A,i,H);
    }
    rep(i,H)
        cout << " " << A[i];
    cout << endl;
    return 0;
}

Measured memory_bytes: 3108
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin >> s;
    int cnt = 0;
    for(int i = 0; i < s.size() - 1; i++){
        if(s[i] == '0' && s[i + 1] == '0'){
            cnt++;
            s[i + 1] = '1';
        }
        if(s[i] == '1' && s[i + 1] == '1'){
            cnt++;
            s[i + 1] = '0';
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 512
#include<algorithm>
#include<string>
#include<stdio.h>
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<utility>
#include<functional>
#include<cassert>

using namespace std;
typedef pair<int, int> P;
typedef long long int ll;

int main(void) {
	int n, sum=0;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < n-1; i++) {
		for (int j = i + 1; j < n; j++) {
			sum += a[i] * a[j];
		}
	}
	cout << sum << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 26 13:55:09 2020

@author: hiroki
"""


n, m = map(int, input().split())
a = list(map(int, input().split()))
days = 0

for i in range(m):
    days += a[i]

if n - days >= 0:
    print(n - days)
else:
    print(-1)


Measured memory_bytes: 9884
#include<bits/stdc++.h>
#include<cmath>
using namespace std;
int main(){
  int a,b,c,x,y;
  cin >> a >> b >> c >> x >> y;
  int sum = 0;
  int ans = 2147483647;
  int i = 0;
  while(i <= x || i <= y){
    sum = i*2*c + max(0,x-i)*a + max(0,y-i)*b;
    ans = min (ans,sum);
    i++;
  }
  cout << ans << endl;
  

}


Measured memory_bytes: 256
#include <iostream>
#include<algorithm>
#include<string>
#include<vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <cmath>
#include <limits>
using namespace std;


int main()
{
	int a,b,cnt=0;
	string s;
	for (cin >> a >> b; a <= b;a++) {
		s = to_string(a);
		if (s[0] == s[4] && s[1] == s[3])cnt++;
	}
	cout << cnt << endl;
} 


Measured memory_bytes: 256
/*author - swapno7064*/

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define ll long long int
#define inf 100000000000
#define MOD 1000000007
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define for0(i, n) for (int i = 0; i < n; i++)
#define tc(t) int t; cin >> t; while (t--)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define vll vector<ll>
#define vi vector<int>
#define pb push_back
#define fi first
#define se second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define S(x) (int)(x).size()
#define L(x) (int)(x).length()
#define ps(x,y)         fixed<<setprecision(y)<<x
using namespace std;
using namespace __gnu_pbds;
int main()
{
	IOS
	int arr[5];
	int pos=0;
	for(int i=0;i<5;i++)
	{
		cin>>arr[i];
		if(arr[i]==0)
		pos=i+1;
	}
	cout<<pos<<endl;
}
	
	


Measured memory_bytes: 3636
fun main(args: Array<String>) {

    val (n, d) = readLine()!!.split(" ").map { it.toInt() }

    val xs = (1..n).map { readLine()!!.split(" ").map { it.toInt() }.toTypedArray() }.toTypedArray()

    var count = 0
    for(i in 0 until n-1){
        for(j in i+1 until n){
            var r = 0.0
            for(k in 0 until d){
                r += Math.pow((xs[j][k] - xs[i][k]).toDouble(), 2.0)
            }
            if(Math.sqrt(r) * 10.0 % 10.0 == 0.0) count++
        }
    }
    println(count)
}

Measured memory_bytes: 35952
#include<iostream>

using namespace std;

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

    // int cnt = 0;
    // while( N%2 == 0)
    // {
    //     N /= 2;
    //     cnt ++;
    // }
    // cout << cnt << endl;

    int cMax = 0;
    int ans = 1;
    for (int i=1; i<N+1; ++i)
    {
        int cnt = 0;
        int tmp = i;
        // cout << tmp << " " << cnt << endl;
        while( tmp%2 == 0)
        {
            tmp /= 2;
            cnt ++;
        }
        // cout << i << " " << cnt << endl;
        if(cMax < cnt)
        {
            cMax = cnt;
            ans = i;
        }  
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        m: usize,
        c: i64,
        b: [i64; m],
        a: [[i64; m]; n],
    }

    let ans = a
        .into_iter()
        .filter(|a| {
            a.into_iter()
                .zip(b.iter())
                .map(|(a, &b)| a * b)
                .sum::<i64>()
                + c
                > 0
        })
        .count();

    println!("{}", ans);
}


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

int main() {
    int n; cin >> n;
    vector<int> ans(2,0);
    for(int i = 1; i <= n; i ++) {
        int tmp = i;
        int count = 0;
        while(true) {
            if(tmp%2!=0) break;
            count ++;
            tmp /= 2;
        }
        if(count >= ans[1]) {
            ans[1] = count;
            ans[0] = i;
        }
    }
    cout << ans[0] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using loop = int;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(loop (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(loop (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(loop (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(loop (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause") //comment out this on AOJ.
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
constexpr ld pi = 3.1415926535897932;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    init();

    ll h, w; cin >> h >> w;
    if (h == 1 || w == 1) {
        cout << 1 << "\n";
    }
    else {
        ll ans = h / 2 * w;
        if (h % 2 == 1)ans += (w + 1) / 2;
        cout << ans << "\n";
    }
}


Measured memory_bytes: 256
//file_name:ABC73_C.cpp
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;

    // int scan
    /*
    int x;
    scanf("%d",&x);
    int y;
    scanf("%d",&y);
    int z;
    scanf("%d",&z);

    // matrix scan
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // string scan
    /*
    string s;
    cin >> s;
    */


int main() {
    int n;
    scanf("%d",&n);
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    sort(a,a+n);

        ll ans = 0;

    rep(i,n){
        if(i==n-1){
            ans++;
            break;
        }
        if(a[i]==a[i+1]){
            i++;
        }else{
            ans++;
        }
    }



    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int INF = 1e8;

int main(){
	int N,M;
	cin >> N >> M;

	vector< vector <char> > meiro(N, vector<char>(M));
	
	int dx[] = {-1,1, 0,0};
	int dy[] = {0 ,0,-1,1};

	for(int i = 0; i<N; i++){
		for(int j=0; j<M; j++){
			cin >> meiro[i][j];
		}
	}

	int ans= 0;

	for(int sx = 0; sx < N; sx++){
		for(int sy = 0; sy < M; sy++){
			for(int gx = 0; gx < N; gx++){
				for(int gy = 0; gy < M; gy++){

					if(meiro[gx][gy] == '#' || meiro[sx][sy] == '#')continue;

					vector< vector <int> > dis(N, vector<int>(M,INF));
					queue<P> q;

					q.push(P(sx,sy));
					dis[sx][sy] = 0;
					while(q.size()){
						P xy = q.front(); 
						q.pop();
						if(xy.first == gx && xy.second == gy)break;

						for(int i = 0; i < 4 ; i++){
							int nx = xy.first  +dx[i];
							int ny = xy.second +dy[i];
							
							if(0 <= nx && nx < N && 0 <= ny && ny < M){
								if(meiro[nx][ny] != '#' && dis[nx][ny] == INF){
									q.push(P(nx,ny));
									dis[nx][ny] = dis[xy.first][xy.second] +1;
								}
							}
						}
					}
					//cout <<sx<<","<<sy<<","<<gx<<","<<gy<<","<<dis[gx][gy]<<endl;
					if(dis[gx][gy] != INF)
						ans = max(ans,dis[gx][gy]);
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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

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


Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<cmath>
using namespace std;
int main(){
	int n;
	cin>>n;
	vector<int> a(n);
	int amin=1e7,amax=-1e7;
	int mindex,maxdex;
	for(int i=0;i<n;i++) {
		cin>>a[i];
		if(amin>a[i]){
			amin=a[i];
			mindex=i;
		}
		if(amax<a[i]){
			amax=a[i];
			maxdex=i;
		}
	}
	cout << (n-1)*2 << endl;
	if(abs(amax)>=abs(amin)){
		for(int i=0;i<n;i++){
			if(i!=maxdex) cout << maxdex+1 << ' ' << i+1 << endl;
		}
		for(int i=0;i<n-1;i++){
			cout << i+1 << ' ' << i+1+1 << endl;
		}
	}else{
		for(int i=0;i<n;i++){
			if(i!=mindex) cout << mindex+1 << ' ' << i+1 << endl;
		}
		for(int i=0;i<n-1;i++){
			cout << n-i << ' ' << n-i-1 << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 256
/*
				C++
				encoding: UTF-8
				Modified: <20/Jul/2019 05:31:24 PM>

				✪ H4WK3yE乡
				Mohd. Farhan Tahir
				Indian Institute Of Information Technology (IIIT), Gwalior
*/

#include <bits/stdc++.h>

using namespace std;

// clang-format off

#define         ll                     long long
#define         mod                    1000000007
#define         ve                     vector
#define         pb                     push_back
#define         endl                   "\n";
#define         ff                     first
#define         ss                     second
#define         pii                    pair<int, int>
#define         len(v)                 int(v.size())
#define         all(v)                 v.begin(), v.end()
#define         reset(a, b)            memset(a, b, sizeof(a));
#define         fr(i, s, n)            for (ll i = s ; i < n ; ++i)
#define         dfr(i, s, n)           for (ll i = s ; i > n ; --i)
#define         prv(v, s, n)           fr(i, s, n) cout<<v[i]<<" "; cout<<"\n"

void print (string sep = "\n") {
    cout << sep;
}

template < typename T, typename... TAIL > void print (const T& t, TAIL... tail) {
    cout << t << " ";
    print (tail...);
}

// clang-format on


signed main () {
	ios_base::sync_with_stdio (false), cin.tie (nullptr);
	int r;
	cin >> r;
	int area = 3 * r * r;
	print (area);
	return 0;
}


Measured memory_bytes: 256
program abc148c
      implicit none
      integer(8)::a,b

         read *, a,b
         print *, lcm(a,b)
         stop

   contains

      function gcd(a,b)
         implicit none
         integer(8),intent(in)::a,b
         integer(8)::gcd
         integer(8)::l,m,n

            l=a
            m=b
            n=mod(l,m)
            do while (n/=0)
               l=m
               m=n
               n=mod(l,m)
            end do
            gcd=m
            return
      end function gcd

      function lcm(a,b)
         implicit none
         integer(8),intent(in)::a,b
         integer(8)::lcm

            lcm=a*b/gcd(a,b)          ! gcd(a,b)*(a/gcd(a,b))*(b/gcd(a,b))
            return
      end function lcm

   end program abc148c

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

void solve(){
    ll n, x;
    cin >> x >> n;
    ll a[n];
    map<ll, ll> mp;
    for(ll i = 0; i < n; i++) cin >> a[i], mp[a[i]]++;
    ll ma = 999999999999999, indx = 0;
    for(ll i = -100; i < 200; ++i) if(!mp[i]){
        if(abs(i - x) < ma) ma = abs(i-x), indx = i;
    }
    cout << indx << endl;
}

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  //int t;cin>>t;while(t--)
  solve();
  return 0;
}


Measured memory_bytes: 3652
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int main(void) {
	int i;
	int N;
	long int result;
	long int cst = 1e9 + 7;
	char buf[128], *ch;

	fgets(buf, sizeof(buf), stdin);
	ch = strtok(buf, " ");
	N = atoi(ch);

	result = 1;
	for(i = 0; i < N; i += 1) {
		result *= (i + 1);
		result = result % cst;
	}

	printf("%ld\n", result);

	return 0;
}


Measured memory_bytes: 2116
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
const int MOD = 1E9 + 7;
const int INF = 1 << 29;

int main() {
  int S, W;
  cin >> S >> W;
  if (S <= W) {
    cout << "unsafe" << endl;
  } else {
    cout << "safe" << endl;
  }
  return 0;
}

Measured memory_bytes: 3596
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
    size_t h, w;
    cin >> h >> w;
    vector<string> grid(h);
    for (size_t i = 0;i < h; ++i) cin >> grid[i];

    for (size_t y = 0; y < h; ++y) {
        for (size_t x = 0; x < w; ++x) {
            if (grid[y][x] == '#') continue;
            size_t counter = 0;
            if (y != 0) {
                if (x != 0 && grid[y - 1][x - 1] == '#') ++counter;
                if (grid[y - 1][x] == '#') ++counter;
                if (x != (w - 1) && grid[y - 1][x + 1] == '#') ++counter;
            }
            if (x != 0 && grid[y][x - 1] == '#') ++counter;
            if (x != (w - 1) && grid[y][x + 1] == '#') ++counter;
            if (y != (h - 1)) {
                if (x != 0 && grid[y + 1][x - 1] == '#') ++counter;
                if (grid[y + 1][x] == '#') ++counter;
                if (x != (w - 1) && grid[y + 1][x + 1] == '#') ++counter;
            }
            grid[y][x] = ('0' + counter);
        }
        cout << grid[y] << endl;
    }
    return EXIT_SUCCESS;
}

Measured memory_bytes: 256
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; input_inner ! { iter , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let s = { use std :: io :: Read ; let mut s = String :: new ( ) ; std :: io :: stdin ( ) . read_to_string ( & mut s ) . unwrap ( ) ; s } ; let mut iter = s . split_whitespace ( ) ; input_inner ! { iter , $ ( $ r ) * } } ; }
macro_rules ! input_inner { ( $ iter : expr ) => { } ; ( $ iter : expr , ) => { } ; ( $ iter : expr , mut $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let mut $ var = read_value ! ( $ iter , $ t ) ; input_inner ! { $ iter $ ( $ r ) * } } ; ( $ iter : expr , mut $ var : ident $ ( $ r : tt ) * ) => { let mut $ var = $ iter . next ( ) . unwrap ( ) . parse ::< usize > ( ) . unwrap ( ) ; input_inner ! { $ iter $ ( $ r ) * } } ; ( $ iter : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ iter , $ t ) ; input_inner ! { $ iter $ ( $ r ) * } } ; ( $ iter : expr , $ var : ident $ ( $ r : tt ) * ) => { let $ var = $ iter . next ( ) . unwrap ( ) . parse ::< usize > ( ) . unwrap ( ) ; input_inner ! { $ iter $ ( $ r ) * } } ; }
macro_rules ! read_value { ( $ iter : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ iter , $ t ) ) ,* ) } ; ( $ iter : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ iter , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ iter : expr , chars ) => { read_value ! ( $ iter , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ iter : expr , usize1 ) => { read_value ! ( $ iter , usize ) - 1 } ; ( $ iter : expr , $ t : ty ) => { $ iter . next ( ) . unwrap ( ) . parse ::<$ t > ( ) . unwrap ( ) } ; }
fn dfs(graph: &Vec<Vec<usize>>, visited: &mut Vec<isize>, x: usize) {
    let d = visited[x];
    for &y in &graph[x] {
        if visited[y] < 0 {
            visited[y] = d + 1;
            dfs(graph, visited, y);
        }
    }
}
fn main() {
    input! { n, ab: [(usize1, usize1); n-1] };
    let mut graph = vec![vec![]; n];
    for &(a, b) in &ab {
        graph[a].push(b);
        graph[b].push(a);
    }
    let mut visited1 = vec![-1; n];
    visited1[0] = 0;
    dfs(&graph, &mut visited1, 0);
    let mut visited2 = vec![-1; n];
    visited2[n - 1] = 0;
    dfs(&graph, &mut visited2, n - 1);
    let cnt = visited1
        .into_iter()
        .zip(visited2.into_iter())
        .filter(|&(x, y)| x <= y)
        .count();
    if cnt <= n - cnt {
        println!("Snuke");
    } else {
        println!("Fennec");
    }
}


Measured memory_bytes: 21244