akhauriyash/Code-Regression huggingface dataset:
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "math.h"
#include "utility"
#include "string"
#include "map"
#include "unordered_map"
#include "iomanip"
#include "random"

using namespace std;
const long long int MOD = 1000000007;

long long int power(long long int x, long long int n, long long int M) {
	long long int tmp = 1;

	if (n > 0) {
		tmp = power(x, n / 2, M);
		if (n % 2 == 0) tmp = (tmp*tmp) % M;
		else tmp = (((tmp*tmp) % M)*x) % M;
	}
	return tmp;
}

long long int N, M, K, Q, W, H, L, R;
long long int ans;


int main() {
	ios::sync_with_stdio(false);
	cin >> N;
	if (64 <= N)cout << "64\n";
	else if (32 <= N)cout << "32\n";
	else if (16 <= N)cout << "16\n";
	else if (8 <= N)cout << "8\n";
	else if (4 <= N)cout << "4\n";
	else if (2 <= N)cout << "2\n";
	else cout << "1\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())

using namespace std;
typedef long long ll;

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; }
const int INF = 1001001001;
const long long INFL = (1LL<<60);
const double eps = (1e-9);

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

  int n = s.size();

  rep(i, n) {
    if (s[i] != s[n-i-1]) {
      cout << "No" << endl;
      return 0;
    }
  }

  string ss = s.substr(0, ((n-1)/2));
  int nn = ss.size();
  // cerr << ss << endl;
  rep(i, ss.size()) {
    if (ss[i] != ss[nn-i-1]) {
      cout << "No" << endl;
      return 0;
    }
  }

  string sss = s.substr((n+3)/2 -1, n);
  int nnn = sss.size();
  // cerr << sss << endl;
  rep(i, sss.size()) {
    if (sss[i] != sss[nnn-i-1]) {
      cout << "No" << endl;
      return 0;
    }
  }

  cout << "Yes" << endl;

  return 0;
}


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

int main()
{
    int N;
    cin >> N;
    vector<int> L(2*N);
    for (int i=0; i < 2*N; i++)
        cin >> L[i];
    sort(L.begin(), L.end());

    int ans=0;
    for (int i=0; i < 2*N; i+= 2)
        ans += L[i];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;
use std::collections::VecDeque;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("faild to read char") as char)
        .take_while(|c| !c.is_whitespace())
        .collect();
    token
        .parse()
        .ok()
        .expect("faild to parse token")
}

fn main(){
    let n: usize = read();
    let m: usize = read();

    let mut path: Vec<Vec<usize>> = (0..n).map(|_| Vec::with_capacity(n)).collect();

    for _ in 0..m {
        let a = read::<usize>() - 1;
        let b = read::<usize>() - 1;
        path[a].push(b);
        path[b].push(a);
    }

    let mut ret: Vec<usize> = (0..n).map(|_| n + 1).collect();
    ret[0] = 0;

    let mut visit: Vec<bool> = (0..n).map(|_| false).collect();

    let mut queue: VecDeque<usize> = VecDeque::with_capacity(m);
    queue.push_back(0);
    visit[0] = true;

    while !queue.is_empty() {
        let now = queue.pop_front().unwrap();
        for &i in &path[now] {
            if !visit[i] {
                ret[i] = now;
                visit[i] = true;
                queue.push_back(i);
            }
        }
    }

    println!("Yes");
    for i in (&ret).into_iter().skip(1) {
        println!("{}", i + 1);
    }
}


Measured memory_bytes: 561056
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define SCLLD(n) scanf("%lld",&n)
#define SCLLD2(m,n) scanf("%lld%lld",&m,&n)
#define SCLLD3(m,n,k) scanf("%lld%lld%lld",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define IN(x,S) (S.count(x) != 0)
using namespace std;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector < VI > VVI;
typedef long long ll;
/////////////////////////(๑•﹏•๑｀)/////////////////////////
int main() {
	string str;
	getline(cin,str);
	int l = str.length();
	FORq(i,1,l-1){
		if (str[i] == str[i-1]){
			printf("%d %d\n",i,i+1);
			return 0;
		}else if((i != 1) and (str[i] == str[i-2])){
			printf("%d %d\n",i-1,i+1);
			return 0;
		}

	}

	printf("-1 -1\n");
	return 0;
}

Measured memory_bytes: 512
// clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
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; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

using Weight = int;
struct Edge {
  int src, dst;
  Weight weight;
  Edge(int s = 0, int d = 0, Weight w = 0)
    : src(s), dst(d), weight(w) {
  }
};

using Edges  = vector<Edge>;
using Graph  = vector<Edges>;
using Array  = vector<Weight>;
using Matrix = vector<Array>;

void addArc(Graph &g, const int &a, const int &b, const Weight &w = 1) {
  g[a].emplace_back(a, b, w);
}

void addEdge(Graph &g, const int &a, const int &b, const Weight &w = 1) {
  addArc(g, a, b, w);
  addArc(g, b, a, w);
}

// deps: graph-basic
Matrix warshallFloyd(const Graph &g) {
  int n = g.size();
  Matrix d(n, Array(n, INF));
  rep(i, n) d[i][i] = 0;
  rep(i, n) for (auto &e : g[i]) cmin(d[e.src][e.dst], e.weight);
  rep(k, n) rep(i, n) rep(j, n) {
    if (d[i][k] != INF && d[k][j] != INF) cmin(d[i][j], d[i][k] + d[k][j]);
  }
  return d;
}

void solve() {
  int n;
  cin >> n;
  Graph g(n);
  while (n--) {
    int r, k;
    cin >> r >> k;
    --r;
    while (k--) {
      int t;
      cin >> t;
      --t;
      addArc(g, r, t);
    }
  }
  Matrix t = warshallFloyd(g);
  int p;
  cin >> p;
  while (p--) {
    int s, d, v;
    cin >> s >> d >> v;
    --s, --d;
    if (t[s][d] + 1 > v) {
      cout << "NA" << endl;
      continue;
    }
    cout << t[s][d] + 1 << endl;
  }
}

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

using namespace std;

int A, B, C, D;

int main(void)
{
	cin >> A >> B >> C >> D;
	
	int ret;
	if(A < C){
		ret = min(B - C, D - C);
	}else{
		ret = min(D - A, B - A);
	}
	if(ret < 0) ret = 0;
	
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		int x = n * a;
		int y = b;
		System.out.println(Math.min(x, y));
	}
}

Measured memory_bytes: 21712
#include <bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
//typedef tree <int,null_type,less <int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
// #include <ext/rope>
// using namespace __gnu_cxx;
typedef long long int ll;
typedef long double ld;
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(g, i, n) for (ll g = i; g < n; g++)
#define rev(g, n, i) for (ll g = n - 1; g >= i; g--)
#define all(v) v.begin(), v.end()
#define pb push_back
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define ve vector
#define lb lower_bound
#define ub upper_bound
#define bb break
#define cc continue
#define rem 1000000007
#define PI 3.141592653589793238462643383279502
ll power(ll x, ll y, ll p) 
{ 
    ll res = 1;      // Initialize result 
    x = x % p;  // Update x if it is more than or 
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1; // y = y/2 
        x = (x*x) % p; 
    } 
    return res; 
} 
ll modInverse(ll n, ll p) 
{ 
    return power(n, p-2, p); 
} 
struct point
{
    ll x,y;
};
int main()
{
    FAST
    // freopen("input1.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    /*ll tests;
    cin>>tests;
    rep (gg,0,tests)
    {}*/
    ll k;
    cin>>k;
    string s;
    cin>>s;
    if (s.length()<=k)
    {
        cout<<s<<"\n";
    }
    else
    {
        string t=s.substr(0,k);
        cout<<t<<"...\n";
    }
    
}


Measured memory_bytes: 3652
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>; 
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
constexpr long long LINF = 1001001001001001001;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main(){
    int n; cin >> n;
    vector<int> A(n, INF), B(n-1); rep(i, n-1)cin >> B[i];

    rep(i, n-1){
        chmin(A[i], B[i]);
        chmin(A[i+1], B[i]);
    }
    int res = 0;
    rep(i, n){
        res += A[i];
    }
    cout << res << ln;
}
    


Measured memory_bytes: 3616
#include <iostream>
#include <cmath>
#include <string>
#include <cstdlib>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cctype>
#include <map>
#include <cstring>
#include <typeinfo>
#define REP(i,n) for(int i = 0;i < n ;i++)
#define FOR(i,m,n) for(int i= m ;i<n;i++)
using namespace std;

int main(void){
  int a,b,h;
  cin >> a >> b >> h;
  cout << ((a+b)*h)/2 << endl;
  return 0;
}


Measured memory_bytes: 256
N = map(int, input())
An = list(map(int, input().split()))
mnum = 10 ** 9 + 7
CumSum = An[0] % mnum
answer = 0
for i in range(1, len(An)):
    answer = (answer + CumSum * An[i]) % mnum
    CumSum = (CumSum + An[i]) % mnum
print(answer)

Measured memory_bytes: 31488
#include <iostream>
using namespace std;
int main(){
  int n,a,b;
  cin >> n >> a >> b;
  int i,j;
  int cnt = 0;
  for(i=1;i<=n;i++){
    int x;
    if(i==10000){
      if(a==1) cnt += i;
    }
    else if(i>=1000){
      x = (i/1000+(i%1000)/100+(i%100)/10+i%10);
      if(a<=x&&x<=b) cnt += i;
    }
    else if(i>=100){
      x = (i/100+(i%100)/10+i%10);
      if(a<=x&&x<=b) cnt += i;
    }
    else if(i>=10){
      x = (i/10+i%10);
      if(a<=x&&x<=b) cnt += i;
    }
    else{
      x = i;
      if(a<=x&&x<=b) cnt += i;
    }
  }
  cout << cnt << "\n";
  return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#ifdef __DEBUG__
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const deque<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const set<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int N;
string S;
void input(){
    fast_io();
    cin >> N >> S;
}

int WAsolve(){
    string T = S;
    string V = S;
    // ll ans = 0;
    // for (int i = 0; i < N-1; i++)
    // {
    //     if(S[i]=='#' && S[i+1]=='.'){
    //         S[i+1]='#';
    //         ans++;
    //     }
    // }
    // ll ans_rev = 0;
    // for (int i = N-1; i > 0; i--)
    // {
    //     if(T[i-1]=='#' && T[i]=='.'){
    //         T[i-1]='.';
    //         ans_rev++;
    //     }
    // }

    int le = 0, ri = N-1;
    int ans = 0;
    while(ri-le>0){
        while(V[ri]=='#') ri--;
        while(V[le]=='.') le++;
        if(ri<=le) break;
        if(V[le]=='#' && V[ri]=='.'){
            int L=0,R=0;
            while(V[le+L]=='#') L++;
            while(V[ri-R]=='.') R++;
            if(L<R) {ans+=L;le+=L;}
            else {ans+=R;ri-=R;}
        }
    }
    cout << ans << endl;
    // DBG(S)
    // DBG(T)
    // cout << min(ans, ans_rev) << endl;    
    return 0;
}   

vector<int> AS;
// [i,j]の中にあるcの数を数える。
int cal(int i,int j,char c){
    if(c=='#') return AS[j+1]-AS[i];
    return (j-i+1)-(AS[j+1]-AS[i]);
}

int solve(){
    // .....######にしたい。
    int ans = N+1;
    AS.assign(N+1,0);
    for (int i = 0; i < N; i++)
    {
        AS[i+1] = AS[i] + (S[i]=='#');
    }
    
    for (int i = 0; i <= N; i++)
    {
        int tmp = cal(0,i-1,'#')+cal(i,N-1,'.');
        ans = min(ans,tmp);
    }
    cout << ans << endl;
    return 0;    
}

int main()
{
    input();
    solve();
    return 0;
}

Measured memory_bytes: 1428
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <set>
#include <iomanip>
#include <stdio.h>
#include <sstream>
#include <bits/stdc++.h>
using namespace std;
int main(void){
  long long int x,k,d;
  cin>>x>>k>>d;
  if(x==0){
    if(k%2==0){
      cout<<0<<endl;
    }else{
      cout<<d<<endl;
    }
  }else if(x>0){
    if(x/d>k){
      x-=d*k;
      k=0;
      cout<<x<<endl;
      return 0;
    }
    k-=x/d;
    x%=d;
    if(k%2==0){
      cout<<x<<endl;
    }else{
      cout<<abs(x-d)<<endl;
    }
  }else{
    if(abs(x/d)>k){
      x+=d*k;
      k=0;
      cout<<abs(x)<<endl;
      return 0;
    }
    k-=abs(x/d);
    x%=d;
    if(k%2==0){
      cout<<abs(x)<<endl;
    }else{
      cout<<abs(x+d)<<endl;
    }
  }
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr long long MOD = 1000000007;
constexpr long long INF = 1LL << 60;
const long double PI = acosl(-1.0);
constexpr long double EPS = 1e-11;
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;
}
void dodo(char i,queue<char>qua,queue<char>qub,queue<char>quc){
    if (i == 'a') {
        if(qua.empty()){
            cout << 'A' << endl;
            return;
        }
        char t = qua.front();
        qua.pop();
        dodo(t, qua, qub, quc);
    } else if (i == 'b') {
        if(qub.empty()){
            cout << 'B' << endl;
            return;
        }
        char t = qub.front();
        qub.pop();
        dodo(t, qua, qub, quc);
    } else {
        if(quc.empty()){
            cout << 'C' << endl;
            return;
        }
            char t = quc.front();
            quc.pop();
            dodo(t, qua, qub, quc);
    }
}
int main(){
    string sa, sb, sc;
    cin >> sa >> sb >> sc;
    queue<char> a, b, c;
    for (ll i = 0; i < sa.size(); i++) a.push(sa[i]);
    for (ll i = 0; i < sb.size(); i++) b.push(sb[i]);
    for (ll i = 0; i < sc.size(); i++) c.push(sc[i]);
    dodo('a', a, b, c);
}

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

int main() {
  string S,T;
  cin >> S;
  int N = S.size();
  T = S;
  
  reverse(T.begin(),T.end());
  
  int ans = 0;
  for (int i = 0; i < N/2; i++) {
    if (S.at(i) != T.at(i)) {
      ans++;
    }
  }
  
  cout << ans << endl;
}
      

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

using namespace std;
typedef long long ll;
typedef pair<ll, double> p_ld;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (ll i=(ll)from; i<(ll)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(int x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { int d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }

struct barrier { double x, y, r; };

// ----------------------------------------------------------------------
// ----------------------------------------------------------------------

struct edge { ll to; double d; };
vector<vector<edge>> adj;

vector<double> dijkstra(int n=0) {
  int N = adj.size();
  auto c = [](const p_ld &x, const p_ld &y){return x.second>y.second;};
  priority_queue<p_ld, vector<p_ld>, decltype(c)> q(c);
  vector<double> result(N,LLINF); result[n] = 0; q.push(make_pair(n,0));
  while(q.size()) {
    p_ld now = q.top(); q.pop();
    ll np = now.first; double nd = now.second;
    if (nd>result[np]) continue;
    for (auto x: adj[np]) {
      if (result[x.to]<=result[np]+x.d) continue;
      q.push(make_pair(x.to, result[np]+x.d));
      result[x.to] = result[np]+x.d;
    }
  }
  return result;
}

// ----------------------------------------------------------------------
// ----------------------------------------------------------------------

int main() {
  double xs, ys, xt, yt; cin >> xs >> ys >> xt >> yt;
  ll N; cin >> N;
  barrier b[N+2]; rep(i,N) cin >> b[i+1].x >> b[i+1].y >> b[i+1].r;
  b[0] = {xs,ys,0}; b[N+1] = {xt,yt,0};

  adj.resize(N+2);
  rep(i,N+2) rep(j,N+2) {
    if (i==j) continue;
    double l = max((double)0, sqrt(pow(b[i].x-b[j].x,2)+pow(b[i].y-b[j].y,2))-(b[i].r+b[j].r));
    adj[i].push_back({j,l});
  }
  vector<double> d = dijkstra();

  double result = d[N+1];
  cout << setprecision(10) << result << endl;
  return 0;
}

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

int main() {
  int r;
  cin >> r;
  cout << 2*r*M_PI << endl;
}

Measured memory_bytes: 3796
//
// Created on 2020/08/12.
//


#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <ios>
#include <iomanip>
#include <numeric>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
using namespace std;
const long long LINF =1e18;
const int INF = 1e9;



int main() {
    ll n;
    cin>>n;
    ll ans = 0;
    ll kurai = 10;
    if(n % 2 == 1){
        cout<<0<<endl;
        return 0;
    }
    for (int i = 1; kurai <= n; ++i) {
        ll temp = (n / kurai);
        ans += temp;
        kurai *= 5;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3636
# 2020/06/10
# AtCoder Beginner Contest 062 - B

# Input
h, w = map(int,input().split())
header = ['#'] * (w+2)
print(''.join(header))

# Calc
for i in range(h):
    instr = input()
    wstr = '#' + instr + '#'
    print(wstr)

print(''.join(header))


Measured memory_bytes: 3060
let (n, p) = Scanf.scanf "%d %d\n" @@ fun n p -> (n, p)

let prime_fact n =
  let rec f arr i n =
    if n <= 1 then arr
    else if n < i * i then n :: arr
    else if n mod i = 0 then f (i :: arr) i (n / i)
    else f arr (i + 1) n
  in
  match f [] 2 n with
    | [] -> []
    | p :: ps ->
        let (acc, p, n) = List.fold_left (fun (acc, p, n) q ->
          if p = q
          then (acc, p, n + 1)
          else ((p, n) :: acc, q, 1)) ([], p, 1) ps in
        (p, n) :: acc

let rec pow n = function
  | 0 -> 1
  | i -> n * pow n (i - 1)

let () = 
  prime_fact p
    |> List.map (fun (i, j) -> pow i (j / n))
    |> List.fold_left ( * ) 1
    |> print_int

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <functional>
#include <unordered_map> 
#include <map> 
#include <numeric>
#include <limits>
#include <utility>
#include <queue>
#include <random>
#include <bitset>
using namespace std;
typedef long long LL;

int main(void) {
	LL i, j, k, n, ans;
	vector<int> a(3);
	vector<int> b(3);
	vector<vector<int>> c(3, vector<int>(3));

	for (i = 0; i < 3; i++) {
		for (j = 0; j < 3; j++) {
			cin >> c[i][j];
		}
	}

	for (i = 0; i <= min(c[0][0], min(c[0][1], c[0][2])); i++) {
		for (j = 0; j <= min(c[1][0], min(c[1][1], c[1][2])); j++) {
			for (k = 0; k <= min(c[2][0], min(c[2][1], c[2][2])); k++) {
				if (((c[0][0] - i == c[1][0] - j) && (c[1][0] - j == c[2][0] - k))&&((c[0][1] - i == c[1][1] - j) && (c[1][1] - j == c[2][1] - k))&&((c[0][2] - i == c[1][2] - j) && (c[1][2] - j == c[2][2] - k))) {
					cout << "Yes" << endl;
					return 0;
				}
			}
		}
	}


	cout << "No" << endl;


	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define N 1000000
const int MOD=(int)1e9+7; //which is prime
int x,y;
int min(int a,int b){
	return a<b?a:b;
}
long long fac(int n){
	long long f=1;
	while(n>0){
		f*=n--;
		f%=MOD;
	}
	return f;
}
long long calc(long long x,long long cnt){
	long long ans=1;
	while(cnt>0){
		if((cnt%2)!=0){
			ans*=x;
			ans%=MOD;
		}
		x*=x;
		x%=MOD;
		cnt/=2;
	}
	return ans;
}
long long solve(){
	if((2*x-y)%3||y>2*x||x>2*y)
		return 0;
	int a=(2*x-y)/3,b=(-x+2*y)/3;
	int n=a+b,r=min(a,b);
	long long x1,x2,x3;
	x1=fac(n);
	x2=fac(r)*fac(n-r);
	x2%=MOD;
	x3=calc(x2,MOD-2);
	long long ans;
	ans=x1*x3;
	ans%=MOD;
	return ans;
}
int main(){
	scanf("%d%d",&x,&y);
	printf("%lld",solve());
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int h[n],dp[n];
  for(int i=0;i<n;i++)
  cin>>h[i];
  dp[0]={0};
  dp[1]=abs(h[1]-h[0]);
  for(int i=2;i<n;i++)
  {
    dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
  }
  cout<<dp[n-1];
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <utility>
#include <queue>
using namespace std;
typedef pair<int,int> P;

int A[1000001]={0};
int main(){
  int n,q,a,b; 
  int f = 0;
  cin >> n >> q;
  priority_queue<P> pp;
  pp.push(P(0,-1));

    for(int i = 0 ; i < q ; i++){
      cin >> a >> b;
      A[a] += b;
      pp.push(P(A[a],-a));
      while(1){
      int x = -pp.top().second;
      int y = pp.top().first;
      if(A[x] == y){
	cout << x << " " << y << endl;
      break;
      }
      pp.pop();
      }

    }
  return 0;
}

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

#define int long long
#define double long double
#define ff first
#define ss second
#define endl '\n'
#define ii pair<int, int>
#define mp make_pair
#define mt make_tuple
#define DESYNC                      \
  ios_base::sync_with_stdio(false); \
  cin.tie(0);                       \
  cout.tie(0)
#define pb push_back
#define vi vector<int>
#define vii vector<ii>
#define all(x) x.begin(), x.end()
#define EPS 1e-9
#define INF 1e18
#define ROOT 1
#define M 1000000007
#define curtime chrono::steady_clock::now().time_since_epoch().count
#define rep(i, beg, n, s) for (int i = beg; i < n; i += s)
const double PI = acos(-1);

using namespace std;

inline int mod(int n, int m = M) {
  int ret = n % m;
  if (ret < 0) ret += m;
  return ret;
}

int exp(int n, int k) {
  if (k == 0) return 1;
  if (k == 1) return n;
  int ax = exp(n, k / 2);
  ax = mod(ax * ax);
  if (k % 2) ax = mod(ax * n);
  return ax;
}

int gcd(int a, int b) {
  if (a == 0)
    return b;
  else
    return gcd(b % a, a);
}
//#define MULTIPLE_TEST_CASE
void solution() {
  int n, m, k;
  cin >> n >> m >> k;
  int a[n + 1];
  int b[m + 1];
  a[0] = 0;
  rep(i, 1, n + 1, 1) {
    int x;
    cin >> x;
    a[i] = x + a[i - 1];
  }
  b[0] = 0;
  rep(i, 1, m + 1, 1) {
    int x;
    cin >> x;
    b[i] = x + b[i - 1];
  }
  int ans = 0;
  int ptr = 0;
  for (int i = n; i >= 0; i--) {
    // reading books from a
    if (a[i] > k) continue;
    while (ptr <= m && a[i] + b[ptr] <= k) {
      ptr++;
    }
    // cout << "at " << i << " " << a[i] << " can " << ptr << " " << b[ptr]
    //     << endl;
    ans = max(ans, i + ptr - 1);
  }
  cout << ans << endl;
}

int32_t main() {
  DESYNC;
  mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  int t = 1;
#ifdef MULTIPLE_TEST_CASE
  cin >> t;
#endif
  while (t--) solution();
}


Measured memory_bytes: 6780
def isPrime(n) : 
  
    # Corner cases 
    if (n <= 1) : 
        return False
    if (n <= 3) : 
        return True
  
    # This is checked so that we can skip  
    # middle five numbers in below loop 
    if (n % 2 == 0 or n % 3 == 0) : 
        return False
  
    i = 5
    while(i * i <= n) : 
        if (n % i == 0 or n % (i + 2) == 0) : 
            return False
        i = i + 6
  
    return True
x=int(input())
while True:
  if isPrime(x):
    print(x)
    break
  x+=1

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

int main() {
	int num[5];
	char c;
	while (cin >> num[0]) {
		for (int i = 1; i < 5; i++) {
			cin >> c >> num[i];
		}
		sort(num, num + 5);
		int pair[2] = {}, cont = 0;
		for (int i = 1, j = 0; i < 5; i++) {
			if (num[i] == num[i - 1]) pair[j]++;
			else if (pair[j]) j++;
			if (num[i] == num[i - 1] + 1) cont++;
		}
		if (cont == 4) cout << "straight" << endl;
		else if (cont == 3 && num[0] == 1 && num[1] == 10) cout << "straight" << endl;
		else {
			sort(pair, pair + 2);
			if (pair[1] == 3) {
				cout << "four card" << endl;
			}
			else if (pair[1] == 2) {
				if (pair[0] == 1) {
					cout << "full house" << endl;
				}
				else {
					cout << "three card" << endl;
				}
			}
			else if (pair[1] == 1) {
				if (pair[0] == 1) {
					cout << "two pair" << endl;
				}
				else {
					cout << "one pair" << endl;
				}
			}
			else {
				cout << "null" << endl;
			}
		}
	}
}


Measured memory_bytes: 3108
/**
 *  Hi, I'm Arpan.
 *
*/

#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;
#define inv(v)         \
    for (auto &it : v) \
        cin >> it;
#define MOD 1000000007
#define pb push_back
#define popb pop_back()
#define endl "\n"
#define fi first
#define se second
typedef priority_queue<ll, vector<ll>, greater<ll>> minheap;
typedef priority_queue<ll> maxheap;
#define sortv(v) sort(v.begin(),v.end())
#define rsortv(v) sort(v.begin(),v.end(), greater<>());

ll modPower(ll num,ll r) {
	if(r==0) return 1;
	if(r==1) return num%MOD;
	ll ans=modPower(num,r/2)%MOD;
	if(r%2==0) {
		return (ans*ans)%MOD;
	} return (((ans*ans)%MOD)*num)%MOD;
}

ll nCr(ll n, ll r) {
    ll res = 1;
    if (r > n - r) {
        r = n - r;
    }
    for(int i=0;i<r;i++) {
        res *= (n - i);
        res /= (i + 1);
    }
    return res;
}

/*******************************************/
//
void solve()
{
    int n;
    cin >> n;
    if(n%1000 == 0){
		cout << "0";
		return;
    }
	cout << (1000-(n%1000));
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t = 1;
    while (t--)
        solve();
    return 0;
}




Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--) 
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;

int main(){
    ll N;
    cin >> N;
    vector<int> d(N);
    rep(i,0,N){
        cin >> d[i];
    }
    sort(d.begin(),d.end());

    if(d[N/2]==d[N/2-1]){
        cout << 0 <<endl;
    }else{
        cout << d[N/2]-d[N/2-1] <<endl;
    }
    return 0;
}

Measured memory_bytes: 768
#include <iostream>
#include <cstring>
#include <fstream>
using namespace std;

const int maxN=1002;
const int MOD=1e9+7;

int n,m;
char mat[maxN][maxN];

int dp[maxN][maxN];

int main(){
    cin>>n>>m;
    for(int i=1;i<=n;i++){
        cin>>(mat[i]+1);
    }

    if(mat[1][1]=='.'){
        dp[1][1]=1;
    } else {
        dp[1][1]=0;
    }

    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            if(i==1 && j==1){
                continue;
            }
            
            if(mat[i][j]=='#'){
                dp[i][j]=0;
            } else {
                int sum=0;
                if(i>1 && mat[i-1][j]=='.'){
                    sum=(sum+dp[i-1][j])%MOD;
                }
                if(j>1 && mat[i][j-1]=='.'){
                    sum=(sum+dp[i][j-1])%MOD;
                }

                dp[i][j]=sum;
            }
        }
    }

    cout<<dp[n][m];

    return 0;
}

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

using ll = long long;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int k;
  cin >> k;
  
  queue<ll> q;
  for (int i = 1; i <= 9; i++) q.push(i);
  
  for (int i = 0; i < k - 1; i++) {
    ll x = q.front();
    q.pop();
    if (i + q.size() < k) {
      if (x % 10 != 0) q.push(10 * x + (x % 10 - 1));
      q.push(10 * x + (x % 10));
      if (x % 10 != 9) q.push(10 * x + (x % 10 + 1));
    }
  }
  
  cout << q.front() << '\n';
}

Measured memory_bytes: 768
#include <stdio.h>
#include <math.h>

int main(){
	int h[4][3][10];
	int tou, kai, heya,hito;
	int i, j,k,n;

	for (i = 0; i < 4; i++){
		for (j = 0; j < 3; j++){
			for (k = 0; k < 10; k++){
				h[i][j][k] = 0;
			}
		}
	}


	scanf("%d", &n);
	for (i = 0; i < n; i++){
		scanf("%d %d %d %d", &tou, &kai, &heya, &hito);
		h[tou-1][kai-1][heya-1] += hito;
	}

	for (i = 0; i < 4; i++){
		for (j = 0; j < 3; j++){
			for (k = 0; k < 10; k++){
				printf(" %d", h[i][j][k]);
			}
			printf("\n");
		}
		if (i == 3)break;
		printf("####################\n");
	}


	return 0;
}

Measured memory_bytes: 612
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

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

vs grid;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int h, w;
    cin >> h >> w;
    
    grid = vs(h);
    rep(i, h) cin >> grid[i];

    queue<P> q;
    vvi d(h, vi(w, -1));
    rep(i, h) rep(j, w) {
        if (grid[i][j] == '#') {
            q.push(P(i, j));
            d[i][j] = 0;
        }
    }
    while (!q.empty()) {
        int y = q.front().fi, x = q.front().se;
        q.pop();
        rep(i, 4) {
            int ny = y + dy[i], nx = x + dx[i];
            if (ny < 0 || h <= ny || nx < 0 || w <= nx) continue;
            if (d[ny][nx] != -1) continue;
            d[ny][nx] = d[y][x] + 1;
            q.push(P(ny, nx));
        }
    }
    int mx = 0;
    rep(i, h) rep(j, w) chmax(mx, d[i][j]);
    cout << mx << endl;
}

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

using namespace std;
typedef long long ll;

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

int main()
{
    string o, e;
    cin >> o >> e;

    rep(i, e.size())
    {
        cout << o[i] << e[i];
    }
    if (o.size() != e.size())
    {
        cout << o[o.size() - 1] << '\n';
    }
    return 0;
}


Measured memory_bytes: 3624
l = [int(i) for i in input().split()]

ln = []
c = 0

for i in range(l[0],l[1]+1):
  ln.append(i)
  
# --
def palin(a):
  if a == a[::-1]:
    return 1
  else:
    return 0
# --
  
for i in range(len(ln)):
  c += int(palin(str(ln[i])))
  
print(c)

Measured memory_bytes: 6680
#define _CRT_SECURE_NO_WARNINGS
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <stack>
#include <array>
#include <fstream>

#define REP(i,n) for(int (i) = 0;(i) < (n) ; ++(i))
#define REPA(a,i,n) for(int (i) = (a) ; (i) < (n) ; ++(i))
#if defined(_MSC_VER)||__cplusplus > 199711L
#define AUTO(r,v) auto r = (v)
#else
#define AUTO(r,v) typeof(v) r = (v)
#endif
#define ALL(c) (c).begin() , (c).end()
#define EACH(it,c) for(AUTO(it,(c).begin());it != (c).end();++it)
#define LL long long
#define int LL
#define INF  99999999
#define DEV 1000000007
#define QUICK_CIN ios::sync_with_stdio(false); cin.tie(0);
using namespace std;


int N, S;

signed main()
{
	QUICK_CIN;
	//ifstream cin("debug.txt");
	//ofstream cout("result.txt");

	while (cin >> N >> S){

		if (!N&&!S) break;

		vector<int> arr(N);
		int sum = 0;

		REP(i, N){
			cin >> arr[i];
		}


		sort(ALL(arr));

		while (arr.size() != 1){
			auto y = S - *(arr.end()-1);
			arr.pop_back();

			auto it = upper_bound(ALL(arr), y);
			int a = distance(it, arr.end());
			auto vv = arr.end();
			sum += distance(it,arr.end()) ;
		}

		cout << sum << endl;
	}

	return 0;
}

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

int main(void){
    int x, a, b;
    cin >> x >> a >> b;
    if (a >= b){
        cout << "delicious" << endl;
    } else if (b - a <= x){
        cout << "safe" << endl;
    } else{
        cout << "dangerous" << endl;
    }
    return 0;
}

Measured memory_bytes: 3636
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <bitset>

using namespace std;

typedef pair<int,int> ii;
typedef vector<int> vi;
#define REP(i, a, b) for(int i = int(a); i <= int(b); i++)
#define LOOP(i, v) for(int i = 0; i < v.size(); i++)
#define EPS 1e-9
#define INF 1e12
#define debug(x) cerr << "DEBUG : " << (#x) << " => " << (x) << endl

int main()
{
  int N;
  scanf("%d", &N);
  
  int prev = -1, a, ans = 0;
  
  REP(i, 1, N)
  {
    scanf("%d", &a);
    if(a == prev)
    {
      ans++;
      prev = -10;
    }
    else
    {
      prev = a;
    }
  }
  
  printf("%d\n", ans);
    
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
using i64 = int64_t;
using f80 = __float80;
static const int dy[4] = {0,1,0,-1}, dx[4] = {1,0,-1,0};
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
#define _overload3(_1,_2,_3,name,...) name
#define repi(i,start,end) for(i64 i=(start);i<(end);++i)
#define _rep(i,n) repi(i,0,n)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,start,end) for(i64 i=(start);i>end;--i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define v(T) vector<T>
#define vv(T) v(v(T))
typedef v(i64) vi;
typedef v(vi) vvi;
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;}
template<typename T> ostream &operator<<(ostream &os, const vector< T > &v){
  rep(i,v.size()) os << v[i] << (i + 1 != v.size() ? " " : "");
  return os;
}
template<typename T> istream &operator>>(istream &is, vector< T > &v){
  for(T &in : v) is >> in;
  return is;
}

void Main()
{
  i64 N,K;
  cin >> N >> K;
  vi H(N);
  cin >> H;
  sort(rng(H));

  vi gap(N+1-K);
  rep(i,N-K+1){
    gap[i] = H[i+K-1] - H[i];
  }
  cout << *min_element(rng(gap)) << "\n";
}

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

Measured memory_bytes: 1792
#include <iostream>
#include <string>
using namespace std;
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <set>
#include <map>
#define MOD1 1000000007
#define MOD2 998244353
#define LIMIT1 200010
#define LIMIT2 500010
#define LIMIT3 1000010
#define INF ((1<<30)-1)
#define LLINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef long double ld;
typedef const void cv;
typedef pair<ll,ll> P;
#define rep(i,n) for((i)=0;(i)<(n);(i)++)
#define per(i,n) for((i)=(n)-1;(i)>=0;(i)--)
template<class T,class C> T max(T a,C b){ return ((a)>(T)(b) ? (a) : (T)(b)); }
template<class T,class C> T min(T a,C b){ return ((a)<(T)(b) ? (a) : (T)(b)); }
#define zt(a,b) (max((a),(b))-min((a),(b)))
#define setpre(n) fixed << setprecision(n)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[8]={1,0,-1,0,1,-1,-1,1},dy[8]={0,1,0,-1,1,1,-1,-1};
int upint(cv *a, cv *b) { return *(int *)a < *(int *)b ? -1 : *(int *)a > *(int *)b ? 1 : 0; }
int downint(cv *a, cv *b) { return *(int *)a < *(int *)b ? 1 : *(int *)a > *(int *)b ? -1 : 0; }
int upchar(cv *left, cv *right) {return strcmp((char *)left,(char *)right);}
int downchar(cv *left, cv *right) {return strcmp((char *)right,(char *)left);}
ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1){
      res *= a; if(mod>=1) res %= mod;
    }
    a *= a; if(mod>=1) a %= mod;
    n >>= 1;
  }
  return res;
}
void initialize(){
  
}
int main(void){
  initialize();
  ll n,m,i,j,k,result=0;
  int x[LIMIT2]={0},y[LIMIT2]={0},a[LIMIT1]={0},b[LIMIT1]={0};
  string s;
  
  cin >> n;
  rep(i,n){
    cin >> x[i] >> y[i];
    a[i] = x[i] + y[i];
    b[i] = x[i] - y[i];
  }
  qsort(a,n,sizeof(int),upint);
  qsort(b,n,sizeof(int),upint);

  result = max(a[n-1]-a[0],b[n-1]-b[0]);

  cout << result << endl;
  return 0;
}

Measured memory_bytes: 9840
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <cmath>
#include <utility> // pair make_pair
#include <algorithm>
#include <iomanip>

#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define ll long long
#define int ll

using namespace std;
using Graph = vector<vector<int> >;

int cnt[300000];
int ADDVALUE[300000];


int rec(Graph& G, int node, int value) {
  cnt[node] += value;

  if (G[node].empty()) {
    return 0;
  }

  for (auto next_node : G[node]) {
    rec(G, next_node, value + ADDVALUE[next_node]);
  }

  return 0;
}


signed main() {

  
  int N, Q; cin >> N >> Q;
  
  Graph G(N+1);
  for (int i = 1; i <= N -1 ; i++) {
    int a, b;
    scanf("%lld", &a);
    scanf("%lld", &b);
    // cin >> a >> b;
    G[a].push_back(b);
  }

  memset(ADDVALUE, 0, sizeof(ADDVALUE));
  
  for (int i = 0; i < Q; i++) {
    int node, value; cin >> node >> value;
    ADDVALUE[node] += value;
  }

  rec(G, 1, ADDVALUE[1]);

  for (int i = 1; i < N+1; i++) {
    printf("%lld ", cnt[i]);
  }
  cout << endl;
}


Measured memory_bytes: 26752
num=int(input())
list1=[]
flag=0
j=0

for i in range(num):

    a=input()



    if a in list1:
        flag+=1
    list1.append(a)
    if j>0:
        if list1[i-1][len(list1[i-1])-1]==list1[i][0]:
           pass

        else:
          flag+=2

    j=1

if flag>0:
    print("No")
else:
    print("Yes")
















Measured memory_bytes: 3060
#include<stdio.h>

int H[251];

int main(){

  int n,i;

  /*for(i=0; i<250; i++)
    H[i] = NULL;*/

  scanf("%d",&n);

  for(i=0; i<n; i++)
    scanf("%d",&H[i]);

  for(i=0; i<n; i++){

    printf("node %d: key = %d, ",i+1,H[i]);

    if((i+1)/2 >= 1)
      printf("parent key = %d, ",H[(i+1)/2-1]);
    
    
    if((i+1)*2-1 < n)
      printf("left key = %d, ",H[(i+1)*2-1]); 
    

    if((i+1)*2 < n)
      printf("right key = %d, ",H[(i+1)*2]);
    

    printf("\n");

  }

  return 0;
}

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

int main(){
	/*input*/
	int h, w;	cin >> h >> w;
	vector<vector<char> >a(h, vector<char>(w));
	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			cin >> a[i][j];
		}
	}
	/*calcualtion*/
	//row
	vector<bool>whiterow(h, false);
	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			switch(a.at(i).at(j)){
				case '.':
				whiterow[i] = true;
				break;
				case '#':
				whiterow[i] = false;
				break;
				default:
				break;
			}
			if(!whiterow[i])break;
		}
		if(whiterow[i]){
			whiterow[i] = true;
		}
	}
	//column
	vector<bool>whitecolumn(w, false);
	for(int i = 0; i < w; i++){
		for(int j = 0; j < h; j++){
			switch(a.at(j).at(i)){
				case '.':
				whitecolumn[i] = true;
				break;
				case '#':
				whitecolumn[i] = false;
				break;
				default:
				break;
			}
			if(!whitecolumn[i])break;
		}
		if(whitecolumn[i]){
			whitecolumn[i] = true;
		}
	}
	
	/*output*/
	for(int i = 0; i < a.size(); i++){
		if(whiterow[i])continue;
		for(int j = 0; j < a.at(i).size(); j++){
			if(whitecolumn[j])continue;
			cout << a[i][j]; 
		}
		cout << endl; 
	}
}


Measured memory_bytes: 256
A,B,m = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
li2=[input() for i in range(m)]
c = []
for i in range(m):
    c.append( [int(x.strip()) for x in li2[i].split()])

ans = min(a) + min (b)

for i in range(m):
    keep = a[c[i][0]-1] + b[c[i][1]-1] - c[i][2]
    if keep < ans:
        ans = keep

print(ans)

Measured memory_bytes: 95084
//The Doc

#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
typedef long long int ll;
typedef unsigned long long int ull;
#define fi first
#define se second
#define pb push_back
ll mod1=pow(10,9)+7;
int mod2=998244353;
ll inf=1e9;
ll maxxy=1e6+9;
typedef long double ld;
const double PI =  3.141592653589793238;

ll power(ll x, ll y, ll pp)
{
    ll res = 1;
    x = x % pp;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % pp;
        y = y>>1;
        x = (x*x) % pp;
    }
    return res;
}

ll modInverse(ll n, ll pp)
{
    return power(n, pp-2, pp);
}
ll gcd(ll a, ll b)
{
    if (a == 0)
        return b;
    return gcd(b % a, a);
}
vector<vector<int>> adj(maxxy);
vector<bool> visited(maxxy);
ll kkk=0;
int dfs(int s) {
    visited[s] = true;
    kkk++;
    for(int i = 0;i < adj[s].size();++i)    {
        if(visited[adj[s][i]] == false)
            dfs(adj[s][i]);
    }
    return kkk;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,m;
    cin>>n>>m;
    adj.resize(n+1);
    visited.resize(n+1,false);
    ll x,y;
    set<pair<ll,ll>> sett;
    for (int i = 0; i <m ; ++i) {
        cin>>x>>y;
        if(x>y){
            sett.insert({y,x});
        }
        else{
            sett.insert({x,y});
        }
    }
    set<pair<ll,ll>> :: iterator itr;
    for (itr = sett.begin(); itr != sett.end(); ++itr)
    {
        pair<ll,ll> ky;
        ky=*itr;
        x=ky.fi;
        y=ky.se;
        adj[x].pb(y);
        adj[y].pb(x);
    }
    vector<ll> connect;
    for (int i = 1; i <=n  ; ++i) {
        if(visited[i]==false) {
            dfs(i);
            connect.pb(kkk);
            kkk=0;
        }
    }
    connect.pb(kkk);
    sort(connect.begin(),connect.end());
    cout<<connect[connect.size()-1]<<"\n";
    return 0;
}


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

using namespace std;

int main()
{
    char S[7];

    scanf("%s", S);
    if(S[2] == S[3] && S[4] == S[5])
        printf("Yes");
    else
        printf("No");

    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int MOD,p,a;
vector<int> fact,fact_inv,inv,a1,ans;
void init_nCk(int n){
  fact.resize(n+5);
  fact_inv.resize(n+5);
  inv.resize(n+5);
  fact[0]=fact[1]=1;
  fact_inv[0]=fact_inv[1]=1;
  inv[1]=1;
  for (int i=2;i<n+5;i++){
    fact[i]=fact[i-1]*i%MOD;
    inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
    fact_inv[i]=fact_inv[i-1]*inv[i]%MOD;
  }
}
int nCk(int n,int k){
  assert(!(n<k));
  assert(!(n<0||k<0));
  return fact[n]*(fact_inv[k]*fact_inv[n-k]%MOD)%MOD;
}
int main(){
  cin>>p;
  MOD=p;
  a1.resize(0);
  ans.resize(p);
  init_nCk(p-1);
  for(int i=0;i<p;i++){
    cin>>a;
    if(a==1){a1.push_back(i);}
  }
  ans.at(0)=a1.size();
  for(int i=0;i<(int)a1.size();i++){
    a=1;
    for(int j=p-1;j>=0;j--){
      ans.at(j)-=nCk(p-1,j)*a-MOD*MOD;
      ans.at(j)%=MOD;
      a*=-1*a1.at(i);
      a%=MOD;
    }
  }
  for(int i=0;i<p;i++){
    cout<<ans.at(i);
    if(i<p-1){cout<<" ";}
  }
}

Measured memory_bytes: 384
#include<stdio.h>

#include<string.h>
#include<stdlib.h>
#include<math.h>
#define MOD 1000000007
long long plzh(long long a)

{
	long long i,t=1;
	for(i=1;i<=a;i++)
	{
		t=i*t%MOD;
	}
	return t;
}

int main()

{

	long long x,m,n;

	while(scanf("%lld %lld",&m,&n)!=EOF)

	{
		if(n==m)
		{
			m=plzh(m);
			n=plzh(n);
			x=(m*n*2)%MOD;
		}
		else if( abs(m-n)==1)
		{
			m=plzh(m);
			n=plzh(n);
			x=m*n%MOD;
		}
		else
		{
			x=0;
		} 
		printf("%lld\n",x);
	}

}


Measured memory_bytes: 128
N = int(input())
D = list(map(int, input().split()))
mod = 998244353
counter = [0] * N
for d in D:
    counter[d] += 1

if counter[0] != 1:
    print(0)
    exit()

ans = 1
for d in D[1:]:
    ans = ans * counter[d-1] % mod
print(ans)

Measured memory_bytes: 14020