akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass
{
	public const long Giri = 1000000007;

	public static void Main(string[] args)
	{
		int n = Console.ReadLine().ToInt();
		Dictionary<int, bool> buf = new Dictionary<int, bool>(100000);
		for(int i = 0; i < n; i++)
		{
			var t = (Console.ReadLine().ToInt()-1);
			if(!buf.ContainsKey(t))
				buf.Add(t, false);
			
			buf[t] = !buf[t];
		}
		int r = 0;
		foreach(var k in buf.Values)
		{
			if(k) r++;
		}
		Console.WriteLine(r);
	}
	
	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(' '); }
	public static int Clamp(int val, int max, int min = 0) { return Math.Min(max, Math.Max(min, val)); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str)
	{
		var r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt();
		return r;
	 }
}

Measured memory_bytes: 17244
#include <bits/stdc++.h>
 
using namespace std;
 
struct Edge {
    int u;
    int v;
    long long c;
    Edge() {}
    Edge(int u, int v, long long c): u(u), v(v), c(c) {}
};
 
struct PqEle {
    int u;
    int num;
    long long content;
    PqEle() {}
    PqEle(int u, int num, long long content): u(u), num(num), content(content) {}
    bool operator <(const PqEle& o) const {
        return make_pair(num, content) > make_pair(o.num, o.content);
    }
};

// struct comp
// {
//         bool operator()(const PqEle &a, const PqEle &b)
//         {
//             return a.num > b.num;
//         }
// };
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    auto t0 = clock();
    int n, m;
    long long l;
    cin >> n >> m >> l;
    vector<vector<Edge>> adj_list(n);
    for (int i = 0; i < m; ++i) {
        int a, b;
        long long c;
        cin >> a >> b >> c;
        --a;
        --b;
        if (c <= l) {
            adj_list[a].push_back(Edge(a, b, c));
            adj_list[b].push_back(Edge(b, a, c));
        }
    }
    int q;
    cin >> q;
    vector<pair<int, int>> queries(q);
    for (int i = 0; i < q; ++i) {
        cin >> queries[i].first >> queries[i].second;
        --queries[i].first;
        --queries[i].second;
    }
    auto dijkstra = [&](int start_id) {
        priority_queue<PqEle> pq;
        pq.push(PqEle(start_id, 0, 0LL));
        vector<bool> visited(n, false);
        vector<int> dist(n, -1);
        while (!pq.empty())
        {
            auto p = pq.top();
            int node_id = p.u;
            pq.pop();
            if (visited[node_id]) {
                continue;
            }
            dist[node_id] = p.num;
            visited[node_id] = true;
            for (auto& edge : adj_list[node_id]) 
            {
                if (!visited[edge.v]) 
                {
                    if (edge.c + p.content > l) {
                        pq.push(PqEle(edge.v, p.num + 1, edge.c));
                    } else {
                        pq.push(PqEle(edge.v, p.num, edge.c + p.content));
                    }
                }
            }
        }
        return dist;
    };
    
    vector<vector<int>> dists(n);
    for (int i = 0; i < n; ++i) {
        dists[i] = dijkstra(i);
    }
    for (auto q : queries) {
        cout << dists[q.first][q.second] << "\n";
    }
    cerr << "time used = " << (clock() - t0) << endl;
    return 0;
}

Measured memory_bytes: 5524
#include <bits/stdc++.h>
#define ff first
#define ss second
#define endl '\n'
using namespace std;
const long long INF = (long long) 1e18;
const int mod = (int) 1e9+7;
const int MAXN = (int) 1e5+5;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll n;
ll dp[MAXN][3];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);cout.tie(nullptr);

    #ifdef Local
        freopen("../IO/int.txt","r",stdin);
        freopen("../IO/out.txt","w",stdout);
    #endif

    cin>>n;
    for(int i = 1; i <= n; i++){
        ll a, b, c;
        cin>>a>>b>>c;

        dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + a;
        dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + b;
        dp[i][2] = max(dp[i - 1][0], dp[i - 1][1]) + c;

    }
    ll ans = 0;
    for(int i = 0; i < 3; i++){
        ans = max(ans, dp[n][i]);
    }
    cout<<ans<<endl;


    #ifdef Local
        cout<<endl<<fixed<<setprecision(2)<<1000.0 * clock() / CLOCKS_PER_SEC<< " milliseconds ";
    #endif
}

Measured memory_bytes: 2560
#include <algorithm>
#include <bitset>
#include <complex>
#include <cstdio>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;

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

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

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

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

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;  cin >> n;
    cout << 24 + (24 - n) << '\n';

    return 0;
}


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

use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Formatter};
use std::io::*;
use std::ops::*;
use std::*;

// -----------------------------------------------
// Framework
// -----------------------------------------------

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

#[allow(unused_macros)]
macro_rules! debug {
    ($($arg:expr),*) => {
        #[cfg(debug_assertions)]
        {
            let entries = [$(&stringify!([$arg]:), &$arg as &Debug),*];
            stderr().write_fmt(format_args!("{:#?}\n", entries)).unwrap();
        }
    };
}

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

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

impl<T: Iterator> IteratorExt for T {}

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

fn p() {
    let n = 4;
    let m = 3;
    let d = 2;
    let mut H = vec![Vec::new(); m];
    let mut B = 0;

    for x in 0..n {
        for y in 0..n {
            for z in 0..n {
                let b = if (x as i32 - y).abs() == d { 1 } else { 0 }
                    + if (y - z).abs() == d { 1 } else { 0 };

                H[b].push(format!("{:?}", (x, y, z)));
                B += b;
            }
        }
    }

    let nm = (n as f64).powf(m as f64);
    debug!(H, B, nm);
    println!("{}", B as f64 / nm);
}

pub fn main() {
    let (n, m, d) = read!(i64, usize, i64);

    let p = if d == 0 {
        1_f64 / n as f64
    } else {
        // [n-d, d] -> ((n-d) - d)/n * (2/n)
        // <=d & <= n-d ->
        let k2 = (n - d) - min(n - d, d);
        let k1 = min(d, n - d) + (n - max(d, n - d));
        (k1 as f64 + 2_f64 * k2 as f64) / n as f64 / n as f64
    };
    let q = p * (m - 1) as f64;
    println!("{}", q);
    return;
}


Measured memory_bytes: 4352
//{{{
#include<algorithm>
#include<cmath>
#include<fstream>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<random>
#include<set>
#include<sstream>
#include<sys/time.h>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printw) FUNC(printwe) FUNC(printb) FUNC(printbe) FUNC(printd) FUNC(printde) FUNC(printdu);
#endif
template <class S, class T>
istream& operator >> (istream& in, pair<S, T>& p){ return in >> p.first >> p.second; }
template <class T>
istream& operator >> (istream& in, vector<T>& v){ for(auto& e : v){ in >> e; } return in; }
//}}}

struct UnionFind {
	vector<pair<int, int>> elems;
	UnionFind(int n):elems(n){
		for(int i = 0; i < n; i++){
			elems[i].first = i;
			elems[i].second = 1;
		}
	}
	void unite(int a, int b){
		if(elems[parent(a)].first == parent(b)){ return; }
		int sum = getSum(a) + getSum(b);
		//cout<<"sum "<<sum<<endl;
		elems[parent(a)].first = parent(b);
		elems[parent(b)].second = sum;
	}
	int getSum(int a){
		if(a == elems[a].first){
			return elems[a].second;
		}
		return getSum(elems[a].first);
	}
	bool same(int a, int b){
		return parent(a) == parent(b);
	}
private:
	int parent(int a){
		if(a == elems[a].first){
			return a;
		}
		return elems[a].first = parent(elems[a].first);
	}
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, m;
    cin >> n >> m;
    vector<ll> anss(m);
    vector<pair<int, int>> abs(m); cin >> abs;
    UnionFind uf(n + 1);
    ll num = n * (n - 1) / 2;
    for(int i = m - 1; i >= 0; i--){
        anss[i] = num;
        if(!uf.same(abs[i].first, abs[i].second)){
            num -= 1ll * uf.getSum(abs[i].first) * uf.getSum(abs[i].second);
        }
        uf.unite(abs[i].first, abs[i].second);
    }
    for(auto& ans : anss){
        cout << ans << '\n';
    }
}


Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<bool> vb;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  int n;
  cin >> n;
  vi p(n);
  rep(i, n) cin >> p[i];
  int m = n + 1, ans = 0;
  rep(i, n) {
    if(p[i] < m) {
      ans++;
      m = p[i];
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>

using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e9;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(int i = 0; i < n; i++)
#define RREP(i, n) for(int i = n - 1; i >= 0; i--)
#define REP2(i, n, k) for(int i = 0; i < n; i += k)


int main() {
    ll n, a[100005];
    
    cin >> n;
    REP(i, n){
        cin >> a[i];
    }
    
    ll ans = 0;
    REP(i, n - 1){
        ans += a[i] / 2;
        if(a[i] % 2 == 1 && a[i + 1] >= 1){
            a[i + 1]--;
            ans++;
        }
    }
    ans += a[n - 1] / 2;
    
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {

ll a,b,c,k;
cin>>a>>b>>c>>k;
ll ans=0;
for (size_t i = 0; i < k; i++)
{
  if(a>0){a--;ans++;continue;}
  if(b>0){b--;continue;}
  if(c>0){c--;ans--;continue;}
}

cout<<ans<<endl;

}
/*vector <int> a(3);
for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }*/

Measured memory_bytes: 3600
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <bitset>

using namespace std;
typedef long long ll;
const int MAXN = 50005, MAXM = 100005;
inline int readint()
{
	int res = 0, f = 1;
	char c = 0;
	while(!isdigit(c))
	{
		c = getchar();
		if(c=='-')
			f = -1;
	}
	while(isdigit(c))
		res = res*10+c-'0', c = getchar();
	return res*f;
}
int n,m,type,x[MAXM],y[MAXM];
bitset<MAXN> f[MAXN];
bool t[MAXN];
char ans[MAXM];
inline void solve1()
{
	for(int i = 1; i<=n; i++)
	    f[i][i] = 1;
	for(int i = m; i>=1; i--)
	    f[x[i]] = f[y[i]] = f[x[i]]|f[y[i]];
	for(int i = 2; i<=n; i++)
	    f[1] &= f[i];
	int now = 0;
	for(int i = 1; i<=n; i++)
        if(f[1][i])
        	now = i;
	if(!now)
	{
    	cout << -1 << endl;
    	return;
	}
	t[now] = true;
	for(int i = m; i>=1; i--)
	{
        if(t[x[i]])
        	ans[i] = '^';
        else
            ans[i] = 'v';
        t[x[i]] = t[y[i]] = t[x[i]]|t[y[i]];
	}
	for(int i = 1; i<=m; i++)
	    cout << ans[i];
	cout << endl;
}
int g[MAXN],h[MAXN];
inline void solve2()
{
	if(n==2&&m>=1)
	{
        cout << -1 << endl;
        return;
	}
	for(int i = 1; i<=n; i++)
		g[i] = 1, h[i] = i;
	for(int i = m; i>=1; i--)
	{
		if(g[h[x[i]]]>g[h[y[i]]])
			g[h[x[i]]]--, g[h[y[i]]]++, h[x[i]] = h[y[i]], ans[i] = 'v';
		else
		    g[h[x[i]]]++, g[h[y[i]]]--, h[y[i]] = h[x[i]], ans[i] = '^';
	}
	for(int i = 1; i<=m; i++)
		cout << ans[i];
	cout << endl;
}

int main()
{
	n = readint(), m = readint(), type = readint();
	for(int i = 1; i<=m; i++)
		x[i] = readint(), y[i] = readint();
	if(type==1)
	    solve1();
	else
	    solve2();
	return 0;
}


Measured memory_bytes: 306816
#include<cstdio>
#include<algorithm>

using namespace std;

int main(){
	int t;	scanf("%d",&t);
	while(t--){
		int n;
		static char s[40001];
		scanf("%d%s",&n,s);

		static bool book[2][10001];
		book[0][0]=(s[0  ]=='Y');
		book[1][0]=(s[2*n]=='Y');
		for(int i=1;i<n;i++){
			book[0][i]=(s[2*i-1    ]=='Y' || s[2*i    ]=='Y');
			book[1][i]=(s[2*i-1+2*n]=='Y' || s[2*i+2*n]=='Y');
		}
		book[0][n]=(s[2*n-1]=='Y');
		book[1][n]=(s[4*n-1]=='Y');

		int cost[2];
		if     (book[1][0])	cost[0]=3,cost[1]=2;
		else if(book[0][0])	cost[0]=1,cost[1]=1;
		else				cost[0]=0,cost[1]=1;
		for(int i=1;i<=n;i++){
			int prev[]={cost[0],cost[1]};
			if(book[0][i] && book[1][i]){
				cost[0]=min(prev[0]+4,prev[1]+3);
				cost[1]=min(prev[0]+3,prev[1]+3);
			}
			else if(book[0][i] && !book[1][i]){
				cost[0]=min(prev[0]+2,prev[1]+2);
				cost[1]=min(prev[0]+2,prev[1]+2);
			}
			else if(!book[0][i] && book[1][i]){
				cost[0]=min(prev[0]+4,prev[1]+3);
				cost[1]=min(prev[0]+3,prev[1]+2);
			}
			else{
				cost[0]=min(prev[0]+1,prev[1]+2);
				cost[1]=min(prev[0]+2,prev[1]+1);
			}
		}

		printf("%d\n",min(cost[0],cost[1]+1));
	}

	return 0;
}

Measured memory_bytes: 0
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i8 = int8_t;
using i32 = int32_t;
using i64 = int64_t;

constexpr char newl = '\n';
constexpr double eps = 1e-10;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
//#define fi first
//#define se second
#define debug(x) cout << #x << ": " << x << '\n';
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

template<typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
template<class T> void Print(vector<T> v) {
  F0R(i, v.size()) {
    cout << v[i] << ' ';
  }
  cout << newl;
}

#if 1


// INSERT ABOVE HERE
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int N;
  cin >> N;
  vector<int> xs(N);
  F0R(i, N) {
    cin >> xs[i];
  }

  i64 result = INT64_MAX;

  FOR(P, 1, 101) {
    i64 score = 0;
    F0R(i, N) {
      i64 d = xs[i] - P;
      score += d * d;
    }
    chmin(result, score);
  }
  cout << result;
}
#endif


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <stdio.h>

using namespace std;

#define PI 3.141592653589793
#define FOR(i,a,b) for(int i=int(a);i<int(b);++i)
#define RFOR(i,a,b) for(int i=int(b)-1;i>=int(a);--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)

int main() {
    double a,b,c;
    cin >> a >> b >> c;
    c = 180/c;
    //cout << a*b*sin(PI/c)/2.0 << endl;
    printf("%.5lf\n", a*b*sin(PI/c)/2.0);
    printf("%.5lf\n", sqrt(pow(a,2)+pow(b,2)-2.0*a*b*cos(PI/c))+a+b);
    printf("%.5lf\n", b*sin(PI/c));
    return 0;
}



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

using namespace std;

//#define FILE_IO

typedef pair<int, int> pii;
typedef pair<int, pii> p3i;

int N;
int a[305][305];
int d[305][305];
vector<p3i> roads;

int main()
{
    #ifdef FILE_IO
    freopen("1.in", "r", stdin);
    freopen("1.out", "w", stdout);
    #endif

    scanf("%d", &N);
    for(int i = 1; i <= N; i++)
        for(int j = 1; j <= N; j++)
            scanf("%d", &a[i][j]);
    for(int i = 1; i <= N; i++)
        for(int j = i + 1; j <= N; j++)
            roads.push_back({a[i][j], {i, j}});

    sort(begin(roads), end(roads));

    for(int i = 1; i <= N; i++)
        for(int j = 1; j <= N; j++)
            d[i][j] = (i == j) ? 0 : (-1);

    long long ans = 0;
    for(auto r: roads)
    {
        int l = r.first;
        int x = r.second.first;
        int y = r.second.second;

        if(d[x][y] < a[x][y] && d[x][y] != -1)
        {
            printf("-1\n");
            exit(0);
        }
        if(d[x][y] == a[x][y])  continue;

        ans += l;
        d[x][y] = d[y][x] = l;
        for(int i = 1; i <= N; i++)
            for(int j = 1; j <= N; j++)
                if(d[x][i] != -1 && d[i][j] != -1)
                {
                    if(d[x][j] == -1)   d[x][j] = d[x][i] + d[i][j];
                    else    d[x][j] = min(d[x][j], d[x][i] + d[i][j]);
                }
        for(int i = 1; i <= N; i++)
            for(int j = 1; j <= N; j++)
                if(d[y][i] != -1 && d[i][j] != -1)
                {
                    if(d[y][j] == -1)   d[y][j] = d[y][i] + d[i][j];
                    else    d[y][j] = min(d[y][j], d[y][i] + d[i][j]);
                }
        for(int i = 1; i <= N; i++)
            for(int j = 1; j <= N; j++)
            {
                if(d[i][x] != -1 && d[x][j] != -1)  d[i][j] = (d[i][j] == -1) ? (d[i][x] + d[x][j]) : min(d[i][j], d[i][x] + d[x][j]);
                if(d[i][y] != -1 && d[y][j] != -1)  d[i][j] = (d[i][j] == -1) ? (d[i][y] + d[y][j]) : min(d[i][j], d[i][y] + d[y][j]);
            }
    }
    cout << ans;


    return 0;
}


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

bool isPalindrome(string S) {
    string T = S;
    reverse(S.begin(), S.end());
    return S == T;
}

int main() {
    string S;
    cin >> S;
    bool ans = isPalindrome(S) && isPalindrome(S.substr(S.size() / 2 + 1));
    puts(ans ? "Yes" : "No");
}

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

typedef long long ll;

struct point { 
    ll x, y; int i; 
    point() {}
    point(ll x, ll y) : x(x), y(y) {}
};

int compare(ll d1, ll d2)
{
    if(d2 - d1 > 0) return -1;
    if(d1 - d2 > 0) return 1;   
    return 0;
}

int turn(point p, point q, point r)
{
    ll result = (r.x - q.x) * (p.y - q.y) - (r.y - q.y) * (p.x - q.x);
    return compare(result, 0); 
}

bool cw(point p, point q, point r)
{
    return turn(p, q, r) < 0;
}

bool cmp(point p1,point p2)
{
    return p1.x < p2.x || (p1.x == p2.x && p1.y < p2.y);
}

vector<point> convexHull(vector<point> P)
{
    int n = (int)P.size(), k = 0;
    vector<point> H(2 * n);
    sort(P.begin(), P.end(),cmp);
    for(int i = 0; i < n; i++)   
    {
        while(k >= 2 && cw(H[k - 2], H[k - 1], P[i])) k--;
        H[k++] = P[i];
    }
    for(int i = n - 2, t = k + 1; i >= 0; i--) 
    {
        while(k >= t && cw(H[k - 2], H[k - 1], P[i])) k--;
        H[k++] = P[i];
    }
    H.resize(k); H.pop_back(); 
    return H;
}

// dot product 
double dot(point p, point q) { return p.x * q.x + p.y * q.y; }
// modulo^2 de un punto (distance to origin)
double norm2(point p) { return p.x * p.x + p.y * p.y; }


double angle(point a, point o, point b) // angle AOB (radians)
{
   point u(a.x - o.x, a.y - o.y); // u: vector oa
   point v(b.x - o.x, b.y - o.y); // v: vector ob
   return acos(dot(u,v) / sqrt(norm2(u) * norm2(v))); // dot product
}


int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    cout << fixed << setprecision(10);
    int n,m;
    double ans[105];
    vector<point> p,h;
    while(cin >> n)
    {
        p = vector<point>(n);
        for(int i = 0; i < n; i++)
        {
            cin >> p[i].x >> p[i].y;
            p[i].i = i;
        }
        h = convexHull(p);
        m = h.size();
        for(int i = 0; i < n; i++)
            ans[i] = 0;
        for(int i = 0; i < m; i++)
            ans[h[i].i] = (M_PI - angle(h[(i-1+m)%m], h[i], h[(i+1)%m])) / (2*M_PI);
        for(int i = 0; i < n; i++)
            cout << ans[i] << '\n';
    }
    return 0;
} 

Measured memory_bytes: 256
import kotlin.math.PI

fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)
fun <T> Array<Array<T>>.print() {
    this.forEach {
        println(it.joinToString(" "))
    }
}

fun main(args: Array<String>) {
    val r = readInt()
    println(2*r* PI)
}


Measured memory_bytes: 34652
s1 = input()

n1 = 0
if s1 == "SUN":
    n1 = 7
elif s1 == "MON":
    n1 = 6
elif s1 == "TUE":
    n1 = 5
elif s1 == "WED":
    n1 = 4
elif s1 == "THU":
    n1 = 3
elif s1 == "FRI":
    n1 = 2
elif s1 == "SAT":
    n1 = 1

print(n1)

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

int main() {
  int a, b;
   1<=a==b<=10000;
  
cin>>a>>b;
    
  if(a*b%2==0){
   cout<<"Even"<<endl; 
  }
  else{
   cout<<"Odd"<<endl; 
  }
}

Measured memory_bytes: 256
def f(n):
  cnt = 0
  while n:
      cnt += 1
      n = n % bin(n).count('1')

  return cnt

def main():
  n = int(input())
  src = input()
  base = int(src, 2)
  base_cnt = src.count('1')

  basep = base % (base_cnt + 1)
  basem = base % (base_cnt - 1) if base_cnt > 1 else 0

  for i, s in enumerate(src):
    i = n - 1 - i
    num = None

    if s == '0':
      mod = base_cnt + 1
      num = (basep + pow(2, i, mod)) % mod
    elif base_cnt > 1:
      mod = base_cnt - 1
      num = (basem - pow(2, i, mod)) % mod
    else:
      print(0)
      continue

    print(1 + f(num))


main()


Measured memory_bytes: 9464
#pragma warning( disable : 6031)

#include <stdio.h>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <math.h>
int minimum(int a, int b) { return a < b ? a : b; }
int maximum(int a, int b) { return a > b ? a : b; }
const long long mod = 1000000007;
//const long long mod = 998244353;
using std::vector;
using std::pair;
using std::string;
using std::map;
using std::abs;
int main() {
	int N, M, Q;
	scanf("%d %d %d", &N, &M, &Q);
	auto a = new int[Q];
	auto b = new int[Q];
	auto c = new int[Q];
	auto d = new int[Q];
	for (int i = 0; i < Q; i++)scanf("%d %d %d %d", a + i, b + i, c + i, d + i);
	int max = 0;
	auto A = new int[N] {};
	auto B = new int[N + M - 1]{};
	for (int i = 0; i < M - 1; i++)B[N + i] = 1;
	do {
		int j = 0;
		int k = 0;
		for (int i = 0; i < N + M - 1; i++) {
			if (B[i])j++;
			else {
				A[k] = j;
				k++;
			}
		}
		int sc = 0;
		for (int i = 0; i < Q; i++) {
			if (A[b[i] - 1] - A[a[i] - 1] == c[i]) {
				sc += d[i];
			}
		}
		//for (int i = 0; i < N; i++)printf(" %d ", A[i]);
		//printf("%d\n", sc);
		max = maximum(max, sc);
	} while (std::next_permutation(B, B + N + M - 1));
	printf("%d", max);
	return 0;
}

Measured memory_bytes: 3220
#include <stdio.h> 
int main(){
  int n;
  while(scanf("%d",&n)!=EOF){
    int ans = 0;
    for(int a=0;a<=9;a++){
      for(int b=0;b<=9;b++){
        for(int c=0;c<=9;c++){
          for(int d=0;d<=9;d++){
            if (a+b+c+d==n) ans++;
          }
        }
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}



Measured memory_bytes: 2032
#include <iostream>
#include <queue>
#include <functional>
#include <map>
#include <vector>

using namespace std;

const int INF = 9999999;

int solve( int from, int to, int cost[101][101], int n )
{
	int dist[101];
	int history[101];

	for( int i = 0;i < 101;i++ ){
		dist[i] = INF;
		history[i] = 0;
	}

	dist[from] = 0;

	priority_queue<pair<int,int>,vector< pair<int,int> >,greater< pair<int,int> > > q;
	q.push( make_pair(0,from) );

	while( !q.empty() ){
		pair<int,int> a = q.top();
		int u = a.second;
		history[u] = 1;
		q.pop();

		for( int i = 1;i <= n;i++ ){
			if( history[i] ) continue;
			if( cost[u][i] == INF ) continue;

			if( dist[i] > cost[u][i] + dist[u] ){
				dist[i] = cost[u][i] + dist[u];
				q.push( make_pair(dist[i],i ) );
			}
		}
	}
	return dist[to];
}

int main(void){
	int n,m;
	int cost[101][101];
	int time[101][101];

	while( cin >> n >> m && n != 0 ){
		for( int i = 0;i < 101;i++ ){
			for( int j = 0;j < 101;j++ ){
				cost[i][j] = INF;
				time[i][j] = INF;
			}
		}
		for( int i = 0;i < 101;i++ ){
			cost[i][i] = 0;
			time[i][i] = 0;
		}
		for( int i = 0;i < n;i++ ){
			int a,b,c,d;
			cin >> a >> b >> c >> d;
			cost[a][b] = c;
			cost[b][a] = c;
			time[a][b] = d;
			time[b][a] = d;
		}

		int k;
		cin >> k;

		for( int i = 0;i < k;i++ ){
			int p,q,r;
			cin >> p >> q >> r;

			cout << solve( p, q, r ? time : cost, m ) << endl;
		}
	}
			
	return 0;
}

Measured memory_bytes: 0
#include<stdio.h>
#include<string.h>
int main(){
    char s[10],t[10];
    int a,b;
    char u[10];
    
    scanf("%s %s",s,t);
    scanf("%d %d",&a,&b);
    scanf("%s",u);
    
    if(strcmp(s,u) == 0){
        printf("%d %d",a-1,b);
    }else{
        printf("%d %d",a,b-1);
    }
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,k;
    cin >> n >> k;
    int sum = 0;
    for(int i = 0;i < n;i++)
    {
        int x;
        cin >> x;
        sum += min(double(x),fabs(x - k)) * 2;
    }
    cout << sum;
    
    return 0;
}

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

int main()
{
	int A, B, C;
	cin >> A >> B >> C;
	int amari = A - B;
	if (amari >= C) {
		cout << 0;
	}
	else {
		cout << C - amari;
	}
	return 0;
}


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

int main(){
    int h,a;
    cin >> h >> a ;
    int ans = h/a ;
    if (h % a != 0)
    {
        ans += 1 ;
    }
    cout << ans << endl ;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
int main(){
  int n1,n2;
  int *A,*B;
  int i,j,count=0;
  
  scanf("%d",&n1);


   A  = (int *)malloc(n1 * sizeof(int));
   
  for(i=0;i<n1;i++){
    scanf("%d",&A[i]);
  }

  scanf("%d",&n2);

  B  = (int *)malloc(n2 * sizeof(int));
   
    
    for(i=0; i<n2; i++){
      scanf("%d",&B[i]);
    }

  for(j=0; j<n2; j++){
    for(i=0; i<n1; i++){
      if(A[i]==B[j]){
	count++;
	break;
      }
    }
  }
    printf("%d\n",count);
    return 0;
  }
 



Measured memory_bytes: 2108
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vint = vector<int>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vchar = vector<char>;
using vvchar = vector<vchar>;
using vp = vector<P>;
using vpp = vector<pair<P, P>>;
using vvp = vector<vp>;

#define rep(i, n) for (int i = 0; i < n; ++i)
#pragma region Debug
istream &operator>>(istream &is, P &a)
{
    return is >> a.first >> a.second;
}
ostream &operator<<(ostream &os, const P &a) { return os << "(" << a.first << "," << a.second << ")"; }

template <typename T>

void view(const std::vector<T> &v)
{
#ifndef ONLINE_JUDGE
    for (const auto &e : v)
    {
        std::cout << e << " ";
    }
    std::cout << std::endl;
#endif
}
template <typename T>
void view(const std::vector<std::vector<T>> &vv)
{
    for (const auto &v : vv)
    {
        view(v);
    }
}
#pragma endregion

int main()
{
    int n, m;
    cin >> n >> m;
    map<ll, ll> a;
    rep(i, n)
    {
        int x;
        cin >> x;
        a[x]++;
    }

    rep(honya, m)
    {
        int b, c;
        cin >> b >> c;
        a[c] += b;
    }

    ll ans = 0;
    ll c = n;
    for (auto p = a.rbegin(); p != a.rend(); ++p)
    {
        pair<ll, ll> q = *p;
        ans += q.first * min(c, q.second);
        c -= q.second;
        if (c <= 0)
            break;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 15976
#include <iostream>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
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; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e15;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
const ll MAX = 400010;
constexpr ll nx[8] = {1,0,-1,0,-1,-1,1,1};
constexpr ll ny[8] = {0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    vector<P> st,ch;
    ll n,m,a,b,c,d;
    cin >> n >> m;
    rep(i,n){
        cin >> a >> b;
        st.push_back(P(a,b));
    }
    rep(i,m){
        cin >> c >> d;
        ch.push_back(P(c,d));
    }
    rep(i,n){
        tie(a,b) = st[i];
        ll ans,now = INF;
        rep(j,m){
            tie(c,d) = ch[j];
            if (chmin(now,abs(a-c)+abs(b-d))) ans = j;
        }
        PRINT(ans+1);
    }
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;

class Main {

    public static void main(String[] args) throws IOException {
        doit(args, System.in, System.out);
    }

    static void doit(String[] args, InputStream in, PrintStream out)
            throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        while (true) {
            String line = reader.readLine();
            if (line == null || line.isEmpty()) {
                break;
            }
            String[] values = line.split(" ");
            double xa1 = Double.parseDouble(values[0]);
            double ya1 = Double.parseDouble(values[1]);
            double xa2 = Double.parseDouble(values[2]);
            double ya2 = Double.parseDouble(values[3]);
            double xb1 = Double.parseDouble(values[4]);
            double yb1 = Double.parseDouble(values[5]);
            double xb2 = Double.parseDouble(values[6]);
            double yb2 = Double.parseDouble(values[7]);
            String result = "YES";
            if (xa2 < xb1 || xb2 < xa1 || ya2 < yb1 || yb2 < ya1) {
                result = "NO";
            }
            out.println(result);
        }
    }
}

Measured memory_bytes: 10000
#include <iostream>
#include <fstream>
#include <iomanip>
#include <math.h>
#include <limits.h>
#include <algorithm>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <string>
#include <string.h>
#include <sstream>
#include <ctime>

using namespace std;

#define eps 1e-12
#define pi 3.14159265358979323846
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define bgn begin
#define ll long long
#define ld long double
#define ull unsigned long long
#define ii pair<ll,ll>









ll x;

void solve()
{
	cin>>x;
	for(ll i=1;;i++)
	{
		if(i*(i+1)>=2*x)
		{
			cout<<i<<"\n";
			return;
		}
	}
}

int main()
{
	std::ios::sync_with_stdio(0);
	cin.tie(0);
#ifdef localProject
	freopen("in.txt","r",stdin);
#endif
	solve();
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,l,r) for (int i=l;i<=r;i++)
using namespace std;
#define PII pair<int,int>
const int maxn=100500;
int n;
int main(){
    scanf("%d",&n);
    int t=1;
    while (t<n) t*=2;
    if (n==t) puts("No");
    else {
        puts("Yes");
        if (n&1) {
            for (int i=2;i<=n;i+=2){
                printf("%d %d\n",1,i);
                printf("%d %d\n",i,i+1);
                printf("%d %d\n",1,i+n+1);
                printf("%d %d\n",i+1+n,i+n);
            }
            printf("%d %d\n",1+n,n+2);
        }
        else {
            for (int i=2;i<=n-1;i+=2){
                printf("%d %d\n",1,i);
                printf("%d %d\n",i,i+1);
                printf("%d %d\n",1,i+n+1);
                printf("%d %d\n",i+1+n,i+n);
            }
            printf("%d %d\n",1+n,n+2);
            rep(i,2,n-1) if ((1^i^n)<n){
                int x=i^1^n;
                printf("%d %d\n",i,n);
                if (x&1) printf("%d %d\n",n+x,2*n);
                else printf("%d %d\n",x,2*n);
                break;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 2304
#include <bits/stdc++.h>
 
#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif // LOCAL_
#define dumpi(x1) fprintf(stderr, "#%s.%d (%s) = (%d)\n", __func__, __LINE__, #x1, x1);
#define dumpii(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%d, %d)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumpiii(x1, x2, x3) fprintf(stderr, "#%s.%d (%s, %s, %s) = (%d, %d, %d)\n", __func__, __LINE__, #x1, #x2, #x3, x1, x2, x3);
#define dumpl(x1) fprintf(stderr, "#%s.%d (%s) = (%ld)\n", __func__, __LINE__, #x1, x1);
#define dumpll(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%ld, %ld)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumpd(x1) fprintf(stderr, "#%s.%d (%s) = (%lf)\n", __func__, __LINE__, #x1, x1);
#define dumpdd(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%lf, %lf)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define loop for(;;)
 
struct S002 {
  int n;
  S002& operator > (long& x) {
    n = x;
    return *this;
  }
  S002& operator > (long&& x) {
    n = x;
    return *this;
  }
  S002& operator >= (long& x) {
    if( scanf("%ld", &x) <= 0 ) exit(0);
    return *this;
  }
  S002& operator >= (double& x) {
    if( scanf("%lf", &x) <= 0 ) exit(0);
    return *this;
  }
  S002& operator >= (std::string& s) {
    if( not (std::cin >> s) ) exit(0);
    return *this;
  }
  template<typename a>
  S002& operator >= (std::vector<a>& v) {
    v.resize(n);
    for(long i = 0; i < n; ++i) {
      *this >= v[i];
    }
    return *this;
  }
  template<typename a, std::size_t s>
  S002& operator >= (std::array<a, s>& x) {
    for(long i = 0; i < (long)s; ++i) {
      *this >= x[i];
    }
    return *this;
  }
};

struct Solver {
  long n, m;
  std::vector<std::string> xs;
  std::vector<std::string> ys;
  Solver() {
    S002 r;
    r >= n >= m >n>= xs >m>= ys;
  }
  void solve() {
    long t = n - m + 1;
    for(long i = 0; i < t; ++i) {
      for(long j = 0; j < t; ++j) {
        bool t = true;
        for(long y = 0; y < m; ++y) {
          for(long x = 0; x < m; ++x) {
            if( xs[i+y][j+x] != ys[y][x] ) t = false;
          }
        }
        if( t ) {
          puts("Yes");
          return;
        }
      }
    }
    puts("No");
  }
};
 
int main() {
  for(;;) std::unique_ptr<Solver>(new Solver())->solve();
  return 0;
}

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

int main() {
    int64_t N;
    cin >> N;
    struct Task {
        int64_t L, R;

        bool operator<(const Task& rhs) const {
            return (L != rhs.L ? L < rhs.L : R < rhs.R);
        }
    };

    vector<Task> tasks(N);
    for (int64_t i = 0; i < N; i++) {
        cin >> tasks[i].L >> tasks[i].R;
    }
    sort(tasks.begin(), tasks.end());

    //[i, N)におけるRの最小値
    vector<int64_t> R_min(N, LLONG_MAX);
    R_min[N - 1] = tasks[N - 1].R;
    for (int64_t i = N - 2; i >= 0; i--) {
        R_min[i] = min(R_min[i + 1], tasks[i].R);
    }

    //可能性1
    int64_t ans = 0;
    int64_t R_min_i = tasks[0].R;
    for (int64_t i = 1; i < N; i++) {
        //[0, i)のタスクを1回目のコンテストに、[i, N)のタスクを2回目のコンテストに使う
        //[0, i)のLの最大値はソートしているのでtasks[i - 1].L
        //[0, i)のRの最小値はR_min_i
        int64_t rem1 = max(R_min_i - tasks[i - 1].L + 1, (int64_t) 0);

        //[i, N)のLの最大値はソートしているのでtasks[N - 1].L
        //[i, N)のRの最小値はR_min[i]
        int64_t rem2 = max(R_min[i] - tasks[N - 1].L + 1, (int64_t) 0);

        //答えの更新
        ans = max(ans, rem1 + rem2);

        //R_min_iの更新
        R_min_i = min(R_min_i, tasks[i].R);
    }

    R_min_i = LLONG_MAX;
    for (int64_t i = 0; i < N; i++) {
        //i番目だけを1回目のコンテストに、それ以外を2回目のコンテストに使う
        int64_t rem1 = tasks[i].R - tasks[i].L + 1;

        int64_t rem2 = max(min(R_min[i + 1], R_min_i) - tasks[N - 1].L + 1, (int64_t)0);

        //答えの更新
        ans = max(ans, rem1 + rem2);

        //R_min_iの更新
        R_min_i = min(R_min_i, tasks[i].R);
    }

    cout << ans << endl;
}

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

int main()
{
	ll n, k, a = 0;
	cin >> n >> k;
	if(k == 0) a = n * n;
	else
		for(int i = k + 1; i <= n; i++){
			a += (n / i) * (i - k);
			if(n % i >= k) a += (n % i - k + 1);
		} 
	cout << a << endl;
	return 0;
}

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

using namespace std;
using ll = long long;

#define MOD 1000000007
template<int mod>
struct ModInt{
   int x;
   ModInt():x(0){}
   ModInt(long long y):x(y>=0?y%mod:(mod-(-y)%mod)%mod){}
   ModInt &operator+=(const ModInt &p){
       if((x+=p.x)>=mod)x-=mod;
       return *this;
   }
   ModInt &operator-=(const ModInt &p){
       if((x+=mod-p.x)>=mod)x-=mod;
       return *this;
   }
   ModInt &operator*=(const ModInt &p){
       x=(int)(1LL*x*p.x%mod);
       return *this;
   }
   ModInt &operator/=(const ModInt &p){
       *this*=p.inverse();
       return *this;
   }
   ModInt &operator^=(long long p){
       ModInt res = 1;
       for (; p; p >>= 1) {
           if (p & 1) res *= *this;
           *this *= *this;
       }
       return *this = res;
   }
   ModInt operator-()const{return ModInt(-x);}
   ModInt operator+(const ModInt &p)const{return ModInt(*this)+=p;}
   ModInt operator-(const ModInt &p)const{return ModInt(*this)-=p;}
   ModInt operator*(const ModInt &p)const{return ModInt(*this)*=p;}
   ModInt operator/(const ModInt &p)const{return ModInt(*this)/=p;}
   ModInt operator^(long long p)const{return ModInt(*this)^=p;}
   bool operator==(const ModInt &p)const{return x==p.x;}
   bool operator!=(const ModInt &p)const{return x!=p.x;}
   explicit operator int() const { return x; }
   ModInt operator=(const int p) {x = p; return ModInt(*this);}
   ModInt inverse()const{
       int a=x,b=mod,u=1,v=0,t;
       while(b>0){
           t=a/b;
           a-=t*b;
           std::swap(a,b);
           u-=t*v;
           std::swap(u,v);
       }
       return ModInt(u);
   }
   friend std::ostream &operator<<(std::ostream &os,const ModInt<mod> &p){
       return os<<p.x;
   }
   friend std::istream &operator>>(std::istream &is,ModInt<mod> &a){
       long long x;
       is>>x;
       a=ModInt<mod>(x);
       return (is);
   }
};
typedef ModInt<MOD> mint;

int main()
{
    int n; cin >> n;
    vector<pair<int,int>> p;
    map<pair<ll,ll>, pair<int,int>> mp;
    int zero = 0;

    for(int i = 0; i < n; i++) {
        ll x, y; cin >> x >> y;
        if(x == 0 && y == 0) {
            zero++; continue;
        }
        ll g = gcd(x, y);
        x /= g, y /= g;
        if(y < 0) x = -x, y = -y;
        if(y == 0 && x < 0) x = -x, y = -y;
        //90°回す
        bool rot90 = x <= 0;
        if(rot90) {
            ll tmp = x;
            x = y, y = -tmp;
        }
        if(rot90)mp[{x,y}].first++;
        else mp[{x, y}].second++;
    }

    mint ans = 1;
    for (auto p : mp) {
        int s = p.second.first;
        int t = p.second.second;
        cerr << s << " :: " << t << endl;
        mint now = 1;
        now += (mint(2)^s) - 1;
        now += (mint(2)^t) - 1;
        ans *= now;
    }
    ans -= 1;
    ans += zero;
    cout << ans << endl;
}

Measured memory_bytes: 16100
n,m = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort(reverse=True)

while 1:
    a.sort(reverse=True)
    if m > 0:
        a[0] //= 2
        tmp_max = a[0] 
        m -=1
    if m == 0:
        break
    for i in range(1,n):
        if tmp_max <= a[i]:
            a[i] //= 2
            m -= 1
        if m == 0:
            break
print(sum(a))

Measured memory_bytes: 63984
package main

import (
	"fmt"
	"strconv"
)

func main() {
	var s, t, u int
	fmt.Scan(&s)
	fmt.Scan(&t)
	fmt.Scan(&u)

	res1 := s - u
	if res1 < 0 {
		res2 := t + res1
		if res2 < 0 {
			fmt.Println("0 0")
		} else {
			fmt.Println(strconv.Itoa(0) + " " + strconv.Itoa(res2))
		}
	} else {
		fmt.Println(strconv.Itoa(res1) + " " + strconv.Itoa(t))
	}
}


Measured memory_bytes: 512
#include <cstdio>
#include <iostream>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)

int main(void) {
  int D;
  cin >> D;
  if(D == 25) {
    puts("Christmas");
  } else if(D == 24) {
    puts("Christmas Eve");
  } else if(D == 23) {
    puts("Christmas Eve Eve");
  } else if(D == 22) {
    puts("Christmas Eve Eve Eve");
  }
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
#ifdef DEBUG
#define display(x) cerr << #x << endl;
#define displaya(a, st, n)\
	{cerr << #a << " = {";\
	for(int qwq = (st); qwq <= (n); ++qwq) {\
		if(qwq == (st)) cerr << a[qwq];\
		else cerr << ", " << a[qwq];\
	} cerr << "}" << endl;}
#define displayv(v) displaya(v, 0, (int)(v).size() - 1)
#endif
template<typename T> bool chmin(T &a, const T &b) { return a > b ? a = b, true : false; }
template<typename T> bool chmax(T &a, const T &b) { return a < b ? a = b, true : false; }

const int maxN = 1000 + 5;
const int INF = 0x3f3f3f3f;
int n, m;
bool a[maxN][maxN];
int d[maxN][maxN];
const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};

int main() {
	ios::sync_with_stdio(false);
	cin >> n >> m;
	memset(a, 0, sizeof(a));
	memset(d, INF, sizeof(d));
	queue<pii> Q;
	for(int i = 1; i <= n; ++i) {
		static char s[maxN];
		cin >> (s + 1);
		assert(strlen(s + 1) == m);
		for(int j = 1; j <= m; ++j) a[i][j] = s[j] == '.';
		for(int j = 1; j <= m; ++j) if(s[j] == '#') d[i][j] = 0, Q.emplace(i, j);
	}
	int ans = 0;
	while(Q.size()) {
		int x = Q.front().first, y = Q.front().second; Q.pop();
		for(int i = 0; i < 4; ++i) {
			int nx = x + dx[i], ny = y + dy[i];
			if(a[nx][ny] && chmin(d[nx][ny], d[x][y] + 1)) {
				Q.emplace(nx, ny);
				chmax(ans, d[nx][ny]);
			}
		}
	}
	cout << ans << endl;
	return 0;
}


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

signed main(){
    int N; cin>>N;
    map<char,int> dic;
    for(int i=0;i<N;i++){
        string S; cin>>S;
        dic[S[0]]++;
    }
    int ans=0;
    ans+=dic['M']*dic['A']*(dic['R']+dic['C']+dic['H']);
    ans+=dic['M']*dic['R']*(dic['C']+dic['H']);
    ans+=dic['M']*dic['C']*dic['H'];
    ans+=dic['A']*dic['R']*(dic['C']+dic['H']);
    ans+=dic['C']*dic['H']*(dic['A']+dic['R']);
    cout<<ans<<endl;
}

Measured memory_bytes: 764
#include <iostream>
#include <algorithm>
#include <vector>
#include <tuple>
#include <string>
using namespace std;

signed main() {
  int n; cin >> n;
  vector<tuple<string, int, int> > a;

  for(int i = 1; i <= n; i++) {
    string s;
    int p;
    cin >> s >> p;
    // p は降順にソートしなければならないので -1 倍テク
    p *= -1;
    // tie は pair で言うところの make_pair. tuple を生成する
    a.push_back(tie(s, p, i));
  }

  // s が同じなら p で比較. p が同じなら i で比較する
  // 今回は p がそれぞれ異なるので、i で比較されてしまう心配は無い
  sort(a.begin(), a.end());

  for(int i = 0; i < n; i++) {
    cout << get<2>(a[i]) << endl;
  }
}


Measured memory_bytes: 256
class DFS:
    def __init__(self, N):
        self.N = N
        self.visited = [False for i in range(N)]
        self.graph = [[False for i in range(N)] for j in range(N)]

    def dfs(self, v):
        self.visited[v] = True
        for i in range(self.N):
            if (self.graph[v][i] == False):
                continue
            if (self.visited[i]):
                continue
            self.dfs(i)


N,M = map(int, input().split())
a = []
b = []
dfs = DFS(N)

for i in range(M):
    x,y = map(int, input().split())
    a.append(x-1)
    b.append(y-1)
    dfs.graph[a[i]][b[i]] = True
    dfs.graph[b[i]][a[i]] = True
ans = 0
for i in range(M):

    dfs.graph[a[i]][b[i]] = False
    dfs.graph[b[i]][a[i]] = False
    dfs.dfs(0)
    bridge = False
    for j in range(N):
        if (dfs.visited[j] == False):
            bridge = True
    if (bridge == True):
        ans +=1
    dfs.visited = [False for i in range(N)]
    dfs.graph[a[i]][b[i]] = True
    dfs.graph[b[i]][a[i]] = True
print(ans)

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;

namespace AtCoder_1
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = CinTAr();
            if(a[0] < a[1]) { Cout("0"); }
            else { Cout("10"); }
        }

        static string Cin() { return Console.ReadLine(); }
        static string[] CinAr() { return Console.ReadLine().Split(' '); }
        static int CinT() { return S2i(Cin()); }
        static int[] CinTAr() { return CinAr().Select((x, i) => { return int.Parse(x); }).ToArray(); }
        static int S2i(string s) { return int.Parse(s); }
        static void Cout(string s) { Console.WriteLine(s); }
    }
}


Measured memory_bytes: 13268