akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Yes                \
    cout << "Yes" << endl; \
    return 0;
#define No                \
    cout << "No" << endl; \
    return 0;
using namespace std;
using ll = long long;
const int INF = 1001001001;
const int MOD = 1000000007;
typedef long long ll;

template <typename T>
void print(const T &v);

int main()
{
    int N, M;
    cin >> N >> M;
    vector<vector<int>> G(N);
    rep(i, M)
    {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    for (auto as : G[0])
    {
        for (auto a : G[as])
        {
            if (a == N - 1)
            {
                cout << "POSSIBLE" << endl;
                return 0;
            }
        }
    }
    cout << "IMPOSSIBLE" << endl;
    return 0;
}

// Use For Debug
template <typename T>
void print(T const &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << " ";
        cout << v[i];
    }
    cout << endl;
}


Measured memory_bytes: 12016
import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List

main :: IO ()
main = do
  solve <$> getl (map read . words) >>= putStrLn

solve :: [Int] -> String
solve [sx, sy, tx, ty] = r1 ++ r2 ++ r3 ++ r4
  where
    w = tx - sx
    h = ty - sy
    r1 = replicate h 'U' ++ replicate w 'R'
    r2 = replicate h 'D' ++ replicate w 'L'
    r3 = "L" ++ replicate (h+1) 'U' ++ replicate (w+1) 'R' ++ "D"
    r4 = "R" ++ replicate (h+1) 'D' ++ replicate (w+1) 'L' ++ "U"

getl :: (String -> a) -> IO a
getl f = f <$> getLine


Measured memory_bytes: 1020
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

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

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};

#[allow(unused_imports)]
use std::io::Write;

fn main() {
    input!{
      n: usize,
      gsbs: [[usize; 3]; 2],
    }

    let mut dp = vec![0; n+1];
    for i in 0..3 {
        let r1 = gsbs[0][i];
        let r2 = gsbs[1][i];
        for w in 0..n+1 {
            if w + r1 <= n && r2 >= r1 {
                dp[w + r1] = max(dp[w + r1], dp[w] + r2 - r1);
            }
        }
    }
    let n = n + *dp.iter().max().unwrap();
    let mut dp = vec![0; n+1];
    for i in 0..3 {
        let r1 = gsbs[1][i];
        let r2 = gsbs[0][i];
        for w in 0..n+1 {
            if w + r1 <= n && r2 >= r1 {
                dp[w + r1] = max(dp[w + r1], dp[w] + r2 - r1);
            }
        }
    }
    let ans = n + *dp.iter().max().unwrap();
    println!("{}", ans);
}


Measured memory_bytes: 200956
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;

typedef long long LL;
int a[200];
int f[200][200];

int main()
{
	int n , m;
	scanf("%d %d",&n , &m);
	for(int i = 0 ; i <= 9 ; i++){
		for(int j = 0 ; j <= 9 ; j++){
			scanf("%d",&f[i][j]);
		}
	}
	for(int k = 0 ; k <= 9 ; k++){
		for(int i = 0 ; i <= 9 ; i++){
			for(int j = 0 ; j <= 9 ; j++){
				if(f[i][k] + f[k][j] < f[i][j]){
					f[i][j] = f[i][k] + f[k][j];
				}
			}
		}
	}
	LL sum = 0;
	for(int i = 1 ; i <= n ; i++){
		for(int j = 1 ; j <= m ; j++){
			int x;
			scanf("%d",&x);
			if(x != -1 && x != 1){
				sum += f[x][1];
			}
		}
	}
	printf("%lld\n",sum);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
  int n,m;
  cin>>n>>m;
  int minn=int(1e9);
  int maxx=0;
  
  for(int i=1;i<=m;i++)
  {
      int l,r;
      cin>>l>>r;
      minn=min(minn,r);
      maxx=max(maxx,l);
  }
  
  cout << max(0,minn-maxx+1) << endl;
}

Measured memory_bytes: 256
nq = list(map(int, input().split()))
n = nq[0]
q = nq[1]

process_list = []
result_list = []

for i in range(n):
    process = input().split()
    name = process[0]
    time = process[1]
    process_list.append([name, int(time)])

now_time = 0
while process_list != []:
    #print(process_list)
    [name, time] = process_list.pop(0)
    if time <= q:
        now_time += time
        result_list.append([name, now_time])
    else:
        now_time += q
        process_list.append([name, time-q])

for r in result_list:
    print(r[0]+' '+str(r[1]))


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

// Inserted snippets: io, root
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
template<typename H> bool chmin(H& v1, const H v2) { if (v1 > v2) { v1 = v2; return true; } return false; }
template<typename H> bool chmax(H& v1, const H v2) { if (v1 < v2) { v1 = v2; return true; } return false; }
template<typename H> void read(H& head) { cin >> head; }
template<typename H, typename ...T> void read(H& head, T& ...tail) { cin >> head; read(tail...); }
template<typename H> void write(H head) { cout << head << '\n'; }
template<typename H, typename ...T> void write(H head, T ...tail) { cout << head << " "; write(tail...); }
template<typename ...T> void die(T ...tok) { write(tok...); exit(0); }
// End snippets

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);

	int a, b, c, d, e; read(a, b, c, d, e);
	write(15 - a - b - c - d - e);
}


Measured memory_bytes: 3588
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())





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

	double l;
	cin >> l;
	printf("%.8f\n", (l / 3) * (l / 3) * (l / 3));




	return 0;
}

Measured memory_bytes: 256
x = input()
y = input().split()
for u in range(len(y)):
    y[u] = int(y[u])
count = 0
for i in range(1, int(x)-1):
    if y[i - 1] < y[i] and y[i] < y[i + 1]:
        count += 1
    elif y[i - 1] > y[i] and y[i] > y[i + 1]:
        count += 1

print(count)

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

using namespace std;

bool judge(string s, string t) {
  string str = s;
  for (int i = 0; i < s.size(); i++) {
    if (str == t) {
      return true;
    }

    str = str[str.size() - 1] + str.substr(0, str.size()-1);
  }

  return false;
}

int main() {
  string s, t;
  cin >> s >> t;

  if (judge(s, t)) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }

}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
  int m,d;
  int j,i;
  int cnt = 0;
  int cntm = 0;
  int cntd = 0;
  scanf("%d" "%d",&m,&d);
  for(cntm = 0;cntm < m;cntm++){
    for(cntd = 0;cntd < d;cntd++){
      i = ((cntd+1)%10);
      j = ((cntd+1-i)/10);
      if((((i*j)==(cntm+1))&&(i>1))&&(j>1)){
      cnt++;
      }
    }
  }
  printf("%d\n",cnt);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    int a,b,c,d; cin>>a>>b>>c>>d;
    cout << min(a,b) + min(c,d) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstring>
#include <cstdio>

const int _ = 3002;

int tot, head[_]; struct Edge { int v, nxt; } edge[_ << 1];
void Add_edge(int u, int v) { edge[++tot] = (Edge) { v, head[u] }, head[u] = tot; }

int n, a[_], dp[_];

void dfs(int u, int f) {
    dp[u] = 0;
    for (int i = head[u]; i; i = edge[i].nxt) {
        int v = edge[i].v; if (v == f) continue ;
        dfs(v, u);
        if (!dp[v] && a[u] > a[v]) dp[u] = 1;
    }
}

int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i) scanf("%d", a + i);
    for (int u, v, i = 1; i < n; ++i)
        scanf("%d %d", &u, &v), Add_edge(u, v), Add_edge(v, u);
    for (int i = 1; i <= n; ++i) {
        memset(dp, 0, sizeof dp), dfs(i, 0);
        if (dp[i]) printf("%d ", i);
    }
    return 0;
}


Measured memory_bytes: 512
def main():
    while 1:
        N = int(input())
        if N == 0:
            break
        D = {}
        G = [set() for i in range(N)]
        cur = 0
        K = []
        PS = []
        for i in range(N):
            ps = []
            s = input()
            if s in D:
                k = D[s]
            else:
                D[s] = k = cur
                cur += 1
            while 1:
                d = input()
                if d == "-1":
                    break
                ps.append(list(map(int, d.split())))

            for j in range(i):
                if k == K[j]:
                    continue
                qs = PS[j]
                ok = 0
                for k1 in range(len(ps)):
                    x0, y0 = ps[k1-1]
                    x1, y1 = ps[k1]
                    dx = x1 - x0; dy = y1 - y0
                    for k2 in range(len(qs)):
                        X0, Y0 = qs[k2-1]
                        X1, Y1 = qs[k2]
                        if (X0 - x0)*dy == (Y0 - y0)*dx and (X1 - x0)*dy == (Y1 - y0)*dx:
                            if dx != 0:
                                s0 = (X0 - x0); s1 = (X1 - x0)
                                t = dx
                            else:
                                s0 = (Y0 - y0); s1 = (Y1 - y0)
                                t = dy
                            if t < 0:
                                s0 = -s0; s1 = -s1
                                t = -t
                            if not s0 < s1:
                                s0, s1 = s1, s0
                            if s0 < t and 0 < s1:
                                break
                    else:
                        continue
                    break
                else:
                    continue
                l = K[j]
                if k < l:
                    G[l].add(k)
                else:
                    G[k].add(l)
            K.append(k)
            PS.append(ps)
        def dfs(i, cs, ma):
            if i == cur:
                return max(cs)+1
            U = 0
            for j in G[i]:
                U |= 1 << cs[j]
            r = cur
            for k in range(ma+1):
                if U & 1 == 0:
                    cs[i] = k
                    r = min(r, dfs(i+1, cs, ma))
                U >>= 1
            cs[i] = ma+1
            r = min(r, dfs(i+1, cs, ma+1))
            return r
        print(dfs(0, [0]*cur, 0))
main()



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

//const long double PIL = 3.141592653589793238462643383279502884L;
//const double PI = 3.14159265358979323846;

#define sz(a) (int)((a).size())
#define all(c) (c).begin(), (c).end()
#define debug(v) {for (auto z : v) {cerr << z << ' ';} cerr << endl;}

using ll = long long;
using ii = pair<int,int>;
using vi = vector<int>;
using vll = vector<long long>;
using vii = vector<pair<int,int>>;

int main() {
	//~ ios::sync_with_stdio(0);
	//~ cin.tie(0);
	double x;
	scanf("%lf", &x);
	x /= 3.0;
	x = x * x * x;
	printf("%.10f\n", x);
}


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

int main(){
  int n,k;
  string s;
  cin >> n;
  cin >> s;
  cin >> k;
  char rem;
  rem = s[k-1];
  
  for (int i =0; i < n; i++){
    if (!(s[i] == rem)){
      s[i] = '*';
    }
  }
  cout << s;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
using namespace std;
int main(){
  int N;//人数
  cin >> N;
  int a[N];
  int result = 0;
  int i=0;
  double sum = 0.0;
  int mid = 0;
  while(i<N){
    cin >> a[i];
    sum = sum + a[i];
    i++;
  }
  //cout << sum;
  mid = round(sum/N);
  //cout << mid;
  i = 0;
    while(i<N){
    result = result+((a[i]-mid)*(a[i]-mid));
    i++;
  }
  cout << result;
}


Measured memory_bytes: 512
#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define UNIQUE(v) { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).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 (a > b) {a = b; return 1;} return 0; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) (q ? "Yes" : "No")
#define YES(q) (q ? "YES" : "NO")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) { cerr << "[DEBUG] " #q ": ["; REP(dumpall_i, (q).size()) { cerr << q[dumpall_i] << (dumpall_i == (q).size() - 1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; }

// gcc拡張マクロ
#define gcd __gcd
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
using  ll = long long;
using ull = unsigned long long;
using  ld = long double;
using namespace std;

// モジュール


// 処理内容
int main() {
    
    ll n; cin >> n;

    ll ans = 0;
    for (ll f = 1; f * f < n; f++) {
        if (n % f == 0) {
            ll c = n/f - 1;
            if (n%c == n/c) ans += c;
        }
    }
    cout << ans << endl;

    
}

Measured memory_bytes: 256
sx, sy, tx, ty = map(int, input().split())
x = tx - sx
y = ty - sy
print("".join(["U"]*y + ["R"]*x +["D"]*y + ["L"]*(x+1) + ["U"]*(y+1) + ["R"]*(x+1) + ["D", "R"] + ["D"]*(y+1) + ["L"]*(x+1) + ["U"]))

Measured memory_bytes: 3316
#include <iostream>
#include <cstdio>
#include <string>
#include <queue>
#include <stack>
#include <list>
#include <algorithm>
#include <vector>
#define REP(i,n) for(int i=0;i<n;i++)
#define P 1000000007
using namespace std;

int powmp(long long x,long long n){
	const long long p = 1000000007;
	if(n==0) return 1;
	long long y = x%p;
	if(n==1) return y;
	long long tmp = (powmp(y,n/2))%p;
	if(n%2==0) return (tmp*tmp)%p;
	else return (powmp(y,n-1)*y)%p;
}

int main(int argc, char const *argv[])
{
	bool bo = true;
	char b[4] = {'Y','A','K','I'};
	string a;
	
	cin >> a;
	if(a.length()<4) bo = false;
	else REP(i,4){
		if(b[i]!=a[i]) bo=false;
	}
	if(bo)cout << "Yes"<<"\n";
	else cout << "No"<<"\n";
	return 0;
}	

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#define max 1000001
int prime[max];

int main()
{
    int n, i, j;


    for (i = 0; i < max; i++)
    {
        prime[i] = 1;
    }

    prime[0] = prime[1] = 0;
    for (i = 2; i * i < max; i++)
    {
        if (prime[i] == 1)
        {
            for (j = i * i; j < max; j += i)
            {
                prime[j] = 0;
            }
        }
    }

    for (i = 1; i < max - 1; i++)
    {
        prime[i + 1] = prime[i + 1] + prime[i];
    }

    while (scanf("%d", &n)==1)
    {
        printf("%d\n", prime[n]);
    }

    return 0;
}

Measured memory_bytes: 4496
#include <iostream>
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <stdlib.h>
#include <cassert>
#include <time.h>
#include <numeric>
#include <iomanip> 
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;
typedef vector<int> vi;
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(v) (int)v.size()
#define ll long long int
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define fill(a,v) memset(a,v,sizeof(a));
#define all(v) v.begin(),v.end()
#define rep(i, a, b) for(int i = a; i < b; i++)


#define trarr(a,n) forn(i,0,n) cerr<<a[i]<<" \n"[i==n-1];
#define trmat(g,n,m) forn(i,0,n)forn(j,0,m) cerr<<g[i][j]<<" \n"[i==m-1];
#define tr(...) cerr<<__FUNCTION__<<' '<<__LINE__<<" = ";trace(#__VA_ARGS__, __VA_ARGS__)
template<typename S, typename T> 
ostream& operator<<(ostream& out,pair<S,T> const& p){out<<'('<<p.ff<<", "<<p.ss<<')';return out;}
template<typename T>
ostream& operator<<(ostream& out,vector<T> const& v){
int l=v.size();for(int i=0;i<l-1;i++)out<<v[i]<<' ';if(l>0)out<<v[l-1];return out;}
template<typename T>
void trace(const char* name, T&& arg1){cout<<name<<" : "<<arg1<<endl;}
template<typename T, typename... Args>
void trace(const char* names, T&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');cout.write(names, comma-names)<<" : "<<arg1<<" | ";trace(comma+1,args...);}

const ld PI = acos(-1);
const ld EPS = 1e-9;
const int inf = 1e9+10;
const ll INF = 1e18+10;
const int P = 1e9+7;
const int N = 2e5+10;

void solve(int _t){
	int n;
	cin >> n;
	double p[n];
	rep(i,0, n) cin >> p[i];
	double dp[n+1][n+1];
	rep(i, 0, n+1) rep(j, 0, n+1) dp[i][j] = 0.0;
	dp[1][0] = 1-p[0];
	dp[1][1] = p[0];
	double tmp = 1;
	double tmp1 = 1;
	for(int i = 0; i < n; i++){
		tmp *= (1-p[i]);
		dp[i+1][0] = tmp;
		tmp1*=p[i];
		dp[i+1][i+1] = tmp1;
	}

	rep(i, 2, n+1) rep(j, 1, i+1){
		dp[i][j] = dp[i-1][j-1]*p[i-1];
		dp[i][j] += dp[i-1][j]*(1-p[i-1]);
	}
	double ans = 0.0;
	rep(i, n/2+1, n+1){
		ans+=dp[n][i];
	}
	cout << setprecision(9)<< ans << endl;

}
int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int t = 1;
	// cin >> t;
	rep(test, 1, t+1){
		solve(test);
	}
	return 0;
}

Measured memory_bytes: 74056
n = int(input())
P = list(map(int, input().split()))

count = 0
for i in range(1, n - 1):
    if P[i - 1] < P[i] < P[i + 1] or P[i - 1] > P[i] > P[i + 1]:
        count += 1

print(count)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
typedef long long ll;
typedef pair<int, int> P;
#define MAXN 105
#define MAXW 100005
ll dp[MAXN][MAXW] = {};
ll w[MAXN] = {};
ll v[MAXN] = {};
ll N,W;

void make() {

	for (ll i=0; i<N; i++) {
		for (ll j=0; j<=W; j++) {
			if (j>=w[i]) {
				dp[i+1][j] = max(dp[i][j-w[i]]+v[i], dp[i][j]);
			} else {
				dp[i+1][j] = dp[i][j];
			}
			// cout << dp[i+1][j] << " ";
	}
	// cout << endl;
	}
}

int main(){
	cin >> N >> W;
	rep(i,N) {
		cin >> w[i] >> v[i];
	}
	make();
	cout << dp[N][W] << endl;
}


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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}

int nextInt() { int x; scanf("%d", &x); return x;}

const ll MOD = 998244353;

ll two[100000];

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

// (x1, y1) と (x2, y2) を通る直線の方程式 ax + by + c == 0 の {a,b,c} を返す
vector<ll> line(ll x1, ll y1, ll x2, ll y2) {
  if (x1 == x2) { return {1, 0, -x1}; }
  if (y1 == y2) { return {0, 1, -y1}; }
  ll a = (y2 - y1);
  ll b = (x1 - x2);
  ll c = y1*x2 - x1*y2;
  if (a < 0) { a *= -1; b *= -1; c *= -1; }
  ll g = gcd(a, gcd(abs(b), abs(c)));
  return {a/g, b/g, c/g};
}

int main2() {
  int N = nextInt();
  vector<ll> x(N), y(N);
  REP(i, N) {
    x[i] = nextInt();
    y[i] = nextInt();
  }

  map< vector<ll>, set<int> > mp;

  REP(i, N) {
    REP(j, N) if (i < j) {
      auto l = line(x[i], y[i], x[j], y[j]);
      mp[l].insert(i);
      mp[l].insert(j);
    }
  }

  ll dis = 0;
  for (auto it = mp.begin(); it != mp.end(); ++it) {
    int m = (it->second).size();
    if (m >= 3) {
      dis += (two[m] - 1 - m - m*(m-1)/2);
      dis = (dis % MOD + MOD) % MOD;
    }
  }

  ll ans = two[N];
  ans = ((ans - 1) % MOD + MOD) % MOD;
  ans = ((ans - N) % MOD + MOD) % MOD;
  ans = ((ans - N*(N-1)/2) % MOD + MOD) % MOD;
  ans = ((ans - dis) % MOD + MOD) % MOD;
  cout << ans << endl;
  return 0;
}

int main() {

  two[0] = 1;
  REP(i, 100000 - 1) two[i+1] = two[i] * 2 % MOD;

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}


Measured memory_bytes: 5632
#include <iostream>
#include <stdio.h>
#include <cstring>
using namespace std;
const int M=1e5+5,N=1e2+9;
int n,w,wh[N],v[N];
long long memo[N][M],oo=1e17+9;
long long dp(int i,int weight)
{
    if(weight<0)
        return -oo;
    if(i==n)
    {
            return 0;
    }
    long long &ret=memo[i][weight];
    if(~ret)
        return ret;
    return ret=max(dp(i+1,weight),dp(i+1,weight-wh[i])+v[i]);
}
int main()
{
    memset(memo,-1,sizeof memo);
    scanf("%d %d",&n,&w);
    for(int i=0;i<n;++i)
    {
         scanf("%d %d",wh+i,v+i);
    }
    printf("%lld\n",dp(0,w));

    return 0;
}


Measured memory_bytes: 88956
import math
a,b,x = map(int,input().split())
ku = math.degrees(math.atan(2*(b/a)-2*x/a**3))
if x/a >a*b/2:
  print(ku)
else:
  print(math.degrees(math.atan(a*b**2/(2*x))))
  
  

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

int main(void)
{
    int i, j, num, lim, price[1000], temp, max;

    for(;;) {
        cin >> num;
        cin >> lim;
        if(num == 0 && lim == 0) {
            return 0;
        }
        for(i = 0; i < num; i++) {
            cin >> price[i];
        }
        max = 0;
        for(i=0; i < num - 1; i++) {
            for(j = i + 1; j < num; j++) {
                temp = price[i] + price[j];
                if(temp > max && temp <= lim) {
                    max = temp;
                }
            }
        }
        if(max == 0) {
            cout << "NONE\n";
        }
        else {
            cout << max << "\n";
        }
    }
    return 0;
}


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

int main()
{
	int x,y;

	for(int i=0;;i++){

		cin >> x >> y;

		if(x == 0 && y == 0)
			break;

		if(x >= y){
			cout << y << " " << x << endl;
		}
		else{
			cout << x << " " << y << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1160
#include <iostream>

#include <algorithm>
#include <cmath>
#include<string>
#include<array>
#include<vector>
#include<functional>
#include<unordered_map>
#include<map>
#include<numeric>
#include<limits>
#include<utility>
#include<queue>
#include<random>

using namespace std;
typedef long long LL;

int main() {


	int a, b,c;
	//----------------------
	LL n=1, X, Z,A,B,N,ans1,ans2,m,C,D;
	LL ans, count=0 ;
	bool f=true;
	string s;
	char t, u;

	cin >> N>>A;
	
	//Nかいやる

	for (int i = 0; N> i; i++) {
	
		if (n * 2 >= n + A) {
		
			n = n + A;
		
		}
		else n = n * 2;


		//cout << "a" ;

	}

	

	cout << n << endl;

	
	//------------------------
	//cin >> Z;

	return 0;
}

Measured memory_bytes: 256
#pragma target("avx")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef unordered_map<ll, ll> U_MAP;
typedef priority_queue<ll> pq;
typedef priority_queue<ll, vector<ll>, greater<ll>> rpq;
const int INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
const ll LINF = 1e18;

#define rep(i, n) for (ll(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrrep(i, a, b) for (ll i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define doublecout(a) cout << fixed << setprecision(15) << a << endl;
#define fi first
#define se second
#define m_p make_pair
#define p_b push_back
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

//------ Believe yourself as a genius!!!!!! ------

int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
// int dy[]={-1,0,1,-1,1,-1,0,1};int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
ll n, cnt, ans, a, b, c, d, tmp, m, h, w, x, y, sum, k, q;

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

  cin >> s;
  ans = Size(s);
  ans = ans - 2;
  cout << s[0] << ans << s[Size(s) - 1] << "\n";
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n,m;
vi g[125252];

ll dp[125252];
ll ans[125252];
vl seg[125252];

void dfs1(int p, int bef){
  ll ans = 1;
  for(int to : g[p])if(to != bef){
    dfs1(to,p);
    ans = ans * (dp[to] + 1) % m;
  }
  dp[p] = ans;
}

ll query(const vl &seg, int l, int r, int a, int b, int k){
  if(r<=a || b<=l)return 1ll;
  if(l<=a && b<=r)return seg[k];
  int z = (a+b)/2;
  return query(seg,l,r,a,z,2*k+1) * query(seg,l,r,z,b,2*k+2) % m;
}

void dfs2(int p, int bef){
  ans[p] = dp[p];
  // seg
  int z;
  int N = 1;
  {
    vl chs;
    REP(i,g[p].size()){
      int to = g[p][i];
      chs.push_back((dp[to]+1) % m);
    }
    z = chs.size();
    // DEBUG(p);
    // DEBUG_VEC(chs);
    while(N < z)N*=2;
    seg[p].assign(2*N-1,1);
    REP(i,z)seg[p][i+N-1] = chs[i];
    FORR(i,0,N-1)seg[p][i] = seg[p][2*i+1] * seg[p][2*i+2] % m;
  }
  REP(i,g[p].size()){
    int to = g[p][i];
    if(to == bef)continue;
    ll v = query(seg[p],0,i,0,N,0) * query(seg[p],i+1,z,0,N,0) % m;
    // DEBUG(p);DEBUG(to);DEBUG(v);
    dp[p] = v;
    dfs2(to, p);
  }
  dp[p] = ans[p];
  ans[p] = seg[p][0];
  seg[p].clear();
}

int main(){
  scanf("%d%d",&n,&m);
  REP(i,n-1){
    int x,y;
    scanf("%d%d",&x,&y);
    --x;--y;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  dfs1(0,-1);
  // printf("%lld\n",dp[0]);
  dfs2(0,-1);
  REP(i,n)printf("%lld\n",ans[i]);
  return 0;
}


Measured memory_bytes: 26880
#include<stdio.h>
int main(void)
{
    int n,i,m,t;
    double x[100],y[100],r,c;
    while(scanf("%d",&n)*n){
        for(i=0;i<n;i++)scanf("%lf,%lf",&x[i],&y[i]);
        for(t=0,r=0.;r<=10.;r+=.01){
            for(c=0.f;c<=10.;c+=.01){
                for(m=0,i=0;i<n;i++){
                    if((x[i]-c)*(x[i]-c)+(y[i]-r)*(y[i]-r)<=1.001)m++;
                }
                if(m>t)t=m;
            }
        }
        printf("%d\n",t);
    }
    return 0;
}

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

int main() {
	string ss;
	cin >> ss;
	/*string xx = ss;
	sort(xx.begin(), xx.end());
	int count = 0;
	for (int i=0; i<=xx.length()/2; i++){
		if (xx[i]==xx[i+1]){
			count ++;
		}
	}
	if (count<=xx.length()/2){
		cout << -1 << ' ' << "-1\n";
		return 0;
	} */
	
	
	
	for (int i=0; i<ss.length()-1; i++){
		if (ss[i]==ss[i+1]){
			cout << i+1 << ' ' << i+2 << endl;
			return 0;
		}
	}
	for (int i=0; i<ss.length()-2; i++){
		if (ss[i]==ss[i+2]){
			cout << i+1 << ' ' << i+3 << endl;
			return 0;
		}
	}
	cout << -1 << ' ' << -1 << endl;
}

Measured memory_bytes: 512
#include<stdio.h>
#include<stdlib.h>
#include<limits.h>
#include<math.h>

int main(){
	int A,B,i,j,k,n;
	char addr[20];
	char c;
	int boo = 1;
	int endflag = 0;
	
	scanf("%d",&A);
	scanf("%d",&B);
	
	if(A >=6 || B >= 6){endflag = 1;boo = -1;}
	
	scanf("%s",&addr);
	
	for(i=0;i<A;i++){
		if(endflag == 1)break;
		if(addr[i]=='\0'){endflag = 1;boo = -1;break;}
		if( !(addr[i] >= '0' && addr[i] <= '9')){endflag = 1;boo =-1;break;}
	}
	
	if(endflag!= 1){
		if(addr[A] == '-');
		else{endflag = 1;boo = -1;}
	}
	
	for(i=A+1;i<A+B+1;i++){
		if(endflag == 1)break;
		if(addr[i]=='\0'){endflag = 1;boo = -1;break;}
		if( !(addr[i] >= '0' && addr[i] <= '9')){endflag = 1;boo =-1;break;}
	}
	
	if(addr[A+B+1] != '\0'){endflag = 1;boo = -1;}
	
	if(boo == 1)printf("Yes\n");
	else printf("No\n");
	
	
	return 0;
}

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

int main( int argc, char *argv[] )
{
char s[ 30 ];

	ios::sync_with_stdio( false );
	cin.tie( 0 );

	cin >> s;

	s[ 5 ] = ' ';
	s[ 13 ] = ' ';
	cout << s << endl;

	return 0;
}



Measured memory_bytes: 256
#include<cstdio>
int main()
{
    char S[3];
    int a=0,b=0,c=0;
    scanf("%s",S);
    for (int ni=0;ni<3;ni++)
    {
        if (S[ni]=='a') a=1;
        if (S[ni]=='b') b=1;
        if (S[ni]=='c') c=1;
    }
    if (a==1&&b==1&&c==1) printf("Yes");
    else printf("No");
    return 0;
}


Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
 
public class Main {
 
    public static final int BIG_NUM  = 2000000000;
    public static final int MOD  = 1000000007;
 
    public static void main(String[] args) {
 
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
 
        try {
            String T = br.readLine();
            String P = br.readLine();
 
            if(P.length() <= T.length()){
 
                char T_array[] = T.toCharArray();
                char P_array[] = P.toCharArray();
 
                boolean Found = false,FLG;
 
                for(int start = 0; start < T.length(); start++){
                    FLG = true;
                    for(int i = 0; i < P.length(); i++){
                        if(P_array[i] != T_array[(start+i)%T.length()]){
                            FLG = false;
                            break;
                        }
                    }
                    if(FLG){
                        Found = true;
                        break;
                    }
                }
 
                if(Found){
                    System.out.printf("Yes\n");
                }else{
                    System.out.printf("No\n");
                }
 
            }else{
 
                System.out.printf("No\n");
            }
 
        } catch (IOException e) {
            e.printStackTrace();
        }
 
 
    }
}


Measured memory_bytes: 24644
N,M,Q=gets.split.map(&:to_i)
X=Q.times.map{gets.split.map(&:to_i)}
F=->t{
  s=0
  X.each{|a,b,c,d|
    s+=d if t[b-1]-t[a-1]==c
  }
  s  
}

max=0
a=[]
M.times{|i|a<<[i+1]}
(N-1).times{
  b=[]
  a.each{|c|
    c[-1].upto(M){|i|
      b<<c+[i]
    }
  }
  a=b
}
a.each{|t|
  s=F[t]
  max=s if s>max
}
p max

Measured memory_bytes: 41152
#include <bits/stdc++.h>
using namespace std;
#define int long long

typedef long long ll;
typedef unsigned long long ull;
//typedef unsigned __int128 HASH;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll,int> plli;
typedef pair<double, int> pdbi;
typedef pair<int,pii> pipii;
typedef pair<ll,pll> plpll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;
typedef vector<vector<int>> mat;

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define pb push_back
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()

const ll hmod1 = 999999937;
const ll hmod2 = 1000000000 + 9;
const int INF = 1<<30;
const ll mod = 1000000000 + 7;
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1};
const double pi = 3.141592653589793;

#define addm(X, Y) (X) = ((X) + ((Y) % mod) + mod) % mod

int n;
int a[15];
int ans;

void dfs(int now, bool ev) {
  bool pre = ev;
  if (now == n) {
    if (ev) ans++;
    return ;
  }
  if ((a[now] + 1) % 2 == 0) {
    ev = true;
    dfs(now + 1, ev);
    ev = pre;
  }
  else dfs(now + 1, ev);
  if ((a[now] % 2) == 0) {
    ev = true;
    dfs(now + 1, ev);
    ev = pre;
  }
  else dfs(now + 1, ev);
  if ((a[now] - 1) % 2 == 0) {
    ev = true;
    dfs(now + 1, ev);
    ev = pre;
  }
  else dfs(now + 1, ev);
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    rep(i, n) cin >> a[i];
    dfs(0, false);
    cout << ans << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
// Welcome to my source code!

int main() {
    int n;
    cin >> n;
    int d[n];
    for (int i = 0; i < n; i++) cin >> d[i];
    sort(d, d+n, greater<int>());
    ll sum = 1, bottom = d[0];
    for (int i = 1; i < n; i++) {
        if (bottom != d[i]) {
            bottom = d[i];
            sum++;
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
/*****************************************************

*****************************************************/

#include<bits/stdc++.h>
#define MAX 9223372036854775807
#define endl "\n"
#define ll long long
#define int long long
#define pb push_back
#define pf push_front
#define ppf pop_front
#define mp make_pair
#define ip pair<int, int>

#define loop(i,n) for(int i=0;i<n;i++)
#define fast ios::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL)
using namespace std;

const ll MOD = 1e9+7;
const ll SZ = 107;
const ll N = 2e5+7;
const ll inf = 1e17;

int pwr(int x, int y)
{
    ll r = 1LL;
    while(y)
    {
        if(y&1)
            r = (r * x) % MOD;
        y >>= 1;
        x = (x * x) % MOD;
    }
    return r % MOD;
}

int inv(int x)
{
    return pow(x, MOD-2);
}

void solve()
{
    int n; 
    cin>>n; 
    int a[n], b[n];
    vector<ip> v;
    for(int i=0;i<n;i++)
    {
        int x, y;
        cin>>x>>y;
        v.pb({y, x});
    }
    sort(v.begin(), v.end());
    reverse(v.begin(), v.end());
    // for(auto i: v)
    //     cout<<i.first<<" "<<i.second<<endl;

    bool f = 1;
    int cur = 1e11;
    for(int i=0;i<n;i++)
    {
        if(cur>v[i].first)
            cur = v[i].first;
        cur -= v[i].second;
        if(cur<0){
            f=0;
            break;
        }
    }
    if(f)
        cout<<"Yes";
    else
        cout<<"No";
}

signed main()
{
    fast;

    int t=1;
    // cin >>t;
    while(t--){
        solve();
    }
    return 0;
}

/*****************************


****************************/

Measured memory_bytes: 6384
#include<iostream>
#include<cstdio>

using namespace std;

int main()
{
	int n,m,l,r;
	scanf("%d%d",&n,&m);
	char s[100005];
	int a[100005]={0},cnt=0;
	scanf("%s",s);
	for(int i=1;s[i];i++)
		if(s[i]=='C'&&s[i-1]=='A')
			a[i]=++cnt;
		else
			a[i]=cnt;
	for(int i=0;i<m;i++)
	{
		cnt=0;
		scanf("%d%d",&l,&r);
        l--;r--;
		printf("%d\n",a[r]-a[l]);
	}
	return 0;
}

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

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

#define MP make_pair
#define PB push_back
#define PI 3.141592653589793238462643383279L

#define MOD 1000000007LL
typedef long long ll;
typedef long double ld;

#define LAR(a, b) a=max(a, (b))
#define SQ(x) ((x)*(x))

int w[212345], x[212345];
int ms[212345], xs[212345];
int wb[20], xb[20];
int n, m;

typedef map<int, int> mii;
typedef pair<int, int> pii;
#define itr iterator

int ama(int a, int b){
	int lo = a,
			hg = n+1;
	while(hg-lo>1){
		int md = (lo+hg)/2;
		if(ms[md]-ms[a]<=wb[b] && xs[md]-xs[a]<=xb[b])
			lo = md;
		else
			hg = md;
	}
	return lo;
}

vector<pii> v;
int ans[65536];

int main(){
	scanf("%d%d", &n, &m);
	REP(i, n) scanf("%d%d", w+i, x+i);
	REP(i, m) scanf("%d%d", wb+i, xb+i);
	ms[0]=xs[0]=0;
	REP(i, n){
		ms[i+1]=ms[i]+w[i];
		xs[i+1]=xs[i]+x[i];
	}
	REP(i, 1<<m){
		int cnt = 0;
		REP(j, m) if(i&(1<<j)) cnt++;
		v.PB(MP(cnt, i));
	}
	fill(ans, ans+65536, 0);
	sort(v.begin(), v.end());
	REP(h, v.size()){
		int i = v[h].second;
		REP(j, m){
			if((i&(1<<j))==0){
				LAR(ans[i|(1<<j)], ama(ans[i], j));
			}
		}
	}
	int ret = 0;
	REP(i, 65536) LAR(ret, ans[i]);
	printf("%d\n", ret);
	return 0;
}

Measured memory_bytes: 6632
$mod = 10 ** 9 + 7
 
def fac(n, m)
    (n..m).inject(1) {|r, v| r * v % $mod}
end
 
def power(x, n)
    n == 0 ? 1 : ((n.odd? ? x : 1) * power(x ** 2 % $mod, n / 2) % $mod)
end
 
def com(n, m)
    m = n - m if n < 2 * m
    fac(n - m + 1, n) * power(fac(1, m), $mod - 2) % $mod
end


x, y = gets.split.map(&:to_i)
 
a, ma = (2 * y - x).divmod(3)
b, mb = (2 * x - y).divmod(3)
 
puts a < 0 || b < 0 || ma != 0 || mb != 0 ? 0 : com(a + b, a)


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

using namespace std;
using ll = long long;

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

	string ans = "";
	ll div = N;
	while (div != 0) {
		div--;
		int mod = div % 26;
		div /= 26;
		ans += ('a' + mod);
	}

	reverse(ans.begin(), ans.end());
	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const ll maxn(200001), mod(1e9 + 7);
ll Jc[maxn];
void calJc() {
  Jc[0] = Jc[1] = 1;
  for (ll i = 2; i < maxn; i++) Jc[i] = Jc[i - 1] * i % mod;
}

ll pow_mod(ll a, ll n, ll p) {
  ll ans = 1;
  while (n) {
    if (n & 1) ans = ans * a % p;
    a = a * a % p;
    n >>= 1;
  }
  return ans;
}
ll comp(ll a, ll b, int p) {
  if(a < b) return 0; 
  if(a == b) return 1; 
  if(b > a - b) b = a - b; 
  int ans = 1, ca = 1, cb = 1; 
  for(ll i = 0; i < b; ++i) { 
    ca = (ca * (a - i))%p; cb = (cb * (b - i))%p; 
  } 
  ans = (ca*pow_mod(cb, p - 2, p)) % p; 
  return ans; } ll lucas(ll n, ll m, ll p) { 
    ll ans = 1; 
    while(n && m && ans) { 
      ans = (ans*comp(n%p, m%p, p)) % p;
      n /= p; m /= p; 
    }
    return ans; 
  }



int main() {
  int n, a, b;
  cin >> n >> a >> b;
  int mod = 1e9 + 7;
  ll total = pow_mod(2, n, mod);
  calJc();
  ll nca = comp(n, a, mod);
  ll ncb = comp(n, b, mod);
  cout << ((total - nca + mod) % mod - ncb - 1 + mod) % mod << endl;
  return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(),x.end()
#define dbg(x) cout<<#x<<":"<<x<<endl
#define int long long
#define MOD 1000000007
typedef pair<int,int> P;
typedef pair<int,P> PP;
int n;
int dp[1<<16];
int a[16][16];

int dfs(int s){
  if(dp[s]!=-1)return dp[s];
  int res=0;
  for(int i=0;i<n;i++){
    for(int j=i;j<n;j++){
	 if((s>>i&1)&&(s>>j&1)){
	   res+=a[i][j];
	 }
    }
  }
  for(int i=(s-1)&s;i>0;i=(i-1)&s){
    res=max(dfs(i)+dfs(s^i),res);
  }
  return dp[s]=res;
}

signed main(){
  cin>>n;
  fill_n(dp,1<<16,-1);
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
	 cin>>a[i][j];
    }
  }
  cout<<dfs((1<<n)-1)<<endl;
  return 0;
}


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

#define int         long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (int)x.size()
#define endl        "\n"
#define repp(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a,b) 	for(int i=a;i<=b;i++)
#define IOS         ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

const int N=1e5 + 5;

mi mp;
int n;
int k;

int check(int x)
{
	while(x>0)
	{
		int f= x%10;
		if(mp[f]>=1)
		{
			return 0;
		}
		x=x/10;
	}
	return 1;
}

int32_t main()
{
	IOS;
	cin >> n >> k;
	rep(i,1,k)
	{
		int x;
		cin >> x;
		mp[x]++;
	}
	int cur=n;
	while(1)
	{
		if(check(cur)==1)
		{
			cout << cur << endl;
			break;
		}
		cur++;
	}
	
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
constexpr const char *p = "pon", *h = "hon", *b = "bon";
constexpr const char* word[] = {p, p, h, b, h, h, p, h, p, h};
int main() {
    int N;
    cin >> N;
    cout << word[N % 10] << endl;
}

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

int t[200005];

int main()
{
    int N, T, ans;

    scanf("%d %d", &N, &T );

    for ( int i = 0; i < N; ++i ) {
        scanf("%d", &t[i] );
    }

    ans = T;
    for ( int i = 1; i < N; ++i ) {
        if ( t[i] - t [ i - 1 ] >= T ) {
            ans += T;
        } else {
            ans += t[i] - t[ i - 1 ];
        }
    }

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

    return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int s = Integer.parseInt(sc.next());
        int left = s / 100;
        int right = s % 100;
        
        if(1 <= left && left <= 12){
            if(1 <= right && right <= 12){
                System.out.println("AMBIGUOUS");
            }else{
                System.out.println("MMYY");
            }
        }else if(1 <= right && right <= 12){
            System.out.println("YYMM");
        }else{
            System.out.println("NA");
        }
    }
}

Measured memory_bytes: 22100
#include<map>
#include<bitset>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<stack>
#define REP(i,x,y) for(ll i=x;i<=y;i++)
#define SIZE(a) ll(a.size())
#define vll vector<ll> 
#define MEMSET(a, n, m) for(ll i=0;i<=n;i++) a[i] = m
#define BIT(n) (ll(1)<<n)
#define UNIQUE(v) v.erase(unique(v.begin(),v.end()),v.end()) 
#define UNIQUE_ARRAY(a,n) n = unique(a + 1, a + x + 1) - a - 1
#define SORT(a,n) sort(a+1,a+n+1)
#define SORT_O(a,n,order) sort(a+1,a+n+1,order)

typedef long long ll;
using namespace std;
/*
struct point
{
long long dist; long long name;
bool operator<(const point& rhs) const {
return dist > rhs.dist;
}
};
*/

int main() {
	ll n;
	string s;
	cin >> s;
	n = s.size();
	if (s[n - 1] == '1'||s[0]=='0') {
		cout << -1 << endl;
		return 0;
	}
	REP(i, 0, n - 2) {
		if (s[i] != s[n - i - 2]) {
			cout << -1 << endl;
			return 0;
		}
	}
	ll cur = 1;
	REP(i, 2, n) {
		ll j = i - 1;
		if (s[j] == '1') {
			REP(k, cur, i - 1) {
				cout << cur << " " << i << endl;
				cur++;
			}
		}
	}
	cout << n - 1 << " " << n << endl;
}

Measured memory_bytes: 1664
//ABC072C
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <climits>
#include <cfloat>
#include <string>
#include <numeric>
using namespace std;

int main() {
	int n;
	cin >> n;
	int a;
	vector<int> count(100001);
	for(int i=0;i<100001;i++){
		count.at(i) = 0;
	}
	for(int i=0;i<n;i++){
		cin >> a;
		count.at(a)++;
	}
	int num, ans;
	for(int i=1;i<100000;i++){
		num = count.at(i-1) + count.at(i) + count.at(i+1);
		ans = max(num,ans);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <stack>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <functional>
#include <string>
#include <cstdlib>
#include <numeric>
#include <cstdbool>
#include <map> 
#include<set>
#include<queue>

typedef long long ll;


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

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

const long long INF = 1000000000000000;
const ll inf = -1e18;
typedef pair<int, int> P;
ll ma = 1000000000 + 7;
ll mx = 1000003;
ll h, w, n,m; string s,t;
char maze[60][60];
int dis[101][101]; int graph[52][52]; bool vis[52];
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };
ll gcd(ll x, ll y) {
	if (x % y == 0) return y;
	return gcd(y, x % y);

}
ll lcm(ll a,ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
void comb(vector<vector <ll> >& v) {
	for (ll i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (ll k = 1; k < v.size(); k++) {
		for (int j = 1; j < k; j++) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j]);
		}
	}
}
vector<ll> ee(1000010);
int main() {
	ll a=1;
	for (ll i = 0; a != 0; i++) {
		cin >> a;
		if (a == 0) {
			n = i;
			break;
		}
		ee[i] = a;
	}
	rep(i, n) {
		ll m = INF;
		ll zz = 0;
		ll yy = 0;
		ll y, z;
		for (z = 0; zz <= ee[i]; z++) {
			zz = z * z * z;
			for (y = 0; yy <= ee[i]; y++) {
				yy = y * y;
				if (yy > ee[i] - zz) {
					y--;
					yy = y * y;
					ll x = ee[i] - zz - yy;
					if (x >= 0) chmin(m, x + y + z);
					break;
				}
			}
		}
		cout << m << endl;
	}

}


Measured memory_bytes: 10500
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

void main() {
    auto nx = readints;
    int x = nx[1];
    auto xs = readints;

    auto ans = xs.map!(e => abs(x - e)).reduce!((a, b) => gcd(a, b));
    writeln(ans);
}

T gcd(T)(T a, T b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}


Measured memory_bytes: 4276