akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define powerof2 ()
#define mp make_pair
#define pi acos(-1)
using ll = long long;
const ll M = 1000000007;
const ll M1= 998244353;
using vl = vector<ll>;
using pll =  pair<ll,ll>;
ll power(ll x,ll y){
	if(y==0)
		return 1;
	ll res=power(x,y/2);
	res=(res*res);
	if(y&1)
		res=(res*x);
	return res;
}
 
ll powermod(ll x,ll y,ll mod){
	if(y==0)
		return 1;
	ll res=powermod(x,y/2,mod);
	res=(res*res)%mod;
	if(y&1)
		res=(res*x)%mod;
	return res;
}
/*ll binarysearch(ll va)
{
	ll n=1;
	ll l=va+1,u=n;
	ll st=num.order_of_key(va);
	while(l+1<u)
	{
		m=(l+u)/2;
		ll in=num.order_of_key(m);
		if(in-st==m-va)
		{
			l=m;
		}
		else
		{
            u=m;
		}
	}
	if(num1.find(l)==num1.end())
		return l;
	return u;
}*/
void solve(){
	int n;
	cin>>n;
	int a[n+1],ans=0;
	for(int i=1;i<=n;i++){
		cin>>a[i];
      if(i%2 && a[i]%2) ans++;
	}
	cout<<ans;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    // cin>>t;
 
    for(int i=1;i<=t;i++)
    {//cout<<"Case #"<<i<<": ";
    solve();}
    return 0;
}


Measured memory_bytes: 3636
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(void){
        int a[10];
        char b;
        while(scanf("%c",&b)!=EOF){
            a[0]=b-'0';
            for(int j=1;j<=10;j++){
                scanf("%c",&b);
                a[j]=b-'0';
            }
            for(int i=0;i<9;i++){
                for(int j=0;j<9-i;j++){
                    a[j]=(a[j]+a[j+1])%10;
                    //cout<<a[j];
                }
              // cout<<endl;
            }
            cout<<a[0]<<endl;

        }
	return 0;
}

Measured memory_bytes: 1156
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt"
	int N, M, K;

int getans(const vector<vector<int>>&edges,const int now, const int use,vector<int>&used) {
	if (now == edges.size() || edges[now].empty())return use;
	int ans = 33;
	
	if (used[now]) {
		return getans(edges, now + 1, use, used);
	}
	else {
		if (use + 1 <= K) {
			used[now] = true;
			ans = min(ans, getans(edges,now + 1, use + 1, used));
			used[now] = false;
		}
		int nextuse = use;
		vector<int>newused;
		for (auto e : edges[now]) {
			if (!used[e]) {
				used[e] = true;
				newused.push_back(e);
			}
		}
		if (use + newused.size() <= K) {
			ans = min(ans, getans(edges, now + 1, use + newused.size(), used));
		}
		for (auto u : newused) {
			used[u] = false;
		}
		//while(edges[num].first==)
	}
	return ans;
}
int main() {cin >> N >> M >> K;
	vector<pair<int, int>>ps(N);
	for (int i = 0; i < ps.size(); ++i) {
		ps[i] = make_pair(0, i);
	}
	vector<vector<int>>aedges(N);
	set<int>aset;
	for (int i = 0; i < M; ++i) {
		int a, b; cin >> a >> b; a--; b--;
		aedges[a].push_back(b);
		aedges[b].push_back(a);
		ps[a].first++;
		ps[b].first++;
		aset.emplace(a);
		aset.emplace(b);
	}
	for (auto &p : ps) {
		if (p.first == 0)p.first = -1e8;
	}
	
	map<int, int>mp;
	for (int i = 0; i <aset.size(); ++i) {
		auto it = max_element(ps.begin(), ps.end(), [](const pair<int,int> &l, const  pair<int, int>&r) {
			return l.first < r.first;
		});
		for (auto e : aedges[it->second]) {
			ps[e].first--;
		}
		it->first = -1;
		mp[it->second] = i;
	}
	vector<vector<int>>realedges(mp.size());
	for (int i = 0; i < aedges.size(); ++i) {
		for (auto e : aedges[i]) {
			if (mp[i] < mp[e]) {
				realedges[mp[i]].push_back(mp[e]);
			}
		}
	}
	vector<int>used(mp.size());
	int ans = getans(realedges, 0, 0, used);
	if (ans == 33) {
		cout << "Impossible" << endl;
	}
	else {

		cout << ans << endl;
	}
	//for()
	return 0;
}

Measured memory_bytes: 3956
#include <iostream>

using namespace std;

int main(){
	string S;
	cin >> S;
	
	
	int a = 0, n = S.length();
	for(int i = 0; i < n; i ++){
		if(S[i] == '+')
			a++;
		else
			a --;
	}
	
	cout << a;
	
	return 0;
}

Measured memory_bytes: 256
import sys
import heapq
from operator import itemgetter
from collections import deque, defaultdict, Counter
from bisect import bisect_left, bisect_right
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
MOD = 10**9 + 7

def sol():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))

    front = 0
    back = 0
    for i in range(N):
        for j in range(i + 1, N):
            if A[i] > A[j]:
                front += 1
    for i in range(N):
        for j in range(i):
            if A[i] > A[j]:
                back += 1

    ans = (((front * K * (K + 1) // 2) % MOD) + ((back * (K - 1) * K // 2) % MOD)) % MOD
    print(ans)


sol()

Measured memory_bytes: 42220
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val
 
using namespace std;
using namespace __gnu_pbds;
 	// find_by_order()  // order_of_key
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
#define f(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(ll i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inff (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
#define flush fflush(stdout) 
#define primeDEN 727999983
#define SPEED ios_base::sync_with_stdio(false) ;cin.tie(NULL) ;cout.tie(NULL) ;
#define fp(i,a,n) for(ll i=n-1; i>a ;i--)
#define deb(x) cout << #x << " ---> " << x << endl;
#define X first
#define Y second
#define pia 3.1415926536
#define mod 1000000007
#define mod2 998244353

#define ml map<ll,ll>
#define mll map<pll,ll>
#define vvl vector<vl>
#define vvi vector<vi>
#define letsh(a,b) a<<b
#define rigsh(a,b) a>>b 
mt19937 rng32(chrono::steady_clock::now().time_since_epoch().count()) ;
		bool sortbysec(const pair<int,int> &a, 
		      const pair<int,int> &b) 
		{ 
		    return (a.second < b.second); 
		} 	   
		
		  ll power(ll a,ll n)
		{
		ll ans=1;
		while(n)
		{
		if(n&1) ans=(ans*a)%mod;
		a=(a*a)%mod ;
		n=n>>1;
		 }
		 return ans;
		}
		ll power2(ll a,ll n)
		{
		ll ans =1 ;
		while(n)
		{
			if(n&1) ans =(ans*a) ;
			n =n>>1 ;
			a = (a*a) ;
		  }
		  return ans ;
		}
		ll lcm(ll a, ll b)
		{
		       return a / __gcd(a, b) * b;
		}
#define N 100050
#define M 400060
         vll dir({{1, 0}, {-1, 0}, {0, 1}, {0, -1}}) ;
         bool doOverlap(pll l1, pll r1, pll l2, pll r2) 
{ 
    // If one rectangle is on left side of other 
    if (l1.X>= r2.X || l2.X >= r1.X) 
        return false; 
  
    // If one rectangle is above other 
    if (l1.Y <= r2.Y || l2.Y <= r1.Y) 
        return false; 
  
    return true; 
} 
         void solve()
		 {
		   ll n ;cin>>n ;
		   vl sum(n+4,0) ,a(n+4,0) ;
		   ll ans =0 ;
		   f(i,1,n+1) cin>>a[i] ;
		   fd(i,n,1) sum[i] =(sum[i+1]+a[i])%mod;
		   f(i,1,n) ans =(ans+(a[i])*(sum[i+1]))%mod ;
		   cout<<ans<<endl ;
 		 }
		
		    
		  
		int main() 
	  	{
	    SPEED
	   ll t  =1 ;
	    while(t--) solve() ;
	    
	    }

Measured memory_bytes: 6408
import sys
from collections import defaultdict

sys.setrecursionlimit(10**7)
input = sys.stdin.readline

n,k = map(int, input().split())
h = []
d = defaultdict(int)
cnt = []
for i in range(n):
    x = int(input())
    h.append(x)
    d[x] += 1

for i in d.items():
    if i[1] >= k:
        print(0)
        exit()

sh = sorted(h)
ans = 1000000001
for i in range(0, n - k + 1):
    ans = min(ans, sh[i + k - 1] - sh[i])
print(ans)


Measured memory_bytes: 20152
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, l, r) for (int i = l; i <= (int)(r); i++)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define all(v) v.begin(), v.end()
#define MOD (int) (1e9+7)
#define INF (int) 1e9
#define LLINF (ll) 1e18

int main(){
    int a, b;
    cin >> a >> b;
    cout << a*b << endl;
    // printf("%d\n", N);
    return 0;
}

Measured memory_bytes: 3596
#define  _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <deque>
#include <queue>
#include <utility>
#include <map>
#include <set>
#include <functional>
#include <math.h>
#include <time.h>
#include <fstream>
#include <list>
#include <climits>

using namespace std;

typedef long long int lld;
typedef long double ld;
typedef vector<int> vi;
typedef vector<lld> vlld;

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

	lld x, k, d;

	cin >> x >> k >> d;

	if (abs(x / d) <= k)
	{
		k -= abs(x / d);

		if (k % 2)
			cout << min(abs(x % d + d), abs(x % d - d));
		else
			cout << abs(x % d);
	}
	else
	{
		if (x >= 0)
			cout << x - k * d;
		else
			cout << abs(x + k * d);
	}

	cout << '\n';

	return 0;
}


Measured memory_bytes: 3644
using System;

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            var s = Console.ReadLine();
            if (s.Length % 2 == 0) s = s.Substring(0, s.Length - 2);
            else s = s.Substring(0, s.Length - 1);
            while (s.Substring(0, s.Length / 2) != s.Substring(s.Length / 2))
            {
                s = s.Substring(0, s.Length - 2);
            }
            Console.WriteLine(s.Length);
        }
    }
}

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

using ll = long long;
using ld = long double;
using vi = vector<int>;
using vll = vector<ll>;
using P = pair<int, int>;

const int INF = 1e9;
const ll INFLL = 1e18;
const int MOD = 1e9 + 7;
const int NIL = -1;
const ld PI = acosl(-1);

#define rep(i,n) for(int i=0; i<(n); ++i)
#define all(n) n.begin(),n.end()

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

int main()
{
	ios::sync_with_stdio(false); cin.tie(nullptr);
	//cout << fixed << setprecision(6);
	int n; cin >> n;
	vi p(n);
	rep(i, n) cin >> p[i];

	sort(all(p));
	reverse(all(p));
	p[0] /= 2;
	ll ans = 0;
	rep(i, n)ans += p[i];

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

Measured memory_bytes: 256
void main() {
	auto N = ri;
	long l = 0, r = N - 1;
	alias Pair = Tuple!(long, "ind", string, "state");
	Pair[] pairs;
	l.writeln;
	stdout.flush();
	pairs ~= Pair(0, rs);
	r.writeln;
	stdout.flush();
	pairs ~= Pair(r, rs);
	if(pairs.any!(p => p.state == "Vacant")) return;

	bool solve() {
		auto m = (l + r) / 2;
		m.writeln;
		stdout.flush();
		auto S = rs;
		if(S == "Vacant") return true;
		else {
			auto p = Pair(m, S);
			foreach(k; 0..2) {
				if(p.state == pairs[k].state && (p.ind - pairs[k].ind).abs % 2 == 1) {
					pairs[(k+1)%2] = p;
				} else if(p.state != pairs[k].state && (p.ind - pairs[k].ind).abs % 2 == 0) {
					pairs[(k+1)%2] = p;
				}
			}
			auto arr = pairs.map!(p => p.ind).array.sort().array;
			l = arr[0], r = arr[1];
		}
		return false;
	}
	while(!solve()) {}
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

Measured memory_bytes: 852
#include <bits/stdc++.h>
using namespace std;
#define MAX 1005

int A[MAX], n;

void Myswap(int b, int e, int t) {
	int i;
	for (i = 0; i < e - b; i++) {
		swap(A[i + b], A[i + t]);
	}
}

int main(void) {
	int i;
	cin >> n;
	for (i = 0; i < n; i++) {
		cin >> A[i];
	}
	int q, b, e, t;
	cin >> q;
	while (q--) {
		cin >> b >> e >> t;
		Myswap(b, e, t);
	}
	for (i = 0; i < n; i++) {
		if (i) cout << " ";
		cout << A[i];
	}
	cout << endl;
}


Measured memory_bytes: 3100
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    static final FS sc = new FS();  // 封装输入类
    static final PrintWriter pw = new PrintWriter(System.out);
    public static void main(String[] args) {
        int n = sc.nextInt();
        long[] a = new long[n];
        for (int i = 0;i < n;i++) {
            a[i] = sc.nextLong();
        }
        long money = 1000;
        for (int i = 1; i < n; i++) {
            long k = 0;
            if (a[i - 1] < a[i]) {
                k = money / a[i - 1];
            }
            money += k * (a[i] - a[i - 1]);
        }
        pw.println(money);
        pw.flush();
    }

    static class FS {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");
        String next() {
            while(!st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch(Exception ignored) {}
            }
            return st.nextToken();
        }
        int[] nextArray(int n) {
            int[] a = new int[n];
            for(int i = 0;i < n;i++) {
                a[i] = nextInt();
            }
            return a;
        }
        int nextInt() {
            return Integer.parseInt(next());
        }
        long nextLong() {
            return Long.parseLong(next());
        }
    }
}

Measured memory_bytes: 32920
#include <bits/stdc++.h>
#define DEBUG fprintf(stderr, "Passing [%s] line %d\n", __FUNCTION__, __LINE__)
#define File(x) freopen(x".in","r",stdin); freopen(x".out","w",stdout)

using namespace std;

typedef long long LL;
typedef pair <int, int> PII;
typedef pair <int, PII> PIII;

inline int gi()
{
	int f = 1, x = 0; char c = getchar();
	while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
	while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return f * x;
}

inline LL gl()
{
	LL f = 1, x = 0; char c = getchar();
	while (c < '0' || c > '9') {if (c == '-') f = -1; c = getchar();}
	while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return f * x;
}

const int INF = 0x3f3f3f3f, N = 200003, M = N << 1;

int h, n, m;
int fa[N];
int tot, head[N], ver[M], nxt[M];
bool vis[N];
int ans[N], bu[N];

inline void add(int u, int v) {ver[++tot] = v, nxt[tot] = head[u], head[u] = tot;}

int main()
{
	//File("");
	n = gi(), m = gi();
	for (int i = 1; i <= m; i+=1)
	{
	    int u = gi(), v = gi();
	    add(u, v), add(v, u);
	}
	queue <int> q;
	vis[1] = true;
	q.push(1);
	while (!q.empty())
	{
	    int u = q.front(); q.pop();
	    for (int i = head[u]; i; i = nxt[i])
	    {
	        int v = ver[i];
	        if (vis[v]) continue;
	        ans[v] = u;
	        vis[v] = true;
	        q.push(v);
	    }
	}
	for (int i = 2; i <= n; i+=1) 
	{
	    if (!vis[i]) {puts("No"); return 0;}
	}
	puts("Yes");
	for (int i = 2; i <= n; i+=1)
	    printf("%d\n", ans[i]);
	return 0;
}

Measured memory_bytes: 7888
#include<bits/stdc++.h>
using namespace std;
string a,b;
int ans=0;

int main()
{	cin>>a>>b;
	if(a[0]==b[0])
		ans++;
	if(a[1]==b[1])
		ans++;
	if(a[2]==b[2])
		ans++;
	cout<<ans<<endl;
	return 0;
} 

Measured memory_bytes: 256
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<chrono>//実行時間計測
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm,accumulate
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//順序保持しないmap
#include<unordered_set>//順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;
//マクロ
//forループ
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#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--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end()
#define SIZE(x) ll(x.size())
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define PI 3.14159265358979323846264338327950L

#define YESNO(T) if(T){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define yesno(T) if(T){cout<<"yes"<<endl;}else{cout<<"no"<<endl;}
#define YesNo(T) if(T){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}

#define int long long
#define Graph vector<vector<int> >
#define PII pair<int,int>
#define VI vector<int>
#define VVI vecotor<vector<int> >
#define VPII vector<pair<int,int> >

template<typename A, size_t N, typename T>

void Fill(A (&array)[N], const T &val) {
	std::fill( (T*)array, (T*)(array + N), val );
}


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//ここにグローバル変数宣言
int H, W, sh, sw, gh, gw;
int dh[4] = {1, 0, -1, 0};
int dw[4] = {0, 1, 0, -1};//BFS関連







//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//ここに関数宣言
int ctoi(char c) {
	switch (c) {
	case '0': return 0;
	case '1': return 1;
	case '2': return 2;
	case '3': return 3;
	case '4': return 4;
	case '5': return 5;
	case '6': return 6;
	case '7': return 7;
	case '8': return 8;
	case '9': return 9;
	default: return 0;
	}
}










//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
signed main() {
	//入力の高速化用のコード
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	
int N;
cin>>N;
bool ok=true;
REP(i,N){
	int a;
	cin>>a;
	if(a%2==0){
		if(a%3!=0&&a%5!=0){
			ok=false;
		}
	}
}

if(ok)cout<<"APPROVED"<<endl;
else cout<<"DENIED"<<endl;







































return 0;

}







Measured memory_bytes: 3604
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <sstream>
#include <string>
#include <map>
#include <set>
using namespace std;

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


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

	rep(i, N/4+1) {
		rep(j, N/7+1) {
			if ((4*i+7*j)==N) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
}

Measured memory_bytes: 256
import sys

def check(s, x, y):

    while s and s[0] == "F":
        s = s[1:]
        x -= 1
    while s and s[-1] == "T":
        s = s[:-1]

    d = 0
    vxs = []
    vys = []
    while s:
        while s and s[0] == "T":
            s = s[1:]
            d ^= 1
        l = 0
        while s and s[0] == "F":
            s = s[1:]
            l += 1
        if d:
            vys.append(l)
        else:
            vxs.append(l)

    def check1(vs, t):
        a = 0
        for v in sorted(vs, reverse=True):
            if t < a:
                a -= v
            else:
                a += v
        return a == t

    r = check1(vxs, x) and check1(vys, y)
    return r

if __name__ == "__main__":
    s = sys.stdin.readline().strip()
    x, y = [int(n) for n in sys.stdin.readline().strip().split()]
    if check(s, x, y):
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 3188
k = int(input())
s = input()
mod = 10 ** 9 + 7

MAX = 2 * 10 ** 6

fact = [1] * (MAX + 1)
for i in range(1, MAX + 1):
    fact[i] = (fact[i-1] * i) % mod

inv = [1] * (MAX + 1)
for i in range(2, MAX + 1):
    inv[i] = inv[mod % i] * (mod - mod // i) % mod

fact_inv = [1] * (MAX + 1)
for i in range(1, MAX + 1):
    fact_inv[i] = fact_inv[i-1] * inv[i] % mod


def comb(n, k):
    if n < k:
        return 0
    return fact[n] * fact_inv[n-k] * fact_inv[k] % mod


ln = len(s)

ans = 0
pow25 = 1
pow26 = pow(26, k, mod)
inv26 = pow(26, mod - 2, mod)
for i in range(ln, k + ln + 1):
    ans += pow25 * pow26 % mod * comb(i - 1, ln - 1) % mod
    ans %= mod
    pow25 *= 25
    pow25 %= mod
    pow26 *= inv26
    pow26 %= mod

print(ans)


Measured memory_bytes: 132944
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  ll n = 0;
  cin >> n;
  map<ll,ll> p;
  ll copy = n;
  ll now = 0;
  now = 1;
  for(int i = 2;i <= sqrt(n);i++){
    while(copy % i == 0){
      p[i]++;
      copy /= i;
      now *= i;
    }
  }
  if(now != n)p[n / now]++;
  ll res = 0;
  for(auto i:p){
    ll now = 0;
    ll c = 0;
    while(1){
      if(now > i.second){
        break;
      }
      c++;
      now += c;
    }
    res += c - 1;
  }  
  cout << res << endl;
}

Measured memory_bytes: 3728
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <unordered_map>
#include <complex>
#include <algorithm>
#include <deque>

using namespace std;
using i64 = int_fast64_t;
using u64 = uint_fast64_t;
using i32 = int_fast32_t;
using u32 = uint_fast32_t;

#define int i64

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; }
const int INF = 1LL << 60;

signed main() {
	i64 n, x, y;
	cin >> n >> x >> y;

	vector<i64> dp(n, INF);
	dp[0] = 0;

	vector<i64> dists(n, INF);
	dp[0] = 0;

	vector<i64> ks(n, 0);
	for(size_t k = 0; k < n; k++) {
		for(size_t i = 0; i < n; i++) dists[i] = abs((i64)i - (i64)k);
		chmin(dists[y - 1], dists[x - 1] + 1);
		chmin(dists[x - 1], dists[y - 1] + 1);
		for(size_t i = 0; i < n; i++) chmin(dists[i], dists[x - 1] + abs(x - 1 - (i64)i));
		for(size_t i = 0; i < n; i++) chmin(dists[i], dists[y - 1] + abs(y - 1 - (i64)i));

		for(size_t i = 0; i < n; i++) {
			// cout << dists[i] << " ";
			ks[dists[i]]++;
			dists[i] = INF;
		}
		// cout << endl;
	}

	for(size_t i = 1; i < n; i++) cout << ks[i] / 2 << endl;

	return 0;
}


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

#define range 524289
#define mod 1000000007
#define eps 1e-9
#define PI 3.14159265358979323846
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define ALL(V) V.begin(), V.end()
#define _ <<" "<<

using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef vector<vi> vvi;
typedef pair <int, int> ii;
typedef pair<int, pair<int,int> > iii;
typedef vector<ii> vii;
typedef vector<iii> viii;


int main(int argc, char const *argv[])
{
	// #ifndef ONLINE_JUDGE
 //    	freopen("input.txt", "r", stdin);
 //    	freopen("output.txt", "w", stdout);
	// #endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n,m,l;
    cin>>n;
    vi a(n);
    for (int i = 0; i < n; ++i)
    {
    	cin>>a[i];
    }
    int count =0;
    for (int i = n-1; i >=1; --i)
    {
    	if(a[i]-a[i-1]>=0) continue;
    	else if(a[i-1]-a[i]==1){
    		a[i-1]--;
    	}
    	else{
    		count = 1;
    		break;
    	}
    }
    if(count) cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int gcd(int a,int b)
{
	return b==0?a:gcd(b,a%b);
}

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

Measured memory_bytes: 0
L = list(map(int,input().split()))

W=L[0]
H=L[1]
x=L[2]
y=L[3]
r=L[4]

if ((x-r)<0 or (x+r)>W):
    print('No')
elif((y-r)<0 or (y+r)>H):
    print('No')
else:
    print('Yes')


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

int main() {
    string s;
    std::cin >> s;
    ll n = s.length();
    
    // i番目までみて、2個使っているかどうか(0,1)
    vector<vector<ll>> dp(n+1,vector<ll>(2,0));
    
    for (int i = 0; i < n; i++) {
        if(i==0){
            dp[i+1][1] = 0;
            dp[i+1][0] = 1;
            continue;
        }
        
        if(s[i]!=s[i-1]) dp[i+1][0] = max(dp[i+1][0],dp[i][0]+1);
        dp[i+1][0] = max(dp[i+1][0],dp[i][1]+1);
        
        if(i>=3)if(s.substr(i-1,2)!=s.substr(i-3,2)) dp[i+1][1] = max(dp[i+1][1],dp[i-1][1]+1);
        dp[i+1][1] = max(dp[i+1][1],dp[i-1][0]+1);
    }
    
    std::cout << max(dp[n][0], dp[n][1]) << std::endl;
}


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

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

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

using namespace std;

#define fr(i,a,b) for(int i=a;i<b;++i)
#define fdr(i,a,b) for(int i=b-1;i>=a;--i)
/////////////

int const N = 1e5 + 41;
int const INF = 1e9 + 41;

int a[N], suf[N], pref[N];
int n, ans;

void solve(){
	int t;
	cin >> n >> t;
	fr(i, 1, n+1) cin >> a[i];
	pref[0] = INF;
	suf[n+1] = -INF;
	fr(i, 1, n+1) pref[i] = min(pref[i-1], a[i]);
	fdr(i, 1, n+1) suf[i] = max(suf[i+1], a[i]);
	int maxi = 0;
	fr(i, 1, n) maxi = max(maxi, suf[i+1] - pref[i]);
	fr(i, 1, n) if(suf[i+1] - a[i] == maxi) ++ans;
	cout << ans << endl;
}

int main(){
#ifdef _DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif
	
	solve();

	return 0;
}

Measured memory_bytes: 1408
n=int(input())
s=[input() for i in range(n)]

cnt=[0]*5

for i in range(n):
    if s[i][0]=='M':cnt[0]+=1
    elif s[i][0]=='A':cnt[1]+=1
    elif s[i][0]=='R':cnt[2]+=1
    elif s[i][0]=='C':cnt[3]+=1
    elif s[i][0]=='H':cnt[4]+=1
    else:pass

ans=0
keta=[0]*5
for i in range(7,29):
 
    for x in range(5):
        keta[x]=(i>>x)&1

    if sum(keta)!=3:
        continue
    
    product=1
    for j in range(5):
        if keta[j]==1:
            product*=cnt[j]

    ans+=product

print(ans)

Measured memory_bytes: 16100
# -*- coding: utf-8 -*-
n, m = map(int, input().split())
lamp_list = [list(map(int, input().split())) for i in range(m)]
#for i in range(m):
#  lamp_list.append(input())
p = list(map(int, input().split()))
counter = 0

for i in range(2 ** n):
  num_list = []
  for j in range(n):
    if (i >> j) & 1:
      num_list.append(j + 1)
  #print(lamp_list)
  count_flag = True
  for _index, lamp in enumerate(lamp_list):
    lamp_counter = 0
    for lamp_num in lamp[1:]:
      if lamp_num in num_list:
        lamp_counter += 1
    if lamp_counter % 2 != p[_index]:
      count_flag = False
      break
  if count_flag:
    #print(_index, lamp[1:], num_list, lamp_counter, p[_index])
    counter += 1
  #print(_index, lamp, lamp_counter, p, counter)
print(counter)



Measured memory_bytes: 3192
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

def input():
    return sys.stdin.readline().strip()

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

# 改行またはスペース区切りの入力をすべて読み込んでイテレータを返します。
def get_all_int():
    return map(int, open(0).read().split())

def rangeI(it, l, r):
    for i, e in enumerate(it):
        if l <= i < r:
            yield e
        elif l >= r:
            break

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

INF = 999999999999999999999999
MOD = 10**9+7

a,b = get_nums_l()

print(a*b)


Measured memory_bytes: 67612
#include<cstring>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;

int main()
{
	int w,a,b;
	scanf("%d %d %d",&w,&a,&b);
	if (a<=b && a+w>=b) printf("0");
	else
	if (b<=a && b+w>=a) printf("0");
	else
	if (a<b) printf("%d",b-a-w);
	else printf("%d",a-b-w);
	printf("\n");
	return 0;
 }  

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define FIN         ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ii          pair<int,int>
#define F           first
#define S           second
#define pb          push_back
#define all(x)      (x).begin(),(x).end()
#define rall(x)     (x).rbegin(),(x).rend()
#define fore(i,a,b) for(int i = a;i < b; i+= 1)
#define forr(i,a)   for(int i = a; i >= 0; i--)
#define fori(i,m)   for(auto i = m.begin(); i != m.end(); i++) 
#define w(t)        while(t--)
#define sz(s)       int(s.size())
#define cls(a,car)  memset(a,car,sizeof (a))
#define db(x)       cerr << #x << " is " << x << '\n'
#define FI          freopen("input.txt", "r", stdin)
#define FO          freopen("output.txt", "w", stdout)
#define EjecuteTime cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n"
#define angle(x)    double(x * acos(-1) / 180.0)
using namespace std;
typedef long long   ll;
typedef vector<int> vi;
typedef vector<ii>  vii;
const int N = 1e4 + 5;
const ll mod = 1e9 + 7;
const double E = 1e-6;
//int dx[] = {0, -1}, dy[] = {-1, 0};
//int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
//int dx[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy[] = {0, 1, 1, 1, 0, -1, -1, -1};
//int dx[] = {2, 1, -1, -2, -2, -1, 1, 2}, dy[] = {1, 2, 2, 1, -1, -2, -2, -1};
// fflush(stdout)
// cout << flush
// a + b = a ^ b + 2 * (a & b)
void solve(){
    int sum = 0;
    string str;
    cin >> str;
    for(auto i : str)
        sum += (i - '0');
    cout << (sum % 9 ? "No" : "Yes") << '\n';
}
int main(){
    FIN;
    int t = 1;
    //cin >> t;
    for(int i = 1; i <= t; i++){
        solve();
    }
    //EjecuteTime;
    return 0;
}       


Measured memory_bytes: 3764
import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		long k = sc.nextLong();
		double  org = 100;
		sc.close();
		double a = 1.01;
		int i  = 1;
		while (true) {
			org = Math.floor(org*a);
			if (org >= k) break;
			i= i+1;
		}
		System.out.println(i);
	}
}


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

bool isPalindrome( string s, int l )
{
    for ( int i = 0; i < l / 2; i++ )
        if ( s[i] != s[l-i-1] )
            return false;
    
    return true;
}

int main( void )
{
    string s;
    cin >> s;
    int l = s.length();
    string firstHalf = s.substr(0,l/2);
    string secondHalf = s.substr(l/2+1);
    
    bool kaibun = isPalindrome(s,l);
    bool tsu = isPalindrome(firstHalf,l/2);
    bool yoi = isPalindrome(secondHalf,l/2);
    
    if ( kaibun && tsu && yoi )
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007 

ll lr[502][502];
int main() {
	ll n,m,q;
	cin>>n>>m>>q;
	for(ll i=0;i<m;i++){
		ll x,y;
		cin>>x>>y;
		x--;y--;
		lr[x][y]++;
	}
	for(ll i=0;i<n;i++){
		for(ll j=1;j<n;j++){
			lr[i][j]+=lr[i][j-1];
		}
	}
	for(ll i=0;i<q;i++){
		ll x,y;
		cin>>x>>y;
		x--;y--;
		ll sum=0;
		for(ll j=x;j<=y;j++){
			sum+=lr[j][y];
		}
		cout <<sum<<endl;
	}
	// your code goes here
	return 0;
}

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

int solve(int n){
    int cnt = 2;
    for (int i = 3; i*i <= n; i++) {
        if (n % i == 0) {

            if (n / i == i)
                cnt++;

            else
                cnt = cnt + 2;
        }
    }
    return cnt;
}
int main(){
    int n;
    cin >> n;
    int ans = 0;
    for (int i = 1; i <= n; i++){
        if (solve(i) == 8 && (i&1))ans++;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
'''
N=int(input())
N,M=list(map(int,input().split()))
S=input()

li=[]
for i in range(N):
    li.append(list(map(int,input().split())))
'''

H,W=list(map(int,input().split()))
h,w=list(map(int,input().split()))

res=h*W+w*H-w*h
print(H*W-res)

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

int main()
{
	char s[1005], t[1005];
	scanf("%s", s);
	scanf("%s", t);
	int sl = strlen(s), tl = strlen(t), ans = sl+tl, cnt;
	for (int k = 0; k <= sl-tl; ++k) {
		cnt = 0;
		for (int i = 0; i < tl; ++i) {
			cnt += (t[i] != s[k+i]);
		}
		ans = min(ans, cnt);
	}
	printf("%d\n", ans);
}

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

double r[21],g[21],b[21];

double dabs(double d) {
    if(d < 0) return -d;
    return d;
}

inline unsigned next_set(unsigned x) {
    unsigned smallest = x&-x;
    unsigned ripple = x + smallest;
    unsigned new_smallest = ripple & -ripple;
    unsigned ones = ((new_smallest/smallest)>>1)-1;
    return ripple | ones;
}

double diff(int i,int j) {
    return dabs(r[i]-r[j])*dabs(r[i]-r[j]) + dabs(g[i]-g[j])*dabs(g[i]-g[j])
        + dabs(b[i]-b[j])*dabs(b[i]-b[j]);
}

int main() {
    int n,m;
    cin>>n>>m;
    if(m == 0) {
        cout<<"0"<<endl;
        return 0;
    }

    for(int i=0; i<n; ++i) cin>>r[i]>>g[i]>>b[i];

    unsigned st = (1<<m)-1;
    double ans = 0;
    while(st < (1<<n)) {
        double tmp = 0;
        for(int i=0; i<n; ++i) {
            for(int j=i+1; j<n; ++j) {
                if((1<<i)&st) {
                    if((1<<j)&st) {
                        tmp += diff(i,j);
                    }
                }
            }
        }
        ans = max(ans, tmp);
        st = next_set(st);
    }
    printf("%.12f\n", ans);
}

Measured memory_bytes: 932
def main():
    N, Q = [int(i) for i in input().split()]
    V = [[] for _ in range(N)]
    for _ in range(N - 1):
        a, b = [int(i) - 1 for i in input().split()]
        V[a].append(b)
        V[b].append(a)
    C = [0] * N
    for _ in range(Q):
        p, x = [int(i) for i in input().split()]
        C[p - 1] += x
    cur = [(0, 0, -1)]
    while cur:
        n, x, f = cur.pop()
        C[n] = x = C[n] + x
        for c in V[n]:
            if c != f:
                cur.append((c, x, n))
    print(' '.join(str(c) for c in C))

main()


Measured memory_bytes: 65308
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#define repp(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define repm(i,a,b) for(int i=(int)a;i>(int)b;--i)
using ll=long long;
static const ll mod = 1e9 + 7;
static const ll INF = 1LL << 50;
using namespace std;

int main() {
	int n, a, b, c, d;
	cin >> n >> a >> b >> c >> d;
	string s;
	cin >> s;
	a--; b--; c--; d--;
	bool judge = true;
	for (int i = a+1; i < max(c, d); ++i) {
		if (s[i] == '#' && s[i + 1] == '#') {
			cout << "No" << endl; return 0;
		}
	}
	if (c < d) {
		cout << "Yes" << endl;
		return 0;
	}
	for (int i =b-1; i < d ; ++i) {
		if (s[i] == '.' && s[i + 1] == '.' && s[i + 2] == '.') {
			cout << "Yes" << endl; return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 

using namespace std;
using namespace __gnu_pbds; 

#define ff              first
#define ss              second
#define ll              int64_t
#define ld              long double
#define nl              cout<<"\n"
#define all(v)          v.begin(),v.end()
#define mset(a,v)       memset((a),(v),sizeof(a))
#define forn(i,a,b)     for(int64_t i=int64_t(a);i<int64_t(b);++i)
#define forb(i,a,b)     for(int64_t i=int64_t(a);i>=int64_t(b);--i)
#define fastio()        ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ordered_set     tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> 

#define mod         1000000007
#define mod2        998244353 
#define inf         1000000000000007
#define pi          3.14159265358979323846

template<class L,class R> ostream& operator<<(ostream& out,pair<L,R> &p)        {return out<<"("<<p.ff<<", "<<p.ss<<")";}
template<class T> ostream& operator<<(ostream& out,vector<T> &v)                {out<<"[";for(auto it=v.begin();it!=v.end();++it){if(it!=v.begin())out<<", ";out<<*it;}return out<<"]";}
template<class T> ostream& operator<<(ostream& out,deque<T> &v)                 {out<<"[";for(auto it=v.begin();it!=v.end();++it){if(it!=v.begin())out<<", ";out<<*it;}return out<<"]";}
template<class T> ostream& operator<<(ostream& out,set<T> &s)                   {out<<"{";for(auto it=s.begin();it!=s.end();++it){if(it!=s.begin())out<<", ";out<<*it;}return out<<"}";}
template<class L,class R> ostream& operator<<(ostream& out,map<L,R> &m)         {out<<"{";for(auto it=m.begin();it!=m.end();++it){if(it!=m.begin())out<<", ";out<<*it;}return out<<"}";}

void dbg_out() {cerr<<"]\n";}
template<typename Head,typename... Tail> 
void dbg_out(Head H,Tail... T) {cerr<<H;if(sizeof...(Tail))cerr<<", ";dbg_out(T...);}
#ifdef LOCAL
	#define dbg(...) cerr<<"["<<#__VA_ARGS__<<"] = [",dbg_out(__VA_ARGS__)
#else
	#define dbg(...)
#endif

ll count_digits(ll n)     {ll dig=floor(log10(n)+1);return dig;}
ll mpow(ll x,ll y,ll p)   {ll r=1;x=x%p;while(y>0){if(y&1)r=(r*x)%p;y=y>>1;x=(x*x)%p;}return r;}
ll mod_inv(ll a,ll m)     {ll m0=m,y=0,x=1;if(m==1)return 0;while(a>1){ll q=a/m,t=m;m=a%m,a=t;t=y;y=x-q*y;x=t;}if(x<0)x+=m0;return x;}
/* const ll MAXN=1000007;ll spf[MAXN+5];vector<ll> prime; */
/* void sieve(ll n)        {forn(i,2,MAXN+1)spf[i]=i;for(ll i=2;i*i<=n;i++)if(spf[i]==i)for(ll j=i*i;j<=n;j+=i)if(spf[j]==j)spf[j]=i;forn(i,2,MAXN+1)if(spf[i]==i)prime.push_back(i);} */

//-------------------------------L_I_Erq34-------------------------------

int main()
{
	fastio();
	ll z,n,m,t,k,i,j,l,d,h,r;
	cin>>n;
	if(n==1)
		cout<<"0\n";
	else
		cout<<"1\n";
	cerr<<"\nTime elapsed: "<<1000*clock()/CLOCKS_PER_SEC<<"ms\n";
	return 0;
}


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

int main(){
	int n;
	int count = 0;
	cin >> n;
	vector<int> v(n);
	for(int i =0 ; i<n; i++){
		cin >> v[i];
	}
	sort(v.begin(), v.end());
	reverse(v.begin(), v.end());
	for(int i = 0 ; i<n; i++){
		if(i%2) count -= v[i];
		else count += v[i];
	}
	cout << count;
	return 0;
}



Measured memory_bytes: 256
import numpy as np
import sys

N,M,X,Y=[int(i) for i in input().split()]

x=[int(i) for i in input().split()]
y=[int(i) for i in input().split()]
x.append(X)
y.append(Y)
x.sort()
y.sort()

if(x[N]>=y[0]):
    print("War")
    sys.exit()
print("No War")


Measured memory_bytes: 17328
#include<bits/stdc++.h>
#define ll long long
using namespace std;
void qmax(int &x,int y) {if (x<y) x=y;}
void qmin(int &x,int y) {if (x>y) x=y;}
inline int read()
{
	char s;
	int k=0,base=1;
	while((s=getchar())!='-'&&s!=EOF&&!(isdigit(s)));
	if(s==EOF)exit(0);
	if(s=='-')base=-1,s=getchar();
	while(isdigit(s)){k=k*10+(s^'0');s=getchar();}
	return k*base;
}
inline void write(int x)
{
	static char cnt,num[15];cnt=0;
	if (!x)
	{
		putchar('0');
		return;
	}
	for (;x;x/=10) num[++cnt]=x%10;
	for (;cnt;putchar(num[cnt--]+48));
}
const int maxn=100000;
int n,id,X,Y;
int to[maxn<<1],ne[maxn<<1],po[maxn];
int sg[maxn];
void add(int x,int y)
{
	id++;
	to[id]=y;ne[id]=po[x];po[x]=id;
}
void dfs(int x,int fa)
{
	for (int i=po[x];i;i=ne[i])
	{
		if (to[i]!=fa) 
		{
			dfs(to[i],x);
			sg[x]^=(sg[to[i]]+1);
		}
	}
}
int main()
{
#ifdef ylx
	freopen("agc017d.in","r",stdin);
	freopen("agc017d.out","w",stdout);
#endif
	n=read();
	for (int i=1;i<n;i++)
	{
		X=read();Y=read();
		add(X,Y);
		add(Y,X);
	}
	dfs(1,-1);
	if (sg[1])
	{
		printf("Alice");
	} else printf("Bob");
	return 0;
}


Measured memory_bytes: 7296
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 998244353;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd_calc(T a, T b){ if(b){ return gcd_calc(b, a % b); }else{ return a; }}
template<class T> T gcd(T a, T b){ if(a < b) swap(a, b); return gcd_calc(a, b); }
template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }
inline int at(int x, int k){ return (x >> k) & 1; }
random_device rnd;

string day[7] =  {"Sunny", "Cloudy", "Rainy"};

int main(){
    string S;
    cin >> S;
    if(S[0] != S[1] && S[2] != S[3] && S[1] != S[2]){
        cout << "Good" << endl;
    }else{
        cout << "Bad" << endl;
    }
}


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

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

  vector<int> D1(N), D2(N);
  int counter = 0;
  string ans = "No";

  for (int i = 0; i < N; i++) {
    cin >> D1[i] >> D2[i];
    counter = D1[i] == D2[i] ? counter + 1 : 0;
    if (counter == 3) {
      ans = "Yes";
      break;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3632
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
import numpy as np
INF = float("inf")
#d = defaultdict(int)
#d = defaultdict(list)
#N = int(input())
#A = list(map(int,input().split()))
#S = list(input())
#S.remove("\n")
#N,M = map(int,input().split())
#S,T = map(str,input().split())
#A = [int(input()) for _ in range(N)]
#S = [input() for _ in range(N)]
#A = [list(map(int,input().split())) for _ in range(N)]
S = list(input())[:-1]
a = 10*int(S[0])+int(S[1])
b = 10*int(S[2])+int(S[3])
if (a > 12 or a == 0) and (b > 12 or b == 0):
    print("NA")
elif a > 12 or a == 0:
    print("YYMM")
elif b > 12 or b == 0:
    print("MMYY")
else:
    print("AMBIGUOUS")

Measured memory_bytes: 13672
def segfunc(x, y):
    return max(x,y)
n,k = map(int,input().split())
ide_ele = 0
class SegTree:
    def __init__(self, init_val, segfunc, ide_ele):
        n = len(init_val)
        self.segfunc = segfunc
        self.ide_ele = ide_ele
        self.num = 1 << (n - 1).bit_length()
        self.tree = [ide_ele] * 2 * self.num
        # 配列の値を葉にセット
        for i in range(n):
            self.tree[self.num + i] = init_val[i]
        # 構築していく
        for i in range(self.num - 1, 0, -1):
            self.tree[i] = self.segfunc(self.tree[2 * i], self.tree[2 * i + 1])

    def update(self, k, x):
        k += self.num
        self.tree[k] = x
        while k > 1:
            self.tree[k >> 1] = self.segfunc(self.tree[k], self.tree[k ^ 1])
            k >>= 1

    def query(self, l, r):

        res = self.ide_ele

        l += self.num
        r += self.num
        while l < r:
            if l & 1:
                res = self.segfunc(res, self.tree[l])
                l += 1
            if r & 1:
                res = self.segfunc(res, self.tree[r - 1])
            l >>= 1
            r >>= 1
        return res

A = []

for _ in range(n):
    A.append(int(input()))
B = [0]*300010
seg = SegTree(B,segfunc,ide_ele)
for a in A:
    tmp = seg.query(max(a-k,0),min(a+k,300000)+1)
    seg.update(a,tmp+1)
print(seg.query(0,300001))


Measured memory_bytes: 142080
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  if(s[1] != s[2]) printf("No\n");
  else if(s[0] == s[1] || s[3] == s[1]) printf("Yes\n");
  else printf("No\n");
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
typedef long long ll;
using namespace std;
 
ll solve(ll h){
    if(h==1) return 1;
    else return 2*solve(h/2)+1;
}

int main(){
    ll h; cin >> h;
 	 ll ans=0;
     ans=solve(h);
  cout << ans << endl;
    return 0;
}

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

int main() {
  int A, B;
  cin >> A >> B;
  
  if( A % 2 == 0 || B % 2 == 0 ){
    cout << "No" << endl;
  }else{
    cout << "Yes" << endl;
  }
}

Measured memory_bytes: 256