akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>

using namespace std;
typedef long long ll;
#define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i))
#define all(x) x.begin(),x.end()


int main()
{
	int a,b;
	cin>>a>>b;
	if(a<10&&b<10)cout<<a*b<<endl;
	else cout<<-1<<endl;
}


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

int main() {
	int h, w;
	cin >> h >> w;
	char s[60][60];
	for(int i = 0; i < h; i++){
		cin >> s[i];
	}
	for(int i = 1; i < h; i++){
		for(int j = 1; j < w; j++){
			if (s[i][j] != '.'){
				if(s[i + 1][j] == '#' || s[i - 1][j] == '#' || s[i][j + 1] == '#' || s[i][j - 1] == '#'){

				}else{
					cout << "No" << endl;
					return 0;
				}
			}
		}
	}
	cout << "Yes" << endl;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10 ** 7)

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

# 複数回出てきているところが問題、グラフ問題として連結した部分で判定
N, M = lr()
adjacent = [[] for _ in range(N+1)] # 1-indexed
for _ in range(M):
    l, r, d = lr()
    adjacent[l].append((r, d))
    adjacent[r].append((l, -d))

X = [None] * (N+1)

def check(i):
    if X[i] == None: X[i] = 0
    for target, dist in adjacent[i]:
        if X[target] == None:
            X[target] = X[i] + dist
            check(target)
        elif X[target] != X[i] + dist:
            print('No')
            exit()

for i in range(1, N+1):
    if X[i] == None:
        check(i)

print('Yes')
# 54


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

#define ll long long

using namespace std;

int n, a[100'003];
int main() {
    cin >> n;
    for (int i = 0; i < n; ++i)
        cin >> a[i];

    int sol = 0;
    for (int i = 0; i < n; ++i) {
        int start = i;
        while (i < n - 1 && a[i + 1] <= a[i])
            i++;
        sol = max(sol, i - start);
    }

    cout << sol;
    return 0;
}


Measured memory_bytes: 640
def solve(string):
    h, w = map(int, input().split(" "))
    a = [list(map(lambda x: int(x) % 2 == 1, input().split(" "))) for _i in range(h)]
    move = []
    for i in range(h):
        for j in range(w):
            if not a[i][j]:
                continue
            if j < w - 1:
                a[i][j + 1] ^= True
                move.append("{} {} {} {}".format(i + 1, j + 1, i + 1, j + 2))
            elif i < h - 1:
                a[i + 1][j] ^= True
                move.append("{} {} {} {}".format(i + 1, j + 1, i + 2, j + 1))
    move.insert(0, str(len(move)))
    return "\n".join(move)


if __name__ == '__main__':
    print(solve(""))


Measured memory_bytes: 16380
#include<bits/stdc++.h>
using namespace std;
typedef signed long long int ll;
ll inf=1000000007;



const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}



int main(){
    string s;
    cin>>s;
    
    int n;
    n=(int)s.size();
    
    ll dp[100010][4]={};
    dp[n][3]=1;
    for(int i=0;i<3;i++) dp[n][i]=0;
    for(int i=n-1;i>=0;i--){
        
        //char c=s[i];
        
        for(int j=3;j>=0;j--){
            /*if(i==n){
                dp[i][j] = (j == 3 ? 1 : 0);
                //if(j==3) dp[i][j]=1;
                //else dp[i][j]=0;
            }else{*/
                
                dp[i][j]=dp[i+1][j]*(s[i] =='?' ? 3LL : 1LL);
                if(j < 3 && (s[i] == '?' || s[i] == "ABC"[j])){
                        dp[i][j] += dp[i+1][j+1];

                }
                dp[i][j]%=MOD;
            
            }
        //}
        
        /*if(c=='?'){
            //j=3
            //何を書くかで三通り
            dp[i][3]=3LL*dp[i+1][3];
            
            //j=2
            //?にA,B,Cを入れて丸しない
            dp[i][2]=3LL*dp[i+1][2];
            //cを入れて丸
            dp[i][2]+=dp[i+1][3];
            
            //j=1
            //A,B,Cで丸しない
            dp[i][1]=3LL*dp[i+1][1];
            //Bで丸
            dp[i][1]+=dp[i+1][2];
            
            //j=0
            //丸しない
            dp[i][0]=3LL*dp[i+1][0];
            //Aで丸
            dp[i][0]+=dp[i+1][1];
        }else if(c=='C'){
            //j=3
            dp[i][3]=dp[i+1][3];
            //j=2
            //丸をするかしないか
            dp[i][2]=dp[i+1][2]+dp[i+1][3];
            //j=1
            dp[i][1]=dp[i+1][1];
            //j=0;
            dp[i][0]=dp[i+1][0];
        }else if(c=='B'){
            //j=3
            dp[i][3]=dp[i+1][3];
            //j=2
            dp[i][2]=dp[i+1][2];
            //j=1
            dp[i][1]=dp[i+1][1]+dp[i+1][2];
            
            dp[i][0]=dp[i][0];
            
        }else if(c=='A'){
            //j=3
            dp[i][3]=dp[i+1][3];
            //j=2
            dp[i][2]=dp[i+1][2];
            
            dp[i][1]=dp[i+1][1];
            
            dp[i][0]=dp[i+1][0]+dp[i+1][1];
        }*/
        
        /*for(int j=0;j<4;j++){
            dp[i][j]%=inf;
        }*/
    }
    
    cout<<dp[0][0]<<endl;
    
    
    return 0;
}


Measured memory_bytes: 3584
module.exports=function(t){var r={};function e(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,e),i.l=!0,i.exports}return e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:n})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,r){if(1&r&&(t=e(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var i in t)e.d(n,i,function(r){return t[r]}.bind(null,i));return n},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},e.p="",e(e.s=0)}([function(t,r,e){"use strict";var n=e(1);e(2)(n.readFileSync("/dev/stdin","utf8"))},function(t,r){t.exports=require("fs")},function(t,r,e){"use strict";var n=e(3),i=e(5);t.exports=function(t){var r=new n(t);i(r)}},function(t,r,e){"use strict";var n=e(4);t.exports=class{constructor(t){var r=t.trim().split(/\s+/g);this.inp=new n(r)}inr(){return this.inp.deq()}in(){return parseInt(this.inp.deq(),10)}fin(){this.inp.clear()}}},function(t,r,e){"use strict";t.exports=class{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.size=t.length,this.items=t,this.ind=0}enq(t){this.size+=1,this.items.push(t)}deq(){var t=this.items[this.ind];return this.size-=1,this.ind+=1,t}clear(){this.items=[],this.size=0,this.ind=0}}},function(t,r,e){"use strict";t.exports=function(t){for(var r=t.in(),e=t.in(),n=new Array(e),i=0;i<e;i++)n[i]=new Array(100005).fill(0);for(var o=new Array(r),s=new Array(r),u=new Array(r),a=0;a<r;a++)o[a]=t.in(),s[a]=t.in(),u[a]=t.in()-1,n[u[a]][o[a]]+=1,n[u[a]][s[a]]-=1;for(var c=[],f=0;f<e;f++)for(var l=0,p=1;p<100005;p++)n[f][p]+=n[f][p-1],0==n[f][p]&&(l!=p-1&&c.push({s:l,t:p-1}),l=p);for(var d=c.length,v=new Array(100005).fill(0),h=0;h<d;h++)v[c[h].s]++,v[c[h].t+1]--;for(var y=0,b=1;b<100005;b++)v[b]+=v[b-1],v[b]>y&&(y=v[b]);console.log(y)}}]);

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

moves = []
for i in range(N):
	moves.append(tuple(map(int, input().split())))
	
current = (0, 0, 0)
for nextPosition in moves:
	dt = nextPosition[0] - current[0]
	dist = abs(nextPosition[1] - current[1]) + abs(nextPosition[2] - current[2])
	if (dist > dt):
		print('No')
		exit()
	if (dt%2 != dist%2):
		print('No')
		exit()

print('Yes')

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

int main() {
  char str[21];
  int length = 0;
  cin >> str;
  for (int i = 0; str[i] != 0; i++) {
    length++;
  }
  for (int i = length-1; i>=0; i--) {
    cout << str[i];
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> list = {105,135,165,189,195};
  int n;
  cin >> n;
  if(n < 105) {
    cout << 0 << endl;
    return 0;
  }
  int ans = 0;
  for(int i=0; i<5; i++) {
    if(list.at(i) <= n) {
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3600
require "set"

INF = (1 << 31) - 1
TownMax = 100

until (given = gets.chomp) == "0 0 0 0 0"
  c, n, m, s, d = given.split.map(&:to_i)
  s -= 1
  d -= 1
  data = m.times.map {gets.split.map(&:to_i)}
  
  fares = Array.new(n) {[]}
  route_map = Array.new(n, [])
  towns = Set.new
  
  data.each do |a, b, f|
    a -= 1
    b -= 1
    route_map[a] += [b]
    route_map[b] += [a]
    fares[a][b] = f
    fares[b][a] = f
    towns << a
    towns << b
  end
  
  shortest = Array.new(c + 1) {Array.new(TownMax, INF)}
  done = Array.new(c + 1) {Array.new(TownMax, false)}
  
  shortest[0][s] = 0
  
  loop do
    u0 = u1 = nil
    (c + 1).times do |ticket|
      towns.each do |town|
        next if done[ticket][town]
        if !u0 or shortest[ticket][town] < shortest[u0][u1]
          u0, u1 = ticket, town
        end
      end
    end
    break unless u0
    done[u0][u1] = true
    
    route_map[u1].each do |to|
      if (a0 = shortest[u0][u1] + fares[u1][to]) < shortest[u0][to]
        shortest[u0][to] = a0
      end
      if u0 + 1 <= c
        if (a1 = shortest[u0][u1] + fares[u1][to] / 2) < shortest[u0 + 1][to]
          shortest[u0 + 1][to] = a1
        end
      end
    end
  end
  
  puts shortest.map {|a| a[d]}.min
end


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

int main(){
  int64_t P=100,ans=0;
  int64_t X;
  cin >>X;
  while(1){
    ans++;
    P=P/100+P;
    if(P>=X){
      cout<< ans<<endl;
      break;
    }
  }
}


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

void setIO(string s) {
  ios_base::sync_with_stdio(0); cin.tie(0); 
  freopen((s+".in").c_str(),"r",stdin);
  freopen((s+".out").c_str(),"w",stdout);
}

int main() {
  ll n;
  cin >> n;
  n = n % 10;
  if (n == 2 || n == 4 || n == 5 || n == 7 || n == 9) {
    cout << "hon\n";
  } else if (n == 0 || n == 1 || n == 6 || n == 8) {
    cout << "pon\n";
  } else {
    cout << "bon\n";
  }
  return 0;
}

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

/**
 * Created by fcdkbear on 15.10.16.
 */
public class Main {

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        new Task().solve(in, out);
        out.close();
    }


    static class Task {

        public void solve(InputReader in, PrintWriter out) {

            int n = in.nextInt();
            String s = in.next();
            String t = in.next();
            for (int len = n; len > 0; --len) {
                String suffix = s.substring(s.length() - len);
                String prefix = t.substring(0, len);
                if (suffix.equals(prefix)) {
                    out.println(n + n - len);
                    return;
                }
            }
            out.println(n + n);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

    }

}


Measured memory_bytes: 8528
/*
 * atcoder/abc144/d.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
using namespace std;
#define ll long long
#define ld long double
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> ostream & operator << (ostream & out, vector<T> const & v) {
  for (auto &&a: v) out << a << " "; out << endl; return out;
}
template <class T> void dump(T &a) { cout << a << endl; }
template <class T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template <class T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }

ld degree(ld rad) {
  return rad * 180 / M_PI;
}

ld a, b, x;
void solve() {
  cin >> a >> b >> x;
  if (x > a * a * b * 0.5) {
    cout << degree(atan(2 * (a * a * b - x) / (a * a * a))) << endl;
  }
  else {
    cout << 90 - degree(atan((2 * x) / (a * b * b))) << endl;
  }
}
int main() {
  cout.precision(15); cout << fixed;

  solve();

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
using namespace std;
int n,l;
int dx[2]={-1,1};
int dir[22];
int p[22];
int np[22];
int ndir[22];
bool move[22];
int main(void){
	while(1){
		scanf("%d %d",&n,&l);
		if(n+l==0)break;
		for(int i=0;i<n;i++){
			string str;
			cin >> str >> p[i];
			if(str=="L")dir[i]=0;
			else dir[i]=1;
		}
		int t=0,rest=n,res;
		memset(move,false,sizeof(move));
		while(rest>0){
			res=-1;
			for(int i=0;i<n;i++){
				if(p[i]%l==0)continue;
				np[i]=p[i]+dx[dir[i]];
				ndir[i]=dir[i];
				for(int j=0;j<n;j++){
					if(i==j || p[j]%l==0)continue;
					if(p[i]+dx[dir[i]]==p[j]+dx[dir[j]]){
						np[i]=p[i]+dx[dir[i]];
						ndir[i]=1-dir[i];
					}
				}
			}
			for(int i=0;i<n;i++){
				if(p[i]%l==0)continue;
				p[i]=np[i];
				dir[i]=ndir[i];
				if(res==-1 || p[i]==0)res=i;
				if(p[i]%l==0){
					if(!move[i]){
						move[i]=true;
						rest--;
					}
				}
			}
			t++;
		}
		printf("%d %d\n",t,res+1);

	}
	return 0;
}

Measured memory_bytes: 1248
// https://atcoder.jp/contests/dp/tasks/dp_k
#include <cmath>
#include <cstring>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair

#define FastIO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

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

const int N = int(1e5)+7;
const int MOD = int(1e9)+7;
const int INF = int(2e9)+5;
const ll INF64 = 1e18;

int a[N],dp[N];

int main () {
    int n,k;cin>>n>>k;
    for (int i=1;i<=n;i++) {
        cin>>a[i];
        dp[i] = 0;
    }
    sort(a+1,a+n+1);
    dp[0] = 0;
    for (int i=1;i<=k;i++) {
        for (int j = 1;j<=n;j++) {
            if (a[j] > i) break;
            if (dp[i - a[j]] == 0) {
                dp[i] = 1;
                break;
            }
        } 
    }
    if (dp[k] == 1) {
        cout<<"First";
    } else {
        cout<<"Second";
    }
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define int long long
int P, Q, A, N;

int dfs(int p, int q, int n, int t) {
    if (P * q == p * Q) return 1;
    if (P * q < p * Q) return 0;
    if (N == n) return 0;

    int ret = 0;

    for (int i = t; q * i <= A; i++) {
        ret += dfs(p * i + q, q * i, n + 1, i);
    }

    return ret;
}

signed main() {
    while (cin >> P >> Q >> A >> N, P || Q || A || N)
        cout << dfs(0, 1, 0, 1) << endl;
    return 0;
}

Measured memory_bytes: 3072
#include <bits/stdc++.h>
#define OP_IO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define fo(i,a,b) for(int i = a; i < b; i++)
#define foi(i,a,b) for(int i = a; i>=b; i--)
#define fi first
#define si second
#define pb push_back
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef vector<pii> vpii;

const ll INF = 1e18L + 5;
const int MAXN = 1005;
const ll modn = 1e9+7;

vs board;
ll dp[MAXN][MAXN];

ll solve(int h, int w){
  fo(i,0,MAXN){
    fo(j,0,MAXN){
      dp[i][j] = 0;
    }
  }
  bool found = false;
  fo(i,0,h){
    if(found){
      dp[i][0] = 0;
    }else if(board[i][0] == '.'){
      dp[i][0] = 1;
    }else{
      dp[i][0] = 0;
      found = true;
    }
  }
  found = false;
  fo(j,0,w){
    if(found){
      dp[0][j] = 0;
    }else if(board[0][j] == '.'){
      dp[0][j] = 1;
    }else{
      found = true;
      dp[0][j] = 0;
    }
  }
  fo(i,1,h){
    fo(j,1,w){
      if(board[i][j] == '.'){
	dp[i][j] = (dp[i-1][j]%modn + dp[i][j-1]%modn)%modn;
      }else{
	dp[i][j] = 0;
      }
    }
  }
  return dp[h-1][w-1];
}

int main(){
  OP_IO;
  int h,w;
  cin>>h>>w;
  fo(i,0,h){
    string row;
    cin>>row;
    board.pb(row);
  }
  cout<<solve(h,w)<<endl;
  return 0;
}


Measured memory_bytes: 9216
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define l long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define pii pair <int,int>
#define pll pair <ll,ll>
#define testcase() int t; cin>>t; while(t--)

ll M = 1e9 + 7;
ll powerm(ll x,ll y){ ll res=1; while(y){ if(y&1) res=(res*x)%M; y=y>>1; x=(x*x)%M;} return res%M; }
ll power(ll x,ll y){ ll res=1; while(y){ if(y&1) res=(res*x); y=y>>1; x=(x*x);} return res; }
ll max3(ll a,ll b,ll c){ return max( max(a,b),c ); }
ll gcd(ll a,ll b){if(b>a)return gcd(b,a); if(b==0)return a; return gcd(b,a%b);}


int main() {
	
	//ifstream cin("input.txt");
	//ofstream cout("output.txt");
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
	
	ll x; cin>>x;
	ll ans = 0; ll sm = 100;
	while(sm<x)
	{
	    sm = sm*( 101.0/100.0 );
	    ans++;
	}
	cout<<ans;
	
	return 0;
}


Measured memory_bytes: 3612
#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>

using ll = long long int;
using P = std::pair<ll, int>;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);

#define l_ength size

ll MOD;

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

ll memo[3030][3030],dp[3030][3030],calc[3030][2]={{1ll,1ll}};
bool done[3030][3030];

ll rwpw(ll a, ll p, ll m = MOD){
	ll ret = 1ll;
	while(p){
		if(p%2){
			ret *= a; ret %= m;
		}
		a *= a; a %= m;
		p /= 2;
	}
	return ret;
}

ll ramen(int a){
	return rwpw(2ll,calc[a][1]);
}

ll c(int n, int k){
	if(done[n][k]){
		return memo[n][k];
	}
	done[n][k] = true;
	if(k==n || k==0){
		return memo[n][k] = 1ll;
	}
	memo[n][k] = c(n-1,k-1);
	add_mod(memo[n][k],c(n-1,k));
	return memo[n][k];
}

int main(void){
	int n,i,j;
	ll tmp,ans=0ll;
	std::cin >> n >> MOD;
	dp[0][0] = 1ll;
	for(i=0; i<n; ++i){
		for(j=0; j<2; ++j){
			calc[i+1][j] = calc[i][j]*2ll%(MOD-j);
		}
		for(j=0; j<=n; ++j){
			add_mod(dp[i+1][j],dp[i][j]);
			add_mod(dp[i+1][j+1],dp[i][j]);
			add_mod(dp[i+1][j],dp[i][j]*j%MOD);
		}
	}
	for(i=0; i<=n; ++i){
		tmp = 1ll;
		for(j=0; j<=n; ++j){
			mul_mod(dp[i][j],tmp);
			mul_mod(tmp,calc[n-i][0]);
		}
		for(j=0; j<n; ++j){
			add_mod(dp[i][j+1],dp[i][j]);
		}
	}
	for(i=0; i<=n; ++i){
		tmp = dp[i][n];
		mul_mod(tmp,ramen(n-i));
		mul_mod(tmp,c(n,i));
		add_mod(ans,((i%2)?(MOD-tmp):tmp));
	}
	std::cout << ans << std::endl;
	return 0;
}


Measured memory_bytes: 129860
#!/usr/bin/env python3

import sys, math, copy
# import fractions, itertools
# import numpy as np
# import scipy

HUGE = 2147483647
HUGEL = 9223372036854775807
ABC = "abcdefghijklmnopqrstuvwxyz"

def main():
    n = int(input())
    ai = []
    bi = []
    for i in range(n):
        a, b = map(int, input().split())
        ai.append(a)
        bi.append(b)
    su = 0
    for i in reversed(range(n)):
        a = ai[i] + su
        b = bi[i]
        su += (-a) % b
    print(su)

main()


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

int main(){
  int N;
  cin>>N;
  
  int sum=0, ans=N;
  while(ans>0){
   sum+=ans%10;
     ans/=10;
  }
  
  if(N%sum==0){cout<<"Yes";}
  else{cout<<"No";}
  
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Created on Wed Mar  4 16:16:18 2020

@author: Kanaru Sato
"""

N = int(input())
D = {}

for i in range(0,N):
    S = input()
    if S not in D:
        D[S] = 1
    if S in D:
        D[S] += 1

Mvalue = max(D.values())

List = []
[List.append(i) for i in D if D[i]==Mvalue]

List.sort()

for i in range(0,len(List)):
    print(List[i])

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

int main() {
	int N;
    cin>>N;
	vector <int> dn(N);
	
	for (int i=0;i<N;i++){
		cin >> dn.at(i);
	}
	
	sort(dn.begin(),dn.end());
	reverse(dn.begin(),dn.end());
	
	int sum =1;
	int p = dn.at(0);
	int q =p ;
	for(int i=1;i<N;i++){
		p=dn.at(i);
		
		if(p!=q){
			sum++;
		}
		
		q=p;
	}
	
	cout << sum << endl;
}


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

#define rep(i,j,n) for(int i=(j);i<(n);i++)
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.rend()
#define INF 1e9
#define LINF 1e18
const int mod = 1e9+7;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pi;
typedef long long i64;

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

  int n;
  cin >> n;
  vi dp(n + 1, 0);
  rep(i, 1, n + 1) {
    dp[i] = dp[i - 1] + 1;

    int six = 6;
    while(i >= six) {
      dp[i] = min(dp[i], dp[i - six] + 1);
      six *= 6;
    }

    int nine = 9;
    while(i >= nine) {
      dp[i] = min(dp[i], dp[i - nine] + 1);
      nine *= 9;
    }
  }
  cout << dp[n] << endl;
}


Measured memory_bytes: 640
// Learn more about F# at http://fsharp.org
// See the 'F# Tutorial' project for more help.
open System

[<EntryPoint>]
let main argv =
    let count = stdin.ReadLine() |> int

    let weight = stdin.ReadLine().Split(' ') |> Array.toList |> List.map int

    let calcDiffOfPartition (list:int List) (separation:int) =
           (list.[..separation], list.[separation+1..])
                ||> fun list1 list2 -> Math.Abs(List.sum(list1) - List.sum(list2))

    let answer = [0..count - 1]
                 |> List.map(calcDiffOfPartition weight) 
                 |> List.min

    printfn "%d" answer

    0


Measured memory_bytes: 14172
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt
from copy import deepcopy


def main():
    n = int(input())
    a_list = list(map(int, input().split()))
    max_num = 0
    ans = 0
    for i in range(n-1):
        if i == 0:
            max_num = a_list[i]
        
        if max_num > a_list[i+1]:
            ans += max_num - a_list[i+1]
        else:
            max_num = a_list[i+1]
    print(ans)

if __name__ == '__main__':
	main()


Measured memory_bytes: 33524
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


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

	long long n, m, nn, mm, i, j, k, p = 1000;
	cin >> n >> m >> nn >> mm;
	if ((n % nn == 0) && (m % mm == 0)) cout << "No\n";
	else {
		cout << "Yes\n";
		for (i = 0; i < n; i++) {
			for (j = 0; j < m; j++) {
				if ((i % nn == nn - 1) && (j % mm == mm - 1)) cout << -(nn * mm * p - p + 1) << " ";
				else cout << p << " ";
			}
			cout << "\n";
		}
	}


	return 0;
}



Measured memory_bytes: 1536
function main(arg) {
	var s = arg.split("\n")[0]
	var l0 = s.split("0").length - 1
	var l1 = s.split("1").length - 1
	var min = (l0  < l1) ? l0 : l1
	console.log(min * 2)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 9036
#include <stdio.h>
int main(void){
    char s[256];
    scanf("%s",s);
    if (s[0] == s[1] || s[1] == s[2] || s[2] == s[3] || s[3] == s[4] ){
        printf("Bad");
    }else{
        printf("Good");
    }
  
}


Measured memory_bytes: 128
using System.Linq;
using System.Collections.Generic;
using System;

public class P
{
    public string s { get; set; }
    public int c { get; set; }
}

public class Hello
{
    public static void Main()
    {
        string s;
        for (; (s = Console.ReadLine()) != null;)
        {
            var a = new int[9];
            for (int i = 0; i < 13; i++) a[int.Parse(s[i].ToString()) - 1]++;
            var ret = new List<int>();
            for (int i = 0; i < 9; i++)
            {
                a[i]++;
                if (a[i] >= 5) { a[i]--; continue; }
                for (int j = 0; j < 9; j++)
                {
                    if (a[j] >= 2)
                    {
                        var b = new int[9];
                        Array.Copy(a, b, 9);
                        b[j] -= 2;
                        if (goBfs(putA(b), 12)) { ret.Add(i); goto next; }
                    }
                }
                next:;
                a[i]--;
            }
            print(ret);
        }
    }
    public static void print(List<int> a)
    {
        var ac = a.Count();
        if (ac == 0) Console.WriteLine(0);
        for (int i = 0; i < ac; i++)
            if (i == ac - 1) Console.WriteLine(a[i] + 1);
            else Console.Write("{0} ", a[i] + 1);
    }
    public static bool goBfs(string s, int c)
    {
        var hs = new HashSet<string>();
        var st = new Stack<P>();
        st.Push(new P { s = s, c = c });
        while (st.Count() > 0)
        {
            var x = st.Pop();
            if (x.c == 0) return true;
            var a = getA(x.s);
            for (int i = 0; i <= 6; i++)
            {
                if (a[i] >= 1 && a[i + 1] >= 1 && a[i + 2] >= 1)
                {
                    a[i]--; a[i + 1]--; a[i + 2]--;
                    var ww = putA(a);
                    if (!hs.Contains(ww)) st.Push(new P { s = ww, c = x.c - 3 });
                    st.Push(new P { s = putA(a), c = x.c - 3 });
                    a[i]++; a[i + 1]++; a[i + 2]++;
                }
            }
            for (int i = 0; i <= 8; i++)
                if (a[i] >= 3)
                {
                    a[i] -= 3;
                    var ww = putA(a);
                    if (!hs.Contains(ww)) st.Push(new P { s = ww, c = x.c - 3 });
                    a[i] += 3;
                }
        }
        return false;
    }
    public static int[] getA(string s)
    {
        var ret = new int[9];
        for (int i = 0; i < 9; i++) ret[i] = int.Parse(s[i].ToString());
        return ret;
    }
    public static string putA(int[] a)
    {
        var ret = "";
        for (int i = 0; i < 9; i++) ret += a[i].ToString();
        return ret;
    }
}



Measured memory_bytes: 10688
import java.util.Scanner;
class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int inputIum = scan.nextInt();
        System.out.println(calCubic(inputIum));
    }
    private static long calCubic (int inputIum) {
        return inputIum * inputIum * inputIum;
    }
}

Measured memory_bytes: 26192
#include <bits/stdc++.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

using namespace std;

typedef long long int lli;
typedef pair<int, int> ii;

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

#ifdef LOCAL
	#define eprintf(...) printf(__VA_ARGS__)
#else 
	#define eprintf(...) 1
#endif

#define ROUNDUP(a, b) 		( ((a) + ((b) - 1) ) / b)
#define SET_ZERO(a)	 		( memset((a), 0, sizeof(a)))
#define SET_NUM_ARRAY(a,b)	( memset((a), b, sizeof(a)))
//#define int long long int //dont forget to change int to signed
int count32bit(unsigned v) {
	unsigned count = (v & 0x55555555) + ((v >> 1) & 0x55555555);
	count = (count & 0x33333333) + ((count >> 2) & 0x33333333);
	count = (count & 0x0f0f0f0f) + ((count >> 4) & 0x0f0f0f0f);
	count = (count & 0x00ff00ff) + ((count >> 8) & 0x00ff00ff);
	return (count & 0x0000ffff) + ((count >> 16) & 0x0000ffff);
}
int main() {
	int N;
	scanf("%d", &N);
	unsigned int colors = 0;
	int wild = 0;
	for (int i = 0; i < N; i++) {
		int c;
		scanf("%d", &c);
		if (c/400 < 8)
			colors |= (1<<(c/400));
		else 
			wild++;
	}
	int min = count32bit(colors);
	int max = min+wild;
	if (min == 0) min = 1;
	printf("%d %d\n", min, max);
	return 0;
}



Measured memory_bytes: 256
# 2020/05/02
# AtCoder Beginner Contest 165 - C

a = list()
def mkArray(in_list, sav_val, cnt):
    if cnt >= n:
        a.append(in_list)
        return 0
    else:
        for x in range(sav_val, m + 1):
            wk_list = list()
            wk_list.extend(in_list)
            wk_list.append(x)
            mkArray(wk_list, x, cnt + 1)

# Input
n, m, q = map(int,input().split())
abcd = list()

for i in range(q):
    w_abcd = list(map(int,input().split()))
    abcd.append(w_abcd)

# Make Array
w_a = list()
mkArray(w_a, 1, 0)

# Search
ans = 0
for i in range(len(a)):
    wans = 0
    for j in range(q):
        if a[i][abcd[j][1]-1] - a[i][abcd[j][0]-1] == abcd[j][2]:
            wans = wans + abcd[j][3]

    if wans > ans:
        ans = wans

# Output
print(ans)


Measured memory_bytes: 27336
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
const int MAX = 510000;

int main() {
  string s;
  cin >> s;
  s.insert(4, " ");
  cout << s << endl;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var S string
	fmt.Scanf("%s\n", &S)

	result := len(S)*(len(S)-1)/2 + 1
	duplicates := make(map[string]int, len(S))
	for _, s := range S {
		duplicates[string(s)]++
	}
	for _, d := range duplicates {
		result = result - d*(d-1)/2
	}
	fmt.Println(result)
}


Measured memory_bytes: 8704
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

S = input()

mon = int(S[5:7])
if mon <= 4:
    print('Heisei')
else:
    print('TBD')

Measured memory_bytes: 9212
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int m=sc.nextInt();
		int l=sc.nextInt();
		long[][] m1=new long[n][m];
		long[][] m2=new long[m][l];
		long[][] ans=new long[n][l];
		for(int i=0; i<n; i++) {
			for(int j=0; j<m; j++) {
				m1[i][j]=sc.nextLong();
			}
		}
		for(int i=0; i<m; i++) {
			for(int j=0; j<l; j++) {
				m2[i][j]=sc.nextLong();
			}
		}
		for(int i=0; i<n; i++) {
			for(int j=0; j<l; j++) {
				long tmp=0;
				for(int k=0; k<m; k++) {
					tmp+=m1[i][k]*m2[k][j];
				}
				ans[i][j]=tmp;
			}
		}
		output(ans,n,l);
	}
	public static void output(long[][] a,int h,int w) {
		for(int i=0; i<h; i++) {
			for(int j=0; j<w-1; j++) {
				System.out.print(a[i][j]+" ");
			}
			if(w>0) {
				System.out.println(a[i][w-1]);;
			}
		}
	}
}


Measured memory_bytes: 53284
//om nama sivaya
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define pb push_back
#define ff first
#define ss second
#define INF 9223372036854777ll
#define pb push_back
using namespace std;
ll a[401],pr[401],dp[401][401];
ll pre(ll l,ll r){
    ll x=0,y=0;
    if(l!=0){
        x=pr[l-1];
    }
    y=pr[r];
    return y-x;
    
}
ll ans(ll i,ll j){
    if(i>j)return INF;
    if(i==j)return dp[i][j]=0;
    ll mi=INF;
    if(dp[i][j])return dp[i][j];
    for(ll k=i;k<j;k++){
        mi=min(mi,ans(i,k)+ans(k+1,j)+pre(i,j));
    }
    return dp[i][j]=mi;
}
void solve(){
    ll n;
    cin>>n;
    //int a[n];
    for(ll i=0;i<n;i++)cin>>a[i];
    pr[0]=a[0];
    for(ll i=1;i<n;i++)
    pr[i]=pr[i-1]+a[i];
    cout<<ans(0,n-1);
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int tt=1;
    //cin>>tt;
    while(tt--){
        solve();
    }
}


Measured memory_bytes: 4868
#include "bits/stdc++.h"
using namespace std;
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2728
/*
?????°???????????????????????¨??????????????????????¬???§??????????????????5sec?????????
*/
typedef long long ll;
int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	string s; cin >> s;
	ll N = stoll(s);
	int digit = s.length();
	ll Ten = 1;
	for (int i = 0; i < digit;i++) Ten *= 10;
	vector<int> v(10);
	iota(v.begin(), v.end(), 0);
	ll ans = -1;
	ll pre = -1;
	do {
		ll now = 0;
		for (int i = 0; i < digit;i++) now = now * 10 + v[i];
		ll diff = min(abs(N - now), Ten - abs(N - now));
		if (diff > pre) {
			pre = diff;
			ans = now;
		}
	} while (next_permutation(v.begin(), v.end()));
	cout << setfill('0') << setw(digit) << right << ans << endl;
}

Measured memory_bytes: 3188
class Node():
    def __init__(self, id):
        self.id = id
        self.adj = []
        self.indeg = 0
        self.passed = False

    def is_start(self):
        return self.indeg == 0

    def __repr__(self):
        return "Node({},{},{},{})".format(
            self.id, self.passed,
            [v.id for v in self.adj],
            [v.id for v in self.radj])


def read_edges(ne, V):
    for _ in range(ne):
        s, t = [int(x) for x in input().split()]
        V[s].adj.append(V[t])
        V[t].indeg += 1


def sort(V):
    W = []

    def visit(v):
        S = []
        S.append(v)

        while S:
            v = S.pop()
            v.passed = True
            W.append(v)
            for a in v.adj:
                a.indeg -= 1
                if a.is_start():
                    S.append(a)

    for v in V:
        if v.is_start() and not v.passed:
            visit(v)

    return W


def main():
    nv, ne = [int(x) for x in input().split()]
    V = [Node(id) for id in range(nv)]
    read_edges(ne, V)
    W = sort(V)
    [print(v.id) for v in W]


if __name__ == '__main__':
    main()



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

using namespace std;

int main() {
	int n[5];
	for (int i = 0; i < 5; i++)
		cin >> n[i];
	sort(n, n + 5, greater<int>());
	cout << n[0];
	for (int i = 1; i < 5; i++)
		cout << " " << n[i];
	cout << endl;
	return 0;
}

Measured memory_bytes: 1176
N = int(input())
A = list(map(int,input().split()))
B = list(map(lambda n:abs(n), A))
C = list(filter(lambda n:n < 0, A))
if 0 in A:
    print(sum(B))
elif len(C) % 2 == 0:
    print(sum(B))
elif len(C) % 2 == 1:
    print(sum(B)-2*min(B))


Measured memory_bytes: 14284
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<string>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;
const ll mod = 1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,s,e) for(int i=s;i<e;i++)
#define reple(i,s,e) for(int i=s;i<=e;i++)
#define revrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()


ll combination(int n, int r)
{
	if (n - r < r) r = n - r;
	if (r == 0) return 1;
	if (r == 1) return n;

	vector<int> numerator(r, 0);
	vector<int> denominator(r, 0);

	rep(k, r)
	{
		numerator[k] = n - r + k + 1;
		denominator[k] = k + 1;
	}

	reple(p, 2, r)
	{
		int pivot = denominator[p - 1];
		if (pivot > 1)
		{
			int offset = (n - r) % p;
			for (int k = p - 1; k < r; k += p)
			{
				numerator[k - offset] /= pivot;
				denominator[k] /= pivot;
			}
		}
	}

	ll result = 1;
	rep(k, r)
	{
		if (numerator[k] > 1)
		{
			result *= numerator[k];
			result %= mod;
		}
	}

	return result;
}


ll calc(int n, int m, int k)
{
	//任意に2点とるとき、その2点間の距離は、その2点を含むk個をmn個から選ぶすべてのパターンに含まれる。
	ll c = combination(n * m - 2, k - 2);

	ll sum = 0;
	reple(d, 1, n - 1)
	{
		//x座標の差がdであるすべての場合について足し合わせ
		sum += c * (((ll)n - d) % mod) * (m % mod) * (m % mod) * (d % mod);
		sum %= mod;
	}

	return sum;
}


int main()
{	
	//解答方針
	//任意の2マスを固定して距離を計算。その後、全パターンの和の中にその2マスの距離が何回出現するか計算する。
	//※パターンを決めて距離を計算し、全パターンについて和をとるのが問題文を素直に読んだ時の解答方法だが、
	//その方法では全パターンを網羅できない（mn_C_kものパターンを網羅する必要があり、時間内に解答できない）
	//イメージとしては、和の順番を入れ替えることで、mn_C_k回のループをなくして、mn_C_kと距離の積に置きなおした感じ

	int n, m, k;
	cin >> n >> m >> k;

	//距離の計算は、xとyが完全に独立しているため、xの和とyの和を別々に計算できる。
	ll distX = calc(n, m, k);
	ll distY = calc(m, n, k);

	cout << (distX + distY) % mod << endl;

	return 0;
}

Measured memory_bytes: 768
let rotate h w a =
  Array.init w (fun i -> Array.init h (fun j -> a.(h-1-j).(i)))
let () =
  Scanf.scanf "%d %d" @@ fun h w ->
  let s = Array.init h (fun _ ->
    let s = Scanf.scanf " %s" (fun x -> x) in
    Array.init w (fun i -> s.[i]))
  in
  let rec calc n s t h w =
    if n <= 0 then t
    else begin
      for i = 0 to h-1 do
        let u = Array.make w 0 in
        if s.(i).(0) = '.' then u.(0) <- 1;
        for j = 1 to w-1 do
          if s.(i).(j) = '.' then
            u.(j) <- u.(j-1) + 1
        done;
        u |> Array.iteri (fun j v -> t.(i).(j) <- t.(i).(j) + v);
      done;
      calc (n-1) (rotate h w s) (rotate h w t) w h
    end
  in

  calc 4 s (Array.make_matrix h w (-3)) h w
  |> Array.fold_left (Array.fold_left max) 0
  |> Printf.printf "%d\n"



Measured memory_bytes: 182252
#include <bits/stdc++.h>
using namespace std;
using ll = long long; // ll は long long　と同じとする。(int64_t)
int main(){
    int A , B , C , D;
    cin >> A >> B >> C >> D;
    if(min(B , D) - max(A , C) >= 0){
        cout << min(B , D) - max(A , C) << endl;
    }
    else{
        cout << 0 << endl;
    }
}

Measured memory_bytes: 256
s = list(input())
index = 0
while index < len(s):
    if "".join(s[index:index+7]) == "dreamer":
        index += 7
    elif "".join(s[index:index+6]) == "eraser":
        index += 6
    elif "".join(s[index:index+5]) == "erase" or "".join(s[index:index+5]) == "dream":
        index += 5
    elif "".join(s[index:index+4]) == "aser":
        index += 4
    elif "".join(s[index:index+3]) == "ase":
        index += 3
    else:
        print("NO")
        exit()
print("YES")


Measured memory_bytes: 9884
//According to all known laws of aviation, there is no way that a bee should be able to fly.
//Its wings are too small to get its fat little body off the ground. The bee, of course, flies anyway.
//Because bees don't care what humans think is impossible.
#include <bits/stdc++.h>
#define FAST_IO ios_base::sync_with_stdio(false), cin.tie(nullptr)
#define mod 1000000007
using namespace std ;
using bigint = long long int ;
using vi = vector<int> ;
using vll = vector<long long int> ;
int cnt[1000001] ;
bool flag[1000001] ;
int main(){
    FAST_IO ;
    int X , N ; cin >> X >> N ;
    set<int> s ;
    for( int i = 0 ; i < N ; i++ ){
        int x ; cin >> x ;
        s.insert(x) ;
    }
    int diff = INT_MAX ;
    for( int i = -102 ; i <= 102 ; i++ ){
        if( s.find(i) == s.end() ){
            if( abs( X - i ) < diff ){
                diff = abs( X - i ) ;
            }
        }
    }
    
    for( int i = -102 ; i <= 102 ; i++ ){
        if( abs( X - i ) == diff && s.find(i) == s.end()){
            cout << i << endl ;
            return 0 ;
        }
    }
    return 0 ;
    
}


Measured memory_bytes: 3620
import re
import math

while True:
    n = int(input())
    if n==0:
        break
    x = math.factorial(n)
    if x%10==0:
        y = str(x)
        z = re.search('[0]+$',y)
        a = z.start()
        b = z.end()
        print(b-a)
    else:
        print(0)
   


Measured memory_bytes: 6760
import java.util.*;

public class Main {
  public static void main(String[] args ) throws Exception {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    String str =sc.next();
    char chr[]=new char[str.length()];
    int count=1;
    for(int i=0;i<str.length();i++){
      chr[i]=str.charAt(i);
    }
    for(int j=1;j<chr.length;j++){
      if(chr[j-1]!=chr[j]){
      	count++;
      }	
    }
    System.out.print(count);
  }
}


Measured memory_bytes: 25904
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=105,inf=1e9;
ll b[N],n;
int main() {
    cin>>n;
    for(ll i=1;i<=n-1;i++)cin>>b[i];
    b[0]=b[n]=inf;
    ll ans = 0;
    for(ll i=1;i<=n;i++)ans+=min(b[i],b[i-1]);
    cout<<ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rep2(i,n) for(int i = 1; i <= (n); ++i)
#define rrep2(i,n) for(int i = (n); i > 0; --i)
#define srep(i,s,n) for(int i = s; i < (n); ++i)
#define rsrep(i,s,n) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { int n = (__VA_ARGS__).size(); rep(i, n) printf("%d%s", (__VA_ARGS__)[i], i != n-1 ? " " : "\n"); }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;


bool check(map<char, int> mp) {
    int sz = mp.size();
    if (sz == 4) return true;
    if (sz == 1 || sz == 3) return false;
    if (mp['N'] && mp['S']) return true;
    if (mp['W'] && mp['E']) return true;
    return false;
} 

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

    map<char, int> mp;
    rep(i, s.length()) {
        mp[s[i]]++;
    }

    yns(check(mp));
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

const int sz=1e5;

signed main()
{
    int N; cin>>N;
    vint cnt(sz);
    REP(i,N){
        int a; cin>>a;
        cnt[a]++;
    }
    int ans=0;
    for(int X=1;X<=sz-2;X++){
        ans=max(ans,cnt[X-1]+cnt[X]+cnt[X+1]);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1024
a = int(input())
b = int(input())
c = int(input())
x = int(input())
p = 0

for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if 500*i + 100*j + 50*k == x:
                p += 1

print(p)


Measured memory_bytes: 3060
// https://atcoder.jp/contests/abc173/tasks/abc173_c
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define DIV(a, b) ((a - 1) / b + 1)

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int H, W, K, ans = 0;
    cin >> H >> W >> K;
    vector<string> v(H);
    REP(i, H) { cin >> v[i]; }
    REP(bit, 1LL << (H + W)) {
        auto t = v;
        REP(j, (H + W)) {
            bitset<64> bs(bit);
            if (bs[j]) {
                // 高さに対して変更
                if (j < H) {
                    REP(a, W) { t[j][a] = 'R'; }
                } else {
                    // 幅に対して変更
                    REP(a, H) { t[a][j - H] = 'R'; }
                }
            }
        }
        // '#'をカウント
        int cnt = 0;
        REP(a, H) REP(b, W) {
            if (t[a][b] == '#') {
                cnt++;
            }
        }
        if (cnt == K) {
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3656
#include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 #include<queue>
 #include<deque>
 #include<functional>
 #include<utility>
 
 using namespace std;

 int main()
 {
   int num;
   while(cin>>num&&num)
   { 
     int sum2,sum5;
     sum2=sum5=0;
     //cin>>num;
     for(int i=2;i<=num;i++)
     {
       int kk=i;
       while((kk%2==0))
       {
         sum2++;
         kk/=2;                 
       }       
       while((kk%5==0))
       {
         sum5++;
         kk/=5;                
       } 
     }         
     int qin=min(sum2,sum5);
     cout<<qin<<endl;       
   }
   //while(1);
   return 0;
 }

Measured memory_bytes: 3016
#include <iostream>

int main()
{
  int a, b;

  std::cin >> a >> b;

  if ( a == 1) { a = 14;}
  if ( b == 1) { b = 14;}

  if (a > b) {
    std::cout << "Alice" << std::endl;
  } else if (a < b) {
    std::cout << "Bob" << std::endl;
  } else {
    std::cout << "Draw" << std::endl;
  }

  return 0;
}


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

#define ll long long

using namespace std;

void swap(ll &a,ll &b){
    ll temp;
    temp = a;
    a = b;
    b = temp;
}

int main(){
    ll n,x;
    cin >> n >> x;
    ll max = 2*n - 1;
    ll min = 1;
    if(x == max || x == min){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
        ll ans[max+10];
        for(ll i = 1;i <= max;i++){
            ans[i] = i;
        }
        swap(ans[(max/2)+1],ans[x]);
        swap(ans[(max/2)],ans[min]);
        swap(ans[(max/2)+2],ans[max]);
        for(ll i = 1;i <= max;i++){
            cout << ans[i] << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3072
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
  int N,A,B; cin>>N>>A>>B;
  vi dp(N);
  int X; cin>>X;
  rep(i,1,N){
    int x; cin>>x;
    dp[i]=dp[i-1]+min(A*(x-X),B);
    X=x;
  }
  cout<<dp[N-1]<<endl;
  }



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

int main(){
  string s;
  cin >> s;
  int val = 0;
  rep(i,s.length()) val += s[i] - '0';
  cout << (val % 9 == 0 ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 3748