akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdint>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

int main() {
  std::cin.tie(0); std::ios::sync_with_stdio(false);
  int N; std::cin >> N;
  int ac = 0, wa = 0, tle = 0, re = 0;
  for(int i = 0; i < N; ++i) {
    std::string s; std::cin >> s;
    if(s == "AC") ++ac;
    if(s == "WA") ++wa;
    if(s == "TLE") ++tle;
    if(s == "RE") ++re;
  }
  std::cout << "AC x " << ac << "\n";
  std::cout << "WA x " << wa << "\n";
  std::cout << "TLE x " << tle << "\n";
  std::cout << "RE x " << re << "\n";
  return 0;
}


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

#define ll long long
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define SPEED ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define sz size()
#define all(x) x.begin(),x.end()
#define OO 1e18
#define iOO INT_MAX
#define Mdp memset(dp,-1,sizeof dp)
#define R return
#define Test int TT;cin>>TT;for(int T=1;T<=TT;T++)
using namespace std;
const ll Mod = 1e9+7;
int n,a[22][22];
ll dp[22][(1<<22)];

ll Solve(int i=0,int Mask=0)
{
    if(i == n)
        R 1;

    ll &Res = dp[i][Mask];
    if(Res != -1)
        R Res;

    Res = 0;
    for(int j=0;j<n;j++)
    {
        if(!(Mask&(1<<j)) && a[i][j])
        {
            Res += Solve(i+1,Mask|(1<<j));
            Res = ((Res%Mod)+Mod)%Mod;
        }
    }

    R Res;
}


int main()
{

    SPEED;
    cin >> n ;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)
        {
            cin >> a[i][j];
        }
    }
    Mdp;
    cout << Solve() << endl;

    R 0;
}


Measured memory_bytes: 721152
#include <iostream>

using namespace std;

int main()
{
	float n;
	cin >> n;

	float p = 0;

	int odd = 0, even = 0;

	for (int i=1;i<=n;i++)
	{
		if (i % 2 == 0)
			even++;
		else
			odd++;
	}

	p = odd / n;

	cout << p;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
using ll = long long;
#define chmin(i, j) i = min(i, j);
#define chmax(i, j) i = max(i, j);
#define rep(i, n) for(int i=0;i<n;i++)
int main() {
  ll x, y, a, b, c;
  cin >> x >> y >> a >> b >> c;
  vector<ll> p(a);
  vector<ll> q(b);
  vector<ll> r(c);
  rep(i, a) cin >> p[i];
  rep(i, b) cin >> q[i];
  rep(i, c) cin >> r[i];
  sort(p.rbegin(), p.rend());
  sort(q.rbegin(), q.rend());
  sort(r.begin(), r.end());
  vector<int> tp(x);
  vector<int> tq(y);
  rep(i, x) tp[i] = p[i];
  rep(i, y) tq[i] = q[i];
  int pback = x-1;
  int qback = y-1;
  int voi = c-1;
  while(voi != -1 && (pback != -1 || qback != -1)) {
    if(pback == -1) {
      if(tq[qback] >= r[voi]) break;
      else {
        tq[qback] = r[voi];
        voi--;
        qback--;
      }
    }
    else if(qback == -1) {
      if(tp[pback] >= r[voi]) break;
      else {
        tp[pback] = r[voi];
        voi--;
        pback--;
      }
    }
    else {
      ll v = r[voi] - tp[pback];
      ll u = r[voi] - tq[qback];
      if(v <= 0 && u <= 0) break;
      if(v < u) {
        tq[qback] = r[voi];
        qback--;
      }
      else {
        tp[pback] = r[voi];
        pback--;
      }
      voi--;
    }
  }
  ll ans = 0;
  rep(i, x) ans += tp[i];
  rep(i, y) ans += tq[i];
  cout << ans << endl;
  return 0;
}


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

using namespace std;

class Node;
Node *Nodes;

class Node
{
  public:
    Node(){ MyId = ParentId = Right = Left = Sibling = -1; Depth = Height = 0; }
    int MyId;
    int ParentId;
    int Left, Right;
    int Depth;
    int Height;
    int Sibling;

    void Print()
    {
      int Degree = 0;

      if(Left >= 0) Degree++;
      if(Right >= 0) Degree++;

      cout << "node " << MyId << ": "
	<< "parent = " << ParentId << ", " 
	<< "sibling = " << Sibling << ", "
	<< "degree = " << Degree << ", "
	<< "depth = " << Depth << ", " 
	<< "height = " << Height << ", "
	<< (ParentId == -1 ? "root" : (Left >= 0 || Right >= 0) 
	    ? "internal node" : "leaf")
	<< endl;
    }


};


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

  Nodes = new Node[N];

  for(int i = 0; i < N; ++i)
    Nodes[i].MyId = i;

  for(int i = 0; i < N; ++i)
  {
    int Id; cin >> Id;
    int Left; cin >> Left;
    int Right; cin >> Right;

    if(Left >= 0)
    {
      Nodes[Id].Left = Left;
      Nodes[Left].ParentId = Id;

      if(Right >= 0)
	Nodes[Left].Sibling = Right;
    }
    if(Right >= 0)
    {
      Nodes[Id].Right = Right;
      Nodes[Right].ParentId = Id;

      if(Left >= 0)
	Nodes[Right].Sibling = Left;
    }  
  }

  for(int i = 0; i < N; ++i)
  {
    int p = i;
    while(Nodes[p].ParentId != -1)
    {
      Nodes[i].Depth++;
      int Old = Nodes[p].Height;
      p = Nodes[p].ParentId;

      Nodes[p].Height = Nodes[p].Height < Old + 1 ? Old + 1 : Nodes[p].Height;
      
    }
  }

  for(int i = 0; i < N; ++i)
    Nodes[i].Print();

  delete [] Nodes;

  return 0;
}



Measured memory_bytes: 3100
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = (a); i <= (b); i++)
#define rng(a) a.begin(), a.end()
#define ina(n,a) cin >> n; for(int i = 1; i <= n; i++) cin >> a[i]
#define sz(x) (int)(x).size()
#define se second
#define fi first
#define prev            coyhhhhhhyoc    
#define next          sdNNNmNNNNNNNmds  
#define y0           hNNNNy_yNNNNNN_sNh
#define y1          mNNNNNdtdNNNNNNtsNNm
#define yn          mNNNNNNNNy___smNNNms
#define tm            oooooosyysooooot 
#define read               tyhyt        
#define rank              ytmNmo         
#define index              yyy
#define pb push_back
#define pcnt __builtin_popcountll
#define rrep(i,a,b) for(int i = (b); i >= (a); i--)
#define rall(x,a) for(auto x : a)
#define MOD 1000000007
#define endl "\n"
#define int long long
typedef long long ll;
using namespace std;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, a, b;
    cin >> n >> a >> b;
    int k = n / (a + b) * a;
    n %= (a + b);
    k += min(n, a);
    cout << k << endl;
    return 0;
}


Measured memory_bytes: 256
//Author : pakhandi
//
using namespace std;

#include<bits/stdc++.h>

#define wl(n) while(n--)
#define fl(i,a,b) for(i=a; i<b; i++)
#define rev(i,a,b) for(i=a; i>=b; i--)

#define si(n) scanf("%d", &n)
#define sll(l) scanf("%lld",&l)
#define ss(s) scanf("%s", s)
#define sc(c) scanf("%c", &c)
#define sd(f) scanf("%lf", &f)

#define pi(n) printf("%d\n", n)
#define pll(l) printf("%lld\n", l)
#define ps(s) printf("%s\n", s)
#define pc(c) printf("%c\n", c)
#define pd(f) printf("%lf\n", f)

#define debug(x) cout<<"\n#("<<x<<")#\n"
#define nline printf("\n")

#define mem(a,i) memset(a,i,sizeof(a))

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int

#define mclr(strn) strn.clear()
#define ignr cin.ignore()
#define PB push_back
#define SZ size
#define MP make_pair
#define fi first
#define sec second

int N;

std::vector<int> cards;

int main()
{
	int i, j;

	cin >> N;

	ll ans = 0;

	fl(i,0,N)
	{
		int temp;
		cin >> temp;
		cards.PB(temp);
	}

	fl(i,0,N)
	{
		if(cards[i] & 1)
		{
			if(i + 1 < N && cards[i + 1] != 0)
			{
				cards[i + 1]--;
				cards[i]++;
			}
		}
		ans += cards[i] / 2;

	}

	cout<<ans;


	return 0;
}
/*
	Powered by Buggy Plugin
*/


Measured memory_bytes: 892
#include <stdio.h>
#define N 6
#define MAX 102

int main(void){

	int i, face[N], temp;
	char str[MAX];
	
	for(i = 0; i < N; i++){
		scanf("%d", &face[i]);
	}
	while(fgets(str, MAX, stdin) != NULL){
		for(i = 0; str[i] != '\n'; i++){
			if(str[i] == 'E'){
				temp = face[3];
				face[3] = face[5];
				face[5] = face[2];
				face[2] = face[0];
				face[0] = temp;
			}
			else if(str[i] == 'W'){
				temp = face[3];
				face[3] = face[0];
				face[0] = face[2];
				face[2] = face[5];
				face[5] = temp;
			}
			else if(str[i] == 'S'){
				temp = face[4];
				face[4] = face[5];
				face[5] = face[1];
				face[1] = face[0];
				face[0] = temp;
			}
			else if(str[i] == 'N'){
				temp = face[4];
				face[4] = face[0];
				face[0] = face[1];
				face[1] = face[5];
				face[5] = temp;
			}
		}
	}
	printf("%d\n", face[0]);	
	return 0;
}

Measured memory_bytes: 604
#include<iostream>
#include<vector>
#include<algorithm>
#include<tuple>
#include<utility>

using namespace std;

typedef long long int64;

int main(void){
    int64 n,k,ans=0;
    cin>>n>>k;
    vector<int64> h(n);
    for (int64 i = 0; i < n; i++)
    {
        cin>>h[i];
    }

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

    for (int64 i = 0; i < n - k; i++)
    {
        ans+=h[i];
    }

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

Measured memory_bytes: 1792
#include <stdio.h>
#include <string.h>

int main(void)
{
	char a[102],b[102];
	int i;
	scanf("%s%s",a,b);
	if(strlen(a)>strlen(b)){
		puts("GREATER");
		return 0;
	}
	else if(strlen(b)>strlen(a)){
		puts("LESS");
		return 0;
	}
	for(i=0;i<strlen(a);i++){
		if(a[i]>b[i]){
			puts("GREATER");
			return 0;
		}
		else if(b[i]>a[i]){
			puts("LESS");
			return 0;
		}
	}
	puts("EQUAL");
	return 0;
}

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

int main(){
	int n,k;
	//if(scanf("%d %d", &n, &k)==EOF){return 0;}
	cin >> n >> k;
	vector<int> sticks(n);
	for(int i = 0; i < n ; i++){
		//if(scanf("%d", &l)==EOF){return 0;}
		cin >> sticks[i];
	}
	
	sort(sticks.begin(), sticks.end());
	int max = 0;
	for(int i = 0; i< k; i++){max += sticks[n-1-i];}	
	//printf("%d\n", max);
	cout << max << endl;
	return 0;

}

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


int main(){

	string s;
	cin >> s;

	bool even = true;

	for(int i = 0; i < s.size(); i++){
		if(even){
			even = false;
			if(s[i] == 'R' || s[i] == 'U' || s[i] == 'D'){
				continue;
			}
			else{
				std::cout << "No" << endl;
				return 0;
			}
		}else{// 偶数
			even = true;
			if(s[i] == 'L' || s[i] == 'U' || s[i] == 'D'){
				continue;
			}else{
				std::cout << "No" << endl;
				return 0;
			}
		}
	}

	std::cout << "Yes" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int N, Y;

int main() {
	cin >> N >> Y;
	int a, b, c;   //10000,5000,1000
	for (int a = 0; a <= N; a++) {
		for (int b = 0; b <= N - a; b++) {
			c = N - a - b;
			if (c < 0)continue;
			if (10000 * a + 5000 * b + 1000 * c == Y) {
				cout << a << " " << b << " " << c << endl;
				return 0;
			}
		}
	}
	cout << "-1 -1 -1" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>

int main()
{
	int n;
	int d, min, max;
	long long sum;

	scanf("%d%d", &n, &d);
	sum = min = max = d;
	while (--n > 0) {
		scanf("%d", &d);
		if (d < min) min = d;
		if (d > max) max = d;
		sum += d;
	}
	printf("%d %d %lld\n", min, max, sum);
	return 0;
}


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

using namespace std;
typedef long long ll;

int main() {
	ll W, H, temp;
	ll ans = 0;
	vector<pair<ll, int> > p;
	cin >> W >> H;
	for(int i=0;i<W;i++) {
		cin >> temp;
		p.push_back(make_pair(temp, 0));
	}
	for(int i=0;i<H;i++) {
		cin >> temp;
		p.push_back(make_pair(temp, 1));
	}
	sort(p.begin(), p.end());
	ll a = W + 1, b = H + 1;
	for(int i=0;i<W+H;i++) {
		if(p[i].second) {
			ans += p[i].first * a;
			b--;
		} else {
			ans += p[i].first * b;
			a--;
		}
	}

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


Measured memory_bytes: 4592
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(int i = m, i##_len = (n); i < i##_len; ++i)
#define reprev(i, n) for(int i = (n-1LL); i >= 0; --i)
#define all(x) (x).begin(), (x).end()
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 <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

struct UnionFind {
  vector< int > data;
 
  UnionFind(int sz) {
    data.assign(sz, -1);
  }
 
  bool unite(int x, int y) {
    x = find(x), y = find(y);
    if(x == y) return (false);
    if(data[x] > data[y]) swap(x, y);
    data[x] += data[y];
    data[y] = x;
    return (true);
  }
 
  int find(int k) {
    if(data[k] < 0) return (k);
    return (data[k] = find(data[k]));
  }
 
  int size(int k) {
    return (-data[find(k)]);
  }
};

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m; cin >> n >> m;
    vector<P> br(m); 
    rep (i, m) {
        cin >> br[i].first >> br[i].second;
        br[i].first--; br[i].second--;
    }
    UnionFind uf(n);
    vector<ll> ans;
    reprev (i, m) {
        ll a = uf.size(br[i].first), b = uf.size(br[i].second);
        eprintf("%d %d\n", a, b);
        ans.push_back(((uf.find(br[i].first) != uf.find(br[i].second)) ? a * b : 0));
        uf.unite(br[i].first, br[i].second);
    }
    reverse(all(ans));
    ll tmp = 0;
    rep (i, ans.size()) {
        tmp += ans[i];
        cout << tmp << "\n";
    }
    return 0;
}

Measured memory_bytes: 3444
/**
 * Created by hiramekun at 20:57 on 2020-05-03.
 */
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using P = pair<ll, ll>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template<typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = ll(n - 1); i >= 0; i--)
#define each(i, mp) for(auto& i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template<class T>
ostream &operator<<(ostream &out, const vector<T> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << ' ';
    return out;
}

template<class T>
istream &operator>>(istream &in, vector<T> &list) {
    ll n = list.size();
    rep(i, n) in >> list[i];
    return in;
}

template<class T>
ostream &operator<<(ostream &out, const vector<vector<T>> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << '\n';
    return out;
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */

void solve() {
    string s;
    cin >> s;

    if (s == "ABC") cout << "ARC" << '\n';
    else cout << "ABC" << '\n';
}

int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
        solve();
#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

vector<int> g[100001];
int dp[100001];
int dfs(int v){
    if(dp[v]!=0) return dp[v];
    rep(i,g[v].size()){
        dp[v]=max(dp[v],dfs(g[v][i])+1);
    }
    return dp[v];
}
int main(){
    int n,m,xi,yi;
    cin>>n>>m;
    rep(i,m){
        cin>>xi>>yi;
        --xi,--yi;
        g[xi].pb(yi);
    }
    rep(i,n) dfs(i);
    int ans=0;
    rep(i,n) ans=max(ans,dp[i]);
    cout<<ans<<endl;
    return 0;
}


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

main(){
  int h,w;cin >> h >> w;
  string str[50];for(int i=0;i<h;i++) cin >> str[i];
  
  const int dx[8] = {1,0,-1,0,1,-1,-1,1};
  const int dy[8] = {0,1,0,-1,1,1,-1,-1};
  
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(str[i][j] == '#') {
        cout << '#';
        continue;
      }
      
      int cnt=0;
      
      if(str[i][j] == '.'){
        for(int k=0;k<8;k++){
          const int ni = i + dy[k];
          const int nj = j + dx[k];
          if(ni < 0 || ni >=h) continue;
          if(nj < 0 || nj >=w) continue;
          
          if(str[ni][nj] == '#') cnt++;
        }
        cout << cnt;
      }
    }
    cout << endl;
  }
  return 0;
} 

Measured memory_bytes: 3632
import numpy as np
import sys ; sys.setrecursionlimit(2000)
import copy

def dfs(v1):
    visited[v1] = 1
    for v2 in range(n):
        if graph[v1][v2] == 0: continue
        if visited[v2] == 1: continue
        dfs(v2)
# nは頂点の数
n, m = map(int,input().split())
ab = np.array([list(map(int,input().split())) for i in range(m)])
a,b = ab.T[0]-1,ab.T[1]-1

#隣接行列
G = np.array([[0] * n for _ in range(n)])
for aa,bb in zip(a,b): G[aa][bb],G[bb][aa] = 1,1

ans = 0
for aa,bb in zip(a,b):
    graph = copy.deepcopy(G)
    graph[aa][bb],graph[bb][aa] = 0,0
    visited = [0]*(n)
    dfs(0)
    if not all(visited): ans += 1

print(ans)




Measured memory_bytes: 12516
from collections import Counter
n,m = map(int,input().split())
a_ls = list(map(int, input().split()))
counter = Counter(a_ls)
for i in range(m):
    b,c = map(int,input().split())
    counter[c] += b

cards = sorted(counter.items(), key = lambda x:x[0], reverse=True)
rest = n
Sum = 0
for num, count in cards:
    if count < rest:
        Sum += num * count
        rest -= count
    else:
        Sum += rest * num
        break
print(Sum)


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

#define ll long long;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

struct fast_ios {
  fast_ios() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
  };
} fast_ios_;

int main() {
  int N;
  cin >> N;
  string s;
  cin >> s;
  int l = 0, r = N - 1, res = 0;
  while (1) {
    while (l < r && s[l] == 'R')
      ++l;
    while (l < r && s[r] == 'W')
      --r;
    if (l == r)
      break;
    swap(s[l], s[r]);
    ++res;
  }
  cout << res << '\n';
  return 0;
}



Measured memory_bytes: 3788
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <string>
#include <math.h>
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) {
	ll c = a % b;
	while (c) {
		a = b;
			b = c;
			c = a % b;
	}
	return b;
}
int main() {
	ll a, b;
	cin >> a >> b;
	cout << a * b / gcd(a, b);
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String args[]) throws Exception {
        BufferedReader bu = new BufferedReader(new InputStreamReader(System.in));
        int t = 1;
        StringBuilder sb = new StringBuilder();
        while (t-- > 0) {
            int n = Integer.parseInt(bu.readLine());
            int [] arr = new int[n];
            long money = 1000, stocks = 0;
            String[]inp = bu.readLine().split(" ");
            for (int pos = 0; pos < n; pos++) {
                arr[pos] = Integer.parseInt(inp[pos]);
            }
            int pos = 0, valley = 0, peak = 0;
            while (pos < n-1){
                while (pos < n-1 && arr[pos]>=arr[pos+1]){
                    pos++;
                }
                valley = pos;
                while (pos < n-1 && arr[pos]<=arr[pos+1]){
                    pos++;
                }
                peak = pos;
//                System.out.println(arr[peak]+" "+arr[valley]);
                stocks = money/arr[valley];
                money -= stocks*arr[valley];
                money+=arr[peak]*stocks;
            }
            sb.append(money+"\n");
        }
        System.out.print(sb);
    }
}


Measured memory_bytes: 36396
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "\n" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

void halve(int d, lint c, lint &cnt, vector<int> &rem) {

	if (c == 1) {
		rem.emplace_back(d);
		return;
	}

	if (c & 1) rem.emplace_back(d);

	if (d <= 4) {
		d *= 2;
		cnt += c / 2;
	}
	else {
		d = 1 + 2 * d % 10;
		cnt += c - (c & 1);
	}

	halve(d, c / 2, cnt, rem);

};

void simulate(lint &cnt, vector<int> &vec) {

	if (vec.size() == 1) return;

	assert(vec.size() != 0);

	int back1 = vec.back();
	vec.pop_back();
	int back2 = vec.back();

	DMP(back1, back2);

	int sum = back1 + back2;
	if (sum <= 9) {
		cnt++;
		vec.back() = sum;
	}
	else {
		cnt += 2;
		vec.back() = 1 + sum % 10;
	}

	simulate(cnt, vec);

}

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int M;
	cin >> M;
	lint ans = 0;
	vector<int> rem;
	for (int i = 0; i < M; i++) {

		lint d, c;
		cin >> d >> c;
		halve(d, c, ans, rem);

	}

	DMP(ans, rem);
	simulate(ans, rem);

	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 18792
import collections
n = int(raw_input())
hs = map(int, raw_input().split(' '))
def f(nums):
	cc,count = collections.Counter(), 0

	#j - i = aj + ai  =>  ai + i = j - aj
	for i in range(len(nums)-1, -1, -1):
		count += cc[nums[i] + i]
		cc[i - nums[i]]+=1
	return count
		


print f(hs)

Measured memory_bytes: 112396
#include <stdio.h>
#include <string.h>
int main(void)
{
  int i,n;
  long long int base,sum=0,a[1000000]={0};
  scanf("%d", &n);
  for(i=0;i<n;i++){
    scanf("%lld", &a[i]);
  }
  base=a[0];
  for(i=1;i<n;i++){
    if(base>a[i]) sum+=base-a[i];
    else base = a[i];
  }
  printf("%lld", sum);
  return 0;
}

Measured memory_bytes: 9540
#include <iostream>
#include <vector>
#include <float.h>

int main() {
	int n;
	std::cin >> n;
	std::vector<double> p(n, 0);
	std::vector<double> q(n + 1, 0);
	std::vector<std::vector<double>> CostMat(n, std::vector<double>(n, 0));

	for (int i = 0; i < n; i++) {
		std::cin >> p[i];
	}
	for (int i = 0; i < n + 1; i++) {
		std::cin >> q[i];
	}

	// 対角成分
	for (int i = 0; i < n; i++) {
		CostMat[i][i] = p[i] + 2.0 * q[i] + 2.0 * q[i + 1];
	}

	// 動的計画法により最小コストを求める
	for (int i = 1; i < n; i++) {
		for (int j = 0; j < n - i; j++) {
			double min = DBL_MAX;
			for (int l = 0; l <= i; l++) {
				double tmp = 0;
				if (l != i) {
					tmp += CostMat[j + l + 1][i + j];
				}
				if (l != 0) {
					tmp += CostMat[j][j + l - 1];
				}
				if (l == 0) {
					tmp += q[j];
				}
				if (l == i) {
					tmp += q[j + i + 1];
				}
				if (tmp < min) {
					min = tmp;
				}
			}
			//std::cout << min << std::endl;
			CostMat[j][i + j] = min;
			for (int k = j; k <= j + i; k++) {
				CostMat[j][i + j] += p[k] + q[k];
			}
			CostMat[j][i + j] += q[j + i + 1];
		}
	}

	std::cout << CostMat[0][n - 1] << std::endl;
}


Measured memory_bytes: 4944
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import permutations,combinations
from collections import defaultdict,Counter
from bisect import bisect_left,bisect_right
# from math import gcd,ceil,floor,factorial
# from fractions import gcd
from functools import reduce
from pprint import pprint

def myinput():
    return map(int,input().split())

def mylistinput(n):
    return [ list(myinput()) for _ in range(n) ]

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col,reverse_flag):
    data.sort(key=lambda x:x[col],reverse=reverse_flag)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(" ")
        elif type(ls[0])==str:
            print(" ".join(ls))
        elif type(ls[0])==int:
            print(" ".join(map(str,ls)))
        else:
            print("Output Error")
    else:
        if len(ls)==0:
            print("")
        elif type(ls[0])==str:
            print("".join(ls))
        elif type(ls[0])==int:
            print("".join(map(str,ls)))
        else:
            print("Output Error")

# ----- heapq ここから-----
import heapq
class Reverse:
    def __init__(self, val):
        self.val = val
        
    def __lt__(self, other):
        return self.val > other.val
        
    def __repr__(self):
        return repr(self.val)
    
class Heapq:
    def __init__(self, arr, desc = False):
        if desc:
            for i in range(len(arr)):
                arr[i] = Reverse(arr[i])
        self.desc = desc
        self.hq = arr
        heapq.heapify(self.hq)
 
    def pop(self):
        if self.desc: return heapq.heappop(self.hq).val
        else: return heapq.heappop(self.hq)
 
    def push(self, a):
        if self.desc: heapq.heappush(self.hq, Reverse(a))
        else: heapq.heappush(self.hq, a)
 
    def top(self):
        if self.desc: self.hq[0].val
        else: return self.hq[0]
# ----- heapq ここまで-----

n,k = myinput()
v = list(myinput())
vr = v[::-1]

ls = [-1,-1]
ans = -float("inf")
for a in range(k+1):
    for b in range(min(k-a+1,n-a+1)):
        have = []
        have.extend( v[:a] )
        have.extend( vr[:b] )
        p = [ i for i in have if i>=0 ]
        m = [ i for i in have if i<0 ]
        m.sort()
        r = k - a - b
        m = m[r:]
        ans_tmp = sum(p)+sum(m)
        if ans<ans_tmp:
            ls[0] = a
            ls[1] = b
        ans = max(ans,ans_tmp)
# print(ls)
print(ans)

Measured memory_bytes: 42480
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
      	int M = N;
		int sum = 0;
		while(N != 0){
			sum += N%10;
			N /= 10;
		}
		System.out.println(M%sum == 0? "Yes": "No");
	}
}

Measured memory_bytes: 21844
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;

long long N, K, H[100009], dp[100009];

int main() {
	cin >> N >> K;
	for (int i = 1; i <= N; i++) cin >> H[i];
	for (int i = 1; i <= N; i++) dp[i] = (1LL << 60);
	dp[1] = 0;
	for (int i = 2; i <= N; i++) {
		for (int j = i - K; j <= i - 1; j++) {
			if (j <= 0) continue;
			dp[i] = min(dp[i], dp[j] + abs(H[j] - H[i]));
		}
	}
	cout << dp[N] << endl;
	return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>

int main(void){
    int n, x = 0, max = 0, i = 0;
    char s[101];

    scanf("%d %s", &n, s);
    while(i < n){
        if(s[i] == 'I'){
            while(s[i] == 'I'){
                x++;
                i++;
            }
            if(max < x) max = x;
        }else{
            while(s[i] == 'D'){
                x--;
                i++;
            }
        }
    }
    printf("%d", max);

    return 0;
}

Measured memory_bytes: 1732
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back

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

void solve(int n, int k, int s) {
    LL ans = 0;
    REP(i, (1 << (n))) {
        int cnt = 0;
        int buf = 0;
        REP(j, n) if (i & (1 << j)) {
            cnt++; buf += j + 1;
        }
        if (buf == s && cnt == k) {
            ans++;
        }
    }
    cout << ans << endl;
    return;
}

signed main(void) {
    int n, m, p, a, b, c, x, y, z, q;
    string s;
    bool f = false;
    while (cin >> n >> m >> p, n) {
        solve(n, m, p);
        //return 0;
    }
}

Measured memory_bytes: 2984
#include <bits/stdc++.h>
#define pi 3.14159
using namespace std;
typedef long long LL;
const LL MOD = 1e9 + 7;
const int N = 2e7 + 9, M = 1e7, OO = 0x3f3f3f3f;
#define AC ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin.sync_with_stdio(0);
int main()
{
int n,i;
string com,s="";
cin>>com;
n=com.size();
for(i=0;i<n;++i){
    if(com[i]=='B'){
        if(s.size()){
            s.pop_back();
        }
    }
    else{
        s+=com[i];
    }
}
cout<<s;


    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<map>
#include<cmath>
#include<string>
#include<bitset>
#include <sstream>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long ll;

int main()
{

    char c;
    cin>>c;
    c++;
    cout<<c<<endl;
}

Measured memory_bytes: 256
// Sort I - Bubble Sort
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_2_A&lang=jp
using System;
using System.Linq;

namespace ALDS1_2_A {
	class Program {
		public Program() {}
		
		public static void Main() {
			new Program().Calc();
		}
		
		void Calc() {
			var N = int.Parse(Input);	// Number of elements
			var A = Input				// Array : N elements
					.Split(' ')
					.Select(i => int.Parse(i))
					.ToArray();
			bubbleSort(A, N);
		}
		
		String Input {
			get {
				return Console.ReadLine();
			}
		}
		
		void Output(String str) {
			Console.WriteLine(str);
		}

        void bubbleSort(int[] A, int N){
            int swapCount = 0;
            int tmp;
            for(int i = 0; i < N -1; i++){
                for(int j = N - 1; j > i; j--){
                    if(A[j-1] <= A[j]) continue;
                    tmp = A[j-1];
                    A[j-1] = A[j];
                    A[j] = tmp;
                    swapCount++;
                }
            }
            Output(A.Select(i => i.ToString())
						.Aggregate((i, j) => i + " " + j));
            Output(swapCount.ToString());
        }
	}
}

Measured memory_bytes: 9580
N, Y = map(int, input().split())

for x in range(N+1):
  for y in range(N+1):
    z = N - x - y
    if Y == x *10000 + y*5000 + z*1000 and z >= 0:
      print(x, y, z)
      exit()
print(-1, -1, -1)

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

int main() {
   int a,b,c;
  string s;
  cin>>a>>b;
  c=0;
  bool t=0;
  vector<int> vec(a);
  for(int i=0;i<a;i++){
  	cin>>vec.at(i);
  }
  
  for(int i=0;i<a;i++){
  	if(vec.at(i)>=b)
      c++;
  }
  
  
  cout<<c<<endl;
  
  
  
}
  

Measured memory_bytes: 640
n = int(input())
v = sorted(list(map(int, input().split())))

sum = 0
p = -1 * (n - 1) 
for i in range(n):
    if i == 0:
        sum += v[i] * 2**p
    else:
        sum += v[i] * 2**p
        p += 1

print(sum)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
const double PI=acos(-1);

template<typename T>
istream& operator>> (istream& is, vector<T> &vec){
    for(T& x: vec) is >> x;
    return is;
}

int main(){
    ll n; string s; cin >> n >> s;
    ll ans = 200005;
    bool z = false;
    vector<ll> bl(n,0), wh(n,0);
    if(s[0] == '#') bl[0] = 1; else wh[0] = 1;
    for(ll i = 1; i < n; ++i){
        if(s[i] == '#') bl[i] = bl[i-1] + 1, wh[i] = wh[i-1];
        else wh[i] = wh[i-1] + 1, bl[i] = bl[i-1];
    }
    if(wh[n-1] == n || bl[n-1] == n){
        cout << 0 << endl;
        return 0;
    }
    //rep(i, n) cout << bl[i] << " ";
    //cout << endl;
    //rep(i, n) cout << wh[i] << " ";
    //cout << endl;
    rep(i,n){
        ll tmp = 0;
        if(s[i] == '#'){
            tmp += wh[n-1] - wh[i];
            if(i > 0) tmp += bl[i-1];
            ans = min(ans, tmp);
        }else{
            tmp += wh[n-1] - wh[i];
            tmp += bl[i];
            ans = min(ans, tmp);
        }
        //cout << tmp << " ";
    }
    //cout << endl;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6796
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int>> vvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> pii;
const int INF = 1001001001;
const ll LINF = 1e18;
const string endstr = "\n";

template <typename T>
T gcd(T a, T b) {
    if(a < b) gcd(b, a);
    T r;
    while((r=a%b)) {
        a = b; b = r;
    }
    return b;
}

bool isin(ll tgt, ll l, ll r){
    if(l > r) return isin(tgt, r, l);
    if(l <= tgt && tgt <= r) return true;
    else return false;
}

int main(){
    ll N; cin >> N;
    vl as(N + 2, 0); as[0] = 0; as[N + 1] = 0;
    for (ll i = 1; i <= N; i++) cin >> as[i];
    
    ll tot = 0;
    for (ll i = 0; i < as.size() - 1; i++) {
        tot += abs(as[i+1] - as[i]);
    }
    
    for (ll i = 1; i <= N; i++) {
        if(isin(as[i], as[i - 1], as[i + 1])){
            cout << tot << endstr;
        }
        else{
            ll tmp = 2 * min(abs(as[i] - as[i - 1]), abs(as[i + 1] - as[i]));
            cout << tot - tmp << endstr;
        }
    }
    
    return 0;
}


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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef long long ll;

const int mod = 1000000007;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) : x(x % mod) {}

    mint &operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }

    mint &operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }

    mint &operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }

    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }

    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }

    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }

    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const {
        return pow(mod - 2);
    }

    mint &operator/=(const mint a) {
        return (*this) *= a.inv();
    }

    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};

struct combination {
    vector<mint> fact, ifact;

    combination(int n) : fact(n + 1), ifact(n + 1) {
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
    }

    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n] * ifact[k] * ifact[n - k];
    }
} comb(100005);

mint f(int n, int k) {
    if (n < 0) return 0;
    // nPk = nCk * k!
    mint res = comb(n, k);
    res *= comb.fact[k];
    return res;
}


int main() {
    int N;
    vector<string> S(2);
    cin >> N >> S[0] >> S[1];

    mint ans = 1;
    int i = 0;
    int pre = -1; // 0:直前が縦並び,1:直前が横並び,-1:初期値
    while (i < N) {
        if (S[0][i] == S[1][i]) { // 縦に1つ並んでいる
            if (pre < 0) ans = 3;
            else if (pre == 0) ans *= 2;
            else ans *= 1;
            pre = 0;
            i++;
        } else { // 横に２つ並んでいる
            if (pre < 0) ans = 6;
            else if (pre == 0) ans *= 2;
            else ans *= 3;
            pre = 1;
            i += 2;
        }
    }

    cout << ans.x << endl;
}

Measured memory_bytes: 1792
#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
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
const ll MOD = 1e9+7;
const ll MOD2 = 998244353;
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const string alpha = "abcdefghijklmnopqrstuvwxyz";

int main(){
    int r;
    cin >> r;
    cout << 3*r*r << endl;
}

Measured memory_bytes: 256
/*
	ID: sixathofpain
	TASK: friday
	LANG: C++   

*/


//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#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 all(x) (x).begin(), (x).end()
#define ff first
#define ss second
#define setbits(x) __builtin_popcount(x)
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<db, db> pdd;
typedef vector<int> vi;
#define m1 make_pair
#define in insert
#define pb push_back
#define IOS                           \
    std::ios::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define endl "\n"
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

inline ll gcd(ll a, ll b)
{
    if (a == 0)
        return b;
    return gcd(b % a, a);
}
inline ll power(ll a, ll n, ll m)
{
    if (n == 0)
        return 1;
    ll p = power(a, n / 2, m);
    p = (p * p) % m;
    if (n % 2)
        return (p * a) % m;
    else
        return p;
}
const ll MOD = 1000000007;
const int N = int(3e5) + 999;
#define int long long int

int32_t main(){
    IOS;
	
    // freopen("friday.in","r",stdin);
    // freopen("friday.out","w",stdout);

    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int ans=-1e18;

    ans = max(ans,b*d);
    ans = max(ans,c*b);
    ans = max(ans,a*c);
    ans = max(ans,a*d);
    cout<<ans<<endl;
    

    return 0;
}

Measured memory_bytes: 3648
n, k = input().split()
n = int(n)
k = int(k)
p = list(map(int, input().split()))

exp = 0
for i in range(k):
  exp += (1 + p[i]) / 2
  exp_true = exp

for i in range(n-k):
  exp += (1 + p[i+k]) / 2
  exp -= (1 + p[i]) / 2
  if exp_true < exp:
    exp_true = exp

print(exp_true)

Measured memory_bytes: 71792
#include <iostream>
#include <set>
#include <queue>
#include <utility>
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;

int main() {
    int n; cin >> n;
    int total = 0;
    int f = n/2;
    int r = n%2;
    total = f+r;
    cout << total << endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int p,q;
    char a[1000][1000];
    scanf("%d %d%*c",&p,&q);
    int i,j;
    for(i=0;i<p;i++)
    {
        for(j=0;j<q;j++)
        {
            scanf("%c",&a[i][j]);
        }
        a[i][j]='\0';
        scanf("%*c");
    }
    for(i=0;i<p;i++)
    {
        int r=0;
        for(j=0;j<q;j++)
        {
            if(a[i][j]!='#') r++;
        }
        if(r==q)
        {
            for(j=0;j<q;j++) a[i][j]='0';
        }
    }
    for(i=0;i<q;i++)
    {
        int r=0;
        for(j=0;j<p;j++)
        {
            if(a[j][i]!='#') r++;
        }
        if(r==p)
        {
            for(j=0;j<p;j++) a[j][i]='0';
        }
    }
    for(i=0;i<p;i++)
    {
        int r=0;
        for(j=0;j<q;j++)
        {
            if(a[i][j]!='0')
            {

            printf("%c",a[i][j]);
            r++;
            }
        }
       if(r!=0) printf("\n");
    }
    return 0;
}


Measured memory_bytes: 256
#include "iostream"
#include "math.h"


int main()
{
	int n;
	double x[1000], y[1000];
	double p1 = 0, p2 = 0, p3 = 0, pI = -1, tempI;
	std::cin >> n;
	for (int i = 0; i < n; i++) 
		std::cin >> x[i];
	for (int i = 0; i < n; i++)
		std::cin >> y[i];
	for (int i = 0; i < n; i++) {
		p1 += fabs(x[i] - y[i]);
		p2 += pow(x[i] - y[i], 2);
		p3 += pow(fabs(x[i] - y[i]), 3);
		tempI = fabs(x[i] - y[i]);
		if (tempI > pI)
			pI = tempI;
	}
	p2 = sqrt(p2);
	p3 = cbrt(p3);
	std::cout << p1 << std::fixed << std::endl << p2 << std::fixed
		<< std::endl << p3 << std::fixed << std::endl << pI << std::fixed << std::endl;
    return 0;
}

Measured memory_bytes: 3476
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef pair<ll,ll> P;
#define fi first
#define se second
set<string> c;
const ll mod=1000000007;
const ll mod2=998244353;
const ll inf=100000000000000000;
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
ll lcm(ll c,ll d){return c/gcd(c,d)*d;}
map<ll,ll> mp;
void prime(ll n){
    for(int i=2;i*i<=n;i++){
        while(n%i==0){
            mp[i]++;
            n/=i;
        }
    }
    if(n>1)mp[n]++;
}
const ll MAX = 200010;//設定して
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;//＊１
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}
// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
int main(){
   ll n,m;
   cin>>n>>m;
    COMinit();
    prime(m);
    ll ans=1;
    for(auto p:mp){
        ll res=p.second;
        //cout<<res<<endl;
        ans*=COM(res+n-1,res);
        ans%=mod;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 4992
import fractions
def lcm(a,b):
  return a*b/fractions.gcd(a,b)
x,y=map(int,input().split())
a=lcm(x,y)
if x%y==0:
  print(-1)
else:
  b=1
  while True:
    b+=1
    c=x*b
    if c%y!=0:
      print(c)
      break

Measured memory_bytes: 5688
#include<bits/stdc++.h>
#define see(x) cerr<<#x<<"="<<x<<endl;
using namespace std;
typedef long long ll;
const ll mod= 998244353;
ll fast(ll x,ll n) {ll ans=1;for(;n;n>>=1,x=x*x%mod) if(n&1) ans=ans*x%mod; return ans;}
const int N=1e6+100;

int main() {
    ll a,b,c;
    cin>>a>>b>>c;
    swap(a,b);
    swap(a,c);
    printf("%lld %lld %lld",a,b,c);
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

class FastReader 
{ 
    BufferedReader br; 
    StringTokenizer st; 
    
    public FastReader() 
    { 
        br = new BufferedReader(new InputStreamReader(System.in)); 
    } 
    
    String next() 
    { 
        while (st == null || !st.hasMoreElements()) 
        { 
            try
            { 
                st = new StringTokenizer(br.readLine()); 
            } 
            catch (IOException  e) 
            { 
                e.printStackTrace(); 
            } 
        } 
        return st.nextToken(); 
    } 
    
    int nextInt() 
    { 
        return Integer.parseInt(next()); 
    } 
    
    long nextLong() 
    { 
        return Long.parseLong(next()); 
    } 
    
    double nextDouble() 
    { 
        return Double.parseDouble(next()); 
    } 
    
    String nextLine() 
    { 
          String str = ""; 
        try
        { 
            str = br.readLine(); 
        } 
        catch (IOException e) 
        { 
            e.printStackTrace(); 
        } 
        return str; 
    } 
} 

class Solution
{
    void solve()
    {
        FastReader sc = new FastReader();
        
        String s = sc.next();
        char c = s.charAt(0);

        int asc = (int)c;

        asc++;

        char res = (char)asc;

        System.out.println(res);
    }
}
  
public class Main 
{ 
    public static void main(String[] args) 
    { 
        Solution ob = new Solution();

        ob.solve();
    } 
} 

Measured memory_bytes: 32772
#include<iostream>
#include<cstdio>
#include<cstring>
#include<map>
#include<set>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#include<vector>
using namespace std;
#define N 200003
#define LL long long
#define mod 1000000007

int n;
int f[N][13];
char s[N];

inline int read(){
	int X=0,w=0;
	char ch=0;
	while (ch<'0' || ch>'9')
	  w|=ch=='-',ch=getchar();
	while (ch>='0' && ch<='9')
	  X=(X<<3)+(X<<1)+(ch^48),ch=getchar();
	return w ? -X : X;
}

int main(){
	scanf("%s",s+1);
	n=strlen(s+1);
	f[0][0]=1;
	for (int i=1;i<=n;i++){
		if (s[i]=='?'){
			for (int j=0;j<=9;j++)
			  for (int k=0;k<=12;k++)
			    f[i][(k*10+j)%13]=(f[i][(k*10+j)%13]+f[i-1][k])%mod;
		}
		else{
			int t=s[i]-'0';
			for (int j=0;j<=12;j++)
			  f[i][(j*10+t)%13]=(f[i][(j*10+t)%13]+f[i-1][j])%mod;
		}
	}
	printf("%d\n",f[n][5]);
	return 0;
}

Measured memory_bytes: 6272
#include <cstddef>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <array>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <limits>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <bitset>
#include <valarray>
#include <utility>
#include <tuple>
#include <cmath>
#include <memory>
#include <random>
#include <fstream>
#include <locale>

using ll = long long;
using ull = unsigned long long;

template <class T>
using vec = std::vector<T>;

template <class T>
using vvec = vec<vec<T>>;

constexpr std::size_t operator""_sz(ull n) { return std::size_t(n); }


int main()
{
    using namespace std;

    ll n, t;
    cin >> n >> t;

    ll ma{};

    ll offset{};

    for (int i = 0; i < n; ++i)
    {
        ll in;
        cin >> in;
        
        ma = max(ma, in);
        auto len = t - offset;
        auto ans = len / ma + 1;
        
        if (len % ma >= in)
            ++ans;
        
        
        cout << max(ans, 1ll) << endl;

        offset += in;
    }
    

    return 0;
}


Measured memory_bytes: 3100