akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <set>
#include <map>
#include <cassert>
#include <fstream>
#include <iomanip>

using namespace std;

int main() {
    
    
    int n;
    cin >> n;
    cout << 180 * (n - 2) << endl;
    
    return 0;
}

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

int main(){
  int h,w,a,b;
  cin >> h >> w >> a >> b;
  vector<vector<int>> s(h,vector<int>(w));

  for (int i = 0;i < b;i++){
    for (int j = 0;j < a;j++){
      s[i][j] = 1;
    }
  }
  for (int i = b;i < h;i++){
    for (int j = a;j < w;j++){
      s[i][j] = 1;
    }
  }

  for (int i = 0;i < h;i++){
    for (int j = 0;j < w;j++){
      cout << s[i][j];
    }
    cout << endl;
  }
}

Measured memory_bytes: 5120
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] count = new int[100001];
        while (n-- > 0) {
            int num = sc.nextInt();
            if (num != 0) count[num-1]++;
            count[num]++;
            if (num != 100000) count[num+1]++;
        }
        
        int ans = 0;
        for (int i = 0; i < 100001; i++) {
            ans = Math.max(ans, count[i]);
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 58840
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int L, R, D;
  cin>>L>>R>>D;
  int ans = 0;
  for(int i=L;i<=R;++i) {
    if(i%D==0) ans++;
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 3624
n,k=map(int,input().split())
A=list(map(int,input().split()))

def culc(L):
    subL=[0]*(n+1)

    for i in range(n):
        temp=L[i]
        bottom=max(i-temp,0)
        top=min(i+temp,n-1)

        subL[bottom]+=1
        subL[top+1]-=1
    
    resL=[0]*n
    resL[0]=subL[0]
    for i in range(1,n):
        resL[i]=resL[i-1]+subL[i]

    return resL

for i in range(min(k,50)):
    A=culc(A)

print(*A)


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

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

	vector<int> point(N);
	for (int i = 0; i < N; i++)
	{
		cin >> point.at(i);
	}

	sort(point.begin(), point.end(), greater<int>());

	int ans = 0;
	for (int i = 0; i < N; i++)
	{
		if ((i % 2) == 0)
		{
			ans += point.at(i);
		}
		else
		{
			ans -= point.at(i);
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
#define rep2(i,a,n) for(int i=a;i<n;i++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INFL = 1e18;
const int INF = 1001001001; 
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
const int mod =1000000007;
const double PI = acos(-1);

int main(){
	int n,k;cin>>n>>k;
    vi a(n);
    rep(i,n)cin>>a[i];
    rep(_,k){
        vi ne(n+1,0);
        rep(i,n){
            ne[max(0,i-a[i])]+=1;
            ne[min(n,i+a[i]+1)]-=1;
        }
        vi su(n);
        su[0]=ne[0];
        rep(i,n){
            if(i==0)continue;
            su[i]=su[i-1]+ne[i];   
        }
        bool f =true;
        rep(i,n){
            if(su[i]<n)f=false;
        }
        if(f){
            rep(i,n-1){cout<<n<<' ';
            }
            cout<<n<<endl;
            return 0;
        }
        else{
            a=su;
        }
    }
    rep(i,n-1){
        cout<<a[i]<<' ';
    }
    cout<<a[n-1]<<endl;
}

Measured memory_bytes: 5636
import java.util.Scanner;

public class Main{
 public static void main(String[] args){
 Scanner sc = new Scanner(System.in);
 while(true){
 int H = sc.nextInt();
 int W = sc.nextInt();
 if(H == 0 && W == 0){
  break;
 }
 for(int i=0;i<H;i++){
  for(int j=0;j<W;j++){
  System.out.printf("#");
  }
  System.out.printf("\n");
}
  System.out.printf("\n");
}
}
}

Measured memory_bytes: 64592
program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils,Classes;
var
  a,h,w,i,j,count,x,y,sw,m,n,b,c,soeji,sum,max:Integer;
  //a:array of Integer;
  s,s123,s1,s2,s3:string;
  tf:Boolean;
  nyu:TStringList;
begin
  try
    { TODO -oUser -cConsole Main : ここにコードを記述してください }
    Read(a);
    Readln(b);

    if (a mod 3=0)or(b mod 3=0)or((a+b)mod 3=0) then
      Writeln('Possible')
    else
      Writeln('Impossible');
    Readln;
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
end.


Measured memory_bytes: 256
n = int(input())
t = list(map(int, input().split(' ')))
x = 0
for i in range(n):
    kome = i
    for j in range(i,n):
        if t[j] < t[kome]:
            kome = j
    if t[i] > t[kome]:
        t[i],t[kome] = t[kome],t[i]
        x = x + 1
t = [str(i) for i in t]
print(' '.join(t))
print(x)


Measured memory_bytes: 5604
#include <iostream>
using namespace std;
int main(void) {
	long long n, sum = 0;
	cin >> n;
	for (int i = 1; i <= n; ++i) {
		if (i % 3 != 0 and i % 5 != 0)
			sum += i;
	}
	cout << sum << endl;
	return 0;
}

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

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

   if (op == '+') {
       cout << a + b << endl;
   } else {
       cout << a - b << endl;
   }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair<ll, ll>
#define F first
#define S second
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)



int main(){
    int N;cin >> N;
    vector<LL> dp(N+100,INF);
    dp[0] = 0;
    rep(i,N+1){
        rep(j,7){
            if(j == 0)chmin(dp[i+1],dp[i]+1);
            if(i + pow(6,j) <= N)chmin(dp[i+pow(6,j)],dp[i]+1);
            if(i + pow(9,j) <= N)chmin(dp[i+pow(9,j)],dp[i]+1);
        }
    }
    cout << dp[N] << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

template <ll Mod>
struct modint {
  ll n;

  modint(const ll x = 0) : n(x) { while (n < 0) n += Mod; n %= Mod; }
  modint operator+(const modint r) const { return modint(*this) += r; }
  modint operator-(const modint r) const { return modint(*this) -= r; }
  modint operator*(const modint r) const { return modint(*this) *= r; }
  modint operator/(const modint r) const { return modint(*this) /= r; }
  modint &operator+=(const modint r) {
    n += r.n;
    if (n >= Mod) n -= Mod;
    return *this;
  }
  modint &operator-=(const modint r) {
    if (n < r.n) n += Mod;
    n -= r.n;
    return *this;
  }
  modint &operator*=(const modint r) { n = n * r.n % Mod; return *this; }
  modint &operator/=(const modint r) { return *this *= r.inv(); }
  modint pow(ll x) const {
    modint<Mod> ret(1), tmp(*this);
    while (x) {
      if (x&1) ret *= tmp;
      tmp *= tmp;
      x >>= 1;
    }
    return ret;
  }
  modint inv() const { return pow(Mod-2); }
  friend ostream& operator<<(ostream& os, const modint& obj) { return os << obj.n; }
  friend istream& operator>>(istream& is, modint& obj) { ll t; is >> t; obj = modint(t); return is; }
};
constexpr ll mod = 1000000007;
using mint = modint<mod>;
mint operator"" _mi(unsigned long long n) { return mint(n); }

ll dfs(ll now, ll p, const vector<vl>& g, vl &size) {
  ll cnt = 1;
  for (auto&& i : g[now]) {
    if (i != p) {
      cnt += dfs(i, now, g, size);
    }
  }
  return size[now] = cnt;
}

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

  ll n;
  cin >> n;
  vector<vl> g(n);
  rep(i, n-1) {
    ll a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }

  // size[i] := 頂点iを根とする部分木の頂点数
  vl size(n);
  dfs(0, 0, g, size);

  mint ans(0);
  rep(i, n) {
    mint cnt(0);

    for (auto&& j : g[i]) {
      ll t;
      if (size[j] < size[i]) t = size[j];
      else t = size[0]-size[i];
      cnt += (2_mi).pow(t)-1;
    }

    ans += (2_mi).pow(n-1)-(cnt+1_mi);
  }

  ans /= (2_mi).pow(n);
  cout << ans << endl;
}


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

int main() {
  int N, Al, Bo;
  cin >> N;
  Al = 0;
  Bo = 0;
  vector<int> A(N);
  
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  
  sort(A.begin(), A.end());
  reverse(A.begin(), A.end());
  
  for (int j = 0; j < N; j++) {
    if (j % 2 == 0) {
      Al += A.at(j);
    }
    else {
      Bo += A.at(j);
    }
  }
  cout << Al - Bo << endl;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < (int)c; i++)
#define all(v) v.begin(), v.end()
const int inf = 1000000000; //10^9
using ll = long long;
using P = pair<int, int>;
//加算代入演算子は+=！！！！！

int main()
{
    int n;
    int ans = 0;
    cin >> n;

    rep(i, n)
    {
        ans += i + 1;
    }
    cout << ans << endl;
}

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

int main(){
   int N;
  cin >> N;
   vector<int> a(N);
   for(int i = 0;i < N;i++){
       cin >> a.at(i);
   }

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

   cout << a.at(N - 1) - a.at(0) << endl;
}

Measured memory_bytes: 256
n,k = list(map(int,input().split()))
x = list(map(int,input().split()))
result = -2 # 初期値！

for i in range(n-k+1):
    xl,xr = x[i],x[i+k-1]
    if result == -2 or min(abs(xl),abs(xr)) + xr - xl < result: # 初期値なら最適なのに更新、resultよりちいさかったら同じく更新する！。
        result = min(abs(xl),abs(xr)) + xr - xl

print(result)

Measured memory_bytes: 14252
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <chrono>
#include <random>

using namespace std;

#define int long long
#define ll long long
//#define double long double
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

const int INF = 2e9;
const int MB = 20;
const int MOD = 1e9 + 7;

void solve() {
    string s;
    cin >> s;
    cout << (s[2] == s[3] && s[4] == s[5] ? "Yes" : "No");
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    solve();
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <cmath>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <limits>
#include <cstring>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <bitset>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

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

int n, m;
ll sum, minv = (ll) 1e10;

int main() {
    /*
    ios::sync_with_stdio(false);
    cin.tie(0);
    */
    scanf("%d", &n);
    for (int i = 0; i < n; ++i) {
        ll x;
        scanf("%lld", &x);
        if (x < 0){
            ++m;
            sum -= x;
        }else{
            sum += x;
        }
        minv = min(minv, abs(x));
    }
    if (m % 2) sum -= 2 * minv;
    printf("%lld\n", sum);
}

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

int A[107];

int bubbleSort(int A[], int N)
{
    bool isReversed = true; 
    int count = 0;
    int i = 0;
    while (isReversed) {
        isReversed = false;
        for (int j = N-1; j > i; j--) {
            if (A[j] < A[j-1]) {
                int swp = A[j-1];
                A[j-1] = A[j];
                A[j] = swp;
                isReversed = true;
                count++;
            }
        }
        i++;
    }
    return count;
}

int main(void)
{
    int N; 
    cin >> N;
    
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    
    int count = bubbleSort(A, N);
    for (int i = 0; i < N-1; i++) {
        cout << A[i] << " ";
    }
    cout << A[N-1] << endl;
    cout << count << endl;
    
    return 0;
}


Measured memory_bytes: 3096
def get_basis(a):
    basis=[]
    for e in a:
        for b in basis:
            e = min(e, e^b)
        if e:
            basis.append(e)
    return basis
def solve():
    n=int(input())
    a=list(map(int,input().split()))
    ans=0
    for i in a:
        ans^=i
    k=~ans
    for i in range(n):
        a[i]&=k
    basis=get_basis(a)
    res=0
    for i in basis:
        res=max(res,res^i)
    print(ans+2*res)
solve()

Measured memory_bytes: 15988
N,M,=input().split()  #複数数値入力　「A B」みたいなスペース空いた入力のとき

N=int(N)
M=int(M)

A=list(map(int, input().split()))

a=[]
for n in range(N):
    a.append(int(A[n]) * (-1))

import heapq
import math

heapq.heapify(a)
for m in range(M):
    heapq.heappush(a,math.ceil(heapq.heappop(a)/2))   
    
print(sum(a)*(-1))

Measured memory_bytes: 14224
mod = 998244353
N,M,K = map(int,input().split())
ans = 0
def color(n,m):
    return m*(pow_k(m-1, n-1))

def pow_k(x, n):
    if n == 0:
        return 1
    K = 1
    while n > 1:
        if n % 2 != 0:
            K = K * x
            x = x ** 2
            x %= mod
            n = (n - 1) // 2
        else:
            x = x ** 2
            x %= mod
            n = n // 2

    return (K * x)%mod
invs = [0] * (N + 1)
invs[1] = 1
for i in range(2, N + 1):
    invs[i] = mod - invs[mod % i] * (mod//i) % mod
mod_inv_factorials=[1]*(N+1)

for i in range(2,N+1):
    mod_inv_factorials[i] = mod_inv_factorials[i-1]*invs[i]
    mod_inv_factorials[i] %= mod

def mod_factorial(n, m):
    r = 1
    for i in range(1, n+1):
        r *= i
        r %= m
    return r

upper = mod_factorial(N-1,mod)

for i in range(K+1):
    tmp = color(N-i,M)
    ansk = (upper*mod_inv_factorials[i]*mod_inv_factorials[N-1-i]*tmp)%mod
    ans += ansk
    ans %= mod
print(ans)

    


Measured memory_bytes: 71324
n = int(input())
l = [list(map(int, input().split())) for i in range(n)]

s = []
f = []
res = 1

for i in range(n):
    s.append(l[i][0]-l[i][1])
    f.append([l[i][0]+l[i][1], i])
    
f = sorted(f)
#print(f)

m = f[0][0]
for i in range(1, n):
    if s[f[i][1]] >= m:
        res += 1
        m = f[i][0]
    
print(res)

Measured memory_bytes: 46268
using System;
using System.Collections.Generic;
using System.Linq;
class Program{
    static void Main(string[] args){
    var vals= Console.ReadLine().Split().Select(x => int.Parse(x)).ToList();
    int N=vals[0];
    int M=vals[1];
    //long[] cards=new long[N];
    var A= Console.ReadLine().Split().Select(x => int.Parse(x)).ToList();
    A.Sort();
    int[] B=new int[M];
    int[] C=new int[M];
    for(int i=0;i<M;i++){
         var BC= Console.ReadLine().Split().Select(x => int.Parse(x)).ToList();
         B[i]=BC[0];
         C[i]=BC[1];
    }
    //複数まとめてソート
    var sortedBC = B.Zip(C, (x, y) => new { x, y })
    .OrderByDescending(p => p.y)
    .ToArray(); 
    int k=0;
    int j=0;
    long ans=0;
    for(int i=0;i<N;i++){
        if(k<M&&A[i]<sortedBC[k].y){
            ans+=sortedBC[k].y;
            j++;
            if(j==sortedBC[k].x){
                j=0;
                k++;
            }
        }
        else{
            ans+=A[i];
        }
    }
    Console.WriteLine(ans);
    }
}




Measured memory_bytes: 32948
#include <iostream>

int main()
{
	std::string movement;
	std::cin >> movement;
	int index = 0;
	for (; index < movement.length(); ++index)
	{
		if ((index % 2 == 0 && movement.at(index) == 'L')
			|| (index % 2 == 1 && movement.at(index) == 'R'))
		{
				break;
		}
	}
	std::cout << (index == movement.length() ? "Yes" : "No") << std::endl;
}

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

using namespace std;

struct Node {
    int parent;
    int children;
    int siblings;
    int depth;

    Node() : parent(-1), children(-1), siblings(-1) {}
};

int _calculate_depth(vector<Node>& tree, int index) {
    int depth = 0;
    while (tree[index].parent != -1) {
        index = tree[index].parent;
        ++depth;
    }
    return depth;
}

void calculate_depth(vector<Node>& tree) {
    for (int i = 0; i < tree.size(); ++i)
        tree[i].depth = _calculate_depth(tree, i);
}

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

    vector<Node> tree(n);
    for (int i = 0; i < n; ++i) {
        int id, k;
        cin >> id >> k;

        int child_id, prev;
        for (int j = 0; j < k; ++j) {
            cin >> child_id;

            if (j == 0)
                tree[id].children = child_id;
            else
                tree[prev].siblings = child_id;
            prev = child_id;

            tree[child_id].parent = id;
        }
    }

    calculate_depth(tree);

    for (int i = 0; i < n; ++i) {
        cout << "node " << i << ": parent = " << tree[i].parent
             << ", depth = " << tree[i].depth << ", ";

        if (tree[i].parent == -1)
            cout << "root, [";
        else if (tree[i].children == -1)
            cout << "leaf, [";
        else
            cout << "internal node, [";

        int idx = tree[i].children;
        for (int j = 0; idx != -1; ++j) {
            if (j != 0)
                cout << ", ";
            cout << idx;
            idx = tree[idx].siblings;
        }

        cout << "]\n";
    }
}



Measured memory_bytes: 4292
#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define int long long
#define pb push_back
#define x first
#define y second
#define mk(a,b) make_pair(a,b)
#define rr return 0
#define sqr(a) ((a)*(a))
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class value, class cmp = less<value> >
using ordered_set = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class value, class cmp = less_equal<value> >
using ordered_multiset = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class key, class value, class cmp = less<key> >
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;

/// find_by_order()
/// order_of_key()
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
inline int randll(int l = INT_MIN, int r = INT_MAX) {
    return uniform_int_distribution<int>(l, r)(rng);
}
const int INF = 1e9, MOD = 1e9 + 7; /// think
const ll LINF = 1e18;


const int dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0};
inline bool inside (int x, int y, int n, int m) {
    return 0 <= x && 0 <= y && x < n && y < m;
}

template<class T> bool umin (T &a, T b) {return a > b ? (a = b, true) : false; }
template<class T> bool umax (T &a, T b) {return a < b ? (a = b, true) : false; }

main()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, k;
    cin >> n >> k;
    int ans = 0;
    while (n) {
        ++ans;
        n /= k;
    }
    cout << ans << '\n';
}


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

using namespace std;

typedef long long ll;

const int maxn = 200100;

int n, a[maxn];

int main() {
    ios_base::sync_with_stdio(0);

    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        a[i] -= i+1;
    }

    sort(a, a + n);
    int b = a[n/2];
    
    ll ans = 0;
    for (int i = 0; i < n; i++)
        ans += abs(a[i] - b);
    cout << ans << endl;
}

Measured memory_bytes: 1024
// 2020-08-20 23:09:34
#include<bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }

const ull B = 100000007;
void answer() {
  int n;
  cin >> n;
  vector<ull> a(n), b(n);
  rep(i, n) cin >> a[i];
  rep(i, n) cin >> b[i];
  ull ah = 0, bh = 0, Bn = 1;
  rep(i, n) {
    Bn *= B;
    ah *= B;
    ah += (a[i] ^ a[(i+1)%n]);
    bh *= B;
    bh += (b[i] ^ b[(i+1)%n]);
  }
  rep(k, n) {
    if(ah == bh) {
      cout << k << ' ' << (a[k] ^ b[0]) << '\n';
    }
    ah *= B;
    ah -= (a[k] ^ a[(k+1)%n]) * Bn;
    ah += (a[k] ^ a[(k+1)%n]);
  }
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}

Measured memory_bytes: 6800
using System;
using System.Collections.Generic;
using System.Linq;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var S = Read();
            if (S == "zyxwvutsrqponmlkjihgfedcba") { Console.WriteLine(-1); return; }
            var used = new Dictionary<char, bool>();
            for (char c = 'a'; c <= 'z'; c++) used.Add(c, false);
            for (int i = 0; i < S.Length; i++) used[S[i]] = true;
            var ans = S;
            if (S.Length < 26)
            {
                foreach(var u in used)
                {
                    if (!u.Value)
                    {
                        ans += u.Key;
                        break;
                    }
                }
            }
            else
            {
                while (true)
                {
                    var c = ans[ans.Length - 1];
                    used[c] = false;
                    ans = ans.Remove(ans.Length - 1, 1);
                    var suc = false;
                    var chk = ans[ans.Length - 1];
                    foreach(var u in used)
                    {
                        if (!u.Value && u.Key > chk)
                        {
                            ans = ans.Remove(ans.Length - 1, 1);
                            ans += u.Key;
                            suc = true;
                            break;
                        }
                    }
                    if (suc) break;
                }
            }

            Console.WriteLine(ans);
            Console.ReadLine();
        }

        static string Read() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Read()); }
        static long ReadLong() { return long.Parse(Read()); }
        static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }
        static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }
    }
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
typedef long long ll;
const int INF = 1<<29;
const int N = 1e6 + 9;
ll a[N];
bool cmp(const pair<ll, ll> &a, const pair<ll, ll> &b)
{
    if(a.second == b.second){
        return a.first < b.first;
    }
    return a.second < b.second;
}
int main()
{
    fio;
    string s;
    cin >> s;
    map <char, ll> m;
    for(int i = 0; i < s.size(); i ++){
        m[s[i]] ++;
    }
    if(m['A'] > 0 && m['B'] > 0){
        cout << "Yes" << endl;
    }
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
int main()
{
  char s[2000000];
  scanf("%s", s);
  int i;
  long sum = 0;
  for (i = 0; s[i] != '\0'; i++)
    sum += s[i] - '0';
  if (sum % 9 == 0)
    printf("Yes");
  else
    printf("No");
}

Measured memory_bytes: 1852
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<map>
#include<algorithm>

using namespace std;

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

    int Xmax = X;
    int Ymin = Y;

    for (int i = 0; i < N; i++) {
        int xi;
        cin >> xi;
        Xmax = max(Xmax, xi);
    }

    for (int i = 0; i < M; i++) {
        int yi;
        cin >> yi;
        Ymin = min(Ymin, yi);
    }

    if (Xmax < Ymin) {
        cout << "No War" << endl;
    } else {
        cout << "War" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    n = int(ipt())
    if n == 2:
        print(1)
        exit()

    def al_div(n):
        pn = 1
        div = []
        while pn**2 < n:
            if n%pn == 0:
                div.append(pn)
                div.append(n//pn)
            pn += 1
        if pn**2 == n:
            div.append(pn)
        return div
    ans = 0
    for i in al_div(n-1):
        if i == 1:
            continue
        else:
            if n%i == 1:
                ans += 1
    for i in al_div(n):
        if i == 1:
            continue
        ni = n
        while ni%i == 0:
            ni //= i
        if ni%i == 1:
            ans += 1

    print(ans)

    return

if __name__ == '__main__':
    main()


Measured memory_bytes: 69084
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,x;cin>>n>>x;
  if(x==1||x==2*n-1){
    cout<<"No"<<endl;
    return 0;
  }
  cout<<"Yes"<<endl;
  if(n==2){
    for(int i=1;i<=3;i++)cout<<i<<endl;
    return 0;
  }
  vector<int>v;
  for(int i=1;i<=2*n-1;i++){
    if(i>=x-1&&i<=x+2)continue;
    v.push_back(i);
  }
  if(x<2*n-2){
    for(int i=1;i<n-2;i++){
      cout<<v[i-1]<<endl;
    }
    cout<<x+1<<endl;
    cout<<x-1<<endl;
    cout<<x<<endl;
    cout<<x+2<<endl;
    for(int i=n+2;i<=2*n-1;i++){
      cout<<v[i-5]<<endl;
    }
    return 0;
  }
  vector<int>w;
  for(int i=1;i<=2*n-1;i++){
    if(i>=x-2&&i<=x+1)continue;
    w.push_back(i);
  }
  for(int i=1;i<n-2;i++){
      cout<<w[i-1]<<endl;
    }
    cout<<x-2<<endl;
    cout<<x+1<<endl;
    cout<<x<<endl;
    cout<<x-1<<endl;
    for(int i=n+2;i<=2*n-1;i++){
      cout<<w[i-5]<<endl;
    }
    return 0;
}


Measured memory_bytes: 3188
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#define MAXN 1010
#define MAXM 100010
#define INF 0x11111111
using namespace std;

struct edge{
	int to,next,w;
	edge(int _to=0,int _next=0,int _w=0):to(_to),next(_next),w(_w){}
}e[MAXM];

int n,m;
int g[MAXN],nume;
int S,T,p1[MAXN],p2[MAXN],nump;
int level[MAXN];

void addEdge(int u,int v,int w){
	e[nume]=edge(v,g[u],w);
	g[u]=nume++;
	e[nume]=edge(u,g[v],0);
	g[v]=nume++;
}

bool bfs(){
	memset(level,-1,sizeof level);
	static queue<int> Q;
	level[S]=0;
	Q.push(S);
	while(!Q.empty()){
		int x=Q.front();
		Q.pop();
		for(int i=g[x];~i;i=e[i].next)
			if(e[i].w && level[e[i].to]==-1){
				level[e[i].to]=level[x]+1;
				Q.push(e[i].to);
			}
	}
	return level[T]!=-1;
}

int dfs(int x,int delta){
	if(x==T) return delta;
	int res=0;
	for(int i=g[x];~i;i=e[i].next)
		if(level[e[i].to]==level[x]+1 && e[i].w){
			int temp=dfs(e[i].to,min(delta,e[i].w));
			delta-=temp;
			res+=temp;
			e[i].w-=temp;
			e[i^1].w+=temp;
			if(!delta) return res;
		}
	return res;
}

int main(){
	memset(g,-1,sizeof g);
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++) p1[i]=++nump;
	for(int i=1;i<=m;i++) p2[i]=++nump;
	S=++nump;
	T=++nump;
	for(int i=1;i<=n;i++){
		static char str[MAXN];
		scanf("%s",str+1);
		for(int j=1;j<=m;j++)
			if(str[j]!='.'){
				addEdge(p1[i],p2[j],1);
				addEdge(p2[j],p1[i],1);
				if(str[j]=='S'){
					addEdge(S,p1[i],INF);
					addEdge(S,p2[j],INF);
				}else if(str[j]=='T'){
					addEdge(p1[i],T,INF);
					addEdge(p2[j],T,INF);
				}
			}
	}
	int flow=0;
	while(bfs()) flow+=dfs(S,INF);
	if(flow>n*m) puts("-1");
	else printf("%d\n",flow);
	return 0;
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n,m;
bool used[100005];
vector<int> G[100005];
vector<int> rG[100005];
int su=0;
int ct=0;

void dfs(int v){
	used[v]=true;
	ct++;
	for(int i=0;i<G[v].size();i++){
		if(!used[G[v][i]]){
			dfs(G[v][i]);
		}
	}
	su+=G[v].size();
}

int main(void){
	scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++){
		int a,b;
		scanf("%d%d",&a,&b);
		a--;
		b--;
		G[a].push_back(b);
		rG[b].push_back(a);
	}
	int cnt=0;
	int ans=0;
	for(int i=0;i<n;i++){
		if(!used[i]){
			cnt++;
			ct=0;
			su=0;
			dfs(i);
			ans+=su-(ct-1);

		}
	}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 8052
#include<iostream>
static const int MAX = 100;
using namespace std;

void trace(int A[], int N)
{
	int i;
	for(i=0; i<N; i++){
		if(i>0){
			cout << " ";
		}
		cout << A[i];
	}
	cout << endl;
}

void selectionSort(int A[], int N)
{
	int i, j, tmp, minj, count;
	int _A[N];
	
	count = 0;
	
	for(i=0; i<N; i++){
		minj = i;
		for(j=i; j<N; j++){
			if(A[j] < A[minj]){
				minj = j;
			}
		}
		
		tmp = A[i];
		A[i] = A[minj];
		A[minj] = tmp;
		
		if(i != minj)count++;
	}
	
	trace(A, N);
	
	cout << count << endl;
}

int main()
{
	int N, i;
	int A[MAX];
	
	cin >> N;
	for(i=0; i<N; i++)cin >> A[i];
	
	selectionSort(A, N);
	
	return 0;
}

Measured memory_bytes: 3036
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string[] sS = System.Console.ReadLine().Trim().Split(' ');

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            string sOut = "No";
            if (sS[0] == sS[1]) { sOut = "Yes"; }

            // 出力
            System.Console.WriteLine("{0}", sOut.ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }

}


Measured memory_bytes: 13268
#include<cstdio>
#include<algorithm>
#define N_ 201000
using namespace std;
int n, m, K, UF[N_], C[N_], R[N_], RC;
long long Res;
int Find(int a) {
	return a == UF[a] ? a : UF[a] = Find(UF[a]);
}
struct Edge {
	int a, b, c;
	bool operator<(const Edge &p)const {
		return c < p.c;
	}
}E[N_];
int main() {
	scanf("%d%d%d", &n, &m, &K);
	int i, c = K, a, b, d;
	for (i = 1; i <= n; i++) {
		scanf("%d", &C[i]);
		if (!C[i])C[i] = ++c;
	}
	for (i = 1; i <= c; i++)UF[i] = i;
	for (i = 0; i < m; i++) {
		scanf("%d%d%d", &E[i].a, &E[i].b, &E[i].c);
	}
	sort(E, E + m);
	for (i = 0; i < m; i++) {
		a = Find(C[E[i].a]), b = Find(C[E[i].b]);
		if (a != b) {
			R[RC++] = E[i].c;
			UF[a] = b;
		}
	}
	if (RC < K - 1) {
		printf("-1\n");
		return 0;
	}
	sort(R, R + RC);
	for (i = 0; i < K - 1; i++)Res += R[i];
	printf("%lld\n", Res);
}

Measured memory_bytes: 3968
H, W = map(int, input().split())
s_l = []
for _ in range(H):
    s_l.append(list(input()))

for h in range(H):
    for w in range(W):
        if s_l[h][w] == ".":
            cnt = 0
            if h != 0:
                if w != 0:
                    if s_l[h - 1][w - 1] == "#":
                        cnt += 1
                if w != W - 1:
                    if s_l[h - 1][w + 1] == "#":
                        cnt += 1
                if s_l[h - 1][w] == "#":
                    cnt += 1
            if h != H - 1:
                if w != 0:
                    if s_l[h + 1][w - 1] == "#":
                        cnt += 1
                if w != W - 1:
                    if s_l[h + 1][w + 1] == "#":
                        cnt += 1
                if s_l[h + 1][w] == "#":
                    cnt += 1
            if w != 0:
                if s_l[h][w - 1] == "#":
                    cnt += 1
            if w != W - 1:
                if s_l[h][w + 1] == "#":
                    cnt += 1
            s_l[h][w] = str(cnt)

for h in range(H):
    print("".join(s_l[h]))


Measured memory_bytes: 9192
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
const int maxd = 105;
char s[maxd];
int main()
{
    // freopen("a.in","r",stdin);
    // freopen("k.out","w",stdout);
    scanf("%s",s+1);
    for(int i = 1;s[i];i++)
    {
        if(i%2 == 1&&s[i] == 'L')
        {
            printf("No");
            return 0;
        }
        if(i%2 == 0&&s[i] == 'R')
        {
            printf("No");
            return 0;
        }
    }
    printf("Yes");
    return 0;
}

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

class Adjl{
private:
	int u;
	int k;
	Adjl **next;
protected:
	int d;
	int f;
public:
	Adjl(int u);
	~Adjl(){ if (next != NULL) delete[] next; }
	void setV(int k, Adjl *vk);
	int depthFirstSearch(int time);
	void print();
};

Adjl::Adjl(int u)
{
	this->u = u;
	k = 0;
	next = NULL;
	d = 0;
	f = 0;
}

void Adjl::setV(int k, Adjl *vk)
{
	if (this->k == 0) next = new Adjl*[k];
	next[this->k] = vk;
	(this->k)++;
}

int Adjl::depthFirstSearch(int time)
{
	if (d != 0) return time;
	time++;
	d = time;
	for (int i = 0; i < k; i++) {
		time = next[i]->depthFirstSearch(time);
	}
	time++;
	f = time;
	return time;
}

void Adjl::print()
{
	cout << u << " " << d << " " << f << endl;
}

int main(void)
{
	int n;
	cin >> n;
	
	Adjl **adjl = new Adjl*[n];
	int check[100] = {0};

	for (int i = 0; i < n; i++) {
		int u, k;
		cin >> u >> k;
		if (check[i] == 0) {
			adjl[i] = new Adjl(u);
			check[i] = 1;
		}
		check[i] = 1;
		for (int j = 0; j < k; j++) {
			int vk;
			cin >> vk;
			if (check[vk - 1] == 0) {
				adjl[vk - 1] = new Adjl(vk);
				check[vk - 1] = 1;
			}
			adjl[i]->setV(k, adjl[vk - 1]);
		}
	}

	int time = 0;
	for (int i = 0; i < n; i++) {
		time = adjl[i]->depthFirstSearch(time);
	}

	for (int i = 0; i < n; i++) {
		adjl[i]->print();
	}

	delete[] adjl;
	return 0;
}

Measured memory_bytes: 3116
#include<cstdio>
long long f[105], cnt[105];

int factor(long long u){
    int size = 0;
    for(long long i = 2; i*i <= u; i++){
        if(u==1) break;
        else if(u%i==0){
            long long fac = 1ll;
            while(u%i==0){
                fac *= i;
                u /= i;
            }
            f[++size] = fac;
        }
    }
    if(u!=1ll) f[++size] = u;
    return size;
}

long long spJudge(long long u){
    long long find = -1;
    for(long long i = 1ll; i*i <= u; i++){
        if(u%i==0){
            long long j = u/i;
            if(i==j+1ll) find = i;
            else if(j==i+1ll) find = j;
        }
    }
    return find;
}

void exgcd(long long a,long long b,long long&x,long long&y){
    if(!b) {
        x = 1;
        y = 0;
    }
    else{
        exgcd(b, a % b, x, y);
        long long t = x; x = y; y= t-a/b*y;
    }
}

long long getRes(long long a,long long b,long long upper){
    long long x,y;
    exgcd(a,b,x,y);
    //printf("a = %lld, b = %lld, x = %lld, y = %lld\n",a,b,x,y);
    if(x<0){
        long long need = -x;
        long long time = need/b;
        if(need%b) time++;
        x += time*b, y -= time*a;
    }
    //printf("diff = %lld\n",a*x+b*y);
    if(y==0) y -= a;
    //printf("after: a = %lld, b = %lld, x = %lld, y = %lld\n",a,b,x,y);
    long long res = (-y)*b;
    return res;
}

int main(){
    long long n;
    scanf("%lld",&n);
    long long answer = -1;
    if(n%2) answer = n;
    else answer = n-1ll;
    long long check = spJudge(2ll*n);
    if(check!=-1){ 
        if(answer>check) answer = check;
    }
    else{
        n *= 2ll;
        int size = factor(n);
        /*for(int i = 1; i <= size; i++) printf("f[%d] = %lld\n",i,f[i]);
        printf("\n");*/
        for(int i = 0; i < (1<<size); i++){
            long long a = 1ll, b = 1ll;
            int mask = i;
            for(int j = 1; j <= size; j++){
                if(mask%2) a *= f[j];
                else b *= f[j];
                mask /= 2;
            }
            long long res = getRes(a,b,answer);
            if(res!=-1 && answer>res) answer = res;
            res = getRes(b,a,answer);
            if(res!=-1 && answer>res) answer = res;
        }
    }
    printf("%lld\n",answer);
    return 0;
}


Measured memory_bytes: 1728
N = int(input())
graph = []
for _ in range(N):
  A = int(input())
  row = []
  for j in range(A):
    x,y = map(int,input().split())
    row.append([x,y])
  graph.append(row)

res = 0
for state in range(2**N):
  for person in range(N):
    if (state >> person) & 1:
      for x, y in graph[person]:
        x -= 1
        if (state >> x & 1) != y:
          break
      else:
        continue
      break
  else:
    res = max(res, bin(state).count('1'))
print(res)

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

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef pair<int, int>P;
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
typedef vector<vector<ll>> mat;
typedef vector<int> vec;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
const ll mod = 1000000007;
const ll INF = mod * mod;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
ll qp(ll a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };



void solve() {
    ll a, b, c, d, e , m, n, k, x, y, l,r,t, h, w;
    string s;
    ll ans = 0;
    double dans = 0;
    string sans = "Yes";
    vector<ll> ar;
    vector<string> sr;
    vector<vector<char>> arr;

    cin >> n;

    rep1(i,n){
        ll co=0;
        if(i%2==0)continue;

        rep1(j,i){
            if(i%j==0)co++;
        }
        if(co==8)ans++;
    }


    std::cout << ans << endl;

    // std::cout << sans << endl;
}

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

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

#define REP(i,n) for (int (i) = 0;(i) < (n);++(i))
#define FORN(i,a,b) for (int i = (a);i <=(b); ++i)
#define FORD(i,a,b) for (int i = (a); i >= (b); --i)
#define SORT(list) sort(ALL((list)));
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define IOS  cin.tie(0),cout.tie(0); ios::sync_with_stdio(false);
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;

const ll mod=1000000007;
// int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head


int main(){
	IOS
	int n, ans = 0;
	string s;
	cin >> n >> s;
	REP(i, s.size()) if(s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C') {
		ans++;
	}

	cout << ans << '\n';
}

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

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

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

// aaaaaaaaaaaaaaaa
void solve() {
  string s, t; cin >> s >> t;
  if (s == t.substr(0, sz(s)))
    cout << "Yes";
  else
    cout << "No";
  cout << '\n';
}

int main() {
  // int _; scanf("%d", &_); while (_--)
  // ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  // int _; cin >> _; while(_--)
  solve();
	return 0;
}


Measured memory_bytes: 3560
#include <iostream>
#include <algorithm>

using namespace std;

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

    long long ans = 0;
    for (int b = K + 1; b <= N; b++) ans += (N + 1)/b*(b - K) + max(0, (N + 1)%b - K);
    if (!K) ans -= N;

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

Measured memory_bytes: 256
n,k = map(int,input().split())
p = list(map(int,input().split()))
wa = sum(p[0:k])
next_wa = wa
for i in range(n-k):
    next_wa = next_wa - p[i] + p[i+k]
    if  next_wa > wa:
        wa = next_wa
print(0.5*(wa+k))

Measured memory_bytes: 25060
#include<iostream>
#define LL long long
LL K;
LL A[50];
int main(){
    std::cin>>K;
    std::cout<<50<<std::endl;
    for(int i=0;i<50;i++){
        A[i]=49+(K/50);
    }
    for(int i=0;i<K%50;i++){
        A[i]+=50;
        A[i]-=K%50-1;
    }
    for(int i=K%50;i<50;i++){
        A[i]-=K%50;
    }
    for(int i=0;i<50;i++){
        std::cout<<A[i];
        if(i<49)std::cout<<" ";
        else std::cout<<std::endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define INF 999999999
#define ll long long
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;


vector<int> v[100000];
vector<bool> u(100000,false);

int main(){
  int x;
  cin >> x;
  if(((x % 10) == ((x / 10) % 10)) || (((x/10) % 10) == ((x / 100) % 10)) ||(((x/100) % 10) == (((x / 1000) % 10)))) cout << "Bad" << endl;
  else cout << "Good" << endl;
  return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  double ans;
  int64_t sum = 0;
  vector<int> num(n, 1);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += 1e10 / a[i];
  }

  ans = 1e10 / sum;

  printf("%.10f", ans);

}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace Tasks
{
    public class C
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var N = int.Parse(Console.ReadLine());
            var a = 1L;
            var b = 1L;
            for (var i = 0; i < N; i++)
            {
                var XY = Console.ReadLine().Trim().Split(' ').Select(long.Parse).ToArray();
                var (X, Y) = (XY[0], XY[1]);
                var max = (long)Math.Max((a - 1) / X + 1, (b - 1) / Y + 1);
                a = max * X;
                b = max * Y;
            }

            Console.WriteLine(a + b);
        }
    }
}


Measured memory_bytes: 28476
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using VS = vector<string>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int i=(a);i<(n);++i)
#define eFOR(i,a,n) for(int i=(a);i<=(n);++i)
#define rFOR(i,a,n) for(int i=(n)-1;i>=(a);--i)
#define erFOR(i,a,n) for(int i=(n);i>=(a);--i)
#define each(i, a) for(auto &i : a)
#define SORT(a) sort(a.begin(),a.end())
#define rSORT(a) sort(a.rbegin(),a.rend())
#define fSORT(a,f) sort(a.begin(),a.end(),f)
#define all(a) a.begin(),a.end()
#define out(y,x) ((y)<0||h<=(y)||(x)<0||w<=(x))
#define tp(a,i) get<i>(a)
#define line cout << "-----------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define elif else if
#define stop system("pause")
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, const T& b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, const 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& a : v)is >> a; return is; }
template<class T>inline istream& operator>>(istream& is, deque<T>& v) { for (auto& a : v)is >> a; 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...)); }
template<class T>inline void print(const T& a) { cout << a << "\n"; }
template<class T, class... Ts>inline void print(const T& a, const Ts&... ts) { cout << a << " "; print(ts...); }
template<class T>inline void print(const vector<T>& v) { for (int i = 0; i < v.size(); ++i)cout << v[i] << (i == v.size() - 1 ? "\n" : " "); }
template<class T>inline void print(const vector<vector<T>>& v) { for (auto& a : v)print(a); }
inline string reversed(const string& s) { string t = s; reverse(all(t)); return t; }

#include<atcoder/scc>;
using namespace atcoder;

int main() {
    init();

    int n, m; cin >> n >> m;
    scc_graph g(n);
    FOR(i, 0, m) {
        int a, b; cin >> a >> b;
        g.add_edge(a, b);
    }

    vector<VI> ans = g.scc();
    print(ans.size());
    for (auto& v : ans) {
        cout << v.size() << " ";
        print(v);
    }

    return 0;
}

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

#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define repm(i, a, b) for (int i = (a); i > (b); i--)

using namespace std;
using ll = long long;


int main(){
  int n, s;
  cin >> n >> s;

  s /= 1000;

  rep (x,0,s/10+1) {
    int sum_wo_x = s - 10 * x;
    rep (y, 0, sum_wo_x/5+1) {
      if (x+y+sum_wo_x-5*y == n) {
        cout << x << " " << y << " " << sum_wo_x-5*y << endl;
        return 0;
      }
    }
  }

  cout << "-1 -1 -1" << endl;
  
  return 0;
}

Measured memory_bytes: 256