akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// #include <ext/pb_ds/detail/standard_policies.hpp>
// using namespace __gnu_pbds;
using namespace std;
// template <typename T>
// using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,
//     tree_order_statistics_node_update>;
 
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization ("unroll-loops")
typedef long long int ll;
const ll N = 1e6;
// const ll m = 1e9 + 7;
// const ll inf= 1e14;
const ll mod =998244353;
const ll INF = 1e14;
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define pld pair<ld,ld>
#define pii pair<ll, ll>
#define ld long double
ll powm(ll a, ll b) { a = a%mod;ll res = 1; while (b) { if (b & 1) res = (res * a) % mod; a = (a * a) % mod; b >>= 1; } return res; }

std::vector<ll> adj[N];
bool vis[N];
ll an[N];

int main() {   
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt","w",stderr);
    #endif
    ll t = 1;
    // cin>>t; 
    memset(vis,0,sizeof(vis));
    while(t--){
        ll n,m;cin>>n>>m;
        for(int i = 0;i<m;i++){
            ll v,u;cin>>v>>u;v--;u--;
            adj[v].pb(u);
            adj[u].pb(v);
        }
        queue<ll> q;
        q.push(0);
        vis[0] = 1;
        while(!q.empty()){
            ll v = q.front();q.pop();
            for(auto u:adj[v]){
                if(vis[u])continue;
                q.push(u);
                vis[u] = 1;
                an[u] = v;
            }
        }
        bool ans = 1;
        for(int i = 0;i<n;i++){
            ans&=vis[i];
        }
        if(ans){
            cout<<"Yes\n";
            for(int i = 1;i<n;i++){
                cout<<an[i]+1<<'\n';
            }
        }
        else{
            cout<<"No\n";
        }

    }
}              

Measured memory_bytes: 35092
n=int(input())
p=[int(x) for x in input().split()]
count=0
for i in range(1,n-1):
  a=p[i-1]
  b=p[i]
  c=p[i+1]
  l=[a,b,c]
  k=sorted(l)
  if(k[1]==l[1]):
    count+=1
print(count)

Measured memory_bytes: 3064
#pragma region template
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vvvld = vector<vvld>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
template <typename T>
using pqrev = priority_queue<T, vector<T>, greater<T>>;
#define rep(i, n) for (ll i = 0, i##_end = (n); i < i##_end; i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repr(i, a, b) for (ll i = (a), i##_end = (b); i < i##_end; i++)
#define reprb(i, a, b) for (ll i = (b)-1, i##_end = (a); i >= i##_end; i--)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
//*
constexpr ll MOD = 1e9 + 7;
/*/
constexpr ll MOD = 998244353;
//*/
constexpr ll INF = 1e+18;
constexpr ld EPS = 1e-12L;
constexpr ld PI = 3.14159265358979323846L;
constexpr ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
constexpr ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
template <typename S, typename T>
inline bool chmax(S &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename S, typename T>
inline bool chmin(S &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif
template <typename T>
bool print_(const T &a) {
  cout << a;
  return true;
}
template <typename T>
bool print_(const vector<T> &vec) {
  for (auto &a : vec) {
    cout << a;
    if (&a != &vec.back()) {
      cout << " ";
    }
  }
  return false;
}
template <typename T>
bool print_(const vector<vector<T>> &vv) {
  for (auto &v : vv) {
    for (auto &a : v) {
      cout << a;
      if (&a != &v.back()) {
        cout << " ";
      }
    }
    if (&v != &vv.back()) {
      cout << "\n";
    }
  }
  return false;
}
void print() { cout << "\n"; }
template <typename Head, typename... Tail>
void print(Head &&head, Tail &&... tail) {
  bool f = print_(head);
  if (sizeof...(tail) != 0) {
    cout << (f ? " " : "\n");
  }
  print(forward<Tail>(tail)...);
}
#pragma endregion

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  ll n, k;
  cin >> n >> k;
  vll h(n);
  rep(i, n){
    cin >> h[i];
  }
  sort(ALL(h));
  reverse(ALL(h));
  ll ans = 0;
  repr(i, k, n){
    ans += h[i];
  }
  print(ans);
}


Measured memory_bytes: 1792
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>
#include <queue>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

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

using ll = long long;
using P = std::pair<ll, ll>;

ll N, C, K;
ll T[100010];
std::set<P> ps;
std::map<ll, ll> mult;
std::map<ll, bool> used;
std::deque<ll> vs;

int main()
{
  scanf( "%lld%lld%lld", &N, &C, &K );

  rep( i, N )
  {
    scanf( "%lld", T+i );

    ps.insert( P( T[i], 0 ) );
    ps.insert( P( T[i]+K, 1 ) );

    ++mult[T[i]];
  }

  ll cnt = 0, ans = 0;

  for( auto it = ps.begin(); it != ps.end(); ++it )
  {
    ll t = it->first, fl = it->second;

    /*printf( "(%d,%d) %d\n", t, fl, cnt );

    for( auto x : vs )
      printf( "%d ", x );
    puts("");*/

    if( !fl )
    {
      cnt += mult[t];

      rep( j, mult[t] )
        vs.push_back( t );

      while( cnt >= C )
      {
        cnt -= C;

        rep( j, C )
          vs.pop_front();

        ++ans;
      }
    }
    else
    {
      ll sum = 0;

      auto it = std::lower_bound( all(vs), t-K );

      if( vs.empty() || it == vs.end() || *it != t-K )
        continue;

      while( sum < mult[t-K] )
      {
        sum += std::min( cnt, C );
        cnt -= std::min( cnt, C );

        ++ans;
      }

      while( !vs.empty() && vs.size() > cnt )
        vs.pop_front();
    }
  }

  while( cnt > 0 )
    cnt -= C, ++ans;

  printf( "%lld\n", ans );

  return 0;
}

Measured memory_bytes: 19840
#include <iostream>
#include<bits/stdc++.h>
#define ll long long
#define   ull unsigned long long 
const int MAX=1e6+9;
const int mod=1e9+7;
using namespace std;
int cnt[MAX];

int main(){
	int a, b;
	cin>>a>>b;
	cout<<max(max(a+a-1, b+b-1) , a+b);
	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long int n, k;
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> k;
    vector<bool>menang(k+1, false);
    vector<int>arr(n);
    for(int i=0;i<n;i++){
        cin >> arr[i];
    }
    for(int i=0;i<=k;i++){
        for(int j=0;j<n;j++){
            if(i>=arr[j]&&!menang[i-arr[j]]){
                menang[i]=true;
                break;
            }
        }
    }
    (menang[k])?cout<<"First"<<endl:cout<<"Second"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <sstream>
#include <algorithm>
#include <bitset>
#include <limits>
#include <map>
#include <set>
#include <iomanip>
#include <cmath>

using namespace std;

typedef long long int ll;
typedef std::numeric_limits<double> dbl;
const long long int LL_INF=1LL<<60;

vector<string> split(const string& input, char delimiter)
{
    stringstream stream(input);
    
    string field;
    vector<string> result;
    while (getline(stream, field, delimiter)) {
        result.push_back(field);
    }
    return result;
}

//#define DEBUG

ll A, B, M, N, D, K, L, Q, W, H, T, X, Y, S;

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

    return 0;
}

Measured memory_bytes: 512
def is_prime(n):
    for i in range(2,n):
        if i*i > n:
            return True
        if n%i == 0:
            return False
    return True
c = 0
n = int(input())
for _ in range(n):
    data = int(input())
    if is_prime(data): c+= 1
print(c)


Measured memory_bytes: 5616
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
#include <set>
#include <map>
#include <tuple>
using namespace std;



#define ll long long
#define ull unsigned long long
#define rep(i,N) for (ll i=0;i<N;i++)
#define loop(i,N,M) for(ll i=N;i<M;i++)
#define MAX(v) *max_element(v.begin(),v.end())
#define MIN(v) *min_element(v.begin(),v.end())
#define SORTL2S(type,v) sort(v.begin(),v.end(),greater<type>())
#define SORTS2L(type,v) sort(v.begin(),v.end())
#define SORTMF(v,func) sort(v.begin(),v.end(),func)

ll debugFlag = false;
template<typename T> void debug(T&);
template<typename T> void debug(T&, bool);
template<typename T> void debug(vector<T>&);
template<typename T> void debug(vector<T>&, bool);
template<typename T, typename U> void debug(pair<T, U>&);
template<typename T, typename U> void debug(pair<T, U>&, bool);

template<typename T>
void debug(T& obj) {
	debug(obj, true);
}

template<typename T>
void debug(T& obj, bool lnFlag) {
	if (!debugFlag) return;
	cout << obj;
	if (lnFlag) cout << endl;
}

template<typename T>
void debug(vector<T>& obj) {
	debug(obj, true);
}

template<typename T>
void debug(vector<T>& obj, bool lnFlag) {
	if (!debugFlag) return;
	cout << "[";
	rep(i, obj.size()) {
		if (i != 0) cout << ",";
		debug(obj[i], false);
	}
	cout << "]";
	if (lnFlag) cout << endl;
}

template<typename T, typename U>
void debug(pair<T, U>& obj) {
	debug(obj, true);
}

template<typename T, typename U>
void debug(pair<T, U>& obj, bool lnFlag) {
	if (!debugFlag) return;
	cout << "(";
	debug(obj.first, false);
	cout << ",";
	debug(obj.second, false);
	cout << ")";
	if (lnFlag) cout << endl;
}

void solve() {

	ll N;
	cin >> N;
	vector<ll> vec(1001,0);
	vector<ll> input(N);

	rep(i, N) {
		cin >> input[i];
		vec[input[i]]++;
	}

	SORTS2L(ll,input);

	vector<ll> vec_sum(1001, 0);
	rep(i, 1001) {
		if (i >= 1) {
			vec_sum[i] = vec_sum[i - 1] + vec[i];
		}
	}

	ll ans = 0;
	for (ll a = 0; a < N; a++) {
		for (ll b = a + 1; b < N; b++) {
			ans += vec_sum[min(input[a] + input[b] - 1,1000LL)] - vec_sum[input[b] - input[a]];
			if ((input[b] - input[a] < input[a])) ans--;
			if ((input[b] - input[a] < input[b])) ans--;
		}
	}

	cout << ans/ 3;
}


int main(int argc, char* argv[]) {
	if (argc == 2 && string(argv[1]) == "debug") debugFlag = true;
	solve();
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <cstddef>
#include <cstdint>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <vector>

using namespace std;

int64_t solve(const vector<int64_t>& as)
{
    const auto n = as.size();
    vector<int64_t> bs(n);

    for (int i = 0; i < n / 2; i++)
    {
        bs[2 * i] = as[i + n / 2];
        bs[2 * i + 1] = as[i];
    }
    if (n % 2 == 1)
    {
        bs[n - 1] = as[n - 1];
        // as[0:n/2], as[n/2:n]
        swap(bs[2], bs[n - 1]);
    }

    int64_t sum = 0;
    for (int i = 0; i < n - 1; i++)
    {
        sum += abs(bs[i] - bs[i + 1]);
    }
    return sum;
}

int main()
{
    int n;
    cin >> n;
    vector<int64_t> as(n);
    for (auto& a : as)
    {
        cin >> a;
    }
    sort(as.begin(), as.end());
    auto sum1 = solve(as);
    reverse(as.begin(), as.end());
    auto sum2 = solve(as);

    cout << max(sum1, sum2) << endl;
}


Measured memory_bytes: 1920
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
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,k;cin >> n >>k;
    vvl b(k,vl(k)),w=b;
    rep(i,n){
        ll x,y;char c;cin >> x >> y >>c;
        ll z=x/k+y/k;
        ll p=(c=='B'? 1:0);
        if(z%2)p^=1;
        if(p)b[x%k][y%k]++;
        else w[x%k][y%k]++;
    }
    vvl cub(k+1,vl(k+1)),cuw=cub;
    rep(i,k)rep(j,k)cub[i+1][j+1]=cub[i+1][j]+cub[i][j+1]-cub[i][j]+b[i][j];
    rep(i,k)rep(j,k)cuw[i+1][j+1]=cuw[i+1][j]+cuw[i][j+1]-cuw[i][j]+w[i][j];
    ll ans=0;
    /*rep(i,k){
        rep(j,k)cout << b[i][j] <<" ";
        cout << endl;
    }
    rep(i,k+1){
        rep(j,k+1){
            cout << cub[i][j] <<" ";
        }
        cout << endl;
    }*/
    repl(i,1,k+1){
        repl(j,1,k+1){
            ll z=cub[i][j]+cub[0][0]-cub[i][0]-cub[0][j];
            ll zz=cub[k][k]+cub[i][j]-cub[i][k]-cub[k][j];
            ll zzz=cuw[i][j]+cuw[0][0]-cuw[i][0]-cuw[0][j];
            ll zzzz=cuw[k][k]+cuw[i][j]-cuw[i][k]-cuw[k][j];
            //cout << z+zz+cuw[k][k]-zzz-zzzz <<endl;
            //cout << zzz+zzzz+cub[k][k]-z-zz <<endl;
            chmax(ans,z+zz+cuw[k][k]-zzz-zzzz);
            chmax(ans,zzz+zzzz+cub[k][k]-z-zz);
        }
    }
    cout << ans <<endl;
}

Measured memory_bytes: 35000
total_num = 0
total_sum = 0
count = 0

while line = $stdin.gets
	data = line.split(/,/).map{|n| n.to_i }
	price = data[ 0 ]
	num   = data[ 1 ]

	total_num += num
	total_sum += (price * num)
	count += 1
end
printf("%d\n%d\n", total_sum, (total_num.to_f / count.to_f).round) if count > 0


Measured memory_bytes: 6112
import itertools
import math
import fractions
import functools
n = int(input())
t,a = map(int, input().split())
h = list(map(int, input().split()))

ans = 0
minimum = 100000000
for i in range(n):
    subs = abs(a - (t-h[i]*0.006))
    if minimum > subs:
        minimum = subs
        ans = i

print(ans+1)

Measured memory_bytes: 63980
def main():
    data  = list(input())

    ans = len(data)
    count_s = 0
    for i in range(len(data)):
        if data[i] == 'S':
            count_s += 1
        else:
            if count_s > 0:
                count_s -= 1
                ans -= 2

    print(ans)




if __name__ == '__main__':
    main()

Measured memory_bytes: 61552
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <stdio.h>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define rep(i,a,n) for(ll i =(a);i<(n);++i)
#define urep(i,a,n) for(ll i = (a);i>=(n);--i)
#define all(x) (x).begin(),(x).end()
#define INF 1e18
const int mod = 1e9 + 7;
typedef long long ll;
using namespace std;
ll dx[4] = { 1,-1,0,0 };
ll dy[4] = { 0,0,1,-1 };
ll N,M,X,Y,A,B,C,Q,K,R,W,H,P;
string S,T;
ll ans;
ll x[1000000];
ll y[1000000];
ll a[1000000];
ll b[1000000];
ll c[1000000];
ll t[1000000];
string s[10000];
ll gcd(ll a, ll b) {
	if (b == 0)return a;
	else return gcd(b, a%b);
}
struct Edge{
	ll to,cost;
	 Edge(int to, int cost) : to(to), cost(cost) {}
};
typedef vector<vector<Edge> > AdjList;
AdjList graph;
vector<ll> dist;
int main() {
	cin>>A>>B>>C;
	ans+=B;
	if(C<=A+B){
		ans+=C;
	}else{
		ans+=abs(A+B)+1;
		if(A+B==C)ans--;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 384
N,W=map(int,input().split())
items=[tuple(map(int,input().split())) for i in range(N)]
items.insert(0, (0,0))

v_max=sum([x[1] for x in items])

dp=[[10**13 for _ in range(v_max+1)] for _ in range(N+1)]
dp[0][0] = 0

for i in range(1,N+1):
    for j in range(v_max+1):
        # print(i,j)
        # take item
        if j-items[i][1]>=0:
            dp[i][j]=dp[i-1][j-items[i][1]]+items[i][0]
        
        dp[i][j]=min(dp[i][j],dp[i-1][j])

# print(dp[N])

ans=0
for i in range(v_max+1):
    if dp[N][i]<=W:
        ans=i

print(ans)



Measured memory_bytes: 172296
#include<vector>
#include<queue>
#include<stdio.h>
#include<map>
#include<set>
#include<string.h>
#include<algorithm>
#include<iostream>
#include<math.h>
#define mp make_pair
using namespace std;
typedef long long ll;
inline ll in()
{
    ll res=0,p=1;
    char c=getchar();
    while(c<'0'||c>'9') {if(c=='-') p=-1; c=getchar();}
    while(c>='0'&&c<='9') res=res*10+c-48,c=getchar();
    return p*res;
}
void out(ll x)
{
    if (x>9) out(x/10);
    putchar(x%10+48);
}
void outn(ll x)
{
    if (x<0){
        putchar('-');
        out(-x);
    }else out(x);
    putchar(10);
}
const double eps = 1e-6;
const int mod = 1e9 + 7, inf = 0x3f3f3f3f;
//const double pi = acos(-1.0);
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int dx[4] = {0, 0, -1, 1}, dy[4] = {1, -1, 0, 0};

ll gcd(ll a, ll b){return b == 0 ? a : gcd(b, a % b);}
ll quickpow(ll x, ll k)
{
    ll res = 1;
    while(k){
        if(k & 1) res = (res * x) % mod;
        k >>= 1, x = (x * x) % mod;
    }
    return res;
}
//ll C(int n, int m){return (fac[n] * quickpow((fac[m] * fac[n - m]) % mod, mod - 2)) % mod;}
const int maxn = 2e3 + 10;
ll a[maxn], duo[maxn], all[maxn];

int main()
{
    ios::sync_with_stdio(0); cin.tie(0);
    ll n, k;
    cin >> n >> k;
    for (int i = 1; i <= n; ++i) cin >> a[i];
    for (int i = 1; i <= n; ++i){
        for (int j = 1; j <= n; ++j){
            if (a[j] < a[i]){
                ++all[i];
                if (j > i) ++duo[i];
            }
        }
    }
    ll ans = 0;
    for (int i = 1; i <= n; ++i){
        ans += k * (k - 1) / 2 % mod * all[i] + duo[i] * k % mod;
        ans %= mod;
    }
    cout << ans << endl;
    return 0;
}


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

typedef ostringstream OSS; typedef istringstream ISS;
typedef long long LL;
typedef pair<int, int> PII;  typedef pair<LL, LL> PLL;
typedef vector<int>    VI;   typedef vector<VI>   VVI;   typedef vector<VVI>   VVVI;
typedef vector<LL>     VLL;  typedef vector<VLL>  VVLL;  typedef vector<VVLL>  VVVLL;
typedef vector<double> VD;   typedef vector<VD>   VVD;   typedef vector<VVD>   VVVD;
typedef vector<string> VS;   typedef vector<VS>   VVS;   typedef vector<VVS>   VVVS;
typedef vector<bool>   VB;   typedef vector<VB>   VVB;   typedef vector<VVB>   VVVB;
typedef vector<PII>    VPII; typedef vector<VPII> VVPII; typedef vector<VVPII> VVVPII;
typedef vector<PLL>    VPLL; typedef vector<VPLL> VVPLL; typedef vector<VVPLL> VVVPLL;

typedef unsigned int  UI;
typedef vector<UI>    VUI;
typedef vector<VUI>   VVUI;

#define fst first
#define snd second
// #define Y first
// #define X second
#define MP make_pair
#define PB push_back
#define EB emplace_back 
#define ALL(x)  (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define RANGEBOX(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
#define RANGE(x, l, r) ((l) <= (x) && (x) <= (r))
#define rep(i, N)  for (int i = 0; i < (int)(N); i++)
#define rrep(i, N) for (int i = N - 1; i >= 0; i--)
#define REP(i, init, N)  for (int i = (init); i < (int)(N); i++)
#define RREP(i, N, last) for (int i = (init - 1); i >= last; i--)
#define MAXUD(orig, target) orig = max(orig, target)
#define MINUD(orig, target) orig = min(orig, target)
#define DUMP(x) cerr << #x << " = " << (x) << endl

template < typename T > inline T fromString(const string &s) { T res; ISS iss(s); iss >> res; return res; };
template < typename T > inline string toString(const T &a)   { OSS oss; oss << a; return oss.str(); };

template<typename T=int> inline void dump(vector<T> vs, bool ent=false) { rep(i, vs.size()) cout << vs[i] << (i+1==vs.size() ? '\n' : ' '); if (ent) cout << endl; }
template<typename T = int> inline void dump(vector<vector<T>> vs, bool ent=false) { rep(i, vs.size()) dump<T>(vs[i]); if (ent) cout << endl; }

const int    INF  = 0x3f3f3f3f;
const LL     INFL = 0x3f3f3f3f3f3f3f3fLL;
const double DINF = 0x3f3f3f3f;
const int    DX[] = {1,  0, -1, 0};
const int    DY[] = {0, -1,  0, 1};
const double EPS  = 1e-12;
// const double PI   = acos(-1.0);

template<typename T = int> inline T in() { T x; cin >> x; return x; }
template<typename T = int> inline vector<T> in(int n) { vector<T> xs(n); rep(i, n) cin >> xs[i]; return xs; }
template<typename T = int> inline vector<vector<T>> in(int n, int m) { vector<vector<T>> xs(n, vector<T>(m)); rep(i, n) rep(j, m) cin >> xs[i][j]; return xs; }

int main(void) {
    VI xs = in(3);
    sort(ALL(xs));
    cout << (xs[0] == 5 && xs[1] == 5 && xs[2] == 7 ? "YES" : "NO") << endl;

    return 0;
}



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

using namespace std;

int main(void)
{
	int node[5];
	int i, j, a = 0, b = 0, c = 0, d = 0, ch = 0;
	
	while (scanf("%d %d %d", &node[0], &node[1], &node[2]) != EOF){
		
		sort(node, node + 3);
		
		if (node[0] + node[1] <= node[2]){
			ch = 1;
		}
		if (ch == 0){
			a++;
		
			if (node[0] * node[0] + node[1] * node[1] == node[2] * node[2]){
				b++;
			}
			else if (node[0] * node[0] + node[1] * node[1] > node[2] * node[2]){
				c++;
			}
			else if (node[0] * node[0] + node[1] * node[1] < node[2] * node[2]){
				d++;
			}
		}
	}
	
	printf("%d %d %d %d\n", a, b, c, d);
	
	return (0);
}

Measured memory_bytes: 1040
import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    [n, k] <- getIntList
    ps <- getIntList
    let qs = scanl' (+) 0 $ map (\p -> (fromIntegral (sum [1..p])) / (fromIntegral p)) ps
    print . maximum $ zipWith (-) (drop k qs) qs

Measured memory_bytes: 15228
#include <iostream>
#include <cstdio>
#include <vector>
#include <deque>
#include <algorithm>
#include <limits.h>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
const int N_MAX = 51; 
ll x[N_MAX];
ll y[N_MAX];

int main(){
    int N,K;
    cin >> N >> K;
    REP(i,N){
        ll xx, yy;
        cin >> xx >> yy;
        x[i] = xx;
        y[i] = yy;
    }

    ll ans = LLONG_MAX;
    REP(i,N){
        ll left = x[i];
        REP(j,N){
            if(i == j) continue;
            ll right = x[j];
            REP(k,N){
                ll upper = y[k];
                REP(l,N){
                    if(k == l) continue;
                    ll lower = y[l];
                    int num = 0;
                    REP(m,N){
                        if(left <= x[m] && x[m] <= right && lower <= y[m] && y[m] <= upper)
                            num++;
                    }
                    if(num >= K){
                        ll S = (right - left)*(upper - lower);
                        if(S < ans)
                            ans = S;
                    }
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
nk = input().split()
NK =[int(x) for x in nk]
t = []
s = []
for i in range(1 ,NK[0]+1):
	s.append(i)
for i in range(1,NK[1]+1):
    d = int(input())
    A =  input().split()
    a = [int(x) for x in A]
    t += a
set_t = set(t)
set_s = set(s)
r = set_s - set_t
print(len(r))

Measured memory_bytes: 9224
#include <bits/stdc++.h>
using namespace std;
#define array_input int n;cin>>n;int a[n+1],i;for(i=1;i<=n;i++){cin>>a[i];}
#define array_output for(i=1;i<=n;i++){cout<<a[i]<<" ";}cout<<endl;
#define INF 2147483647
#define long_INF 18446744073709551615
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef long double ld;
const double pi=acos(-1);
const double eps=1e-6;

int main()
{
	ios::sync_with_stdio(false);
	int m,n;
	cin>>m;
	string a[m+1];
	int i;
	for (i=1;i<=m;i++)
	{
		cin>>a[i];
	}
	cin>>n;
	string b[n+1];
	for (i=1;i<=n;i++)
	{
		cin>>b[i];
	}
	ll maxv=-100,cnt=0;
	for (i=1;i<=m;i++)
	{
		cnt=1;
		for (int j=i+1;j<=m;j++)
		{
			if (a[i]==a[j])
			{
				cnt++;
			}
		}
		for (int j=1;j<=n;j++)
		{
			if (a[i]==b[j])
			{
				cnt--;
			}
		}
		if (maxv<cnt)
		{
			maxv=cnt;
		}
	}
	if (maxv>0)
	{ 
		cout<<maxv<<endl;
	}
	else
	{
		cout<<"0"<<endl;
	}
	return 0;
}


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

int main(){
	int k[4][3][10] = {{{},{},{}},{{},{},{}},{{},{},{}},{{},{},{}}};
	int n, b, f, r, v;
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> b >> f >> r >> v;
		k[b-1][f-1][r-1] += v;
	}
	for(int z = 0; z < 4; z++){
		for(int y = 0; y < 3; y++){
			for(int x = 0; x < 10; x++){
				cout << " " << k[z][y][x];
			}
			cout << endl;
		}
		if(z != 3) cout << "####################" << endl;
	}
	return 0;
}


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

int n,m;
int a[51],b[51];
int graph[51][51];
int visited[51];

void dfs(int v){
        visited[v] = true;
        for(int v2=0;v2<n;v2++){
                if(visited[v2]==true)    continue;
                if(graph[v][v2]==false) continue;
                dfs(v2);
        }
}

int main(){
        int ans = 0;
        cin >> n >> m;
        for(int i=0;i<m;i++){
                 cin >> a[i] >> b[i];
                 a[i]--,b[i]--;
                 graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
        }
        for(int i=0;i<m;i++){
                graph[a[i]][b[i]] = graph[b[i]][a[i]] = false;
                for(int j=0;j<n;j++)    visited[j] = false;
                dfs(0);
                bool bridge=false;
                for(int j=0;j<n;j++)    if(visited[j]==false) bridge = true;
                if(bridge)      ans++;
                 graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
        }
        cout << ans << endl;
        return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long a,n,sum,ans;
map<long long,int>m;
int main(){
	cin>>n;
	m[0]=1;
	for(int i=0;i<n;i++){
		cin>>a;
		sum+=a;
		ans+=m[sum];
		m[sum]++;
	}
	cout<<ans;
}

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

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

    ll a = 1;
    ll cnt = 0;
    while(a <= H) {
        cnt = a + a - 1;
        a *= 2;
    }
    cout << cnt << endl;
}

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

#define rep(i, n) for(int i = 0; i < n;i++)

int main()
{
    int H, W;
    cin >> H >> W;
    vector<vector<char>> s(H+1, vector<char>(W+1));
    rep(i, H)
    {
        rep(j, W)
        {
            cin >> s.at(i).at(j);
        }
    }

    bool b = true;
    for (int i = 1; i <= H;i++)
    {
        for (int j = 1; j <= W;j++)
        {
            if(s.at(i).at(j) == '#' && s.at(i).at(j+1) != '#' && s.at(i).at(j-1) != '#' && s.at(i+1).at(j) != '#' && s.at(i-1).at(j) != '#')
            {
                b = false;
            }
        }
    }

    if(b)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=998244353;
const LL LINF=1LL<<60;
const int INF=1<<20;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};


vector<LL> divi(LL K){
    vector<LL> v;
    for(int i=1;i*i<=K;i++){
        if(K%i) continue;
        v.pb(i);
        v.pb(K/i);
    }
    sort(ALL(v));
    v.erase(unique(ALL(v)),v.end());
    return v;
}


int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    vector<vector<LL>> dp(n+1,vector<LL> (2,0));
    dp[0][1] = 1;
    for (int i = 0; i < n; i++) {
        for (int f = 0; f < 2; f++) {
            if(f){
                int x = s[i] - '0';
                for (int j = 0; j <= x; j++) {
                    if(j==x) dp[i+1][1] = (dp[i+1][1] + dp[i][1])%mod;
                    else dp[i+1][0] = (dp[i+1][0] + dp[i][1])%mod;
                }
            }
            else{
                dp[i+1][0] = (dp[i+1][0] + 2 * dp[i][0])%mod;
            }
        }
    }
    LL ans = (dp[n][0] + dp[n][1]) * n % mod * 2 % mod;
    auto p = divi(n);
    reverse(ALL(p));
    vector<LL> dp2(n+1,0);
    for(auto a:p){
        LL x = n / a;
        if(n % 2 == 0){
            if(x % 2) continue;
            if(x % 2 || n / x % 2 == 0) continue;
        }
        string t = "";
        for (int j = 0; j < n; j++) {
            if(j / x % 2){
                t += '0' + (s[j % x] ^ '1');
            }
            else{
                t += s[j % x];
            }
        }
        if(t <= s){
            dp2[x] = (dp[x][0] + dp[x][1])%mod;
        }
        else{
            dp2[x] = dp[x][0];
        }
        for(auto b:p){
            LL y = n / b;
            if(x % y == 0 && x != y) dp2[x] = (dp2[x] - dp2[y] + mod) %mod;
        }
        ans = (ans - ((2 * (n - x + mod)%mod) * dp2[x] %mod) + mod)%mod;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 13440
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;
typedef long long int ll;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	double left=0,right=90;
	double a,b,x; cin >> a >> b >> x;
	double m=a*a*b-x;
	m*=2.0;
	static const double pi = 3.141592653589793;
	if(x>=a*a*b/2.0){
		for(int i=0;i<100;i++){
			double mid=(left+right)/2.0;
			long double y=a*a*a*(long double)tan(mid*pi/180.0);
			if(y<m)left=mid;
			else right=mid;
		}
	}
	else{
		for(int i=0;i<100;i++){
			double mid=(left+right)/2.0;
			long double y=b*b*a/2.0/tan(mid*pi/180.0);
			if(y>x)left=mid;
			else right=mid;
		}
	}
	printf("%.8f\n",right);
}

Measured memory_bytes: 256
/*
TASK: <Task>
LANG: C++
*/
#include <bits/stdc++.h>
using namespace std;
#define X first
#define Y second
#define EPS 1e-9
#define ALL(x) (x).begin(),(x).end()
#define mp(x,y) make_pair((x),(y))
#define pb(x) push_back((x))
#define FOR(i,st,ed) for(int (i)=(st);(i)<(ed);(i)++)
typedef pair<int,int> PII;
typedef vector<int> vi;
typedef vector<pair<int,int> > vii;
typedef long long LL;

int N,M,T;
bool tb[127];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("xxx.in","r",stdin);
    //freopen("xxx.out","w",stdout);
    int i,j,k;
    string s;
    cin >> s;
    for(i=0;i<s.size();i++)
        tb[s[i]]=1;
    for(i='a';i<='z';i++)
        if(!tb[i])
        {
            cout << (char)i << '\n';
            return 0;
        }
    cout << "None\n";
}


Measured memory_bytes: 512
fn get_line() -> String {
    use std::io;
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.pop().unwrap();
    buf
}

fn main() {
    let mut buf = String::new();
    let mut abcde = [0; 5];
    for i in abcde.iter_mut() {
        *i = get_line().parse::<i32>().unwrap();
        buf.clear();
    }

    let k = get_line().parse::<i32>().unwrap();

    let mut none = true;
    for i in 0..4 {
        for j in i+1..5 {
            none = none && abcde[j] - abcde[i] <= k;
        }
    }

    if none {
        println!("Yay!");
    } else {
        println!(":(");
    }
}


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

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

    ll x, counter=0; cin >> x;

    for (ll i=100; i<=1000000000000000000; i=i+i/100) 
    {
        if (i>=x)
        {
            cout << counter << "\n";
            return 0;
        }

        counter += 1;
    }

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

Measured memory_bytes: 3640
#include <stdio.h>
 
using namespace std;
 
int main(){
    int a,b;
    char op;
    while(true){
        scanf("%d %c %d",&a,&op,&b);
        if(op == '?') break;
        switch(op){
        case '+':
            printf("%d\n",a+b);
            break;
        case '-':
            printf("%d\n",a-b);
            break;
        case '/':
            printf("%d\n",a/b);
            break;
        case '*':
            printf("%d\n",a*b);
            break;
        }
    }
}


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

// g++ -std=c++17 -O2 -Wall template.cpp -o template
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    int d[n];
    for (int i = 0; i < n; i++) {
        cin >> d[i];
    }
    sort(d, d + n);
    int med = d[n / 2] - d[n / 2 - 1];
    cout << med << endl;
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // Solution
}


Measured memory_bytes: 640
import java.util.*;
public class Main
{
  public static void main(String[] args)
  {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    String str = sc.next();
    if(str.length() <= A)
    {
      System.out.println(str);
    }
     else
     {
       String s = str.substring(0,A);
       s = s+"...";
       System.out.println(s);
     }
  }
}


Measured memory_bytes: 38488
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt(), b = sc.nextInt();
        if (a <= b) {
            System.out.println(a);
        } else {
            System.out.println(a - 1);
        }
    }

}


Measured memory_bytes: 21844
using static System.Math;
using System;

public class Hello
{
    public static void Main()
    {
        var c = new int[361];
        var n = int.Parse(Console.ReadLine().Trim());
        for (int i = 0; i < n; i++)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            var m = int.Parse(line[0]);
            var d = int.Parse(line[1]);
            var a = int.Parse(line[2]);
            var s = int.Parse(line[3]);
            setC(c, m, d, a, s);
        }
        var ans = getAns(c);
        Console.WriteLine(ans);
    }
    static int getAns(int[] c)
    {
        var ans = int.MaxValue;
        for (int i = 1; i <= 360; i++) ans = Min(ans, c[i]);
        return ans;
    }
    static void setC(int[] c, int m, int d, int a, int s)
    {
        var w = (m - 1) * 30 + d;
        for (int i = 1; i <= s - 1; i++)
        {
            var t = w - i;
            if (t < 1) t += 360;
            while (t < 1) t += 360;
            c[t] = Max(c[t], s - i);
            var t2 = w + a - 1 + i;
            while (t2 > 360) t2 -= 360;
            c[t2] = Max(c[t2], s - i);
        }
        for (int i = w; i <= w + a - 1; i++)
            if (i > 360) c[i - 360] = Max(c[i - 360], s);
            else c[i] = Max(c[i], s);
    }
}



Measured memory_bytes: 17984
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;
using ll = long long;

int main()
{
  ll N, M, K; cin >> N >> M >> K;
  for (ll n = 0; n <= M; ++n) {
    for (ll m = 0; m <= N; ++m) {
      if (n*N+m*M-2*n*m==K) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 256
import collections
import numpy as np

N = int(input())
A = list(map(int, input().split()))
Q = int(input())
B = [0 for _ in range(Q)]
C = [0 for _ in range(Q)]
for i in range(Q):
  B[i], C[i] = map(int, input().split())
  
a = collections.Counter(A)
S = np.sum(A)
for i in range(Q):
  S += (C[i]-B[i]) * a[B[i]]
  a[C[i]] += a[B[i]]
  a[B[i]] = 0

  print(S)

Measured memory_bytes: 47804
// AOJ 2700: Airport Codes
// 2017.10.8 bal4u@uu

#include <stdio.h>

char nm[50][51];
char tr['z'];

int main()
{
	int n, i, j, ans;
	char s[51], *p, *q;

	tr['a'] = tr['i'] = tr['u'] = tr['e'] = tr['o'] = 1;
	while (scanf("%d", &n) && n > 0) {
		for (i = 0; i < n; i++) {
			scanf("%s", s); p = s, q = nm[i];
			*q++ = *p;
			while (*p) {
				if (tr[*p]) {
					if (!*++p) break;
					*q++ = *p;
				} else p++;
			}
			*q = 0;
		}

		for (ans = 0, i = 0; i < n; i++) {
			for (j = i+1; j < n; j++) {
				p = nm[i], q = nm[j];
				while (*p && *p == *q) p++, q++;
				if (!*p && !*q) { ans = -1; goto Done; }
				if (ans < p-nm[i]+1) ans = p-nm[i]+1;
			}
		}
Done:	printf("%d\n", ans);
	}
	return 0;
}

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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();
            int k = int.Parse(Console.ReadLine()) - 1;

            var sb = new StringBuilder();
            for (int i = 0; i < n; i++)
            {
                sb.Append(s[i] == s[k] ? s[i] : '*');
            }
            Console.WriteLine(sb.ToString());
        }
    }
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define me BOSS
#define bug() cout<<"AIkahne aise"<<endl
ll A[5000001],bin[5000001];
vector<ll>v;
map<int,int>myMap;
set<int>mySet;
vector<pair<ll,ll> >vp;
/* Precode Start Here *\



     Sieve
void sieve()
{
    for(ll i=3; i<=2000; i+=2)
    {
        for(ll j=i*i; j<=4000000; j+=i)
            A[j]=1;
    }
    v.push_back(2);
    for(ll i=3; i<=4000000; i+=2)
        if(A[i]==0)
            v.push_back(i);
}

     Power Function Modulo P

ll modPow(ll a, ll x, ll p) {
    //calculates a^x mod p in logarithmic time.
    long res = 1;
    while(x > 0) {
        if( x % 2 != 0) {
            res = (res * a) % p;
        }
        a = (a * a) % p;
        x /= 2;
    }
    return res;
}


   factorial

ll fact(ll n)
{
    ll ans=1;
    for(ll i=1;i<=n;i++)
    {
        ans=(ans*i)%mod;
    }
    return ans;
}
     Calculating nCr using Fermats law Theorem

ll modInverse(ll a, ll p) {
    //calculates the modular multiplicative of a mod m.
    //(assuming p is prime).
    return modPow(a, p-2, p);
}


ll modBinomial(ll n, ll k, ll p) {
// calculates C(n,k) mod p (assuming p is prime).

    ll numerator = 1; // n * (n-1) * ... * (n-k+1)
    for (ll i=0; i<k; i++) {
        numerator = (numerator * (n-i) ) % p;
    }

    ll denominator = 1; // k!
    for (ll i=1; i<=k; i++) {
        denominator = (denominator * i) % p;
    }

    // numerator / denominator mod p.
    return ( numerator* modInverse(denominator,p) ) % p;
}
     num of divisor and euler totient

ll phi[1000001],mark[1000001],divi[1000001];;
void divisorPhi(ll n)
{
    for(int i=1;i<=n;i++)
        phi[i]=i;
    for(int i=2;i<=n;i++)
    {
        if(!mark[i])
        {
            for(int j=i;j<=n;j+=i)
            {
                mark[j]=1;
                phi[j]*=(1-1/(double)i);
            }
        }
    }
    for(ll i=1;i<=n;i++)
    {
        for(ll j=i;j<=n;j+=i)
            divi[j]++;
    }
}




/* Precode Ends */
int main()
{
   ll a,b;
   cin>>a>>b;
   if(a<2*b)
   {
       cout<<0<<endl;
   }
   else
   {
       cout<<a-2*b<<endl;
   }
return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pi 3.1415926535897932384626
using namespace std;
      
struct P{
  int x,y;
  bool operator < (const P &a )const{
    //if(y!=a.y)
    return y>a.y;
  };
};

int a,b,c,d,i,k,n,m,e,dx[10]={1,0,-1,0,1,1,-1,-1},dy[10]={0,1,0,-1,1,-1,1,-1};
int o[400031],o1[400101];
int l[400055],l1[400101];
int j[400101];

long long x,y,z,mod=1000000007;
//string r;
char r[1];

P u[1];
queue<int> q;

//stack<int> s;
set<int> s;
map<int,int> p;
vector<P> v;

bool as(P a,P b)
{
  if(a.x==b.x)
  return a.y<b.y;
  return a.x<b.x;
}


int main()
{
  scanf("%d",&a);
  for(int t=0;t<a;t++)
    scanf("%d",&o1[t]);
   
  for(int t=0;t<a;t++)
    scanf("%d",&l1[t]);
  
  for(int t=1;t<2*a;t++)
  {
    o[t]=(o1[(t-1)%a]^o1[t%a]);
    //printf("%d ",o[t]);
  }
  //puts("#");
  for(int t=1;t<a;t++)
  {
    l[t]=(l1[t-1]^l1[t]);
    //printf("%d ",l[t]);
  }
  for(int t=2;t<a;t++)
  {
    for(;k&&l[k+1]!=l[t];k=j[k]);
    if(l[k+1]==l[t]) k++,j[t]=k;
  }
  k=0;
  for(int t=1;t<2*a-1;t++)
  {
    for(;k&&l[k+1]!=o[t];k=j[k]);
    if(l[k+1]==o[t]) k++;
    //printf("@@%d %d %d %d\n",t,k,l[k],o[t]);
    if(k==a-1)
    {
      k=j[k];
      v.push_back({(t-a+1),o1[(t+t-a+1)%a]^l1[(t)%a]});
    }
  }
  sort(v.begin(),v.end(),as);
  //puts("#");
  for(int t=0;t<v.size();t++)
  printf("%d %d\n",v[t].x,v[t].y);
}



Measured memory_bytes: 12016
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(i,v.size())cout<<" "<<v[i];cout<<endl<<endl;
#define show2d(v) rep(i,v.size()){rep(j,v[i].size())cout<<" "<<v[i][j];cout<<endl;}cout<<endl;
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
//#define mt make_tuple
//typedef tuple<int,int,int> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int a,b;
	cin>>a>>b;
	if(b==100)b++;
	while(a--)b*=100;
	cout<<b<<endl;
}










Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    int a, b, c, t;
    cin >> a >> b >> c;
    if(a<b)
        if(b>c){
            t = c;
            c = b;
            b = t;
        }
            if(a>b){
                t = b;
                b = a;
                a = t;
            }
    else{
        t = b;
        b = a;
        a = t;
    }
        if(b>c){
            t = c;
            c = b;
            b = t;
        }
            if(a>b){
                t = b;
                b = a;
                a = t;
            }
                
    cout << a << " " << b << " " << c << endl;
    return 0;
}


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

int main(){
  string s;
  cin>>s;
  int maxnum=0;
  for(int i=0;i<s.size();i++){
    int count=0,log=i;
    while(s.at(log)=='A'||s.at(log)=='T'||s.at(log)=='G'||s.at(log)=='C'){
      count++;
      log++;
      if(log==s.size()) break;
    }
    maxnum=max(maxnum,count);
  }
  cout<<maxnum<<endl;
}

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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using Pi = pair<int, int>;
using Tapris = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

const int dy[] = {-1, 0, 1, 0};
const int dx[] = {0, -1, 0, 1};

int h, w;
bool wall[4][33][33];

bool in(int y, int x) {
  return 0<=y&&y<h&&0<=x&&x<w;
}

int brokenPath[4][33][33][33][33];

void bfs(int d, int sy, int sx) {
  queue<Pi> que;
  que.emplace(h-1, w-1);
  rep(i, 33) rep(j, 33) brokenPath[d][sy][sx][i][j] = inf;
  brokenPath[d][sy][sx][h-1][w-1] = 0;
  while(!que.empty()) {
    int y, x; tie(y, x) = que.front(); que.pop();
    rep(i, 4) {
      int ny = y+dy[i], nx = x+dx[i];
      if(!in(ny, nx) || wall[i][y][x]) continue;
      if(brokenPath[d][sy][sx][y][x]+1 < brokenPath[d][sy][sx][ny][nx]) {
	brokenPath[d][sy][sx][ny][nx] = brokenPath[d][sy][sx][y][x]+1;
	que.emplace(ny, nx);
      }
    }
  }
}

int mincost[33][33];

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  while(cin >> h >> w, h || w) {
    rep(i, 4) rep(j, 33) rep(k, 33) wall[i][j][k] = true;

    rep(i, 2*h-1) {
      if(i&1) {
	rep(j, w) {
	  bool f;
	  cin >> f;
	  wall[2][i/2][j] = f;
	  wall[0][i/2+1][j] = f;
	}
      } else {
	rep(j, w-1) {
	  bool f;
	  cin >> f;
	  wall[3][i/2][j] = f;
	  wall[1][i/2][j+1] = f;
	}
      }
    }

    rep(k, 4) rep(i, h) rep(j, w) {
      if(wall[k][i][j]) continue;
      wall[k][i][j] = true;
      bfs(k, i, j);
      wall[k][i][j] = false;
    }

    priority_queue<Tapris, vector<Tapris>, greater<Tapris> > que;
    rep(i, 33) rep(j, 33) mincost[i][j] = inf;
    mincost[h-1][w-1] = 0;
    que.emplace(0, h-1, w-1);
    while(!que.empty()) {
      int cost, y, x;
      tie(cost, y, x) = que.top(); que.pop();
      if(mincost[y][x] < cost) continue;
      rep(i, 4) {
	int ny = y+dy[i], nx = x+dx[i];
	if(!in(ny, nx) || wall[i][y][x]) continue;
	int nc = max(cost+1, brokenPath[i][y][x][ny][nx]);
	if(nc < mincost[ny][nx]) {
	  mincost[ny][nx] = nc;
	  que.emplace(nc, ny, nx);
	}
      }
    }

    cout << (mincost[0][0] == inf ? -1 : mincost[0][0]) << endl;
  }

  return 0;
}



Measured memory_bytes: 33244
#include <stdio.h>
#include <stdlib.h>

using namespace std;

int main()
{
//    cout << "Hello world!" << endl;
  int a,b,x;
  scanf("%d%d%d",&a,&b,&x);
  if(x>a+b)
    printf("NO\n");
  else
  {
      if(a<=x)
        printf("YES\n");
      else
        printf("NO\n");
  }


    return 0;
}


Measured memory_bytes: 128
// Prime Factorize
// 所要時間 分
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define REP(i, d, n) for(int i=(d); i<(n); ++i)
#define all(v) v.begin(), v.end()

int main() {

    int n;
    cin >> n;


    cout << to_string(n) << ": ";

    int a = n;
    for(int i=2; i*i<=a; ++i){
        while(n % i == 0){
            cout << i;
            if((double)n / i != 1){
                cout << " ";
            }
            else{
                cout << endl;
            }
            n /= i;
        }
    }
    if(n != 1){
        cout << n << endl;
    }

    return 0;
}


Measured memory_bytes: 3268