akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

using boost::multiprecision::cpp_int;
using cpp_dec_float_1000 = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000, boost::int128_type>>;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

constexpr char CRLF  = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;
constexpr int MOD = 1000'000'007;

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<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }
template<class T> T modinv(T a, T m) { T b = m, u = 1, v = 0; while (b) { T t = a / b; a -= t * b; boost::swap(a, b); u -= t * v; boost::swap(u, v); } u %= m; if (u < 0) u += m; return u; }
template<class T> inline bool isSosuu(const T& n) { if (n == T(1)) { return false; } for (T i = 2; i*i <= n; ++i) { if (n % i == 0) { return false; } } return true; }
template<class T> vector<vector<T>> split (const vector<T>& S, T delim) { vector<vector<T>> ret{}; vector<T> buff{}; for (auto c : S) { if (c == delim) { if (!buff.empty()) ret.push_back(buff); buff.clear(); } else { buff.push_back(c); } } if (!buff.empty()) ret.push_back(buff); return ret; }
template<class T> inline void printYesNo(const T& t) { cout << (t ? "Yes" : "No") << CRLF; }
template<class T = int64_t> T modpow(T N, T P, T M) { T ret{1}; N %= M; while (P) { if (P & 0x01) { ret *= N; ret %= M; } P >>= 1; N *= N; N %= M; } return ret; }

/** code for assert debug begin */
int gErr = 0;
#define ASSERT(p) if(!(p)){ gErr = 1; }else{ ; }
/** code for assert debug end */

struct Tmp
{
public:
  int N;
  Tmp(int N)
  : N(N)
  {}
};

void solve(void)
{
  int N, M; cin >> N >> M;
  vector<int> H(N);
  for (auto& h : H) { cin >> h; }
  vector<int> aitenoH(N, -1);

  for (int i = 0; i < M; ++i) {
    int a, b; cin >> a >> b;
    --a; --b;
    chmax(aitenoH[a], H[b]);
    chmax(aitenoH[b], H[a]);
  }

  ll res{};
  for (int i = 0; i < N; ++i) {
    if (H[i] > aitenoH[i]) {
      ++res;
    }
  }
  cout << res << CRLF;
  return;
}

int main(void)
{
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);

  solve();

  return 0;
}


Measured memory_bytes: 3992
def partition(A, l, r):
    v = A[r-1]
    i = l - 1
    for j in range(l, r-1):
        if A[j] <= v:
            i += 1
            t = A[i]
            A[i] = A[j]
            A[j] = t
    q = i+1
    A[r-1] = A[q]
    A[q] = v
    return q

N = int(input())
A = list(map(int, input().split()))
q = partition(A, 0, N)
print(*['['+str(A[i])+']' if i == q else A[i] for i in range(N)])


Measured memory_bytes: 16392
#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
import heapq
#from fractions  import gcd
#input=sys.stdin.readline
import bisect
n=int(input())
d=[]
a=(int(input()))*-1
d.append(a)
ans=1
for i in range(n-1):
    a=-1*(int(input()))
    ind=bisect.bisect_right(d,a)
    l=len(d)
    if ind==l:
        d.append(a)
        ans+=1
    else:
        d[ind]=a
print(ans)

Measured memory_bytes: 13100
import Control.Applicative
import Data.List (intercalate)

main = do
        recTime <- map read.words<$>getLine
        if all (==(-1)) recTime then return ()
                                else do
                                    putStrLn $ remTime 1 recTime
                                    putStrLn $ remTime 3 recTime
                                    main

remTime :: Int -> [Int] -> String
remTime n [t,h,s] = intercalate ":".map showTime.secToTHS.(n*).(2*3600 -)$thsToSec t h s
secToTHS sec = [t,h,s]
    where (t,m) = divMod sec 3600
          (h,s) = divMod m   60

thsToSec t h s = 3600 * t + 60 * h + s

showTime :: Int -> String
showTime t = case length $ show t of
                 2 -> show t
                 1 -> '0' : show t

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

int main() {
	int a,b,i,j,ans=0;
	cin >> a;
	int aa[a],bb[2];
	
	for(i=0;i<a;i++) cin >> aa[i];
	
	cin >> b;
	for(i=0;i<b;i++){
		cin >> bb[0] >> bb[1];
		for(j=0;j<a;j++){
			if(j+1==bb[0]){
				ans+=bb[1];
			}else{
				ans+=aa[j];
			}
		}
		cout << ans << endl;
		ans=0;
	}
}

Measured memory_bytes: 256
#include <cstdio>

int main() {
  int n;
  scanf("%d", &n);

  int bal=0;
  for (int i=0; i<n; ++i) {
    char p;
    int x;
    scanf(" %c %d", &p, &x);
    if (p == '(') {
      bal += x;
    } else if (p == ')') {
      bal -= x;
      if (bal < 0) return !printf("NO\n");
    }
  }
  printf("%s\n", bal>0? "NO":"YES");
}



Measured memory_bytes: 2748
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;

int main() {
 int n;
 cin >> n;
 
 vector<int> a(n);
 rep(i,n) {
  cin >> a.at(i);
 }
    vector<int> b(n);
    rep(i,n) {
     b.at(i) = a.at(i);
    }
    
    int semimax = 0;
    sort(b.begin(),b.end(),greater<int>());
    int maxa = b.at(0);
        if(b.at(0) != b.at(1)) {
         semimax = b.at(1);
        }
        
    if(b.at(0) == b.at(1)) {
     rep(i,n) {
      cout << maxa << endl;;
     }
    }
    else {
        rep(i,n) {
         if(a.at(i) == maxa) {
         cout << semimax << endl;
         }
            else {
             cout << maxa << endl;
            }
        }
        
     }
    
    
}

Measured memory_bytes: 4824
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <stdio.h>
#include <vector>
#include <map>

using namespace std;
typedef long long ll;

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

int main() {

    ll W,H,N;
    cin >> W >> H >> N;
    ll w = 0;
    ll h = 0;
    rep(i,N){
        ll x,y,a;
        cin >> x >> y >> a;
        if(a==1&&w<x) w = x;
        else if(a==2&&W>x) W = x;
        else if(a==3&&h<y) h = y;
        else if(a==4&&H>y)H = y;
    }
    ll out = 0;
    if(H>h&&W>w) out = (H-h)*(W-w);
    cout << out << endl;
    return 0;
}


Measured memory_bytes: 256
odd= ('R', 'U', 'D')
even = ('L','U','D')

S=input()
S_num=len(S)

flg = 0
for i in range(S_num):
  if (i%2 == 0 and S[i] == 'L') or ( i%2 == 1 and S[i] == 'R'):
    flg=1
    break
if flg==1:
  print('No')
else:
  print('Yes')

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

int main()
{
    cin.tie(0);
   	ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    if(N == M){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define int long long
#define fi first
#define se second
#define Pair pair<int, int >
#define inf (int)1e18+7
#define mod 1000000007
//############################//

const int nmax = (int)1e2+2;
const int vmax = (int)1e5+2;

int v[nmax], w[nmax];
int n, weight;

int dp[nmax][vmax];




signed main() {
    

    cin >> n >> weight;
    for (int i = 1; i <= n; i ++) {
        cin >> w[i] >> v[i];
    }

    memset(dp, -1, sizeof dp);
    for (int i = 0; i < nmax; i ++) {
        dp[i][0] = 0;
    }

    for(int i = 1; i <= n; i ++) {
        for (int j = 1; j < vmax; j ++) {
            if (j - v[i] >= 0) {
                if (dp[i - 1][j - v[i]] != -1) {
                   if (dp[i - 1][j - v[i]] + w[i] > weight) {
                       dp[i][j] = dp[i - 1][j];  
                   } else {
                       dp[i][j] = dp[i - 1][j - v[i]] + w[i];
                       if (dp[i - 1][j] != -1) {
                          dp[i][j] = min(dp[i][j], dp[i - 1][j]);
                       }
                   } 
                } else {
                    dp[i][j] = dp[i - 1][j];    
                }
            } else {
                dp[i][j] = dp[i - 1][j];
            }
        }

    }
    
    for (int ans = vmax - 1; ans >= 0; ans --) {
        if (dp[n][ans] != -1) {
            cout << ans << endl;
            break;
        }
    }             

    return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int N,W;
    cin>>N>>W;
    long long int dp[N+1][W+1];
    for (int i=0;i<=W;i++) dp[0][i]=0;
    long long int w,v;
    for (int i=1;i<=N;i++){
        cin>>w>>v;
        dp[i][0]=0;
        for (int j=1;j<=W;j++){
            if(j<w)
                dp[i][j]=dp[i-1][j];
            else
                dp[i][j]=max(dp[i-1][j],dp[i-1][j-w]+v);
        }
    }
    cout<<dp[N][W]<<"\n";
	return 0;
}

Measured memory_bytes: 79104
n = int(input())
s = list(map(int,input().split()))

ans = 0
tmp = 0
for i in range(n):
    ans += abs(s[i] - tmp)
    tmp = s[i]
ans += abs(tmp)

s.insert(0,0)
s.insert(n+1,0)
for i in range(1,n+1):#とばす番号
    tmp_ans = ans
    a = s[i-1]
    tmp = s[i]
    b = s[i+1]
    if (b >= tmp and tmp >= a) or (b <= tmp and tmp <= a):
        pass
    else:
        if (a >= b and tmp > a) or (a <= b and tmp < a):
            tmp_ans -= abs(2*(tmp-a))
        else:
            tmp_ans -= abs(2*(tmp-b))
    print(tmp_ans)

Measured memory_bytes: 14176
from operator import itemgetter
n = int(input())
a = list()

for i in range(0,n):
    a.append(list(input().split()))
    a[i][1] = int(a[i][1])
    a[i].append(i+1)

a.sort(key = itemgetter(1),reverse = True)
a.sort(key = itemgetter(0))

for i in range(0,n):
    print(a[i][2])

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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,n) for(int i=(int)(n-1);i>=0;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define print(x) cout << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<int, P> PIP;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;
typedef set<int> S;

#define INF INT_MAX/3
#define MAX_N 1000000001
#define MOD ((ll)1e9 + 7)

int main(){
  cin.sync_with_stdio(false);
  int n;
  cin >> n;

  ll ans = 1;
  repl(i, 1, n + 1) ans = ans * i % MOD;
  print(ans);

  return 0;
}


Measured memory_bytes: 256
/*
	Roll no : 18EC10057
	PC No.:   70
*/


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define size 100000
#define ll long long int
ll arr1[size+1][101];


struct node
{
	int val;
	node *right;
	node *left;
	node *parent;
};
struct item
{
	int weight;
	int val;
};
item arr[size];
bool compare(item a, item b) 
{ 

    if (a.weight != b.weight ) 
        return a.weight < b.weight; 
  	else
  		return a.val>b.val;
} 
node* readtree()
{
	int x,lcnt,rcnt;
	cin>>x>>lcnt>>rcnt;
	node *root=new node;
	root->val=x;
	root->right=NULL;
	root->left=NULL;
	if(lcnt!=0)
		root->left=readtree();
	if(rcnt!=0)
		root->right=readtree();
	return root;
}
void prn_preorder(node *x)
{
	if(x==NULL)
		return;
	cout<<x->val;
	cout<<"  ";
	prn_preorder(x->left);
	prn_preorder(x->right);
}
void prn_inorder(node *x)
{
	if(x==NULL)
		return;
	prn_inorder(x->left);
	cout<<x->val;
	cout<<"  ";
	prn_inorder(x->right);
	if(x->left!=NULL)
		x->left->parent=x;
	if(x->right!=NULL)
		x->right->parent=x;
}
void swapchild(node *x)
{
 	node *temp;
	temp=x->right;
	x->right=x->left;
	x->left=temp;
}
node* rrotate(node *x)
{
	//

	//node *u=x-left->left;
	node *temp=x->parent;
	node *q=x->left;
	node *v=x->left->right;
	q->right=x;
	x->left=v;
	if(v!=NULL)
		v->parent=x;
	q->parent=temp;
	x->parent=q;
	return q;
}
node* lrotate(node *x)
{
	//

	//node *u=x-left->left;
	node *temp=x->parent;
	node *p=x->right;;
	node *v=x->right->left;
	p->left=x;
	x->right=v;
	if(v!=NULL)
		v->parent=x;
	p->parent=temp;
	x->parent=p;
	return p;
}


int main()
{
	int n,w;
	cin>>n>>w;
	for(int i=0;i<n;i++)
	{
		cin>>arr[i].weight>>arr[i].val;
	}
	//sort(arr,arr+n,compare);
	for(int i=0;i<=w;i++)
	{
		for(int j=0;j<=n;j++)
		{
			if(i==0 || j==0)
				arr1[i][j]=0;
			else
			{
				if(arr[j-1].weight>i)
					arr1[i][j]=arr1[i][j-1];
				else
				{
					arr1[i][j]=max(arr1[i][j-1],arr1[i-arr[j-1].weight][j-1]+arr[j-1].val);
				}
			}
		}
	}
	// for(int i=0;i<=w;i++)
	// {
	// 	for(int j=0;j<=n;j++)
	// 	{
	// 		cout<<arr1[i][j]<<" ";
	// 	}
	// 	cout<<endl;
	// }

	cout<<arr1[w][n]<<endl;
}


Measured memory_bytes: 79104
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <utility>
#include <vector>


int main(void){
    std::cin.tie(nullptr); std::cin.sync_with_stdio(false); 

    int n, k; std::cin >> n >> k;
    std::vector<int> A(n); for(int i = 0; i < n; ++i) std::cin >> A[i];
    std::vector<long long int> S(n + 1);
    S[0] = 0; for(int i = 0; i < n; ++i) S[i + 1] = S[i] + A[i] - k;
  
    std::vector<long long int> Comp = S;
    std::sort(Comp.begin(), Comp.end()); 
    Comp.erase(std::unique(Comp.begin(), Comp.end()), Comp.end());
    for(int i = 0; i <= n; ++i) S[i] = std::lower_bound(Comp.cbegin(), Comp.cend(), S[i]) - Comp.cbegin();
    const int m = Comp.size();
  
    long long int res = 0;
    std::vector<int> data(m + 1, 0);
    for(int i = 0; i <= n; ++i){
        long long int p = res;
        int idx = S[i] + 1;
        while(idx){ res += data[idx]; idx -= idx & -idx; }
        idx = S[i] + 1;
        while(idx <= m){ ++data[idx]; idx += idx & -idx; }
    }
  
    std::cout << res << '\n';

    return 0;
}

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

signed main(void){
    int n; cin >> n;
    vector<int>l(n);
    for(int i=0;i<n;i++) cin >> l[i];
    sort(l.begin(),l.end());
    int ans = 0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            int a=l[i],b=l[j];
            auto front = l.begin();
            front += j + 1;
            auto end = lower_bound(l.begin(),l.end(),b+a);
            // cout << end - l.begin() - 1 << ' ' << front - l.begin() << endl;
            // cout << distance(front,end) << endl;
            ans += distance(front,end);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

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

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int a, b; char op;
	cin >> a >> op >> b;
	if (op == '+'){
		cout << a + b << endl;
	}else{
		cout << a - b << endl;
	} // end if
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
using pq = priority_queue<int>;
template<class T>
using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
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; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int under = (1 << 31);
int upper = under - 1;
ll UNDER = (1LL << 63);
ll UPPER = UNDER - 1;
const int MOD = 1e9 + 7;
const long double pi = 3.141592653589793;
int main() {
	int n;
	cin >> n;
	V a(n + 1);
	rep1(i, n) {
		cin >> a[i];
	}
	VL sum(n + 1, 0);
	sum[0] = 0;
	rep1(i, n) {
		sum[i] = sum[i - 1] + a[i];
	}
	VL Xor(n + 1, 0);
	Xor[0] = 0;
	rep1(i, n) {
		Xor[i] = Xor[i - 1] ^ a[i];
	}
	ll ans = 0;
	rep1(i, n) {
		int ok = i;
		int ng = n + 1;
		while (ng - ok > 1) {
			int mid = (ok + ng) / 2;
			int S = sum[mid] - sum[i - 1];
			int X = Xor[mid] ^ Xor[i - 1];
			if (S == X) ok = mid;
			else ng = mid;
		}
		ans += ok - i + 1;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4096
n,m=map(int,input().split())
a=[list(input()) for _ in range(n)]
b=[list(input()) for _ in range(m)]
for i in range(0,n-m+1):
    for j in range(0,n-m+1):
        p=[a[x][i:i+m] for x in range(j,j+m)]
        ok=0
        for h in range(m):
            x,y=p[h],b[h]
            for k in range(m):
                if x[k]!=y[k]:
                    ok+=1
        if ok==0:
            print('Yes')
            exit()
print('No')

Measured memory_bytes: 9208
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        int b = in.nextInt();
        int c = in.nextInt();
        if((b - a) == (c - b)){
            System.out.println("YES");
        }else {
            System.out.println("NO");
        }
    }
}


Measured memory_bytes: 21844
#include<iostream>
using namespace std;
long long a, b, c, ab, bc, ac;
long long mins;
int main()
{
	cin >> a >> b >> c;
	ab = a * b;
	mins = ab;
	bc = b * c;
	if (bc < mins)
		mins = bc;
	ac = a * c;
	if (ac < mins)
		mins = ac;
	if (mins == ab)
	{
		long long temp;
		temp = (c - c / 2) - c / 2;
		temp = temp * ab;
		cout << temp;
		return 0;
	}
	if (mins == bc)
	{
		long long temp;
		temp = (a - a / 2) - a / 2;
		temp = temp * bc;
		cout << temp;
		return 0;
	}
	if (mins == ac)
	{
		long long temp;
		temp = (b - b / 2) - b / 2;
		temp = temp * ac;
		cout << temp;
		return 0;
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<cmath>
#define LL long long 
using namespace std;
char s[10];
int main()
{
	scanf("%s", s + 1);
	int tot = 0;
	int ans = 0;
	for(int i = 1; i <= 3; i++)
	{
		if(s[i] == 'R')
		{
			tot++;
			ans = max(ans, tot);
		}
		if(s[i] == 'S')
		{
			tot = 0;
		}
	}
	printf("%d",ans);
	return 0;
 } 

Measured memory_bytes: 3824
h, w = map(int, input().split())

s = [list(input()) for _ in range(h)]
ans = [[0] * w for _  in range(h)]
for i in range(h):
    for j in range(w):
        ans[i][j] += s[i][max(j - 1, 0):min(j + 2, w)].count("#")
        if i != 0:
            ans[i][j] += s[i - 1][max(j - 1, 0):min(j + 2, w)].count("#")
        if i != h - 1:
            ans[i][j] += s[i + 1][max(j - 1, 0):min(j + 2, w)].count("#")

        
            

for i in range(h):
    for j in range(w):
        if s[i][j] == "#":
            print(s[i][j], end ="")
        else:
            print(ans[i][j], end = "")
    print()

Measured memory_bytes: 3572
#include <bits/stdc++.h> 
using namespace std; 
  
typedef long long int ll; 
typedef pair<int, int> pii; 
typedef pair<ll, ll> pll; 
typedef pair<string, string> pss; 
typedef vector<int> vi; 
typedef vector<vi> vvi; 
typedef vector<pii> vii; 
typedef vector<ll> vl; 
typedef vector<vl> vvl; 
  
double EPS = 1e-9; 
long long INF = 1000000000000000005ll; 
double PI = acos(-1); 
#define M 1000000007ll
#define D 998244353ll
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define oset tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define bs binary_search
#define lb lower_bound
#define ub upper_bound  
#define SQR(x) ((LL)(x) * (x)) 
#define RESET(a, b) memset(a, b, sizeof(a))
#define GCD(a,b) __gcd(a,b)
#define setbits(x)   __builtin_popcountll(x)
#define zerobits(x)  __builtin_ctzll(x) 
#define ps(x,y)  fixed<<setprecision(y)<<x
#define endl '\n'
#define ff first 
#define ss second 
#define mp make_pair  
#define ALL(v) v.begin(), v.end() 
#define ALLA(arr, sz) arr, arr + sz 
#define SIZE(v) (int)v.size() 
#define SORT(v) sort(ALL(v)) 
#define REVERSE(v) reverse(ALL(v)) 
#define SORTA(arr, sz) sort(ALLA(arr, sz)) 
#define REVERSEA(arr, sz) reverse(ALLA(arr, sz)) 
#define PERMUTE next_permutation 
  
inline string IntToString(ll a) 
{ 
    char x[100]; 
    sprintf(x, "%lld", a); 
    string s = x; 
    return s; 
} 
  
inline ll StringToInt(string a) 
{ 
    char x[100]; 
    ll res; 
    strcpy(x, a.c_str()); 
    sscanf(x, "%lld", &res); 
    return res; 
} 
  

inline string uppercase(string s) 
{ 
    int n = SIZE(s); 
    for(ll i=0;i<n;i++) 
    if (s[i] >= 'a' && s[i] <= 'z') 
        s[i] = s[i] - 'a' + 'A'; 
    return s; 
} 
  
inline string lowercase(string s) 
{ 
    int n = SIZE(s); 
    for(ll i=0;i<n;i++) 
    if (s[i] >= 'A' && s[i] <= 'Z') 
        s[i] = s[i] - 'A' + 'a'; 
    return s; 
}

bool sortcol( const vector<ll>& v1, 
               const vector<ll>& v2 ) { 
 return v1[0] > v2[0]; 
} 

bool isPrime(ll 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 || n%3 == 0) return false; 
  
    for (ll i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
}

int main() {
    FAST
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ll a[5];
    for(ll i=0;i<5;i++){
    	cin>>a[i];
    	if(a[i]==0){
    		cout<<i+1<<endl;
    		break;
    	}
    }
    return 0;
}

Measured memory_bytes: 3656
using System;
using System.Collections.Generic;
using System.Linq;


public class Contest
{
	public static void Main()
	{

/*
		int n = a[0];
		int[][] e = new int[n][];
		for(int i=0; i<n; i++) e[i] = Array.ConvertAll(Console.ReadLine().Split(' '), new Converter<string,int>(zzz => int.Parse(zzz)));

		int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), new Converter<string,int>(zzz => int.Parse(zzz)));
*/

 //       long a,b,c,d,e,f;
 //       MyRead.Multi(out a, out b, out c, out d, out e, out f);
        int n;
        MyRead.Multi(out n);

		int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), new Converter<string,int>(zzz => int.Parse(zzz)));
		int[] b = Array.ConvertAll(Console.ReadLine().Split(' '), new Converter<string,int>(zzz => int.Parse(zzz)));


		long cnt = 0;
		for(int i=0; i<n; i++) {
			if(a[i]<b[i]) {
				cnt += a[i];
				int t = a[i+1];
				a[i+1] -= b[i]-a[i];
				if(a[i+1]<0) a[i+1]=0;
				cnt += t-a[i+1];
			}else{
				cnt += b[i];
			}
		}

		string s = cnt.ToString();


		Console.WriteLine(s);
	}
	
	private static int calc_main(int[] a,int[] b,int[] c,int[] d) {



		return 0;
	}




}

public static class MyRead
{
	private static bool eq<T, U>() => typeof(T).Equals(typeof(U));
	private static T ct<T, U>(U a) => (T)Convert.ChangeType(a, typeof(T));
	private static T cv<T>(string s) => eq<T, int>()    ? ct<T, int>(int.Parse(s))
	                                  : eq<T, long>()   ? ct<T, long>(long.Parse(s))
	                                  : eq<T, double>() ? ct<T, double>(double.Parse(s))
	                                  : eq<T, char>()   ? ct<T, char>(s[0])
	                                                    : ct<T, string>(s);
	public static string[] Multi<T>(out T a) {
		var ar = Console.ReadLine().Split(new char[] {' '}, StringSplitOptions.RemoveEmptyEntries); 
		a = cv<T>(ar[0]);
		return ar;
	}
	public static string[] Multi<T, U>(out T a, out U b) {
		var ar = Multi<T>(out a); 
        b = cv<U>(ar[1]);
		return ar;
	}
	public static string[] Multi<T, U, V>(out T a, out U b, out V c) {
		var ar = Multi<T, U>(out a, out b); 
        c = cv<V>(ar[2]);
		return ar;
	}
	public static string[] Multi<T, U, V, W>(out T a, out U b, out V c, out W d) {
		var ar = Multi<T, U, V>(out a, out b, out c); 
        d = cv<W>(ar[3]);
		return ar;
	}
	public static string[] Multi<T, U, V, W, X>(out T a, out U b, out V c, out W d, out X e) {
		var ar = Multi<T, U, V, W>(out a, out b, out c, out d); 
        e = cv<X>(ar[4]);
		return ar;
	}
	public static string[] Multi<T, U, V, W, X, Y>(out T a, out U b, out V c, out W d, out X e, out Y f) {
		var ar = Multi<T, U, V, W, X>(out a, out b, out c, out d, out e); 
        f = cv<Y>(ar[5]);
		return ar;
	}
}




Measured memory_bytes: 35404
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define F first
#define S second
ll mod1=1000000007ll;
ll mod2=998244353ll;
ll gcd(ll a, ll b)
{  //cout<<a<<b<<endl;
    if(b==0)
    {
        return a;
    }
    else
        return gcd(b,a%b);
}

void solve()
{
   ll n,m=1,c=1;
  // cin>>n>>m;
  string s;
  cin>>s;
  n=s.size();
  for(ll i=1;i<n;i++)
  {
    if(m==2)
    {
        m=1;
        c++;
    }
    else if( s[i]==s[i-1])
    {
        if(i==n-1)
            break;
        m=2;
        i++;
        c++;
    }
    else
        c++;
      //  cout<<c<<m<<endl;;
  }
  cout<<c;

}

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

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


Measured memory_bytes: 720
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;


int main(){
    int N,K;
    ll inf = 1e9+7;
    cin >> N >> K;
    vector<vector<vector<ll>>> dp(N+1,vector<vector<ll>>(N+1,vector<ll>(N*N+1,0)));
    dp[0][0][0] = 1;
    for(ll i=1;i<=N;i++){
        for(ll j=0;j<i;j++){
            for(ll k=0;k<=N*N;k++){
                //iとiをマッチング
                if(k>=2*j) (dp[i][j][k] += dp[i-1][j][k-2*j])%=inf;
                //残してるものとi
                if(j>=1 && k>=2*(j-1)) (dp[i][j-1][k] += j*j*dp[i-1][j][k-2*(j-1)]%inf)%=inf;
                //片方はiとマッチング、もう片方は残す
                if(j!=0 && k>=2*j) (dp[i][j][k] += 2*j*dp[i-1][j][k-2*j]%inf)%=inf;
                //両方マッチングしない
                if(k>=2*(j+1)) (dp[i][j+1][k] += dp[i-1][j][k-2*(j+1)])%=inf;
            }
        }
    }
/*     for(int i=1;i<=N;i++){
        cerr << i << endl;
        for(int j=0;j<=N;j++) for(int k=0;k<=K;k++) cerr << dp[i][j][k] << (k!=K? " ":"\n");
    }*/
    cout << dp[N][0][K] << endl;
}

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

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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    ll mod = static_cast<ll>(1e9+7);

    vector<vector<ll>> dp(s.length()+1, vector<ll>(13, 0));
    if(s.at(0) == '?')
    {
        for(int i=0; i<10; i++)
        {
            dp.at(0).at(i)++;
        }
    }
    else
    {
        int num = s.at(0) - '0';
        dp.at(0).at(num)++;
    }
    
    for(int i=1; i<s.length(); i++)
    {
        if(s.at(i) == '?')
        {
            for(int j=0; j<10; j++)
            {
                for(int k=0; k<13; k++)
                {
                    dp.at(i).at((10*k+j)%13) += dp.at(i-1).at(k);
                    dp.at(i).at((10*k+j)%13) %= mod;
                }
            }
        }
        else
        {
            int num = s.at(i) - '0';
            for(int j=0; j<13; j++)
            {
                dp.at(i).at((j*10 + num) % 13) += dp.at(i-1).at(j);
            }
        }
    }
    cout << dp.at(s.length()-1).at(5) << endl;

    return 0;
}


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

using namespace std;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define blank(ans) cout << (ans) << " ";
#define mp(p, q) make_pair(p, q)
#define mt(p, q, r) make_tuple(p, q, r)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;

typedef vector<ll> vll;
typedef vector<ld> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<vector<ll>> vvll;
typedef vector<vector<ld>> vvd;
typedef vector<vector<bool>> vvb;
typedef vector<vector<char>> vvc;
typedef vector<vector<str>> vvs;
typedef vector<pair<ll, ll>> vpll;
typedef vector<tuple<ll, ll, ll>> vtlll;

const ld PI = acos(-1.0);
const ll MAX = 9000000000000000000;
const ll MIN = -9000000000000000000;
const ld DMAX = 4500;
const ld DMIN = -4500;
const ll MOD = 1000000007;

template <typename T>
void fin(T a)
{
  cout << a << endl;
  exit(0);
}

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

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

//実行部
void Main()
{
  ll a, b, c; cin >> a >> b >> c;
  for(ll i = 1;i < 10000;i++)
  {
    if(a * i % b == c) fin("YES");
  }
  fin("NO");
}

//前処理
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(20); //高精度少数表示
  Main();
  return 0;
}

/*
//test時
  g++ test.cpp -o test;./test
*/


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var xy = ReadInts();
            WriteLine(Gcd(xy[0], xy[1]));
        }

        private static string Read() { return ReadLine(); }
        private static string[] Reads() { return (Read().Split()); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        public static void debuglist(List<int> x)
        {
            foreach (var item in x)
            {
                WriteLine(item);
            }
        }
        public static void debuglist(List<string> x)
        {
            foreach (var item in x)
            {
                WriteLine(item);
            }
        }
        public static void debugarray(int[] x)
        {
            foreach (var item in x)
            {
                WriteLine(item);
            }
        }
        public static void debugarray(string[] x)
        {
            foreach (var item in x)
            {
                WriteLine(item);
            }
        }

        public static bool IsPrime(int num)
        {
            if (num < 2) return false;
            else if (num == 2) return true;
            else if (num % 2 == 0) return false;

            double sqrtNum = Sqrt(num);
            for (int i = 3; i <= sqrtNum; i += 2)
            {
                if (num % i == 0)
                {
                    return false;
                }
            }
            return true;
        }

        //最大公約数

        public static int Gcd(int a, int b)
        {
            if (a < b)
            {
                return Gcd(b, a);
            }
            while (b != 0)
            {
                var reminder = a % b;
                a = b;
                b = reminder;
            }
            return a;
        }

        //最小公倍数
        public static int Lcm(int a, int b)
        {
            return a * b / Gcd(a, b);
        }

        //文字数を数える
        public static int CountChar(string s, char c)
        {
            return s.Length - s.Replace(c.ToString(), "").Length;
        }
    }
}



Measured memory_bytes: 17920
n = int(input())
a = list(map(int, input().split()))
r = 1
maxi = [0] * (n + 1)

ok = True

for i in range(n + 1):
    if r <= 0 or a[i] > r:
        ok = False
        break
    maxi[i] = r
    r = 2 * (r - a[i])

branches = a[n]
ans = a[n]
for i in range(n - 1, -1, -1):
    branches = min(branches + a[i], maxi[i])
    ans += branches

if not ok:
    ans = -1

print(ans)


Measured memory_bytes: 700644
#include<stdio.h>
int main(){
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	if(a>=b){
		if(b>=c){
			printf("%d %d %d\n",c,b,a);
		}
		else if(c>=b){
			if(a>=c){
				printf("%d %d %d\n",b,c,a);
			}
			else if(c>=a){
				printf("%d %d %d\n",b,a,c);
			}
		}
	}
	else if(b>=a){
		if(a>=c){
			printf("%d %d %d\n",c,a,b);
		}
		else if(c>=a){
			if(b>=c){
				printf("%d %d %d\n",a,c,b);
			}
			else if(c>=b){
				printf("%d %d %d\n",a,b,c);
			}
		}
	}
return 0;	
}			

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

int main(void){
    int n1, n2, n3;
    cin >> n1 >> n2 >> n3;
    if( (n1==5 and n2==5 and n3 ==7) or
        (n1==5 and n2==7 and n3 ==5) or
        (n1==7 and n2==5 and n3 ==5))
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}

Measured memory_bytes: 256
object Main extends App {
  val inputs: Seq[String] = scala.io.Source.stdin.getLines().toList
  val nums = inputs.head.split(" ").map(_.toInt)
  val a = nums(0) match {
    case 1   => 14
    case num => num
  }
  val b = nums(1) match {
    case 1   => 14
    case num => num
  }

  println(if(a == b) {
    "Draw"
  } else if (a < b){
    "Bob"
  } else {
    "Alice"
  })
}

Measured memory_bytes: 54992
import sys
sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():
    """
    https://qiita.com/drken/items/4a7869c5e304883f539b#3-3-dfs-%E3%81%AE%E5%86%8D%E5%B8%B0%E9%96%A2%E6%95%B0%E3%82%92%E7%94%A8%E3%81%84%E3%81%9F%E5%AE%9F%E8%A3%85
    cf. https://atcoder.jp/contests/abc138/submissions/13273052
    """

    from collections import deque

    N = int(input())
    M = N-1  # 頂点数，辺数
    # グラフ入力受取 (ここでは無向グラフを想定)
    G = [[] for _ in range(N)]
    for i in range(M):
        a, b = map(int, input().split())
        a -= 1
        b -= 1
        G[a].append((b, i))
        G[b].append((a, i))

    seen = [False]*N
    res = [0]*M

    def dfs(G, v, parent_col):
        col = 1
        if col == parent_col:
            col += 1
        seen[v] = True
        stack = deque([(v, -1)])
        while stack:
            v, parent_col = stack.pop()
            col = 1
            for next_v, edge_ind in G[v]:
                if seen[next_v]:
                    continue
                if col == parent_col:
                    col += 1
                res[edge_ind] = col
                seen[next_v] = True
                stack.append((next_v, col))
                col += 1

    # 頂点 0 をスタートとした探索
    dfs(G, 0, -1)
    print(max(res))
    for i in res:
        print(i)


resolve()

Measured memory_bytes: 68384
n = gets.chomp!.to_i
ls = gets.split(" ").map(&:to_i)

ls = ls.sort
#p ls
start = ls.first
goal = ls.last



for i in start..goal do
  score = 0
  ls.each do |e|
    score += (e - i)**2
  end
  if i == start
    d = score
  else
    if score < d
      d = score
    end
  end
end

p d


Measured memory_bytes: 1788
#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 main(){
	int n,x,y,ans=0;
	cin>>n>>x>>y;
	int a[2222]={};
	FOR(i,1,n+1){
		cin>>a[i];
	}
	//int dp[2022][2022]={};
	if(n==1)ans=abs(a[n]-y);
	else ans=max(abs(a[n]-y),abs(a[n-1]-a[n]));

	cout<<ans<<endl;


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
                     
#define int             long long
#define ld              long double
#define mp              make_pair
#define ff              first
#define ss              second
#define pb              push_back
#define fo(i,n)         for(i=0;i<n;i++)
#define fo1(i,n)        for(i=1;i<=n;i++)
#define FO(i,k,n)       for(i=k;k<=n?i<=n:i>=n;k<=n?i++:i--)
#define all(c)          c.begin(),c.end()
#define rall(c)         c.rbegin(),c.rend()
#define si              set<int>
#define vi              vector<int>
#define mii             map<int,int>
#define pii             pair<int,int>
#define vpii            vector<pii>
#define vvi             vector<vi>
#define usi             unordered_set<int>
#define umii            unordered_map<int,int>
#define pqmx            priority_queue<int>
#define pqmn            priority_queue<int,vi,greater<int> >
#define sp(x)           cout<<setprecision(x)<<fixed;
#define setbits(x)      __builtin_popcountll(x)
#define zerobits(x)     __builtin_ctzll(x)
#define in(a,n)         vi a(n);fo(i,n)cin>>a[i];
#define in1(a,n)        vi a(n+1);fo1(i,n)cin>>a[i];
#define w(t)            int t;cin>>t;while(t--)
#define gcd             __gcd
#define lcm(x,y)        x*(y/gcd(x,y))
#define endl            '\n'
#define PI              3.14159265358979323846
#define mod             1000000007
const int inf=1e18;
void __p(int x) {cout<<x;}
void __p(int32_t x){cout<<x;}
void __p(float x){cout<<x;}
void __p(double x){cout<<x;}
void __p(ld x) {cout<<x;}
void __p(char x){cout <<'\''<<x<<'\'';}
void __p(const char *x){cout <<'\"' <<x<<'\"';}
void __p(const string &x) {cout<<'\"'<<x<<'\"';}
void __p(bool x) {cout<<(x?"true":"false");}
void _p() {cout << "]\n";}
template<typename T,typename V>     void __p(const pair<T,V> &x) {cout<<'{';__p(x.first);cout<<',';__p(x.second);cout<<'}';}
template<typename T>                void __p(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __p(i); cout << "}";}
template <typename T,typename... V> void _p(T t, V... v) {__p(t);if(sizeof...(v))cout<<", ";_p(v...);}
int po(int x,int p,int m = inf) {int ans=1;x%=m;while(p>0){if(p&1)ans=(ans*x)%m;p=p>>1;x=(x*x)%m;}return ans;}
int inv(int x,int m=mod){return po(x,m-2,m)%m;}
#ifndef ONLINE_JUDGE
#define dbg(x...) cout<<"["<<#x<<"]=[";_p(x)
#else 
#define dbg(x...)
#endif
//=================================================================================




const int N=1e6+6;
int n,m,k,x,y,z,a,b,c,d,i,j,l,r;








void sol()
{   
    cin>>n;
    in(a,n);
    sort(rall(a));
    int p=1;
    int f=0;
    for(auto c:a)if(c==0)f=1;
    if(f){cout<<0;return;}
    f=0;
    for(auto c:a)
    {
        if(p>inf/c)f=1;
        p*=c;
    }
    
    if(f)cout<<-1;
    else cout<<p<<endl;
}





int32_t main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //sp(10);
    // w(t)
    sol();
    return 0;
}

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


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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define SORT(v) sort(v.begin(), v.end());
#define RSORT(v) sort(v.rbegin(), v.rend());
#define REVERSE(v) reverse(v.begin(), v.end());

template <typename T>
void printlnVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << endl;
  }
}
template <typename T>
void printVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << " ";
  }
  cout << endl;
}

int main()
{
  int R;
  cin >> R;
  long double ans = 2 * R * M_PI;
  cout << fixed << setprecision(15) << ans << endl;
  return 0;
}

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

using namespace std;

using ll = long long;

const int INF = 1e9;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int h, n;
    cin >> h >> n;

    vector<int> dp(h + 1, INF);
    dp[0] = 0;
    for (int i = 0; i < n; ++i) {
        int a, b;
        cin >> a >> b;
        for (int j = 0; j < h; ++j) {
            int& tar = dp[min(j + a, h)];
            tar = min(tar, dp[j] + b); 
        }
    }
    cout << dp[h] << "\n";
    return 0;
}

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

int main(){
    ll n,k;
    cin >> n >> k;
    vector<ll> h(n + 1);
    for(ll i = 0;i < n;i++) cin >> h.at(i);
    sort(h.begin(),h.end());
    ll sum = 0;
    ll hh = n - k;
    if(hh < 0) hh = 0;
    for(ll i = 0;i < hh + 1;i++) {
        sum += h.at(i);
    }
    cout << sum << endl;
    return 0;
}

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

int main()
{
	int n, x, cnt;

	while(cin >> n >> x)
	{
		if (n == 0 && x == 0) break;
		cnt = 0;
		for (int i = 1; i <= n; ++i)
			for (int j = i + 1; j <= n; ++j)
			{
				for (int k = j + 1; k <= n; ++k)
					if (i + j + k == x) ++cnt;
			}
		cout << cnt << endl;
	}
	

	return 0;
}

Measured memory_bytes: 1160
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder
{
	public class ABC
	{
		static readonly int mod = 1000000007;  // 10^9+7

		static void Main(string[] args)
		{
			Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });


			int n = int.Parse(Console.ReadLine());
			//string s = Console.ReadLine();
			//int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
			//long[] a = Console.ReadLine().Split().Select(long.Parse).ToArray();
			if (n == 1) {
				Console.WriteLine("Hello World");
			} else {
				int a = int.Parse(Console.ReadLine());
				int b = int.Parse(Console.ReadLine());
				Console.WriteLine(a + b);
			}


			Console.Out.Flush();
		}
	}
}


Measured memory_bytes: 13140
#include<stdio.h>
#include<stdlib.h>
//copy file from aizu
struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef node* Node;
#define NIL NULL
 
node array[500000];
int size=0;
 
Node root = NIL;
  
Node treeMinimum(Node x){
  while(x->left!=NIL)x=x->left;
  return x;
}
  
Node treeSearch(Node u, int k){
  Node i=u;
  while(i!=NIL){
    if(i->key==k)return i;
    else if(i->key<k)i=i->right;
    else i=i->left;     
  }
  return NIL;
}
  
Node treeSuccessor(Node x){
  if(x->right!=NIL)return treeMinimum(x->right);
  Node y=x->parent;
  while(y!=NIL&&x==y->right){
    x=y;
    y=y->parent;
  }
  return y;
}
  
void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y
  if(z->left==NIL||z->right==NIL)y=z;
  else y=treeSuccessor(z);
    
  if(y->left!=NIL)x=y->left;
  else x=y->right;
  
  if(x!=NIL)x->parent=y->parent;
    
  if(y->parent==NIL)root=x;
  else if(y==y->parent->left)y->parent->left=x;
  else y->parent->right=x;
  
  if(y!=z)z->key=y->key;
    
  //free(y);
}
  
void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;
  
  z = &array[size++];
  z->key = k;
  z->left = NIL;
  z->right = NIL;
  
  while(x!=NIL){
    y=x;
    if(z->key<x->key)x=x->left;
    else x=x->right;
  }
  z->parent=y;
  if(y==NIL)root=z;
  else if(z->key<y->key)y->left=z;
  else y->right=z;   
}
 
 
void inorder(Node u){
  if(u==NIL)return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}
 
void preorder(Node u){
  if(u==NIL)return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}
 
 
int main(){
  int n,x;
  char str[20];
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    scanf("%s", str);
    if(str[0]=='f'){
      scanf("%d",&x);
      Node t=treeSearch(root,x);
      if (t!=NIL) printf("yes\n");
      else printf("no\n");
    }else if(str[0]=='i'){
      scanf("%d",&x);
      insert(x);
    }else if(str[0]=='p'){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }else if(str[0]=='d'){
      scanf("%d",&x);
      treeDelete(treeSearch(root,x));
    }
  }
 
  return 0;
}


Measured memory_bytes: 15048
use std::collections::*;
use std::io::*;
use std::*;
// template {{{
macro_rules! get {
    ($($t:tt),*; $n:expr) => {
        {
            let stdin = std::io::stdin();
            let ret = std::io::BufRead::lines(stdin.lock()).take($n).map(|line| {
                let line = line.unwrap();
                let mut it = line.split_whitespace();
                _get!(it; $($t),*)
            }).collect::<Vec<_>>();
            ret
        }
    };
    ($($t:tt),*) => {
        {
            let mut line = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut it = line.split_whitespace();
            _get!(it; $($t),*)
        }
    };
}
macro_rules! _get {
    ($it:ident; [char]) => {
        _get!($it; String).chars().collect::<Vec<_>>()
    };
    ($it:ident; [u8]) => {
        _get!($it; String).bytes().collect::<Vec<_>>()
    };
    ($it:ident; usize1) => {
        $it.next().unwrap().parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1
    };
    ($it:ident; [usize1]) => {
        $it.map(|s| s.parse::<usize>().unwrap_or_else(|e| panic!("{}", e)) - 1).collect::<Vec<_>>()
    };
    ($it:ident; [$t:ty]) => {
        $it.map(|s| s.parse::<$t>().unwrap_or_else(|e| panic!("{}", e))).collect::<Vec<_>>()
    };
    ($it:ident; $t:ty) => {
        $it.next().unwrap().parse::<$t>().unwrap_or_else(|e| panic!("{}", e))
    };
    ($it:ident; $($t:tt),+) => {
        ($(_get!($it; $t)),*)
    };
}
// }}}

fn main() {
    let n = get!(usize);
    let a = get!([i64]);
    let mut money: i64 = 1000;
    let mut stock: i64 = 0;
    for i in 0..n - 1 {
        if a[i] < a[i + 1] {
            stock += money / a[i];
            money %= a[i];
        } else if a[i] > a[i + 1] {
            money += stock * a[i];
            stock = 0;
        }
    }
    money += stock * a[n - 1];
    println!("{}", money);
}


Measured memory_bytes: 2140