akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <math.h>
#define ALL(a)    a.begin(), a.end() 
#define rep(i, K, N)  for(long long int i = K; i < N; i++)
#define ll long long int
using namespace std;

ll cnt = 0;
queue<ll> Q;
vector<bool> seen;
vector<vector<ll>> G;

void bfs(){
 
    if(!Q.empty()){
 
        ll x = Q.front(), L = G[x].size();
 
        Q.pop();
 
        rep(i, 0, L){

            if(seen[G[x][i]])continue;

            cnt++;

            Q.push(G[x][i]);seen[G[x][i]] = 1;

        }
 
        bfs();
 
    }
}

int main(){
ll N, M, Ans = 0;cin >> N >> M;
G.resize(N + 1);seen.resize(N + 1);

rep(i, 0, M){
  
   ll a, b;cin >> a >> b;

    G[a].push_back(b);
    G[b].push_back(a);

}

rep(i, 1, N + 1){

    if(!seen[i]){

        cnt = 1;

        Q.push(i);seen[i] = 1;

        bfs();

    }

    Ans = max(Ans, cnt);
  

}

cout << Ans;

}




Measured memory_bytes: 16936
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
// #define int long long
#define mod (int)(1e9 + 7)
#define pb push_back
#define ll long long int
using namespace std;
typedef pair<int,int> pii;

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

  int res,tmp,h,ima;
  res=tmp=0;
  cin>>ima;
  
  for(int i=1;i<n;i++){
    cin>>h;
    if(ima>=h){
      tmp++;
      ima=h;
    }
    else{
      res=max(res,tmp);
      tmp=0;
    }
    ima=h;
  }
  cout<<max(res,tmp)<<endl;
  return 0;
}



Measured memory_bytes: 256
import sys
from collections import deque
def main():
    MOD=10**9+7
    q=deque()
    H,W=tuple(map(int,sys.stdin.readline().split()))
    m=[]
    for _ in range(H):
        m.append(list(sys.stdin.readline().strip()))
    dp=[[0 for _ in range(W)] for _ in range(H)]
    dp[0][0]=1
    q.append((0,0))
    while len(q)>0:
        h,w=q.popleft()
        if h+1<H and m[h+1][w]=='.':  # down
            if dp[h+1][w]==0:q.append((h+1,w))
            dp[h+1][w]=(dp[h+1][w]+dp[h][w])%MOD
        if w+1<W and m[h][w+1]=='.':  # right
            if dp[h][w+1]==0:q.append((h,w+1))
            dp[h][w+1]=(dp[h][w+1]+dp[h][w])%MOD
    print(dp[H-1][W-1])
if __name__=='__main__':main()

Measured memory_bytes: 129396
#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()
using ll = long long;
using P = pair<int, int>;

int main() {

    string s;
    cin >> s;

    vector<P> p;
    char c = s[0];
    p.emplace_back(0, 0);
    rep(i, s.length()){
        if(c == 'L' && s[i] == 'R'){
            p.emplace_back(1, 0);
        }
        else if(s[i] == 'R'){
            p.back().first++;
        }
        else{
            p.back().second++;
        }
        c = s[i];
    }

    int idx = 0;
    s = s + " ";
    rep(i, s.length()-1){
        if(s[i] == 'R' && s[i+1] == 'L'){
            int r = p[idx].first/2 + p[idx].second/2;
            int l = p[idx].first/2 + p[idx].second/2;
            if(p[idx].first % 2 == 1){
                r += 1;
            }
            if(p[idx].second % 2 == 1){
                l += 1;
            }
            cout << r << " " << l << " ";
            idx++;
            i++;
        }
        else{
            cout << 0 << " ";
        }
    }

    return 0;
}

Measured memory_bytes: 1144
using System;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using static System.Math;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;

public static class P
{
    public static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        var s = Console.ReadLine();
        int curMaxLength = 0;
        var hash = new RollingHash(s);
        for (int i = 0; i < s.Length; i++)
            for (int j = i; j < s.Length; j++)
                while (curMaxLength < j - i && j + curMaxLength < n && hash.Slice(i, curMaxLength + 1) == hash.Slice(j, curMaxLength + 1)) curMaxLength++;
        Console.WriteLine(curMaxLength);
    }
}

class RollingHash
{
    const ulong MASK30 = (1UL << 30) - 1;
    const ulong MASK31 = (1UL << 31) - 1;
    const ulong MOD = (1UL << 61) - 1;
    const ulong POSITIVIZER = MOD * ((1UL << 3) - 1);
    static uint Base;
    static ulong[] powMemo = new ulong[5000 + 1];
    static RollingHash()
    {
        Base = (uint)new Random().Next(129, int.MaxValue);
        powMemo[0] = 1;
        for (int i = 1; i < powMemo.Length; i++)
            powMemo[i] = CalcMod(Mul(powMemo[i - 1], Base));
    }

    ulong[] hash;

    public RollingHash(string s)
    {
        hash = new ulong[s.Length + 1];
        for (int i = 0; i < s.Length; i++)
            hash[i + 1] = CalcMod(Mul(hash[i], Base) + s[i]);
    }

    public ulong Slice(int begin, int length)
    {
        return CalcMod(hash[begin + length] + POSITIVIZER - Mul(hash[begin], powMemo[length]));
    }

    private static ulong Mul(ulong l, ulong r)
    {
        var lu = l >> 31;
        var ld = l & MASK31;
        var ru = r >> 31;
        var rd = r & MASK31;
        var middleBit = ld * ru + lu * rd;
        return ((lu * ru) << 1) +
            ld * rd +
            ((middleBit & MASK30) << 31) +
            (middleBit >> 30);
    }

    private static ulong CalcMod(ulong val)
    {
        val = (val & MOD) + (val >> 61);
        if (val > MOD) val -= MOD;
        return val;
    }
}


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

using namespace std;

bool isprime(int a) {
	for (int i = 2; i * i <= a; i++)
		if (a % i == 0) return false;
	return true;
}

int main() {
	ios::sync_with_stdio(false);
	int x;
	cin>>x;
	while (!isprime(x)) x++;
	cout<<x;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <numeric>
#include <bitset>
#include <vector>
#include <queue>

using namespace std;

typedef long long ll;
#define FOR(i,a,b)   for(ll i = (a); i < (b); i++ )
#define REP(i, n)    FOR(i,0,n)
typedef pair< ll, ll >   cp2;
typedef pair< ll, cp2 >   cp3;
#define fi first
#define se second
#define sec  se.fi
#define thr  se.se
const ll mod = 1000000007;
//              123456789

 
///////////////////////////////////////////////
//
//
///////////////////////////////////////////////

////////////////////////////////////////////////
////////////////////////////////////////////////

string O;
string E;

int main(){
	
	cin>>O>>E;
	
	REP( i, O.size()+E.size() ){
		if( i % 2 ){	cout<<E[i/2];}
		else{		cout<<O[i/2];}
	}
	
	puts("");
	
	return 0;

}

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

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

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

#define MAX 100005
#define INF 1001001001

int main(int, char**)
{
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  sort(a.begin(), a.end());

  int q;
  cin >> q;
  vector<int> ans;
  rep(i,q) {
    int k; cin >> k;
    if (binary_search(a.begin(), a.end(), k)) ans.push_back(1);
    else ans.push_back(0);
  }

  for(auto a : ans) cout << a << endl;

  return 0;
}



Measured memory_bytes: 4328
const val INF = Long.MAX_VALUE / 4

data class Person(val h: Long, val p: Long)

fun main(args: Array<String>) {
  val n = readLine()!!.toInt()
  val persons = Array(n, {
    val (h, p) = readLine()!!.split(" ").map(String::toLong)
    Person(h, p)
  })
  persons.sortWith(
      java.util.Comparator { p1, p2 -> java.lang.Long.compare(p1.h + p1.p, p2.h + p2.p) })
  val dp = LongArray(n + 1, { if (it == 0) 0 else INF })
  for (person in persons) {
    for (k in n - 1 downTo 0) {
      if (dp[k] <= person.h) {
        dp[k + 1] = Math.min(dp[k + 1], dp[k] + person.p)
      }
    }
  }
  // println(dp.toList())
  println(dp.withIndex().filter { it.value < INF }.map { it.index }.max()!!)
}


Measured memory_bytes: 44376
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <vector>
#include <array>
#include <stack>
#include <list>
#include <queue>
#include <deque>
#include <climits>
#include <utility>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <complex>
#include <numeric>

#include <time.h>
#include <float.h>

#define loop(i, start, end) for(int i = (start); i <= (end); i++)
#define loopRev(i, start, end) for(int i = (start); i >= (end); i--)
#define FLASH ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define testCases(t) cin >> t; while(t--)
#define PN(n) cout << (n)
#define PN1(n) cout << (n) << " "
#define PN2(a, b) cout << (a) << " " << (b) << " "
#define PN3(a, b, c) cout << (a) << " " << (b) << " " << (c) << " "
#define PNN1(n) cout << (n) << endl
#define PNN2(a, b) cout << (a) << " " << (b) << endl
#define PNN3(a, b, c) cout << (a) << " " << (b) << " " << (c) << endl
#define PrintObject(ar) for(auto var: ar) cout << var << " "; cout << endl
#define PrintMap(map) for(auto var: map) PNN2(var.first, var.second)
#define IN1(n) cin >> n
#define IN2(a, b) cin >> a >> b
#define IN3(a, b, c) cin >> a >> b >> c
#define ALL(s) s.begin(), s.end()
#define ENTER PNN1("")
#define llPair std::pair<lli, lli>
#define iiPair std::pair<int, int>
// #define ONLINE_JUDGE

typedef long long int lli;
typedef long int li;
typedef unsigned long long int ulli;
typedef long double ld;

using namespace std;

template <typename T>
T ii() {
	T a;
	IN1(a);
	return a;
}

int main(void){
	FLASH
	#ifndef ONLINE_JUDGE
		freopen("input-stream.txt", "r", stdin);
		freopen("output-stream.txt", "w", stdout);
	#endif

	lli a, b;
	IN2(a, b);
	PNN1(a * b);

	return 0;
}


Measured memory_bytes: 3596
n = gets.to_i
h = gets.split("\s").map(&:to_i)

result = 0
record = 0

n.times do |i|
  if(i == n - 1)
    if(record > result)
      result = record
    end
    puts result
    break
  end

  if(h[i] < h[i+1])
    if(record > result)
      result = record
    end
    record = 0
    next
  end

  record += 1
end


Measured memory_bytes: 8580
#include <bits/stdc++.h>
using namespace std;
const long long MOD=1e9+7;
int main(){
  string s;
  int ans=0;
  cin>>s;
  for(int i=1;i<s.size();++i){
    if(s[i]!=s[i-1])ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>

int main()
{
    std::string S;
    std::cin >> S;
    
    int a[26];
    int i = 0;
    for ( i = 0; i < 26; i++ ) {
        a[i] = 0;
    }
    
    for ( i = 0; i < S.length(); i++ ) {
        a[ static_cast<int>( S[ i ] ) - static_cast<int>( 'a' ) ]++;
    }

    for ( i = 0; i < 26; i++ ) {
        if ( a[i] > 1 ) {
            std::cout << "no" << std::endl;
            return 0;
         }
    }
    std::cout << "yes" << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
//累乗(power)a^n(mod10^9+7)
long long power(long long a,long long n){
  long long count=a,sum=1;
  while(n>0){
    if(n%2==1)
      sum*=count;
    count*=count;
    count%=1000000007;
    sum%=1000000007;
    n/=2;
  }
  return sum;
}

int main(){
  int n,i;
  scanf("%d",&n);
  int a[n],count[n];
  for(i=0;i<n;i++)
    count[i]=0;
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
    count[a[i]]++;
  }
  if(n%2==0){
    for(i=1;i<n;i+=2)
      if(count[i]!=2){
        puts("0");
        return 0;
      }
    printf("%lld\n",power((long long)2,(long long)n/2));
  }
  else{
    if(count[0]!=1){
      puts("0");
      return 0;
    }
    for(i=2;i<n;i+=2)
      if(count[i]!=2){
        puts("0");
        return 0;
      }
    printf("%lld\n",power((long long)2,(long long)n/2));
  }
  return 0;
}

Measured memory_bytes: 2488
MAX = 1000001;


factor = [0] * (MAX + 1)

def generatePrimeFactors():
    factor[1] = 1


    for i in range(2, MAX):
        factor[i] = i;


    for i in range(4, MAX, 2):
        factor[i] = 2;


    i = 3
    while (i * i < MAX):

        if (factor[i] == i):

            j = i * i
            while (j < MAX):

                if (factor[j] == j):
                    factor[j] = i
                j += i
        i += 1

def calculateNoOFactors(n):
    if (n == 1):
        return 1;
    ans = 1;

    # stores the smallest
    # prime number that
    # divides n
    dup = factor[n];

    # stores the count of
    # number of times a
    # prime number divides n.
    c = 1;

    # reduces to the next
    # number after prime
    # factorization of n
    j = int(n / factor[n]);

    # false when prime
    # factorization is done
    while (j > 1):
        # if the same prime
        # number is dividing
        # n, then we increase
        # the count
        if (factor[j] == dup):
            c += 1;

        # if its a new prime factor
        # that is factorizing n,
        # then we again set c=1 and
        # change dup to the new prime
        # factor, and apply the formula
        # explained above.
        else:
            dup = factor[j];
            ans = ans * (c + 1);
            c = 1;

        # prime factorizes
        # a number
        j = int(j / factor[j]);

    # for the last
    # prime factor
    ans = ans * (c + 1);

    return ans;


# Driver Code
n=int(input())
generatePrimeFactors()
a=0
for i in range(1,n):
        a+=calculateNoOFactors(n-i)
print(a)

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

#define forsn(i, s, n) for(tint i=s;i<tint(n);i++)
#define forn(i, n) forsn(i, 0, n)
#define all(v) v.begin(), v.end()


using namespace std;

typedef long long tint;

int main(){
	int n; cin >> n;
	vector<int> a (n);
	forn(i, n){
		cin >> a[i];
	}
	int glo = 0, best = 0;
	for(int i=n-1;i>=1;i--){
		if(a[i] <= a[i-1]) best++;
		else{glo = max(glo, best); best = 0;}
		
	}
	glo = max(glo, best);
	cout << glo << endl;
}


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

using namespace std;

#define sim template <class c
#define ris return *this
#define dor > debug &operator<<
#define eni(x)                                                                        \
	sim > typename enable_if<sizeof dud<c>(0) x 1, debug &>::type operator<<(c i) \
	{
sim > struct rge
{
	c b, e;
};
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c *x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug
{
#ifdef LOCAL
	~debug()
	{
		cerr << endl;
	}
	eni(!=) cerr << boolalpha << i;
	ris;
} eni(==) ris << range(begin(i), end(i));
}
sim, class b dor(pair<b, c> d)
{
	ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d)
{
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
	sim dor(const c &)
	{
		ris;
	}
#endif
}
;
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define forn(i, n) for (ll i = 0; i < int(n); i++)
#define rfor(n, i) for (ll i = (n - 1); i >= 0; --i)
#define all(V) V.begin(), V.end()
#define rall(V) V.rbegin(), V.rend()
#define len(V) (int)V.size()
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define endl '\n'
#define M_PI 3.14159265358979323846
#define EPS 1e-7

void solve()
{
	int n; cin >> n;
	set<pair<string, pair<int, int>>> a;
	forn(i, n)
	{
		string s; cin >> s;
		int x; cin >> x;
		a.insert({s, {x, i + 1}});
	}
	map<string, vector<pair<int, int>>> v;
	for (auto x: a)
	{
		v[x.first].push_back(x.second);
	}
	for (auto x: v)
	{
		sort(rall(x.second));
		for (auto o : x.second)
		{
			cout << o.second << endl;
		}
	}
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	solve();
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, n) for (int i = (n); i >= 0; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1 << 30;
 
int main() {
  char b;
  cin>>b;
  char ans;
    if(b=='A') ans='T';
    else if(b=='T') ans='A';
    else if(b=='G') ans='C';
    else ans='G';
  
  cout <<ans <<endl;
  return 0;
}

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

#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define all(c) begin(c),end(c)

using ll=long long;
using Tile=array<int,4>;
using Faces=array<Tile,4>;

Tile normalize(Tile a)
{
	Tile res=a;
	rep(i,3){
		rotate(all(a)-1,end(a));
		res=min(res,a);
	}
	return res;
}

ll npr(int n,int p)
{
	ll res=1;
	rep(i,p) res*=n-i;
	return res;
}

ll calc(const vector<Tile>& tiles,map<Tile,ll>& freq,int ti,int bi)
{
	Faces faces={
		normalize(Tile{tiles[ti][1],tiles[ti][0],tiles[bi][1],tiles[bi][0]}),
		normalize(Tile{tiles[ti][2],tiles[ti][1],tiles[bi][0],tiles[bi][3]}),
		normalize(Tile{tiles[ti][3],tiles[ti][2],tiles[bi][3],tiles[bi][2]}),
		normalize(Tile{tiles[ti][0],tiles[ti][3],tiles[bi][2],tiles[bi][1]}),
	};
	map<Tile,int> face_count;
	for(auto f:faces) face_count[f]++;
	ll res=1;
	for(auto p:face_count){
		Tile face=p.first;
		int n=freq[face]-(face==tiles[ti])-(face==normalize(tiles[bi]));
		res*=npr(n,p.second);
	}
	for(Tile f:faces)
		if(f[0]==f[2]&&f[1]==f[3]){
			res*=2;
			if(f[0]==f[1])
				res*=2;
		}
	return res;
}

int main()
{
	for(int n;cin>>n&&n;){
		vector<Tile> tiles;
		rep(i,n){
			int a,b,c,d; cin>>a>>b>>c>>d;
			tiles.emplace_back(normalize({a,b,c,d}));
		}

		map<Tile,ll> freq;
		rep(i,n) freq[tiles[i]]++;

		ll res=0;
		rep(i,n) repi(j,i+1,n) rep(k,4){
			res+=calc(tiles,freq,i,j);
			rotate(all(tiles[j])-1,end(tiles[j]));
		}
		cout<<res/3<<endl;
	}
}


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

int N;
int A[21];

int main() {
    cin >> N;
    for (int i = 0; i < N; ++i) cin >> A[i];
    int max=0;
    int res=0;
    
    
    for (int i = 0; i < N; ++i) {
            if (A[i] >=max){
            max=A[i];
            res++;
            }
        }
    
    cout << res << endl;
    
    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for (int i = (a); i <= (b); ++ i)
#define rrp(i,a,b) for (int i = (a); i >= (b); -- i)
#define gc() getchar()
#define fir first
#define sec second
typedef pair<int,int> pii;
typedef double db;
typedef long long ll;
template <typename tp>
inline void read(tp& x) {
  x = 0; char tmp; bool key = 0;
  for (tmp = gc(); !isdigit(tmp); tmp = gc())
    key = (tmp == '-');
  for (; isdigit(tmp); tmp = gc()) 
    x = (x << 3) + (x << 1) + (tmp ^ '0');
  if (key) x = -x;
}
template <typename tp>
inline void ckmn(tp& x,tp y) {
  x = x < y ? x : y;
}
template <typename tp>
inline void ckmx(tp& x,tp y) {
  x = x < y ? y : x;
}

const int N = 3010;
int n;
char str[N << 1];
struct data {
  int lp,rp,tp;
  bool operator < (const data& a) const {
    return lp < a.lp;
  }
} dat[N];
string dp[N];
int cnt, vis[N << 1];
string doit(int l,int r) {
  string ret = "";
  if (dat[l].tp == 0) {
    int cur = 0;
    rep (i, l, r) {
      if (dat[i].lp > cur) {
	cur = dat[i].rp;
	ret += "ab";
      }
    }
  } else {
    rep (i, l, r) {
      rep (j, i, r) vis[dat[j].lp] = vis[dat[j].rp] = 1;
      string tmp = "";
      rep (j, 1, 2*n) if (vis[j]) tmp += str[j];
      ret = max(ret, tmp);
      rep (j, i, r) vis[dat[j].lp] = vis[dat[j].rp] = 0;      
    }
  }
  return ret;
}
int main() {
  read(n);
  scanf("%s", str + 1);
  for (int i = 1, j = 1; i <= 2 * n; ++ i)
    if (str[i] == 'a') dat[j++].lp = i;
  for (int i = 1, j = 1; i <= 2 * n; ++ i)
    if (str[i] == 'b') dat[j++].rp = i;
  rep (i, 1, n) if (dat[i].lp > dat[i].rp) {
    dat[i].tp = 1;
    swap(dat[i].lp, dat[i].rp);
  }
  sort(dat + 1, dat + n + 1);
  dp[0] = "";
  for (int i = 1, j = 1; i <= n; ++ i) {
    j = i;
    while (j < n && dat[j+1].lp < dat[j].rp) ++ j;
    string tmp = doit(i, j);
    ++ cnt;
    rep (k, 0, cnt-1) dp[cnt] = max(dp[k] + tmp, dp[cnt]);
    i = j;
  }
  string ans = "";
  rep (i, 1, cnt) ans = max(ans, dp[i]);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 14080
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder.ABC
{
    class QuestionA
    {
        public static void Main(string[] args)
        {
			var scanner = new Scanner();

			var n = scanner.Int();

			Console.WriteLine(n == 0 ? "1" : "0");
        }

		public class Scanner
		{
			private readonly char[] delimiter_ = new char[] { ' ' };
			private readonly string filePath_;
			private readonly Func<string> reader_;
			private string[] buf_;
			private int index_;

			public Scanner(string file = "")
			{
				if (string.IsNullOrWhiteSpace(file)) {
					reader_ = Console.ReadLine;
				} else {
					filePath_ = file;
					var fs = new StreamReader(file);
					reader_ = fs.ReadLine;
				}
				buf_ = new string[0];
				index_ = 0;
			}

			public string NextLine() => reader_();
			public string Next()
			{
				if (index_ < buf_.Length) {
					return buf_[index_++];
				}

				string st = reader_();
				while (st == "") {
					st = reader_();
				}

				buf_ = st.Split(delimiter_, StringSplitOptions.RemoveEmptyEntries);
				if (buf_.Length == 0) {
					return Next();
				}

				index_ = 0;
				return buf_[index_++];
			}

			public int Int() => int.Parse(Next());
			public long Long() => long.Parse(Next());
			public double Double() => double.Parse(Next());

			public int[] ArrayInt(int N, int add = 0)
			{
				int[] Array = new int[N];
				for (int i = 0; i < N; i++) {
					Array[i] = Int() + add;
				}
				return Array;
			}

			public long[] ArrayLong(int N, long add = 0)
			{
				long[] Array = new long[N];
				for (int i = 0; i < N; i++) {
					Array[i] = Long() + add;
				}
				return Array;
			}

			public double[] ArrayDouble(int N, double add = 0)
			{
				double[] Array = new double[N];
				for (int i = 0; i < N; i++) {
					Array[i] = Double() + add;
				}
				return Array;
			}

			public (int, int) Int2(int add = 0)
			{
				var array = ArrayInt(2, add);
				return (array[0], array[1]);
			}

			public (int, int, int) Int3(int add = 0)
			{
				var array = ArrayInt(3, add);
				return (array[0], array[1], array[2]);
			}

			public (long, long) Long2(int add = 0)
			{
				var array = ArrayLong(2, add);
				return (array[0], array[1]);
			}

			public (long, long, long) Long3(int add = 0)
			{
				var array = ArrayLong(3, add);
				return (array[0], array[1], array[2]);
			}

			public (double, double) Double2(int add = 0)
			{
				var array = ArrayDouble(2, add);
				return (array[0], array[1]);
			}

			public (double, double, double) Double3(int add = 0)
			{
				var array = ArrayDouble(3, add);
				return (array[0], array[1], array[2]);
			}

			public void Save(string text)
			{
				if (string.IsNullOrWhiteSpace(filePath_)) {
					return;
				}

				File.WriteAllText(filePath_ + "_output.txt", text);
			}
		}
	}
}



Measured memory_bytes: 27460
def floor_sum(n,m,a,b):
    ans=0
    if a>=m:
        ans+=(n-1)*n*(a//m)//2
        a%=m
    if b>=m:
        ans+=n*(b//m)
        b%=m
    y_max=(a*n+b)//m
    x_max=(y_max*m-b)
    if y_max==0:
        return ans
    ans+=(n-(x_max+a-1)//a)*y_max
    ans+=floor_sum(y_max,a,m,(a-x_max%a)%a)
    return ans

T=int(input())
for i in range(T):
    N,M,A,B=map(int,input().split())
    print(floor_sum(N,M,A,B))


Measured memory_bytes: 9228
#include <bits/stdc++.h>
#define rep(i,a,n)  for (int i=(int)(a); i<=(int)(n); ++i)
#define rrep(i,a,n) for (int i=(int)(a); i>=(int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) rep(i, x.size()) cerr << x[i] << (i == x.size() - 1 ? "\n" : " ")
#define all(x) x.begin(),x.end()
#define int long long
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = ((1LL << 30) + (1LL << 29));
const int MOD = 1000000007;

//=============================
int N,M,K;
string S,T;
vector<int> A;
vector<int> B;
//=============================
void input()
{
    cin>>N;
    A.resize(N);
    rep(i,0,N-1){
        cin>>A[i];
    }
}
//=============================
void func(){}
//=============================
void solve()
{
    long double g = 0;
    for(auto x : A){
        g += 1.0 / x;
    }

    cout<<1.0 / g << endl;

}
//=============================
signed main()
{
    input();
    solve();
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <stack>
#include <climits>
#include <map>
#include <set>

using namespace std;

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

const ll mod = 1000000007;
const int inf = 1e9;
const long long INF = 1LL << 60;

int main()
{
    int n;
    cin >> n;
    int d[n];
    for(int i = 0; i < n; i++) cin >> d[i];
    sort(d,d+n);
    int a,b;
    a = d[n/2-1];
    b = d[n/2];
    cout << b - a << endl;
}

Measured memory_bytes: 640
#define _USE_NATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <random>
#include <tuple>

using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
#define EPS 1e-9
const int INF = 1050000000;
const ll MOD = 1e9 + 7; 
const int MINF = -1050000000;


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() {
	
	int n, a;
	cin >> n >> a;
	vector<int> x(n);

	rep(i, n) {
		cin >> x[i];
	}

	ll dp[55][55][2600];
	dp[0][0][0] = 1;
	rep(i, n) {
		rep(j, n) {
			rep(k, 2500) {
				if (dp[i][j][k]) {
					dp[i + 1][j][k] += dp[i][j][k];
					dp[i + 1][j + 1][k + x[i]] += dp[i][j][k];
				}
			}
		}
	}

	ll ans = 0;
	REP(i, 1, n + 1) ans += dp[n][i][i*a];
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 57600
import java.util.*;
public class Main {
	public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int x;
     if(( a + b ) % 2 == 0){
       x = (a+b)/2;
       System.out.println(x);
     }else{
       x = (a+b)/2 + 1;
       System.out.println(x);
     } 
    }
}

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

using namespace std;

using int64 = long long;

int main()
{
  int H, W, C[10][10];
  cin >> H >> W;
  for(int i = 0; i < 10; i++) {
    for(int j = 0; j < 10; j++) {
      cin >> C[i][j];
    }
  }
  for(int k = 0; k < 10; k++) {
    for(int i = 0; i < 10; i++) {
      for(int j = 0; j < 10; j++) {
        C[i][j] = min(C[i][j], C[i][k] + C[k][j]);
      }
    }
  }

  int ret = 0;
  for(int i = 0; i < H; i++) {
    for(int j = 0; j < W; j++) {
      int x;
      cin >> x;
      if(~x) ret += C[x][1];
    }
  }

  cout << ret << endl;
  
}



Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<fstream>

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }

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

    cout<<3*r*r<<endl;

    return 0;
}






Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>

using namespace std;

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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a, b, c;
	cin >> a >> b >> c;
	if (a <= c && c <= b) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
}

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

#define ll long long

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n, r;
    cin >> n >> r;

    if(n>=10) cout << r << "\n";
    else {
        cout << r+100*(10-n) << "\n";
    }

    return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

ans = 0
for i in range(n):
    ans += b[a[i]-1]
    if i < n-1 and a[i] + 1 == a[i+1]:
        ans += c[a[i]-1]
print(ans)

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

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

    int cnt[26] = {0};

    string S;
    cin >> S;
    rep(i, S.size()) {
        ++cnt[int(S[i] - 'a')];
    }

    rep(i, N - 1) {
        cin >> S;
        int tmp[26] = {0};
        rep(j, S.size()) {
            ++tmp[int(S[j] - 'a')];
        }

        rep(j, 26)
            cnt[j] = min(cnt[j], tmp[j]);
    }

    rep(i, 26) {
        rep(j, cnt[i]) cout << char('a' + i);
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORR(i, a, b) for(int i = (a); i >= (b); i--)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOREACH(x, a) for(auto x : a)

/* exchange */
#define CHMIN(a, b) (a) = min((ll)(a), (ll)(b))
#define CHMAX(a, b) (a) = max((ll)(a), (ll)(b))

/* function */
#define IN(x) cin >> x
#define DEBUG(x) cerr << (x) << " "
#define LN() cerr << "\n"
#define PRINT(x) cout << (x) << endl
#define BR cout << endl

/* const */
const int ARRAY = 100005;
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;

ll N = 0;
string s;
ll t;
ll ret = 0;

void input() {
  IN(N);
  IN(s);
}

void solve() {
  REP(i, s.size()) {
    int c = s[i] - 'A';
    c += N;
    c %= 26;
    s[i] = c + 'A';
  }
  PRINT(s);
}

int main(void){
  input();
  solve();
}


Measured memory_bytes: 256
N,M,C=[int(s) for s in input().split()]
B=[int(s) for s in input().split()]
A=[[int(s) for s in input().split()] for i in range(N)]
n=0
for i in range(N):
        x = 0
        for j in range(M):
                x = x + A[i][j]*B[j]
        if x+C>0:
                n = n+1
print(n)

Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;


namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var cin = new Scanner();
            var S = cin.nextLong();

            var v = 1000000000;

            var x = (v - S % v) % v;
            var y = (S + x) / v;

            Console.WriteLine("0 0 1000000000 1 " + x + " " + y);
        }
    }

    class Point
    {
        public int x { get; set; }
        public int y { get; set; }
    }


    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }
}

Measured memory_bytes: 13268
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;

ll v;

vector<vector<ll>> road;
vector<vector<ll>> train;

vector<ll> Rg;
vector<ll> Tg;

void Rdfs(ll where,ll group){
    Rg[where]=group;
    for(int i=0;i<road[where].size();i++){
        ll to=road[where][i];
        if(Rg[to]==-1){
            Rdfs(to,group);
        }
    }
}

void R(){
    Rg.resize(v,-1);
    ll count=0;
    for(int i=0;i<Rg.size();i++){
        if(Rg[i]==-1){
            Rdfs(i,count);
            count++;
        }
    }
}


void Tdfs(ll where,ll group){
    Tg[where]=group;
    for(int i=0;i<train[where].size();i++){
        ll to=train[where][i];
        if(Tg[to]==-1){
            Tdfs(to,group);
        }
    }
}

void T(){
    Tg.resize(v,-1);
    ll count=0;
    for(int i=0;i<Tg.size();i++){
        if(Tg[i]==-1){
            Tdfs(i,count);
            count++;
        }
    }
}

void solve(){
    ll k,l;
    cin>>v>>k>>l;
    road.resize(v);
    train.resize(v);
    for(int i=0;i<k;i++){
        ll u,v;
        cin>>u>>v;
        u--; v--;
        road[u].push_back(v);
        road[v].push_back(u);
    }
    for(int i=0;i<l;i++){
        ll u,v;
        cin>>u>>v;
        u--; v--;
        train[u].push_back(v);
        train[v].push_back(u);
    }
    map<pll,ll> M;
    R(); T();
    for(int i=0;i<v;i++){
        M[{Tg[i],Rg[i]}]++;
    }
    for(int i=0;i<v;i++){
        pll w={Tg[i],Rg[i]};
        cout<<M[w];
        if(i!=v-1){cout<<" ";}
    }
    cout<<endl;
}




int main(){
    solve();
    
    
    
    return 0;
}



Measured memory_bytes: 30336
#include<iostream>
	#include<vector>
	#include<algorithm>
	#include<string>
	#include<cmath>
	#include<map>
	#include<cstdio>
	#include<stack>
	#include<queue>
	#include<fstream>
	#include<cstdio>
	#include<deque>
	#include<iomanip>
	#include <numeric>
	//#include<bits/stdc++.h>

	using namespace std;
	#define ok1 printf("ok1\n");
	#define ok2 printf("ok2\n");
	#define M 1000000000000000000LL
	#define rep(i,n) for(int i=0;i<n;i++)
	#define REP(i,s,n) for(int i=(s);i<(n);i++)
	#define repr(i,n) for(int i=n-1;i>=0;i--)
	#define REPR(i,s,n) for(int i=(s);i>=(n);(i)--)
	#define all(a) (a).begin(),(a).end()
	#define reall(a) (a).rbegin(),(a).rend()
	#define pb push_back
	#define pf push_front
	#define MIN(a,b) a=min((a),(b))
	#define MAX(a,b) a=max((a),(b))
	#define SIZE(v) (int)v.size()
	const double pi = acos(-1.0);

	typedef vector<int> vi;
	typedef vector<string> vs;
	typedef long long ll;
	typedef vector<ll> vll;
	typedef vector<vi> vvi;
	typedef vector<vll> vvll;
	typedef deque<ll> dll;
	typedef pair<ll, ll> P;
	const ll mod = 1e9 + 7;
	ll dx[4] = {1,0,-1,0};
	ll dy[4] = {0,1,0,-1};


	int main() {
		cin.tie(0);
		ios::sync_with_stdio(false);
		
		ll n, k;
		cin >> n >> k;
		ll ans =  k * pow(k - 1, n - 1);;
		cout << ans << endl;
		return 0;
	}	
	

Measured memory_bytes: 892
#include <iostream>
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <iomanip>
#include <string>
#include <queue>
#include <numeric>
#include <functional>
#include <array>
#include <map>
#include <set>

#define INF /*1000000007*/ 1000000000000000003
#define MOD 1000000007

#define ll long long

//printf("%.10f", );
//cout << fixed << setprecision(10) << heikin << endl;

using namespace std;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using edge = struct { int to; long long dist; };
const double PI = 3.141592653589793;

vector<edge>tree[100010];
vector<P> connect[100005];
long long cost[100005];

bool compare_by_second(pair<int, int> a, pair<int, int> b) {
	if (a.second != b.second) {
		return a.second < b.second;
	}
	else {
		return a.first < b.first;
	}
}

int main() {

	double a,b,x;
	cin >> a >> b >> x;

	double height = x / (a * a);
	double ans = 0;
	if (height <= (b / 2)) {
		double sqare = a * height;
		double triangleA = (sqare * 2) / b;
		double radian = atan2(b, triangleA);
		ans = radian * 180.0 / PI;
	}
	else {
		double sqare = a * height;
		double noSqare = a * b - sqare;
		double triangleB = (noSqare * 2) / a;
		double radian = atan2(triangleB, a);
		ans = radian * 180.0 / PI;
	}

	cout << fixed << setprecision(10) << ans << endl;
}

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

#define For(i,n) for(int i = 0; i < n; ++i)
#define Forr(i,n) for(int i = 1; i <= n; ++i)
#define Fori(i,a,b) for(int i = a;i <= b; ++i)
#define Forir(i,a,b) for(int i = a;i >= b; --i)
#define pb push_back
#define pf pop_front
#define SZ(x) (int)x.size()
#define mp make_pair
#define fi first
#define se second
#define np(b,e) next_permutation(b, e)
#define rev(b,e) reverse(b, e)
#define is(b, e) is_sorted(b, e)
#define DBG(v) cerr<< #v<<" = "<< (v) <<endl
#define DBG2(v, e) cerr<< #v<<", "<< #e<<" = "<<(v)<<", "<<(e)<<endl

using namespace std;


int main () {
  int a,b;
  cin>>a>>b;
  cout<<a*b<<endl;
  return 0;
}
  

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define endl "\n"
#define speed() ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sz(x) (int)(x).size()
#define _USE_MATH_DEFINES
using namespace std;
typedef long long int lli;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

int main() {
    speed();
    int N; cin >> N;
    int A[N], temp[N];
    rep(i, 0, N) {
        cin >> A[i];
        temp[i] = A[i];
    }
    sort(A, A+N);
    rep(i, 0, N) {
        (temp[i] == A[N-1]) ? cout << A[N-2] << endl : cout << A[N-1] << endl;
    }
    return 0;
}

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

// loop macro
#define PER(ITER,TIMES) for(auto ITER = 0; ITER < TIMES; ++ITER)

// helper macro
#define FUCK(IT) #IT": " << IT << ": "
#define ALL(ITER) ITER.begin(), ITER.end()

void solve(void);

/* --- MAIN PART ----------------------------------------------------------- */

#define SOLVE_F
#ifdef SOLVE_E

void solve(void) {
    int n;
    cin >> n;
    vector<int> a(n);
    PER(i, n) {
        cin >> a[i];
    }
    sort(ALL(a), [](const int& a, const int& b){return a > b;});
    int result = a[0];
    PER(i, (a.size() - 2) / 2) {
        result += 2 * a[i + 1];
    }
    if ((a.size() - 2) % 2) {
        result += a[(a.size() - 2 / 2) + 1];
    }
    cout << result;
    return;
}

#endif

#ifdef SOLVE_F

void solve(void) {
    int n, m, sum;
    cin >> n >> m >> sum;
    PER(i, m) {
        cout << sum << " ";
    }
    PER(i, n - m) {
        cout << (sum == (int)1e9 ? 1 : sum + 1) << " ";
    }
    return;
}

#endif

#ifdef SOLVE_B

long long times (const vector<long long>& sorted, long long len) {
    long long result = 1;
    PER (i, len) {
        result *= sorted[i];
    }
    return result;
}

void solve(void){
    long long n, k;
    cin >> n >> k;
    vector<long long> a(n);
    PER(i, n) {
        cin >> a[i];
    }

    vector<long long> up, down;
    PER(i, n) {
        if (a[i] > 0) {
            up.push_back(a[i]);
        } else if (a[i] < 0) {
            down.push_back(a[i] = -a[i]);
        }
    }

    long long result = 0;
    if ((k % 2 == 1 && up.size() == 0) || (down.size() == 1 && up.size() == k - 1)) {
        if (up.size() + down.size() != a.size()) {
            result = 0;
        } else {
            sort(ALL(a));
            for (int i = 0; i < k; ++i) {
                result += -a[i];
            }
            while (result < 0) {
                result += (long long) 1e9 + 7;
            }
        }
    } else {
        sort(ALL(up), [](const long long& a, const long long& b){return a > b;});
        sort(ALL(down), [](const long long& a, const long long& b){return a > b;});

        for(long long i = 0; i <= down.size(); i += 2) {
            long long _ = times(up, k - i) * times(down, i);
            result = (result > _ ? result : _);
            result %= (long long)1e9 + 7;
        }
    }

    cout << result << endl;

    return;
}

#endif // for solve

/* ------------------------------------------------------------------------- */

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


Measured memory_bytes: 3616
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#define maxn 200005
#define fi first
#define se second
#define mod 1000000007
using namespace std;
int a[maxn], b[maxn], arr[maxn], f[maxn];
pair <int, int> node[maxn];
map <int, int> mp;
int C[maxn], c;
bool cmp(pair <int, int> x, pair <int, int> y){
	return x.fi < y.fi || x.fi == y.fi && x.se > y.se;
}
void add(int x, int y){
	for (; x <= c; x += x & -x)
		C[x] = (C[x] + y) % mod;
}
int sum(int x){
	int ans = 0;
	for (; x; x -= x & -x)
		ans = (ans + C[x]) % mod;
	return ans;
}
int main(){
	int n, m;
	cin >> n >> m;
	for (int i = 1; i <= n; ++ i)
		scanf("%d", &a[i]);
	for (int i = 1; i <= m; ++ i)
		scanf("%d", &b[i]);
	int l = 1, r = n;
	while (a[l] < b[1] && l <= n)
		++ l;
	while (a[r] > b[m] && r)
		-- r;
	for (int i = l; i <= r; ++ i)
		a[i - l + 1] = a[i];
	n = r - l + 1;
	for (int i = 1, j = 1; i <= n; ++ i){
		while (b[j + 1] < a[i] && j + 1 <= m)
			++ j;
		node[i].fi = a[i] - b[j];
	}
	for (int i = n, j = m; i; -- i){
		while (b[j - 1] > a[i] && j - 1)
			-- j;
		node[i].se = b[j] - a[i];
		arr[i] = b[j] - a[i];
	}
    sort(arr + 1, arr + 1 + n);
    for (int i = 1; i <= n; ++ i)
		if (arr[i] != arr[i - 1])
			mp[arr[i]] = ++ c;
	for (int i = 1; i <= n; ++ i)
		node[i].se = mp[node[i].se];
	sort(node + 1, node + 1 + n, cmp);
	int _n = unique(node + 1, node + 1 + n) - node - 1;
	//for (int i = 1; i <= n; ++ i)
		//cout << node[i].fi << " "<< node[i].se << endl;
	int ans = 1;
	for (int i = 1; i <= _n; ++ i){
		ans = (ans + (f[i] = (sum(node[i].se - 1) + 1) % mod)) % mod;
		add(node[i].se, f[i]);
	}
	cout << ans << endl;
}


Measured memory_bytes: 8832
S = input()
Sl = len(S)
Scenter = int((len(S) - 1) / 2)
for i in range(Scenter):
    if not S[i] == S[len(S) - 1 - i]:
        print("No")
        quit()
for i in range(Scenter // 2):
    if not S[i] == S[Scenter - 1 - i]:
        print("No")
        quit()
for i in range(Scenter // 2):
    if not S[i + 1 + Scenter] == S[len(S) - 1 - i]:
        print("No")
        quit()
print("Yes")

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

int main(){
    while (true){
        int H,W;
        cin >> H >> W;
        if(H==0 && W==0){
            break;
        }
        for(int i=0; i<H; i++){
            for(int j=0; j<W; j++){
                if(i==0 || i==H-1){
                    cout << "#";
                }
                else{
                    if(j==0 || j==W-1){
                        cout << "#";
                    }
                    else{
                        cout << ".";
                    }
                }
            }
            cout << endl;
        }
        cout << endl;
    }
}



Measured memory_bytes: 3100
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define pi 3.14
using namespace std;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
typedef pair<long long,int> pli;
typedef pair<int,long long> pil;
const int INF=1000000007;
const int MOD=11092019;
const int nmax=201234;


int main()
{
    int n,k,cnt;
    scanf("%d%d",&n,&k);
    if(n==0){
        return puts("1");
    }
    cnt=0;
    while(n){
        ++cnt;
        n/=k;
    }
    printf("%d\n",cnt);
    return 0;
}


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

using namespace std;

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> v(n);

    for(int i = 0; i < m; ++i){
       int a, b;
       cin >> a >> b;
       a--;
       b--;
       v[a]++;
       v[b]++;
    }
    for(int i = 0; i < n; ++i){
        cout << v[i] << endl;
    }
	return 0;

}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int h, w;
	int i, j;

	while(1){
	scanf("%d %d", &h, &w);

	if(h == 0 && w == 0){
		break;
	}

	for(i = 0; i < h; i++){
		for(j = 0; j < w; j++){
			if(i % 2 == 0){
				if(j % 2 == 0){
					printf("#");
				}else{
					printf(".");
				}
			}else{
				if(j % 2 == 0){
					printf(".");
				}else{
					printf("#");
				}
			}
		}
		printf("\n");
	}
	
	printf("\n");
	}

	
	return 0;
}

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

int n;
vector<int> tr[100001];
bool good[100001], yes[100001];

void Y() { printf("First\n"), exit(0); }

void go(int v = 1, int p = 0){
	bool g = true;
	int y = 0;
	f(i, 0, tr[v].size()){
		int u = tr[v][i];
		if (u == p)continue;
		go(u, v);
		if (!good[u])g = false;
		if (yes[u])++y;
	}
	if (y > 1)Y();
	if (y == 1)good[v] = true;
	if (g)yes[v] = true;
}

int main(){
	scanf("%d", &n);
	f(i, 1, n){
		int a, b;
		scanf("%d%d", &a, &b);
		tr[a].push_back(b);
		tr[b].push_back(a);
	}
	go();
	if (yes[1])Y();
	printf("Second\n");
}

Measured memory_bytes: 7936
#ABC050

n = int(input())
a = sorted(list(map(int,input().split())))
p = 10 ** 9 + 7
l_odd = sorted([2*i-1 for i in range(1,n//2+1)]*2)
l_even = [0]+sorted([2*i for i in range(1,n//2+1)]*2)
#print(l_odd) if n % 2 == 0 else print(l_even)

if (n % 2 != 0 and a == l_even) or (n % 2 == 0 and a == l_odd):
    print(2**(n//2)%p)
else:
    print(0)

Measured memory_bytes: 14008
a,b,c,d=map(int,input().split())
ans=0
while a>0 and c>0:
    c-=b
    ans+=1
    if c<=0:
        break
    a-=d
    ans+=1
    if a<=0:
        break
if ans%2==0:
    print('No')
else:
    print('Yes')
    
        
    


Measured memory_bytes: 61860