akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,k,q,i,temp;
    cin>>n>>k>>q;
    ll a[n]={0};
    
    for(i=0;i<q;i++)
    {
        cin>>temp;
        a[temp-1]++;
        
    }
    for(i=0;i<n;i++)
    {
        if(a[i]+k-q>0)
        cout<<"Yes"<<endl;
        else
        cout<<"No"<<endl;
    }


     

  return 0;
    
}
    


Measured memory_bytes: 1408
// Template from https://techracho.bpsinc.jp/jhonda/2019_08_05/78537

// input macro for competive-programming from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

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

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

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

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

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

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

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

fn main() {
    use std::io::Read;
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();

    println!("{}", solve(&s));
}

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
// r#"2018 218"# => "Yes",
// r#"2763 0"# => "No",
r#"3"# => "6",

}

fn solve(src: &str) -> String {
    input! {
        source = src,
        n: usize,
    }

    if n % 2 == 0 { n } else { n * 2 }.to_string()
}

Measured memory_bytes: 4352
#include <iostream>

typedef long long ll;

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	ll x;
	cin >> x;
	ll s = 100;
	int res = 0;
	while (s < x) {
		s += s / 100;
		res++;
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 3652
import java.util.*;

public class Main {
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      	int n = sc.nextInt();
      	if(n%2==0){
        	System.out.println(n);
        }
      	else{
        	System.out.println(n*2);
        }
    }
}

Measured memory_bytes: 23252
n = int(input())
if n % 2 == 1:
    print(0)
    exit()
elif n % 2 == 0:
    ans = n//10
    kar = n//10
    while True:
        if kar // 5 >= 1:
            ans += kar // 5
            kar = kar// 5
        elif kar // 5 < 1:
            break
print(ans)

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

int main(){
    int n,i,a,b,omax,emax,ans,tmp;
    cin >> n;
    vector<int> even(100000,0),odd(100000,0);
    vector<int>::iterator emaxit,omaxit;
    for(i=0;i<n/2;i++){
        cin >> a >> b;
        odd.at(a-1)++;
        even.at(b-1)++;
    }
    emaxit = max_element(even.begin(),even.end());
    omaxit = max_element(odd.begin(),odd.end());
    emax = distance(even.begin(),emaxit);
    omax = distance(odd.begin(),omaxit);
    sort(even.begin(),even.end(),greater<int>());
    sort(odd.begin(),odd.end(),greater<int>());
    if(emax != omax){ 
        ans = n - even.at(0) - odd.at(0);
    }else{
        ans = n - even.at(0) - odd.at(1);
        tmp = n - even.at(1) - odd.at(0);
        if(tmp < ans) ans = tmp;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <climits>
using namespace std;
int main() {
    int coin[] = {1,5,10,50,100,500};
    int dp[1000];
    fill_n(dp, 1000, INT_MAX);
    dp[0] = 0;
    for (int i=1; i<1000; ++i) {
        for (int j=0; j<6; ++j) {
            if (i - coin[j] >= 0) {
                dp[i] = min(dp[i], dp[i-coin[j]]+1);
            }
        }
    }

    int n;
    while (cin >> n && n!=0) {
        cout << dp[1000-n] << endl;
    }

    return 0;
}

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

typedef long long ll;
typedef pair<int,int>P;
#define INF (int)(1e9)
#define EPS (1e-7)
#define MOD ((ll)1e9+7)
#define REP(i,n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,k,n) for(int i = (k); i < (int)(n); i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define pb push_back
#define vec vector<int>


/*--------------------------------------------*/
/*ll factorial(ll);
void list_Prime(ll);
ll divisor(ll);
ll lcm(ll, ll);//AとBの最小公倍数
ll gcd(ll,ll);*/
/*--------------------------------------------*/


int main(){
    int n;ll k;cin>>n>>k;
    ll a[100000+10];ll b[100000+10];
    REP(i,n)cin>>a[i]>>b[i];
    //vector<ll> c(n);//dummy
    //REP(i,n)c[i]=a[i];
    vector<ll> d(100000+10,0);
    REP(i,n)d[a[i]]+=b[i];
    //sort(ALL(c));
    //REP(i,n)cout<<c[i]<<","<<d[c[i]]<<endl;
    ll cnt=0;
    ll now=0;
    for(now=1;now<=100000;now++){
        if(d[now]>=k){cout<<now<<endl;break;}
        k-=d[now];
    }
 
}



/*--------------------------------------------*/
/*
ll factorial(ll n){
    if(n==1)return 1;
    return n*factorial(n-1);
}
ll lcm(ll A, ll B) {//最小公倍数
    ll a = A;
    ll b = B;
    if (a == 0 || b == 0) { return 0; }
    if (a < 0) { a = -a; }
    if (b < 0) { b = -b; }
    while (b > 0) {
        ll c = a % b;
        a = b;
        b = c;
    }
    return A/a*B;
}

ll gcd(ll a,ll b){
    while (b != 0) {
        int t = b;
        b = a % b;
        a = t;
    }
    return a;
}


void list_Prime(ll n){//n以下の素数を全て見つける
    ll Limit=(int)sqrt((double)n);
    for(ll i=2;i<=n;i++)prime[i]=1;//最初はみんな素数かも
    //素数の整数倍を消していく(ルートnまで)
    for(ll i=2;i<=Limit;i++){
        if(prime[i]){
            for(ll j=2*i;j<=n;j++){
                if(j%i==0){
                    prime[j]=0;                
                }
            }
        }
    }
}

ll divisor(ll n){
    for(ll i=2;i<=n;i++){
        ll d=1;
        ll tmp=i;
        while(tmp>0){
            d++;
            while(tmp%d==0){
                prime[i]++;
                tmp/=i;
            }
        }
    }
    ll sum=1;
    for(ll i=2;;i<=n;i++){
        sum*=(prime[i]+1)/MOD;
    }    
    cout<<"sum="<<sum<<endl;

    return sum%MOD;
}
*/


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define all(c) begin(c),end(c)
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;
//最大公約数
ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}
//最小公倍数
ll lcm(ll x, ll y) {
  return x/gcd(x, y)*y;
}
//素因数分解
vector<pair<ll,int>> factorize(ll n) {
  vector<pair<ll,int>> res;
  for (ll i = 2; i*i <= n; ++i) {
    if (n%i) continue;
    res.emplace_back(i,0);
    while (n%i == 0) {
      n /= i;
      res.back().second++;
    }
  }
  if (n != 1) res.emplace_back(n,1);
  return res;
}
 
 
 
 
int main() {
  int n;
  cin>>n;
  rep(i,10){
    rep(j,10){
      int t=i*j;
      if(t==n){
        cout<<"Yes";
        return 0;
      }
    }
  }
  cout<<"No";
}



Measured memory_bytes: 256
N = int(input())
i = 1
ans = [0 for i in range(1) if N == 0]
while N != 0:
    if N % (-2 ** i) == 0:
        ans.append(0)
    else:
        ans.append(1)
        N -= ((-2)**(i-1))
    i += 1
print("".join(map(str, ans))[::-1])

"""
N = bin(int(input()))
N_str = str(N)[:1:-1]+"0"  # 逆順
N_list = list(N_str)
print(N_list)
for i in range(len(N_list)+1):
    if i % 2 == 1:


        # 繰り上がり
        for j in range(i+1, len(N_list)):
            # N[j] += 1
            # print(type(N[j]))
            N_list[j] = str(int(N_list[j])+1)
            # N_str[j] = str(int(N[j])+1)
            if N_list[j] == "2":
                N_list[j] = "0"
                continue
            else:
                break

ans = "".join(N_list[::-1])
print(ans)
        """


Measured memory_bytes: 3060
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#define rep(i, s, g) for (i = s; i < g; i++)
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1e18) + 1;

ll gcd(ll a, ll b)
{
    ll tmp;
    ll c;
    if (a < b)
    {
        tmp = a;
        a = b;
        b = tmp;
    }

    do
    {
        c = a % b;
        a = b;
        b = c;
    } while (c != 0);

    return a;
}

ll lcm(ll a, ll b)
{
    return a * b / gcd(a, b);
}

int main(void)
{
    ll a, b;

    cin >> a >> b;

    cout << lcm(a, b) << endl;
}

Measured memory_bytes: 256
eratosthenes = Array.new(50022, true)
eratosthenes[0..1] = [false, false]
primes = []

i = 2
while i <= 50021
    if eratosthenes[i]
        m = 2
        while i * m <= 50021
            eratosthenes[i * m] = false
            m += 1
        end
    end
    i += 1
end
eratosthenes[2..-1].each_with_index{|x, i| primes << (i + 2) if x}

while line = gets
    n = line.to_i
    i = primes.rindex{|x| x < n}
    puts "#{primes[i]} #{(n != primes[i + 1]) ? primes[i + 1] : primes[i + 2]}"
end


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

int main(){
	int n,maxcnt=0,tmp;
	cin>>n;
	vector<int> a(100005,0);
	for(int i=0; i<n; i++){
		cin>>tmp;
		if(tmp!=0)
			a.at(tmp-1)++;
		a.at(tmp)++;
		a.at(tmp+1)++;
	}
	for(int i=1;i<100001;i++)
		maxcnt=max(maxcnt,a.at(i));
	cout << maxcnt << endl;
}

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

using namespace std;

#define rep(i,a,b) for(int i = a; i<int(b);++i)
#define all(v) v.begin(),v.end()
#define sz(v) v.size()
#define trav(a,c) for(auto a: c)

typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> pii;

int main(){
	cin.sync_with_stdio(false);
	ll k; cin>>k;
	vi v(k);
	rep(i,0,k) cin>>v[i];
	reverse(all(v));
    ll mn = 2;
    ll mx = 2;
    rep(i,0,k){
        mn = (mn/v[i]+(mn%v[i]!=0))*v[i];
        mx = (mx/v[i])*v[i]+v[i]-1;
        if(mn>mx) {
            cout<<-1<<endl;
            return 0;
        }
    }
    cout<<mn<<" "<<mx<<endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <bitset>
#include <limits>

using namespace std;

using ll = long long;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

#define input(...) __VA_ARGS__; in(__VA_ARGS__)

template<class T>
void print(vector<T> a) {
  cout << "[ ";
  REP(i, a.size()) cout << a[i] << " ";
  cout << "]" << endl;
}

void print() {
  std::cout << std::endl;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  std::cout << head << " ";
  print(std::forward<Tail>(tail)...);
}

void in() { }

template <class Head, class... Tail>
void in(Head&& head, Tail&&... tail) {
  cin >> head;
  in(std::forward<Tail>(tail)...);
}

int main() {
  int input(n, k);
  vector<ll> a(n);
  REP(i, n) cin >> a[i];

  ll minv = numeric_limits<ll>::max();
  REP(i, 1 << n) {
    bitset<15> state(i);
    state[0] = 1;
    if (state.count() < k) continue;

    ll p = 0;
    ll cost = 0;
    REP(j, 15) {
      if (state[j]) {
        if (p >= a[j]) {
          cost += (p - a[j]) + 1;
          p++;
        }
      }
      p = max(p, a[j]);
    }
    minv = min(minv, cost);
  }
  cout << minv << endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
  long a,b,c,N;
  cin>>N;
  a=2;
  b=1;
  c=0;
  if(N==0)
    cout<<a<<endl;
  else if(N==1)
    cout<<b<<endl;
  else
  {for(int i=1;i<N;i++)
    {
      c=a+b;
      a=b;
      b=c;
    }
   cout<<c<<endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,m,K,sum[19][1009],ans=0x3f3f3f3f;
char grid[19][1009];
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin>>n>>m>>K;
	for(int i=0;i<n;i++) cin>>grid[i];
	for(int j=0;j<m;j++)
		for(int i=0;i<n;i++)
			sum[i][j]=(i>0?sum[i-1][j]:0)+(grid[i][j]=='1');
	for(int i=0;i<1<<n-1;i++) {
		vector<int>pos,now,pre;
		int num=0;
		bool c=1;
		pos.push_back(-1);
		for(int j=0;j<n;j++)
			if(1<<j&i)
				pos.push_back(j);
		pos.push_back(n-1);
		now.resize(pos.size(),0);
		pre.resize(pos.size(),0);
		for(int j=0;j<m;j++) {
			bool add=0,can=1;
			for(int k=1;k<pos.size();k++) {
				now[k]=pre[k]+sum[pos[k]][j]-(k>1?sum[pos[k-1]][j]:0);
				if(now[k]-pre[k]>K) {
					can=0;
					break;
				}
				if(now[k]>K) add=1;
			}
			if(!can) {
				c=0;
				break;
			}
			if(add) {
				num++;
				for(int k=1;k<pos.size();k++) now[k]=max(0,pre[k]-K)+now[k]-pre[k];
			}
			pre=now;
		}
		if(c) ans=min(ans,__builtin_popcount(i)+num);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for(int i=(a);i<=(n);++i)
const int N=111111,M=111111;
int m,n;
char s[N];
int main(){
	scanf("%s",s);
	n=strlen(s);
	rep(i,0,n-1)if(s[i]==',')s[i]=' ';
	printf("%s\n",s);
	return 0;
}

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

int main() {
    int q;cin>>q;
    deque<int > v;
    while(q--){
        int a;cin>>a;
        if(a==0){
            int d,x;cin>>d>>x;
            if(d==1){
                v.push_back(x);
            }
            if(d==0){
                v.push_front(x);
            }
        }
        else if(a==1){
            int p;cin>>p;
            cout<<v[p]<<endl;
        }
        else if(a==2){
            int d;cin>>d;
            if(d==1){
                v.pop_back();
            }
            if(d==0){
                v.pop_front();
            }
        }
    }
    return 0;
}



Measured memory_bytes: 4596
a,b,h,m=map(int,input().split())

import math

zir=2*math.pi*(h/12+m/720)
hunr=2*math.pi*m/60

zixy=(a*math.cos(zir),a*math.sin(zir))
hunxy=(b*math.cos(hunr),b*math.sin(hunr))

print(math.sqrt((zixy[0]-hunxy[0])**2+(zixy[1]-hunxy[1])**2))


Measured memory_bytes: 9512
#include <bits/stdc++.h> 
#include<cmath>
#define pb push_back
#define ll long long
#define ull unsigned long long
#define deb(x) cerr<<#x<<" "<<x<<"\n"
#define debi cerr<<"hey sparky\n"
#define x first
#define y second
#define nax (int)1e5+2
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define newline cout<<"\n"
#define yes cout<<"YES"<<"\n"
#define no cout<<"NO"<<"\n" 
#define INF (int)1e9
#define eps (long double)1e-9
//#define int long long
using namespace std;
// sequences with only one 2 should not be included	
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	cout<<c<<" "<<a<<" "<<b;
	
	
	return 0;
}
	


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
const int N=1e5+5;
vector<int>st[N];int n,k,tot;
inline int add(R int x,R int y){return x+y>=k-1?x+y-k+1:x+y;}
int main(){
    k=38,n=k*(k-1)+1,tot=1;
    printf("%d %d\n",n,k);
    fp(i,1,k){
        printf("%d ",1);
        st[i].resize(k-1);
        fp(j,0,k-2)st[i][j]=++tot;
        fp(j,0,k-2)printf("%d ",st[i][j]);
        puts("");
    }
    fp(i,0,k-2){
        fp(s,0,k-2){
            R int p=s;
            printf("%d ",st[1][i]);
            fp(j,2,k)printf("%d ",st[j][p]),p=add(p,i);
            puts("");
        }
    }
    return 0;
}

Measured memory_bytes: 2816
#include <bits/stdc++.h>
#define maxn 500010
using namespace std;
char s[maxn];
int a[maxn], dp[maxn];
int main() {
    int n;
    scanf("%d%s", &n, s+1);
    for (int i = 1; i <= n; ++i) {
        if (s[i] == '0') a[i] = i;
        else a[i] = a[i-1];
    }
    for (int i = 1; i <= n; ++i) {
        dp[i] = dp[i-1];
        if (s[i] == '1') {
            if (s[i-1] == '0' && s[i-2] == '1') {
                dp[i] = max(dp[i], dp[a[i-2]]+ (i-2) - a[i-2]);
                dp[i] = max(dp[i], dp[a[i-2]+1] + (i-2) - (a[i-2]+1));
            }
            else if (a[i]>1 && s[a[i]-1] == '1') dp[i] = max(dp[i], dp[a[i]-2] + i - a[i]);
        }
    }
    printf("%d\n", dp[n]);
    return 0;
}


Measured memory_bytes: 4736
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int begin =Integer.parseInt(s.charAt(0)+""+s.charAt(1));
    int end = Integer.parseInt(s.charAt(2)+""+s.charAt(3));
    if((begin > 12 || begin == 0) && (end <= 12 && end != 0)){
      System.out.println("YYMM");
    } else if((begin <= 12 && begin !=0) && (end > 12 || end == 0)){
      System.out.println("MMYY");
    } else if((begin <= 12 && begin != 0) && (end <= 12 && end !=0)){
      System.out.println("AMBIGUOUS");
    } else {
      System.out.println("NA");
    }
  }
}

Measured memory_bytes: 21972
n,k=map(int,input().split())
p=list(map(int,input().split()))
 
an=0
an2=0
t=0
 
for i in range(n):
    if i<k:
        an+=((p[i]+1)/2)
        an2=an
    else:
        t=((p[i-k]+1)/2)
        if an+((p[i]+1)/2)-t>an2:
            an2=an+((p[i]+1)/2)-t
        an=an+((p[i]+1)/2)-t
            
print(an2)

Measured memory_bytes: 25060
#include<bits/stdc++.h>
#define int long long
#define pii pair<int,int>
#define pb push_back
#define F first
#define S second
using namespace std;
const int N = 1e5+10;
main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n ;cin>>n;
    cout<<n/3;
}


Measured memory_bytes: 764
#include<stdio.h>

int n, q;
int a[21];

int solve(int i, int m)
{
	if(m == 0)
		return 1;
	if(i >= n)
		return 0;
	int rec = solve(i + 1, m) || solve(i + 1, m - a[i]);
	return rec;
}

int main()
{
	int m;
	scanf("%d", &n);
	for(int i = 0; i < n; i++)
		scanf("%d", &a[i]);
	scanf("%d", &q);
	for(int i = 0; i < q; i++)
	{
		scanf("%d", &m);
		if(solve(0, m))
			printf("yes\n");
		else
			printf("no\n");
	}
	return 0;	
} 


Measured memory_bytes: 2108
def solve():
    cmd = []
    n, m = map(int, input().split())
    if n == 1 and m == 0:
        print(0)
        return

    for _ in range(m):
        cmd.append(tuple(map(int, input().split())))

    res = ["0"] * n
    res[0] = "1"
    cmd.sort()

    for i in range(len(cmd)-1):
        t1, t2 = cmd[i], cmd[i+1]
        if t1[0] == t2[0] and t1[1] != t2[1]:
            print(-1)
            return

    for si, ci in cmd:
        res[si-1] = str(ci)

    r = int("".join(res))

    if len(str(r)) == n:
        print(r)
    else:
        print(-1)

solve()


Measured memory_bytes: 38384
#include<stdio.h>	
int main(){
	while(1){
		int n;
		scanf("%d",&n);
		if(n==0)break;
		int a[5100];
		for(int i=0;i<n;i++)scanf("%d",&a[i]);
		int max =-100000,sum;
        for(int j=0;j<n;j++){
            sum = 0;
            for(int k=j;k<=n-1;k++){
                sum += a[k];
                max = (max >= sum)? max:sum;}}
		printf("%d\n",max);}
		return 0;}


Measured memory_bytes: 2628
//                             In The Name Of Allah
#include <bits/stdc++.h>
#define ss second
#define ff first
#define use_fast ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ret(n) return cout << n, 0
#define se(n) cout << setprecision(n) << fixed
#define ll long long
#define int long long
#define pb push_back
using namespace std; 

const ll N = 1e6 + 100, OO = 1e10 + 10, M = 1e9 + 7, lg = 20;
typedef pair <int, int> pii;

int32_t main() {
	int n, m;
	multiset <int> s;
	cin >> n >> m;
	for(int i = 0; i < n; i++) {
		int x;
		cin >> x;
		s.insert(x);
	}
	while(s.size()) {
		if(m == 0)
			break;
		int u = *s.rbegin();
		s.erase(s.find(*s.rbegin()));
		u /= 2;
		m--;
		if(u > 0)
			s.insert(u);
	}
	int ans = 0;
	for(auto u : s) {
		ans += u;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4992
<?php
fscanf(STDIN, "%d", $n);
$p = explode(' ', trim(fgets(STDIN)));
$x = 0;
for ($i = 1; $i < $n - 1; $i++) {
	if ($p[$i-1] < $p[$i] && $p[$i] < $p[$i+1]
	 || $p[$i-1] > $p[$i] && $p[$i] > $p[$i+1]) {
		$x++;
	}
}
echo $x;

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

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

    int N; cin >> N;
    vector<int> V(N);
    for (int i = 0; i < N; i++) cin >> V[i];
    int ans = 0;
    for (int i = 0; i < N; i++) {
        int C; cin >> C;
        ans += max(0, V[i] - C);
    }
    cout << ans << "\n";
}

Measured memory_bytes: 256
import java.util.*; 

class Main{
public static void main(String[] args){
	Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        long k=sc.nextLong();
		
  		long[] x=new long[n+1];
  		x[n]=k;
		for(int c=0;c<n;c++){
    		x[c]=sc.nextLong();
    	}
        Arrays.sort(x);
      if(n==1){
       long gcd=x[1]-x[0];
        System.out.println(gcd);
      }else{
      long gcd=gcd(x[1]-x[0],x[2]-x[1]);
      
 	for(int a=2;a<n;a++){
    	gcd=gcd(gcd,x[a+1]-x[a]);
    }
        System.out.println(gcd);
      }
	
    }
  
  private static long gcd(long a,long b){
   if(b==0){
   	return a;
   }
	return gcd(b, a%b);
}
}


Measured memory_bytes: 60248
#include <algorithm>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <deque>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <ratio>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = long long;
using ull = unsigned long long;
template<class T> using v = vector<T>;
template<class T, class U> using p = pair<T, U>;

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

template<class T> T read() { T x{}; cin >> x; return x; }
template<class T> v<T> read(int N){ v<T> x(N); REP(i, N) cin >> x[i]; return x; }

template<class T>
void write(const T &x){ cout << x << endl; }
void write(double x){ printf("%.15f\n", x); }

const ull MOD = 1000'000'007;



int main(){
    ll N, K, S;
    cin >> N >> K >> S;
    
    ll a1 = S, a2 = S+1;
    if(S == 1e9){ a2 = 1; }
    
    for(ll i = 0; i < N; ++i){
        if(i > 0) { cout << " "; }
        if(i < K){ cout << a1; }
        else { cout << a2; }
    }
    cout << endl;
}



Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
const long long mod = 1e9+7;
//////////////////////////////////

class UnionFind {
public:
  vector<int> parent;
  vector<int> sizes;
  UnionFind(int n) : parent(n), sizes(n, 1) {
    for(int i=0; i<n; i++) parent[i] = i;
  }
  int find(int x) {
    if (x == parent[x]) return x;
    return parent[x] = find(parent[x]);
  }
  void unite(int x, int y) {
    x = find(x);
    y = find(y);
    if(x == y) return;
    if(sizes[x] < sizes[y]) swap(x, y);
    parent[y] = x;
    sizes[x] += sizes[y];
  }
  bool same(int x, int y) { return find(x) == find(y); }
  int size(int x) { return sizes[find(x)]; }
};

int main() {
  int n, m; cin >> n >> m;
  vector<int> a(m);
  vector<int> b(m);
  if (m == 0) {
    cout << 1 << endl;
    return 0;
  }
  UnionFind uf(n);
  int ans = 0;
  for(int i=0; i<m; i++) {
    cin >> a[i] >> b[i];
    uf.unite(a[i]-1, b[i]-1);
  }
  for(int i=0; i<m; i++) {
    ans = max({ans, uf.size(a[i]-1), uf.size(b[i]-1)});
  }
  cout << ans << endl;
  


  return 0;
}

// EOF

Measured memory_bytes: 6420
#include<bits/stdc++.h>
using namespace std;
 
int main() {
  int N,i;
  cin>>N;
  int A=0;
  int B=0;

  int a[N];
  for (i=0;i<N;i++)cin>>a[i];
  sort(a,a+N);
  reverse(a,a+N);
  
  for (i=0;i<N;i++){
    //cout << a[i] << endl;
    if(i%2==0){
      A += a[i];
    }else{
      B += a[i];
    }
  }
  cout << A - B << endl;
}

Measured memory_bytes: 3568
#include <iostream>
using namespace std;
int main() {
	int N;
	int a[100];
	int cnt = 0;

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

	for (int i = 0; i < N; i++)
	{
		if (a[i] == a[i + 1]) {
			cnt++;
			i++;
		}
	}

	cout << cnt << endl;

	return 0;
}

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


Measured memory_bytes: 14052
import sys

k = int(input())
n = 7
counter = 1
remainders = set()

while True:
    remainder = n % k
    if remainder == 0:
        print(counter)
        sys.exit()
    if remainder in remainders:
        print(-1)
        sys.exit()
    remainders.add(remainder)
    
    n = remainder * 10 + 7
    counter += 1

Measured memory_bytes: 77748
#include <stdio.h>
int main(){

  int n,m,result[100]={0},a[100],b,targetplus=0,i,j;

  scanf("%d %d",&n,&m);

  for(i = 0; i < m; i++) scanf("%d",&a[i]);

  for(i = 0; i < m; i++){

    for(j = 0; j < n; j++){

      scanf("%d",&b);

      if(a[i] != b) result[a[i]-1] += 1;
      else result[j] += 1;

    }

  }

  for(i = 0; i < n; i++) printf("%d\n",result[i]);

  return 0;

}

Measured memory_bytes: 596
using System;
using System.Text;
using System.Collections.Generic;
class Solve{
    public Solve(){}
    int[] p;
    int[] q;
    StringBuilder sb;
    public static int Main(){
        new Solve().Run();
        return 0;
    }
    void Run(){
        sb = new StringBuilder();
        Calc();
        Console.Write(sb.ToString());
    }
    void Calc(){
        p = new int[6];
        q = new int[6];
        string[] str = Console.ReadLine().Split(' ');
        for(int i=0;i<6;i++){
            p[i] = int.Parse(str[i]);
        }
        str = Console.ReadLine().Split(' ');
        for(int i=0;i<6;i++){
            q[i] = int.Parse(str[i]);
        }
        double f = 0;
        double l = 1;
        while(l - f >= 0.000000001){
            double c1 = (2*f+l)/3;
            double c2 = (f+2*l)/3;
            if(check(c1) >= check(c2)){
                f = c1;
            }
            if(check(c1) <= check(c2)){
                l = c2;
            }
        }
        sb.Append(check((f+l)/2)/100+"\n");
    }
    double check(double d){
        double sum = 0;
        for(int i=0;i<6;i++){
            sum += d*p[i] > (1-d)*q[i] ? d*p[i] : (1-d)*q[i];
        }
        return sum;
    }
}

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

int main(){

  int N;
  cin >> N;
  
  int count=0;
  int l;
  int r;
  
  for(int i=0;i<N;i++){
    cin >> l >> r;
    count += (r-l+1);
  }
  
  cout << count << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    for(;;){
        int h, w, n;
        cin >> h >> w >> n;
        if(h == 0)
            return 0;

        vector<vector<bool> > east(h, vector<bool>(w));
        for(int i=0; i<h; ++i){
            for(int j=0; j<w; ++j){
                int a;
                cin >> a;
                east[i][j] = (a == 1);
            }
        }

        vector<vector<int> > num(h+1, vector<int>(w+1, 0));
        num[0][0] = n - 1;
        for(int i=0; i<h; ++i){
            for(int j=0; j<w; ++j){
                num[i+1][j] += num[i][j] / 2;
                num[i][j+1] += num[i][j] / 2;
                if(num[i][j] % 2 == 1){
                    if(east[i][j])
                        ++ num[i][j+1];
                    else
                        ++ num[i+1][j];
                    east[i][j] = !east[i][j];
                }
            }
        }

        int y = 0;
        int x = 0;
        while(y < h && x < w){
            if(east[y][x])
                ++ x;
            else
                ++ y;
        }
        cout << (y+1) << ' ' << (x+1) << endl;
    }
}

Measured memory_bytes: 0
from math import gcd
import sys
input=sys.stdin.readline
n=int(input())
a=list(map(int,input().split()))
x=[-1]*(10**6+5)
x[0]=0
x[1]=1
i=2
while i<=10**6+1:
    j=2*i
    if x[i]==-1:
        x[i]=i
        while j<=10**6+1:
            if x[j]==-1:x[j]=i
            j+=i
    i+=1

z=[0]*(10**6+5)

g=gcd(a[0],a[0])
for i in range(n):
    g=gcd(g,a[i])
if g!=1:
    print("not coprime")
else:
    f=0
    for i in range(n):
        p=1
        while a[i]>=2:
            if p==x[a[i]]:
                a[i]=a[i]//p
                continue
            else:
                p=x[a[i]]
                z[p]+=1
                a[i]=a[i]//p

    for i in range(10**6+1):
        if z[i]>=2:
            f=1
    print("pairwise coprime" if f==0 else "setwise coprime")


Measured memory_bytes: 184508
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, m; cin >> n >> m;   
    vi res(n, -1);

    rep(_, m){
        int s, c; cin >> s >> c;
        s--;
        if(res[s] >= 0 and res[s] != c){
            cout << -1 << endl;
            return 0;
        }
        res[s] = c;
    }
    if(n > 1 and res[0] == 0){
        cout << -1 << endl;
    }
    else {
        for(auto& e : res) chmax(e, 0);
        if(n > 1) chmax(res[0], 1);
        rep(i, n){
            cout << res[i];
        }
        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
int i,n,l,min = 10000,sum =0, flag =0 ;
cin >> n >> l;
for(i=1; i<=n; i++)
{
if((l+i-1) < 0)
{
    if (flag == 1)
    {
        if(-(l + i -1)<= (-min))
        {
            min = l+i -1;
            flag =1;
        }
    }
    else
    {
        if(-(l+i-1)<= min)
        {
            min = l+i -1;
            flag =1 ;
        }
    }
    
}
else
{
    if(flag == 1)
    {
        if(l + i -1 <=(-min))
        {
            min = l+i -1;
            flag =0;
        }
    }
    else
    {
        if(l + i - 1 <= min)
        {
            min = l + i -1;
            flag = 0;
        }
    }
}
sum = sum + l + i -1;
}
cout<< sum - min;
return 0;
}

Measured memory_bytes: 256
// f-pond-skater.yml
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using pii = pair<int, int>;
const int INF = 0x3f3f3f3f;
const ll LLINF = 0x3f3f3f3f3f3f3f3f;
template <typename V> using uset = unordered_set<V>;
template <typename K, typename V> using umap = unordered_map<K, V>;
template <typename C> int sz(C &v) { return v.size(); }

const int DIR[4][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};

struct Pos {
    int x, y;
};

struct Ent { 
    int x, y, predir;
};

int R, C, K;
Pos st, en;
vector<vector<bool>> grid;
vector<vector<ll>> dis[5];
deque<Ent> q;

// priority_queue<Ent> q;


ll make_dp(ll dis, ll k) {
    return (k << 32LL) | dis;
}
const ll MSK = (1LL << 32) - 1;
inline ll gdis(ll dp) { return dp & MSK; }
inline ll gk(ll dp) { return dp >> 32LL; }

bool cmp(const ll a, const ll b) {
    return gdis(a) == gdis(b) ? gk(a) < gk(b) : gdis(a) < gdis(b);
}

inline void tryPush(int x, int y, int predir, int ndis, int k, bool inc) {
    ll disPair = make_dp(ndis, k);
    if (x < 0 || x >= R || y < 0 || y >= C || !grid[x][y] || cmp(dis[predir][x][y], disPair)) return;

    Ent ent{x, y, predir};
    if (gdis(dis[predir][x][y]) > ndis) {
        if (inc)
            q.push_back(ent);
        else
            q.push_front(ent);
    }
    dis[predir][x][y] = disPair;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    cin >> R >> C >> K;
    cin >> st.x >> st.y >> en.x >> en.y;
    grid.assign(R, vector<bool>(C, true));
    for (int i = 0; i < R; i++) {
        string tmp;
        cin >> tmp;
        for (int j = 0; j < C; j++)
            grid[i][j] = tmp[j] == '.';
    }
    st.x--; st.y--;
    en.x--; en.y--;

    for (int i = 0; i < 5; i++) {
        dis[i].assign(R, vector<ll>(C, make_dp(INF, 0)));
        // inq[i].assign(R, vector<bool>(C, false));
    }

    // assert(0);
    // cout << st.x<<' '<<st.y<<endl;

    dis[4][st.x][st.y] = make_dp(0, 0);
    q.push_back({st.x, st.y, 4});
    // assert(0);
    while (!q.empty()) {
        auto c = q.front();
        q.pop_front();
        int cdis = gdis(dis[c.predir][c.x][c.y]), ck = gk(dis[c.predir][c.x][c.y]);
        // inq[c.predir][c.x][c.y] = false;

        // if (c.x == en.x && c.y == en.y) {
        //     cout << cdis << '\n';
        //     return 0;
        // }

        if (cmp(dis[c.predir][c.x][c.y], make_dp(cdis, ck))) continue;

        // cout << "pos=("<<c.x<<", "<<c.y<<") dir="<<c.predir<<" dis=("<<c.dis<<", "<<c.k<<")"<<endl;

        if (c.predir == 4) {
            for (int i = 0; i < 4; i++) {
                tryPush(c.x + DIR[i][0], c.y + DIR[i][1], i, cdis + 1, 1, true);
            }
        }
        else {
            for (int i = 0; i < 4; i++) {
                bool inc = i != c.predir || ck == K;
                int newK = inc ? 1 : (ck + 1);
                tryPush(c.x + DIR[i][0], c.y + DIR[i][1], i, cdis + inc, newK, inc);
            }
        }
    }

    // cout << "-1\n";
    int ans = INF;
    for (int i = 0; i < 5; i++)
        ans = min(ans, (int)gdis(dis[i][en.x][en.y]));
    cout << (ans == INF ? -1 : ans) << '\n';

    return 0;
}



Measured memory_bytes: 50324
#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

// -----------------------------------------------
// Framework <https://github.com/vain0x/procon>
// -----------------------------------------------

#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($t:ty) =>
        (rl().parse::<$t>().unwrap());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($arg:expr),*) => {
        #[cfg(debug_assertions)]
        $(writeln!(stderr(), "{} = {:?}", stringify!($arg), $arg).unwrap());*
    };
}

#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

trait IteratorExt: Iterator + Sized {
    fn vec(self) -> Vec<Self::Item> {
        self.collect()
    }
}

impl<T: Iterator> IteratorExt for T {}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn f(n: i32) -> Vec<i32> {
    let mut v = vec![];

    for k in 1..n + 1 {
        if n % k == 0 {
            v.push(k);
        }
    }

    v
}

fn main() {
    let N = read!(i32);

    let mut count = 0;

    for n in 1..N + 1 {
        if n % 2 == 0 {
            continue;
        }

        if f(n).len() == 8 {
            count += 1;
        }
    }

    println!("{}", count)
}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>
#include <list>
#include <bitset>

//< in.txt > out.txt
using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
typedef long long LL;
typedef long double LD;
typedef pair<LL, LL> PLL;
typedef pair<LD, LL> pdl;
typedef pair<LD, LD> pdd;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned long long ULL;
//typedef boost::multiprecision::cpp_int bigint;

pair<PLL,bool> calc(LL X) {
	for (LL p = 1; p * p <= X; p++) {
		if (X % p != 0)continue;
		{
			for (LL b = -2000; b <= 2000; b++) {
				LL temp = 5 * p * p * p * p * b + 10 * p * p * p * b * b + 10 * p * p * b * b * b + 5 * p * b * b * b * b + p * p * p * p * p;
				if (temp == X) {
					return pair<PLL, bool>(PLL(b + p, b), true);
				}
			}
		}
		if (p * p != X) {
			for (LL b = -2000; b <= 2000; b++) {
				LL pp = X / p;
				LL temp = 5 * pp * pp * pp * pp * b + 10 * p * p * p * b * b + 10 * pp * pp * b * b * b + 5 * pp * b * b * b * b + pp * pp * pp * pp * pp;
				if (temp == X) {
					return pair<PLL, bool>(PLL(b + pp, b), true);
				}
			}
		}
	}
	return pair<PLL, bool>(PLL(-1,-1), false);
}

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	LL X;
	cin >> X;
	PLL ans = calc(X).first;
	cout << ans.first << " " << ans.second << "\n";
	return 0;
}



Measured memory_bytes: 3196
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <algorithm>
#include <bitset>
#include <tuple>
#include <set>
#include <map>
#define range(i, r) for(int i=0;i<r;i++)
#define ranges(i, l, r) for(int i=l;i<r;i++)
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi std::vector<std::vector<int> >
#define vvl std::vector<std::vector<ll> >
#define MODs 1000000007;
#define MODn 1000000009;
typedef long long int ll;
using namespace std;
#define P 1000000007
#define N_MAX 2000000
ll fac[N_MAX+1];
ll inv[N_MAX+1];
ll finv[N_MAX+1];

ll comb(ll n, ll k){
    return (((fac[n]*finv[n-k])%P)*finv[k])%P;
}

void init(){
    fac[0] = finv[0] = fac[1] = finv[1] = inv[1] = 1;
    for(int i = 2; i <= N_MAX; i++){
        fac[i] = (fac[i-1]*i)%P;
        inv[i] = ((-(P/i)*inv[P%i])%P+P)%P;
        finv[i] = (finv[i-1]*inv[i])%P;
    }
}
ll pp(ll a, ll b){
  return (a * b)%P;
}
struct tree{
  int number;
  std::vector<tree*> child;
  int one_back=0;
  int c_num=0;
  int tc_num=0;
  int c=0;
  int par=0;
};
std::vector<tree> T(100001);
std::vector<int> check(100001,0);
void ans(int num, int parent){
  if(check[num]==0){
    check[num]=1;
    T[parent].c_num++;
    for(int i=0;i<T[num].child.size();i++){
      ans(T[num].child[i]->number, num);
    }
  }
}
void ans2(int num, int parent){
  if(check[num]==1){
    check[num]=0;
    T[parent].tc_num+=T[num].c_num;
    for(int i=0;i<T[num].child.size();i++){
      ans2(T[num].child[i]->number, num);
    }
  }
}
ll ret;
void ans3(int num, int parent, int K){
  if(check[num]==0){
    check[num]=1;
    if(parent!=0) T[num].par=1;
    ret =  (ret * (K-T[parent].par-T[num].par-T[parent].c))%P;
    T[parent].c++;
    for(int i=0;i<T[num].child.size();i++){
      ans3(T[num].child[i]->number, num, K);
    }
  }
}
int main(int argc, char const *argv[]) {
  init();
  ll N, K;
  std::cin >> N >> K;
  for(int i=1;i<=N;i++){
    T[i].number=i;
  }
  int x,y;
  for(int i=0;i<N-1;i++){
    std::cin >> x >> y;
    if(x>y) swap(x,y);
    T[y].child.push_back(&T[x]);
    T[x].child.push_back(&T[y]);
  }
  ret=1;
  ans(1,0);
  ans2(1,0);
  ans3(1, 0, K);
  std::cout << ret << '\n';
  return 0;
}


Measured memory_bytes: 59648
// #include {{{
#include <iostream>
#include <cassert>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <ctime>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <string>
#include <bitset>
#include <vector>
#include <complex>
#include <algorithm>
using namespace std;
// }}}
// #define {{{
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
// }}}

int main(){
  int x;
  cin >> x;
  ll ans = 2;
  rep(i,0,x)
    ans = (ans + 1) * 2;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import fractions
import copy
n, m = map(int, input().split())
a_list = [int(i) for i in input().split()]

c = 1
b_list = []
for a in a_list:
    d = copy.deepcopy(a)
    k = 1
    while (d % 2 == 0):
        d = d // 2
        k *= 2
    b_list.append(k)
    c = c * (a // 2) // fractions.gcd(c, a // 2)
if len(list(set(b_list))) > 1:
    print(0)
elif (m // c) % 2 == 0:
    print((m // c) // 2)
else:
    print(((m // c) // 2) + 1)

Measured memory_bytes: 16120
X, N = map(int, input().split())
if not N:
  print(X)
  exit()

p = set(map(int, input().split()))
n = set(range(102))
l = n - p
ans = 10000
a = 10000
for i in l:
  tmp = abs(X - i)
  if a > tmp:
    a = tmp
    ans = i
  elif a == tmp:
    ans = min(ans, i)
    
print(ans)

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

int main(){
    int n, a[4][14], b;
    char mark;
    for(int i = 0; i < 4; i++){
        for(int j = 1; j < 14; j++){
            a[i][j] = 0;
        }
    }
    cin >> n;
    for(int k = 0; k < n; k++){
        cin >> mark >> b;
        if(mark == 'S') a[0][b] = 1;
        if(mark == 'H') a[1][b] = 1;
        if(mark == 'C') a[2][b] = 1;
        if(mark == 'D') a[3][b] = 1;
    }
    for(int l = 0; l < 4; l++){
        for(int m = 1; m < 14; m++){
            if(a[l][m] == 0){
                if(l == 0) cout << "S " << m << endl;
                if(l == 1) cout << "H " << m << endl;
                if(l == 2) cout << "C " << m << endl;
                if(l == 3) cout << "D " << m << endl;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3088
#include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<functional>
#include<queue>
#include<stack>
#include<set>
using namespace std;
char ta[]={'I','V','X','L','C','D','M'};
int t[]={1,5,10,50,100,500,1000};
int main(){
	string n;
	while(cin>>n){
	bool used[5000]={0};
	int ans=0,a=0,b=0;
		
		for(int i=1;i<n.size();i++){
			for(int j=0;j<7;j++)if(n[i]==ta[j])a=t[j];
			for(int j=0;j<7;j++)if(n[i-1]==ta[j])b=t[j];
			if(b<a){
			used[i]=used[i-1]=1;
			ans+=a-b;
			}
		}
			for(int i=0;i<n.size();i++){
			for(int j=0;j<7;j++)if(n[i]==ta[j])a=t[j];
			if(used[i]==0)ans+=a;
			}
		cout<<ans<<endl;
	}
	return 0;
}

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

using namespace std;

int main(){
	long n;
	int i,j;
	long h[100000],dp[100000];
	cin >> n;
	for(i=0;i<n;i++){
		cin >> h[i];
		dp[i] = 1e9+7;
	}	
	dp[0] = 0;
	for(i=0;i<n;i++){
		for(j=i+1;j<=i+2;j++){
			if (j < n){
				dp[j] = min(dp[j], dp[i]+ abs(h[i]-h[j]));	
			}			
		}	
	}
	cout << dp[n-1];		
	return 0;
}

Measured memory_bytes: 5056
INFTY = 10**10
N,W = map(int,input().split())
X = [list(map(int,input().split())) for _ in range(N)]
dp = [[[-INFTY for _ in range(3*(N-1)+1)] for _ in range(N+1)] for _ in range(N+1)]
for i in range(N+1):
    dp[i][0][0] = 0
for i in range(1,N+1):
    for j in range(1,i+1):
        for k in range(3*(N-1)+1):
            dp[i][j][k] = dp[i-1][j][k]
            if k>=X[i-1][0]-X[0][0]:
                dp[i][j][k] = max(dp[i][j][k],dp[i-1][j-1][k-X[i-1][0]+X[0][0]]+X[i-1][1])
cmax = 0
for j in range(1,N+1):
    for k in range(3*(N-1)+1):
        if j*X[0][0]+k<=W:
            cmax = max(cmax,dp[N][j][k])
print(cmax)

Measured memory_bytes: 67932
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>

using namespace std;

int main() {
	int N;
	vector<int>W;

	cin >> N;

	W.resize(N);

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


	int min = 20000;
	for (int i = 0; i < N; i++) {
		int G1 = 0, G2 = 0;
		for (int j = 0; j <= i; j++) {
			G1 += W[j];
		}
		for (int j = i + 1; j < N; j++) {
			G2 += W[j];
		}
		if (min > abs(G1 - G2))
			min = abs(G1 - G2);
	}

	cout << min << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k,i,j,a,d;
    set<int>s;
    cin>>n>>k;
    for(i=0;i<k;i++)
    {
        cin>>d;
        for(j=0;j<d;j++)
        {
            cin>>a;
            s.insert(a);
        }
    }
    cout<<n-s.size()<<endl;
}


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

#define ld long double
#define ll long long
#define ull unsigned long long

#define f first
#define s second

#define endl '\n'
#define pii pair <ll, ll>

#define ios ios_base::sync_with_stdio(0), cin.tie()
#define pb push_back
#define mp make_pair

#define pi 3.14159265358979323846264
#define y1 abacaba

using namespace std;

const int MXN = 1e5 + 30;
const int MAXN = 1e3 + 2;
const ll INF = 1e9 + 7;
const ll BINF = 1e18;
const int MOD = 1e9 + 7;
const ld EPS = 1e-15;   
const ll dx[] = {0, 0, 1, -1};      
const ll dy[] = {1, -1, 0, 0};
           
ll n, f[MXN];

int main(){
    //freopen("input.txt", "r", stdin); 
    cin >> n;
    f[0] = 2;
    f[1] = 1;
    for(int i = 2; i <= n; i++) f[i] = f[i - 1] + f[i - 2];
    cout << f[n];
    return 0;
}

Measured memory_bytes: 256