akhauriyash/Code-Regression huggingface dataset:
//#pragma optimization_level 3

//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <chrono>
#include <ctime>
#include <queue>
#include <math.h>
#include <deque>
#include <stack>
#include <iomanip>
#include <assert.h>
#include <stdio.h>
#include <cstring>
#include <random>

using namespace std;

#define int long long
#define ld long double
#define ull unsigned long long
//#define endl '\n'
#define try tr
#define pii pair<int, int>
#define ti tuple <int, int, int>
#define vi vector <int>
#define vpi vector <pii>
#define umap unordered_map
#define uset unordered_set
#define left left11
#define right right11
#define mp make_pair
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define sqr(a) ((a) * (a))
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

#define X first
#define Y second

ld TL = 1.0;
bool is_tl = 0;
int CALLS = 0;

inline bool IS() {
    if (++CALLS == 1000) {
        CALLS = 0;
        is_tl |= clock() > (TL - 0.1) * CLOCKS_PER_SEC;
    }
    return is_tl;
}

template<typename T1, typename T2>
inline void amin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void amax(T1 &a, T2 b) { if (a < b) a = b; }

template<typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> &p) {
    os << p.first << ' ' << p.second << endl;
    return os;
}

template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) {
    is >> p.first >> p.second;
    return is;
}

template<typename T>
ostream &operator<<(ostream &os, vector<T> &v) {
    for (auto &u : v) os << u << ' ';
    os << endl;
    return os;
}

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
const int N = 2e5 + 7, NS = 2e3 + 7, lg = 19, sq = 550, inf = 1e18 + 7, SM = 1e2 + 7;
const ld eps = 1e-9;
int hash_mod[4] = {1000000007, 998244353, 1000000009, 999999937}, mod = hash_mod[rnd() % 4];
int hash_pows[4] = {179, 239, 1007, 2003}, P = hash_pows[rnd() % 4];
char a[NS][NS];
void solve() {
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> a[i][j];
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if(a[i][j] == '#' || j == 0 || (j != m - 1 && i % 2 == 0))
                cout << '#';
            else
                cout << '.';
        }
        cout << endl;
    }
    cout << endl;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if(a[i][j] == '#' || j == m - 1 || (j != 0 && i % 2))
                cout << '#';
            else
                cout << '.';
        }
        cout << endl;
    }
}

signed main() {
    fast
    solve();

}


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

int main(){
  int64_t n;
  cin >> n;
  if(n<10){
    cout << n << endl;
    return 0;
  }
  string s=to_string(n);
  int ans=s.at(0)-49;
  bool ok=true;
  for(int i=1;i<s.size();i++){
    if(s.at(i)!='9'){
      ok=false;
      break;
    }
  }
  if(ok){
    ans+=(s.size()-1)*9+1;
    cout << ans << endl;
    return 0;
  }   
  ans+=9*(s.size()-1);
  cout << ans << endl;
  return 0;
}
    

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

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

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

	int ans = 0;
	for(int i=0; i<N-1; i++) {
		for(int j=i+1; j<N; j++) {
			ans += d[i] * d[j];
		}
	}
	cout << ans << endl;
}

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

int n;
double ans;

int main() {
  cin >> n;
  vector<double> p(n);
  vector<vector<double>> dp(n+1, vector<double>(n+1, 0));
  dp[0][0] = 1;
  rep (i, n) {
    cin >> p[i];
  }
  rep (i, n) {
    rep (j, n) {
      dp[i+1][j] += dp[i][j] * (1-p[i]);
      dp[i+1][j+1] += dp[i][j] * p[i];
    }
  }
  ans = 0;
  for (int i = n/2 + n%2; i <= n; i++) {
    ans += dp[n][i];
  }
  cout << fixed << setprecision(15) << ans << endl;
  return 0;
}


Measured memory_bytes: 70784
//Optional FAST

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")

//Required Libraries

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

//Required namespaces

using namespace std;
using namespace __gnu_pbds;

//Required defines

#define endl '\n'

#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(long long i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define FORI(a,b,c) for(long long a=b;a<c;a++)
#define FORD(a,b,c) for(long long a=b;a>c;a--)

//Required typedefs

typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;

//Required Constants

const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);
const long long INIT=(long long)(1e6+1);
const long double PI=3.14159265358979;

// Required random number generators

// mt19937 gen_rand_int(chrono::steady_clock::now().time_since_epoch().count());
// mt19937_64 gen_rand_ll(chrono::steady_clock::now().time_since_epoch().count());

//Required Functions

ll power(ll x,ll y) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2) % MOD; 
    p = (p * p) % MOD; 
  
    return (y%2 == 0)? p : (x * p) % MOD; 
}
ll modInverse(ll a) 
{ 
   return power(a,MOD-2); 
   
}

//Work

int main()
{
    #ifndef ONLINE_JUDGE
    if (fopen("INPUT.txt", "r"))
    {
        freopen ("INPUT.txt" , "r" , stdin);
        //freopen ("OUTPUT.txt" , "w" , stdout);
    }
    #endif
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    clock_t clk;
    clk = clock();
//-----------------------------------------------------------------------------------------------------------//

    READV(N);
    READAR(A,N);
    sort(A,A+N);
    ll ans=0;
    ll tot=0;
    FORI(i,0,N)
    {
        tot+=A[i];
    }
    FORD(i,N-1,-1)
    {
        if(i+1<N && tot*2<A[i+1])
        {
            break;
        }
        ans++;
        tot-=A[i];
    }
    cout<<ans<<endl;

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


    clk = clock() - clk;
    cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << endl;

    return 0;
}

Measured memory_bytes: 4544
#include <iostream>
#include <string>

using namespace std;

int main(int argc, const char *argv[])
{
  string s;
  cin >> s;
  char prev_ch = s[0];
  bool result = false;
  for (int i = 0; i < s.size(); i++) {
    if (prev_ch != s[i]) {
      result = true;
      break;
    }
  }

  cout << (result ? "Yes\n" : "No\n");
  return 0;
}

Measured memory_bytes: 256
N, Q = map(int, input().split())
S = input()

L, R = [0] * Q, [0] * Q
for i in range(Q):
    L[i], R[i] = map(int, input().split())

cum = [0] * N
c = 0
for i in range(0, N - 1):
    if S[i:i + 2] == "AC":
        c += 1

    cum[i + 1] = c
cum[-1] = c

for l, r in zip(L, R):
    print(cum[r - 1] - cum[l - 1])

Measured memory_bytes: 14128
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int main()
{
    int a[3];
    cin>>a[0]>>a[1]>>a[2];
    sort(a,a+3);
    cout<<a[0]<<" "<<a[1]<<" "<<a[2]<<endl;
    return 0;
}

Measured memory_bytes: 3084
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;

//using Graph = vector<vector<edge>>;
using dou =long double;
string yes="yes";
string Yes="Yes";
string YES="YES";
string no="no";
string No="No";
string NO="NO";

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(ll i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(ll i = m; i < (ll)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define query int qq;std::cin >> qq;rep(qqq,qq)
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum(a) accumulate(all(a),0ll)
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
#define case std::cout <<"Case #" <<qqq+1<<": "
#define RES(a,i,j) a.resize(i);rep(ii,i)a[ii].resize(j); 
#define as assign
#define ffor for(;;)
#define ppri(a,b) std::cout << a<<" "<<b << std::endl
#define pppri(a,b,c) std::cout<<a<<" "<<b<<" "<<c<<std::endl
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define ssum(a) accumulate(a,0ll) 
#define gre(n) greater<n>()

typedef long long ll;
//
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
//typedef long long T;
const int INF = 1000000000;
const double dINF = 1000000000;
const ll INF64 = 922337203685477580ll;
//const ll MOD = 1000000007ll;
const ll MOD = 998244353ll;
const dou pi=3.141592653589793;

//メモ
//二次元配列のresizeのしかた
//vv.resize(n);
//for(size_t i=0; i<n; i++){
// vv[i].resize(n);
//}

//メモ
//負の辺を持つ最短経路問題では到達不可経路でも初期化値より小さくなりうるので注意しよう
int main(){
    ll n;
    std::cin >> n;
    ll a,b;
    std::cin >> a>>b;
    if((b-a)%2==0)std::cout << (b-a)/2 << std::endl;
    else std::cout << min({b-1,n-a,(a)+(b-a-1)/2,(n-b+1)+(n-(a+1-b+n))/2}) << std::endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>


using namespace std;

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

int main(){

   int A,B,C,D,E,F;
   scanf("%d %d %d %d %d %d",&A,&B,&C,&D,&E,&F);

   //cout<<"A:"<<A<<"B:"<<B<<"C:"<<C<<"D:"<<D<<"E:"<<E<<"F:"<<F<<endl;
   


   set<int> set_w;
   set<int> set_s;

   int max_w=100*A;;
   int max_s=0;

   double max_f=0;
   double f;


   

   for(int a=0;a*A*100<=F;++a){
       for(int b=0;b*B*100<=F;++b){
           if(a*A*100+b*B*100<=F){
               set_w.insert(a*A*100+b*B*100);
           }

       }
   }
   /*
    for(set<int>::iterator i=set_w.begin();i!=set_w.end();++i){
       cout<<*i<<endl;
   }
   */

   for(int c=0;c*C<=F;++c){
       for(int d=0;d*D<=F;++d){
           if(c*C+d*D<=F){
               set_s.insert(c*C+d*D);
           }
       }
   }
/*
   for(set<int>::iterator i=set_s.begin();i!=set_s.end();++i){
       cout<<*i<<endl;
   }
*/

   for(set<int>::iterator w=set_w.begin();w!=set_w.end();++w){
       for(set<int>::iterator s=set_s.begin();s!=set_s.end();++s){
           if((*w)+(*s)<=F&&(E*(*w)>=(*s)*100)){
               if(*s==0){
                   f=0;
               }else{
                   f=(*s)*1.0/((*s)+(*w));
               }
               
               if(max_f<f){
                   max_f=f;
                   max_w=*w;
                   max_s=*s;
               }
           }
       }

   }

   cout<<max_w+max_s<<" "<<max_s<<endl;
}


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

int n;
struct Node {
	Node* pre, * nxt;
	int key;
};
Node *head;
void Init() {
	head = new Node;
	head->nxt = head, head->pre = head;
}
void Insert(int x) {
	Node* tmp = new Node;
	tmp->key = x;
	tmp->nxt = head->nxt;
	head->nxt->pre = tmp;
	head->nxt = tmp;
	tmp->pre = head;
}
Node* listSearch(int key) {
	Node* cur = head->nxt;
	while (cur != head && cur->key != key) {
		cur = cur->nxt;
	}
	return cur;
}
void deleteNode(Node* t) {
	if (t == head) return;
	t->pre->nxt = t -> nxt;
	t->nxt->pre = t->pre;
	free(t);
}
void deleteFirst() {
	deleteNode(head->nxt);
}
void deleteLast() {
	deleteNode(head->pre);
}
void deleteKey(int key) {
	deleteNode(listSearch(key));
}
void listPrint() {
	Node* cur = head->nxt;
	int isblank = 0;
	while (cur != head) {
		if (isblank) printf(" ");
		printf("%d", cur->key);
		cur = cur->nxt;
		isblank++;
	}
	printf("\n");
}
int main() {
	Init();
	int n;
	scanf("%d", &n);
	getchar();
	string S; int key;
	while (n--) {
		cin >> S;
		if (S == "insert") {
			scanf("%d", &key);
			Insert(key);
		}
		if (S == "delete") {
			scanf("%d", &key);
			deleteKey(key);
		}
		if (S == "deleteFirst") deleteFirst();
		if (S == "deleteLast") deleteLast();
	}
	listPrint();
	return 0;
}



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


int main()
{

    int n,i;
    char ch[25];

    scanf("%s",&ch);

    n = strlen(ch);

    for(i=0; i<n; i++)
    {
        if(ch[i]==',')
        {
            printf(" ");
        }
        else
        {
            printf("%c",ch[i]);
        }
    }
    printf("\n");
    return 0;

}


Measured memory_bytes: 128
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;  

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int LEN=12;

char s[LEN+1];


void run() {
	scanf("%s",s); REP(i,4) printf("%c",s[i]); printf(" "); FOR(i,4,12) printf("%c",s[i]); puts("");
}

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


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int W = Integer.parseInt(sc.next());
        int H = Integer.parseInt(sc.next());
        int x = Integer.parseInt(sc.next());
        int y = Integer.parseInt(sc.next());

        // 組み合わせ
        int pattern = 0;
        if (2 * x == W && 2 * y == H) {
            pattern++;
        }

        // 面積
        double rect = (double) H * W / 2;

        System.out.println(rect + " " + pattern);
    }
}


Measured memory_bytes: 23252
n=int(input())
flag=0
ans=0

for i in range(n):
    d1,d2=map(int,input().split())
    if d1==d2:
        flag+=1
        if flag==3:
            ans=1
    else:
        flag=0
if ans!=1:
    print("No")
else:
    print("Yes")
    

Measured memory_bytes: 9164
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <tuple>
#include <stdio.h>
#include <bitset>
#include <limits.h>
#include <complex>
#include <deque>
#include <iomanip>
#include <list>
#include <cstring>
using namespace std;
#define pi pair<int,int>
#define pl pair<long long,long long>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define en cout << endl //セミコロンつけろ
//#define MM 1000000000
//#define MOD MM+7
const int MM = 1e9;
const int MOD = MM+7;
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};
// 'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122
template<typename T>
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
template<typename T>
T LCM(T x,T y){
    T gc = GCD(x,y);
    return x*y/gc;
}

bool dpx[8000][20000],dpy[8000][20000];
int main(){
    string s; cin >> s;
    int x,y; cin >> x >> y;

    bool flg = true;
    int tmp = 0;
    vector<int> vx(0),vy(0);
    for (int i = 0; i < s.size(); i++){
        if (s[i] == 'F'){
            tmp++;
        } else if (s[i] == 'T') {
            if (flg){
                vx.push_back(tmp);
                flg = false;
            } else {
                vy.push_back(tmp);
                flg = true;
            }
            tmp = 0;
        }
    }
    //cout << "check1" << endl;
    if (flg){
        vx.push_back(tmp);
        vy.push_back(0);
    } else {
        vy.push_back(tmp);
        vx.push_back(0);
    }
    
    dpx[0][8000] = true;
    for (int i = 0; i < vx.size(); i++){
        //cout << "check-" << endl;
        for (int j = 0; j < 16000; j++){
            if (dpx[i][j]){
                dpx[i+1][j+vx[i]] = true;
                if (j >= vx[i] && i != 0) dpx[i+1][j-vx[i]] = true;
            }
        }
    }

    

    dpy[0][8000] = true;

    for (int i = 0; i < vy.size(); i++){
        for (int j = 0; j < 16000; j++){
            if (dpy[i][j]){
                dpy[i+1][j+vy[i]] = true;
                if (j >= vy[i]) dpy[i+1][j-vy[i]] = true;
            }
        }
    }
    //cout << "x : " << dpx[vx.size()][x+8000] << endl;
    //cout << "y : " << dpy[vy.size()][y+8000] << endl;
    

    
    if (dpx[vx.size()][x+8000] && dpy[vy.size()][y+8000]){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

}

Measured memory_bytes: 156416
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <queue>
#include <numeric>
#include <ctime>
using namespace std;

int H[6][6] = {
    {1,5,2,3,0,4}, // North : 奥へ移動   ( y:-1 )
    {3,1,0,5,4,2}, // East  : 右へ移動   ( x:+1 )
    {2,1,5,0,4,3}, // West  : 左へ移動   ( x:-1 )
    {4,0,2,3,5,1}, // South : 手前へ移動 ( y:+1 )
    {0,2,4,1,3,5}, // Right : 右回りに回転 (移動なし)
    {0,3,1,4,2,5}  // Left  : 左回りに回転 (移動なし)
};

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

// サイコロライブラリ
// d[0] := top,   d[1] := front 
// d[2] := right, d[3] := left
// d[4] := back,  d[5] := bottom
enum{TOP, FRONT, RIGHT, LEFT, BACK, BOTTOM};
struct Cube{
    vector<int> d;
    // コンストラクタで初期化
    Cube(vector<int> v){
        if( v.size() == 6 )
            d = v;
        else
            d = vector<int>(6);
    }
    Cube(){ d = vector<int>(6); }
    // dirの方向に回転 (副作用なし)
    Cube roll(int dir){
        vector<int> d_(6);
        for(int i = 0 ; i < 6 ; i++ ){
            d_[i] = d[ H[dir][i] ];
        }
        return Cube(d_);
    }
};
// Cube の順序を定義 (map<Cube,T> を使いたいとき用)
bool operator<(const Cube& a, const Cube& b){
    if( a.d[0] == b.d[0] )
        return a.d[1] < b.d[1];
    return a.d[0] < b.d[0];
}

const int INF = 1e+8;
int m[10][10];
int w, h, sx, sy, gx, gy;
// d[y][x][top][front] := (x,y) にサイコロの上面がtop, 正面がfrontだったときの最小コスト
int d[10][10][10][10];

struct State{
	Cube c;
	int x, y, cost;
	State(){}
	State(Cube c_, int x_, int y_, int cost_){
		c = c_; x = x_; y = y_; cost = cost_;
	}
};
bool operator<(const State& a, const State& b){
	return a.cost > b.cost;
}

int solve(){
	// 初期化
	for(int y=0 ; y < 10 ; y++ ){
		for(int x=0 ; x < 10 ; x++ ){
			for(int i=0 ; i < 10 ; i++ ){
				fill(d[y][x][i], d[y][x][i]+10, INF);
			}
		}
	}
	vector<int> v(6);
	for(int i=0 ; i < 6 ; i++ ){
		v[i] = i+1;
	}
	d[sy][sx][1][2] = 0;
	priority_queue<State> q;
	q.push( State(Cube(v), sx, sy, 0) );
	int res = INF;
	while( !q.empty() ){
		int x = q.top().x;
		int y = q.top().y;
		int cost = q.top().cost;
		Cube c = q.top().c;
		q.pop();
		
		if( x == gx && y == gy ){
			res = cost;
			break;
		}
		
		for(int i=0 ; i < 4 ; i++ ){
			int mx = x + dx[i];
			int my = y + dy[i];
			if( mx < 0 || my < 0 || w <= mx || h <= my ) continue;
			Cube next = c.roll(i);
			int next_cost = cost + next.d[BOTTOM] * m[my][mx];
			int top = next.d[TOP];
			int front = next.d[FRONT];
			if( next_cost < d[my][mx][top][front] ){
				d[my][mx][top][front] = next_cost;
				q.push( State(next, mx, my, next_cost) );
			}
		}
	}
	return res;
}

int main(){
	while( cin >> h >> w , h || w ){
		for(int y=0 ; y < h ; y++ ){
			for(int x=0 ; x < w ; x++ ){
				cin >> m[y][x];
			}
		}
		cin >> sy >> sx >> gy >> gx;
		int ans = solve();
		cout << ans << endl;
	}
}

Measured memory_bytes: 1332
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define pp pair<ll,ll>
#define vi vector<pair<pp,pp> >
#define pq_min priority_queue<ll,vector<ll>,greater<ll> >
#define pq_max priority_queue<ll>
#define forx(i,a,b) for(ll i=0;i<a;i++)
#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define fill(a,b) memset((a),(b),sizeof((a)))
#define ld long double
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
typedef pair<pp,pp> ppll;
const ll mod=1e9 + 7;

int main()
{
	fast;
	char a;
	cin>>a;
	a=a+1;
	cout<<a;
	
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <cmath>
#include <vector>
#include <algorithm>

#define M 1000000007

using namespace std;

int main(){
  int n;
  cin >> n;
  string s1, s2;
  cin >> s1 >> s2;

  long long res = (s1[0] == s2[0]) ? 3 : 6;
  
  char l1 = s1[0], l2 = s2[0];
  for(int i = 1;i < n;i++){
    if(l1 == l2){
      res = (res*2)%M;
    }else{
      if(l1 == s1[i] && l2 == s2[i]){
      }else if(s1[i] != s2[i]){
	// a: c b b
	// b: a a c 
	res = (res*3)%M;
      }
    }

    l1 = s1[i];
    l2 = s2[i];
  }

  cout << res << endl;

  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long; using ull = unsigned long long;
#define int ll
using vb = vector<bool>; using vvb = vector<vb>;
using vi = vector<int>; using vvi = vector<vi>;
using vl = vector<ll>; using vvl = vector<vl>;
using pii = pair<int,int>; using pll = pair<ll,ll>;
#define FOR(i,a,b) for(ll i = (a); i < (ll)(b); ++i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(ll i = (ll)(n)-1;i >= 0;--i)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define eb(val) emplace_back(val)
const double PI = acos(-1);
const double EPS = 1e-10;
const ll MOD = 1e9+7;
void cioacc(){//accelerate cin/cout
  cin.tie(0);
  ios::sync_with_stdio(false);
}
struct union_find{//rank,経路圧縮で高速化
  vector<long long> data;//そのノードがrootであれば-（集合のサイズ）を表し、そうでなければ親ノードidを示す。
  union_find(long long size):data(size,-1){}//コンストラクタ,size個のノードを作成し、-1で初期化
  long long root(long long a){//根を探す,経路圧縮
    return data[a] < 0 ? a : data[a]=root(data[a]);
  }
  bool find(long long a,long long b){//a,bが同じ集合に属するか調べる
    return root(a) == root(b);
  }
  bool unite(long long a,long long b){//小さい方の木の根に大きい方の根を上書きする
    a = root(a),b = root(b);
    if(a==b) return false;//根が同じなら終了,uniteが失敗したことを出力
    if(data[a]<data[b]) swap(a,b); //集合サイズの大きい方の根に低い方の根をつける
    data[b] += data[a];//集合サイズを統合
    data[a] = b;//yの親にxをつける
    return true;//unite成功を出力
  }
  long long size(long long a){//aが属する集合のサイズを出力
    return -data[root(a)];
  }
};
signed main(){
  ll n,m;
  cin >> n >> m;
  vi a(m),b(m);
  REP(i,m) cin >> a[i] >> b[i],a[i]--,b[i]--;
  int ans = 0;
  REP(i,m){
    union_find uf(n);
    REP(j,m){
      if(i!=j){
        uf.unite(a[j],b[j]);
      }
    }
    if(uf.size(0)!=n) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cstring>

using namespace std;

#define x first
#define y second
#define mp make_pair
#define pb push_back

typedef long long ll;

const ll MOD = 1e9+7;

int n, p;
ll memo[55][2];
int a[55];

ll dp(int pos, int o) {
	if (pos == n) return o==0;
	if (memo[pos][o] != -1) return memo[pos][o];
	return memo[pos][o] = dp(pos+1, o) + dp(pos+1, (o+a[pos])%2);
}

int main() {
	memset(memo, -1, sizeof memo);
	scanf("%d%d", &n, &p);
	for (int i=0 ; i<n ; i++) {
		scanf("%d", a+i);
	}
	printf("%lld\n", dp(0, p));
	return 0;
}

Measured memory_bytes: 256
#line 1 "/workspaces/compro/lib/template.hpp"


#line 1 "/workspaces/compro/lib/io/vector.hpp"
#include <iostream>
#include <vector>

#ifndef IO_VECTOR
#define IO_VECTOR

template <class T> std::ostream &operator<<(std::ostream &out, const std::vector<T> &v) {
  int size = v.size();
  for (int i = 0; i < size; i++) {
    std::cout << v[i];
    if (i != size - 1)
      std::cout << " ";
  }
  return out;
}

template <class T> std::istream &operator>>(std::istream &in, std::vector<T> &v) {
  for (auto &el : v) {
    std::cin >> el;
  }
  return in;
}

#endif
#line 4 "/workspaces/compro/lib/template.hpp"
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
#define MM << " " <<

using namespace std;

template <class T> void say(bool val, T yes, T no) { cout << (val ? yes : no) << "\n"; }

void say(bool val, string yes = "Yes", string no = "No") { say<string>(val, yes, no); }

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

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

// C++ 17に完全移行したら消す
// 最大公約数を求める
template <class T> T gcd(T n, T m) { return n ? gcd(m % n, n) : m; }

// 最小公倍数を求める
template <class T> T lcm(T n, T m) {
  int g = gcd(n, m);
  return n * m / g;
}

// 重複を消す。計算量はO(NlogN)
template <class T> void unique(std::vector<T> &v) {
  std::sort(v.begin(), v.end());
  v.erase(std::unique(v.begin(), v.end()), v.end());
}


#line 2 "main.cpp"

long long solve(long long N, long long X, long long M) {
  map<int, int> mp;
  ll ans = X;
  ll A = X;
  ll T = 0;
  ll init = 0;
  mp[X] = 0;
  REP(i, min(N - 1, M + 5)) {
    A = (A * A) % M;
    if (mp.count(A) == 0) {
      mp[A] = i + 1;
      ans += A;
    } else {
      init = mp[A];
      T = i + 1 - init;
      break;
    }
  }

  if (T == 0)
    return ans;

  vl val(T);
  REP(i, T) {
    val[i] = A % M;
    A = (A * A) % M;
  }

  ll loop = (N - init - T) / T;
  REP(i, T) { ans += val[i] * loop; }

  ll res = (N - init) % T;
  REP(i, res) { ans += val[i]; }

  return ans;
}

// generated by online-judge-template-generator v4.4.0 (https://github.com/kmyk/online-judge-template-generator)
int main() {
  long long N, X, M;
  std::cin >> N >> X >> M;
  auto ans = solve(N, X, M);
  std::cout << ans << std::endl;
  return 0;
}


Measured memory_bytes: 5924
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split(" ");
var arr=[];
for(var i=0;i<Arr.length;i++){
var v=Arr[i];
if(v=="+"){arr.push(arr.pop()+arr.pop());continue;}
if(v=="-"){arr.push((-1*arr.pop())+arr.pop());continue;}
if(v=="*"){arr.push(arr.pop()*arr.pop());continue;}
arr.push(v-0);
}
console.log(arr[0]);

Measured memory_bytes: 7380
R=range
while True:
    n,x=map(int,input().split())
    if n==x==0:
        break
    r=0
    for a in R(1,x//3):
        for b in R(a+1,x//2):
            c=x-a-b
            if b<c<=n:
                r+=1
    print(r)

Measured memory_bytes: 7700
using System;
using System.Numerics;
using System.Linq;
using System.Collections.Generic;
using System.Text;

namespace debug
{

    class ProgramE
    {
        static void Main(string[] args)
        {
            //入力
            long n = long.Parse(Console.ReadLine());
            long[] a = new long[n];
            long[] L = new long[n];
            long[] R = new long[n];

            string[] s = Console.ReadLine().Split(' ');

            //式変形からi + Ai = j - Ajでこの比較をする（i < j)
            for (int i = 0; i < n; i++)
            {
                L[i] = i - long.Parse(s[i]);
                R[i] = i + long.Parse(s[i]);
            }

            long count = 0;


            //i < j の条件かなので、jの値を求める。そしてその時の値がiにあるかみる
            for(int i = 0;i < n;i++)
            {
                //j側の条件を見る
                long temp2 = L[i];
                //aの中にはすでにi側で満たす数が入っている
                if(temp2 > 0)
                {
                    count += a[temp2];
                }

                long temp = R[i];

                //i側の条件を追加する
                if(temp < n)
                {
                    a[temp]++;
                }
                

            }

            //答え出力
            Console.WriteLine(count);



        }
    }
}


Measured memory_bytes: 49820
import java.util.*;

public class Main {
    public void main(Scanner sc) {
        char s[] = sc.next().toCharArray();
        int w = sc.nextInt();
        int len = s.length;

        for (int i = 0; i < len; i += w) {
            System.out.print(s[i]);
        }
        System.out.println();
    }

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


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

int main(void) {
	int n;
	cin >> n;
	vector<int> a(n+1);
	for (int i = 0; i < n+1; i++) {
		cin >> a[i];
	}

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

	long long  ans = 0;
	for (int i = 0; i < n; i++) {
		int left = min(a[i], b[i]);
		ans += left;
		a[i] -= left;
		b[i] -= left;

		int right = min(a[i+1], b[i]);
		ans += right;
		a[i+1] -= right;
		b[i] -= right;

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


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

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int main()
{
    string S;
    cin >> S;

    int s = 0, t = 0;
    REP(i, S.length())
    {
        char c = S[i];
        if (c == 'S')
        {
            s++;
        }
        else
        {
            if (s == 0)
                t++;
            else
                s--;
        }
    }
    cout << t + s << endl;
    return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<map>
using namespace std;
#define ll long long 


int prime[1000001];
void primesieve()
{
	ll i;
	for(i=0;i<=1000000;i++)
	{
		prime[i]=i;
	}
	ll j;
	for(i=2;i<=1000000;i++)
	{
		if(prime[i]==i)
		{
			for(j=i*i;j<=1000000;j+=i)
			{
				prime[j]=i;
			}
		}
	}
	return;
}

int main()
{
	primesieve();
	ll n;
	cin>>n;
	ll i;
	ll fin=0;
	for(i=1;i<n;i++)
	{
		ll b=n-i;
		map<int,int>mp;
		while(b!=1)
		{
			mp[prime[b]]++;
			b=b/prime[b];
		}
		ll ans=1;
		for(auto it=mp.begin();it!=mp.end();it++)
		{
			ans=ans*(it->second+1);
		}
		fin+=ans;
	}
	cout<<fin<<"\n";
}

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

int main(){
    while(1){
        
        string st1,st2;
        cin>>st1;
        if(st1=="-") break;
        int m;
        cin>>m;
        rep(i,m){
            int h;
            cin>>h;
            st2=st1.substr(0, h);
            st1.erase(0,h);
            st1+=st2;
        }
        
    
        cout<<st1<<endl;
    }
      
}


Measured memory_bytes: 3140
#include <bits/stdc++.h>
using namespace std;
int main(){
  int d;
  cin >> d;
  switch(d){
      case 22:
      cout << "Christmas Eve Eve Eve";
      break;
      case 23:
      cout << "Christmas Eve Eve";
      break;
      case 24:
      cout << "Christmas Eve";
      break;
      case 25:
      cout << "Christmas";
      break;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using namespace std;
typedef pair<ll, ll> pint;


void yesno(bool b) {
    if (b) {
        cout << "Yes" << endl;
    }     else {
        cout << "No" << endl;
    }

}
const double PI=3.14159265358979323846;
int main(){
    double R;
    cin >> R;
    cout << setprecision(6) << PI * 2 * R << endl;

}


Measured memory_bytes: 3756
package main

import "fmt"

func main(){
    var d, t, s float64

    fmt.Scanf("%f %f %f", &d, &t, &s)

    //fmt.Printf("%f %f %f\n", d,t,s)

    if t >= d * (1.0/s) {
        fmt.Printf("Yes\n")
    } else {
        fmt.Printf("No\n")
    }
}


Measured memory_bytes: 1836
#include<bits/stdc++.h>
#define ll long long int
#define pi pair<int,int>
#define eps 0.000000001
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define sz(x) ((int)x.size())
#define ln(x) ((int)x.length())
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define endl '\n'
#define dbg(x) cout<<#x<<" "<<x<<endl
#define clr(x,v) memset(x, v, sizeof(x))
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
const int mod = 1e9 + 7;
const double PI = acos(-1.0);
const int MAXN = 1e6 + 5;
int n, m, x;
int cost[15];
int inc[15][15];
int ans = INT_MAX;

void solve(int pos, vector<int> add, int cost_so_far)
{
    if(pos == n)
    {
        bool ok = true;
        for(int a : add)
            if(a < x)
                ok = false;
        if(ok)
            ans = min(ans, cost_so_far);
    }
    else
    {
        //don't read pos-th book
        solve(pos + 1, add, cost_so_far);
        for(int i = 0; i < m; i++)
            add[i] += inc[pos][i];
        solve(pos + 1, add, cost_so_far + cost[pos]);
    }
}

void cp()
{
    cin >> n >> m >> x;
    for(int i = 0; i < n; i++)
    {
        cin >> cost[i];
        for(int j = 0; j < m; j++)
            cin >> inc[i][j];
    }
    solve(0, vector<int>(m, 0), 0);
    if(ans == INT_MAX)
        cout << -1;
    else
        cout << ans;
}

int main()
{
    FASTIO;
    int t;
    t = 1;
    // cin >> t;
    while(t--)
    {
        cp();
    }
    return 0;
}

Measured memory_bytes: 3672
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#define print(n) std::cout << n << std::endl
using namespace std;


int main() {
    int a,b;
    cin >> a >> b;

    int sum = 1;
    int count = 0;
    while(sum < b){
        sum += a - 1;
        count++;
    }

    print(count);
}

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

int main() {
  int n;
  cin >> n;
  int a[n];
  for(int i=0;i<n;i++){
  	cin >> a[i];
  }
  sort(a,a+n);
  int sum1=0, sum2=0;
  for(int i=n-1;i>=0;i=i-2){
  	sum1+=a[i];
  }
  for(int i=n-2;i>=0;i=i-2){
  	sum2+=a[i];
  }
  
  cout << sum1-sum2 << endl;

}


Measured memory_bytes: 3616
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

// vectorの重複削除
// std::sort(test.begin(), test.end());
// test.erase(std::unique(test.begin(), test.end()), test.end());

using namespace std;
using ll = long long;
using P = pair<int, int>; // vector<P> ba(n); みたいな感じですぐ使える ba[i] = P(a, b); make_pairをしなくてもいい
// typedef vector<int> v;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}
#define rep(i, c) for(int i = 0; i < int(c); i++)
#define ALL(x) (x).begin(), (x).end() //sort(ALL(obj))みたいな
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値
#define pb push_back //
// const int MOD = 1000000007;
// string alpha="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
// printf("%.20f\n", ans); あれ
// const double PI = 3.141592653589793238462643383;

int main() {
  string alpha="zabcdefghijklmnopqrstuvwxy";
  ll n; cin>>n;
  ll ka;
  ll num = n;
  std::vector<char> v;
  while (num > 0) {
    if (num / 26 > 0) {
      if (num / 26 == 1 && num % 26 == 0) {
        ka = num % 26;
        v.push_back(alpha[ka]);
        break;
      }

      else if (num / 26 > 1 && num % 26 == 0) {
        ka = num % 26;
        v.push_back(alpha[ka]);
        //ka = num / 26 - 1;
        num /= 26;
        num -= 1;

      }
      else {
        ka = num % 26;
        num /= 26;
        //num = ks + ka;
        //cout << alpha[ka];
        v.push_back(alpha[ka]);
      }

    } else {
      ka = num % 26;
      //cout << alpha[ka];
      v.push_back(alpha[ka]);
      break;
    }
  }
  for (ll i=v.size()-1; i>=0; i--){
    cout << v[i];
  }
  cout << endl;
}


Measured memory_bytes: 3168
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using static MyIO;


public class E
{
	public static void Main() => (new Solver()).Solve();
}


public class Solver
{
	public void Solve()
	{
		long N = GetLong();
		long[] a = GetLongs((int)N);

		long cnt = 0;
		long[] b = new long[N];
		Array.Copy(a, b, N);
		while(b.Any(x => (x >= N)))
		{			
			long[] q = new long[N];
			for(int i = 0; i < N; i++)
				q[i] = b[i] / N;

			long S = q.Sum();
			cnt += S;
			for(long i = 0; i < N; i++)
			{
				b[i] -= q[i] * N;
				b[i] += S - q[i];				
			}
		}

		Console.WriteLine(cnt);
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(int N) => Enumerable.Range(0, N).Select(_ => GetInt()).ToArray();
	public static long[] GetLongs(int N) => Enumerable.Range(0, N).Select(_ => GetLong()).ToArray();
	public static double[] GetDoubles(int N) => Enumerable.Range(0, N).Select(_ => GetDouble()).ToArray();
	public static string[] GetStrings(int N) => Enumerable.Range(0, N).Select(_ => GetString()).ToArray();
}


Measured memory_bytes: 13396
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  while(N--){
    string start = "";
    for(int i = 0; i < 30; i++){
      char p;
      cin >> p;
      start += p;
    }

    queue< string > que;
    map< string, int > min_cost;
    que.push(start);
    min_cost[start] = 0;
    while(!que.empty()){
      string p = que.front(); que.pop();
      if(p == "111111111222444666555333333333"){
        cout << min_cost[p] << endl;
        break;
      }
     
      string next = p;
      swap( next[0], next[23]);
      swap( next[3], next[26]);
      swap( next[6], next[29]);
      swap( next[9], next[20]);
      swap( next[15], next[17]);
      if(min_cost.find(next) == min_cost.end()){
        que.push(next);
        min_cost[next] = min_cost[p] + 1;
      }

      next = p;
      swap( next[2], next[21]);
      swap( next[5], next[24]);
      swap( next[8], next[27]);
      swap( next[12], next[14]);
      swap( next[11], next[18]);
      if(min_cost.find(next) == min_cost.end()){
        que.push(next);
        min_cost[next] = min_cost[p] + 1;
      }

      next = p;
      swap( next[0], next[27]);
      swap( next[1], next[28]);
      swap( next[2], next[29]);
      swap( next[14], next[15]);
      swap( next[18], next[20]);
      if(min_cost.find(next) == min_cost.end()){
        que.push(next);
        min_cost[next] = min_cost[p] + 1;
      }

      next = p;
      swap( next[6], next[21]);
      swap( next[7], next[22]);
      swap( next[8], next[23]);
      swap( next[9], next[11]);
      swap( next[12], next[17]);
      if(min_cost.find(next) == min_cost.end()){
        que.push(next);
        min_cost[next] = min_cost[p] + 1;
      }
    }
  }
}

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

#define     fast()              ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
#define     ll                  long long int
#define     test()              ll t; cin>>t; while(t--) 
#define     lp0(i,begin,end)    for(ll i=begin;i<end;i++)
#define     lp1(i,begin,end)    for(ll i=begin;i<=end;i++)
#define     rlp(i,begin,end)    for(ll i=end;i>=begin;i--)
#define     prec(n)             fixed<<setprecision(n)
#define     initial(a,i)        memset(a,i,sizeof(a))
#define     pb                  push_back
#define     PI                  3.1415926535897932384626433832795
#define     MOD                 1000000007
#define     F                   first
#define     S                   second
#define     all(a)              (a).begin(),(a).end()
#define     BPC(x)              __builtin_popcountll(x)
#define     gcd(a,b)            __gcd(a,b)

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

ll power(ll x,ll n)
{
    ll result = 1;
    while (n)
    {
        if (n & 1)
            result = ((result%MOD) * (x%MOD))%MOD;
        n = n / 2;
        x = ((x%MOD) * (x%MOD))%MOD;
    }
    return result;
}

// Solution Function
void solution()
{
    // cout<<compte<<"\n";
    ll n;
    cin>>n;
    
    if(n==1)
        cout<<0;
   
    else 
    {
        ll ans  = MOD + ((power(10, n)  + power(8, n) % MOD) - ((2 * power(9, n)) % MOD)) % MOD;
	    cout<<(ans % MOD);
    }
}

// Driver Function
int main()
{
    //test()
    //{
        solution();
    //}
    return 0;
}

Measured memory_bytes: 3580
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;
using ll = long long;

#define REP(i, a) for (int i = 0; i < (a); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (a)-1; i >= (b); --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define SIZE(obj) (int)(obj).sizeT()
#define YESNO(cond, yes, no) \
    { cout << ((cond) ? (yes) : (no)) << endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(), (list).rend())
#define ASSERT(cond, mes) assert(cond&& mes)

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'050'000'000;

template <typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    REP(i, (int)v.size())
    is >> v[i];
    return is;
}

template <typename T>
T clamp(T& n, T a, T b) {
    if (n < a) n = a;
    if (n > b) n = b;
    return n;
}

template <typename T>
static T GCD(T u, T v) {
    T r;
    while (v != 0) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}

template <typename T>
static T LCM(T u, T v) {
    return u / GCD(u, v) * v;
}

std::vector<ll> enum_div(ll n) {
    std::vector<ll> ret;
    for (ll i = 1; i * i <= n; ++i) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i != 1 && i * i != n) { ret.push_back(n / i); }
        }
    }
    return ret;
}

template <typename T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

struct ToUpper {
    char operator()(char c) {
        return toupper(c);
    }
};

struct ToLower {
    char operator()(char c) {
        return tolower(c);
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int N, M;
    cin >> N >> M;
    map<int, int> m;
    REP(i, N) {
        m[i]++;
    }
    vector<int> r(N);
    r[0] = 1;
    REP(i, M) {
        int x, y;
        cin >> x >> y;
        x--;
        y--;
        m[x]--;
        m[y]++;
        if (r[x] == 1) { r[y] = 1; }
        if (m[x] == 0) { r[x] = 0; }
    }

    cout << count(ALL(r), 1) << endl;
    return 0;
}

Measured memory_bytes: 5376
#include<bits/stdc++.h>
using namespace std;
int n,m,a[100][100],ans;
string s;
int main()
{
	cin>>n>>m;
	ans=0;
	for(int i=0;i<n;i++)
	{
		cin>>s;
		for(int j=0;j<s.size();j++)
		{
			if(s[j]=='#')a[i][j]=1;
			else a[i][j]=0;
		}
	}
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)
		{
			if(a[i][j]==1)
			{
				cout<<"#";
			}
			if(a[i][j]==0)
			{
				if(a[i][j+1]==1)ans++;
				if(a[i][j-1]==1)ans++;
				if(a[i+1][j]==1)ans++;
				if(a[i+1][j-1]==1)ans++;
				if(a[i+1][j+1]==1)ans++;
				if(a[i-1][j]==1)ans++;
				if(a[i-1][j-1]==1)ans++;
				if(a[i-1][j+1]==1)ans++;
				cout<<ans;
				ans=0;
			}
		}
		cout<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
 
class Main{
  public static void main(String[] arg){
    int a, b, d, r;
    double f;
    Scanner in = new Scanner(System.in);
    a = in.nextInt();
    b = in.nextInt();
    d = a/b;
    r = a%b;
    f = (double)a/b;
    System.out.printf("%d %d %.6f",d,r,f);
    }
}

Measured memory_bytes: 26516
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define in(x) cin >> x
#define out(str) cout << str << endl

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; }

int N,C;
int s[100000],t[100000],c[100000],ss[200002]={},tt[200002],ans=0;

int main(){
    cin>>N>>C;
    rep(i,N)cin>>s[i]>>t[i]>>c[i];
    C++;
    rep(i,C){
        rep(j,200002)tt[j]=0;
        rep(j,N)if(c[j]==i){
            tt[s[j]*2-1]++;
            tt[t[j]*2]--;
        }
        repi(j,1,200002)tt[j]+=tt[j-1];
        rep(j,200002)if(tt[j])ss[j]++;
    }
    int maxi=0;
    rep(i,200002)maxi=max(maxi,ss[i]);
    out(maxi);
}


Measured memory_bytes: 2944
one = input()
two = input()
letter_one = list(one)
letter_two = list(two)

#print(len(letter_one))
ans = 0
for i in range(len(letter_one)):
    if letter_one[i] == letter_two[i]:
        ans += 0
    else:
        ans += 1
        
print(ans)
        

Measured memory_bytes: 12516
#include <iostream>
using namespace std;
int main(){
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int train;
  if(a <= b){
    train = a;
  }else{
    train = b;
  }
  
  int bus;
  if(c <= d){
    bus = c;
  }else{
    bus = d;
  }

  cout << train + bus << endl;
}
  
  


Measured memory_bytes: 256