akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

const int MOD = 1000000007;

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

    vector<vector<int> > v(2);
    for(int i=0; i<2; ++i){
        v[i].resize(n[i]);
        for(int j=0; j<n[i]; ++j)
            cin >> v[i][j];
    }

    long long ans = 1;
    for(int i=0; i<2; ++i){
        long long tmp = 0;
        for(int j=1; j<n[i]; ++j){
            long long a = v[i][j] - v[i][j-1];
            a *= j;
            a %= MOD;
            a *= n[i] - j;
            a %= MOD;
            tmp += a;
            tmp %= MOD;
        }
        ans *= tmp;
        ans %= MOD;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>

int squ(int d){
	int i,S=0;
	for(i=1; i*d<600;i++)
		S +=d*(i*d)*(i*d);
	return (S);
}

int main(void){
	int d,S;

	while(scanf("%d", &d) != EOF){
	S=squ(d);
	printf("%d\n", S);
	};
	return (0);
}

Measured memory_bytes: 596
#include <cstdio>
#include <iostream>
#include <vector>
#include <string>

using namespace std;

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

    vector<string> s(h);

    for(int i = 0; i < s.size(); i++) cin >> s[i];

    int flag = 0; //[w][n][s][e]
    for(int i = 0; i < s.size(); i++){
        for(int j = 0; j < w; j++){
            if(s[i][j] == '#'){
                if(0 < j && s[i][j - 1] == '.') flag |= 0b1000;
                if(0 < i && s[i - 1][j] == '.') flag |= 0b0100;
                if(i < h - 1 && s[i + 1][j] == '.') flag |= 0b0010;
                if(j < w - 1 && s[i][j + 1] == '.') flag |= 0b0001;
            }

            if(flag == 0b1111) break;
            else flag = 0;
        }

        if(flag == 0b1111) break;
    }

    if(flag == 0b1111) printf("No\n");
    else printf("Yes\n");

    return 0;
}


Measured memory_bytes: 256
s=input()
D=["AKIHABARA","KIHABARA","AKIHBARA","AKIHABRA","AKIHABAR","AKIHABR","AKIHBAR","KIHABAR","AKIHBRA","KIHABRA","KIHBARA","KIHBRA","KIHBAR","KIHABR","AKIHBR","KIHBR"]
if s in D:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
const int N = 100001;
vector<int> adj[N];
vector<bool> visited(N);
vector<int> dp(N,0);
void dfs(int cur_node)
{
	visited[cur_node] = true;
	for(int i=0;i<(int)adj[cur_node].size();i++){
		int next_node = adj[cur_node][i];
		if(!visited[next_node])
			dfs(next_node);
		dp[cur_node] = max(dp[cur_node],1+dp[next_node]);
	}
}
int main()
{
	int nodes,edges;
	cin >> nodes >> edges;
	for(int i=0;i<edges;i++){
		int x,y;
		cin >> x >> y;
		adj[x].push_back(y);
	}
	for(int i=1;i<=nodes;i++){
		if(!visited[i])
			dfs(i);
	}
	int answer = 0;
	for(int i=1;i<=nodes;i++)
		answer = max(answer,dp[i]);
	cout << answer << "\n";
}

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

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

	string ans = "No";
	int a[3];
	int b[3];
	for( int ii = 0; ii <= 100; ii++ ) {
		a[0] = ii;
		for( int jj = 0; jj <= 100; jj++ ) {
			a[1] = jj;
			for( int kk = 0; kk <= 100; kk++ ) {
				a[2] = kk;
				int flag = 0;
				for( int i = 0; i < 3; i++ ) {
					for( int j = 0; j < 3; j++ ) {
						if( i == 0 ) b[j] = c[i][j] - a[i];
						else if( c[i][j] != a[i] + b[j] ) {
							flag = 1;
							break;
						}
					}
					if( flag ) break;
				}
				if( flag == 0 ) {
					ans = "Yes";
					break;
				}
			}
			if( ans == "Yes" ) break;
		}
		if( ans == "Yes" ) break;
	}

	cout << ans << endl;
}


Measured memory_bytes: 3628
<?php

while (true) {
    fscanf(STDIN, '%d %d', $height, $width);
    if ($height == 0 && $width == 0) break;
    
    $rentangle = new Rectangle($height, $width);
    $rentangle->draw();
    Drawer::drawEmptyLine();
    
}

class Rectangle
{
    private $height;
    private $width;
    private $char = '#';
    
    public function __construct($height, $width)
    {
        $this->height = $height;
        $this->width  = $width;
    }
    
    public function draw()
    {
        for ($i = 0; $i < $this->height; $i++) {
            $this->drawLine($this->width, $this->char);
        }
    }
    
    public function drawLine()
    {
        echo str_repeat($this->char, $this->width), PHP_EOL;
    }
}

class Drawer
{
    public static function drawEmptyLine()
    {
        echo PHP_EOL;
    }
}

Measured memory_bytes: 15360
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  string s;
  cin >> s;
  string t = "";
  rep(i,sz(s)){
    if(s[i] =='B'){
      if(sz(t))t.pop_back();
    }
    else t.push_back(s[i]);
  }
  print(t);
  return 0;
}

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

int main() {
    int n, m;
    cin >> n >> m;
    int a[m], b[m];
    for (int i = 0; i < m; i++)
        cin >> a[i] >> b[i];
    vector<int> v(n + 1, 0);
    for (int i = 0; i < m; i++) {
        v[a[i]]++;
        v[b[i]]++;
    }
    for (int i = 1; i <= n; i++) {
        cout << v[i] << endl;
    }
    return 0;
}

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

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

    vector<int> A(N);
    int sum = 0;
    for (int &a : A)
    {
        cin >> a;
        sum += a;
    }
    sort(A.begin(), A.end());
    int ans = 0;
    for (int a : A)
    {
        if (4 * M * a >= sum)
        {
            ans++;
        }
    }
    if (ans >= M)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i < n + 1; i++)
#define PI 3.14159265359
#define EPS 0.0000000001
#define MOD 1000000007
//cout << std::fixed << std::setprecision(15) << y << endl;


int main(){
    ll N;
    ll D, X;
    cin >> N >> D >> X;

    ll A;
    rep(i, N){
        cin >> A;
        X += (D - 1) / A + 1;
    }

    cout << X << endl;

    return 0;
}

Measured memory_bytes: 3592
/* 
	今日も一日がんばるぞい
*/
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define ALL(v) (v.begin(),v.end())
#define COUT(x) cout<<(x)<< '\n'

int main(){
    int n;
    cin >> n;
    int a[n];//ソートするやつ
    vector<int> v;
    REP(i,n){
        scanf("%d",&a[i]);
        v.push_back(a[i]);
    }
    sort(v.begin(),v.end());
    int num1 = v[(n-1)/2];
    int num2 = v[n/2];
    REP(i,n){
        if(a[i]<=num1)COUT(num2);
        else COUT(num1);
    }
    return 0;
}


Measured memory_bytes: 3828
#include <iostream>
#include <cmath>

int main(void){
    int N;
    double X;
    std::cin >> N;


    X = N / 1.08;

    if( ceil(X) == floor(X) ){
        std::cout << X << std::endl;
        return 0;
    }
    if(((int)floor(X*10) % 10) == 0){
        std::cout << ":(" << std::endl;
        return 0;
    }
    std::cout << trunc(X)+1<< std::endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <tr1/unordered_map>
using namespace std;

int n , v[20];

tr1::unordered_map<int,int> memo[20];

int f(int pos , int sum){
	return pos == n ? abs(sum) : memo[pos].count(sum) ? memo[pos][sum] : memo[pos][sum] = min( f(pos+1,sum+v[pos] ) , f(pos+1,abs(sum-v[pos])) );
}

int main(){
	while(scanf("%d\n",&n)&& n){
		for(int i = 0 ; i < n ; i++) scanf("%d",&v[i]) , memo[i].clear() ;
		printf("%d\n",f(0,0));
	}
}

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

int gcd(int a, int b)
{
        if (b == 0) return a;
        else {
                return gcd(b, a%b);
        }
}

int main()
{

        int K;
        cin >> K;
        vector<int> ab;
        for (int i = 1; i <= K; ++i) {
                for (int j = 1; j <= K; ++j) {
                        ab.push_back(gcd(i, j));
                }
        }
        vector<int> ans;
        int len = ab.size();
        for (int i = 0; i < len; ++i) {
                for (int j = 1; j <= K; ++j) {
                        ans.push_back(gcd(ab[i], j));
                }
        }
        len = ans.size();
        int A = 0;
        for (int i = 0; i < len; ++i) {
                A += ans[i];
        }
        cout << A << endl;




}


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

int main(){

    int n;
    cin >> n;

    vector<string> s(n);

    rep(i,n)cin >> s[i];

    rep(i,n){
        if(s[i]=="Y"){
            cout << "Four" << endl;
            return 0;
        }
    }
    cout << "Three" << endl;


    return 0;
}

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

using namespace std;


//二項係数ライブラリ
const int MAX = 1000000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
//前処理COMinit()忘れずに


void solve() {
    int N, K; cin >> N >> K;
    vector<int> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];

    COMinit();

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

    long long ans = 0;

    for (int i = 0; i < N; i++) {
        long long plus, minus;

        if (i < K-1) plus = 0;
        else plus = COM(i, K-1);
        if (i >= N - K + 1) minus = 0;
        else minus = COM(N-1-i, K-1);

        ans += A[i] * (plus - minus);
        if (ans < 0) ans += MOD;
        ans %= MOD;
    }

    cout << ans << endl;
}


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

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

#define int                 long long
#define pb                  push_back
#define all(v)              v.begin(),v.end()
#define INF                 (int)1e14
#define speed               ios_base::sync_with_stdio(false);cin.tie(NULL);cout.flush()
#define MOD                 (int)(998244353)
#define fi                  first
#define se                  second
#define sq(a)               a*a
#define ld                  long double
#define Error(x)            cout<< #x << " = " << (x) <<endl;
#define Error2(a,b)         cout<<"( "<<#a<<" , "<<#b<<" ) = ( "<<(a)<<" , "<<(b)<<" )\n";
#define Error3(a,b,c)       cout<<"("<<#a<<" , "<<#b<<" , "<<#c<<" ) = ( "<<(a)<<" , "<<(b)<<" , "<<(c)<<")\n";
#define Error4(a,b,c,d)     cout<<"("<<#a<<" , "<<#b<<" , "<<#c<<" , "<<#d<<" ) = \
                            ( "<<(a)<<" , "<<(b)<<" , "<<(c)<<" , "<<(d)<<")\n";
#define popcount            __builtin_popcountll
#define ign                 cin.ignore(numeric_limits<streamsize>::max(),'\n')
#define PI                  acos(-1.0)

int abso(int a) { return a>0 ? a : (-a); }
int cdiv(int a,int b) { return a/b + ( (a%b) > 0 ); }
int mul(int a,int b) { int res=0; while(b){ if(b&1) res=(res+a)%MOD; a=(a+a)%MOD; b=b/2; } return res; }
int bexp(int a,int b) { int res=1; while(b){ if(b&1) res=mul(res,a); a=mul(a,a); b=b/2; } return res; }
int inv(int a) { return bexp(a,MOD-2); }

int power(int a,int b) {
    int res=1;
    while(b) {
        if(b&1)
            res=res*a;
        a=a*a;
        b=b>>1;
    }
    return res;
}

void solve() {
    int cnt=0;
    int n;
    cin>>n;
    string str;
    for(int i=1;i<=n;i++) {
        string temp=to_string(i);
        if(temp.size()%2==1) {
            cnt++;
        }
    }
    cout<<cnt<<"\n";
}

signed main() {
    speed;
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    //cin>>t;
    while(t--) {
        solve();
    }
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);
#endif

#define FILE_IO freopen("input.txt","r",stdin)
#define int long long
#define f first
#define s second
#define endl '\n'
#define all(c) c.begin(),c.end()
#define bp __builtin_popcount
#define debug(x) cerr << #x << " = " << x << endl;

const int MOD = 1e9 + 7;
const int INF = 1e18;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>void print(T t){for(auto &it : t)cout<<it<<" ";}
inline int powerexp(int a, int b, int m = MOD){ int res = 1;while(b){if(b&1)res = res * a % m;a = a * a % m,b >>= 1;}return res % m;}
inline int modinv(int a){ return powerexp(a,MOD-2,MOD);}
inline int lcm(int a, int b){ int g = __gcd(a,b);return a/g*b;}
inline int add(int x, int y){ x += y; if (x >= MOD) x -=  MOD; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % MOD;}
inline int sub(int x, int y){ x -= y; if (x<0) x += MOD; return x ;}

//-------------------< start here >-------------------------// 

void solve(){
  int n, t;
  vector<int> v;
  cin >> n >> t;
  for(int i = 0; i < n; i++){
	  int x;
	  cin >> x;
	  v.push_back(x);  
	}
	int ret = t;
	for(int i = 0; i + 1 < n; i++){
	  ret += min(t, v[i + 1] - v[i]);	
	}
	cout << ret << endl;   
}

//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
   IOS;
   solve();
   //find();
   #ifdef LOCAL_DEFINE
   cerr << "time elapsed " << (double)clock()/CLOCKS_PER_SEC << endl;
   #endif
}


Measured memory_bytes: 2420
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

typedef long long  ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
 ll pd[1010];
int main() {
    ll n;
    ll mod=1e9+7;
    cin>>n;
    ll sum=1;
    ll cnt=0;
    for(int i=0;i<=n;i++) pd[i]=0;
    for(int i=2;i<=n;i++){
        for(int j=i+i;j<=n;j+=i){
            pd[j]=1;
        }
    }
    ll ans=1;
    for(int i=2;i<=n;i++){
        if(pd[i]==0){
            ll tot=0;
            for(int j=i;j<=n;j*=i){
                tot+=n/j;
            }
                ans=1ll*ans*(tot+1)%mod;
                ans%=mod;
            
        }   
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

long n , m , l;
long a[100][100] , b[100][100] , ab[100][100] = {0};

long func(long y , long x) {
	long i;
	for(i = 0; i < m; i++) {
		ab[y][x] += a[y][i] * b[i][x];
	}
}

long main () {
	long i , s , k;

	scanf("%ld %ld %ld" , &n , &m , &l);
	for(i = 0; i < n; i++) {
		for(s = 0; s < m; s++) {
			scanf("%ld" , &a[i][s]);
		}
	}
	for(i = 0; i < m; i++) {
		for(s = 0; s < l; s++) {
			scanf("%ld" , &b[i][s]);
		}
	}



	for(i = 0; i < n; i++) {
		for(s = 0; s < l; s++) {
			if (s > 0) printf(" ");
			func(i,s);
			printf("%ld" , ab[i][s]);
		}
		printf("\n");
	}

	return 0;
}

Measured memory_bytes: 836
import java.util.*;

public class Main {
  public static void main(String[] args) throws Exception {
  Scanner sc = new Scanner(System.in);
  int n = sc.nextInt();
  int []a = new int[n];
  for (int i = 0; i < n; i++) {
    a[i] = sc.nextInt();
  }
  int left = 2*n;
  int right = left+1;

  int [] b= new int[4*n];
  for (int i = 0; i < a.length; i++) {
    if(i%2==(n-1)%2){
      b[left]=a[i];
      left--;

    }else{
      b[right]=a[i];
      right++;
    }
  }
  for (int i = left+1; i < right; i++) {
    System.out.print(b[i]);
    System.out.print(" ");
  }
  }
}


Measured memory_bytes: 101740
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()
int dy[4] = {-1,0,1,0};
int dx[4] = {0,1,0,-1};
int Dy[8] = {-1,-1,0,1,1,1,0,-1};
int Dx[8] = {0,1,1,1,0,-1,-1,-1};
const int mod = 1000000007;
const int inf = mod*mod;
const int d5 = 100100;
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin>>s;
    int res=0;
    for(int i=0;i<6;i++){
        if(s[i]=='1')res++;
    }
    cout<<res<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <math.h>
#include <algorithm>
using namespace std;

int n = 0;

int main() {
	unsigned long long A, B, K;
	cin >> A >> B >> K;
	for (unsigned long long i = 0; i < K; i++) {
		n = 0;
	    if (i % 2 == 0) {
		    if (A % 2 != 0) A--;
		    n = A / 2;
		    A -= n; 
		    B += n;
	    }
	    else {
		    if (B % 2 != 0) B--;
		    n = B / 2;
		    A += n; 
		    B -= n;
	    }
	}
	cout << A << ' ' << B << endl;
	return 0;
}

Measured memory_bytes: 256
julia -E"n,s=[`dd`];A=3n;f(b,n)=n<b?n:f(b,n÷b)+n%b;g(b)=A>b>1&&f(b,n)==s?b:A;A=g(n+1);for b=1:isqrt(n);A=g(b);A=g((n-s)÷b+1);end;A>2n?-1:A"

Measured memory_bytes: 154768
#include <iostream>
#include <string>
#include <map>

using namespace std;

string today(int month, int day){
    string today;
    int startMonth=1, startDay=1, total=0;
    
    for(int i=startMonth; i<month; i++){
        switch(i){
            case 4:
            case 6:
            case 9:
            case 11:
                total += 30;
                break;
            
            case 1:
            case 3:
            case 5:
            case 7:
            case 8:
            case 10:
            case 12:
                total += 31;
                break;
            case 2:
                total += 29;
                break;
        }
    }
    total += day;
    //cout << total%7 << endl;
    
    switch(total%7){
        case 1:
            today = "Thursday";
            break;
        case 2:
            today = "Friday";
            break;
        case 3:
            today = "Saturday";
            break;
        case 4:
            today = "Sunday";
            break;
        case 5:
            today = "Monday";
            break;
        case 6:
            today = "Tuesday";
            break;
        case 0:
            today = "Wednesday";
            break;
    }
    
    
    return today;
}


int main (int argc, char const* argv[]){
    int month, day, n;
    
    cin >> month >> day;
    while(month!=0 && day!=0){
        
        cout << today(month,day)<< endl;
        cin >> month >> day;
    }
    return 0;
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
#define ll long long
#define int long long
#define debug(x) cerr << "\n" \
                      << #x << ": " << x << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define all(x) (x).begin(), (x).end()
#define INF 1e9
#define pii pair<int, int>
#define pt(xx) cout << "\n" \
                    << xx << "\n"
#define debugv(x)               \
    cout << "\n"                   \
         << #x << ": ";            \
    rep(i, x.size()) cout << x[i] << " "; \
    cout << endl
#define debug2d(x)            \
    cout << "\n"                    \
         << #x << " is: \n";        \
    rep(i,x.size())     \
    {                               \
        rep(j,x[0].size()) \
        {                           \
            cout << x[i][j] << " "; \
        }                           \
        cout << endl;               \
    }
#define nl cout << endl

#define MOD 1000000007
using namespace std;

int N, M, K;
int ans = 0;

signed main()
{
    cin >> N >> K;

    int a, b;
    map<int, bool> state;
    vector<pii> sushi(N);

    rep(i, N)
    {
        cin >> a >> b;
        sushi[i].second = a;
        sushi[i].first = b;
    }

    sort(sushi.rbegin(), sushi.rend());
    priority_queue<int, vector<int>, greater<int>> q;

    int tmp = 0;

    int variety = 0;
    int sum = 0;
    for (int i = 0; i < N; ++i)
    { // おいしい順
        if (state[sushi[i].second])
            // おいしい寿司が
        {   // すでに食べた種類のとき
            if ( i >= K ) { // 満足度が高くなる見込みがないため，次のネタへ
                continue;
            }
            q.push(sushi[i].first); //食べた数がK個未満のとき，種類は増えないが，枠に入れておく
        }
        else
        { // まだ食べていないネタを発見
            if ( i >= K )  // 枠がいっぱい
            {
                if ( q.empty() ) // 種類が増えない場合,何もしない
                {
                    break;
                }
                sum -= q.top(); // 種類が増える場合，
                q.pop();        // 重複しているネタを取り出し，入れてみる
            }
            state[sushi[i].second] = true;
            ++variety;
        }
        sum += sushi[i].first;
        ans = max(ans, sum + variety * variety);
    }

    cout << ans << endl;
    return 0;
}

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

using namespace std;
long long sqr(long long s)
{
    long long ss = abs(s);
    long long l = 0, r = 1000;
    while(l<r)
    {
        long long mid = (l+r)/2;
        if(pow(mid, 5) < ss) l = mid+1;
        else r = mid;
    }
    if(s>=0) return l;
    else return -l;
}
int main()
{
    long long x;
    cin >> x;
    long long v = 0;
    while(1)
    {
        long long a = v;
        long long b = sqr(pow(a, 5)-x);
        if(pow(a, 5)-pow(b, 5) == x){cout << a <<  " " << b << endl;break;}
        a = -v;b = sqr(pow(a, 5)-x);
        if(pow(a, 5)-pow(b, 5) == x){cout << a <<  " " << b << endl;break;}
        v++;
    }
    return 0;
}

Measured memory_bytes: 4004
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(ll i=0;i<(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORC(i,a,b,c) for(ll i=(a);i<(b);i+=(c))
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define ff first
#define ss second
#define dd long double
#define mod 1000000007

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll arr[5];
    REP(i,5){
        cin>>arr[i];
    }
    REP(i,5){
        if(arr[i]==0){
            cout<<i+1<<endl;
            break;
        }
    }
}


Measured memory_bytes: 3544
from bisect import bisect
import math
n,k=map(int,input().split())
A=list(map(int,input().split()))


l,r = 0,max(A)

while l < r - 1:
  mid = (l+r)//2
  cnt = 0
  for a in A:
    cnt += math.ceil(a/mid) - 1
  #print(l,r,mid,cnt,k)
  if cnt <= k:
    r = mid
  else:
    l = mid
print(r)


Measured memory_bytes: 31208
n = int(input())
c = input()
p,q = 0,n-1
x = 0
while(1):
    while(c[p] == 'R' and p < n-1):
        p += 1
    while(c[q] == 'W' and q > 0):
        q -= 1
    if(p < n-1 and q > 0 and p < q):
        p += 1
        q -= 1
        x += 1
    else:
        break
print(x)

Measured memory_bytes: 67652
#include <stdio.h>
int main(){
  int S[10000],T[500];
  int i,j,n,m,c=0;

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

  scanf("%d",&m);
  for(i=0;i<m;i++){
    scanf("%d",&T[i]);
  }

  for(i=0;i<m;i++){
    for(j=0;j<n;j++){
      if(S[j]==T[i]){
	c++;
	break;
      }
    }
  }

  printf("%d\n",c);
  return 0;
}



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

int main() {
    int n, l;
    cin >> n >> l;
    vector<string> s(n);
    for (int i = 0; i < n; i++) {
        cin >> s[i];
    }

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

    string ans;
    for (int i = 0; i < n; i++) {
        ans += s[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
// Begin Header {{{
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i,n) for(ll i=0; i<n; i++)
#define loop(i, j, n) for(ll i=j; i<n; i++)
#define all(x) (x).begin(), (x).end()
constexpr int INF  = 0x3f3f3f3f;
const long long mod=1e9+7;
const long double PI = acos(-1);
// }}} End Header

int main() {
	string s, t;
	cin >> s >> t;
	string n = s+t;
	int k = stoi(n);
	int z = 1;
	while(z*z <= k){
		if(z*z == k){
			puts("Yes");
			return 0;
		}
		z++;
	}
	puts("No");
	return 0;
}

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

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

int main() {
	long A, B;
	cin >> A >> B;
	long a = gcd(A, B);
	vector<long> b;
	for (long i = 2; i * i <= a; i++) {
		while (a % i == 0) {
			a /= i;
			b.push_back(i);
		}
	}
	if (a != 1) b.push_back(a);
	sort(b.begin(), b.end());
	b.erase(unique(b.begin(), b.end()), b.end());
	cout << b.size() + 1;
}

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

int main() {
    int N;
    cin >> N;
    cout << (N*(N + 1)) / 2 << endl;
}


Measured memory_bytes: 256
#include<cstdio>
int n;
int h[100002]={100000},f[100002]={};
int min(int a,int b)
{
	return a<b? a:b;
}
int abs(int x)
{
	return x<0? -x:x;
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&h[i]);
	for(int i=2;i<=n;i++)
		f[i]=min(f[i-1]+abs(h[i]-h[i-1]),f[i-2]+abs(h[i]-h[i-2]));
	printf("%d",f[n]);
	return 0;
}

Measured memory_bytes: 896
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;

const int MAXN = 100010;
const int MAXM = 200010;
const int MAXLOG = 17;

vector<int> G[MAXN], GW[MAXN];
int N, M, dsu[MAXN];
inline int find(int x) { return (x == dsu[x]) ? x : (dsu[x] = find(dsu[x])); }
struct item {
    int u, v, d;
} A[MAXM];
int NA = 0;

bool vis[MAXN];
int val[MAXN];
void dfs(int u) {
    int i, v;
    vis[u] = 1;
    for(i = 0; i < G[u].size(); i++) if(!vis[ v = G[u][i] ]) {
        val[v] = val[u] + GW[u][i];
        dfs(v);
    }
}

int main() {
    int i, u, v, d;
    scanf("%d%d", &N, &M);
    for(i = 1; i <= N; i++) dsu[i] = i;
    for(i = 1; i <= M; i++) {
        scanf("%d%d%d", &u, &v, &d);
        int pu = find(u), pv = find(v);
        if(pu != pv) {
            dsu[pu] = pv;
            G[u].push_back(v), GW[u].push_back(d);
            G[v].push_back(u), GW[v].push_back(-d);
        }
        else A[++NA] = (item) { u, v, d };
    }
    //dfs
    for(i = 1; i <= N; i++) if(!vis[i]) dfs(i);
    //chk
    for(i = 1; i <= NA; i++) {
        int dis = val[ A[i].v ] - val[ A[i].u ];
        if(dis != A[i].d) { printf("No"); return 0; }
    }
    printf("Yes");
}

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

const int N = 1e6 + 100;

int adj[505][505];

void solve(int u, int v, int cur) {
    if(v-u == 1) {
        adj[u][v] = cur;
        return;
    }
    int w = (u+v)/2;
    solve(u, w, cur+1);
    solve(w, v, cur+1);
    for(int i = u; i <= w; i++) {
        for(int j = w + 1; j <= v; j++) {
            adj[i][j] = cur;
        }
    }
}


int main() {
    // freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(0);
    cin.tie(0);

    int n;
    cin >> n;

    solve(1,n,1);
    for(int i = 1; i <= n; i++) {
        for(int j = i+1; j <= n; j++) {
            cout << adj[i][j] << " ";
        }
        cout << endl;
    }

    return 0;
}



Measured memory_bytes: 1536
#include <iostream>

int main() {
  long long x, y;
  std::cin >> x >> y;
  long long ans = 0ll;
  if (std::abs(std::abs(x) - std::abs(y)) < std::abs(std::abs(x + 1) - std::abs(y))) {
    x = -x;
    ++ans;
  }
  ans += std::abs(std::abs(x) - std::abs(y));
  x += std::abs(std::abs(x) - std::abs(y));
  if ((x > 0 && y < 0) || (x < 0 && y > 0)) {
    ++ans;
  }
  std::cout << ans;
  return 0;
}

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

using namespace std;

typedef long long ll;
// const ll mod = 1000000007;
char S[2001][2001];
int dp1[2010][2010],dp2[2010][2010],dp3[2010][2010],dp4[2010][2010];

int main() {
  int h,w;
  cin>>h>>w;
  for (int i = 1; i <= h; i++) {
    for (int j = 1; j <= w; j++) {
      cin>>S[i][j];
      if (S[i][j] == '#') dp1[i][j] = dp2[i][j] = dp3[j][j] = dp4[j][j] = 0;
      else {
        dp1[i][j] = dp1[i - 1][j] + 1;
        dp3[i][j] = dp3[i][j - 1] + 1;
      }
    }
  }
  for (int i = h; i >= 1; i--) {
    for (int j = w; j >= 1; j--) {
      if (S[i][j] == '.') dp2[i][j] = dp2[i + 1][j] + 1, dp4[i][j] = dp4[i][j + 1] + 1;
    }
  }
  int ans = 0;
  for (int i = 1; i <= h; i++) {
    for (int j = 1; j <= w; j++) {
      if (S[i][j] == '.') {
        int res = dp1[i - 1][j] + dp2[i + 1][j] + dp3[i][j - 1] + dp4[i][j + 1] + 1;
        ans = max(ans,res);
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}

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

int32_t main() {

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

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int n;
	cin >> n;
	int x = 100;
	int ct = 0;
	while (x < n) {
		x += 0.01 * x;
		ct++;
	}

	cout << ct << endl;


}

Measured memory_bytes: 3660
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T>& V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> >& Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T>& mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }
template<typename T>vector<T> make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type fill_v(T &t,const V &v){t=v;}
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type fill_v(T &t,const V &v){for(auto &e:t) fill_v(e,v);}
/*
 <url:https://atcoder.jp/contests/abc157/tasks/abc157_b>
 問題文============================================================
 B - Bingo
 =================================================================
 解説=============================================================
 
 ================================================================
 */

template<class Type>
Type solve(Type res = Type()){
    auto B = make_v<int>(3,3);

    map<int,pii> mp;
    for(int i = 0; i < 3;i++){
        for(int j = 0; j < 3;j++){
            int A; cin >> A;
            mp[A] = pii(i,j);
        }
    }
    int N; cin >> N;
    for(int i = 0; i < N;i++){
        int b; cin >> b;
        if(mp.count(b)){
            B[mp[b].first][mp[b].second] = 1;
        }
    }
    
    // 縦・横
    for(int i = 0; i < 3;i++){
        if(B[0][i] & B[1][i] & B[2][i]) return "Yes";
        if(B[i][0] & B[i][1] & B[i][2]) return "Yes";
    }
    // 斜め
    if(B[0][0] & B[1][1] & B[2][2]) return "Yes";
    if(B[2][0] & B[1][1] & B[0][2]) return "Yes";
    
    return "No";
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<string>() << endl;
    return 0;
}


Measured memory_bytes: 256
using System;

namespace abc089_c
{
    class program
    {
        static void Main(string[] args)
        {
            ChangeLocalDebugInput();
            int N = int.Parse(Console.ReadLine());

            long[] march = new long[5];

            for (int i = 0; i < N; i++)
            {
                string input = Console.ReadLine();
                if (input[0] == 'M') {
                    march[0]++;
                } else if (input[0] == 'A')
                {
                    march[1]++;
                }
                else if (input[0] == 'R')
                {
                    march[2]++;
                }
                else if (input[0] == 'C')
                {
                    march[3]++;
                }
                else if (input[0] == 'H')
                {
                    march[4]++;
                }
            }

            long answer = march[0] * march[1] * march[2] + march[0] * march[1] * march[3] +
                march[0] * march[1] * march[4] + march[0] * march[2] * march[3] + march[0] * march[2] * march[4] +
                march[0] * march[3] * march[4] +  march[1] * march[2] * march[3] +
                march[1] * march[2] * march[4] + march[1] * march[3] * march[4] + march[2] * march[3] * march[4];
            Console.WriteLine(answer);
        }


        [System.Diagnostics.Conditional("LOCAL_DEBUG")]
        static void ChangeLocalDebugInput()
        {
            Console.SetIn(new System.IO.StreamReader("../../stdin.txt"));
        }
    }
}


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

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
// #define int long long
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000               // 2e9
#define LLINF 2000000000000000000ll  // 2e18 (llmax:9e18)
#define fi first
#define sec second
#define all(x) (x).begin(), (x).end()
#define sq(x) ((x) * (x))
#define dmp(x) cerr << #x << ": " << x << endl;

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

template <class T>
using MaxHeap = priority_queue<T>;
template <class T>
using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template <class T>
vector<T> vect(int len, T elem) {
  return vector<T>(len, elem);
}

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << p.fi << ',' << p.sec;
  return os;
}
template <class T, class U>
istream &operator>>(istream &is, pair<T, U> &p) {
  is >> p.fi >> p.sec;
  return is;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) {
    os << vec[i];
    if (i + 1 < vec.size()) os << ' ';
  }
  return os;
}
template <class T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) is >> vec[i];
  return is;
}
void fastio() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(20);
}

#define endl "\n"

void solve() {
  int N;
  cin >> N;
  vector<int> a(N);
  cin >> a;
  map<int, int> m;
  for (int i = 0; i < N; i++) { m[a[i]]++; }
  int k = 1 - (N % 2);
  if (m[k] != 2 - (N % 2)) {
    cout << 0 << endl;
    return;
  }
  for (int i = k + 2; i < N; i += 2) {
    if (m[i] != 2) {
      cout << 0 << endl;
      return;
    }
  }
  ll ans = 1ll;
  for (int i = 0; i < N / 2; i++) { ans = ans * 2 % 1000000007ll; }
  cout << ans << endl;
  return;
}

signed main() {
  fastio();
  solve();
  // int t; cin >> t; while(t--)solve();
  return 0;
}


Measured memory_bytes: 3584
#include <iostream>
#include <cstdio>

using namespace std;

int ans[110];

int main(){
	int n, k;
	scanf("%d%d",&n,&k);
	for (int i = 0; i < k; i++){
		int x;
		scanf("%d",&x);
		for (int j = 0 ; j < x; j++){
			int y;
			scanf("%d",&y);
			ans[y]++;
		}
	}
	int res = 0;
	for (int i = 1; i <= n; i ++){
		if (!ans[i]) res ++;
	}
	cout <<res<<endl;

	return 0;
}

Measured memory_bytes: 3628
#include<stdio.h>
#include<algorithm>
using namespace std;
int b[400][400];
int sum[400][400];
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<a;i++)for(int j=0;j<a;j++)scanf("%d",&b[i][j]);
	for(int i=0;i<a;i++)for(int j=0;j<a;j++)
		sum[i+1][j+1]=b[i][j];
	for(int i=0;i<=a;i++)for(int j=1;j<=a;j++){
		sum[i][j]+=sum[i][j-1];
	}
	for(int i=0;i<=a;i++)for(int j=1;j<=a;j++){
		sum[j][i]+=sum[j-1][i];
	}
	int ret=-999999999;
	for(int i=0;i<a;i++){
		for(int j=i+1;j<a;j++){
			int L=-999999999;
			int tmp=0;
			for(int k=0;k<a;k++){
				ret=max(ret,sum[j+1][k+1]-sum[j+1][k]-sum[i][k+1]+sum[i][k]+tmp+L);
				L=max(L,sum[j][k+1]-sum[j][k]-sum[i+1][k+1]+sum[i+1][k]-tmp);
				tmp+=b[i][k];
				tmp+=b[j][k];
			}
		}
	}
	for(int i=0;i<a;i++){
		int now=0;
		for(int j=0;j<a;j++){
			now+=b[i][j];
			if(now<0)now=0;
			ret=max(ret,now);
		}
	}
	for(int i=0;i<a;i++){
		int now=0;
		for(int j=0;j<a;j++){
			now+=b[j][i];
			if(now<0)now=0;
			ret=max(ret,now);
		}
	}
	printf("%d\n",ret);
}

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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i=0; i<N; i++) {
    cin >> A[i];
  }
  
  int C=0;
  for (int i=0; i<N-2; i++) {
    if (A[i]>A[i+1] && A[i+1]>A[i+2]) {
      C++;
    }
    else if (A[i]<A[i+1] && A[i+1]<A[i+2]) {
      C++;
    }
  }
  cout << C << endl;
}


Measured memory_bytes: 3624
def solve():
    N = int(input())
    H = list(map(int, input().split()))
    max_num = 0
    now_num = -1
    now_h = H[0]
    for h in H:
        if now_h >= h:
            now_num += 1
            if max_num < now_num: max_num = now_num
        else:
            now_num = 0
            
        now_h = h
    
    print(max_num)
    
solve()

Measured memory_bytes: 14252
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    int a,b;
    cin >> a >> b;
    string s;
    cin >> s;
    for(int i=0;i<s.size();i++){
        if(i==a){continue;}
        else if(s[i]=='-'){
            cout << "No" << endl;
            return 0;
        }
    }
    if(s[a]=='-' && s.size()==a+b+1){
        cout << "Yes" << endl;
    }
    else cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define repr(i,n) for(ll i=(n-1);i>=0;i--)
#define all(x) x.begin(),x.end()
#define br cout << "\n";
using namespace std;
const int INF = 1e9;
const int MOD = 1e9+7;
using Graph = vector<vector<ll>>;
template<class T> inline bool chmin(T &a, T b) { if(a > b){ a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b) { if(a < b){ a = b; return true;} return false;}

// 0 false, 1 true 
// string to int : -48
// ceil(a)  1.2->2.0
// c++17	g++ -std=c++17 a.cpp

int main() {
    std::cout << std::fixed << std::setprecision(15);
    ld r;
    cin >> r;
    cout << r * 2* 3.14159 << endl;

}

Measured memory_bytes: 3788
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
#define pb(x) push_back(x)
#define mp(x, y) make_pair(x, y)
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repd(i, n) for (ll i = n-1; i >= 0; i--)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define repd2(i, s, n) for (ll i = n-1; i >= (s); i--)

int n, k;
vector<int> T(100000);

int check(ll P) {
    int i = 0;
    rep(j, k) {
        ll s = 0;
        while (s + T[i] <= P) {
            s += T[i];
            i++;
            if (i == n)
            return n;
        }
    }
    return i;
}
int solve() {
    ll left = 0;
    ll right = 100000 * 10000;
    ll mid;
    while (right - left > 1) {
        mid = (right + left) / 2;
        int v = check(mid);
        if (v >= n) right = mid;
        else left = mid;
    }
    return right;
}
int main() {
    cin >> n >> k;
    rep(i, n) cin >> T[i];
    ll ans = solve();
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3100
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i,sum=0,j;
    cin>>n;
    int a[n+1];
    for (i=1;i<=n;i++) cin>>a[i];
    for (;;)
    {
        int flag=0;
        for (i=1;i<=n;i++)
        if (a[i]%2!=0) 
        { flag=1; break; }
        if (flag==1) break;
        if (flag==0) 
        {
            sum++;
            for (i=1;i<=n;i++)
            a[i]/=2;
        }
    }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int fact(int n){
    if(n==1){
        return 1;
    }else{
        ll f=fact(n-1);
        return f*n;
    }
}

int main(void){
    double N; cin>>N;
    vector<double> x(N),y(N);
    vector<int> num(N);
    for(ll i=0;i<N;i++){
        cin>>x[i]>>y[i];
        num[i]=i;
    }
    double mean=0;
    do{
        for(ll i=0;i<N-1;i++){
            double dis;
            dis=(x[num[i+1]]-x[num[i]])*(x[num[i+1]]-x[num[i]])+(y[num[i+1]]-y[num[i]])*(y[num[i+1]]-y[num[i]]);
            mean+=sqrt(dis);
        
        }
    } while (next_permutation(num.begin(),num.end()));
    cout<<fixed<<setprecision(10)<<mean/fact(N)<<endl;
}


Measured memory_bytes: 256
def main():
  from collections import deque
  s,*c=open(0)
  h,w=map(int,s.split())
  f=[-1]*h*w
  q=deque()
  a,p=q.append,q.popleft
  for i,c in enumerate(''.join(t[:w]for t in c)):
    if c=='#':
      a(i)
      f[i]=0
  while q:
    i=p()
    v=f[i]+1
    j,k,l,m,u=i+w,i-w,i+1,i-1,i%w
    if h*w>j and f[j]<0:
      a(j)
      f[j]=v
    if k>=0 and f[k]<0:
      a(k)
      f[k]=v
    if w>u+1and f[l]<0:
      a(l)
      f[l]=v
    if u and f[m]<0:
      a(m)
      f[m]=v
  print(v-1)
if __name__=='__main__':
  main()

Measured memory_bytes: 52160
# util functions

# debug
$debugFlag = ( ARGV[0] != nil )
p "==== DEBUG MODE ====" if $debugFlag

# input
inputs = []
lc = 0
while l = $stdin.gets do
  if false
    inputs << l.chomp.split(" ").map(&:to_s)
  else
    inputs << l.chomp.split(" ").map(&:to_i)
  end
  lc += 1
end

# input check
if $debugFlag
  p "--- INPUT (begin) ---"
  inputs.each do |l_i|
    p l_i
  end
  p "--- INPUT (end) ---"
  print "\n"
end

# body
$aa = inputs[0][0]
$bb = inputs[0][1]
$kk = inputs[0][2]

if $debugFlag
  p $aa
  p $bb
  p $kk  
end

if $aa > $bb
  min = $bb
else
  min = $aa
end

comd = []
min.times do |i|
  comd << (i + 1) if $aa % (i + 1) == 0 and $bb % (i + 1) == 0
end

if $debugFlag
  print "comd: "
  p comd
end

puts comd.reverse[$kk-1]


Measured memory_bytes: 1788
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    s = S()
    s = list(s)
    blen = len(s)
    same = len(s) == s.count(s[0])
    ans = float("inf")
    dic = collections.Counter(s)
    chars = dic.keys()

    if same:
        ans = 0
    elif not same:
        for char in chars:
            same = False
            bs = copy.copy(s)
            while not same:
                same = True
                for i in range(1,len(bs)):
                    if bs[i-1] == char and bs[i] == char:
                        pass
                    elif bs[i-1] == char or bs[i] == char:
                        bs[i-1] = char
                    else:
                        same = False
                bs.pop()
            cnt = blen - len(bs)
            ans = min(ans,cnt)
    print(ans)
main()            


Measured memory_bytes: 75148
#include <bits/stdc++.h>
#define em3 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
#define X real()
#define Y imag()
#define cross(a, b) ((conj(a) * (b)).Y)
#define dot(a, b) ((conj(a) * (b)).X)
#define EPS 1e-7
long long mod = 1e9 + 7;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const double pi = acos(-1);
typedef complex <double> point;
typedef tuple<int, int, int> line;
typedef vector<point> polygon;
ll n , h[100005] , memo[100005] , k;

int main()
{
    em3
    cin >> n >> k;
    for(int i = 0 ; i < n ; i++)
        cin >> h[i];
    memo[0] = 0 , memo[1] = abs(h[0] - h[1]) ;
    for(int i = 2 ; i < n ; i++)
    {
        memo[i] = 1e10;
        for(int j = i - 1 ; j >= 0 && i - j <= k; j--)
                    memo[i] = min(abs(h[i] - h[j]) + memo[j] , memo[i]);
        ///cout << memo[i] << endl;
    }
    cout << memo[n - 1] << endl;

    return 0;
}


Measured memory_bytes: 1792
//コンパイラ最適化用
#pragma GCC optimize("Ofast")

//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<climits>
#include<chrono>//実行時間計測
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm,accumulate
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//順序保持しないmap
#include<unordered_set>//順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

// clang++ main.cc -std=c++11 -stdlib=libc++

/*
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++)
    cin >> a[i];
*/

signed main(){
  int res = INT_MAX;
  int N;
  cin >> N;

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

  for (int p = 1; p <= 100; p++) {
    int hp = 0;
    for (int j = 0; j < N; j++) {
      hp += (X[j] - p) * (X[j] - p);
    }
    res = min(res, hp);
  }
  cout << res << endl;

  return 0;
}

Measured memory_bytes: 3596