akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
#ifdef XVENOM
	#define errp(...) fprintf(stderr, __VA_ARGS__)
	#define dbg(...) errp("[%s]: ", #__VA_ARGS__), dbg_str(__VA_ARGS__)
#else
	#define errp(...)
	#define dbg(...)
#endif
template <typename U, typename V> string to_string (pair<U, V>);
string to_string (const string& e_) { return "\"" + e_ + "\""; }
string to_string (char e_) { return "\'" + string(1, e_) + "\'"; }
string to_string (bool e_) { return e_ ? "true" : "false"; }
template <typename T> string to_string (T e_) {
	string s_ = "[ ";
	for (const auto& x_ : e_) s_ += to_string(x_) + " ";
	return s_ + "]";
}
template <typename U, typename V> string to_string (pair<U, V> e_) {
	return "(" + to_string(e_.first) + ", " + to_string(e_.second) + ")";
}
void dbg_str () { errp(" \n"); }
template <typename U, typename... V> void dbg_str (U u, V... v) {
	errp(" %s", to_string(u).c_str()); dbg_str(v...);
}
/* --- */
const int N = 200010;
int a[N];

int main () {
	ios_base::sync_with_stdio(0); cin.tie(0);
	/* --- */
	int n, max = 0, max2 = 0;
	cin >> n;
	
	for(int i = 0; i < n; i++){
		cin >> a[i];
		if(max <= a[i]){
			max2 = max;
			max = a[i];
		}
		else if(max2 < a[i]) max2 = a[i];
	}

	for(int i = 0; i < n; i++){
		if(a[i] == max) cout << max2 << "\n";
		else cout << max << "\n";
	}
}	

Measured memory_bytes: 2432
#include <bits/stdc++.h>
using namespace std;
void solve(); 
int main() 
{ 
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); 
			   
	#ifndef ONLINE_JUDGE 
	freopen("input.txt", "r", stdin); 
	freopen("error.txt", "w", stderr); 
	freopen("output.txt", "w", stdout); 
	#endif 
			   
	int t=1; 
	while(t--) 
	{ 
	   solve(); 
	} 
	
	cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl; 
	return 0; 
} 
void solve() 
{ 
	int a;
	cin >> a;
	int b = a + (a * a) + (a * a * a);
	cout << b;
}

Measured memory_bytes: 3792
#include <bits/stdc++.h>
#define inf 1000000007
#define mod 1000000007
//#pragma GCC optimize(2)
//#define int long long
using namespace std;
template <typename T> void read(T &x){
	x=0;char ch=getchar();int fh=1;
	while (ch<'0'||ch>'9'){if (ch=='-')fh=-1;ch=getchar();}
	while (ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
	x*=fh;
}
template <typename T> void write(T x) {
	if (x<0) x=-x,putchar('-');
	if (x>9) write(x/10);
	putchar(x%10+'0');
}
template <typename T> void writeln(T x) {
	write(x);
	puts("");
}
signed main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int h,a;
	cin>>h>>a;
	cout<<h/a+(h%a?1:0)<<endl;
	return 0;
}


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

using namespace std;
int main(){
    int n,s;
    int a[2000],b[2000];
    s=0;
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> a[i] >>b[i];
        s+=b[i]-a[i]+1;
    }
    cout << s <<endl;
    
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,x,y; cin>>n>>x>>y;
	vector<vector<int>>scores(n+1,vector<int>(n+1));
	for(int i=1;i<=n;i++){
		for(int j=i+1;j<=n;j++){
			scores[i][j]=j-i;
			int alter = abs(x-i)+1+abs(y-j);
			scores[i][j]=min(j-i,alter);
		}
	}
	vector<int>table(n);
	for(int i=1;i<=n;i++){
		for(int j=i;j<=n;j++){
			if(scores[i][j]>0)
				table[scores[i][j]]++;
		}
	}
	for(int i=1;i<n;i++)
		cout<<table[i]<<endl;
	return 0;
}

Measured memory_bytes: 16000
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<cstring>
#include<cmath>
#include<ctime>
#include<algorithm>
#include<utility>
#include<stack>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#define EPS 1e-9
#define PI acos(-1.0)
#define INF 0x3f3f3f3f
#define LL long long
const int MOD = 1E9+7;
const int N = 1000+5;
const int dx[] = {-1,1,0,0,-1,-1,1,1};
const int dy[] = {0,0,-1,1,-1,1,-1,1};
using namespace std;

LL G[N][N];
int main() {
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        for(int j=1;j<=n;j++)
            scanf("%lld",&G[i][j]);

    bool flag=false;
    LL res=0;
    for(int i=1;i<=n&&!flag;i++){
        for(int j=i+1;j<=n&&!flag;j++){
            bool flag2=true;
            for(int k=1;k<=n&&!flag;k++){
                if(G[i][k]+G[k][j]<G[i][j])
                    flag=true;
                else{
                    if(i!=k&&j!=k&&G[i][j]==G[i][k]+G[k][j])
                        flag2=false;
                }
            }
            if(flag2)
                res+=G[i][j];
        }
    }

    if(flag)
        printf("-1\n");
    else
        printf("%lld\n",res);


    return 0;
}


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

using namespace std;

constexpr int kMaxN = 51;
constexpr int kMaxX = 51;

int x[kMaxN] = {0};
long long dp[kMaxN][kMaxN][kMaxN * kMaxX] = {{{0}}};

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

  int N, A;
  cin >> N >> A;
  int X = 0;
  for (int i = 1; i <= N; ++i) {
    cin >> x[i];
    X = max(X, x[i]);
  }

  for (int j = 0; j <= N; ++j) {
    for (int k = 0; k <= N; ++k) {
      for (int s = 0; s <= N * X; ++s) {
        if (j == 0 && k == 0 && s == 0) {
          dp[j][k][s] = 1;
        } else if (1 <= j && s < x[j]) {
          dp[j][k][s] = dp[j - 1][k][s];
        } else if (1 <= j && 1 <= k && x[j] <= s) {
          dp[j][k][s] = dp[j - 1][k][s] + dp[j - 1][k - 1][s - x[j]];
        } else {
          dp[j][k][s] = 0;
        }
      }
    }
  }
  long long ans = 0;
  for (int k = 1; k <= N; ++k) ans += dp[N][k][k * A];
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 53120
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
  int a;
  int b;
  int c;
  cin>>a>>b>>c;
  if((a*b)>=c){
    cout<<c<<endl;
  }else{
    cout<<a*b<<endl;
  }
  

  
    
}


Measured memory_bytes: 3636
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int[] B = new int[N];
        for (int i = 0; i < N-1; i++) {
            B[i] = scan.nextInt();
        }
        int answer = B[0] + B[N-2];
        for (int i = 1; i < N - 1; i++) {
            answer += Math.min(B[i-1],B[i]);
        }
        System.out.println(answer);
    }
}


Measured memory_bytes: 23892
#include<iostream>
#include<cstdio>
using namespace std;
typedef long long ll;
const ll Maxn=2e5+5;
const ll Maxm=4000+5;
const ll Mod=1e9+7;
ll n,ans,a[Maxn],b[Maxn],mul[Maxn],ny[Maxn];
ll f[Maxm][Maxm];
ll qpow(ll x,ll k)
{	ll res=1;
	while(k)
	{	if(k&1)res=res*x%Mod;
		x=x*x%Mod;
		k=k>>1;
	}
	return res;
}
ll C(ll x,ll y){return mul[x]*ny[y]%Mod*ny[x-y]%Mod;}
int main()
{
	mul[0]=1;
	scanf("%lld",&n);
	for(ll i=1;i<=n;i++)
	{	scanf("%lld%lld",&a[i],&b[i]);
		f[2002-a[i]][2002-b[i]]++;
	}
	for(ll i=1;i<=8000;i++)mul[i]=1ll*mul[i-1]*i%Mod;
	for(ll i=1;i<=8000;i++)ny[i]=qpow(mul[i],Mod-2);
	for(ll i=1;i<=4002;i++)
		for(ll j=1;j<=4002;j++)
			f[i][j]=(f[i][j]+(f[i-1][j]+f[i][j-1])%Mod)%Mod;
	for(ll i=1;i<=n;i++)
	{	ans=(ans+f[a[i]+2002][b[i]+2002])%Mod;
		ans=(ans-C(2*a[i]+2*b[i],2*a[i]))%Mod;
	}
	ans=(ans+Mod)%Mod;
	ans=(1ll*ans*500000004)%Mod;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 131840
#define _CRT_SECURE_NO_WARNINGS
#define REL

#pragma GCC target ("avx2")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <iomanip>
#include <cstdio>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <string>
#include <set>
#include <bitset>
#include <cstdint>
#include <cstring>
#include <cassert>
#include <complex>
#include <stack> 
#include <random>

using namespace std;

typedef int64_t i64;
typedef long long LL;
typedef long long ll;
typedef long double LD;
typedef complex <LD> cld;
typedef unsigned int uint;
typedef complex <double> cd;
typedef unsigned long long ULL;

#define endl "\n"
#define dendl "\n\n"
#define mp make_pair
#define mt make_tuple
#define size(v) (int)v.size()
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

/////////////////////////////////////////////////////////////////////

template <typename T>
T sqr(T a) {
	return a * a;
}

template <typename T>
int sign(T a) {
	if (a == 0)
		return 0;
	return (a > 0 ? 1 : -1);
}

template <typename T>
bool uax(T& a, const T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

template <typename T>
bool uin(T& a, const T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}

template <typename T1, typename T2>
istream& operator >> (istream& in, pair<T1, T2>& p) {
	in >> p.first >> p.second;
	return in;
}

template <typename T1, typename T2>
ostream& operator << (ostream& out, pair<T1, T2>& p) {
	out << p.first << ' ' << p.second;
	return out;
}

mt19937_64 rnd(0);

const int LOG = 64;
const int N = (int)2e3 + 7;
const int MAXN = (int)1e7 + 7;
const int MOD = (int)1e9 + 7;
const int INF = (int)2e9 + 7;
const int CONST = 450;
const LL LINF = (i64)1e18;
const LD PI = 3.1415926535897932384626433832795;
const LD EPS = 1;

/////////////////////////////////////////////////////////////////////

void solve() {
	int n = 5, a[5];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		if (a[i] == 0)
			cout << i + 1;
	}
}

int main() {
	double start = clock();
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	cout << fixed << setprecision(20);
	cerr << fixed << setprecision(20);
#else
	cout << fixed << setprecision(20);
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	rnd.seed(time(0));
#endif

	int t = 1;
	for (int i = 0; i < t; i++) {
		solve();
	}
	
#ifdef _DEBUG
	cout << endl << "Time is " << (clock() - start) / 1000.0;
#endif
}

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

int main(){
  int n, h; cin >> n >> h;
  
  vector<pair<int, char> > sw;
  
  for(int i = 0; i < n; i++){
    int a, b; cin >> a >> b;
    sw.push_back(make_pair(a, 'a'));
    sw.push_back(make_pair(b, 'b'));
  }
  
  sort(sw.begin(), sw.end(), greater<pair<int, char> >());
  
  int ans = 0;
  while(h > 0){
    int atk = sw[ans].first;
    if(sw[ans].second == 'a'){
      ans += (h - 1) / atk + 1;
      break;
    }else{
      h -= atk;
      ans++;
    }
  }
  cout << ans << endl;
}

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

int main(){
    int N,X;
    cin>>N>>X;
    vector<int> A(N);
    for(int i=0;i<N;i++) cin>>A[i];

    long long ans = 0;

    if(A[0] > X){
            ans += A[0] - X;
            A[0] = X;
        }

    for(int i=0;i<N-1;i++){
        long long pair = A[i] + A[i+1];
        if(pair > X){
            ans += (pair-X);
            A[i+1] -= (pair-X);
        }
    }

    cout<<ans<<endl;

}

Measured memory_bytes: 640
/* Written by Filip Hlasek 2016 */
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstring>

#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
#define REP(i,b) for(int i=0;i<(b);i++)

using namespace std;

int main(int argc, char *argv[]) {
  long long N, X;
  scanf("%lld%lld", &N, &X);
  if (N == 2 * X) {
    printf("%lld\n", 3 * X);
    return 0;
  }
  if (2 * X > N) X = N - X;
  long long A = N - 2 * X, B = X, ans = N + X;
  while (true) {
    if (!A) break;
    if (A <= B) {
      ans += 3 * B;
      long long nB = B % A;
      long long nA = A - nB;
      if (B % A == 0) { ans -= A; break; }
      ans -= nB;
      B = nB;
      A = nA;
    }
    else {
      long long cnt = A / B;
      ans += 2 * cnt * B;
      A -= cnt * B;
    }
  }
  printf("%lld\n", ans);
  return 0;
}

Measured memory_bytes: 128
#template
def inputlist(): return [int(k) for k in input().split()]
import sys
sys.setrecursionlimit(10**6)
#template
N,K = inputlist()
A = inputlist()
seen = [False]*(N+1)
dic = {n:0 for n in range(1,N+1)}
for i in range(N):
    dic[i+1] = A[i]

def search(i,count):
    seen[i] = True
    next_i = dic[i]
    if seen[next_i]:
        count+=1
        return [next_i,count]
    count+=1
    return search(next_i,count)
key,count_sum = search(1,0)

def find(i,count):
    if i == key:
        return count
    count+=1
    return find(dic[i],count)

tmp = find(1,0)
if K < count_sum:
    ans = 1
    for i in range(K):
        ans = dic[ans]
    print(ans)
    exit()

d = count_sum-tmp
Ka = K-tmp

mod = Ka % d

loop = []
loop.append(key)
def dfs(i):
    next_i = dic[i]
    if next_i == key:
        return False
    loop.append(next_i)
    return dfs(next_i)
dfs(key)

print(loop[mod])


Measured memory_bytes: 278280
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()

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

typedef long long ll;


// 偶数　全部＋
// 奇数 最小-
int main() {
    ll N;
    cin >> N;
    vector<ll> A(N);
    REP(i,N) cin >> A[i];
    int mns = 0;
    // マイナスの個数を数える
    // ついでにプラスに直す
    REP(i,N) {
        if(A[i]<0) {
            A[i]*=-1;
            mns++;
        }
    }
    ll ans = accumulate(ALL(A),ll(0));
    if (mns%2==1) {
        ans-=*min_element(ALL(A)) * 2;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024
s = input()
for i in range(1, 8):
  y = int(s[0])
  z = ""
  for j in range(3):
    if ((i >> j) & 1):
      y += int(s[j+1])
      z += "+"
    else: 
      y -= int(s[j+1])
      z += "-"
  if y == 7:
    print(s[0]+z[0]+s[1]+z[1]+s[2]+z[2]+s[3]+"=7", sep="")
    break

Measured memory_bytes: 3064
import java.util.*;
    public class Main {
     
    	public static void main(String[] args) {
    			
    		Scanner scan=new Scanner(System.in);
    		
    		int a=Integer.parseInt(scan.next());
    		int b=Integer.parseInt(scan.next());
    		int c=Integer.parseInt(scan.next());
    		int[] array= {a,b,c};
    		Arrays.sort(array);
    		System.out.print(array[0]+array[1]);

    		
    	
  
    				
 
     
    }
    }

Measured memory_bytes: 22996
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  vector<int> a(n);
  int cnt0=0,cnt2=0;
  for(int i=0;i<n;i++){
    cin>>a[i];
    a[i]%=4;
    if(a[i]==0){
      cnt0++;
    }
    else if(a[i]==2){
      cnt2++;
    }
  }
  int cnt=n-cnt0-cnt2;
  bool can=false;
  if(cnt2!=0){
    cnt++;
  }
  if(cnt<=cnt0+1) can=true;
  cout<<(can? "Yes":"No");
}

Measured memory_bytes: 764
//Written by Rhitwik Saha//
#include <bits/stdc++.h>
using namespace std;
#define int         long long
#define mp          make_pair
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vb          vector<bool>
#define vc          vector<char>
#define vii         vector<pii>
//#define mi          map<int,int>
//#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (int)x.size()
#define ub(x)       upper_bound(x)
#define lb(x)       lower_bound(x)
#define endl        '\n'
#define file        freopen("input.txt","r",stdin);freopen("output.txt","w",stdout)
#define fastio      ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
// #define N            1e5+5
#define M           1000000007
#define MAX         100005
#define mem0(a)     memset(a,0,sizeof(a))
#define prec        cout<<std::setprecision(9)<<std::fixed
#define forn(i,a,b)  for(int i=a;i<b;i++)
int i,j,k;
void Anon_mouS(){
    int n;
    cin>>n;
    vi a(n);
    for(i=0;i<n;i++)cin>>a[i];
    for(i=0;i<n;i++){
        if(a[i]%2==0){
            if(a[i]%3!=0 and a[i]%5!=0){
                cout<<"DENIED";
                return;
            }
        }
    }
    cout<<"APPROVED";
}
int32_t main(){
    fastio;
    // file;
    // sieve();
    int q=1;
    // cin>>q;
    while(q--)Anon_mouS();
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod =1e9+7;
ll n,a,b;
ll quic(ll base ,ll n)
{ 
    ll ret=1;
    while(n)
    {
        if(n&1)  ret=(ret*base)%mod;
        base= ( base*base)%mod;
        n=n/2;
    }
    return ret;
}
ll  acount( ll  n,ll a   )
{
    ll ret=1,ans=1;
    for(int i=n;i>=(n-a+1);i--) 
        ret= (ret* i )%mod;
    for(int i=1;i<=a;i++)
        ans=(ans*i)%mod;
        ans= quic( ans,mod-2 );
        return ( ret*ans  )%mod;

}
int main(){
    
     
     cin>>n>>a>>b;
     ll cnt= quic( 2,n );
     cnt  = ( cnt-1+mod)%mod;
     cnt= (cnt-acount (n,a )+mod)%mod;
     cnt= ( cnt-acount(n,b)+mod )%mod;
     cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FastRead ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define FOR(i,a,n) for (int i=(a);i<=(n);++i)
#define RFOR(i,a,n) for (int i=(n);i>=(a);--i)
#define FI(i,n) for (int i=0; i<(n); ++i)
#define ZERO(a) memset((a),0,sizeof((a)))
#define f first
#define s second
#define pb push_back
#define mk make_pair
#define all(g) g.begin(),g.end()
int fastMax(int x, int y) { return (((y-x)>>(32-1))&(x^y))^y; }
int fastMin(int x, int y) { return (((y-x)>>(32-1))&(x^y))^x; }

// #include <ext/pb_ds/assoc_container.hpp> // Common file
// #include <ext/pb_ds/tree_policy.hpp>     // Including tree_order_statistics_node_updat
// using namespace __gnu_pbds;
// typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

// I am questioning life and universe and 
// everything else after looking at this

void solve(){
    ll n,m,c; cin>>n>>m>>c;

    ll b[m];
    FOR(i,0,m-1) cin>>b[i];

    ll a[n][m];
    ll ans = 0;
    FOR(i,0,n-1){
        ll sum = 0;
        FOR(j,0,m-1){
            cin>>a[i][j];
            sum += a[i][j]*b[j];
        }
        if(sum + c > 0) ans++;
    }

    cout<<ans<<endl;
}

signed main(){

// #ifndef ONLINE_JUDGE
//     freopen("input.txt", "r", stdin);
//     freopen("output.txt", "w", stdout);
// #endif

    FastRead;

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<math.h>
#include<map>
#include<bitset>
#include<iomanip>
#include<queue>
#include<functional>
#include<stack>
#include<tuple>
#include<cassert>
using namespace std;

#define rep(i, n) for (long long i = 0; i < (long long)(n); ++i)
using ll = long long;
using P = pair<long long, long long>;
using MATRIX = vector< vector<ll> >;
template <class T> inline bool chmin(T &x, const T &y) {if (x > y) {x = y; return 1;} return 0;}
template <class T> inline bool chmax(T &x, const T &y) {if (x < y) {x = y; return 1;} return 0;}

const long long MOD = 1000000007;
long long dp[1000001][4] = {0};

int main() {
  long long N;
  cin >> N;
  dp[2][0] = 2;
  dp[2][1] = 17;
  dp[2][2] = 17;
  dp[2][3] = 64;
  for(long long i = 2; i < N; i++) {
    dp[i+1][0] += dp[i][0] * 10;
    dp[i+1][0] %= MOD;
    dp[i+1][0] += dp[i][1];
    dp[i+1][0] %= MOD;
    dp[i+1][0] += dp[i][2];
    dp[i+1][0] %= MOD;

    dp[i+1][1] += dp[i][1] * 9;
    dp[i+1][1] %= MOD;
    dp[i+1][1] += dp[i][3];
    dp[i+1][1] %= MOD;

    dp[i+1][2] += dp[i][2] * 9;
    dp[i+1][2] %= MOD;
    dp[i+1][2] += dp[i][3];
    dp[i+1][2] %= MOD;

    dp[i+1][3] += dp[i][3] * 8;
    dp[i+1][3] %= MOD;
  }
  cout << dp[N][0] << endl;
  return 0;
}

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

using namespace std;

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

typedef long long ll;

int main()
{
	string s;
	cin >> s;
	int n=s.size();
	vector<int> v;
	rep(i, n)
	{
		if(s[n-1-i]=='B') v.push_back(i);
	}
	int m=v.size();
	ll ans=0;
	rep(i, m) ans+=(ll)(v[i]-i);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1532
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#include <bitset>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
using namespace std;


int main(int argc, char* argv[])
{
    int n;
    scanf("%d", &n);

    vector<int> a(n);
    int i;
    for(i=0; i<n; i++) {
        scanf("%d", &a[i]);
    }
    sort(a.begin(), a.end());

    for(i=0; i<n; i+=2) {
        a[i]=24-a[i];
    }
    sort(a.begin(), a.end());

    int min=MIN(a[0], 24-a[n-1]);
    for(i=1; i<n; i++) {
        min=MIN(min,a[i]-a[i-1]);
    }
    printf("%d\n", min);


    return 0;
}

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

int main() {
 int a;
  cin >> a;
 long int b[a];
 long long int count = 0;
 for(int i = 0;i<a;i++){
   cin >> b[i];
 }
  for(int i = 1;i<a;i++){
    if(b[i-1]>b[i]){
      count += b[i-1]-b[i];
      b[i]=b[i-1];
    }
  }
    cout << count << endl;
}

Measured memory_bytes: 5192
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
using namespace std;
#define f(i,n) for(int i=0;i<int(n);i++)

int gru(int x, int k){
	if (x < k)return 0;
		int y = x / k;
		int z = (x%k) % (y+1);
		if (z == 0)return y;
		else return gru(y*(k - 1) + z - 1, k);
}

int main(){
	int n, k, x, s, ans;
	ans = 0;
	scanf("%d", &n);
	f(i, n){
		scanf("%d %d", &x,&k);
		s = gru(x, k);
		ans = ans^s;
	}
	if(ans==0)printf("Aoki\n");
	else printf("Takahashi\n");
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vii = vector<vi>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const int INF = 2e9;
template<class T> void print(const T& t){ cout << t << endl; }
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 gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
  ll n;
  cin >> n;
  vi b(n - 1);
  rep(i,n-1){
    cin >> b[i];
  }
  b.pb(INF);
  ll ans = b[0];
  for (ll i = 1; i < n;i++){
    ans += min(b[i], b[i - 1]);
  }
  print(ans);
}

Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <cmath>
#include <limits>
#include <stdio.h>
#include <iomanip>
#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
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
ll Max(ll(a), ll(b), ll(c)) {
	return max(max(a, b), c);
}
ll Min(ll(a), ll(b), ll(c)) {
	return min(min(a, b), c);
}





int main() {

	ll N, D, an = 0;;
	cin >> N>>D;
	rep(i, N) {
		ll X, Y;
		cin >> X >> Y;
		if (X * X + Y * Y <= D * D)an++;
	}

		cout << an << endl;
	

}


Measured memory_bytes: 3616
use std::io::*;
use std::str::FromStr;

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

pub fn read_n<T: FromStr>(n: usize) -> Vec<T> {
    read_n_logic::<T>(n, vec![])
}

pub fn read_n_logic<T: FromStr>(n: usize, mut a: Vec<T>) -> Vec<T> {
    match n {
        0 => a,
        _ => {
            a.push(read::<T>());
            read_n_logic(n - 1, a)
        }
    }
}
use std::cmp::{max, min};

fn main() {
    let n: usize = read();
    let x: Vec<i64> = read_n(n);
    let mut avg: f64 = 0.0;

    let mut ans = 0;
    for i in 0..x.len() {
        let xi = x[i];
        avg += xi as f64;
    }

    avg = avg / x.len() as f64;
    let point: i64 = avg.round() as i64;

    for i in 0..x.len() {
        let xi = x[i];
        ans += (point - xi).pow(2)
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

struct Edge {
  int v, c;
};

i64 n, m, p;
vector<vector<Edge>> g, rg, h;
vector<bool> inc_f, inc_r;

template<class T, class U>
void dfs(int u, const T& g, U& b) {
  if (b[u]) return;
  b[u] = true;
  for (Edge e : g[u]) dfs(e.v, g, b);
}

int main() {
  cin >> n >> m >> p;
  init_n(g, n + 1);
  init_n(rg, n + 1);
  for (int i = 0; i < m; ++i) {
    int a, b, c;
    cin >> a >> b >> c;
    g[a].push_back({ b, c });
    rg[b].push_back({ a, c });
  }
  init_n(inc_f, n + 1);
  init_n(inc_r, n + 1);
  dfs(1, g, inc_f);
  dfs(n, rg, inc_r);
  init_n(h, n + 1);
  for (int u = 1; u <= n; ++u) {
    if (inc_f[u] && inc_r[u]) {
      for (Edge e : g[u]) {
        if (inc_f[e.v] && inc_r[e.v]) h[u].push_back(e);
      }
    }
  }

  bool upd = false;
  vector<i64> scr(n + 1, -(1ll << 60));
  scr[1] = 0;
  for (int i = 0; i <= 2 * n; ++i) {
    upd = false;
    for (int u = 1; u <= n; ++u) {
      for (Edge e : h[u]) {
        i64 s = scr[u] + e.c - p;
        if (s > scr[e.v]) {
          scr[e.v] = s;
          upd = true;
        }
      }
    }
  }

  if (upd) cout << -1 << endl;
  else cout << max(i64(0), scr[n]) << endl;
  return 0;
}


Measured memory_bytes: 896
n = gets.to_i


arr1 = gets.split.map(&:to_i)

arr2 = Array.new(100001,0)
arr3 = Array.new(100001,0)

i = 0
(n/2).times{
  arr2[arr1[i]-1]+=1
  i+=1 
  arr3[arr1[i]-1]+=1
  i+=1
}

max1 = arr2.max
max2 = arr3.max

atmax1 = arr2.index(max1)
atmax2 = arr3.index(max2)

arr2[atmax1] = 0
arr3[atmax2] = 0

max3 = arr2.max
max4 = arr3.max


if max1>max3 && max2>max4 && atmax1 == atmax2
    puts [n-max1-max4,n-max2-max3].min
    
else
    puts n-max1-max2
    
end






Measured memory_bytes: 9612
require "prime"
q=gets.to_i
a=[0]
pr=[0]*(10**5+1)
prime=Prime.each(10**5).to_a
prime.each do |pp|
  pr[pp]=1
end
1.upto(10**5) do |i|
  if pr[i]==1&&pr[(i+1)/2]==1
    a[i]=a[i-1]+1
  else
    a[i]=a[i-1]
  end
end
q.times do
  l,r=gets.split.map(&:to_i)
  puts a[r]-a[l-1]
end


Measured memory_bytes: 5044
N = int(input())
A = list(map(int,input().split()))
Q = int(input())
BC = list(list(map(int,input().split())) for _ in range(Q))

total = sum(A)

li = [0] * 100000
for i in range(N):
  li[A[i] - 1] += 1

for i in range(Q):
  j = BC[i][0]
  k = BC[i][1]
  if li[j - 1] > 0:
    li[k - 1] += li[j - 1]
    total += li[j - 1] * (k - j)
    li[j - 1] = 0
  print(total)

Measured memory_bytes: 32240
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE BangPatterns #-}

import Control.Applicative
import Control.Monad
import Control.Arrow
import Data.List
import Data.Maybe
import Data.Char
import qualified Data.ByteString.Char8 as B
import Text.Printf

readInt = ( readLn :: IO Int )
readInts = map ( read :: String -> Int ) . words <$> getLine

getList = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

main = do
	[ n, k ] :: [Integer] <- map read . words <$> getLine
	print $ k * ( k - 1 )^( n - 1 )


Measured memory_bytes: 508
#include <cstdio>
#include <cctype>
#include <cstring>

//User's Lib

#include <algorithm>

using namespace std;

char buf[11111111], *pc = buf;

struct Main_Guard{
    Main_Guard(){
        #ifndef ONLINE_JUDGE
        // freopen("in.in", "r", stdin);
        #endif
        fread(buf, 1, 11111111, stdin); 
    }
    ~ Main_Guard(){
        fclose(stdin), fclose(stdout);
    }
};

static inline int read(){
    int num = 0;
    char c, sf = 1;
    while(isspace(c = *pc++));
    if(c == 45) sf = -1, c = *pc ++;
    while(num = num * 10 + c - 48, isdigit(c = *pc++));
    return num * sf;
}

namespace LKF{
    template <typename T>
    extern inline T abs(T tar){
        return tar < 0 ? -tar : tar;
    }
    template <typename T>
    extern inline void swap(T &a, T &b){
        T t = a;
        a = b;
        b = t;
    }
    template <typename T>
    extern inline void upmax(T &x, const T &y){
        if(x < y) x = y;
    }
    template <typename T>
    extern inline void upmin(T &x, const T &y){
        if(x > y) x = y;
    }
    template <typename T>
    extern inline T max(T a, T b){
        return a > b ? a : b;
    }
    template <typename T>
    extern inline T min(T a, T b){
        return a < b ? a : b;
    }
}

//Source Code

//我们发现由于每一个位置必须有数，所以必定会少枚举一维

const int MAXN = 303;
const int MODS = 1000000007;

int n, m, nowm;

struct Limit{
    int l, r, x;
    Limit(){}
    Limit(const int &_l, const int &_r, const int &_x) : l(_l), r(_r), x(_x) {}
    inline bool operator < (const Limit &tar) const {
        return r == tar.r ? l < tar.l : r < tar.r;
    }
}limt[MAXN];

int dp[MAXN][MAXN][MAXN];

inline void Mod(int &a){
    if(a >= MODS) a -= MODS;
}

int main(){
    Main_Guard main_guard;
    n = read(), m = read();
    for(int i = 1; i <= m; i++){
        limt[i].l = read(), limt[i].r = read(), limt[i].x = read();
    }
    sort(limt + 1, limt + 1 + m);
    nowm = 1;
    dp[0][0][0] = 1;
    for(int i = 1; i <= n; i++){
        for(int r = 0; r < i; r++)
            for(int g = 0; g < i; g++)
                for(int b = (r < i - 1 && g < i - 1) ? i - 1 : 0; b < i; b++){
                    int tmp = dp[r][g][b];
                    Mod(dp[i][g][b] += tmp);
                    Mod(dp[r][i][b] += tmp);
                    Mod(dp[r][g][i] += tmp);
                }
        for(; nowm <= m && limt[nowm].r == i; nowm ++)
            for(int r = 0; r <= i; r++)
                for(int g = 0; g <= i; g++)
                    for(int b = (r < i && g < i) ? i : 0; b <= i; b++)
                        if((r >= limt[nowm].l) + (g >= limt[nowm].l) + (b >= limt[nowm].l) != limt[nowm].x)
                            dp[r][g][b] = 0;
    }
    int ans = 0;
    for(int r = 0; r <= n; r++)
        for(int g = 0; g <= n; g++)
            for(int b = (r < n && g < n) ? n : 0; b <= n; b++)
                Mod(ans += dp[r][g][b]);
    printf("%d\n", ans);
    return 0;
}

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

using namespace std;

typedef long long ll;

static const int INTINF = (2147483647 >> 1); // 10^9 + 5000
static const ll LLINF = (9223372036854775807 >> 1);
static const int MAX = 1e5+1;
static const ll MOD = 1e9+7;

namespace Printer{
    template<class T>
    void print(T x){
        cout << x << endl;
    }

    template<class T>
    void print(T x, T y){
        cout << x << "," << y << endl;
    }

    template<class T>
    void print(vector<T> v){
        rep(i, v.size()){
            if(i) cout << " ";
            cout<< v[i];
        }
        cout << endl;
    }

    template<class T>
    void print(vector<vector<T> > vv){
        rep(i, vv.size()){
            rep(j, vv[i].size()){
                if(j) cout << " ";
                cout << vv[i][j];
            }
            cout << endl;
        }
    }

    void print(pair<int, int> p){
        cout << "(" << p.first << ", " << p.second << ")" << endl;
    }
};
using namespace Printer;

//--global--//



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

ll solve(ll n){
    if(n == 0) return 0;
    if(n == 1) return 1LL;
    return solve(n / 2) * 2 + 1;
}

int main(int argc, const char * argv[]) {
    //提出時、消す----//
    //--------------//

    ll n;
    cin >> n;
    cout << solve(n) << endl;
    
    
    return 0;
}


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


int main() {
long n;
cin >> n;
vector<long> a(n);

long long cnt[n];
long long ans[n];
long long tmp=0;

for(int i=0;i<n;i++){
    cin >> a.at(i);
    cnt[i]=0;
}
for(int i=0;i<n;i++){
    cnt[a.at(i)-1]++;
}

for(int i=0;i<n;i++){
    if(cnt[a[i]-1]==0){ans[i]==0;}
    else{ans[i]=(cnt[a[i]-1]-1)*(cnt[a[i]-1]-2)/2;}
    tmp+=(cnt[i])*(cnt[i]-1)/2;
    
}
for(int i=0;i<n;i++){
    cout << tmp - (cnt[a[i]-1])*(cnt[a[i]-1]-1)/2 + ans[i] << endl;
}
}



Measured memory_bytes: 7296
#include<stdio.h>

int main(){
    int N, L[20];
    int i, max=0, sum=0;

    scanf("%d", &N);

    for(i=0; i<N; i++){
        scanf("%d", &L[i]);
        sum += L[i];
        if(L[i]>max){
            max = L[i];
        }
    }
    if(max<(sum-max)){
        printf("Yes");
    }else{
        printf("No");
    }
    return 0;
}

Measured memory_bytes: 128
N, K = map(int, input().split())
*A, = map(int, input().split())

b = 1 << 63
X = 0
ans = 0
for i in range(64):
    cnt = 0
    for a in A:
        if a & b:
            cnt += 1
    if N >= cnt*2 and (X ^ b) <= K:
        X ^= b
        ans += (N - cnt) * b
    else:
        ans += cnt * b
    b >>= 1
print(ans)

Measured memory_bytes: 14620
#include<algorithm>
#include<cstdio>
#include<iostream>

#define debug(...) fprintf(stderr,__VA_ARGS__)

#define lson u<<1,l,mid
#define rson u<<1|1,mid+1,r

using namespace std;

namespace fastIO
{
	inline char nc()
	{
		return getchar();
		static char buf[100000],*l=buf,*r=buf;
		return l==r&&(r=(l=buf)+fread(buf,1,100000,stdin),l==r)?EOF:*l++;
	}
	template<class T> void rd(T &x)
	{
		x=0;int f=1,ch=nc();
		while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=nc();}
		while(ch>='0'&&ch<='9'){x=x*10-'0'+ch;ch=nc();}
		x*=f; 
	}
} 
using namespace fastIO;

const int mod=1e9+7;
inline int add(int x)
{
	return x>=mod?x-mod:x;
}

const int maxn=1e5+50;
const int maxm=1e5+50;

const int maxnode=maxn<<2;

int N,M;
int x[maxn],y[maxm];

namespace seg
{
	int sum[maxnode];
	inline void pushup(int u)
	{
		sum[u]=add(sum[u<<1]+sum[u<<1|1]);
	}
	void build(int u,int l,int r)
	{
		if(l==r)
		{
			sum[u]=0;
			return;
		}
		int mid=(l+r)>>1;
		build(lson);
		build(rson);
		pushup(u);
	}
	void update(int u,int l,int r,int qp,int qv)
	{
		if(l==r)
		{
			sum[u]=qv;
			return;
		}
		int mid=(l+r)>>1;
		if(qp<=mid) update(lson,qp,qv);
		else update(rson,qp,qv);
		pushup(u);
	}
	int query(int u,int l,int r,int ql,int qr)
	{
		if(l==ql&&r==qr)
		{
			return sum[u];
		}
		int mid=(l+r)>>1;
		if(qr<=mid) return query(lson,ql,qr);
		else if(ql>mid) return query(rson,ql,qr);
		else
		{
			int L=query(lson,ql,mid);
			int R=query(rson,mid+1,qr);
			return add(L+R);
		}
	}
}

int H[maxn];
void hash_init(int *a,int n,int &p)
{
	p=0;
	for(int i=1;i<=n;++i)
	{
		H[++p]=a[i];
	}
	sort(H+1,H+p+1);
	p=unique(H+1,H+p+1)-H-1;
	for(int i=1;i<=n;++i)
	{
		a[i]=lower_bound(H+1,H+p+1,a[i])-H;
	}
}

int n;
int pa,pb;
int a[maxn],b[maxn];
int ord[maxn];
inline int cmp(const int &x,const int &y)
{
	if(a[x]!=a[y]) return a[x]<a[y];
	return b[x]>b[y];
}
void init()
{
	int i=1,j=1;
	while(i<=N&&x[i]<y[j])
	{
		++i;
	}
	while(i<=N)
	{
		while(j<M&&x[i]>y[j+1])
		{
			++j;
		}
		if(j==M) return;
		++n;
		a[n]=x[i]-y[j];
		b[n]=y[j+1]-x[i];
		++i;
	}
}
int solve()
{
	init();
	if(n==0) return 1;
	hash_init(a,n,pa);
	hash_init(b,n,pb);
	for(int i=1;i<=n;++i)
	{
		ord[i]=i;
	}
	sort(ord+1,ord+n+1,cmp);
	seg::build(1,0,pb);
	seg::update(1,0,pb,0,1);
	for(int i=1;i<=n;++i)
	{
		int x=ord[i],y=ord[i-1];
		if(a[x]==a[y]&&b[x]==b[y]) continue;
		seg::update(1,0,pb,b[x],seg::query(1,0,pb,0,b[x]));
//		debug("%d %d\n",a[x],b[x]);
//		for(int d=0;d<=pb;++d)
//		{
//			debug("%d ",seg::query(1,0,pb,d,d));
//		}
//		debug("\n");
	}
	return seg::sum[1];
}
int main()
{
	rd(N),rd(M);
	for(int i=1;i<=N;++i)
	{
		rd(x[i]);
	}
	for(int i=1;i<=M;++i)
	{
		rd(y[i]);
	}
	printf("%d\n",solve());
	return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

int main(){
    int n;
    cin >> n;
    vector<ll> a(3*n);
    for(int i = 0; i < 3*n; i++){
        cin >> a[i];
    }

    vector<ll> front_sum(n+1);
    vector<ll> rear_sum(n+1);

    priority_queue<ll, vector<ll>, greater<ll>> front;
    priority_queue<ll> rear;
    ll tmp_front_sum = 0, tmp_rear_sum = 0;
    for(int i = 0; i < n; i++){
        front.push(a[i]);
        tmp_front_sum += a[i];
        rear.push(a[2*n+i]);
        tmp_rear_sum += a[2*n+i];
    }
    front_sum[0] = tmp_front_sum;
    rear_sum[n] = tmp_rear_sum;
    for(int i = 0; i < n; i++){
        front.push(a[n+i]);
        tmp_front_sum += a[n+i];
        tmp_front_sum -= front.top();
        front.pop();
        front_sum[i+1] = tmp_front_sum;
        rear.push(a[2*n-1-i]);
        tmp_rear_sum += a[2*n-1-i];
        tmp_rear_sum -= rear.top();
        rear.pop();
        rear_sum[n-1-i] = tmp_rear_sum;
    }

    ll ans = -99999999999999;
    for(int i = 0; i < n+1; i++){
        ans = max(ans, front_sum[i] - rear_sum[i]);
    }

    cout << ans << endl;
    return 0;

}


Measured memory_bytes: 5996
/*
	Name:
	Author: xiaruize
	Date:
*/

#include<algorithm>
#include<bitset>
#include<cctype>
#include<cerrno>
#include<clocale>
#include<cmath>
#include<complex>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<utility>
#include<vector>
#include<cwchar>
#include<cwctype>
using namespace std;
#define ull unsigned long long
#define MOD 1000000007
#define ALL(a) (a).begin(), (a).end()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define ll long long
#define form(i,j,n) for(int i=int(j);i<=int(n);i++)
#define pb push_back
#define mk make_pair
#define pii pair<int,int>
#define pis pair<int,string>
#define sec second

inline int read()
{
    char ch=getchar();
    int x=0,f=1;
    while(ch<'0'||ch>'9'){if(ch=='-') f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9') x=x*10+(ch^48),ch=getchar();
    return x*f;
}

int main()
{
 	ios::sync_with_stdio(false);
	cin.tie(0);
 	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	double r;
	cin>>r;
	cout<<r*2*3.1415926<<endl;
	return 0;
}

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

int main(){
  char a,b,c,d;
  int i,res=0;
  cin >> a >> b >> c >> d;
  
  if(a==b){
    if(c==d){
      if(a!=c){
      res=1;
      }
    }
  }
  if(a==c){
    if(b==d){
      if(a!=b){
      res=1;
      }
    }
  }
  if(a==d){
    if(c==b){
      if(a!=c){
      res=1;
      }
    }
  }

  if(res==0){
    cout << "No" <<endl;
  }else{
    cout << "Yes" <<endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
ostream& operator<<(ostream &out, string str) {
	for(char c : str) out << c;
	return out;
}
 
template<class L, class R> ostream& operator<<(ostream &out, pair<L, R> p) {
	return out << "(" << p.first << ", " << p.second << ")";
}
 
template<class T> auto operator<<(ostream &out, T a) -> decltype(a.begin(), out) {
	out << "{";
	for(auto it = a.begin(); it != a.end(); it = next(it))
		out << (it != a.begin() ? ", " : "") << *it;
	return out << "}";
}
 
void dump() { cerr << "\n"; }
template<class T, class... Ts> void dump(T a, Ts... x) {
	cerr << a << ", ";
	dump(x...);
}
 
#ifdef DEBUG
#  define debug(...) cerr << "[" #__VA_ARGS__ "]: ", dump(__VA_ARGS__)
#else
#  define debug(...) false
#endif
 
#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define ST first
#define ND second
 
template<class T> int size(T && a) { return a.size(); }
 
using LL = long long;
using PII = pair<int, int>;
 
mt19937 _gen(chrono::system_clock::now().time_since_epoch().count());
int rd(int a, int b) {
	return uniform_int_distribution<int>(a, b)(_gen);
}
 
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	int n, k, q;
	cin >> n >> k >> q;

	vector<int> score(n, k - q);
	REP(i, q) {
		int a;
		cin >> a;
		score[a - 1]++;
	}

	REP(i, n) {
		if(score[i] >= 1)
			cout << "Yes\n";
		else
			cout << "No\n";
	}
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
const int N = 100;
typedef long long ll;
string s[N];
int t[N];
int main() {
    int n;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        cin >> s[i] >> t[i];
    }
    string tmp;
    cin >> tmp;
    int pos = -1;
    for (int i = 1; i <= n; i++) {
        if (s[i] == tmp) {
            pos = i;
            break;
        }
    }
    ll ans = 0;
    for (int i = pos + 1; i <= n; i++) {
        ans += t[i];
    }
    printf("%lld\n", ans);
    return 0;
}

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

int main(){
  
  int n;
  cin >> n;
  int digit = n % 10;
  
  if (digit == 2 || digit == 4 || digit == 5 || digit == 7 || digit == 9){
    cout << "hon";
  }
  else if (digit == 0 || digit == 1 || digit == 6 || digit == 8){
    cout << "pon";
  }
  else{
    cout << "bon";
  }
  return 0;
}

Measured memory_bytes: 3616
import java.io.*;
class Main
{
    public static void main(String args[])throws IOException
    {
	BufferedReader input=new BufferedReader(new InputStreamReader(System.in));
	String str=input.readLine();
	String str_ary[]=str.split(" ");
	
	int a[]=new int[str_ary.length];
	for(int i=0;i<str_ary.length;i++)
	    {
		for(int j=0;j<str_ary.length;j++)
		    {
			if(str_ary[i].equals(str_ary[j]))a[i]++;
		    }
	    }
	int max=0;

	int i;
	
	for(i=0;i<a.length;i++)
	    {
		if(max<a[i])max=i;
	    }
	int x=0;
	int y=0;
	int b[]=new int[str_ary.length];
	for(int j=0;j<str_ary.length;j++)
	    {
		b[j]=str_ary[j].length();
		if(x<b[j])
		    {
			x=b[j];
			y=j;
		    }
	    }
	
	
	System.out.println(str_ary[max]+" "+str_ary[y]);
    }
}

Measured memory_bytes: 16888
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;
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; }

vector<ll>  divisor(ll n){
	vector<ll> a;
	for(ll i = 1; i*i <= n; i++) {
		if (n % i == 0){
			a.pb(i);
			if (i != n/i){
				a.pb(n/i);
			}
		}
	}
	return a;
} 

map<ll,ll> prime_factor(ll n){
	map<ll,ll> res;
	for(ll i = 2; i * i  <= n; i++) {
		while(n % i == 0){
			res[i]++;
			n /= i;
		}
	}
	if (n != 1){
		res[n] = 1;
	}
    return res;
}
int main(){ll ans = 0;
	ll n;cin>>n;
	vector<ll> a = divisor(n);
	sort(ALL(a));
	for(int i = 0; i < a.size(); i++) {
		// cout << a[i] << endl;
		map<ll,ll> m = prime_factor(a[i]);
		if (m.size() == 1){
			ll div = 1;
			for(auto it = m.begin();it != m.end();it++) {
				// cout << it-> fs << " " << it -> sc << endl;
				div *= pow(it->fs,it->sc);
			}
			if (n % div == 0){
				n /= div;
				ans++;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end())
#define vdelete(v) (v).erase(unique(all(v)), (v).end())
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1000000007
#define INF 9223372036854775807

int x,y,z,k,a[1000],b[1000],c[1000];
vector<int> hoge,ans;

signed main() {
    cin >> x >> y >> z >> k;
    rep(i,x) cin >> a[i];
    rep(i,y) cin >> b[i];
    rep(i,z) cin >> c[i];
    rep(i,x) rep(j,y) hoge.pb(a[i]+b[j]);
    sort(rall(hoge));
    rep(i,min(k,(int)hoge.size())) rep(j,z) ans.pb(hoge[i]+c[j]);
    sort(rall(ans));
    rep(i,k) cout << ans[i] << endl;
}


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

int main(){
  int N;
  cin>>N;
  vector<string> W(N);
  for(int i=0; i<N; ++i) cin>>W.at(i);
  bool can=true;
  for(int i=0; i<N-1; ++i){
    
    if(W.at(i).back() != W.at(i+1).front()){
      can=false;
      break;
    }
    
    for(int j=1; j<N; ++j){
      if(i!=j){
        bool AAA=false;
        AAA=equal(begin(W.at(i)), end(W.at(i)), begin(W.at(j)), end(W.at(j)));
        if(AAA){
          can=false;
          break;
        }
      }
    }
    
  }
  
  if(can) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int r = sc.nextInt();
		int c = sc.nextInt();
		int arr[][] = new int[r + 1][c + 1];

		// ????????????
		for (int i = 0; i < r; i++) {
			for (int j = 0; j < c; j++) {
				arr[i][j] = sc.nextInt();
			}
		}

		// ????¨?
		for (int i = 0; i < r; i++) {
			for (int j = 0; j < c; j++) {
				arr[i][c] += arr[i][j];
			}
		}
		for (int i = 0; i <= c; i++) {
			for (int j = 0; j < r; j++) {
				arr[r][i] += arr[j][i];
			}
		}

		// ????????????
		for (int i = 0; i <= r; i++) {
			for (int j = 0; j <= c; j++) {
				if (j != c) {
					System.out.print(arr[i][j] + " ");
				} else {
					System.out.println(arr[i][j]);
				}
			}
		}

	}

}

Measured memory_bytes: 42580
#include<iostream>
#include<iomanip>
#include<cstring>
#include<cmath>
#include<bits/stdc++.h>
using namespace std;
char a1[5271720];
long long int n,a[71720],lsbl1,lsbl2,sum,sumend,m,i,j;
bool cmp(int a,int b)
{
    return a>b;
}
int main()
{
    /*cin>>n;
    for(i=1;i<=n;i++)
        cin>>a[i],sum+=a[i];
    //for(i=1;i<=n;i++)
       // sum+=a[i];
    cin>>m;
    while(m--)
    {
        cin>>lsbl1>>lsbl2;
        sumend+=(sum-a[lsbl1]+lsbl2);
        cout<<sumend<<endl;
    }*/
    cin>>a1;
    int la=strlen(a1);
    for(i=0;i<=la-1;i++)
    {
        if(lsbl1==lsbl2)
        {
            lsbl1++; 
            if(a1[i]=='p') 
                sum--;
            continue;
        }
        lsbl2++;
        if(a1[i]=='g')
            sum++;
    }
    sumend+=sum;
    cout<<sumend<<endl;
    return 0;
}

Measured memory_bytes: 384