akhauriyash/Code-Regression huggingface dataset:
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define FORR(i,n,m) for(int i=n-1;i>=m;i--)
#define all(in) in.begin(),in.end()
#define ALL(in,K) in,in+K
#define INF 1e18
#define MOD 100000007
#define SIZE 10005
#define PI 	3.14159265358979323846

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    string a,b,c;
    cin >> a >> b >> c;
    ll sum=0;
    REP(i,n){
        int m=2;
        if(a[i]==b[i])m--;
        if(b[i]==c[i])m--;
        if(a[i]==c[i])m--;
        sum += max(0,m);
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
N=int(input())

if N%2==0:
  ans='0'
else:
  ans='1'
  N-=1
  
i=2
while abs(N)>0:
  if N%((-2)**i)==0:
    ans='0'+ans
  else:
    ans='1'+ans
    N-=(-2)**(i-1)
  i+=1
    
print(ans)

Measured memory_bytes: 3060
import java.io.IOException;
import java.util.Scanner;

public class Main{

    public static void main(String[] args) throws IOException, StackOverflowError{
        Scanner scanner = new Scanner(System.in);
        while(true){
        	//first line
            int r = scanner.nextInt(); // 0 <= r <= 10
            int c = scanner.nextInt(); //0 <= c <= 10000
            //separater
            if(r == 0 && c == 0){
                break;
            }
            int[] a = new int[c];
            for(int i = 0; i < r; ++i){
                for(int j = 0; j < c; ++j){
                    //01??????????????§??¨??????????????¨???????????????
                    a[j] = a[j] * 2 + scanner.nextInt();
                }
            }
            //???????????¢????????????2???r???
            int bitRow = 1 << r; // max 2^10 -> 1024
            int answer = 0;
            //i????????¢????????????1????????£?????????
            for(int i = 0; i < bitRow; ++i){
                int thisAnswer = 0;
                //??????????????????
                //???????????§??§10000
                for(int j = 0; j < c; ++j){
                    //i??¨?????§XOR??????????????¨???????????¨????????£?????????????????????????????°??????????????????
                    int currentBit = Integer.bitCount(a[j] ^ i);
                    //r - currentBit????£?????????£?????????????????????????????°?????§?????????????????¨????????°??????
                    thisAnswer += Math.max(currentBit, r - currentBit);
                }
                answer = Math.max(answer, thisAnswer);
            }
            System.out.println(answer);
        }
    }
}

Measured memory_bytes: 63420
#include <bits/stdc++.h>
using namespace std;
using ll = int_fast64_t;
using ull = uint_fast64_t;
using ld = long double;
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep1(i, n) for (ll i = 1; i < n; ++i)
ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }
template <typename T> void vecout(const T &v) {
  for (auto it = v.begin(); it != v.end();
       ++it, cout << (it != v.end() ? " " : "\n")) {
    cout << *it;
  }
}

void solve() {
  // main coding
  int INF=1e9;
  int n,k; cin>>n>>k;
  vector<int> H(n);
  rep(i,n) cin>>H[i];
  vector<int> dp(n,INF);
  dp[0]=0;
  rep(i,n) for(int j=1;j<=k;++j) {
    if(i-j>=0) dp[i]=min(dp[i],dp[i-j]+abs(H[i]-H[i-j]));
  }
  cout<<dp[n-1]<<endl;
}

int main() {
  cout << fixed << setprecision(10);
  solve();
  return 0;
}


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

template <typename T>
void print_vector(vector<T>& vec) {
    cout << "print_vector -> ";
    for(int i=0; i<vec.size(); i++) {
        if(i == vec.size()-1) {
            cout << vec[i] << endl;
        }
        else {
            cout << vec[i] << " ";
        }
    }
    return;
}

int main() {

    unsigned long long A, B, N;
    cin >> A >> B >> N;

    unsigned long long x;
    if(B-1>N) x = N;
    else x = B-1;

    cout << (A * x) / B - A * (x / B) << endl;
    
    return 0;
}

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

int main(void){

    int  n;
    cin >>n;
    int dp[n];
    dp[0] = dp[1] = 1;
    for(int i=2;i<=n;i++){
        dp[i] = dp[i-1]+dp[i-2];
    }
    cout<<dp[n]<<endl;
    return 0;
}


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

typedef long long ll;

int main() {
    string s;
    int g_count = 0;
    int ans = 0;
    cin >> s;

    for (int i = 0; i < s.size(); i++) {
        if (s[i] == 'g') {
            if (g_count > 0) {
                ans++;
                g_count--;
            } else {
                g_count++;
            }
        } else {
            if (g_count > 0) {
                g_count--;
            } else {
                ans--;
                g_count++;
            }
        }
    }
    cout << ans << endl;
}


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

#define pb         push_back

typedef long long ll;
const ll INF = 1000000000000000000ll;
const ll MOD = 1000000007ll;
const double EPS = 1e-8;

// Union Find
const int MAX_N = 100005;
int par[MAX_N], tree_rank[MAX_N];
void init_union_find(int n){
	for(int i=0; i<n; i++){
		par[i] = i;
		tree_rank[i] = 0;
	}
}

int root(int x){
	return par[x] == x ? x : par[x] = root(par[x]);
}

bool same(int x, int y){
	return root(x) == root(y);
}

void unite(int x, int y){
	x = root(x);
	y = root(y);
	if(x == y) return;

	if(tree_rank[x] < tree_rank[y]){
		par[x] = y;
	}else{
		par[y] = x;
		if(tree_rank[x] == tree_rank[y]) tree_rank[x]++;
	}
}

// Kruskal
struct edge{int u, v, cost;};
bool comp(const edge& e1, const edge& e2){
	return e1.cost < e2.cost;
}

const int MAX_E = 1000005;
edge es[MAX_E];
int kruskal(int node_n, int edge_n){
	sort(es, es + edge_n, comp);
	init_union_find(node_n);
	int res = 0;
	for(int i=0; i<edge_n; i++){
		edge e = es[i];
		if(!same(e.u, e.v)){
			unite(e.u, e.v);
			res += e.cost;
		}
	}
	return res;
}

typedef pair<int, int> P;

int main(void) {
	//ios_base::sync_with_stdio(false);
	//cin.tie(0);
	int n, E;
	cin >> n;
	vector< P >  p1, p2;
	for(int i=0; i<n; i++){
		int x, y;
		cin >> x >> y;
		p1.pb(make_pair(x, i));
		p2.pb(make_pair(y, i));
	}

	sort(p1.begin(), p1.end());
	sort(p2.begin(), p2.end());

	E = 0;
	for(int i=0; i<n-1; i++){
		int x1 = p1[i].first;
		int x2 = p1[i+1].first;
		int i1 = p1[i].second;
		int i2 = p1[i+1].second;

		//printf("%d : %d %d %d\n", E, x1, x2, x2 - x1);
		es[E] = edge{i1, i2, x2 - x1};
		E++;
	}

	for(int i=0; i<n-1; i++){
		int x1 = p2[i].first;
		int x2 = p2[i+1].first;
		int i1 = p2[i].second;
		int i2 = p2[i+1].second;

		//printf("%d : %d %d %d\n", E, x1, x2, x2 - x1);
		es[E] = edge{i1, i2, x2 - x1};
		E++;
	}

	cout << kruskal(n, E) << endl;
	
	return 0;
}


Measured memory_bytes: 8428
#include <bits/stdc++.h>
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define mkp make_pair
typedef long long ll;
using namespace std;

int N, M;
vector<ll>A;
ll res, c[701], B;

int main() {
	cin >> N >> M;
	A = vector<ll>(N);
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
		res += A[i];
		for (int j = 1; j <= 700; ++j) {
			c[j] += A[i] / j;
		}
	}
	res *= M;
	sort(A.begin(), A.end());
	for (int i = 0; i < M; ++i) {
		cin >> B;
		if (B <= 700) {
			res -= B*c[B];
		}
		else {
			for (ll j = 1; j*B <= 200000; ++j) {
				res -= B*(lower_bound(A.begin(), A.end(), B*(j + 1)) - lower_bound(A.begin(), A.end(), B*j))*j;
			}
		}
	}
	cout << res << endl;
}


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

typedef long long ll; // -9,223,372,036,854,775,808 から 9,223,372,036,854,775,807

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

#define DEBUG

ll comb(ll n, ll k){
    if(k == 3){
        return n*(n-1)*(n-2)/6;
    }else if(k == 2){
        return n*(n-1)/2;
    }else if(k == 1){
        return n;
    }else if(k == 0){
        return 1;
    }
    cout << k << endl;
    assert(0);
}

ll makeFree(ll Ndigit, ll K){
    if(K < 0){
        return 0;
    }
    if(K > Ndigit){
        return 0;
    }
    return pow(9, K)*comb(Ndigit, K);
}

ll rec(vec<int>& digits, int ptr, ll K){
    if(ptr == digits.size() - 1){
        if(K == 0){
            // そこは0
            return 1;
        }else if(K == 1){
            // そこは非0
            return digits.back();
        }else{
            // K個も非0をつくれない。条件をみたさない。
            return 0;
        }
    }
    ll res = 0;
    ll NdigitsFol = digits.size() - ptr - 1;
    if(digits.at(ptr) == 0){
        // なんでもいいのでこの下の桁で非0をK個つくるやりかた
        res += rec(digits, ptr+1, K);
    }else{
        // この桁は維持する
        res += rec(digits, ptr+1, K-1);
        // この桁を非0で小さくする
        res += (digits.at(ptr) - 1)*makeFree(NdigitsFol, K - 1);
        // この桁を0にする
        res += makeFree(NdigitsFol, K);
    }

    return res;
    
}

void solve(string N, long long K){
    vec<int> digits;
    for(auto iter: (N)){
        digits.push_back(iter - '0');
    }

    cout << rec(digits, 0, K) << endl;

}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    // long long N;
    // scanf("%lld",&N);
    string N;
    cin >> N;
    long long K;
    scanf("%lld",&K);
    solve(N, K);
    return 0;
}


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

int main() {
	vector<int> v; int m, n, temp; cin >> m >> n; v.resize(m);
	fill(v.begin(), v.end(), 0);
	for (int i = 0; i < m; i++) for (int j = 0; j < n; j++) {
		cin >> temp; if (temp == 1) v[i]++;
	}
	sort(v.begin(), v.end(), greater<int>()); cout << v[0] << endl;
	return 0;
}


Measured memory_bytes: 3156
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
ll i, temp,t, n,j,k, ans, a[200600];
bool cond;
string s;
int main()
{
    //I am Monim, a tiny creature of Allah
    cin >> n;
    for(i=0;i<n;i++)
        cin >> a[i];
    sort(a, a+n);
    for(i=0;i<n;i++)
        for(j=i+1;j<n;j++)
            for(k=j+1;k<n;k++)
            {
                if(a[i]!=a[j] && a[j]!=a[k] && a[i]+a[j]>a[k])
                    ans++;
            }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3640
#include <stdio.h>
#include <stdlib.h>

#define M 9
#define N 3
#define yes 1
#define no -1
#define lim 100

typedef struct{
  int a[M],b,c;
}Puzzle;

Puzzle now;

int s1[4]={0,-1,0,1};
int s2[4]={1,0,-1,0};
char contl[4]={'r','u','l','d'};
int bord[M][M];

int max,leng[lim];

int in_bord(Puzzle x){
  int i,count=0;
  for(i=0;i<M;i++){
    if(x.a[i]==M) continue;
    count+=bord[i][x.a[i]-1];
  }
  return count;
}

int dfs(int deep,int z){
  int i,r1,r2,y1,y2,change;
  
  if(now.c==0) return yes;
  if(deep+now.c>max) return no;

   r1=now.b/N;
   r2=now.b%N;
  Puzzle comp;

  for(i=0;i<4;i++){
    y1=r1+s1[i];
    y2=r2+s2[i];

    if(y1<0 || y2<0 || y1>=N || y2>=N) continue;
    if(abs(z-i)==2) continue;
    comp=now;

    now.c-=bord[y1*N+y2][now.a[y1*N+y2]-1];
    now.c+=bord[r1*N+r2][now.a[y1*N+y2]-1];
    change=now.a[y1*N+y2];
    now.a[y1*N+y2]=now.a[r1*N+r2];
    now.a[r1*N+r2]=change;
    now.b=y1*N+y2;
    if(dfs(deep+1,i)==yes){
      leng[deep]=i;
      return yes;
    }
    now=comp;
  }
  return no;
}

void solve(Puzzle x){
  int i,count=0;
  
  x.c=in_bord(x);
  for(max=x.c;max<=lim;max++){
    now=x;
    if(dfs(0,-100)==yes){
      for(i=0;i<max;i++){
	count++;
      }
      printf("%d\n",count);
      return;
    }
  }
}
      

int main(){
  int i,j,keep;
  Puzzle in;

  for(i=0;i<M;i++){
    for(j=0;j<M;j++){
      bord[i][j]=abs(i/N-j/N)+abs(i%N-j%N);
    }
  }

  for(i=0;i<M;i++){
    scanf("%d",&in.a[i]);
    if(in.a[i]==0) keep=i;
  }
      in.a[keep]=M;
      in.b=keep;

  solve(in);

  return 0;
}
  



Measured memory_bytes: 2036
a, b, k = [int(x) for x in input().split()]

divisors = []

m = min(a, b)
x = 1
while True:
    # print(divisors)
    if x > min(a, b):
        break
    if a % x == 0 and b % x == 0:
        divisors.append(x)
    x += 1

print(divisors[-k])


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#ifdef _DEBUG_
  #define debug(...) printf(__VA_ARGS__)
#else
  #define debug(...) (void)0
#endif
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;

string S;
int K;

const int MAXL = 350;
int dp[MAXL][MAXL][MAXL];

int f(int l, int r, int k) {
  if (dp[l][r][k] >= 0)
    return dp[l][r][k];
  if (l > r)
    return dp[l][r][k] = 0;
  if (l == r)
    return dp[l][r][k] = 1;
  int &res = dp[l][r][k];
  res = max(f(l, r - 1, k), f(l + 1, r, k));
  if (S[l] == S[r])
    res = max(res, f(l + 1, r - 1, k) + 2);
  if (k > 0)
    res = max(res, f(l + 1, r - 1, k - 1) + 2);
  debug("%d, %d, %d - %d\n", l, r, k, res);
  return res;
}

int main() {
  cin >> S >> K;
  memset(dp, -1, sizeof(dp));
  cout << f(0, SZ(S) - 1, K) << endl;
  return 0;
}


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

int main() {
    string s;
    cin >> s;
    if ((s[0] == 'R' and s[1] == 'S') or (s[2] == 'R' and s[1] == 'S') or (s[0] == 'S' and s[1] == 'R' and s[2] == 'S')) {
        cout << 1 << endl;
    }
    else if (s[0] == 'S' and s[1] == 'S' and s[2] == 'S') {
        cout << 0 << endl;
    }
    else if (s[0] == 'R' and s[1] == 'R' and s[2] == 'R') {
        cout << 3 << endl;
    }
    else {
        cout << 2 << endl;
    }
}

Measured memory_bytes: 3620
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
#include<vector>
#include<map>
using namespace std;

#define LL long long
#define DB double
#define MAXN 100000
#define MOD 1000000007
#define Pr pair<LL,LL>
#define X first
#define Y second
#define INF 1000000000000000000
#define mem(x,v) memset(x,v,sizeof(x))

LL read(){
	LL x=0,F=1;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-')F=-1;c=getchar();}
	while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
	return x*F;
}

int n,m,F;
int isp[MAXN+5],pcnt,ans;
LL p3[MAXN+5],s[MAXN+5],pri[MAXN+5];
vector<Pr> a[MAXN+5],b[MAXN+5];
map<LL,int> A,B;

void prepare(){
	for(int i=2;i<=m;i++){
		if(!isp[i])pri[++pcnt]=i;
		for(int j=1;pri[j]*i<=m&&j<=pcnt;j++){
			isp[pri[j]*i]=1;
			if(i%pri[j]==0)break;
		}
	}
	for(int i=1;i<=m;i++)p3[i]=1LL*i*i*i;
}
LL divmod(LL x){
	for(int i=1;i<=pcnt;i++)
	while(x%p3[pri[i]]==0)x/=p3[pri[i]];
	return x;
}
LL Div(LL x,Pr &tmp){
	tmp.X=tmp.Y=1;
	for(int i=1;i<=pcnt;i++)
	if(x%pri[i]==0){
		x/=pri[i];
		if(x%pri[i]==0)
		tmp.X*=pri[i]*pri[i],tmp.Y*=pri[i],x/=pri[i];
		else tmp.X*=pri[i],tmp.Y*=pri[i]*pri[i];
	}
	return x;
}
int main(){
	n=read(),m=2160;
	prepare();
	for(int i=1;i<=n;i++)s[i]=divmod(read());
	for(int i=1;i<=n;i++){
		if(s[i]==1){F=1;continue;}
		Pr tmp;
		LL x=Div(s[i],tmp);
		LL px=sqrt(x);
		//printf("%lld %lld\n",px,x);
		if(px*px==x)a[px].push_back(tmp);
		else if(x<=100000)b[x].push_back(tmp);
		else ans++;
	}
	for(int i=0;i<a[1].size();i++)A[a[1][i].X]++;
	for(int i=0;i<a[1].size();i++){
		ans+=max(A[a[1][i].X],A[a[1][i].Y]);
		A[a[1][i].X]=A[a[1][i].Y]=0;
	}
	for(int i=2;i<=100000;i++)
	if(a[i].size()==0||b[i].size()==0)ans+=a[i].size()+b[i].size();
	else{
		for(int j=0;j<a[i].size();j++)A[a[i][j].X]++;
		for(int j=0;j<b[i].size();j++)B[b[i][j].X]++;
		for(int j=0;j<a[i].size();j++){
			ans+=max(A[a[i][j].X],B[a[i][j].Y]);
			A[a[i][j].X]=B[a[i][j].Y]=0;
		}
		for(int j=0;j<b[i].size();j++){
			ans+=max(B[b[i][j].X],A[b[i][j].Y]);
			B[b[i][j].X]=A[b[i][j].Y]=0;
		}
	}
	printf("%d",ans+F);
}

Measured memory_bytes: 16416
import java.util.Scanner;
class Main{
    public static void main(String[] a){
          Scanner sc = new Scanner(System.in);
       int i = sc.nextInt(); ;
       int s = (i%3600)%60;
       int m = (i%3600)/60;
       int h = i/3600;
       
       System.out.println(h+":"+m+":"+s);
    }
}

Measured memory_bytes: 26320
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, *A = map(int, read().split())
    
    approved = True
    for a in A:
        if a % 2 == 0 and a % 3 and a % 5:
            approved = False
            break
    if approved:
        print('APPROVED')
    else:
        print('DENIED')
    
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 61896
#include "stdio.h"
  #include "string.h"
  #define DICE 4
  const int shokiti[4][4]={{1,2,6,5},{1,4,6,3},{1,5,6,2},{1,3,6,4}};
  int zorome[4][4];
  int cp[4];
  unsigned long sum;
  void direction(const int de){
      int tmp[2],i,m,j;
      m=(de>=2)?de-2:de+2;
      j=(m+de)/2%2;
      tmp[0]=zorome[de][0];
      tmp[1]=zorome[m][3];
      for(i=1;i<DICE;i++){
          zorome[de][i-1]=zorome[de][i];
          zorome[m][DICE-i]=zorome[m][DICE-i-1];
      }
      zorome[de][3]=tmp[0];
      zorome[m][0]= zorome[j][0]=zorome[j+2][0]=tmp[1];
      zorome[j][2]=zorome[j+2][2]=zorome[de][2];
      sum+=(unsigned long)zorome[m][0];
  }
  void rotation(const int de){
       int i,m;
          for(i=0;i<DICE;i++){
              cp[i]=zorome[de][i];
          }
           for(m=0;m<DICE;m++){                                  
for(i=0;i<DICE;i++){
                   zorome[(de)?DICE-m-1:m][i]=zorome[(de)?DICE-m-    2:m+1][i];
              }
           }
          for(i=0;i<DICE;i++){
              zorome[(de)?0:3][i]= cp[i];
          }
            sum+=(unsigned long)zorome[de][0];
  }
  
  int main(void){
      int i,n;
      char ch[100];
  do{
      for(i=0;i<DICE;i++){
            for(n=0;n<DICE;n++){
                zorome[i][n]=shokiti[i][n];   
 }
      }
      sum=0;
      scanf("%d",&n);
      for(i=0;i<n;i++){
          scanf("%s",ch);
        if(strcmp(ch,"North")==0){
              direction(0);
          }else if(strcmp(ch,"East")==0){
              direction(1);
          }else if(strcmp(ch,"South")==0){
              direction(2);
          }else if(strcmp(ch,"West")==0){
              direction(3);
          }else if(strcmp(ch,"Right")==0){
              rotation(3);
          }else if(strcmp(ch,"Left")==0){
              rotation(0);
          }
  }
	if(n)
      printf("%lu\n",sum+1);
  }while(n);  
      return 0;
 }
                                   

Measured memory_bytes: 608
fun main(args:Array<String>){
  var (a,b) = readLine()!!.split(" ").map{it.toInt()}
  if(a>=b){
    for(i in 1 .. a){
      print(b)
    }
  }
  else{
    for(i in 1 .. b){
      print(a)
    }
  }
  println()
}
      

Measured memory_bytes: 36000
#include<stdio.h>

int main(){
  int a,b,c,d;
  int e,f;
  scanf("%d\n%d\n%d\n%d",&a,&b,&c,&d);
  if(a>b){
    e=b;
  }else{
    e=a;
  }
  if(c>d){
    f=d;
  }else{
    f=c;
  }

  printf("%d",e+f);

  return 0;
}


Measured memory_bytes: 128
N, M = map(int, input().split())
ac = 0
wa = 0
arr = [0] * N
if M == 0:
  print("0 0")
  exit()
  
for i in range(M):
  p, s = list(input().split())
  p = int(p)
  if arr[p-1] != "AC":
    if s == "AC":
      wa += arr[p-1]
      arr[p-1] = "AC"
      ac += 1
    else:
      arr[p-1] += 1
print(ac, wa)
    

Measured memory_bytes: 79360
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=1LL<<61;

int main() {
  ll a,b,c;
  cin >> a >> b >> c;
  if((a<c&&c<b)||(b<c&&c<a)) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    string s;
    
    cin>>s;
    
    long long sum=0;
    for(int i=0;i<s.size();i++){
        int n = s[i] - '0';
        sum+=n;
    }
    
    if(sum%9==0) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    
}


Measured memory_bytes: 3752
fn main() {
    proconio::input! {
        d: usize,
        c: [i64;26],
        s: [[i64;26];d],
        t: [proconio::marker::Usize1;d],
    }
    let mut last=[0;26];
    let mut v=0;
    for (i,t) in t.into_iter().enumerate() {
        v+=s[i][t];
        last[t]=i+1;
        for (&c,&last) in c.iter().zip(last.iter()) {
            v-=c*(i+1-last)as i64;
        }
        println!("{}",v);
    }
}

Measured memory_bytes: 2272
#include<bits/stdc++.h>
using namespace std;
const int ran = 111111;
int n,_p[ran*2];
int _e[ran],_o[ran];
struct Node{
	int val,pos;
};
Node merge(Node x,Node y){
	return x.val < y.val? x : y;
}
struct segTree{
	Node a[111111*4];
	void build(int i,int l,int r,int*p){
		if(l==r){
			a[i].val = p[l];
			a[i].pos = l;
			return;
		}
		int m=(l+r)/2;
		build(i*2,l,m,p);
		build(i*2+1,m+1,r,p);
		a[i] = merge(a[i*2],a[i*2+1]);
	}
	Node query(int i,int l,int r,int s,int e){
		if(l==s && r==e)
			return a[i];
		int m=(l+r)/2;
		if(e <= m)return query(i*2,l,m,s,e);
		if(s > m)return query(i*2+1,m+1,r,s,e);
		return merge(query(i*2,l,m,s,m),query(i*2+1,m+1,r,m+1,e));
	}
	void build(int*p){build(1,1,n,p);}
} o,e;
struct seg{
	int l,r;
	Node L,R;
	seg(int _l,int _r){
		l = _l; r = _r;
		if(l%2==1){
			L = o.query(1,1,n,(l+1)/2,r/2);
			R = e.query(1,1,n,L.pos,r/2);
		}else{
			L = e.query(1,1,n,l/2,r/2);
			R = o.query(1,1,n,L.pos+1,(r+1)/2);
		}
	}
};
bool operator <(seg A,seg B){
	return A.L.val > B.L.val;
}
priority_queue<seg> q;
int main(){
	scanf("%d",&n);
	for(int i=1; i<=n; i++)
		scanf("%d",&_p[i]);
	n /= 2;
	for(int i=1; i<=n; i++){
		_o[i] = _p[i*2-1];
		_e[i] = _p[i*2];
	}
	o.build(_o);
	e.build(_e);
	q.push(seg(1,2*n));
	bool fir = false;
	while(!q.empty()){
		seg tmp = q.top();
		q.pop();
		if(fir)printf(" ");
		fir = true;
		printf("%d %d",tmp.L.val, tmp.R.val);
		int l = tmp.l;
		int r = tmp.r;
		int l2 = tmp.L.pos * 2 - l%2;
		int r2 = tmp.R.pos * 2 - (l+1)%2;
		if(l < l2 - 1)q.push(seg(l,l2-1));
		if(l2+1 < r2-1)q.push(seg(l2+1,r2-1));
		if(r2+1 < r)q.push(seg(r2+1,r));
	}
	puts("");
	return 0;
}


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

int main()
{
    long long int i,sum=0;
    char N[200003];

    scanf("%s",N);


    for(i=0; i<strlen(N);i++)
        sum=sum+N[i]-48;
    if(sum%9==0)
        printf("Yes\n");
    else
        printf("No\n");





    return 0;
}


Measured memory_bytes: 2208
#include <stdio.h>

int main(void)
{
    int N, Q, i;
    scanf("%d%d", &N, &Q);

    char str[N + 1];
    int sum[N], l[Q], r[Q];
    scanf("%s", str);

    sum[0] = 0;
    for (i = 0; i < N - 1; i++)
    {
        sum[i + 1] = sum[i];
        if(str[i] == 'A' && str[i + 1] == 'C'){
            sum[i + 1]++;
            }
    }

    for (i = 0; i < Q; i++)
        scanf("%d %d", &l[i], &r[i]);

    for (i = 0; i < Q; i++)
        printf("%d\n", sum[r[i] - 1] - sum[l[i] - 1]);

    return 0;
}

Measured memory_bytes: 2048
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000

typedef pair<int, int> P;

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    int upper = (N - 1) * (N - 2) / 2;
    if(upper < K) {
        cout << -1 << endl;
        return 0;
    }
    vector<P> A;
    rep(i, N - 1) {
        A.push_back({0, i + 1});
    }
    int add = upper - K;
    int left = 1, right = 2;
    while(add--) {
        A.push_back({left, right});
        right++;
        if(right == N) {
            left++;
            right = left + 1;
        }
    }
    cout << A.size() << endl;
    for(auto& e: A) {
        cout << e.first + 1 << " " << e.second + 1 << endl;
    }

    return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<math.h>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef long double ld;
const long double pi = 3.14159265358979323846264338327950288;
bool a[1000001];
int main() {
	string s;
	bool a[4] = { 0,0,0,0 };
	cin >> s;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == 'N')
			a[0] = 1;
		if (s[i] == 'S')
			a[1] = 1;
		if (s[i] == 'W')
			a[2] = 1;
		if (s[i] == 'E')
			a[3] = 1;
	}
	if (a[0] == a[1] && a[2] == a[3])
		cout << "Yes\n";
	else
		cout << "No\n";
	cin >> s;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <functional>
/*
#include <ext/pb_ds/tree_policy.hpp> 
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
*/
using namespace std;
#define int         long long
#define double      long double
#define pb          push_back
#define pf          push_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vpii        vector<pii>
#define mi          map<int,int>
#define vii         vector<vector<int>>
#define mpii        map<pii,int>
#define piii        pair<int,pair<int,int> >
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define PI          3.141592653589
#define bs(v,n)     binary_search(all((v)),(n))
#define lb(v,n)     lower_bound(all((v)),(n))
#define ub(v,n)     upper_bound(all((v)),(n))
#define fo(i,l,u)   for(i=l;i<u;i++)
#define rfo(i,l,u)  for(i=l;i>=u;i--)
#define rf(s)       for(auto &c : s)
#define allfo(s)    for(auto it=(s).begin();it!=(s).end();it++) //use Iterator
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MOD         1000000007
#define ef else if

/*template<class T>
T big(T a, T b) { return a>b ? a : b; }
int gcd(int a, int b) {  if (a == 0)  return b; return gcd(b % a, a); } 
int lcm(int a, int b) { return (a*b)/gcd(a,b); } 
bool mod(double a,double b) {return a/b - floor(a/b);}
int occurs(vi v,int n)  {  auto it=lb(v,n);auto it1=ub(v,n);int x=it1-it;return x;}
int logb(int base, int x) {return (log(x) / log(base));}
int pow(int n, int m){
    int ans=1;
    fo(i,0,m){
        ans*=n;
    }return ans;
}
int factors(int ans){
    int count=0;
    for (int i=1; i<=sqrt(ans); i++) { 
        if (ans%i == 0) 
        {if (ans/i == i) count++;
            else count+=2;} 
    }
    return count;     
}
bool isSubSequence(string str1, string str2, int m, int n)  // str1<str2
{ 
  
    if (m == 0) return true; 
    if (n == 0) return false; 
  
  	if (str1[m-1] == str2[n-1]) 
        return isSubSequence(str1, str2, m-1, n-1); 
  
    return isSubSequence(str1, str2, m, n-1); 
} */

signed main()
{
tezz;
string a;
cin>>a;
int c=0;
for(int i=1;i<a.size();i++)
{
	if(a[i]==a[i-1])
	{
		c++;
		if(a[i-1]=='1')
		{
			a[i]='0';
		}
		else
		a[i]='1';
	}
}
cout<<c<<endl;
return 0;
}

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

int main(){
   string s;
   cin>>s;
   int ans=0,res=0;
   s='0'+s;
   int len=s.size();
   for(int i=len-1;i>=1;i--){//先算进位所需的钞票数
        if(s[i]>'5') {
            res+=10-(s[i]-'0');
            s[i]='0';
            s[i-1]++;
        }
        else if(s[i]=='5' && s[i-1]>='5'){
            res+=10-(s[i]-'0');
            s[i]='0';
            s[i-1]++;
        }
   }
   for(int i=0;i<len;i++)//再算每一位所需的钞票数
       ans+=s[i]-'0';
   cout<<ans+res;
   return 0;
}


Measured memory_bytes: 2308
#include <iostream>
#include <stdio.h>
#include <bits/stdc++.h>
#include <math.h>
#define ll long long
using namespace std;

int main(){
    ll a,b;
    cin>>a>>b;
    ll p=a/b;
    if (a%b!=0) p++;
    cout<<p<<endl;
    
}

Measured memory_bytes: 256
#include<cstdio>
#include<math.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<string.h>
 
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define mp make_pair
#define LLIandI pair<long long int , int>
#define ll long long

int main(){
    int N;
    scanf("%d",&N);
    int mN=-1;
    int sqN=int(sqrt(N));
    if(N==1){
        printf("Yes\n");
        printf("2\n");
        printf("1 1\n");
        printf("1 1\n");
        return 0;
    }
    rep(i,N){
        if(N== (i*(i+1))/2  )mN=i;
        if(N<= (i*(i+1))/2)break;
    }
    if(mN==-1){
        printf("No\n");
        return 0;
    }
    
    vector<int> group[100002];
    if(mN>0){
        int ue=0;
        int shita=1;
        
        printf("Yes\n");
        printf("%d\n",mN+1);
        rep(i,N){
            group[ue].push_back(i+1);
            group[shita].push_back(i+1);
            if(group[ue].size()==mN)ue++;
            shita++;
            if(shita>=mN+1)shita=ue+1;
        }
        //1組目
        /*printf("%d ",mN);
        rep(i,mN){
            printf("%d",i+1);
            if(i!=mN-1)printf(" ");
        }
        printf("|\n");
        rep(i,mN)){
            if(i==0){//二行目
                printf("%d ",(N+1)/2);
                printf("%d ",i+1);
                rep(i,((N+1)/2)-1){
                    printf("%d",(N+1)/2+i+1);
                    if(i!=((N+1)/2)-2)printf(" ");
                }
            }else{
                printf("%d %d %d",2,i+1,((N+1)/2)+i);
            }
            printf("\n");
        }*/
        rep(i,mN+1){
            printf("%d ",group[i].size());
            rep(j,group[i].size()){
                printf("%d",group[i][j]);
                if(j!=group[i].size()-1)printf(" ");
            }
            printf("\n");
        }
    }
}


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

int main(void){
    int N,ans=0;
    cin>>N;
    char c[N];
    for(int i=0;i<N;i++){
        cin>>c[i];
    }
    int l=0,r=N-1;
    while(l<r){
        if(c[l]=='W' && c[r]=='R'){
            ans++;
            l++; r--;
            continue;
        }
        if(c[l]=='R' && c[r]=='R'){
            l++;
            continue;
        }
        if(c[l]=='W' && c[r]=='W'){
            r--;
            continue;
        }
        l++;
        r--;        
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3820
n,m=map(int,input().split())
a=list(map(int,input().split()))
l=[list(map(int,input().split())) for _ in range(m)]
a.sort(reverse=True)
l.sort(key=lambda x:x[1],reverse=True)
o=sum(a)
for i in range(m):
    for j in range(1,l[i][0]+1):
        if len(a)==0:
            print(o)
            exit()
        if a[-1]>=l[i][1]:
            print(o)
            exit()
        else:
            r=a.pop(-1)
            o-=r
            o+=l[i][1]
print(o)

Measured memory_bytes: 34632
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))){
			int n = Integer.parseInt(br.readLine());
			int a = Integer.parseInt(br.readLine());
			System.out.println(n*n-a);
		}

	}

}

Measured memory_bytes: 23252
#include <bits/stdc++.h>
#include <string>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
#define all(c) begin(c), end(c)

int n,m,c,s,g;

int d_dist[30][110][110];
int d_final[110][110];
int p[30], q[30][60], r[30][60];

const int inf = 1e9;

int getcost(int dist, int *q, int *p){
    if(dist == inf) return inf;
    int res = 0;
    rep(i,1000000){
        if(dist <= q[i+1]){
            res += (dist-q[i]) * p[i];
            break;
        } else {
            res += (q[i+1]-q[i]) * p[i];
        }
    }
    return res;
}

signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    /*
      ????´?????????¢??§???????????¨???WF 1
      ??????????????¨???????????¨????????? 2
      ??????????????§WF 3
     */
    while(cin >> n >> m >> c >> s >> g && n){
        --s, --g;
        rep(ic,c)rep(i,n)rep(j,n) d_dist[ic][i][j] = inf;
        rep(i,n)rep(j,n) d_final[i][j] = inf;
        rep(i,c)rep(j,n) d_dist[i][j][j] = 0;
        rep(i,n) d_final[i][i] = 0;

        rep(i,m){
            int x,y,d,c;
            cin >> x >> y >> d >> c;
            --x, --y, --c;
            d_dist[c][x][y] = min(d_dist[c][x][y], d);
            d_dist[c][y][x] = min(d_dist[c][y][x], d);
        }

        rep(i,c) cin >> p[i];
        rep(i,c){
            q[i][0] = 0;
            rep(j,p[i]-1) cin >> q[i][j+1];
            q[i][p[i]] = inf*2;
            rep(j,p[i]) cin >> r[i][j];
        }

        rep(ic,c) rep(k,n)rep(i,n)rep(j,n) {
            d_dist[ic][i][j] = min(d_dist[ic][i][j], d_dist[ic][i][k] + d_dist[ic][k][j]);
        }

        rep(ic,c)rep(i,n)rep(j,n){
            d_final[i][j] = min(d_final[i][j], getcost(d_dist[ic][i][j], q[ic], r[ic]));
        }

        rep(k,n)rep(i,n)rep(j,n){
            d_final[i][j] = min(d_final[i][j], d_final[i][k] + d_final[k][j]);
        }
        int ans = d_final[s][g];
        cout << (ans == inf ? -1 : ans) << '\n';
    }
}

Measured memory_bytes: 4200
#include<bits/stdc++.h>
using namespace std;
int main(){
	string a;
	cin>>a;
	int maxs=0;
	int curr=0;
	for(int i=0;i<a.length();i++){
		if(a[i]=='R'){
			curr++;
			maxs=max(maxs,curr);
		}
		else{
			curr=0;
		}
	}
	cout<<maxs<<endl;
}

Measured memory_bytes: 3524
import logging

logging.basicConfig(level=logging.INFO, format="%(message)s")
#logging.disable(logging.CRITICAL)

def main():
    A_1, A_2, A_3 = map(int, input().split())
    logging.info("Hello!")

    if (A_1 + A_2 + A_3) > 21:
        print("bust")
    else:
        print("win")
        
if __name__ == "__main__":
    main()

Measured memory_bytes: 4580
from collections import Counter

N = int(input())
V = tuple(map(int, input().split()))

C0 = Counter(V[0::2]).most_common()
C0.append((0, 0))
C1 = Counter(V[1::2]).most_common()
C1.append((0, 0))
ans = N
for k0, v0 in C0:
    for k1, v1 in C1:
        if k0 != k1:
            ans = min(ans, N - v0 - v1)
            break
print(ans)


Measured memory_bytes: 20576
N, K = map(int, input().split())
S = list(input())
if S[K - 1] == "A":
    S[K - 1] = "a"
    print("".join(S))
elif S[K - 1] == "B":
    S[K - 1] = "b"
    print("".join(S))
else:
    S[K - 1] = "c"
    print("".join(S))


Measured memory_bytes: 3060
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define Max(a, b) ((a) > (b) ? (a) : (b))
#define Min(a, b) ((a) > (b) ? (b) : (a))
#define abs(x) ((x) > 0 ? (x) : -(x))
#define pri(x) (printf("%d", x))
#define prll(x) (printf("%lld", x))
#define sci(x) (scanf("%d", &x))
#define scll(x) (scanf("%lld", &x))
#define endl printf("\n");
typedef long long ll;

int
main(int argc, char *argv[])
{
int n, a, b;
sci(n); sci(a);sci(b);
pri(Min(a*n, b));
return 0;
}


Measured memory_bytes: 128
#![allow(unused_imports, unused_macros, dead_code)]

macro_rules! min {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| min!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = min!($($ys),*);
        if $x < t { $x } else { t }
    }}
}
macro_rules! max {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| max!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = max!($($ys),*);
        if $x > t { $x } else { t }
    }}
}


macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => { ewriteln!(">>> {} = {:?}", stringify!($x), $x) };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! put {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(x) = it.next() { print!("{}", x); }
        for x in it { print!(" {}", x); }
        println!("");
    }};
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

const M: i64 = 1_000_000_007;

fn main() {
    let mut sc = Scanner::new();
    let a: i32 = sc.cin();
    let b: i32 = sc.cin();
    put!(a*b-a-b+1);
}

use std::io::{self, Write};
use std::str::FromStr;
use std::collections::VecDeque;

struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
impl Scanner {
    fn new() -> Self { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
}


Measured memory_bytes: 4352
import java.io.*;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        int r = Integer.parseInt(sc.next());
        int c = Integer.parseInt(sc.next());
        int[][] a = new int[r+1][c+1];
        for (int i = 0; i < r; i++)
            for (int j = 0; j < c; j++) {
                a[i][j] = Integer.parseInt(sc.next());
                a[i][c] += a[i][j];
                a[r][j] += a[i][j];
                a[r][c] += a[i][j];
            }
        for (int i = 0; i <= r; i++) {
            for (int j = 0; j <= c; j++) {
                pw.print(a[i][j]);
                if (j != c) pw.print(" ");
            }
            pw.println();
        }
        pw.flush();
    }
}


Measured memory_bytes: 39608
h,w=map(int,input().split())
masulist=[list(input()) for a in range(h)]
masulist2=[b for b in masulist if b.count("#")]
x=[b for b in list(zip(*masulist2)) if b.count("#")]
y=list(zip(*x))
for a in y:
    print("".join(a))

Measured memory_bytes: 3316
#include <stdio.h>
int main()
{
    int n = 0, count = 0;
    char *p = NULL;
    scanf("%d", &n);
    p = (char *)calloc(n+1, sizeof(char));
    scanf("%s", p);
    while (*p != '\0')
    {
        if (*p != *(p+1))
        {
            count++;
        }
        p++;
    }
    printf("%d", count);
    return 0;
}

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

int main(){
    int a, b;
    cin >> a >> b;
    bool flag = false;
    for(int i = 1; i < 1e+4 / (float)8; i++){
        if(floor(i * 8 / (double)100) != a) continue;
        if(floor(i * 10 / (float)100) != b) continue;
        cout << i << endl;
        flag = true;
        break;
    }
    if(!flag) cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class Main {

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

        // Map: sに含まれる文字 -> 位置のSet
        Map<Character, Set<Integer>> mapS = new HashMap<>();
        // Map: tに含まれる文字 -> 位置のSet
        Map<Character, Set<Integer>> mapT = new HashMap<>();
        for (int i = 0; i < s.length(); i++) {
            if (!mapS.keySet().contains(s.charAt(i))) {
                mapS.put(s.charAt(i), new TreeSet<>());
            }
            if (!mapT.keySet().contains(t.charAt(i))) {
                mapT.put(t.charAt(i), new TreeSet<>());
            }
            mapS.get(s.charAt(i)).add(i);
            mapT.get(t.charAt(i)).add(i);
        }

        // mapSとmapTのvalueに含まれるSetがすべて等しければYes
        // でなければNoとなる
        boolean isOk = true;
        for (Set<Integer> setS : mapS.values()) {
            Integer i = setS.iterator().next();
            for (Set<Integer> setT : mapT.values()) {
                if (setT.contains(i)) {
                    if (!setS.equals(setT)) {
                        isOk = false;
                        break;
                    }
                }
            }
            if (!isOk) {
                break;
            }
        }

        if (isOk) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }

}


Measured memory_bytes: 56128
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <utility>
#include <climits>
#include <iomanip>
using namespace std;
#define MAXSIZE 100005
#define MAXL 100
typedef long long int lli;

int main(){
    int n;
    cin >> n;
    
    int ans = 180 * (n - 2);
    cout << ans << endl;
    return 0;
}

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

using namespace std;

int main() {
  int n;
  cin >> n;
  int ans = 0;
  int last = INT_MAX;
  for (int i = 0; i < n - 1; ++i) {
    int b;
    cin >> b;
    ans += min(last, b);
    last = b;
  }
  cout << ans + last << endl;
}

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

#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define int long long int
#define ld long double
#define F first
#define S second
#define P pair<int,int>
#define pb push_back

using namespace std;


int32_t main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  	int a,b,c,k;
  	cin>>a>>b>>c>>k;
  	int ans =0;
  	while(k!=0){
  		if(a>=k and k){
  			ans += k;
  			k=0;
  		}
  		else if(a<k and k){
  			ans += a;
  			k-=a;
  		}
  		if(b>=k and k){
  			k=0;
  		}
  		else if(b<k and k){
  			k-=b;
  		}
  		if(c>=k and k){
  			ans -= k;
  			k=0;
  		}else if(c<k){
  			k-=c;
  			ans -= c;
  		}
  	}
  	cout<<ans<<'\n';	

    return 0;
}

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

int a,b,c,n;
string s;

int main() {
	cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>a>>b>>c;
  cout<<c<<" "<<a<<" "<<b;
	

  return 0;
}



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

#define REP(i, n) for(decltype(n) i = 0; i < (n); i++)
#define REP2(i, x, n) for(decltype(x) i = (x); i < (n); i++)
#define REP3(i, x, n) for(decltype(x) i = (x); i <= (n); i++)
#define RREP(i, n) for (decltype(n) i = (n) - 1;i >= 0; i--)

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

#define LL long long int
#define LD long double

#define INF 1000000000
#define PI 3.14159265358979323846

#define _CRT_SECURE_NO_WARNINGS

using namespace std;

// N, E, S, W
const int dx[4] = { -1, 0,  1,  0 };
const int dy[4] = { 0, 1,  0, -1 };

typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<LL> vll;
//==============================================

struct node { int p, l, r; };
vi D(30);
vi H(30);
node N[30];

int setDepth(int u, int p) {
	if (u == -1) return 0;
	D[u] = p;
	if (N[u].l != -1) setDepth(N[u].l, p + 1);
	if (N[u].r != -1) setDepth(N[u].r, p + 1);
}

int setHeight(int u) {
	int h1 = 0, h2 = 0;
	if (N[u].l != -1) {
		h1 = setHeight(N[u].l) + 1;
	}
	if (N[u].r != -1) {
		h2 = setHeight(N[u].r) + 1;
	}

	return H[u] = max(h1, h2);
}

int getSibling(int u) {
	if (N[u].p == -1) return -1;
	if (N[N[u].p].l != u && N[N[u].p].l != -1) {
		return N[N[u].p].l;
	}
	if (N[N[u].p].r != u && N[N[u].p].r != -1) {
		return N[N[u].p].r;
	}

	return -1;
}

int getDegree(int u) {
	int deg = 0;
	if (N[u].l != -1) deg++;
	if (N[u].r != -1) deg++;

	return deg;
}

void print(int u) {
	cout << "node " << u << ": ";
	cout << "parent = " << N[u].p << ", ";
	cout << "sibling = " << getSibling(u) << ", ";

	cout << "degree = " << getDegree(u) << ", ";
	cout << "depth = " << D[u] << ", ";
	cout << "height = " << H[u] << ", ";

	if (N[u].p == -1) {
		cout << "root";
	} else if (N[u].l == -1 && N[u].r == -1) {
		cout << "leaf";
	} else {
		cout << "internal node";
	}
	cout << "\n";
}

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

	int n;
	cin >> n;

	REP(i, n) {
		N[i].p = N[i].l = N[i].r = -1;
	}
	int id, inputLeft, inputRight;
	REP(i, n) {
		cin >> id >> inputLeft >> inputRight;

		N[id].l = inputLeft;
		N[id].r = inputRight;
		if (inputLeft != -1) N[inputLeft].p = id;
		if (inputRight != -1) N[inputRight].p = id;
	}

	int r = 0;
	REP(i, n) {
		if (N[i].p == -1) r = i;
	}


	setDepth(r, 0);
	setHeight(r);

	REP(i, n) {
		print(i);
	}
	return 0;
}

Measured memory_bytes: 3192
n = int(input())

for k in range(20):
    if (26**k-1)//25<=n<(26**(k+1)-1)//25:
        n-=26*(26**(k-1)-1)//25
        break

ans=''
for i in range(k):
        ans+='abcdefghijklmnopqrstuvwxyz'[((n-1)//26**i)%26]

print(ans[::-1])

Measured memory_bytes: 9172