akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<set>
#include<map>
#include<cstring>
#include<stdio.h>
using namespace std;
typedef long long LL;
#define maxn (100000*2)
long long sett[maxn+1];
int n,cnt;
set<long long> ss;
map<long long ,long long > mp;
bool binary(int x,int y,long long v)
{
    while(x<y)
    {
        int mid=(x+y)/2;
        if(sett[mid]==v) return true;
        else if(sett[mid]>v) y=mid;
        else  x=mid+1;
    }
    return false;
}
int main()
{
    cnt=0;
    mp.clear();
    scanf("%d",&n);
    long long sum=0;
    for(int i=0;i<n;i++)
    {
        int x;scanf("%d",&x);
        sum+=x;
        mp[sum]++;
       // if(binary(0,cnt,sum)) continue;
       ss.insert(sum);
      // if(j<cnt) continue;
        //  sett[cnt++]=sum;
    }
     set<long long >::iterator iter;
    long long ans=0,tmp;
    for(iter=ss.begin();iter!=ss.end();iter++)
    {
        tmp=mp[*iter];
        //cout<<tmp<<" "<<*iter<<endl;
        ans+=(tmp*(tmp-1)/2);
    }
    cout<<ans+mp[0]<<endl;
    return 0;
}


Measured memory_bytes: 22144
#include<iostream>
#include<vector>
#include<queue>
#include<functional>
#include<algorithm>
#include<string>
#include<iomanip>

using namespace std;

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


int main(){
  int N;
  vector<pair<int,int>>data;
  cin >> N;
  rep(i,N){
    int x;
    cin >> x;
    data.push_back({x,i});
  }

  sort(data.begin(),data.end());
  int cnt=0;
  rep(i,N){
    if(data[i].second % 2 != i % 2)++cnt;
  }

  cout << cnt / 2 << endl;

  return 0;
}


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

typedef long long LL;
int Mod;
const int MN = 205;

inline void Sub(int &x, int y) { x -= y; x += x >> 31 & Mod; }
inline void Add(int &x, int y) { Sub(x, Mod - y); }

int Inv[MN];

int N, K;
std::vector<int> vec[MN];
int f[MN][MN][MN], tmp[MN][MN];

int main() {
	scanf("%d%d%d", &N, &K, &Mod);
	Inv[1] = 1;
	for (int i = 2; i <= N; ++i) Inv[i] = (LL)(Mod - Mod / i) * Inv[Mod % i] % Mod;
	for (int i = 0; i + (N - i) / 2 <= K; ++i) {
		// 1 <= Q < P
		// P + Q = N - i
		// i + P - 1 <= K
		for (int P = 0; P < N - i; ++P) {
			int Q = N - i - P;
			if (Q >= P || i + P - 1 > K) continue;
			int dif = P - Q - 1;
			vec[dif].push_back(P);
		}
	}
	int Ans = K == N - 1 ? 1 : 0;
	for (int d = 0; d <= N; ++d) if (!vec[d].empty()) {
		std::sort(vec[d].begin(), vec[d].end());
		int lim = vec[d].back();
		f[1][0][1] = f[1][0][2] = 0;
		f[1][0][d ? 1 : 2] = 1;
		for (int i = 2; i <= lim; ++i) {
			// f[i - 1][x][y] -> f[i][j][y + t] : t = (j == i - 1) + (j == i - d - 1);
			for (int k = 1; k <= (d ? i : 2 * i); ++k) {
				tmp[0][k] = f[i - 1][0][k];
				for (int j = 1; j < i && j <= lim - d - 1; ++j)
					Add(tmp[j][k] = tmp[j - 1][k], f[i - 1][j][k]);
			}
			for (int j = (i < d ? 0 : i - d - 1); j < i && j <= lim - d - 1; ++j) {
				int t = (j == i - 1) + (j == i - d - 1);
				for (int k = t; k <= (d ? i : 2 * i); ++k)
					f[i][j][k] = tmp[j][k - t];
			}
		}
		for (int P : vec[d])
			for (int k = 1; k <= (d ? P : 2 * P); ++k) if (f[P][P - d - 1][k])
				Ans = (Ans + (LL)f[P][P - d - 1][k] * Inv[k - 1]) % Mod;
	}
	for (int i = 1; i <= N; ++i) Ans = (LL)Ans * i % Mod;
	printf("%d\n", Ans);
	return 0;
}

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

//.define
// #define FILE_IN_OUT
#define RET(_x)    return cout << (_x) << '\n', 0;
#define all(_obj)  (_obj).begin(), (_obj).end()
#define loop(_n)   for (int i = 0; i < (_n); ++i)
#define sz(_obj)   static_cast<int>((_obj).size())
#ifdef SHJ_LOCAL
#define debug(_x)  std::cerr << (#_x) << " = " << (_x) << '\n' << std::flush;
#else
#define debug(_x)  {}
#endif
#define endl "\n"
template<typename P, typename Q>
P CeilDiv(P _dividend, Q _divider) {
    return static_cast<P>((_dividend - 1LL + _divider) / _divider);
}
template<typename Tp>
inline void outarr(Tp _begin, Tp _end, const char* _delim = " ") {
    for (Tp current = _begin; current != _end; ++current) {
        std::cout << *current << _delim;
    }
    std::cout << '\n';
}

//.constant
using ll  = long long;
using pii = std::pair<int, int>;
constexpr int INF = 0x3f3f3f3f;
constexpr int MOD = static_cast<const int>(1e9 + 7);

//.data

//.code
int main() {
#ifdef FILE_IN_OUT
    std::ifstream cin ("input.txt",  std::ios::in);
    std::ofstream cout("output.txt", std::ios::out);
#else
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
#endif

    int n, k;
    cin >> n >> k;
    vector<int> arr(n);
    loop(n) {
        cin >> arr[i];
        --arr[i];
    }
    vector<int> cost(n);
    loop(n) {
        cin >> cost[i];
    }
    vector<char> used(n, false);
    vector<ll> v;
    ll ans = -INF;
    loop(n) {
        fill(all(used), false);
        v.clear();
        for (int j = i; !used[j]; j = arr[j]) {
            used[j] = true;
            v.push_back(cost[j]);
        }
        for (int j = 1; j < sz(v); ++j) {
            v[j] += v[j - 1];
        }
        if (v.back() > 0) {
            ll d = k / sz(v);
            int r = k % sz(v);
            ll xx = 0;
            if (r > 0) {
                xx = *max_element(begin(v), next(begin(v), r));
            }
            ans = max(ans, d * v.back() + xx);
            if(d > 0) {
                --d;
                ans = max(ans, d * v.back() + *max_element(begin(v), next(begin(v), min(k, sz(v)))));
            }
        }
        ans = max(ans, *max_element(begin(v), next(begin(v), min(k, sz(v)))));
    }
    cout << ans << endl;

#ifdef FILE_IN_OUT
    cin.close();
    cout.close();
#endif
    return 0;
}

Measured memory_bytes: 3804
#include <bits/stdc++.h>
#define owo(i,a, b) for(int i=(a);i<(b); ++i)
#define uwu(i,a, b) for(int i=(a)-1; i>=(b); --i)
#define senpai push_back
#define ttgl pair<int, int>
#define ayaya cout<<"ayaya~"<<endl
 
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
gp_hash_table<int, int> mp;*/
using ll = long long;
using ld = long double;
const ll MOD = 1000000007;
const ll root = 62;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
ll binpow(ll a,ll b){ll res=1;while(b){if(b&1)res=(res*a)%MOD;a=(a*a)%MOD;b>>=1;}return res;}
ll modInv(ll a){return binpow(a, MOD-2);}
const double PI = acos(-1);
const double eps = -1e6;
const int INF = 0x3f3f3f3f;
const int NINF = 0xc0c0c0c0;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const ll NINFLL = 0xc0c0c0c0c0c0c0c0;
const int mxN = 51;
ll dp[mxN][mxN][mxN*mxN + 101];
int n, m;
int main() {
    //freopen("file.in", "r", stdin);
    //freopen("file.out", "w", stdout);
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    cin.tie(0)->sync_with_stdio(0);
    cin>>n>>m;
    dp[0][0][0] = 1;
    owo(i, 0, n) {
        owo(j, 0, i+1) {
            owo(k, 0, m+1) {
                //pair the next ones
                dp[i+1][j][k+2*j] = (dp[i+1][j][k+2*j] + dp[i][j][k])%MOD;
                //pair one of them backwards and one fowards
                dp[i+1][j][k+2*j] = (dp[i+1][j][k+2*j] + 2*j*dp[i][j][k])%MOD;
                //pair them both backwards
                if(j>0) {
                    dp[i+1][j-1][k+2*j] = (dp[i+1][j-1][k+2*j] + j*j*dp[i][j][k])%MOD;
                }
                //pair them both fowards
                dp[i+1][j+1][k+2*j] = (dp[i+1][j+1][k+2*j] + dp[i][j][k])%MOD;
                //cout<<i<<" "<<j<<" "<<k<<" "<<dp[i][j][k]<<"\n";
            }
        }
    }
    cout<<dp[n][0][m]<<"\n";
    return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define int long long

signed main(){
    int a, b;
    cin >> a >> b;
    if(a <= 5){
        cout << 0 << endl;
    }else{
        cout << (a > 12 ? b : b/2) << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;

int main() {
int64_t X,A,B;
cin >> X >> A >> B;
if (A-B >= 0) cout << "delicious" << endl;
else if (abs(A-B) <= X) cout << "safe" << endl;
else cout << "dangerous" << endl;


return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

int main()
{
    int h, w;
    cin >> h >> w;

    int cnt = 0;
    for(int i=0; i<h*w; ++i){
        char c;
        cin >> c;
        if(c == '#')
            ++ cnt;
    }

    if(cnt == h + w - 1)
        cout << "Possible" << endl;
    else
        cout << "Impossible" << endl;

    return 0;
}

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

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

using namespace std;

inline int popcount(int x){
	x=((x>>1)&0x55555555)+(x&0x55555555);
	x=((x>>2)&0x33333333)+(x&0x33333333);
	x=((x>>4)+x)&0x0f0f0f0f;
	x+=(x>>8);
	x+=(x>>16);
	return x&0x3f;
}

int main(){
	int n; scanf("%d",&n);
	vector<int> t[15],f[15];
	rep(i,n){
		int m; scanf("%d",&m);
		rep(j,m){
			int x,y; scanf("%d%d",&x,&y); x--;
			if(y==1) t[i].emplace_back(x);
			else     f[i].emplace_back(x);
		}
	}

	int ans=0;
	rep(S,1<<n){
		bool ok=true;
		rep(i,n){
			if(S>>i&1){
				for(auto x:t[i]) if((S>>x&1)==0) ok=false;
				for(auto x:f[i]) if((S>>x&1)==1) ok=false;
			}
		}
		if(ok) ans=max(ans,popcount(S));
	}
	printf("%d\n",ans);

	return 0;
}


Measured memory_bytes: 256
N=int(input())
a=list(map(int, input().rstrip().split()))
work=int()
Multiple=int(1)
Output=int(0)
def gcd(x,y):
    while y>0:
        x, y=y, x%y
    return x
for i in range(N):
    Multiple=int((Multiple*a[i])//gcd(Multiple, a[i]))
for i in range(N):
    Output+=(Multiple-1)%a[i]
print(Output)


Measured memory_bytes: 3316
#include <iostream>
using namespace std;
int main() {
    int d;
    cin >> d;
    switch (d) {
        case 22: cout << "Christmas Eve Eve Eve";
            break;
        case 23: cout << "Christmas Eve Eve";
            break;
        case 24: cout << "Christmas Eve";
            break;
        case 25: cout << "Christmas";
            break;
        default:
            break;
    }

    return 0;
}

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

int main(void)
{
    int N, M;
    cin >> N >> M;

    vector<int> cnt(M, 0);
    int K;
    int num;
    for (int i = 0; i < N; i++)
    {
        cin >> K;
        for (int j = 0; j < K; j++)
        {
            cin >> num;
            num--;
            cnt.at(num)++;
        }
    }
    int ans = 0;
    for (int i = 0; i < M; i++)
    {
        if (cnt.at(i) == N)
        {
            ans++;
        }
    }
    cout << ans << endl;
    return (0);
}

Measured memory_bytes: 256
#include<iostream>
#include<string.h>
#include<ctype.h>
#include<string>
#include<math.h>
#define pi 3.141592653589
#include<iomanip>
using namespace std;

int main(){
     
    int a,b,c;
    
    cin>>a>>b>>c;
    if(a==b){
        if(b==c)cout<<"1"<<endl;
        else cout<<"2"<<endl;
    }
    else{
        if(b==c)cout<<"2"<<endl;
        else {
            if(a!=c)cout<<"3"<<endl;
            else cout<<"2"<<endl;
        }
    }
    
    return 0;
}
 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string to_string(const string& s) {
	return '"' + s + '"';
}
string to_string(const bool b) {
	return (b ? "true" : "false");
}
string to_string(const char* s) {
	return to_string((string)s);
}
string to_string(const char c) {
	string s = "'";
	s += c;
	s += "'";
	return s;
}
template<class T, class U>
string to_string(const pair<T, U>& p) {
	string s = "(";
	s += to_string(p.first);
	s += ", ";
	s += to_string(p.second);
	s += ")";
	return s;
}
template<class T>
string to_string(const T& a) {
	bool first = true;
	string s = "{";
	for (const auto& x : a) {
		if(!first){
			s += ", ";
		}
		first = false;
		s += to_string(x);
	}
	s += "}";
	return s;
}
void debug_out() {cerr << '\n';}
template<class Head, class... Tail>
void debug_out(Head head, Tail... tail) {
	cerr << ' ' << to_string(head);
	debug_out(tail...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "] = ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif
using ll = long long;
using ld = long double;
const int mod = 1e9 + 7;
const int inf = 1e9 + 100;
const ll inf64 = 7e18l;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(20);
	int n, m;
	cin >> n >> m;
	int mn = inf, mx = 0;
	for (int i = 0; i < m; ++i) {
		int l, r;
		cin >> l >> r;
		mn = min(mn, r);
		mx = max(mx, l);
	}
	cout << max(mn - mx + 1, 0) << '\n';
}


Measured memory_bytes: 256
N,M,Q=map(int,input().split())
from copy import copy
stack=[[1]]
A=[]
while stack:
    temp=stack.pop()
    if len(temp)==N:
        A.append(temp)
    else:
        x=temp[-1]
        for i in range(x,M+1):
            temp.append(i)
            stack.append(copy(temp))
            temp.pop()

q=[]
for i in range(Q):
    a,b,c,d=map(int,input().split())
    q.append([a,b,c,d])

L=len(A)
ans=0
for i in range(L):
    point=0
    for j in range(Q):
        if A[i][q[j][1]-1]-A[i][q[j][0]-1]==q[j][2]:
            point+=q[j][3]
    ans=max(ans,point)
print(ans)

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

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

  int n, l;

  cin >> n >> l;

  vector<string> v(n);

  for (int i = 0; i < n; i++)
    cin >> v[i];

  sort(v.begin(), v.end());

  for (auto s : v)
    cout << s;
  cout << endl;

  return 0;
}


Measured memory_bytes: 3620
s = list(input())
if len(s) == 1:
    print(1)
    exit()
elif len(s) == 2:
    if s[0] == s[1]:
        print(1)
    else:
        print(2)
    exit()
else:
    dp = [0]*len(s)
    if s[0]==s[1] and s[1]==s[2]:
        dp[0:3]=[1,1,2]
    elif s[0]==s[1] and s[1]!=s[2]:
        dp[0:3]=[1,1,2]
    elif s[0]!=s[1] and s[1]==s[2]:
        dp[0:3]=[1,2,2]
    else:
        dp[0:3]=[1,2,3]

for i in range(3, len(s)):
    if s[i] != s[i-1]:
        dp[i] += dp[i-1]+1
    else:
        dp[i] += dp[i-3]+2

print(dp[-1])

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


void solve(long long N, long long K, vector<long long> h){
  sort(h.begin(), h.end());

  long long mindiff = INT_MAX;

  for(long long i = 0; i < N - (K-1); i++){
    mindiff = min(mindiff, abs(h[i] - h[i+(K-1)]));
  }

  cout << mindiff << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
  scanf("%lld",&N);
  long long K;
  scanf("%lld",&K);
  std::vector<long long> h;
  long long in;
  for(int i = 0 ; i < N ; i++){
    cin >> in;
    h.push_back(in);
  }
    solve(N, K, std::move(h));
    return 0;
}


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

#define int long long

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

int N, Y;

signed main() {
    cin >> N >> Y;
    for (int i = 0; i <= N; i++) {
        for (int j = 0; i + j <= N; j++) {
            int x = N - i - j;
            if (1000 * i + 5000 * j + 10000 * x == Y) {
                cout << x << " " << j << " " << i << endl;
                return 0;
            }
        }
    }
    cout << "-1 -1 -1" << endl;
    return 0;
}


Measured memory_bytes: 256
# 2019-11-15 13:51:51(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import numpy as np 

def main():
    # x1 を求めると、連鎖的にxnまで求められる
    # n種類の降った量(x1, x2,...,xn)を求めるのに、それぞれのDとxを使ってちょうどn個の一次不定方程式が作れるので、解はただ一つの組みが存在する
    # nは必ず奇数
    n, *a = [int(x) for x in sys.stdin.read().split()]
    x0 = 0
    for i in range(n):
        if i % 2 == 0:
            x0 += a[i]
        else:
            x0 -= a[i]
    x0 //= 2 # 2x の量が一つの山にふる
    x = [x0]
    for i in range(1, n):
        xi = a[i-1] - x[i-1]
        x.append(xi)
    
    # xは半分の量のlistなので2倍して出力する
    for i in range(n):
        print(x[i] * 2, end=' ')

if __name__ == "__main__":
    main()


Measured memory_bytes: 14092
import Control.Monad
import Text.Printf

main = do
  line <- readline getLine
  let aa = Point { x = line !! 0, y = line !! 1}
  let bb = Point { x = line !! 2, y = line !! 3}
  let l = Line aa bb
  q <- readLn
  input <- replicateM q getLine
  let xs = fmap (fmap (read :: String -> Double) . words) input
  let points = fmap (\e -> Point{x = e !! 0, y = e !! 1}) xs
  solve2 l points

solve2 :: Line Double -> [Point Double] -> IO ()
solve2 l xs = do
  let result = fmap (\p -> l `reflect` p) xs
  mapM_ (\e -> printf "%.8f %.8f\n" (x e) (y e)) result

readline :: (Read a) => IO String -> IO [a]
readline = fmap (fmap read . words)

rep :: (Read a) => Int -> ([a] -> IO ()) -> IO ()
rep n f = do
  input <- replicateM n (readline getLine)
  mapM_ f input

eps :: (Floating a) => a
eps = 1e-7

add :: (Ord a, Floating a) => a -> a -> a
add a b
  | abs (a + b) < eps * (abs a + abs b ) = 0.0
  | otherwise = a + b

data Point a = Point { x :: a, y :: a } deriving (Eq)
instance (Show a) => Show (Point a) where
  show(Point x y) = show x ++ " " ++ show y

toTuple :: Point a -> (a,a)
toTuple a = (x a,y a)

data Line a = Line {a :: Point a, b :: Point a}
instance (Show a) => Show (Line a) where
  show(Line a b) = show a ++ " " ++ show b

(^+) :: (Ord a, Floating a) => Point a -> Point a -> Point a
a ^+ b =  Point (add (x a) (x b)) (add (y a) (y b))

(^-) :: (Ord a, Floating a) => Point a -> Point a -> Point a
a ^- b = Point (add (x a) (-(x b))) (add (y a) (-(y b)))

(^*) :: (Floating a) => Point a -> a -> Point a
a ^* d = Point (x a * d) (y a * d)

dot :: (Floating a) => Point a -> Point a -> a
a `dot` b = x a * x b + y a * y b

project :: (Ord a, Floating a) => Line a -> Point a -> Point a
l `project` p = a l ^+ (base ^* t)
  where base = b l ^- a l
        t = ((p ^- a l) `dot` base) / (base `dot` base)

reflect :: (Ord a, Floating a) => Line a -> Point a -> Point a
l `reflect` p = p ^+ (((l `project` p) ^- p) ^* 2.0)

Measured memory_bytes: 5020
//============================================================================
// Name        : abc145_a.cpp
// Author      : abb
// Version     :
// Copyright   : [My copyright notice]
// Description : test program
//============================================================================

/*
A - Circle

実行時間制限: 2 sec / メモリ制限: 1024 MB

配点 : 100 点

問題文
整数 r が与えられます。
半径 r の円の面積が半径 1 の円の面積の何倍になるかを求めてください。
なお答えは制約の下では必ず整数になることが示せます。

制約

・1 <= r <= 100
・入力中のすべての値は整数である。
 */

#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ull = unsigned long long;

#define REP(i, m, n) for (ll i = (m); i < (ll)(n); ++(i))
#define REPM(i, m, n) for (ll i = (m); i <= (ll)(n); ++(i))
#define REPR(i, m, n) for (ll i = (m); i >= (ll)(n); --(i))
#define REPD(i, m, n, d) for (ll i = (m); i < (ll)(n); i += (d))
#define REPMD(i, m, n, d) for (ll i = (m); i <= (ll)(n); i += (d))
#define ALL(x) begin(x), end(x)

/**
 * エントリポイント．
 * @return 0.
 */
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    ll r;
    cin >> r;
    // pi -> pi * r * r
    cout << r * r << endl;
    return 0;
}


Measured memory_bytes: 256
A, B, M = map(int,input().split())
listA = list(map(int,input().split()))
listB = list(map(int,input().split()))
ans = min(listA) + min(listB)
for _ in range(M):
    x,y,c = map(int,input().split())
    temp = listA[x-1]+listB[y-1]-c
    ans = min(ans,temp)
print(ans)

Measured memory_bytes: 18736
#include <bits/stdc++.h>
#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() {
  string s, t;
  cin >> s >> t;
  int ns = s.size(), nt = t.size();
  for (int i = ns - nt; i >= 0; i--) {
    bool flag = true;
    rep(j, nt) if (s[i + j] != '?') flag &= (t[j] == s[i + j]);
    if (flag) {
      rep(j, nt) s[i + j] = t[j];
      rep(i, ns) if (s[i] == '?') s[i] = 'a';
      cout << s << endl;
      return 0;
    }
  }
  cout << "UNRESTORABLE" << endl;
  return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define nl '\n'
#define f(i, n) for (int i = 0; i < n; ++i)

using namespace std;
void solve() {
    ll a, b, c;
    cin >> a >> b >> c;
    ll ans = max({a + 10 * b + c, 10 * a + b + c, 10 * c + a + b});
    cout << ans << nl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    solve();
}

Measured memory_bytes: 3528
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;

constexpr long double PI = 3.14159265358979323846264338327950288L;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

class BPapersPlease {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      int n; cin >> n;
      vector<int> a(n);
      rep(i, n) {
        cin >> a[i];
        if (a[i]%2==0) {
          if (a[i]%3 != 0 && a[i]%5 != 0) {
            cout << "DENIED" << endl;
            return;
          }
        }
      }
      cout << "APPROVED" << endl;

    }
};

signed main() {
  BPapersPlease solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace B
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var abck = Console.ReadLine().Trim().Split(' ').Select(long.Parse).ToArray();
            if (abck[3] <= abck[0])
            {
                Console.WriteLine(abck[3]);
                return;
            }
            if (abck[3] <= abck[0] + abck[1])
            {
                Console.WriteLine(abck[0]);
                return;
            }
            Console.WriteLine(abck[0] - Math.Min(abck[2], (Math.Max(0, abck[3] - (abck[0] + abck[1])))));

        }
    }
}


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

int main() {
  string S;
  cin >> S;

  for (int i = S.length() - 1; i >= 0; i--) {
    if (i % 2 == 0 && S.substr(0, i / 2) == S.substr(i / 2, i / 2)) {
      cout << i << endl;
      break;
    }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<long>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
using pll = pair<long, long>;
#define fix20 cout << fixed << setprecision(20);
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define MOD 1000000007
#define all(vec) vec.begin(), vec.end()

int main(){
    char c;
    cin >> c;
    c++;
    cout << c << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

template <class T>
void chmax(T &a, T b) {
    if (b > a) a = b;
}

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

    int n, m;
    cin >> n >> m;

    vector<int> h(n), x(n);

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

    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        a--; b--;

        chmax(x[a], h[b]);
        chmax(x[b], h[a]);
    }

    int r = 0;
    for (int i = 0; i < n; i++) {
        r += h[i] > x[i];
    }

    cout << r << endl;

    return 0;
}

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

int main(){
	string s={};
	cin>>s;
	
	
	int a,b;
	for(int i=0;s[i]!=0;i++){
		if(s[i]=='A'){
			a=i;
			break;
		}
	}
	
	for(int i=0;s[i]!=0;i++){
		if(s[i]=='Z'){
			b=i;
		}
	}
	cout<<b-a+1<<endl;
	return 0;
}

Measured memory_bytes: 640
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(i,v.size())cout<<" "<<v[i];cout<<endl<<endl;
#define show2d(v) rep(i,v.size()){rep(j,v[i].size())cout<<" "<<v[i][j];cout<<endl;}cout<<endl;
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1,1,1,-1,-1};
int dy[]={1,0,-1,0,1,-1,1,-1};//RBLF
int n,m,cnt;
vs in;
vvi num;
void dfs(int a,int b,char c){
	in[a][b]='!';
	num[a][b]=cnt;
	rep(i,8){
		if(c=='.'&&i==4)break;
		int x=a+dx[i];
		int y=b+dy[i];
		if(x<0||x>=n+2||y<0||y>=m+2)continue;
		if(in[x][y]!=c)continue;
		dfs(x,y,c);
	}
}
vvi f(){
	cin>>n>>m;
	if(!n)return vvi(0);
	in=vs(n+2,string(m+2,'.'));
	num=vvi(n+2,vi(m+2));
	vvi G(1);
	rep(i,n){
		string s;cin>>s;
		in[i+1]="."+s+".";
	}
	cnt=0;
	
	rep(i,n+2)rep(j,m+2)if(in[i][j]!='!'){
		if(cnt){
			G[num[i][j-1]].pb(cnt);
			G.pb(vi(0));
		}
		dfs(i,j,in[i][j]);
		cnt++;
	}
	return G;
}
vvi G;
string Hash(int a){
	vs in;
	rep(i,G[a].size()){
		in.pb(Hash(G[a][i]));
	}
	sort(all(in));
	string out="";
	rep(i,in.size())out+=in[i];
	out="("+out+")";
//	cout<<a<<" "<<out<<endl;
	return out;
}
int main(){
	while(1){
		G=f();
		if(G.size()==0)break;
		string A=Hash(0);
		G=f();
		string B=Hash(0);
//		cout<<A<<" "<<B<<endl;
		if(A==B)cout<<"yes"<<endl;
		else cout<<"no"<<endl;
	}
}












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

int isprime(int x){
    if(x==2)return true;
    if(x<2||x%2==0)return false;
    for (int i=3; i<=sqrt(x); i+=2) {
        if(x%i==0)return false;
    }
    return true;
}

int main(){
    int n;
    int a[10000];
    int ans=0;
    cin>>n;
    for (int i=0; i<n; i++) {
        cin>>a[i];
        ans+=isprime(a[i]);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3088
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
#define vec vector<ll>
#define mat vector<vector<ll> >
typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=998244353;
const ll mod=1e9+7;
signed main(){
    ll n,m,q;cin>>n>>m>>q;
    vector<vector<ll> >a(n+2,vector<ll>(m+2));
    vector<vector<ll> >b(n+2,vector<ll>(m+2));
    vector<vector<ll> >bb(n+2,vector<ll>(m+2));
    vector<vector<ll> >c(n+2,vector<ll>(m+2));
    rep(i,n){
        rep(j,m){
            char d;cin>>d;
            if(d=='1'){
                c[i+1][j+1]=1;
            }
        }
    }
    REP(i,1,n+1){
        REP(j,1,m+1){
            a[i][j]=(a[i-1][j]+a[i][j-1]-a[i-1][j-1]);
            b[i][j]=(b[i-1][j]+b[i][j-1]-b[i-1][j-1]);
            bb[i][j]=(bb[i-1][j]+bb[i][j-1]-bb[i-1][j-1]);
            if(c[i][j]==1){
                a[i][j]++;
                if(c[i][j-1]==1)b[i][j]++;
                if(c[i-1][j]==1)bb[i][j]++;
            }
            //cout<<b[i][j]+bb[i][j]<<' ';
        }
    }
    rep(i,q){
        ll x,y,xx,yy;cin>>x>>y>>xx>>yy;
        ll s=a[xx][yy]-a[x-1][yy]-a[xx][y-1]+a[x-1][y-1];
        ll t=b[xx][yy]-b[x-1][yy]-b[xx][y]+b[x-1][y];
        ll u=bb[xx][yy]-bb[x][yy]-bb[xx][y-1]+bb[x][y-1];
        cout<<s-t-u<<endl;
        //cout<<s-t<<endl;
    }
}

Measured memory_bytes: 128892
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Map<String,Integer> sales = new HashMap<>();
		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();

		for(int i = 0; i < a;i++){
			int x= sc.nextInt();
			String key = sc.next();
			if(x ==0){
				sales.put(key,sc.nextInt());
			}else{
				System.out.println(sales.get(key));

			}
		}
	}
}



Measured memory_bytes: 193468
#include <iostream>
#include <vector>
#include <algorithm>

int main() {
    std::vector<std::vector<int> > cards(4, std::vector<int>());
    int N;
    std::cin >> N;
    for (int i = 0; i < N; i++) {
        char suit;
        int rank;
        std::cin >> suit >> rank;
        switch (suit) {
            case 'S':
                cards.at(0).push_back(rank);
                break;
            case 'H':
                cards.at(1).push_back(rank);
                break;
            case 'C':
                cards.at(2).push_back(rank);
                break;
            case 'D':
                cards.at(3).push_back(rank);
                break;
            default:
                break;
        }
    }

    std::vector<std::string> n_to_suit = {"S ", "H ", "C ", "D "};

    for (int i = 0; i < 4; i++) {
        for (int j = 1; j < 14; j++) {
            auto f = std::find(cards.at(i).begin(), cards.at(i).end(), j);
            if (f == cards.at(i).end()) {
                std::cout << n_to_suit.at(i) << j << std::endl;
            }
        }
    }
}


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

namespace abc112
{
    class abc112b
    {
        static void Main(string[] args)
        {
            var buf = Console.ReadLine().Split();
            var n = int.Parse(buf[0]);
            var t_limit = int.Parse(buf[1]);

            const int NO_AVAILABLE_ROUTE = 1001;
            var c_min = NO_AVAILABLE_ROUTE;
            for(var i= 1; i<=n;++i)
            {
                buf = Console.ReadLine().Split();
                var c = int.Parse(buf[0]);
                var t = int.Parse(buf[1]);
                if (t <= t_limit && c < c_min)
                    c_min = c;
            }
            if(c_min== NO_AVAILABLE_ROUTE)
                Console.WriteLine("TLE");
            else
                Console.WriteLine(c_min);
        }
    }
}


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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define FOR(NAME, START, NUM) for (ll NAME = START; NAME < (NUM); NAME++)
#define REP(NAME, NUM) for (ll NAME = 0; NAME < (NUM); NAME++)
#define BREP(NAME, NUM) for (ll NAME = (NUM)-1; NAME >= 0; NAME--)
#define ALL(NAME) (NAME).begin(), (NAME).end()
const ll INF =1000000000000000;

int main(){
  ll n,m;
  cin>>n>>m;
  vector<ll> a(n);
  REP(i,n)cin>>a[i];
  vector<pair<ll,ll>> cb(max(m,n));
  REP(i,m){
    cin>>cb.at(i).second;
    cin>>cb.at(i).first;
  }
  sort(ALL(a));
  sort(ALL(cb));
  reverse(ALL(cb));
  
  ll bsum=0,x=0;
  REP(i,n){
    if(a.at(i)<cb.at(x).first)
      a.at(i)=cb.at(x).first;
    else{
      bsum=i+1;
      x++;
      continue;
    }
    if(cb.at(x).second-1 + bsum == i){
      bsum+=cb.at(x).second;
      x++;
    }
  }
  ll sum=0;
  REP(i,n){
    sum+=a[i];
  }
  cout<<sum<<endl;
}

Measured memory_bytes: 2560
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;


public class Main {
	
	public static void main(String[] args) throws IOException {
		new Main().exec();
	}
	
	public void exec() throws IOException {
		InputUtil in = new InputUtil();
		PrintWriter out = new PrintWriter(System.out);
		int N = in.nextInt();
		int[] P = in.nextInt(new int[N]);
		int cnt=0;
		boolean flg=false;
		for(int i=0; i<N; i++){
			if(flg){
				cnt++;
				flg=false;
			}
			else if(P[i]==i+1){
				flg=true;
			}
		}
		if(flg) cnt++;
		out.println(cnt);
		out.flush();
	}
	
}

class InputUtil {
	//Static Fields
	private static final int BUFSIZ = 100000;
	
	//Fields
	protected InputStream in;
	private byte[] buf = null;
	private int ptr = 0;
	private int max = -1;
	private DataInputStream dis = null;
	//Constructors
	public InputUtil() {this(System.in,BUFSIZ);}
	public InputUtil(InputStream in, int bufsiz) {
		initBuf(bufsiz);
		initIn(in);
	}
	
	//Methods
	//Initializer
	protected void initIn(InputStream in) {dis = new DataInputStream(this.in = in);}
	protected void initBuf(int bufsiz) {buf = new byte[bufsiz];}
	
	//buffer operation
	private void next() throws IOException {ptr++; readBuf();}
	private void readBuf() throws IOException {
		if(ptr >= max && dis.available()>0) {
			if(max>0) Arrays.fill(buf,0,max,(byte)0);
			max = dis.read(buf);
			ptr = 0;
		}
	}
	
	//Number Input Reader/Parser
	private boolean isNum(byte b) {return '0' <= b && b <= '9'; }
	private boolean isMinus(byte b) {return b=='-'; }

	private int _nextInt() throws IOException {
		int sign = 1;
		int res = 0;
		byte c;
		while (!isNum(c=buf[ptr]) && !isMinus(c)) 
			next();
		if (isMinus(buf[ptr])) {
			sign = -1;
			next();
		}
		while (isNum(c=buf[ptr])) {
			res *= 10;
			res += c - '0' ;
			next();
		}
		next();
		return sign * res;
	}
	
	public int nextInt() throws IOException {
		readBuf();
		return _nextInt();
	}

	public int[] nextInt(int[] result) throws IOException {
		readBuf();
		for(int i=0; i<result.length; i++) {
			result[i] = _nextInt();
		}
		return result;
	}
	
	//Close 
	public void close() throws IOException {
		if(!this.in.equals(System.in)) 
			this.in.close();
	}

}

Measured memory_bytes: 21972
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int int_cmp(const int *a, const int *b)
{
    if (*a < *b)
        return (-1);
    else if (*a > *b)
        return (1);
    return (0);
}

int main(){
    int a[30],b[30];
    int f = 0;
    char ch;
    string str,str2;

    FOR(i,0,30){
        a[i] = 0;
        b[i] = 0;
    }

    cin >> str;
    const char* cstr = str.c_str();
    FOR(i,0,str.size())a[cstr[i] - 97]++;
    qsort(a,26,sizeof(int),(int(*)(const void*, const void*))int_cmp);

    cin >> str2;
    const char* cstr2 = str2.c_str();
    FOR(i,0,str2.size())b[cstr2[i] - 97]++;
    qsort(b,26,sizeof(int),(int(*)(const void*, const void*))int_cmp);

    FOR(i,0,26){
        if(a[i] != b[i])f = 1;
    }

    if(f == 0)cout << "Yes";
    else cout << "No";


    return 0;
}


Measured memory_bytes: 776
import math
N, M = map(int,input().split())
mod = 10**9 + 7

if abs(N-M) > 1:
    print(0)
else:
    if N == M:
        print(2*math.factorial(N)*math.factorial(M)%mod)
    else:
        print(math.factorial(N)*math.factorial(M)%mod)


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

int main(){
    int N;
    cin >> N;
    vector<int> X(N);

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

    int p_min=1e+07;
    for(int i=1;i<=100;i++){
        int p=0;
        for(int j=0;j<N;j++){
            p+=pow(X[j]-i,2);
        }
        p_min=min(p,p_min);
    }

    cout << p_min << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fr first
#define sc second
#define sz(c) int(c.size())
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define vlong long long

int main() {
	int t , x;
	cin >> t >> x;
	cout << max(0 , t - x) << endl;
}


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

int main()
{
    int N, M;
    cin >> N >> M;
    int like[31] = {0};
    for (int i = 0; i < N; i++)
    {
        int K;
        cin >> K;
        for (int j = 0; j < K; j++)
        {
            int x;
            cin >> x;
            like[x]++;
        }
    }

    int ans = 0;
    for (int i = 1; i <= M; i++)
    {
        if (like[i] == N)
        {
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
while True:
    try:
        a, b = map(int, input().split())
        if a < b:
            b, a = a, b
        x, y = a, b
        while b: a, b = b, a%b
        gcd = a
        lcm = (x*y)//gcd
        print(gcd, lcm)
    except:
        break

Measured memory_bytes: 7568
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

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

// xのn乗を求める
pub fn mod_pow(x: i64, n: i64, mods: i64) -> i64 {
    if n == 0 {
        return 1;
    }
    let mut res = mod_pow(x * x % mods, n / 2, mods);
    if n % 2 == 1 {
        res = res * x % mods;
    }
    return res;
}

// nの逆元を求める
pub fn mod_inv(n: i64, mods: i64) -> i64 {
    return mod_pow(n, mods-2, mods);
}

// nCkを求める
pub fn mod_comb(n: i64, k: i64, mods: i64) -> i64 {
    let sum1 = (n-k+1..n+1).fold(1, |ac, x| ac * x % mods);
    let sum2 = (1..k+1).fold(1, |ac, x| ac * x % mods);
    return sum1 * mod_inv(sum2, mods) % mods;
}

//const max: i64 = 1000000000;
// const fac: [i64; max] = [0; max];
// const finv: [i64; max] = [0; max];
// const inv: [i64; max] = [0; max];

// テーブルを作る前処理
// pub fn mod_binom_init(mods: i64) {
//     fac[0] = fac[1] = 1;
//     finv[0] = finv[1] = 1;
//     inv[1] = 1;
//     for i in 2..max {
//         fac[i] = fac[i - 1] * i % mods;
//         inv[i] = mods - inv[mods%i] * (mods / i) % mods;
//         finv[i] = finv[i - 1] * inv[i] % mods;
//     }
// }

// pub fn mod_binom(n: i64, k: i64, mods: i64) -> i64 {
//     if n < k {
//         return 0;
//     }
//     if n < 0 || k < 0 {
//         return 0;
//     }
//     return fac[n] * (finv[k] * finv[n - k] % mods) % mods;
// }

fn main() {
    input!{
        n: i64,
        a: i64,
        b: i64,
    }
    let mods = 10_i64.pow(9) + 7;
    //mod_binom_init(mods);
    let sum = (mod_pow(2, n, mods) - 1 + 2 * mods - mod_comb(n, a, mods) - mod_comb(n, b, mods)) % mods;
    println!("{}", sum);

}



Measured memory_bytes: 4476
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8 ff=unix


def solv(K, X):
    if 500 * K >= X:
        return "Yes"
    else:
        return "No"


if __name__ == "__main__":

    K, X = map(int, input().split())
    ans = solv(K, X)

    print(ans)


Measured memory_bytes: 2940
#include <iostream>

int main(int argc, char **argv)
{
    long N, K;
    std::cin >> N >> K;

    long base = 1000000000 + 7;
    long ans = 0;

    for(int k = K; k <= N+1; k++){
        long b = k * (k - 1) / 2;
        long e = b + k * (N - k + 1);
        ans += (e - b) + 1;
        ans %= base;
    }

    std::cout << ans << std::endl;
}


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

using namespace std;
const int MAXN = 3e3 + 7;

double dp[MAXN][MAXN], a[MAXN], n;

double solve(int on, int k) {
  if(on == n) return (k > n/2);
  double &ans = dp[on][k];
  if (ans != -1) return ans;
  ans = a[on] * solve(on + 1, k + 1) + (1 - a[on]) * solve(on + 1, k);
  return ans;
}

int main() {
  for (int i = 0; i < MAXN; i++) {
    for (int j = 0; j < MAXN; j++) {
      dp[i][j] = -1;
    }
  } 
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  cout << fixed << setprecision(10) << solve(0, 0);
  return 0;
}

Measured memory_bytes: 71040
//include
//------------------------------------------
#include <bits/stdc++.h>
using namespace std;
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const long long INF = 1000000007;
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
// chmax chmin
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main(void){
    int N,M;
    cin >> N >> M;

    ll ans = 0;
    if(abs(N-M) < 2){
        ans = 1;
        REP(i,min(N,M)) ans = (ans*(i+1)) % INF;
        if(N == M) ans = (ans*ans*2) % INF;
        else ans = ((ans*ans)%INF)*max(N,M) % INF;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<cmath>
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;

int main() {
	int sx, sy, tx, ty;
	cin >> sx >> sy >> tx >> ty;
	int bx = tx - sx;
	int by = ty - sy;
	rep(i, bx) cout << 'R';
	rep(i, by) cout << 'U';
	cout << 'R';
	rep(i, by + 1) cout << 'D';
	rep(i, bx + 1) cout << 'L';
	cout << 'U';
	rep(i, by) cout << 'U';
	rep(i, bx) cout << 'R';
	cout << 'U';
	rep(i, bx + 1) cout << 'L';
	rep(i, by + 1) cout << 'D';
	cout << 'R';
	cout << endl;
}  

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int n;
	scanf("%d", &n);
	int i;
	long long int a[100005];
	for (i = 0; i < n; i++)
		scanf("%lld", &a[i]);
	int count = 0, zero = 0;
	long long int sum = 0;
	long long int min = 2000000009;
	for (i = 0; i < n; i++)
	{
		if (a[i] < 0)
		{
			count++;
			a[i] *= -1;
		}
		if (a[i] == 0)
			zero++;
		sum += a[i];
		if (min > a[i])
			min = a[i];
	}
	if (count % 2 == 0 || zero > 0)
		printf("%lld\n", sum);
	else
		printf("%lld\n", sum - 2 * min);
	return 0;
}

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

int main() {
    string S;
    cin >> S;
    
    int count = 0;
    for (int i =  0; i < 3; i++) {
        if (S.at(i) == 'o') count++;
    }
    cout << 700 + count * 100 << endl;
}

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

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define MAX 500005

template<typename T>
struct BIT {
  int n;
  vector<T> bit[2];
  BIT(int _n) : n(_n+1) {
    rep(i,2) bit[i].assign(n,0);
  }
  void add_sub(int p, int i, T x) {
    while (i < n) {
      bit[p][i] += x;
      i += i&-i;
    }
  }
  void add(int l, int r, T x) {
    add_sub(0,l,-x*(l-1));
    add_sub(0,r,x*(r-1));
    add_sub(1,l,x);
    add_sub(1,r,-x);

  }
  T sum_sub(int p, int i) {
    T s(0);
    while (i > 0) {
      s += bit[p][i];
      i -= i&-i;
    }
    return s;
  }
  T sum(int i) { return sum_sub(0,i) + sum_sub(1,i)*i; }
  T query(int l, int r) { return sum(r-1) - sum(l-1); }
  T operator[](int i) { return query(i,i+1); }
};

int main(int, char**)
{
  int n, q;
  cin >> n >> q;

  BIT<int> bit(n);

  vector<int> ans;
  rep(i,q) {
    int command; cin >> command;
    if (command == 0) {
      int s, t, x;
      cin >> s >> t >> x;
      bit.add(s,t+1,x);
    } else if (command == 1) {
      int i; cin >> i;
      ans.push_back(bit[i]);
    }
  }
  for (auto a : ans) cout << a << endl;

  return 0;
}



Measured memory_bytes: 4116
#include <bits/stdc++.h>
#define rep2(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(i,n) rep2(i,0,n)
using namespace std;
using ll = long long;
int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n)cin >> a[i];
    int r=0,sum=0;
    ll ans=0;
    rep(l,n){
        while(r<n&&(sum+a[r]==(sum^a[r]))){
            sum+=a[r];
            ++r;
        }
        ans+=r-l;
        sum^=a[l];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1152