akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

using pll = pair<ll, ll>;
map<pll, int> dic;
vector<vi> graph;

ll mod1 = 1e9+7LL;
int base1 = 10007;
ll mod2 = 1e9+9LL;
int base2 = 1009;

pll dfs(int v, int pv, int d){
    ll ret1 = 0LL, ret2 = 0LL;
    for(int nv : graph[v]){
        if(nv == pv) continue;
        pll nxt = dfs(nv, v, d + 1);
        ret1 = ADD(ret1, nxt.first , mod1);
        ret2 = ADD(ret2, nxt.second, mod2);
    }
    ret1 = MUL(ret1, base1, mod1);
    ret2 = MUL(ret2, base2, mod2);
    ret1 = ADD(ret1, 1LL, mod1);
    ret2 = ADD(ret2, 1LL, mod2);

    dic[pll(ret1, ret2)]++;
    return pll(ret1, ret2);
}

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

    int n; cin >> n;
    graph = vector<vi>(n);

    rep(i, n - 1){
        int a, b; cin >> a >> b; a--, b--;
        graph[a].emplace_back(b);
        graph[b].emplace_back(a);
    }
    dfs(0, -1, 0);

    long long res = 0LL;
    for(auto& e : dic){
        ll num = e.second;
        res += num * (num - 1) / 2;
    }
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 22456
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>

// template {{{
using namespace std;

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define all(x) (x).begin(), (x).end()
#define fill(x, y) memset(x, y, sizeof(x))

using int64 = long long;

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

bool in_field(int W, int H, int x, int y) {
  return (0 <= x && x < W) && (0 <= y && y < H);
}

// pair
template <typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) {
  return s << "(" << p.first << ", " << p.second << ")";
}
// vector
template <typename T> ostream &operator<<(ostream &s, const vector<T> &v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i];
    if (i < len - 1)
      s << "\t";
  }
  return s;
}

// }}}

// url: https://atcoder.jp/contests/tenka1-2019-beginner/tasks/tenka1_2019_b
int N, K;
string S;

int main() {
  cin >> N >> S >> K;
  rep(i, S.length()) {
    if (S[i] == S[K - 1]) {
      cout << S[i];
    } else {
      cout << '*';
    }
  }

  cout << endl;

  return 0;
}

// vim: foldmethod=marker


Measured memory_bytes: 256
import sys

C = [list(map(int, input().split())) for _ in range(3)]

a = [0, 1, 2]
b = [0, 1, 2]

for i in range(3):
    for j in range(3):
        a_ = list(a)
        b_ = list(b)
        del a_[i]
        del b_[i]
        if C[a_[0]][b_[0]] + C[a_[1]][b_[1]] != C[a_[1]][b_[0]] + C[a_[0]][b_[1]]:
            print("No")
            sys.exit()

print("Yes")

Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define int ll
#define double long double
void YN(bool flg){cout<<(flg?"YES":"NO")<<endl;}
void Yn(bool flg){cout<<(flg?"Yes":"No")<<endl;}
void yn(bool flg){cout<<(flg?"yes":"no")<<endl;}
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define out(n) cout << n << endl;
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD = 1000000007;
const long long INF = 10e10;
const double PI = acos(-1.0);
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 T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
int POW(int a, int n) { int r = 1; while (n > 0) { if (n & 1)r *= a; a *= a; n /= 2; }return r; }
int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*素因数分解*/map< int64_t, int >prime_factor(int64_t n){map< int64_t, int > ret;for(int64_t i = 2; i * i <= n; i++) {while(n % i == 0) {ret[i]++;n /= i;}}if(n != 1) ret[n] = 1;return ret;}
/*約数列挙*/vector<int> getDivisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------ライブラリとか----------------

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(15);

    int n; cin >> n;
    string s; cin >> s;
    if(n%2==1){cout << "No" << endl; return 0;}
    Yn(s.substr(0,n/2)==s.substr(n/2,n/2));

    return 0;
}

Measured memory_bytes: 256
//Himanshu Shukla
#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
//#define file_input
//#define multitest
//#define measure_time
#define ll long long
#define v32 vector<int>
#define v64 vector<ll>
#define s32 set<int>
#define s64 set<ll>
#define graph vector<v32>
#define p32 pair<int, int>
#define p64 pair<ll, ll>
#define sz(v) (ll)(v).size()
#define fi first
#define se second
#define ln '\n'
#define debug(x) cerr << (#x) << ": " << (x) << ln
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline ll add(ll a, ll b, ll m) { return (((a % m + b % m) % m + m) % m); }
inline ll mul(ll a, ll b, ll m) { return (((a % m * b % m) % m + m) % m); }
const double EPS = 1e-6;
const ll MOD = 1e9 + 7;
template <typename T, typename U>
ostream &operator<<(ostream &out, const pair<T, U> &p)
{
	out << '[' << p.fi << ", " << p.se << ']';
	return out;
}
template <template <typename, typename...> class ContainerType, typename ValueType, typename... Args>
void print_container(const ContainerType<ValueType, Args...> &c)
{
	cout << "{ ";
	for (const auto &v : c)
		cout << v << ' ';
	cout << '}' << ln;
}

ll power(ll x, ll y)
{
	ll res = 1;
	while (y)
	{
		if (y & 1)
			res = mul(res, x, MOD);
		y /= 2;
		x = mul(x, x, MOD);
	}
	return res;
}

const int N = 1e5 + 5;
ll dp[N];
//gcd is i
ll go(ll i, ll n, ll k)
{
	if (i == k)
		return 1;
	if (dp[i] != -1)
		return dp[i];
	ll ans = 0;
	for (ll m = 2 * i; m <= k; m += i)
		ans = add(ans, go(m, n, k), MOD);
	ll cnt = k / i;
	ans = mul(MOD - 1, ans, MOD);
	ans = add(power(cnt, n), ans, MOD);
	return dp[i] = ans;
}

void solve()
{
	ll n, k;
	cin >> n >> k;
	ll ans = 0;
	memset(dp, -1, sizeof(dp));
	for (int i = 1; i < k + 1; i++)
		ans = add(ans, mul(i, go(i, n, k), MOD), MOD);
	cout << ans << ln;
	return;
}

int main()
{
	FASTIO;
#ifdef file_input
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	clock_t start, stop;
	int t = 1;
#ifdef multitest
	cin >> t;
#endif
#ifdef measure_time
	start = clock();
#endif
	for (int tc = 1; tc < t + 1; tc++)
		solve();
#ifdef measure_time
	stop = clock();
	cerr << "Time :" << fixed << setprecision(5) << double(stop - start) / double(CLOCKS_PER_SEC) << "s" << ln;
#endif
	return 0;
}


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

using namespace std;

#define int long long
int ans, neg, mn = 200000000000007;
signed main(){
  int n;
  cin >> n;

  int a[n+1];
  for(int i = 1;i<=n;i++){
    cin >> a[i];
    ans+=abs(a[i]);
    mn = min(mn, abs(a[i]));
    if(a[i]<0)neg++;
  }
    //cout << ans << endl;
  if(neg%2)ans-=2*mn;
  cout << ans;
  cout << endl;
  return 0;
}


Measured memory_bytes: 1024
S = input()

i = 0
while True:
    if i >= len(S):
        print('YES')
        break
    if S[i:i+5] == 'dream':
        if S[i+5:i+10] == 'erase':
            if S[i+10:i+11] == 'r':
                i += 11
            else:
                i += 10
        elif S[i+5:i+7] == 'er':
            i += 7
        else:
            i += 5
    elif S[i:i+5] == 'erase':
        if S[i+5:i+6] == 'r':
            i += 6
        else:
            i += 5
    else:
        print('NO')
        break

Measured memory_bytes: 3188
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cassert>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <complex>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <iterator>

using namespace std;

#define dump(n) cout<<"# "<<#n<<'='<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define iter(c) __typeof__((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();++i)
#define all(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int,int> pii;

const int INFTY=1<<29;
const double EPS=1e-9;

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& a){
	os<<'[';
	rep(i,a.size()) os<<(i?" ":"")<<a[i];
	return os<<']';
}

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

struct Edge{
	int src,dst;
	Edge(){}
	Edge(int s,int d):src(s),dst(d){}
};
typedef vector<vector<Edge> > Graph;

bool Augment(const Graph& g,int u,vi& vis,vi& match)
{
	rep(i,g[u].size()){
		int v=g[u][i].dst;
		if(vis[v]) continue;
		vis[v]=1;
		if(match[v]==-1 || Augment(g,match[v],vis,match)){
			match[u]=v;
			match[v]=u;
			return true;
		}
	}
	return false;
}

int BipartiteMatching(const Graph& g,vi& match)
{
	int n=g.size();
	match.assign(n,-1);
	int res=0;
	rep(i,n) if(match[i]==-1){
		vi vis(n);
		res+=Augment(g,i,vis,match);
	}
	return res;
}

int main()
{
	for(int m,n;scanf("%d%d",&m,&n),m|n;){
		vi bs(m),rs(n);
		rep(i,m) scanf("%d",&bs[i]);
		rep(i,n) scanf("%d",&rs[i]);
		
		Graph g(m+n);
		rep(i,m) rep(j,n) if(gcd(bs[i],rs[j])>1){
			g[i].push_back(Edge(i,m+j));
			g[m+j].push_back(Edge(m+j,i));
		}
		
		vi match;
		printf("%d\n",BipartiteMatching(g,match));
	}
	
	return 0;
}

Measured memory_bytes: 4124
require 'prime'
n = gets.chomp.to_i
count = 0
(1..n).each do |i|
    hairetsu = i.prime_division
    ans = 1
    hairetsu.each do |j|
        ans *= j[-1] + 1 
    end
    if ans == 8 && i % 2 != 0
        count += 1
    end
end
puts count

Measured memory_bytes: 14388
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
const int inf = 1001001001;

int main(){
  string s;
  cin >> s;
  int n =sz(s);

  string t = "ACGT";

  int cnt = 0;
  int ans = 0;
  rep(i,n){
    bool flag = 0;
    rep(j,4){
      if(s[i] == t[j]) flag = 1;
    }
    if(flag){
      cnt++;
      ans = max(ans,cnt);
    }else{
      cnt = 0;
    }
  }
  cout << ans << endl;
  
}


Measured memory_bytes: 3652
import itertools
N = int(input())
p = "".join(input().split())
q = "".join(input().split())

cnt = 1
for x in itertools.permutations(range(1, N + 1)):
    tmp = "".join(map(str, x))
    if p == tmp:
        a = cnt
    if q == tmp:
        b = cnt
    cnt += 1

print(abs(a-b))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>(b);i--)
#define pb push_back

typedef long long ll;
using namespace std;
int MOD = 1000000007;

int N, C, A[400], B[400];
ll base[401], DP[401][401], sigma[401][401];
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  FOR(i, 0, 401){base[i] = 1;}
  FOR(i, 0, 401){
    ll sum = 0ll;
    FOR(j, 0, 401){
      sum = (sum + base[j]) % MOD;
      sigma[i][j] = sum;
      base[j] = base[j] * j % MOD;
    }
  }
  cin >> N >> C;
  FOR(i, 0, N){cin >> A[i];}
  FOR(i, 0, N){cin >> B[i];}
  FOR(i, 1, C+1){DP[0][i] = 0;}
  DP[0][0] = 1;
  FOR(i, 1, N+1){
    int a = A[i-1]-1, b = B[i-1];
    FOR(j, 0, C+1){
      ll sum = 0ll;
      FOR(k, 0, j+1) sum = (sum + (MOD + sigma[k][b] - sigma[k][a]) * DP[i-1][j-k]) % MOD;
      DP[i][j] = sum % MOD;
    }
  }
  cout << DP[N][C] << "\n";
}


Measured memory_bytes: 2816
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    long MOD = 1000000007;
    int[] diff = new int[N];
    for(int i = 0; i < diff.length; i++) {
      diff[i] = sc.nextInt();
    }
    Arrays.sort(diff);
    int[] a = new int[N];
    if(N % 2 == 0) {
      for(int i = 0; 2 * i + 1 < N; i++) {
        a[2 * i] = 2 * i + 1;
        a[2 * i + 1] = 2 * i + 1;
      }
    } else {
      a[0] = 0;
      for(int i = 0; 2 * i + 2 < N; i++) {
        a[2 * i + 1] = 2 * i + 2; 
        a[2 * i + 2] = 2 * i + 2;
      }
    }
    long ans = 0;
    if(Arrays.equals(diff, a)) {
      int time = N / 2;
      ans = 1;
      for(int i = 0; i < time; i++) {
        ans = (ans * 2) % MOD;
      }
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 52160
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#define MAX_N 100001
using namespace std;
using ll = long long;
//struct edge{int to;ll cost;};
using edge = struct{int to;ll cost;};
vector<edge> tree[MAX_N];
ll depth[MAX_N];
void dfs(int now,int end,ll total){
    depth[now] = total;
    for(auto &e:tree[now]){
        if(e.to==end)continue;
        dfs(e.to,now,total+e.cost);
    }
}
int n,q,k,a,b;ll c;
int main()
{
    cin>>n;
    for(int i = 1;i<=n-1;i++){
        cin>>a>>b>>c;
        edge x = {b,c};
        tree[a].push_back(x);
        edge y = {a,c};
        tree[b].push_back(y);
    }
    cin>>q>>k;
    dfs(k,0,0);
    for(int i = 1;i<=q;i++){
        cin>>a>>b;
        cout<<depth[a]+depth[b]<<endl;
    }
    return 0;
}


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

int main(void)
{
    ll N, K;
    cin >> N >> K;
    vector<ll> A(N);
    for(int i=0;i<N;i++){
        int a;
        cin >> a;
        A[i] = a - 1;
    }
    // find cycle
    vector<int> visited(N, -1);
    int p = 0;
    int cnt = 0;
    while(true){
        if(K==0){
            cout << p + 1 << endl;
            return 0;
        }
        K--;
        visited[p] = cnt++;
        p = A[p];
        if(visited[p]==-1) continue;
        // visited
        int cycle = cnt - visited[p];
        K = K % cycle;
    }
    return 0;
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<double> vd;
typedef vector<string> vs;
typedef pair<int, int> P;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

void YN(bool flg){if(flg) cout << "YES" << endl; else cout << "NO" << endl;}
void Yn(bool flg){if(flg) cout << "Yes" << endl; else cout << "No" << endl;}
void yn(bool flg){if(flg) cout << "yes" << endl; else cout << "no" << endl;}

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

int main()
{   
    int k, s;
    cin >> k >> s;

    int ans = 0;
    rep(i, s+1) rep(j, s+1) {
        int z = s-i-j;
        if(z < 0 || z > k || i > k || j > k) continue;
        if(i+j+z == s) ans++;
        //cout << i << j << z << endl;
    }

    cout << ans << endl;

    return 0;
}


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

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

int main(){
  int n;
  cin >> n;
  vector<ll> x(n+1);
  rep(i, n+1) cin >> x[i];
  sort(x.begin(), x.end());
  vector<ll> diff(n);
  rep(i, n) diff[i] = x[i+1] - x[i];
  ll ans = gcd(diff[0], diff[1]);
  for(int i = 2; i <= n-1; i++){
    ans = gcd(ans, diff[i]);
  }
  cout << ans << endl; 
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
const long long mod = 1e9+7;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
const int ddx[4] = {1,1,-1, -1};
const int ddy[4] = {1,-1,-1,1};
//////////////////////////////////

int main() {
    int n, a; cin >> n;
    vector<pair<int, int>> p(n);
    for(int i=0; i<n; i++) {
        cin >> a;
        p[i].first = a;
        p[i].second = i+1;
    }
    sort(all(p));
    for(int i=0; i<n; i++) cout << p[i].second << " ";
    cout << endl;

    return 0;
}

// EOF


Measured memory_bytes: 1664
#include <iostream>
#include <stdio.h>
#include <sstream>
using namespace std;
void draw(int map[10][10]);
void drop(int x,int y,int z);
void drop_rotate(int,int,int,int);
bool isValidPoint(int,int);
void count(int map[10][10]);
int map[10][10];
int white, conc;
int dx,dy;

int main(){
  int x,y,s;
  string tmp;
  
  //zñÌú»
  for(int i=0;i<10;i++){
    for(int j=0;j<10;j++){
      map[i][j]=0;
    }
  }

  while(cin >> tmp){ //J}æØèðooÉ
    tmp.replace(tmp.find(","),1," ");
    tmp.replace(tmp.find(","),1," ");
    istringstream ss(tmp);
    ss >> x >> y >> s;
    drop(x,y,s);
    //draw(map);
  }
  count(map);
}

//2³mapÌ`Ê
void draw(int map[10][10]){
    for(int i=0;i<10;i++){
      for(int j=0;j<10;j++){
      printf("%4d",map[i][j]);
      }
      cout << endl;
    }
    cout << endl;
}

//¦ðÔ·Ö
void count(int map[10][10]){
  white = 0; conc = 0;
  for(int i=0;i<10;i++){
    for(int j=0;j<10;j++){
      if(map[i][j]==0){
	white++;
      }
      if(map[i][j] > conc){
	conc = map[i][j];
      }
    }
  }
  cout << white << endl << conc << endl;
}
 
//CNº
void drop(int x,int y,int s){
  if(isValidPoint(x,y)){
    map[x][y]++;
  }
  if(s==3){
    drop_rotate(x,y,2,0);
    drop_rotate(x,y,1,1);
    drop_rotate(x,y,1,0);
  }else if(s==2){
    drop_rotate(x,y,1,1); 
    drop_rotate(x,y,1,0);
  }else{
    drop_rotate(x,y,1,0);
  }
}

void drop_rotate(int x, int y,int dx, int dy){
  int temp;
  for(int i = 0; i < 4; i++){
    temp = dx;
    dx = dy;
    dy = -temp;
    if(isValidPoint((x+dx),(y+dy))){
      map[x+dx][y+dy]++;
    }
  }
}

bool isValidPoint(int x,int y){
  if(x < 0 || x > 9 || y < 0 || y > 9){
    return false;
  }else{
    return true;
  }
}

Measured memory_bytes: 0
s = input()
n = len(s)

#解説参照
for i in range(n-1):
    if s[i]==s[i+1]:
        print(i+1,i+2)
        exit()
for i in range(n-2):
    if s[i]==s[i+2]:
        print(i+1,i+3)
        exit()
print(-1,-1)
            


Measured memory_bytes: 39408
N = int(input())
A = list(map(int,input().split()))

ans = 0
res = 0
while(1):
  for i in range(N):
    if A[i]%2 == 0:
      A[i]=A[i]/2
    else :
      res = 1
  if res == 0:
    ans = ans + 1
  else :
    break

print(ans)

Measured memory_bytes: 3060
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, StdoutLock, Write};
#[allow(unused_imports)]
use std::iter::FromIterator;
#[allow(unused_macros)]
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , bytes ) => { read_value ! ( $ next , String ) . into_bytes ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }
#[allow(dead_code)]
struct Writer {
    s: String,
}
#[allow(unused_imports)]
use std::fmt::Display;
#[allow(dead_code)]
impl Writer {
    #[allow(dead_code)]
    pub fn new() -> Writer {
        Writer { s: String::new() }
    }
    #[allow(dead_code)]
    pub fn flush(&mut self) {
        print!("{}", self.s);
        self.s.clear();
    }
    pub fn write<T: Display>(&mut self, x: T) {
        self.s.push_str(&format!("{}", x));
    }
    pub fn writeln<T: Display>(&mut self, x: T) {
        self.s.push_str(&format!("{}", x));
        self.s.push('\n');
    }
    #[allow(dead_code)]
    pub fn write_vec<T: Display>(&mut self, xs: &Vec<T>) {
        if xs.len() == 0 {
            self.writeln("");
            return;
        }
        self.write(&format!("{}", xs[0]));
        for i in 1..xs.len() {
            self.write(&format!(" {}", xs[i]));
        }
        self.writeln("");
    }
}
#[allow(dead_code)]
fn main() {
    input!{
        x: u64
    }
    if x < 1200 {
        println!("ABC");
    } else {
        println!("ARC");
    }
}

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

int main() {
int64_t n,a,b;
  b=0;
  cin>>n;
  for(int64_t i=0;i<n;i++){
  cin>>a;
    if(a%2==0&&a%3!=0&&a%5!=0){b=1;}
    
  }
  if(b==0){cout<<"APPROVED"<<endl;}
  else{cout<<"DENIED"<<endl;}
} 

Measured memory_bytes: 3580
#include <iostream> 
#include <bits/stdc++.h>
#include <vector> 
#include <algorithm> 
#include <string>
#include <cmath>
#include <iomanip> 
#include<climits> 
#include <utility>   
#include <set>
#include <numeric> 
#include <iterator>
#include <map> 
using namespace std; 
#define ll long long int
#define M 1000000007

int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    int k,a,b;
    cin>>k>>a>>b;
    if(a%k==0 || b%k==0)
    cout<<"OK"<<endl;
    else if(a/k==b/k)
    cout<<"NG"<<endl;
    else
    cout<<"OK"<<endl;
    
    
  
}

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

typedef long long int ll;
typedef pair<ll, ll> p_ll;
typedef vector<pair<ll, ll>> vec_p; //vector<pair<ll, ll>> pairs(n) ,pairs.at(i) = make_pair(i*i, i)

#define ture ture
#define flase false
#define falg flag

#define REP(i, x) for (ll i = 0; i < (ll)(x); i++)
#define REPS(i, x) for (ll i = 1; i <= (ll)(x); i++)
#define RREP(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (ll i = ((ll)(x)); i > 0; i--)
#define all(x) (x).begin(), (x).end()

const ll MOD = pow(10, 9) + 7;
const ll LLINF = pow(2, 61) - 1;//llの最大9*10^18
const int INF = pow(2, 30) - 1;

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

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

    ll A,B;
    string S;
    cin >> A>>B;
    cout << A * B << endl;

}


Measured memory_bytes: 3648
# sys.stdin.readline
import sys

input = sys.stdin.readline


class AtCoder:
    def main(self):
        S = input().rstrip()

        while len(S) > 0:
            if S[:11] == 'dreameraser':
                S = S[11:]
            elif S[:10] == 'dreamerase':
                S = S[10:]
            elif S[:7] == 'dreamer':
                S = S[7:]
            elif S[:6] == 'eraser':
                S = S[6:]
            elif S[:5] == 'dream' or S[:5] == 'erase':
                S = S[5:]
            else:
                print('NO')
                exit()
        print('YES')


# Run main
if __name__ == '__main__':
    AtCoder().main()

Measured memory_bytes: 134856
#include <bits/stdc++.h>
#define lli long long int
#define uli unsigned long long int
#define rep(i, m, n) for (lli i = m; i < (n); i++)
#define repe(i, m, n) for (lli i = m; i <= (n); i++)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((lli)(x).size())
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007      //10^9+7
#define SORT(n) sort(n.begin(), n.end())
#define SORTR(n) sort(n.begin(), n.end(), greater<int>())
#define REV(n) reverse(n.begin(), n.end())
#define Vec(K, L, N, S) vector<L> K(N, S)
#define rt sqrt
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vlli = vector<lli>;
using vs = vector<string>;
using ll = long long;
// vector入力
template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
  for (T &x : vec)
    is >> x;
  return is;
}
// vector出力
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec)
{
  // os << '{';
  for (int i = 0; i < vec.size(); i++)
  {
    os << vec[i] << (i + 1 == vec.size() ? "" : "");
  }
  // os << '}';
  return os;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli h, k, n, w, R = 0, B = 0, G = 0, ans = 0, count = 0;
  string s, t;
  cin >> n;
  cin >> s;
  rep(i, 0, n)
  {
    if (s[i] == 'R')
    {
      R++;
    }
    if (s[i] == 'G')
    {
      G++;
    }
    if (s[i] == 'B')
    {
      B++;
    }
  }
  ans = R * G * B;
  repe(i, 1, n)
  {
    rep(j, 0, n)
    {
      if (s[j] != s[j + i] && s[j] != s[j + i * 2] && s[j + i] != s[j + i * 2] && j + i * 2 < n)
        ans--;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3660
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int popcount(unsigned i) {
    i = ((i & 0xaaaaaaaa) >> 1) + (i & 0x55555555);
    i = ((i & 0xcccccccc) >> 2) + (i & 0x33333333);
    i = ((i & 0xf0f0f0f0) >> 4) + (i & 0x0f0f0f0f);
    i = ((i & 0xff00ff00) >> 8) + (i & 0x00ff00ff);
    i = ((i & 0xffff0000) >> 16) + (i & 0x0000ffff);
    return i;
}

bool solve() {
    int N, C;
    if(!(cin >> N >> C)) return false;
    if(!N &&! C) return false;

    vector<int> patterns(N), press_patterns(C);
    for(int i = 0; i < N; ++i) {
        int v = 0;
        for(int j = 0; j < 16; ++j) {
            int b;
            cin >> b;
            v <<= 1;
            v += b;
        }
        patterns[i] = v;
    }
    for(int i = 0; i < C; ++i) {
        int v = 0;
        for(int j = 0; j < 16; ++j) {
            int b;
            cin >> b;
            v <<= 1;
            v += b;
        }
        press_patterns[i] = v;
    }

    vector<int> memo[2];
    memo[0].resize(1<<16, -1);
    memo[1].resize(1<<16, -1);
    memo[0][0] = 0;
    for(int pat : patterns) {
        fill(memo[1].begin(), memo[1].end(), -1);
        for(int prev = 0; prev < (1<<16); ++prev) {
            if(memo[0][prev] == -1) continue;
            const int cur = pat | prev;
            for(int press : press_patterns) {
                const int np = cur & (~press);
                const int ns = memo[0][prev] + popcount(cur & press);
                memo[1][np] = max(memo[1][np], ns);
            }
        }
        memo[0].swap(memo[1]);
    }
    cout << *max_element(memo[0].begin(), memo[0].end()) << endl;
    return true;
}

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

    while(solve()) ;
    return 0;
}

Measured memory_bytes: 1588
#include <iostream>
#include <vector>

int main() {
    int nums = 0;
    int K = 0;
    std::vector<int> h;
    std::cin >> nums >> K;
    int tmp = 0;
    while( std::cin >> tmp) {
        h.push_back(tmp);
    }
    std::vector<int> memery_(nums, 0);
    memery_[1] = std::abs(h[1] - h[0]);
    for (int i=2;i<nums;i++) {
         memery_[i] = memery_[i-1] + std::abs(h[i] - h[i-1]);
         for (int j=2;j<=K;j++) {
             if (i-j >= 0) {
                 memery_[i] = std::min(memery_[i], memery_[i-j] + std::abs(h[i] - h[i-j]));
             }
         }
    }
    std::cout << memery_[nums-1] << std::endl;
    return 0;
}

Measured memory_bytes: 1144
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define repr(i, a, b) for(ll i = (a); i < (b); i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
const ll MOD = 1000000007;
const ll INF = 100000000000000000LL;
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; }
inline ll powint(unsigned long long x, ll y){ ll r=1; while(y){ if(y&1) r*=x; x*=x; y>>=1; } return r; }
inline ll powmod(ll x, ll y, ll m = MOD){ ll r=1; while(y){ if(y&1) r*=x; x*=x; r%=m; x%=m; y>>=1; } return r; }
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; }
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll h, w;
    cin >> h >> w;
    ll n;
    cin >> n;
    vll a(n);
    rep(i, n){
        cin >> a[i];
    }
    vvll ans(h, vll(w, 0));
    ll p = 0;
    rep(i, h)rep(j, w){
        ll k = j;
        if(i&1) k = w-1-j;
        ans[i][k] = p+1;
        a[p]--;
        if(a[p] == 0) p++;
    }
    rep(i, h)rep(j, w){
        cout << ans[i][j] << " \n"[j==w-1];
    }
    return 0;
}

Measured memory_bytes: 512
#define rep(i, a, b) for(int i = a; i < (int)(b); i++)
#include <bits/stdc++.h>

typedef long long ll;
using namespace std;
template<class T> inline void chmax(T &a, const T &b) {if(a < b) a = b;}
template<class T> inline void chmin(T &a, const T &b) {if(a > b) a = b;}
const long long INF = 1LL<<60;
// const long long MOD = (ll)1e9+7;
const long long MOD = (ll)1e6+3;
const long long MAX = (ll)170 * 80;


int main(void) {
   ll N;
   cin>>N;
   string s;
   cin>>s;
   ll Num[2] = {};
   rep(i,0,N) {
      if (s[i]=='R') Num[0]++;
      else Num[1]++;
   }
   if (Num[0]>Num[1]) cout<<"Yes"<<endl;
   else cout<<"No"<<endl;
   return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long x,y,ans;
int main()
{
	cin>>x>>y;
	for(;;)
	{
		ans++;
		x*=2;
		if(x>y)
		{
			cout<<ans<<endl;
			return 0;
		}
	}
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;

const int LG = 20;
int dp[LG][100001];

int main(){
    int N, L, Q;
    cin >> N;
    vi x(N);
    rep(i, N)scanf("%d", &x[i]);
    cin >> L >> Q;
    
    rep(i, N){
        int k = --lower_bound(all(x), x[i] + L + 1)-x.begin();
        dp[0][i] = k;
    }

    rep(i, LG - 1){
        rep(j, N){
            dp[i + 1][j] = dp[i][dp[i][j]];
        }
    }

    while(Q--){
        int a, b;
        scanf("%d%d", &a, &b);
        if(a > b)swap(a, b);
        --a; --b;

        int lo = 0, hi = N;
        while(hi - lo > 1){
            int mid, cur = a;
            mid = (hi + lo) / 2;
            rep(i, LG)if(mid >> i & 1){
                cur = dp[i][cur];
            }
            if(cur >= b)hi = mid;
            else lo = mid;
        }
        printf("%d\n", hi);
    }
}

Measured memory_bytes: 9088
#include<bits/stdc++.h>
using namespace std;
int n,k,M,i,j,m;
long long dp[305][305],f[305][305];
int main()
{
	scanf("%d %d %d",&n,&k,&M);
	for(i=0;i<=n;++i)
		f[0][i]=1;
	for(i=1;i<=n;++i)
		for(j=0;j<=n;++j)
		{
			long long s=1;
			for(m=0;m<=j;++m)
			{
				f[i][j]=(f[i][j]+f[i-1][j-m]*s)%M;
				s=s*(i+1)%M;
			}
		}
	dp[0][0]=1;
	for(i=1;i<=k;++i)
		for(j=0;j<=n;++j)
			for(m=0;m<=j;++m)
				dp[i][j]=(dp[i][j]+dp[i-1][j-m]*f[j-m][m])%M;
	cout<<dp[k][n]<<endl;
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
const int INF=1e9+5;
int main() {
    int n,k;
    cin>>n>>k;
    vector<int> h(n);
    for(int i=0;i<n;i++){
        cin>>h[i];
    }
    vector<int> dp(n,INF);
    dp[0]=0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<i+k+1;j++){
            if(j<n){
                dp[j]=min(dp[j],dp[i]+abs(h[j]-h[i]));
            }
        }
    }
    cout<<dp[n-1]<<endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp setprecision
#define pb(x) push_back(x)
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ld, ld> pdd;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = 1e8;
const ll INF = 1e16;
const string alpha = "abcdefghijklmnopqrstuvwxyz";

//a!が2で何回割り切れるか
int log2(int a){
    int sum = 0;
    while(a > 0){
        sum += a/2;
        a /= 2;
    }
    return sum;
}

int main(){
    int N;
    cin >> N;
    int a[N];
    string s;
    cin >> s;
    bool exist[3];
    fill(exist, exist+3, false);
    rep(i, N){
        a[i] = s[i]-'1';
        exist[a[i]] = true;
    }
    bool sub = false;
    if(exist[0] && exist[2] && !exist[1]){
        sub = true;
        rep(i, N) a[i] /= 2;
    }
    int ans = 0;
    rep(i, N){
        //cout << a[i] << endl;
        if(a[i]%2){
            int x = log2(N-1)-log2(N-1-i)-log2(i);
            if(x == 0) ans ^= 1;
        }
    }
    if(sub) ans *= 2;
    cout << ans << endl;
}

Measured memory_bytes: 5252
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <numeric> 
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, t, a;
	vector<int> vec;
	cin >> n >> t >> a;
	double ans = INF, pos;
	for(int i = 0; i < n; i++)
	{
		int h;
		cin >> h;
		double c = t - h * 0.006;
		if(abs(a - c) < ans)
		{
			ans = abs(a - c);
			pos = i;
		}
	}
	cout << pos + 1 << endl;
	return 0;
}



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

ll g1(ll n, int p) {
  if (n == 0) return 0;
  return n / p + g1(n / p, p);
}

ll g2(ll N, int p) {
  if (N % 2 == 1) {
    return g1(N, p) - g2(N - 1, p);
  }
  ll res = g1(N / 2, p);
  if (p == 2) res += N / 2;
  return res;
}

int main() {
  ll N;
  scanf("%lld", &N);
  ll ans = min(g2(N, 2), g2(N, 5));
  printf("%lld", ans);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(b);i>(a);--i)
#define eper(i,a,b) for(int i=((int)(a));i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF 2000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

ll n;
int main() {
 ios::sync_with_stdio ( false );
 cin.tie ( 0 );
    cin >> n;
    ll cnt = 0;
    ll sum = 0;
    while (sum <= n) cnt++, sum += cnt;
    rep(i, 1, cnt + 1) {
        if (i != sum - n) {
            printf("%d\n", i);
        }
    }
    return 0;
}


Measured memory_bytes: 384
#include <stdio.h>

int main(void)
{
	int R,B,W,G,A;
	scanf("%d",&R);	
	scanf("%d",&B);	
	scanf("%d",&W);	
	scanf("%d",&G);
	A=R+W+G+B;
	printf("%d\n",A);
	return 0;
}





Measured memory_bytes: 2056
# -*- coding: utf-8 -*-

s = input()

ans = ""
for i in range(len(s)):

    if s[i] == "0":
        ans += "0"
    
    elif s[i] == "1":
        ans += "1"

    elif s[i] == "B":
        # 文字列が空ではない確認
        if ans != "":
            # 残っている時のみ削除を行う(最後の1文字以外を切り取る)
            ans = ans[0:-1]

print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define mo 1000000007
using namespace std;
int n,k,ans;
int dp[52][2600][52];//到第 i个，已经有 j的奇怪值，有 u个空位 
int main(){
	scanf("%d%d",&n,&k);
	if(k&1){
		puts("0");
		return 0;
	}
	dp[0][1280][0]=1;
	for(int i=0;i<n;i++){
		int now=i+1;
		for(int j=0;j<=2560;j++){
			for(int u=0;u<=i;u++){
				if(!dp[i][j][u])continue;
				int num=dp[i][j][u];
				dp[i+1][j][u]=(dp[i+1][j][u]+1ll*num*(u*2+1)%mo)%mo;
				dp[i+1][j-now][u+1]=(dp[i+1][j-now][u+1]+num)%mo;
				if(u)dp[i+1][j+now][u-1]=(dp[i+1][j+now][u-1]+1ll*num*u*u%mo)%mo;
			}
		}
	}
	if(k+1280>2560)puts("0");
	else printf("%d\n",dp[n][(k>>1)+1280][0]);
	return 0;
}

Measured memory_bytes: 25088
#include <bits/stdc++.h>
using namespace std;
int h,w;
int main(){
    std::cin >> h>>w;
    for (int i = 0; i < h+2; i++) {
        string s;
        if(i==0||i==h+1){
            for (int j = 0; j < w+2; j++) {
                s+='#';
            }
        }else{
            for (int j = 0; j < w+2; j++) {
                char c;
                if(j==0||j==w+1){
                    s+='#';
                }else{
                    std::cin >> c;
                    s+=c;
                }
            }
        }
        std::cout << s << std::endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define X first
#define Y second
#define pb push_back
#define CL(x) (x << 1)
#define CR(x) ((x << 1) + 1)
#define sqr(x) ((x) * (x))
typedef long long cc;
typedef long double ld;
typedef pair <int, int> pt;
const int N = 100005;
int n, c[N];

int main() {
    std :: ios_base :: sync_with_stdio(false); cin.tie(NULL);
    cin >> n;
    while (n--) {
        int x; cin >> x;
        if (x > 0) c[x - 1]++;
        c[x]++;
        c[x + 1]++;
    }
    int res = 1;
    for (int i = 0; i <= 100001; i++)
        res = max(res, c[i]);
    cout << res;
    return 0;
}


Measured memory_bytes: 640
PROGRAM-ID.                      ABC_102_C.
ENVIRONMENT                      DIVISION.
INPUT-OUTPUT                     SECTION.
FILE-CONTROL.
    SELECT SYSIN ASSIGN TO KEYBOARD ORGANIZATION LINE SEQUENTIAL.

DATA                             DIVISION.
FILE                             SECTION.
    FD  SYSIN.
        01 INDATA PIC X(2200000).

WORKING-STORAGE                  SECTION.
    01 N       PIC 9(6).

    01 INP     PIC X(2200000).

    01 maxlen  PIC 9(7).
    01 cur     PIC 9(7) VALUE 1.
    01 i       PIC 9(18) BINARY VALUE 1.
    01 j       PIC 9(18).
    01 len     PIC 9(7).

    01 B1.
        03 B11 OCCURS 2200000 DEPENDING ON maxlen INDEXED BIX.
            05 B PIC S9(11).

    01 x       PIC S9(11).
    01 t       PIC 9(10).
    01 s       PIC 9(15).

    01 tmp     PIC 9(6).

    01 ans     PIC X(15).

    01 ZS      PIC Z(15)9.
    01 DUMMY   PIC X(1).

PROCEDURE                        DIVISION.
    ACCEPT N.

    OPEN INPUT SYSIN.

    READ SYSIN INTO INP.

    CLOSE SYSIN.

    MOVE N TO maxlen.

    PERFORM maxlen TIMES
        PERFORM VARYING j FROM cur BY 1
            UNTIL INP(j:1) = SPACE
        END-PERFORM

        COMPUTE len = j - cur

        MOVE INP(cur:len) TO x

        SUBTRACT i FROM x

        SET BIX TO i

        MOVE x TO B(BIX)

        COMPUTE cur = j + 1

        ADD 1 TO i
    END-PERFORM.

    SORT B11 ON ASCENDING KEY B.

*> 中央 index
    SUBTRACT 1 FROM N GIVING tmp.

    DIVIDE 2 INTO tmp GIVING tmp.

    ADD 1 TO tmp.

    SET BIX TO tmp.

    MOVE B(BIX) TO x.

    MOVE ZERO TO s.

    MOVE 1 TO i.

    PERFORM maxlen TIMES
        SET BIX TO i

        SUBTRACT B(BIX) FROM x GIVING t

        ADD t TO s

        ADD 1 TO i
    END-PERFORM.

    MOVE s TO ZS.

    PERFORM UNANS.

    DISPLAY ans(1:FUNCTION STORED-CHAR-LENGTH(ans)).
    STOP RUN.

UNANS                            SECTION.
    UNSTRING
        ZS DELIMITED BY ALL SPACE
        INTO DUMMY ans
    END-UNSTRING.


Measured memory_bytes: 30460
a, b, c, d = list(input())
for op1 in ['+', '-']:
    for op2 in ['+', '-']:
        for op3 in ['+', '-']:
            tmp = a + op1 + b + op2 + c + op3 + d
            if eval(tmp) == 7:
                print(tmp+'=7')
                exit()


Measured memory_bytes: 2940
#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdint.h>
#include<vector>
#include<deque>
#include<stack>
#include<functional>
#include<string>
#include<cstring>
#include<time.h>
#include<array>
#include<iomanip>
#include<list>
#include<set>
#include<map>
#include<random>
#include<unordered_map>
#include<unordered_set>
#include<bitset>
#include <queue>


using namespace std;
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using ldb = long double;


//BDD,ZDD,kdtree, bdtree,bicalc, bolonoy, doloney, tree, chinesemod,segmenttree,daikusutora, saidairyuu, 2bugurahu, heirokenshutu, topologicalsort, kyourenketuseibun

#define REP(i,a,b) for(ll i = a; i < b; ++i)
#define PRI(s) cout << s << endl
#define PRIY PRI("Yes")
#define PRIN PRI("No")
#define MINS(a,b) a = min(a,(decltype(a))(b))
#define MAXS(a,b) a = max(a,(decltype(a))(b))


int main() {
	ll N;
	cin >> N;
	vector<pair<ll,ll>> P(N);
	
	REP(i, 0, N) {
		cin >> P[i].first >> P[i].second;
	}

	sort(P.begin(), P.end(), [](const pair<ll, ll>& a, const pair<ll, ll>& b) {return atan2l(a.second, a.first) < atan2l(b.second, b.first); });

	ldb ans = 0;
	REP(i, 0, N) {
		REP(j, i, i + N) {
			pair<ll, ll> p = { 0,0 };
			REP(k, i, j + 1) {
				p.first += P[k % N].first;
				p.second += P[k % N].second;
			}
			MAXS(ans, sqrtl(p.first* p.first + p.second * p.second));
		}
	}
	printf("%.11Lf\n", ans);
	return 0;
}




Measured memory_bytes: 3840
#include<iostream>
#include<algorithm>
#include<vector>
#include<math.h>

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i, a, n) for (int i = a; i <= (n); ++i)
#define yorn(f) puts((f) ? "Yes" : "No")
#define YORN(f) puts((f) ? "YES" : "NO")

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

int main() {
    int N; cin >> N;
    int L; cin >> L;

    vector<string> vc;
    rep(i, N) {
        string s; cin >> s;
        vc.push_back(s);
    }

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

    string res = "";
    rep(i, N) res += vc[i];

    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ll int
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define all(x) x.begin(),x.end()
#define sz(x) (ll)x.size() 

ll pwr[10000005];

int main()
{
    ios_base::sync_with_stdio(false);
	ll n,i,j,k,x,y,t,m;

	cin >> n;
	pwr[0]=1;
	for(i=1;i<=1e7;i++)
		pwr[i]=(pwr[i-1]*10)%n;

	ll f=0;
	x=0;
	for(i=0;i<=1e7;i++)
	{
		x+=7*pwr[i];
		x%=n;
		if(!x)
		{
			f=1;
			cout<<(i+1)<<endl;
			break;
		}
	}
	if(!f)
		cout<<-1<<endl;
}

Measured memory_bytes: 42704
module Dfs
  # Node
  class Node
    attr_accessor :id, :edges, :visited, :progress

    def initialize(id, edges = [], visited = false, progress = false)
      @id, @edges, @visited, @progress = id, edges, visited, progress
    end
  end

  # Edge
  class Edge
    attr_accessor :to

    def initialize(to)
      @to = to
    end
  end

  # Graph
  class Graph
    attr_accessor :d, :f

    def initialize(data, counter)
      @counter = counter
      @d, @f = [], []
      @nodes = data.map do |id, edges|
        edges.map! { |edge| Edge.new(*edge) }
        Node.new(id, edges)
      end
    end

    def dfs(start)
      search(start)

      loop do
        visited_node = nil
        @nodes.each do |node|
          next if node.visited == true
          visited_node = node
          break
        end
        break if visited_node.nil?
        search(visited_node.id)
      end
    end

    def search(start)
      node = @nodes.find { |node| node.id == start }
      return if node.visited == true
      node.visited = true
      @d[node.id] = @counter.call
      node.edges.each do |edge|
        search edge.to
      end
      node.progress = true
      @f[node.id] = @counter.call
    end
  end
end

def create_counter
  count = 0
  return proc { count += 1 }
end

n = gets.chop.to_i

data = {}

n.times do
  u, k, *v = gets.chop.split.map(&:to_i)
  data[u] = v
end

g = Dfs::Graph.new data, create_counter
g.dfs(1)

1.upto(n) do |i|
  puts "#{i} #{g.d[i]} #{g.f[i]}"
end

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

int main(void) {
  int n; cin >> n;
  cout << (n - 1) / 2 << endl;

  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstdlib>
#include<iostream>
#include<vector>
#include<map>
#include<cmath>
using namespace std;
int N,A;

int main(int argc, char const *argv[])
{
    cin>>N>>A;
    cout<<N*N-A<<endl;
    return 0;
}


Measured memory_bytes: 256