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

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

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

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

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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }
template<class T> T modinv(T a, T m) { T b = m, u = 1, v = 0; while (b) { T t = a / b; a -= t * b; boost::swap(a, b); u -= t * v; boost::swap(u, v); } u %= m; if (u < 0) u += m; return u; }

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

Tmp::Tmp(int N){}

void solve(void)
{
  int N; cin >> N;
  vector<vector<int>> A(2, vector<int>(N));
  for (auto& row : A) {
    for (auto& a : row) {
      cin >> a;
    }
  }
  vector<vector<int>> res(2, vector<int>(N));

  res[0][0] = A[0][0];
  res[1][0] = A[0][0] + A[1][0];
  for (int i = 0; i < N-1; ++i) {
    chmax(res[0][i+1], res[0][i]+A[0][i+1]);
    chmax(res[1][i+1], res[1][i]+A[1][i+1]);
    chmax(res[1][i+1], res[0][i+1]+A[1][i+1]);
  }
  auto ans = res[1][N-1];
  cout << ans << CRLF;
  
  return;
}

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

  solve();

  return 0;
}


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

int n, m;
int a[100000];
priority_queue<int> que;

signed main() {
	int i;
	
	cin >> n >> m;
	rep(i, n) cin >> a[i];
	rep(i, n) que.push(a[i]);
	
	rep(i, m) {
		int x = que.top();
		que.pop();
		que.push(x / 2);
	}
	
	int ans = 0;
	while (!que.empty()) {
		ans += que.top();
		que.pop();
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2168
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define DEBUG
#ifdef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
	template <typename Arg1>
	void __f(const char* name, Arg1&& arg1){
		cerr << name << " : " << arg1 << std::endl;
	}
	template <typename Arg1, typename... Args>
	void __f(const char* names, Arg1&& arg1, Args&&... args){
		const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
	}
#else
#define debug(...)
#endif
#define FOR(i,a,b) 	for(int i=a;i<b;++i)
#define RFOR(i,a,b) 	for(int i=a;i>=b;--i)
#define ln 		"\n"
#define mp make_pair
#define pb push_back
#define sz(a)	ll(a.size())
#define F first
#define S second
#define all(c)	c.begin(),c.end()
#define rall(c) c.rbegin(), c.rend()
#define trace(c,x) for(auto &x:c)
#define pii pair<ll,ll>
#define init(a, x) memset(a,x,sizeof(a))
typedef long long ll;
typedef long double ld;
typedef	priority_queue<pii,std::vector<pii>,greater<pii> > revpr;

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> pbds;
// ordered_set X
//K-th smallest
//*X.find_by_order(k-1)
//NO OF ELEMENTS < A
//X.order_of_key(A)
const int L=1e6+7;
map<ll,ll> counter;
ll dp[L][3], a[L][3], n;
ll solve(int i, int cur)
{
	if(i>=n)return 0;
	if(cur>=0 && dp[i][cur] != -1)return dp[i][cur];
	ll &ret = dp[i][cur];
	ret = INT_MIN;
	FOR(j,0,3)
	{
		if(j != cur)ret = max(ret, solve(i+1,j) + a[i][j]);
	}
	return ret;
}
void fff()
{
	cin >> n;
	FOR(i,0,n)FOR(j,0,3)cin >> a[i][j], dp[i][j] = -1;
	cout<<solve(0,-1);
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	//int t;cin >> t;while(t--)
	fff();
	return 0;
}

Measured memory_bytes: 16116
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<queue>
#include<stack>
#include<map>
#include<math.h>
#include<string>
#include <cctype>
#include <cstdlib>
#include<bitset>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = s; i < (int)(n); i++)
#define out(x) cout << x << endl;
#define INF 1ll<<60;
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; }

using namespace std;
using ll = long long;
typedef pair<int, int> P;

int main(){
    int x; cin >> x;
    if(400<=x && x<600){out(8);}
    else if(600<=x && x<800){out(7);}
    else if(800<=x && x<1000){out(6);}
    else if(1000<=x && x<1200){out(5);}
    else if(1200<=x && x<1400){out(4);}
    else if(1400<=x && x<1600){out(3);}
    else if(1600<=x && x<1800){out(2);}
    else if(1800<=x && x<2000){out(1);}
}

Measured memory_bytes: 3632
N, M = gets.chomp.split.map(&:to_i)
h = {}
wa = 0
M.times {
  p, s = gets.chomp.split
  if h[p] != true
    if s == 'AC'
      wa += h[p] || 0
      h[p] = true
    else
      h[p] = (h[p] || 0) + 1
    end
  end
}
ac = h.values.select { |v| v == true }.size
puts "#{ac} #{wa}"



Measured memory_bytes: 16764
#include <bits/stdc++.h>
#include <string>
#include <cmath>
#include <sstream>
//#include <unordered_map>
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORD(i, a, b) for(int i = (a-1); i >= (b); i--)
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define ff first
#define ss second
typedef long long int ll;
using namespace std;
ll mod=1000000007;
//ll mod=67280421310721;
//ll mod=998244353;
ll INF=1e18;
ll po(ll a,ll b)
{
	ll re=1;
	while(b)
	{
		if(b%2==1)
		{
			re=(re*a);
			re%=mod;
		}
		a=(a*a);
		a%=mod;
		b>>=1;
	}
	return re;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	long long n,cnt=0;
	long long input=0;
	cin>>n;
	vector<long long> vi;
	for(long long i=0;i<n;i++){
			cin>>input;
			vi.push_back(input);
	}


//		for(long long i=0;i<n-1;i++){
//			cout<<vi[i]<<endl;
//	}
	
	for(long long i=0;i<n-1;i++){
			if(vi[i]>vi[i+1]){
				long long temp;
				temp=vi[i]-vi[i+1];
				cnt+=temp;
				vi[i+1]+=temp;
				//cout<<vi[i]-vi[i+1]<<endl;
				
			//	cout<<"cnt is"<<cnt<<endl;
			}
			else{
				continue;
			}
	}
	cout<<cnt;
	//	for(long long i=0;i<n;i++)
	//		cout<<vi[i]<<endl;
	
		
	
	return 0;
}

Measured memory_bytes: 5252
#include <cstdio>
#include<iostream>
#include<map>
#include<algorithm>
#include<vector>
#include <cmath>
#include <iomanip>
#include <regex>
#include <queue>
#include <set>
using namespace std;
using ll = long long;
using Lf = long double;
using plong = pair<ll,ll>;
const int mod = 1000000007;

ll kai(ll N){
    ll res = 1;
    for(ll i=1;i<=N;i++){
        res*=i;
    }
    return res;
}

int main(){
    ll N,M,R;
    cin>>N>>M>>R;
    vector<ll> r(R);
    for(ll i=0;i<R;i++){
        cin>>r[i];
        r[i]--;
    }
    ll d[N][N];
    ll INF = 99999999999;
    for(ll i=0;i<N;i++){
        for(ll j=0;j<N;j++){
            if(i==j)d[i][j]=0;
            else d[i][j]=INF;
        }
    }
    for(ll i=0;i<M;i++){
        ll a,b,c;
        cin>>a>>b>>c;
        a--;b--;
        d[a][b] = c;
        d[b][a] = c;
    }

    for(ll k = 0;k<N;k++){
        for(ll i=0;i<N;i++){
            for(ll j=0;j<N;j++){
                d[i][j] = min(d[i][j],d[i][k]+d[k][j]);
            }
        }
    }


    ll res=INF;
    for(ll i=0;i<kai(R)-1;i++){
        ll tmp=0;
        for(ll j=0;j<R-1;j++){
            tmp+=d[r[j]][r[j+1]];
        }
        res=min(tmp,res);
        next_permutation(r.begin(),r.end());
    }
    cout<<res<<endl;
}

Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<map>
#include<string>
#include<sstream>
using namespace std;
int inf = 1000000000;


int main(){

  vector<int> a(3);
  cin >> a[0] >> a[1] >> a[2];
  sort(a.begin(), a.end());
  cout << a[0] + a[1] << endl;


  return 0;
}





//


Measured memory_bytes: 256
n = gets.chomp.to_i
a = gets.chomp.split(" ").map(&:to_i)
xor_sum = a[0]
(1...n).each do |i|
    xor_sum ^= a[i]
end
ans = []
a.each do |num|
    ans << (xor_sum ^ num)
end
puts ans.join(" ")

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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

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

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N, K, X, Y;
    cin >> N >> K >> X >> Y;

    if (N < K) {
        cout << N * X << endl;
    } else {
        cout << (N-K) * Y + K * X << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <math.h>

#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define PI 3.14159265358979323846264338327950L
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define SIZE_OF_ARRAY(array) (sizeof(array) / sizeof(array[0]))

int main() {
  string X, Y;
  cin >> X >> Y;

  bool ans = true;
  rep(i, 3) {
    if (X[i] != Y[2 - i]) ans = false;
  }

  if (ans == true)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 256
import java.io.ByteArrayInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.Scanner;
import java.util.Stack;

public class Main {
	public static void main(String[] args)  {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		sc.nextLine();
		String str=sc.nextLine();
		System.out.println(solve(str));
		
	}
	private static int solve(String str) {
		// TODO Auto-generated method stub
		int min=str.length();
		int white=0;
		int black=0;
		
		int[] arr=new int[str.length()+1];
		arr[arr.length-1]=0;
		
		for(char c:str.toCharArray())
			if(c=='.')
				white++;
		
		black=str.length()-white;
			
		
		
		
		for(int i=str.length()-1;i>=0;i--) {
			arr[i]=(str.charAt(i)=='.'?arr[i+1]+1:arr[i+1]);
		}
		

		
	
		min=Math.min(black, white);

		int cost=0;
		for(int i=0;i<str.length();i++) {	
			char c=str.charAt(i);
			if(c=='.') {
				--white;
				min=Math.min(black+cost, min);
				min=Math.min(min, white+cost);
				if(arr[i+1]==0) {

					return Math.min(cost,min);
				}
				
			}else {
				--black;
				++cost;
				min=Math.min(min, black+cost);
				min=Math.min(white+cost,min);
				if(arr[i+1]==0) {
					
					return min=Math.min(cost,min);
				}
			}
		}
		return min;
	}
}


Measured memory_bytes: 29908
#include <cstdio>

int hoge(int x)
{
    int hoge_tmp = x;
    int hoge_ans = 0;
    while (true) {
        if (hoge_tmp % 2 == 1) {
            break;
        } else {
            hoge_ans += 1;
            hoge_tmp /= 2;
        }
    }
    return hoge_ans;
}
int main()
{
    int N;
    scanf("%d", &N);
    int ans = 0;
    int tmp;
    for (int i = 0; i < N; i++) {
        scanf("%d", &tmp);
        ans += hoge(tmp);
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 128
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
const int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

int main() {
  string s; cin >> s;
  cout << (s == "ABC" ? "ARC\n" : "ABC\n");
  return 0;
}


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

int discending(const int* a, const int* b)
{
	return *b - *a;
}

int ascending(const int* a, const int* b)
{
	return *a- *b;
}

int main()
{
	int a[3];
	std::cin >> a[0];
	std::cin >> a[1];
	std::cin >> a[2];

	std::string output;

	std::qsort(a, 3, sizeof(int), (int(*)(const void*, const void*))ascending);

	std::cout << a[0] << " " << a[1] << " " << a[2] << std::endl;

	return 0;
}

Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n;
    cin>>n;
    int max_cnt=0,ans=1;
    for (int i=1;i<=n;i++) {
        int cnt=0;
        int tmp=i;
        while (tmp%2==0) {
            tmp/=2;
            cnt++;
        }
        if (cnt>max_cnt) {
            max_cnt=cnt;
            ans=i;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <functional>
#include <vector>

using namespace std;

#define int long long
#define dotimes(i, n) for (int i = 0, i##max__ = (n); i < i##max__; i++)
#define whole(x, f, ...) ([&](decltype((x)) c) { return (f)(begin(c), end(c), ## __VA_ARGS__); })(x)

int rint() {
  int x;
  scanf("%lld", &x);
  return x;
}

void wint(int x) {
  printf("%lld\n", x);
}

template<typename T> int size(T const& c) { return static_cast<int>(c.size()); }
template <typename T> bool maxs(T& a, T const& b) { return a < b ? a = b, true : false; }
template <typename T> bool mins(T& a, T const& b) { return a > b ? a = b, true : false; }
inline int lg(int x) { return 63 - __builtin_clzll(static_cast<unsigned int>(x)); }

class segment_tree {
  vector<pair<int, int>> xs;
public:
  segment_tree(int n) : xs(1 << (lg(2 * n - 1) + 1)) {}
  void update(const int i, const int j, int x) {
    function<void(int, int, int)> rec;
    rec =
      [&](int k, int a, int b) {
        if (i <= a && b <= j) {
          xs[k].first += x;
          xs[k].second += x;
        } else {
          int c = a + (b - a) / 2;
          if (xs[k].second != 0) {
            xs[2*k].first += xs[k].second;
            xs[2*k].second += xs[k].second;
            xs[2*k+1].first += xs[k].second;
            xs[2*k+1].second += xs[k].second;
            xs[k].second = 0;
          }
          if (j <= c)
            rec(2*k, a, c);
          else if (c <= i)
            rec(2*k+1, c, b);
          else {
            rec(2*k, a, c);
            rec(2*k+1, c, b);
          }
          xs[k].first = min(xs[2*k].first, xs[2*k+1].first);
        }
      };
    rec(1, 0, ::size(xs)/2);
  }
  int query(const int i, const int j) {
    function<int(int, int, int)> rec;
    rec =
      [&](int k, int a, int b) {
        if (i <= a && b <= j)
          return xs[k].first;
        int c = a + (b - a) / 2;
        return xs[k].second + (j <= c ? rec(2*k, a, c) : c <= i ? rec(2*k+1, c, b) : min(rec(2*k, a, c), rec(2*k+1, c, b)));
      };
    return rec(1, 0, ::size(xs)/2);
  }
};

signed main() {
  const int n = rint();
  segment_tree st(n);
  const int q = rint();
  dotimes(i, q)
    if (rint()) {
      int s = rint();
      int t = rint();
      wint(st.query(s, t+1));
    } else {
      int s = rint();
      int t = rint();
      int x = rint();
      st.update(s, t+1, x);
    }
  return 0;
}



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

#define int long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define dbg(x) cerr << #x << ": " << x << endl;
#define dbg2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define dbg3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define dbgB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

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

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

template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

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

signed main() {
   int n;
   cin >> n;
   double av = 0;
   int sum = 0;
   vec<int> v(n);
   rep (i, n) {
      cin >> v[i];
      sum += v[i];
   }

   av = 1.0 * sum / n;

   double Min = 1e9;
   rep (i, n) {
      chmin(Min, abs(v[i]-av));
   }

   int ans = 0;
   rep (i, n) {
      if (abs(v[i] - av) == Min) {
         ans = i;
         break;
      }
   }

   cout << ans << endl;


   return 0;
}

Measured memory_bytes: 764
#include<iostream>
#include<iomanip>
#include<string>
#include<queue>
#include<vector>
using namespace std;
int main(){
  int n;
  cin>>n;
  priority_queue<int> que;
  for(int i=0;i<n;i++){
    int d;
    cin>>d;
    que.push(d);
  }
  int small,big;
  for(int i=0;i<n/2+1;i++){
    if(i==0){
      small=que.top();
      que.pop();
  }else{
      big=small;
      small=que.top();
      que.pop();
    }
  }

  cout<<big-small;

return 0;
}

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

int main() {
  vector<int> v(5);
  for (int i = 0; i < 5; ++i) {
    cin >> v.at(i);
  }
  int ans = 0;
  for (int i = 0; i < 5; ++i) {
    ans += v.at(i);
    ans = (ans + 10 - 1) / 10 * 10;
  }
  int x;
  int mn = 1000;
  for (int i = 0; i < 5; ++i) {
    x = v.at(i) % 10;
    if (x == 0) {
      continue;
    }
    mn = min(mn, x);
  }
  if (mn != 1000) {
    ans -= 10 - mn;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import itertools

n = int(input())
pos = []
for _ in range(n):
	x, y = map(int, input().split())
	pos.append([x, y])

def dist(lst):
	d = 0
	for i in range(n-1):
		lst1 = lst[i]
		lst2 = lst[i+1]
		d += ((lst1[0]-lst2[0])**2 + (lst1[1]-lst2[1])**2)**0.5
	return d

d = 0
p_lst = list(itertools.permutations(pos, n))

for v in p_lst:
	d += dist(v)
    
print(d / len(p_lst))

Measured memory_bytes: 47212
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Deque;
import java.util.LinkedList;
 class Main {
	public static void main(String[] args) throws Exception {
	 BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
     int n = Integer.parseInt(bufferedReader.readLine());
     Deque<Integer> Deque = new LinkedList<Integer>();
     for (int i = 0; i < n; i++) {
         String line = bufferedReader.readLine();

         if (line.startsWith("insert")) {
             Deque.offerFirst(Integer.parseInt(line.substring(line.indexOf(" ") + 1)));
         } else if (line.equals("deleteFirst")) {
             Deque.pollFirst();
         } else if (line.equals("deleteLast")) {
             Deque.pollLast();
         } else {
             Deque.remove(Integer.parseInt(line.substring(line.indexOf(" ") + 1)));
         }
     }

     StringBuilder stringBuilder = new StringBuilder();
     stringBuilder.append(Deque.poll());
     for (Integer s : Deque) {
         stringBuilder.append(" ").append(s);
     }
     System.out.println(stringBuilder.toString());

 }
}

Measured memory_bytes: 137852
#include <stdio.h>
#define LEN 100000

typedef struct{
  char name[11];
  int t;
}Process;

Process Q[LEN];
int n, q, head = 0, tail = 0;

void enqueue(Process x){
  Q[tail] = x;
  tail = (tail + 1)%LEN;
}

Process dequeue(){
  Process x = Q[head];
  head = (head + 1)%LEN;
  return x;
}

int main(void)
{
  int i, j, count, time = 0;
  Process x;
  scanf("%d %d", &n, &q);

  for(i = 0; i < n; i++){
    scanf("%s %d", x.name, &x.t);
    enqueue(x);
  }

  while(1){
    x = dequeue();
    if(x.t <= q){
      time += x.t;
      printf("%s %d\n", x.name, time);
    }else{
      x.t -= q;
      time += q;
      enqueue(x);
    }
    if(head - tail == 0) break;
  }
  return 0;
}

Measured memory_bytes: 2160
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long

string s = "rsp";

signed main(){

  int n, k; cin >> n >> k;
  vector<pair<int, int>> p(3);
  for(int i = 0; i < 3; i++){
    cin >> p[i].first;
    p[i].second = i;
  }
  string t; cin >> t;

  sort(p.rbegin(),p.rend());
  vector<int> dp(n, 0), used(n, -1);
  for(auto q : p){
    for(int i = n-1; i >= 0; i--){
      if(t[i] == s[(q.second + 1) % 3] && used[i] != q.second){
        dp[i] = q.first;
        if(i - k >= 0){
          used[i - k] = q.second;
        }
      }
    }
  }

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

  return 0;
}


Measured memory_bytes: 2176
#include<iostream>

using namespace std;

int main(){
	int N, T[100], M, P, X;
	long long int all = 0;
	cin >> N;
	for(int i = 0; i < N; i++){
		cin >> T[i];
		all += T[i];
	}
	cin >> M;
	for(int i = 0; i < M; i++){
		cin >> P >> X;
		cout << all - T[P - 1] + X << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define goat() ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);srand(time(NULL))
typedef long long ll;
int a[1005]; int b[1005];
int main() {
	goat();
	int n, m, i;
	int ac = 0, wa = 0, tle = 0, re = 0;
	cin >> n;
	for (i = 0; i < n; i++) {
		string s;
		cin >> s;
		if (s == "AC") {
			ac++;
		}
		else if (s == "TLE") {
			tle++;
		}
		else if (s=="WA") {
			wa++;
		}
		else {
			re++;
		}
	}
	cout << "AC" << " x " << ac << endl;
	cout << "WA" << " x " << wa << endl;
	cout << "TLE" << " x " << tle << endl;
	cout << "RE" << " x " << re << endl;
	
}

Measured memory_bytes: 3600
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef pair<int, int>P;
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
typedef vector<vector<ll>> mat;
typedef vector<int> vec;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
const ll mod = 1000000007;
const ll INF = mod * mod;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
ll qp(ll a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };



void solve() {
    ll a, b, c, d, n, k, x,l,r;
    string s, t;
    ll ans = 0;
    double dans = 0;
    string sans = "Yes";
    vector<ll> re;
    vector<ll> de;

    cin  >> n;
    ll _max = 0;

    rep(i,n){
        cin >> a;
        if(a >= _max){
            ans++;
            _max = a;
        }
    }

    
    std::cout << ans << endl; 

    // std::cout << sans << endl; 
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    solve();
    // stop
        return 0;
}

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

const int MOD = 998244353;

int power(int a, int b) {
	if (b == 0) return 1;
	int result = power(a, b / 2);
	return (LL) result * result % MOD * (b % 2 == 1 ? a : 1) % MOD;
}

void solve_test() {
	int n, s;
	cin >> n >> s;
	vector<int> a(n);
	for (int i = 0; i < n; i++) cin >> a[i];

	vector<vector<int>> dp(n + 1, vector<int>(s + 1));
	dp[0][0] = 1;
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j <= s; j++) {
			dp[i][j] = dp[i - 1][j] * 2 % MOD;
			if (j >= a[i - 1])
				dp[i][j] = (dp[i][j] + dp[i - 1][j - a[i - 1]]) % MOD;
		}
	}
	cout << dp[n][s] << '\n';
}

int main() {
	int T;
	T = 1;
	for (int t = 1; t <= T; t++)
		solve_test();

	return 0;
}


Measured memory_bytes: 38568
#include<bits/stdc++.h>
using  namespace  std;
int main()
{
    string t;
    cin>>t;
    int len=t.size()-1;
    if(t[len]=='3')
        cout<<"bon"<<endl;
    else if(t[len]=='0' || t[len]=='1' ||t[len]=='6' || t[len]=='8')
        cout<<"pon"<<endl;
    else cout<<"hon"<<endl;
    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define per(i,n) for (int i = (n)-1; i >=0; --i)
using namespace std;
using ll = long long;
using vi = vector<int>;
using vv = vector<vi>;

int main(){
    int n;
    cin>>n;
    vector<ll> a(3*n);
    rep(i,3*n)cin>>a[i];
    sort(a.rbegin(), a.rend());
    
    ll ans = 0;
    
    rep(i,n)ans += a[2*i+1];
    cout << ans << endl;
    return 0;
}

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

#define rep(i,n) for(ll (i)=0;(i)<(ll)(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007LL
#define INF (1LL<<60LL)
#define int long long
typedef long long ll;

using namespace std;

#define MAX_N 1000000

signed main() {
	vector<vector<vector<ll>>> v(4, vector<vector<ll>>(3, vector<ll>(10,0)));
	ll n; cin >> n;
	rep(i, n) {
		ll a, b, c, d;
		cin >> a >> b >> c >> d;
		v[a - 1][b - 1][c - 1] += d;
	}
	rep(a, 4) {
		rep(b, 3) {
			rep(c, 10) {
				cout << " "<< v[a][b][c];
			}
			cout << endl;
		}
		if(a<3) cout << "####################" << endl;
	}

}


Measured memory_bytes: 3140
#include<bits/stdc++.h>
#define ll          long long int
#define lld          long double
#define pb          push_back
#define pii         pair<ll,ll>
#define mi          map<ll,ll>
#define vec         vector<ll>
#define all(a)     (a).begin(),(a).end()
#define F           first
#define S           second
#define mod         1000000007
#define nmod         -1000000007
#define N            1000000//31630=sqrt(pow(10,9))
#define rep(i,a,b)	for(ll  i=a;i<b;i++)
#define repi(i,a,b)	for(ll  i=a;i<=b;i++)
#define per(i,a,b)  for(ll i=a;i>=b;i--)
#define mp          make_pair
#define mit         map<ll,ll>::iterator
#define sit         set<ll>::iterator
#define pit         pair<ll,ll>::iterator
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;
ll xo(ll x, ll y) 
{ 
   return (x | y) & (~x | ~y); 
}  
ll bin_Expo(ll x,ll n)
{
		if(x==0)
		return 0;
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return bin_Expo(x*x,n/2);
    else                             //n is odd
        return x*bin_Expo(x*x,(n-1)/2);
}
ll mod_Expo(ll x,ll n,ll M)
{
		if(x==0)
		return 0;
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return mod_Expo((x*x)%M,n/2,M);
    else                             //n is odd
        return (x*mod_Expo((x*x)%M,(n-1)/2,M))%M;
 
}
//bool pf[N+1ll];
//vec prim;
//void sieve()
//{
//    repi(i,0,N)
//    pf[i]=true;
//	pf[0] = pf[1] = false;
//    for (int i = 2; i <= N; i++) {
//        if (pf[i]) 
//		{
//            prim.push_back(i);
//            for (int j = i + i; j <= N; j+=i) {
//                pf[j] = false;
//            }
//        }
//    }
//}
bool prime_check(ll x)
{
    bool prime = (x >= 2);
    for (ll i = 2; i * i <= x; i++) 
    {
        if (x % i == 0) 
        {
            prime = false;
            break;
        }
    }
    return prime;
}
ll logg(ll base,ll x) 
{
    return (ll)(log(x) / log(base));
}
ll a[100005];
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
//	cin>>TESTS; 
    while(TESTS--)
    {
    	ll m,k,g,i,l,n,h,j,mx,my,ans,d,x;
    	cin>>n>>k;
    	ans=0;
    	per(i,k,1)
    	{
    		a[i]=k/i;
    		a[i]=mod_Expo(a[i],n,mod);
    		for(j=2*i;j<=k;j+=i)
    		a[i]=(a[i]-a[j]+mod)%mod;
    		ans=(ans+a[i]*i)%mod;
		}
    	cout<<ans;
	}
	return 0;
} 

Measured memory_bytes: 4468
const input=require('fs').readFileSync('/dev/stdin', 'utf8').split(/[\s]/);const nin=()=>{const r = input[0];input.shift();return Number(r)};const nrin=(n)=>{const a:number[]=[];rep(n,()=>a.push(nin()));return a};const sin=()=>{const r = input[0];input.shift();return String(r)};const out=(...a)=>{console.log(...a)};const floor=(a)=>{return Math.floor(a)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const rep=(n, callback)=>{for(let i = 0;i < n; i++){callback()}};const strrep=(s, i, v)=>{return s.slice(0, i)+v+s.slice(i+1);};const permutation=({result=[],pre=[],post,n=post.length})=>{if(n>0){post.forEach((_,i)=>{const rest=[...post];const elem=rest.splice(i, 1);permutation({result, pre: [...pre,...elem],post:rest,n:n-1})})}else{result.push(pre)}return result};
const sw=(s,a:any[],op:'='|'>='|'>'|'<='|'<'='=')=>{for(let i=0;i<a.length;i+=2){if(op==='='){if(s==a[i])return a[i+1]}else if(op==='>='){if(s>=a[i])return a[i+1]}else if(op==='<='){if(s<=a[i])return a[i+1]}else if(op==='>'){if(s>a[i])return a[i+1]}else if(op==='<'){if(s<a[i])return a[i+1]}}return a[a.length-1];};const or=(a,...b)=>{for(let i=0;i<b.length;i++)if(a==b[i])return true;return false};const maxindex=(...a)=>{return a.indexOf(Math.max.apply(null,a))};const asc=(ar:number[])=>{return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{return ar.sort((a,b)=>{return b-a})};
const main = ()=>{
  let [a,b]=nrin(2);
  out(a%b==0?0:1);
}
main();

Measured memory_bytes: 7372
S = '0b' + input()
s1 = '0b' + '10' * (len(S) // 2 - 1) + '1' * (len(S) % 2)
s2 = '0b' + '01' * (len(S) // 2 - 1) + '0' * (len(S) % 2)
Ss1 = bin(int(S, 2) ^ int(s1, 2))[2:]
Ss2 = bin(int(S, 2) ^ int(s2, 2))[2:]
print(min(sum([1 for x in Ss1 if int(x)]), sum([1 for x in Ss2 if int(x)])))


Measured memory_bytes: 4340
#include "bits/stdc++.h"

using namespace std;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int K, T;
    cin >> K >> T;
    int maxv = 0;
    for (size_t i = 0; i < T; ++i) {
        int a; cin >> a;
        maxv = max(maxv, a - 1 - (K - a));
    }
    cout << maxv << "\n";
    return 0;
}


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

int main() {
    int n; cin >> n;
    vector<char> c(n);
    for (int i = 0; i < n; i ++) cin >> c.at(i);
    sort(c.begin(), c.end());
    c.erase(unique(c.begin(),c.end()), c.end());
    cout << (c.size() == 3 ? "Three" : "Four") << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <cstring>
#include <string>
#include <vector>
#include <map>
#include <set>
#define MIN 1<<31-1
#define HMAX 1000000000000000000
#define MOD 1000000007
#define REP(i,n) for(int i = 0; i < (n); i++)
#define RSET(s) for(set<int>::iterator it=s.begin();it!=s.end();it++)
typedef long long int ll;
using namespace std;
int Z[200];int Q[200]; 
int main()
{
	int N,M,X;cin>>N>>M>>X;
	for(int i=0;i<M;i++)
		{int a;cin>>a;
		Z[a]++;
		}
	for(int i=0;i<=N;i++)
	{
		Q[i]=Q[i-1]+Z[i];
	}
	cout<<min(Q[X],Q[N]-Q[X]);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

int main(){
    int N; cin>>N;
    vector<int> L(N);
    rep(n,0,N) cin>>L.at(n);

    sort(ToEnd(L));
    int64_t ans=0;

    rep(i,0,N-2){
        rep(j,i+1,N-1){
            auto itr=lower_bound(ToEnd(L),L.at(i)+L.at(j));
            int num=distance(L.begin(),itr);
            ans+=num-j-1;
        }
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <map>

using namespace std;

typedef long long ll;

const ll M = 1e9 + 7;
ll n;
map<ll, ll> ma;

ll f(ll p)
{
    if(p == 0) return 1;
    else if(p == 1) return 2;
    if(ma[p]) return ma[p];
    if(p % 2 == 0) return ma[p] = (f(p / 2) + f(p / 2 - 1) * 2 % M) % M;
    else return ma[p] = (f(p / 2) * 2 % M + f(p / 2 - 1)) % M;
}

int main()
{
    scanf("%lld", &n);
    printf("%lld", f(n));
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>

using namespace std;
// https://qiita.com/Clpsplug/items/81fe12400d4093a8fb5a

int main() {
    int D, S, T;
    cin >> D >> S >> T;
    if (D <= T * S) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3048
#include<stdio.h>
#include<algorithm>
using namespace std;

static const int MAX = 2000001;
static const int VMAX = 10000;

int main(){
    unsigned short *A, *B;
    int n, C[VMAX + 1];

    scanf("%d", &n);

    A = new unsigned short[n+1]; B = new unsigned short[n+1];

    for(int i=0; i<=VMAX; ++i) C[i] = 0;

    for(int i=0; i<n; ++i){
        scanf("%hu", &A[i+1]);
        ++C[A[i+1]];
    }

    for(int i=1; i<VMAX; ++i) C[i] = C[i] + C[i-1];

    for(int i=1; i<=n; ++i){
        B[C[A[i]]] = A[i];
        --C[A[i]];
    }

    for(int i=1; i<=n; ++i){
        if(i>1) printf(" ");
        printf("%d", B[i]);
    }
    printf("\n");
}



Measured memory_bytes: 10556
#include<bits/stdc++.h>
using namespace std;
#define fo(i,a,n) for(i=a;i<n;i++)
#define ll long long
#define deb(x) cout << #x << "=" << x << endl
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define sortrev(x) sort(all(x),greater<int>())
#define pi 3.1415926535897932384626

typedef pair<int,int> pii;
typedef pair<ll, ll> pl;
typedef vector<int>	vi;
typedef vector<ll>	vl;
typedef vector<pii>	vpii;
typedef vector<pl>	vpl;
typedef vector<vi>	vvi;
typedef vector<vl>	vvl;


const int mod = 100000007;
const int inf = 100000005;
const int N = 3e5, M = N;
ll i,j,n,m;


void solve() {
  ll n;
  cin>>n;

  vi vec(n);
  fo(i,0,n) cin>>vec[i];

  ll minn = INT_MAX , ans = 0;
  fo(i,0,n) {
      if(vec[i]<minn) {
        minn = vec[i];
        ans++;
      }
  }
  cout<<ans<<"\n";
}


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

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

    return 0;
}




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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

int main()
{
    string s;
    cin >> s;
    int a = s[0] - '0', b = s[1] - '0', c = s[2] - '0', d = s[3] - '0';

    if (a + b + c + d == 7)
        printf("%d+%d+%d+%d=7\n", a, b, c, d);
    else if (a + b + c - d == 7)
        printf("%d+%d+%d-%d=7\n", a, b, c, d);
    else if (a + b - c + d == 7)
        printf("%d+%d-%d+%d=7\n", a, b, c, d);
    else if (a + b - c - d == 7)
        printf("%d+%d-%d-%d=7\n", a, b, c, d);
    else if (a - b + c + d == 7)
        printf("%d-%d+%d+%d=7\n", a, b, c, d);
    else if (a - b + c - d == 7)
        printf("%d-%d+%d-%d=7\n", a, b, c, d);
    else if (a - b - c + d == 7)
        printf("%d-%d-%d+%d=7\n", a, b, c, d);
    else if (a - b - c - d == 7)
        printf("%d-%d-%d-%d=7\n", a, b, c, d);

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;

int main() {
    int h = 2;
    int w = 3;
    vector<string> c(h);
    rep(i, h) cin >> c[i];

    bool f = true;

    rep(i, h) rep(j, w) {
        if (c[i][j] != c[h-1-i][w-1-j]) f = false;
    }

    if (f) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  int N, T, c, t, cm = MOD;

  std::cin >> N >> T;
  
  for (int i = 0; i < N; i ++) {
    std::cin >> c >> t;

    if (t <= T)
      cm = std::min(c, cm);
  }

  if (cm < MOD) {
    std::cout << cm << std::endl;
  }
  else  {
    std::cout << "TLE" << std::endl;
  }

  return 0;
}


Measured memory_bytes: 256
////#include "stdafx.h"
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <tuple>
#include <numeric>
#include <assert.h>
#include <functional>
#include <unordered_map>

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
#define REP(i, n)				for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n)			for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define INF						2e9
#define MOD						(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)				(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)				(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)			((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)				(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)				(!IsOdd((x)))						
#define ArrayLength(x)			(sizeof( x ) / sizeof( x[ 0 ]))
#define	MAX_QWORD				((QWORD)0xFFFFFFFFFFFFFFFF)
#define M_PI					3.14159265358979323846
typedef long long				ll;
typedef unsigned long long int	QWORD;
typedef pair<ll, ll>			P;

/*-----------------------------------------------------------------------------
　処理
 -------------------------------------------------------------------------------*/
int main()
{
	int H, W;
	cin >> H >> W;
	static char masu[51][51];
	REP(i, H) REP(j, W) cin >> masu[i][j];

	const int step[4][2] = {
		{1, 0},
		{-1, 0},
		{0, 1},
		{0, -1},
	};

	static int isFin[51][51];
	REP(i, H) REP(j, W) {
		if (masu[i][j] == '.') {
			isFin[i][j] = true;
		} else {
			if ((0 < i		&& masu[i - 1][j] == '#')||
				(i < H - 1	&& masu[i + 1][j] == '#')||
				(0 < j		&& masu[i][j - 1] == '#')||
				(j < W - 1	&& masu[i][j + 1] == '#')) {
				isFin[i][j] = true;
			}
		}
	}

	REP(i, H) REP(j, W) {
		if (!isFin[i][j]) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}



Measured memory_bytes: 256
#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:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

const ll MOD = 1e9+7;
template<class Type>
Type solve(Type res = Type()){
    string S; cin >> S;
    reverse(S.begin(),S.end());
    
    int len = (int)S.length();
    vector<vector<ll>> dp(len+1,vector<ll>(13,0));
    dp[0][0] = 1;

    vector<ll> ten(len);
    ten[0] = 1;
    for(int i = 1; i < len;i++){
        ten[i] = ten[i-1] * 10 %13;
    }
    for(int i = 0; i < len;i++){
        for(int j = 0; j < 13;j++){
            if(dp[i][j] == 0) continue;
            if(S[i] != '?'){
                (dp[i+1][(j+ten[i]*(S[i]-'0'))%13] += dp[i][j])%=MOD;
            }else{
                for(int k = 0; k <= 9;k++){
                    (dp[i+1][(j+ten[i]*k)%13] += dp[i][j])%=MOD;
                }
            }
        }
    }
    res = dp[len][5];
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    // solve(0);
    cout << fixed << setprecision(15) << solve<ll>() << endl;
    return 0;
}


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

int main() {
  
  // 3*3配列Aijの定義
  vector<vector<int>> A(3, vector<int>(3));
 
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> A.at(i).at(j);
    }
  }
  
  // 配列bjの定義
  int N;
  cin >> N;
  
  vector<int> b(N);
  
  for (int i = 0; i < N; i++) {
    cin >> b.at(i);
  }
  
  
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      for (int k = 0; k < N; k++) {
        if (A.at(i).at(j) == b.at(k)) {
          A.at(i).at(j) = 0;
        }
      }
    }
  }
  
  int M = 0;
  
  for (int i = 0; i < 3; i++) {
    if (A.at(i).at(0) == A.at(i).at(1) && A.at(i).at(0) == A.at(i).at(2)) {
      M++;
    }
  }
  
  for (int i = 0; i < 3; i++) {
    if (A.at(0).at(i) == A.at(1).at(i) && A.at(0).at(i) == A.at(2).at(i)) {
      M++;
    }
  }
  
  if (A.at(0).at(0) == A.at(1).at(1) && A.at(1).at(1) == A.at(2).at(2)) {
    M++;
  }
  
  if (A.at(0).at(2) == A.at(1).at(1) && A.at(1).at(1) == A.at(2).at(0)) {
    M++;
  }
  
  
  if (M == 0) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
}

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

int main() {
  string s, ans = "None";
  cin >> s;
  int i, l = s.size();
  vector<int> count(26);
  for (i = 0; i < l; i++) count.at((int)s.at(i) - (int)'a')++;
  
  for (i = 0; i < 26; i++) {
    if (count.at(i) == 0) {
      ans = (char)((int)'a' + i);
      break;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3720
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <bits/stdc++.h>

using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define fore(i,a) for(auto &i:a)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
 

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

LL lcm(LL a, LL b){
    LL g = gcd(a,b);
    return a/g *b;
}


int main(){
    LL Q,H,S,D,N;
    cin >> Q >> H >> S >> D >> N;
    LL ans=0;
    LL two_lit=D;
    LL one_lit=S;
    LL five_mililit=H;
    
    two_lit=min(two_lit,S*2);
    two_lit=min(two_lit,H*4);
    two_lit=min(two_lit,Q*8);
    one_lit=min(one_lit,H*2);
    one_lit=min(one_lit,Q*4);
    five_mililit=min(five_mililit,Q*2);
    LL count=0;
    ans=(N/2)*two_lit+(N%2)*one_lit;
    cout << ans;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdlib>
#include<cmath>
using namespace std;
typedef long long llong;
typedef unsigned long long ullong;

llong mod_pow(ullong x, ullong n, ullong mod) {
  ullong res = 1;
  while ( n > 0) {
    if ( n & 1 ) res = res * x % mod;
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}

int main() {
  ullong m, n;
  cin >> m >> n;
  cout << mod_pow(m, n, 1000000007) << endl;

  return 0;
}


Measured memory_bytes: 3096