akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
#include <iomanip>
using namespace std;
typedef long long ll;

const ll MOD = 1e9+7;
ll pt[100000];
int main()
{
	int n;
	ll k;
	int q;
	cin>>n>>k>>q;
	fill(pt,pt+100000,0);
	for(int i=0;i<q;i++)
	{
		int a;
		cin>>a;
		a--;
		pt[a]++;
	}
	for(int i=0;i<n;i++)
	{
		if(k-(q-pt[i])>0)
			cout<<"Yes"<<endl;
		else
			cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 1408
#include <iostream>
using namespace std;
int main()
{
 int n,i,v;
 cin>>n;
 int oo[n],ao[n];
 /* oo=original order ao=after order gc=gradually count */
 for(int i=0;i<n;i++){
    cin>>v;
    ao[v-1]=i+1;
 }

 for(int i=0;i<n;i++){
    cout<<ao[i]<<" ";
 }
 return 0;
}

Measured memory_bytes: 1152
#include<stdio.h>
int main()
{
  int C[4]={0},N,four=scanf("%d",&N);
  char temp[4],judge[4][4]={"AC","WA","TLE","RE"};
  while(N--)
  {
    four=scanf("%s",temp);
    if(temp[0]=='A')C[0]++;
    else if(temp[0]=='W')C[1]++;
    else if(temp[0]=='T')C[2]++;
    else C[3]++;
  }
  four=4;while(four--)printf("%s x %d\n",judge[3-four],C[3-four]);
}

Measured memory_bytes: 1732
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (n); ++i)
#define FOR(i, m, n) for(ll i = m; i < (n); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
using vi = vector<int>;
using vii = vector<vi>;
using pii = pair<int, int>; 
using vl = vector<ll>;
using vll = vector<vl>;
using pll = pair<ll, ll>;

int main() {
    ll N;
    cin >> N;
    map<ll, ll> mp;
    vl A(N);
    rep(i, N){
        ll a;
        cin >> a;
        if(mp.count(a)) mp.at(a)++;
        else mp[a] = 1;
    }
    for(auto p : mp){
        if(p.second != 1){
            cout << "NO";
            return 0;
        }
    }
    cout << "YES";
}

Measured memory_bytes: 14336
// #pragma GCC target("avx")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
// #define BEGIN_STACK_EXTEND(size) void * stack_extend_memory_ = malloc(size);void * stack_extend_origin_memory_;char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);*stack_extend_dummy_memory_ = 0;asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
// #define END_STACK_EXTEND asm volatile("mov %%rax, %%rsp"::"a"(stack_extend_origin_memory_));free(stack_extend_memory_);

#include<stdio.h>
#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<bitset>
#include<numeric>
#include<unordered_set>
#include<unordered_map>
#include<complex>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const long double EPS=1e-9;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3100000;
const int UF_SIZE = 3100000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int pw_mod_int(int a,int b,int M){
		if(a<0)return 0;
		if(b<0)return 0;
		int ret=1;
		while(b){
			if(b%2)ret=(long long)ret*a%M;
			a=(long long)a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
	int UF[UF_SIZE];
	void init_UF(int n){
		for(int i=0;i<n;i++)UF[i]=-1;
	}
	int FIND(int a){
		if(UF[a]<0)return a;
		return UF[a]=FIND(UF[a]);
	}
	void UNION(int a,int b){
		a=FIND(a);b=FIND(b);if(a==b)return;
		if(UF[a]>UF[b])swap(a,b);
		UF[a]+=UF[b];UF[b]=a;
	}
}
// ここから編集しろ
int ans[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int main(){
	int a,b;scanf("%d%d",&a,&b);
	if(a>b)swap(a,b);
	long long ret=0;
	if(a==1)ret=1;
	else{
		ret=((long long)a*b+1)/2;
	}
	printf("%lld\n",ret);
}

Measured memory_bytes: 128
#[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)*}
    };
}
#[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")
    };
}

fn res(v1: i64, v2: i64) -> i64 {
    if v1 == -1 {
        0
    } else {
        v1 / v2 + 1
    }
}
fn main() {
    input! {
        a: i64,
        b: i64,
        x: i64,
    }
    println!("{}", res(b, x) - res(a - 1, x));
     
} 


Measured memory_bytes: 4352
from collections import Counter, defaultdict
n = int(input())
lc = [chr(i) for i in range(97, 97+26)]
ans_dict = Counter(input())

for _ in range(n-1):
    S = input()
    tmp = {k:0 for k in lc}
    for s in S:
        tmp[s] += 1

    for k in tmp.keys():
        try:
            ans_dict[k] = min(ans_dict[k], tmp[k])
        except:
            pass

ans = ''
for k, v in sorted(ans_dict.items()):
    ans += k * v
print(ans)

Measured memory_bytes: 9472
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REP2(i, n) for (int i = 1; i <= (int)(n); i++)
#define FOR(i, m, n) for (int i = m; i n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define REVE(x) reverse(x.begin(), x.end())
#define all(x) (x).begin(), (x).end()
struct initon
{
    initon()
    {
        cin.tie(0);
        ios::sync_with_stdio(false);
    };
};
int k=0,n=0, m=0, l=0,a=0, b=0, c=0, d=0,e=0,ans=0,ans2=0,x=0,y=0;
string s,t,S;
signed main() {
    int H, W, h, w;
    cin >> H >> W >> h >> w;
    cout << (H - h) * (W - w);
}

Measured memory_bytes: 3564
#include <stdio.h>

#define Mod 998244353

long long div_mod(long long x, long long y, long long z)
{
	if (x % y == 0) return x / y;
	else return (div_mod((1 + x / y) * y - x, (z % y), y) * z + x) / y;
}

long long combination(int n, int k)
{
	if (k == 0) return 1;
	
	static long long ans[300][300] = {};
	if (ans[n][k] != 0) return ans[n][k];
	
	int i;
	long long x, y;
	for (i = n, x = 1; i >= n - k + 1; i--) x = x * i % Mod;
	for (i = 2, y = 1; i <= k; i++) y = y * i % Mod;
	ans[n][k] = div_mod(x, y, Mod);
	return ans[n][k];
}

int main()
{
	int K;
	char S[301];
	scanf("%s %d", S, &K);

	int i, j, k, l, m, count[151][2] = {}, sum[2] = {};
	count[0][S[0] - '0']++;
	for (l = 1, k = 0; S[l] != 0; l++) {
		if (S[l] == S[l-1] || S[l] == '1') count[k][S[l] - '0']++;
		else count[++k][0]++;			
	}
	
	long long dp[2][301][301] = {};
	if (count[0][0] == 0) i = 1;
	else i = 0;
	dp[i][0][count[i][0]+1] = 1;
	for (j = 1; j <= count[i][1]; j++) {
		for (k = 1; k <= count[i][0]; k++) dp[i][j][k] = combination(j + count[i][0] - k - 1, j - 1);
	}
	
	for (sum[0] = count[i][0], sum[1] = count[i++][1]; count[i][1] > 0; i++) {
		sum[0] += count[i][0];
		for (j = 0; j <= sum[1]; j++) {
			for (k = 1; k <= count[i][0]; k++) dp[i%2][j][k] = 0;
			for (; k <= sum[0] + 1; k++) dp[i%2][j][k] = dp[1-i%2][j][k-count[i][0]];
		}
		sum[1] += count[i][1];
		for (j = 1; j <= sum[1]; j++) {
			for (k = 1; k <= sum[0]; k++) {
				for (l = 1; l <= j && l <= count[i][1]; l++) {
					for (m = sum[0] - count[i][0] + 1; m >= k - count[i][0] + 1 && m >= 1; m--) dp[i%2][j][k] = (dp[i%2][j][k] + dp[1-i%2][j-l][m] * combination(l + m + count[i][0] - k - 2, l - 1)) % Mod;
				}
			}
		}
	}
	
	long long ans = 0;
	for (j = 0; j <= K && j <= sum[1]; j++) {
		for (k = 1; k <= sum[0] + 1; k++) ans = (ans + dp[1-i%2][j][k]) % Mod;
	}
	printf("%lld\n", ans);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 3764
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}
using namespace std;

int main() {
    int a;
    cin >> a;
    vector<int> g(a);
    vector<int> h(a);
    for (int i = 0; i < a; i++) {
        cin >> g.at(i);
        h.at(i) = g.at(i);
    }
    sort(h.begin(), h.end());
    reverse(h.begin(), h.end());
    for (int i = 0; i < a; i++) {
        if (g.at(i) == h.at(0)) cout << h.at(1) << endl;
        else cout << h.at(0) << endl;
    }
}

Measured memory_bytes: 3200
n=int(input())
s=list(map(int,input().split()))
s.sort(reverse=True)
if len(s)%2==1:
    n+=1
    s.append(0)
a=s[::2]
b=s[1::2]
ans=0
for i in range(n//2):
    ans +=a[i]-b[i]
print(ans)

Measured memory_bytes: 3064
N,M = map(int,input().split())
A = list(map(int,input().split()))

sum = 0
for i in range(N):
	sum = sum + A[i]

boarder = sum /(4 * M)
count = 0
for i in range(N):
	if A[i] >= boarder:
		count = count + 1
if M <= count:
	print("Yes")
else:
	print("No")

Measured memory_bytes: 9124
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define int long long
#define ld long double
#define fi first
#define se second
#define all(uiet) uiet.begin(),uiet.end()
#define read(UIET) for(int i = 0; i < n; ++i) cin >> UIET[i]
#define out(UIET) for(int i = 0; i < n; ++i) cout << UIET[i]
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define vpp vector<pair< int, int > >
#define pll pair<int , int >
#define ppll pair < pll , pll >
#define debug(n1) cout << n1 << endl
#define len(a) ((int) (a).size())
#define endl "\n"
#define mod 1000000007
const int INF=(1LL<<60)-1;
const int maxN = 1000001;
string extractStringAtKey(string str, int key){
    char *s = strtok((char *)str.c_str(), " ");
    while(key > 1){
        s = strtok(NULL, " ");
        key--;
    }
    return (string)s;
}
bool prime[maxN + 1];
void seive(){
    memset(prime, true, sizeof(prime));
    for(int i = 2; i * i <= maxN; ++i){
        if(prime[i]){
            for(int j = i * i; j <= maxN; j += i){
                prime[j] = false;
            }
        }
    }
}
int32_t main(){
    SPEED;
    int n;
    cin >> n;
    int nc = n;
    vector<int> arr(3 * n);
    for(int i = 0; i < 3 * n; ++i){
        cin >> arr[i];
    }
    sort(all(arr));
    reverse(all(arr));
    int cnt = 0, ans = 0;
    for(int i = 0; i < 3 * n; ++i){
        cnt++;
        if(cnt == 2 && nc){
            nc--;
            ans += arr[i];
            cnt = 0;
        }
    }
    cout << ans ;
}

Measured memory_bytes: 5448
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<utility>
#include<sstream>
#include<cctype>
#include<cmath>
#include<algorithm>
using namespace std;

#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define rev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define repp(i,n) for(int (i)=1;(i)<=(n);(i)++)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define clr(a) memset((a), 0 ,sizeof(a))


typedef pair<int,int> P;
typedef vector<pair<int,int> > pii;
typedef map<string,int> mi;




int main(){
	int a,b;
	string s,s2;
	vector<string> s3;
	cin >> a >> b;
	for(int i=0;i<a;i++){
		cin >> s;
		s3.push_back(s);
	}
	sort(s3.begin(),s3.end());
	
	for(int i=0;i<s3.size();i++){
		s2+=s3[i];
	}
	cout << s2 << endl;
	return 0;
}

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

#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
namespace adaptor = boost::adaptors;

// 多倍長テンプレ
/* ---------------------- ここから ---------------------- */
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
using Real = mp::number<mp::cpp_dec_float<1024>>;
/* ---------------------- ここまで ---------------------- */

void Main()
{
	const double PI = acos(-1);

    int A, B, H, M;
    cin >> A >> B >> H >> M;

	double t1 = ((H + M / 60.0) / 12.0) * 2 * PI;
	double t2 = M / 60.0 * 2 * PI;

	double x1 = A * cos(t1);
	double y1 = A * sin(t1);
	double x2 = B * cos(t2);
	double y2 = B * sin(t2);

	double dx = x1 - x2;
	double dy = y1 - y2;

	double d = sqrt(dx * dx + dy * dy);
	cout << d;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}

Measured memory_bytes: 4116
//Dragon_warrior7(IITK)
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//using namespace __gnu_pbds;
#define umap unordered_map
#define uset unordered_set
#define ll long long
#define lll long long
#define pb push_back
#define nl cout << '\n'
#define sor(x) sort(x.begin(), x.end())
#define rev(v) reverse(v.begin(), v.end())
#define lb(v, temp) lower_bound(v.begin(), v.end(), temp)
#define ub(v, temp) upper_bound(v.begin(), v.end(), temp)
#define fi first
#define se second
#define llmax 1000000000000000000
#define pll pair<ll, ll> 
#define ull unsigned ll
#define vll vector<ll> 
#define rub cout << "\n------------------------------------\n"
#define deb(x) cerr<<#x<<' '<<'='<<' '<<x<<'\n'
#define fo(i,a,b) for(int i=a;i<b;i++)
#define Lets_be_precise cout<<fixed<<setprecision(10)
//typedef  tree < int ,  null_type ,  greater<int> ,  rb_tree_tag ,  tree_order_statistics_node_update > oset;
const int mod=1e9+7;
// ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
// ll modInverse(ll a){return power(a,mod-2);}
ll n,m,a,b,c,k,temp,x,y;
const int MAXN=100000+11;
void read(vector<ll> &v)
{
	for (int i = 0; i < v.size(); i++)
	cin>>v[i];
}
//#define cerr if(false)cerr//uncomment to remove cerr from program...
void solveforthiscase(const int & test)
{//deb(test);
cin>>n>>k;
vll v(n);
read(v);
ll count=0;
ll g[3000];
for(int i=0;i<n;i++)
{
    g[v[i]]=llmax;
for(int j=0;j<i;j++)
{
    if(v[j]>v[i])
    count++;
}
}
sor(v);
for(int i=0;i<n;i++)
{
    g[v[i]]=min(g[v[i]],n-i-1);
}
count+=(k-1)*count;
for(int i=0;i<n;i++)
{
    count+=((((k-1)*(k))/2)%mod*g[v[i]])%mod;
    count%=mod;
}
cout<<count;
return ;
}

int main()
{
	ios_base::sync_with_stdio(false);
	Lets_be_precise;
	cin.tie(NULL);
	cout.tie(NULL);
	int test=1;
// 	cin>>test;
    for(int i=1;i<=test;i++)
    {
        solveforthiscase(i);
    }
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
  string s;
  int N,K;
  cin >> N >> K >> s;

  string c = s.substr(K-1, 1);
  //  cout << c << endl;
  if(c == "A") s.replace(K-1, 1, "a");
  if(c == "B") s.replace(K-1, 1, "b");
  if(c == "C") s.replace(K-1, 1, "c");

  cout << s << "\n";

  return 0;
}


Measured memory_bytes: 256
local n,m=io.read("n","n")
local city={}
for i=1,m do
    local p,y=io.read("n","n")
    city[i]={p,y,i}
end

table.sort(city,function(x,y)
    if x[1]~=y[1] then
        return x[1]<y[1]
    else
        return x[2]<y[2]
    end
end)

local id={}
local x=1
local P=0
for i=1,m do
    local p=city[i][1]
    local y=city[i][2]
    local c=city[i][3]
    if P==p then
        x=x+1
    else
        x=1
    end
    id[c]=string.format("%06d",p)..string.format("%06d",x)
    P=p
end

for i=1,m do
    print(id[i])
end

Measured memory_bytes: 29540
N = int(input())
sp = [list(map(str,input().split())) for _ in range(N)]

for i in range(N):
    sp[i].append(i+1)

sp.sort(key=lambda x:x[0])

city = []
for k in range(N):
    if sp[k][0] not in city:
        city.append(sp[k][0])

A = []
for i in range(len(city)):
    cnt = 0
    end = 0
    for j in range(i,N):
        if sp[j][0] == city[i]:
            cnt += 1
            end = j
    A.append((cnt,end+1-cnt))

B = [0] * len(A)
for i in range(len(A)):
    begin = A[i][1]
    end = A[i][0]+A[i][1]
    B[i] = sp[begin:end]

for k in B:
    k.sort(key=lambda x:int(x[1]))
    for i in range(len(k)):
        print(k[len(k)-i-1][2])

Measured memory_bytes: 3064
//\\//\\ * * * //\\// ||
#include <bits/stdc++.h> 

#define debug(x) cerr << #x << ": " << x << endl

using namespace std;

typedef long long ll;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  int ans = 0;
  int cnt = 0;
  for (char c : s) {
    if (c == 'S') {
      cnt = 0;
    } else {
      ++cnt;
      ans = max(ans, cnt);
    }
  } 
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ll long long
#define ld long double
#define mk make_pair
#define fi first
#define se second
#define vll vector<ll>
#define pii pair<ll,ll>
#define vvll vector< vector<ll> >
#define pb push_back
#define sz(v) (v).size()
#define inf 1e18
#define md 1000000007
#define all(v) (v).begin(),(v).end()
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define tel(a){cout<<a<<"\n";}
#define tell(a,b){cout<<a<<" | "<<b<<"\n";}
#define telll(a,b,c){cout<<a<<" | "<<b<<" | "<<c<<"\n";}
#define teln(v,n){cout<<"v- ";rep(i,0,n)cout<<v[i]<<" ";cout<<"\n";}
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); 

using namespace std;
using namespace __gnu_pbds;

template<typename T>
using o_set=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define M 1000010

int main(){
	IOS;
	string s;cin>>s;
	ll val=0;
	rep(i,0,sz(s)){
		if(s[i]=='+')val++;
		else val--;
	}
	cout<<val;
	return 0;
}



Measured memory_bytes: 256
A,B,C=map(int,input().split())
if A==B and B==C and A%2==0:
    print(-1)
elif A%2==1 or B%2==1 or C%2==1:
    print(0)
else:
    ans=0
    flag=0
    d=0
    while flag==0:
        if (A>>d &1)==(B>>d &1) and (C>>d &1)==(B>>d &1):
            d+=1
        else:
            ans=d
            break
    print(ans)


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

#define INCANT cin.tie(0), ios::sync_with_stdio(false), cout << fixed << setprecision(20)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define all(x) (x).begin(),(x).end()
#define out(a) cout << a << endl
#define PRINT(V) for (auto v : (V)) cout << v << " "

const int MOD = 1000000007;
const double PI = acos(-1.0);

void solve() {
    string S;
    ll ans=0;
    cin >> S;
    for(int bit=0; bit < (1<<(S.size()-1)); ++bit){
        vector<int> plus;
        rep(i, S.size()-1){
            if (bit & (1<<i)){
                plus.push_back(i);
            }
        }
        int prev=0;
        for(auto i : plus){
            i++;
            ll digit = atoll(S.substr(prev, i-prev).c_str());
            ans += digit;
            prev=i;
        }
        ll digit = atoll(S.substr(prev, S.size()-prev).c_str());
        ans += digit;
    }
    out(ans);
}
int main() {
    INCANT;
    solve();
    return 0;
}




Measured memory_bytes: 256
//#include "bits/stdc++.h"
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <complex>
#include <bitset>
#include <functional>
#include <stack>
#include <regex>
#include <tuple>
#include <iomanip>

#define int long long
#define REP(i,l,r) REPEAT(i,l,r,true) //[l, r)
#define rep(i,n) REP(i,0,n)           //[0, n)
#define REPEAT(i,l,r,condition) for(int i=(condition)?l:r-1;(condition)?i<r:i>=l;(condition)?++i:--i) // false<-[l, r)->true
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define fs first
#define sc second
#define show(...) cerr<<#__VA_ARGS__<<" = ";_DEBUG(__VA_ARGS__)
#define shows(n) for(auto z:n){cerr<<z<<", ";}cerr<<endl
#define showslr(n,l,r) cerr<<#n<<" = ";for(int i=l;i<r;i++){cerr<<n[i];}cerr<<endl //[l, r))

#define yes puts("Yes")
#define no puts("No")
#define case(i) printf("Case #%lld: ",i)

using namespace std;

using vi=vector<int>;
using pint=pair<int,int>;

inline void io(){cin.tie(0);ios::sync_with_stdio(false);cout.tie(0);cout<<fixed<<setprecision(20);}

void _DEBUG(){cerr<<endl;}
template<typename H,typename... T> void _DEBUG(H a,T...b){cerr<<a<<",";_DEBUG(b...);}

template<typename T> inline void in(T &e){cin>>e;}
template<typename H,typename... T>void in(H &a, T&... b){in(a);in(b...);}
template<typename T> inline void out(T e){cout<<e<<endl;}
template<typename H,typename... T> void out(H a, T... b){out(a);out(b...);}

const int INF=1LL<<55;
const int MOD=1000000007;
const double EPS=1e-8;

const int MAX_N=100010;

vi G[MAX_N];
vector<bool> went(MAX_N,false);

deque<int> path;

int N,M;

bool check(){
    bool f=true;
    for(auto e:G[path[0]])
        if(!went[e]) {
            f=false;
            break;
        }

    if(f) for(auto e:G[path[path.size()-1]]) if(!went[e]) {
        f=false;
        break;
    }

    return f;
}

void unite(){
    for(auto e:G[path.front()]){
        if(!went[e]){
            went[e]=true;
            path.push_front(e);
            break;
        }
    }
    for(auto e:G[path.back()]){
        if(!went[e]){
            went[e]=true;
            path.push_back(e);
            break;
        }
    }
}

signed main(){
    io();
    in(N,M);
    went.resize(N,false);
    int a,b;
    rep(i,M){
        in(a,b);
        a--;b--;
        G[a].pb(b);
        G[b].pb(a);
    }

    path.pb(0);
    went[0]=true;

    while(!check()){
        unite();
    }

    out(path.size());
    for(auto e: path){
        printf("%lld ",e+1);
    }
    puts("");

    return 0;
}


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

int main(){
    int N, M;
    cin >> N >> M;
    vector<vector <int>> jobs(M);
    for(int i = 0; i < N; i++){
        int A, B;
        cin >> A >> B;
        if(A > M) continue;
        jobs[M - A].push_back(B);
    }
    priority_queue<int> Q;
    ll ans = 0;
    for(int i = M - 1; i >= 0; i--){
        for(int b : jobs[i]){
            Q.push(b);
        }
        if(!Q.empty()){
            ans += Q.top();
            Q.pop();
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5504
import * as fs from 'fs';

function main(input) {
  input = input.split("\n");
  const tmp = input[0].split(" ");
  const N = parseInt(tmp[0], 10);
  const X = parseInt(tmp[1], 10);
  const t = parseInt(tmp[2], 10);
  //出力
  console.log('%d', Math.ceil(N / X) * t);
  return 0;
}

main(fs.readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 29580
#include<cstdio>
using namespace std;
int main()
{
	int n;
	scanf("%d",&n);
	int ans=0;
	for(int i=1;i<=n;i++){
		int l,r;
		scanf("%d%d",&l,&r);
		ans+=r-l+1;
	}
	printf("%d",ans);
}

Measured memory_bytes: 128
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

int n;
int a[200000];
int b[200000];
int c[1000][1000][2];
int f[1000];
vector <pair<int, int>> v[1000];

void dfs(int x, int y, int z, int w) {
    int i;
    
    f[x] = 1;
    c[y][x][z] = w;
    
    for (i = 0; i < v[x].size(); i++) {
        int nx = v[x][i].first;
        
        if (f[nx] == 0) dfs(nx, y, z, w);
    }
}

void check(int x) {
    int i, j;
    
    for (i = 0; i < n; i++) {
        c[x][i][0] = 1e9;
        c[x][i][1] = -1e9;
    }
    
    for (i = 0; i < n; i++) f[i] = 0;
    f[x] = 1;
    
    for (i = 0; i < v[x].size(); i++) {
        int nx = v[x][i].first;
        
        if (f[nx] == 0) dfs(nx, x, 0, v[x][i].second);
    }
    
    for (i = 0; i < n; i++) f[i] = 0;
    f[x] = 1;
    
    reverse(v[x].begin(), v[x].end());
    for (i = 0; i < v[x].size(); i++) {
        int nx = v[x][i].first;
        
        if (f[nx] == 0) dfs(nx, x, 1, v[x][i].second);
    }
}

int main() {
    int m, i, j;
    
    scanf("%d %d", &n, &m);
    
    for (i = 0; i < m; i++) {
        scanf("%d %d", &a[i], &b[i]);
        
        a[i]--;
        b[i]--;
        
        v[a[i]].push_back(make_pair(b[i], i));
    }
    
    for (i = 0; i < n; i++) check(i);
    
    for (i = 0; i < m; i++) {
        int x = a[i], y = b[i];
        int f1 = 0, f2 = 0;
        
        if (c[x][y][0] < i || c[x][y][1] > i) f1 = 1;
        if (c[y][x][1] >= 0) f2 = 1;
        
        if (f1 ^ f2) {
            puts("diff");
        } else {
            puts("same");
        }
    }
    
    return 0;
}


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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007



int main(){

  int h,w,k;
  cin >> h >> w >> k;
  vector<string> s(h);
  rep(i,h)cin >> s[i];
  vector<vector<ll>> res(h,vector<ll>(w,0));
  int nu = 0;
  bool ok = false;
  rep(i,h)rep(j,w){
    if(j == 0)ok = false;
    if(s[i][j] == '#')nu++,ok = true;
    if(ok)res[i][j] = nu;
  }
  for(int i = 0;i < h;i++)for(int j = w-2;j >= 0;j--){
    if(res[i][j] == 0 && res[i][j+1] != 0)res[i][j] = res[i][j+1];
  }
  for(int i = 1;i < h;i++)rep(j,w){
    if(res[i][j] == 0 && res[i-1][j] != 0)res[i][j] = res[i-1][j];
  }
  for(int i = h-2;i >= 0;i--)rep(j,w){
    if(res[i][j] == 0 && res[i+1][j] != 0)res[i][j] = res[i+1][j];
  }
  rep(i,h)rep(j,w){
    cout << res[i][j] << " ";
    if(j == w-1)cout << "\n";
  }





  return 0;
}

Measured memory_bytes: 1664
/*
.....            
.        .       *
.....   . .      .
    .  .....     .
..... .     .    .
*/
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stdio.h>
#include <cstdio>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <random>
#include <iomanip>
#include <bitset>
   
using namespace std;
   
template<typename T> void uin(T &a, T b) {
    if (b < a) {
        a = b;
    }
}
   
template<typename T> void uax(T &a, T b) {
    if (b > a) {
        a = b;
    }
}

#define left left228
#define right right228
#define prev prev228

random_device rnd;

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	string s;
	cin >> s;
	map< char, bool > is;
	for (char c : s) {
		is[c] = 1;
	}
	if ((is['N'] && !is['S']) || (is['S'] && !is['N']) || (is['W'] && !is['E']) || (is['E'] && !is['W'])) {
		cout << "No\n";
	} else cout << "Yes\n";
	return 0;
}


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

const int N = 1e5 + 10;
int n, m, Q, ans = 1, cur, a[N], c[N], p[N], inv[N];

template <class T> inline void in(T &x) {
	x = 0; int f = 1; char ch = getchar();
	for (; ch<'0' || ch>'9';) {if (ch=='-') f=-1; ch = getchar();}
	for (; ch>='0' && ch<='9';) x = x*10 + ch-'0', ch = getchar();
	x *= f;
}

int main() {
	in(n), in(m), in(Q), c[0] = n;
	for (int i = 1; i <= Q; ++i) in(a[i]);
	for (int i = 1; i <= m; ++i) inv[i] = -1;
	for (int i = Q; i; -- i)
		if (inv[a[i]] == -1) {
			inv[a[i]] = ++cur;
			c[cur] = 1, p[cur] = a[i];
		} else if (c[inv[a[i]]] < c[inv[a[i]] - 1]) ++c[inv[a[i]]];
	for (int i = 1; i <= m; ++i) if (inv[i] == -1) p[++cur] = i;
	for (int i = 2; i <= m; ++i)
		if (c[i - 1] != n && p[i - 1] > p[i]) {ans = 0; break;}
	puts(ans ? "Yes" : "No");
	return 0;
}

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

#ifdef LOCAL
#define DEBUG(...) debug(#__VA_ARGS__, __VA_ARGS__);
#else
#define DEBUG(...) 6;
#endif

template<typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &p) {return os << "(" << p.first << ", " << p.second << ")";}
template<typename C, typename T = decay<decltype(*begin(declval<C>()))>, typename enable_if<!is_same<C, string>::value>::type* = nullptr>
ostream& operator << (ostream &os, const C &c) {bool f = true; os << "["; for (const auto &x : c) {if (!f) os << ", "; f = false; os << x;} return os << "]";}
template<typename T> void debug(string s, T x) {cerr << s << " = " << x << "\n";}
template<typename T, typename... Args> void debug(string s, T x, Args... args) {cerr << s.substr(0, s.find(',')) << " = " << x << " | "; debug(s.substr(s.find(',') + 2), args...);}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int h, a;
    cin >> h >> a;

    cout << ((h + a - 1) / a) << "\n";

    return 0;
}


Measured memory_bytes: 3648
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
typedef long long ll;
typedef long double ld;
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF (1LL<<60)
#define MOD1 1000000007
#define MAX_N (1 << 17)


void swap(ll *a, ll *b){ll c;c=*b;*b=*a;*a=c;}
ll max2(ll a,ll b){return a>=b?a:b;}
ll min2(ll a,ll b){return a>=b?b:a;}
ll minn(ll n, ll a[n]){ll b=INF;rep(i,0,n) b=min2(b,a[i]);return b;}
ll maxn(ll n, ll a[n]){ll b=-INF;rep(i,0,n) b=max2(b,a[i]);return b;}
ll ABS(ll a){return a>=0?a:(-a);}
ll POW(ll a, ll b){ll c=1;rep(i,0,b) c*=a;return c;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}

typedef struct{
    ll aa;
    ll bb;
}frequent;

ll run(ll n){
    ll ans=0;
    rep(i,1,n+1){
        if(n%i==0) ans++;
    }
    return ans;
}

int main(void){
    // char ;
    ll n,ans=0;
    scanf("%lld",&n);
    repp(i,1,n+1,2){
        if(run(i)==8) ans++;
        // ans+=run(i);
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 128
n,m = map(int,input().split())

x = list(map(float,input().split()))
x = sorted(x)

if (n >= m):
    print(0)
else:
    lena = x[m-1]-x[0]

    a = []
    for i in range(0,m-1):
        a.append(x[i+1]-x[i])
    a = sorted(a)

    diff = 0
    for i in range(n-1):
        diff += a[m-2-i]


    print(int(lena - diff))


Measured memory_bytes: 13192
#!/usr/bin/env python3
# Generated by https://github.com/kyuridenamida/atcoder-tools
from typing import *
import collections
import functools as fts
import itertools as its
import math
import sys

INF = float('inf')


def solve(N: int, d: "List[int]"):
    return sum(x * y for x, y in its.combinations(d, 2))


def main():

    sys.setrecursionlimit(10 ** 6)

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    d = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    print(f'{solve(N, d)}')


if __name__ == '__main__':
    main()


Measured memory_bytes: 75268
from collections import Counter
N = int(input())
W = [Counter(input()) for k in range(N)]
A = [100000]*26
S = "abcdefghijklmnopqrstuvwxyz"
for e in W:
    for s in S:
        A[ord(s)-97] = min(A[ord(s)-97],e[s])

ans = ""
for k in range(26):
    ans += S[k]*A[k]
print(ans)


Measured memory_bytes: 3316
#include <iostream>
using namespace std;
int V, E, s, t, d;
long long int K[101][101];
bool B[101][101];
const long long int inf = 100000000000;
int main() {
 cin >> V >> E;
 for (int i=0; i<V; ++i) {
  for (int j=0; j<V; ++j) {
   K[i][j] = (i == j) ? 0 : inf;
   B[i][j] = false;
  }
 }
 for (int i=0; i<E; ++i) {
  cin >> s >> t >> d;
  K[s][t] = d;
  B[s][t] = true;
 }
 for (int k=0; k<V; ++k) {
  for (int i=0; i<V; ++i) {
   for (int j=0; j<V; ++j) {
    if (K[i][j] > K[i][k] + K[k][j] && B[i][k] && B[k][j]) {
	 K[i][j] = K[i][k] + K[k][j];
	 B[i][j] = true;
	}
   }
  }
 }
 bool nc = false;
 for (int i=0; i<V; ++i) {
  if (K[i][i] < 0) {
   cout << "NEGATIVE CYCLE" << endl;
   nc = true;
   break;
  }
 }
 if (!nc) {
  for (int i=0; i<V; ++i) {
   for (int j=0; j<V; ++j) {
    if (K[i][j] == inf) { cout << "INF"; }
	else { cout << K[i][j]; }
    cout << ((j == V-1) ? "" : " ");
   }
   cout << endl;
  }
 }
}


Measured memory_bytes: 1244
#include <algorithm>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
const int M = 310;
const ll base = 9973;
const ll mod[2] = {ll(1e9 + 7), ll(1e9 + 9)};
ll pow[2][M];

void init() {
  for (int t = 0; t < 2; t++) {
    pow[t][0] = 1;
    for (int i = 1; i < M; i++) pow[t][i] = pow[t][i - 1] * base % mod[t];
  }
}

int main() {
  init();
  int N;
  while (cin >> N) {
    static int C[M][M];
    for (int i = 0; i < N; i++) {
      string line;
      cin >> line;
      for (int j = 0; j < N; j++) {
        C[i][j] = line[j] - 'a';
      }
    }
    int res = 0;
    for (int A = 0; A < N; A++) {
      static ll hhash[M][2], whash[M][2];
      for (int i = 0; i < N; i++) for (int t = 0; t < 2; t++) {
        ll h = 0;
        for (int j = 0; j < N; j++) {
          h = (h + pow[t][j] * C[(i - A + N) % N][j]) % mod[t];
        }
        whash[i][t] = h;
      }
      for (int j = 0; j < N; j++) for (int t = 0; t < 2; t++) {
        ll h = 0;
        for (int i = 0; i < N; i++) {
          h = (h + pow[t][i] * C[(i - A + N) % N][j]) % mod[t];
        }
        hhash[j][t] = h;
      }
      for (int B = 0; B < N; B++) {
        bool ok = true;
        for (int k = 0; k < N; k++) {
          auto w = whash[k];
          auto h = hhash[(k - B + N) % N];
          ok &= w[0] == h[0] && w[1] == h[1];
        }
        if (ok) ++res;
        for (int i = 0; i < N; i++) for (int t = 0; t < 2; t++) {
          whash[i][t] = 
            (whash[i][t] * base % mod[t] - (pow[t][N] - 1) * C[(i - A + N) % N][N - B - 1] % mod[t] + mod[t]) % mod[t];
        }
      }
    }
    cout << res << endl;
  }
  return 0;
}


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

using ll = long long;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define REP(i, n) FOR(i, 0, n)
#define ALL(c) (c).begin(), (c).end()
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
const int MOD = 1000000007;

int main() {
    int n;
    cin >> n;
    cout << 180 * (n - 2) << endl;
}


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

int main() {
	
	int mi, ma,count(0) ;

	cin >> mi >> ma;

	for (int i = mi; i < ma + 1; i++) {
		int a(0), b(0), c(0), d(0), e(0);
		a = i / 10000;
		b = (i - a * 10000) / 1000;
		c = (i - a * 10000 - b * 1000) / 100;
		d = (i - a * 10000 - b * 1000 - c * 100) / 10;
		e = i - a * 10000 - b * 1000 - c * 100 - d * 10;

		//cout << a << b << c << d << e << endl;

		if (a == e && b == d) {
			//cout << a << b << c << d << e << endl;
			count++;
		}
	}
	cout << count;
	return 0;	
}


Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>
#include <tuple>
#include <cmath>
#define repeat(i,n) for (int i = 0; (i) < (n); ++(i))
#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
using namespace std;
template <class T> void setmin(T & a, T const & b) { if (b < a) a = b; }
template <typename T>
vector<T> original_dijkstra(vector<vector<pair<int, T> > > const & g, int start, T inf) {
    int n = g.size();
    vector<double> dist(n, inf);
    vector<int> ixs(n); whole(iota, ixs, 0);
    dist[start] = 0;
    repeat (loop,n) {
        int i; {
            auto it = whole(min_element, ixs, [&](int i, int j) { return dist[i] < dist[j]; });
            i = *it;
            *it = ixs.back();
            ixs.pop_back();
        }
        for (auto it : g[i]) {
            int j; T cost; tie(j, cost) = it;
            setmin(dist[j], dist[i] + cost);
        }
    }
    return dist;
}
int main() {
    int sx, sy, gx, gy, n; scanf("%d%d%d%d%d", &sx, &sy, &gx, &gy, &n);
    vector<int> x(n), y(n), r(n); repeat (i,n) scanf("%d%d%d", &x[i], &y[i], &r[i]);
    x.push_back(sx); y.push_back(sy); r.push_back(0);
    x.push_back(gx); y.push_back(gy); r.push_back(0);
    vector<vector<pair<int, double> > > g(n+2);
    repeat (i,n+2) repeat (j,n+2) g[i].emplace_back(j, max(0.0, sqrt(pow(x[j] - x[i], 2) + pow(y[j] - y[i], 2)) - r[i] - r[j]));
    auto dist = original_dijkstra(g, n, double(INFINITY));
    printf("%.10lf\n", dist[n+1]);
    return 0;
}


Measured memory_bytes: 16384
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

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

const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
const double eps=1e-10;

int dx[]={1, 0, -1, 0};
int dy[]={0, -1, 0, 1};

bool dp[100010];

int main(){
    int n, k; cin>>n>>k;
    vector<int> a(n);
    for(int i=0; i<n; i++) cin>>a[i];

    for(int i=0; i<=k; i++){
        for(int j=0; j<n; j++){
            if(i - a[j] >= 0) dp[i] |= !dp[i - a[j]];
        }
    }

    if(dp[k]) cout << "First" << endl;
    else cout << "Second" << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define INF 100000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;


int main()
{
  ll N, x;
  cin >> N >> x;
  if (x == 1 || x == (2 * N - 1)) {
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;
  for (ll i = N - 1; i >= 0; --i) {
    ll temp = x - i;
    if (temp <= 0) {
      temp += 2 * N - 1;
    }
    cout << temp << endl;
  }
  for (ll i = 1; i < N; ++i) {
    ll temp = x + i;
    if (temp > 2 * N - 1) {
      temp -= 2 * N - 1;
    }
    cout << temp << endl;
  }
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
int main() {
    int h, w; cin >> h >> w;
    vector<vector<int>> v(w, {h});
    int n; cin >> n;
    for (int i = 0; i < n; i++) {
        int p, q; cin >> p >> q;
        v[q-1].push_back(p-1);
    }
    for (int i = 0; i < w; i++) {
        sort(v[i].begin(), v[i].end());
    }
    int cur = 0; int ans = 1e9;
    for (int i = 0; i < w; i++) {
        int t = *(upper_bound(v[i].begin(), v[i].end(), cur));
        ans = min(ans, t);
        if (i+1 < w) {
            cur++;
            int j = lower_bound(v[i+1].begin(), v[i+1].end(), cur) - v[i+1].begin();
            while (cur < h && cur == v[i+1][j]) {
                cur++; j++;
            }
            if (cur >= t) break;
        }
    }
    cout << ans << endl;
    return 0;
}

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

typedef long long int ll;
typedef unsigned long long int ull;

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

using namespace std;

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

  int l = s.size();

  for (int i = 0; i < l; i++)
  {
    if (s == t.substr(i, l - i) + t.substr(0, i))
    {
      cout << "Yes" << endl;
      return 0;
    }
  }

  cout << "No" << endl;

  return 0;
}

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

// int/long:		-2,147,483,648 - 2,147,483,648 (-2^31 <= int < 2^31)
// long/long long:	-9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

#define	INF (1<<29)
//536,870,912

// lower_bound(A.begin(), A.end(), N)
// upper_bound(...

// A.erase(unique(A.begin(), A.end()), A.end())

// bit: &/and, |/or, ^/xor, ~/not

// getline(cin, String)

// Graph
// Warshall-Floyd: Distance between each node, N^3
// Dijkstra: Distance from the start node, N^2
// DFS(Depth-First Search)

#define	MOD 1000000007

int	main() {
	int N;
	cin >>N;
	vector<vector<vector<int>>> node(N+1);
	for (int i=1; i<=N-1; i++) {
		int f;
		int t;
		cin >>f >>t;
		node.at(f).push_back({t, 1});
		node.at(t).push_back({f, 1});
	}
	vector<int> d1(N+1, INF);
	vector<bool> fixed(N+1, false);
	vector<int> q;
	int ixq;
	d1.at(1)=0;
	q.push_back(1);
	ixq=0;
	while(N!=ixq) {
		int f=q.at(ixq);
		fixed.at(f)=true;
		for (int i=0; i<node.at(f).size(); i++) {
			int t=node.at(f).at(i).at(0);
			int dd=node.at(f).at(i).at(1);
			if (!fixed.at(t)) {
				d1.at(t)=d1.at(f)+dd;
				q.push_back(t);
			}
		}
		ixq++;
	}
	vector<int> d2(N+1, INF);
	for (int i=0; i<fixed.size(); i++)
		fixed.at(i)=false;
	q.erase(q.begin(), q.end());
	d2.at(N)=0;
	q.push_back(N);
	ixq=0;
	while(N!=ixq) {
		int f=q.at(ixq);
		fixed.at(f)=true;
		for (int i=0; i<node.at(f).size(); i++) {
			int t=node.at(f).at(i).at(0);
			int dd=node.at(f).at(i).at(1);
			if (!fixed.at(t)) {
				d2.at(t)=d2.at(f)+dd;
				q.push_back(t);
			}
		}
		ixq++;
	}
	int f=0;
	int s=0;
	for (int i=1; i<=N; i++)
		if (d1.at(i)<=d2.at(i))
			f++;
		else
			s++;
	if (f>s)
		cout <<"Fennec" <<endl;
	else
		cout <<"Snuke" <<endl;
	return 0;
}



Measured memory_bytes: 16376
#include<bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>*/
 
using namespace std;
//using namespace __gnu_pbds;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int long long 
#define rep(i,n) for(int i=0;i<n;i++)
#define repa(i,arr,n) for(int i=arr;i<=n;i++)
#define repd(i,arr,n) for(int i=arr;i>=n;i--)
#define trav(arr,x) for(auto& arr:x)
#define all(c) c.begin(), c.end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(arr) arr.size()
#define pi 3.14159265358979323846
#define MAX 500003
#define vi vector<int>
#define pii pair<int,int>
#define pqueue priority_queue<int>
#define pdqueue priority_queue<int,vi,greater<int> >
//#define endl "\n"
 
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
 
const int mod=1e9+7;
int power(int a,int b)
{
    int ans=1;
    while(b)
    {
        if(b&1)
        {
            ans=(ans*a)%mod;
        }
        a=(a*a)%mod;
        b>>=1;
    }
    return ans;
}


int32_t main()
{
    fast;
    int n,val,flag=0;
    cin>>n;
    vi v;
    rep(i,n)
    {
    	cin>>val;
    	v.pb(val);
    	if(val==0) flag=1;
    }
    if(flag) cout<<0<<endl;
    else
    {
    	int maxx=1e18,curr=1;
    	sort(all(v));

    	rep(i,n)
    	{
    		int req=maxx/curr;
    		if(v[i]>req)
    		{
    			cout<<"-1"<<endl;
    			return 0;
    		}
    		curr*=v[i];
    	}
    	cout<<curr<<endl;
    }
}

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

typedef long long ll;

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


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i=0;i < (int)(n);i++)
const ll INF = 1LL << 60;
ll d[201][201];
struct edge{int from,to; ll cost;};

int main(){
    int n,m,r;
    cin >> n >> m >> r;
    vector<edge> v(m);
    rep(i,n){
        rep(j,n){
            if (i == j) d[i][j] = 0;
            else d[i][j] = INF;
        }
    }
    vector<int> per(r);
    rep(i,r) {
        cin >> per[i];
        per[i]--;
    }
    rep(i,m){
        int a,b;
        ll c;
        cin >> a >> b >> c;
        d[a-1][b-1] = c;
        d[b-1][a-1] = c;
    }
    for (int i= 0;i < n;i++){
        for (int j = 0;j < n;j++){
            for (int k = 0;k < n;k++){
                d[j][k] = min(d[j][k],d[j][i]+d[i][k]);
            }
        }
    }
    ll ans = 1LL << 60;
    sort(per.begin(),per.end());
    do{
        ll tmp = 0;
        for (int i=0;i < r-1;i++){
            tmp += d[per[i]][per[i+1]];
        }
        ans = min(ans,tmp);

    }while(next_permutation(per.begin(),per.end()));
    cout << ans << endl;




    

    return 0;
}

Measured memory_bytes: 896