akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(u,a,b) for(int u=(a);u<(b);u++)
#define rrep(u,a,b) for(int u=(b)-1;u>=(a);u--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

struct HopcroftKarp {
	int n;
	vector<vector<int>> g;
	vector<int> match, dist;
	vector<bool> used, alive;
	HopcroftKarp(int n) : n(n), g(n), match(n), dist(n), used(n), alive(n, true) {}
	void addEdge(int u, int v) {
		g[u].emplace_back(v);
		g[v].emplace_back(u);
	}
	int maximumMatching() {
		int cnt = 0;
		fill(match.begin(), match.end(), -1);
		while (true) {
			buildAlternatingLevelGraph();
			fill(used.begin(), used.end(), false);
			int flow = 0;
			for (int u = 0; u < n; u++)
				if (match[u] == -1 && augment(u))
					flow++;
			if (flow == 0)break;
			cnt += flow;
		}
		return cnt;
	}
	void buildAlternatingLevelGraph() {
		fill(dist.begin(), dist.end(), -1);
		queue<int> q;
		for (int u = 0; u < n; u++)
			if (match[u] == -1) {
				q.emplace(u);
				dist[u] = 0;
			}
		while (q.size()) {
			int u = q.front(); q.pop();
			for (int v : g[u]) {
				int w = match[v];
				if (w != -1 && dist[w] == -1) {
					dist[w] = dist[u] + 1;
					q.emplace(w);
				}
			}
		}
	};
	bool augment(int u) {
		used[u] = true;
		for (int v : g[u]) {
			if (!alive[v])continue;
			int w = match[v];
			if (w == -1 || (!used[w] && dist[w] == dist[u] + 1 && augment(w))) {
				match[u] = v;
				match[v] = u;
				used[v] = true;
				return true;
			}
		}
		return false;
	}
};

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	for (int N, M, L; cin >> N >> M >> L&&N;) {
		vector<vector<int>> g(N, vector<int>(N, INF));
		rep(i, 0, M) {
			int u, v, d; cin >> u >> v >> d;
			g[u][v] = g[v][u] = d;
		}
		rep(i, 0, N)
			g[i][i] = 0;
		rep(k, 0, N)rep(i, 0, N)rep(j, 0, N) {
			if (g[i][k] != INF&&g[k][j] != INF)
				g[i][j] = min(g[i][j], g[i][k] + g[k][j]);
		}

		vector<int> p(L), t(L); rep(i, 0, L) {
			cin >> p[i] >> t[i];
		}
		HopcroftKarp hk(L + L);
		int source = L + L, sink = source + 1;
		rep(i, 0, L) {
			rep(j, 0, L) {
				if (i == j)continue;
				if (g[p[i]][p[j]] <= t[j] - t[i]) {
					hk.addEdge(i, L + j);
				}
			}
		}
		auto ans = L - hk.maximumMatching();
		cout << ans << endl;
	}
	return 0;
}

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

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

map<pair<pair<int, int>, int>, bool> visited;
map<pair<int, int>, bool> mp;

int dfs(int sx, int sy, int dir, int now, vector<string> &g)
{
    //cerr << sy << " " << sx << " " << now << endl;
    if (sx == gx && sy == gy)
    {
        return now;
    }
    if (visited[{{sx,
                  sy},
                 dir}] == true)
    {
        return -1;
    }
    visited[{{sx,
              sy},
             dir}] = true;

    int nx = sx + dx[dir];
    int ny = sy + dy[dir];
    mp[{sx, sy}] = true;
    if (g[ny][nx] != '#' && g[ny + dy[(dir + 1) % 4]][nx + dx[(dir + 1) % 4]] == '#')
    {

        int cost = 1;
        if (mp[{nx, ny}] == true)
        {
            cost = 0;
        }
        return dfs(nx, ny, dir, now + cost, g);
    }
    if (g[ny][nx] != '#' && g[ny + dy[(dir + 1) % 4]][nx + dx[(dir + 1) % 4]] != '#')
    {
        int cost = 2;

        if (mp[{sx + dx[dir], sy + dy[dir]}] == true)
        {
            cost--;
        }
        if (g[sy + dy[dir]][sx + dx[dir]] == 'G')
        {
            return now + 1;
        }
        if (mp[{nx + dx[(dir + 1) % 4], ny + dy[(dir + 1) % 4]}] == true)
        {
            cost--;
        }
        visited[{{sx + dx[dir], sy + dy[dir]}, dir}] = true;
        mp[{sx + dx[dir], sy + dy[dir]}] = true;

        //mp[{sx + dx[dir], sy + dy[dir]}] = true;

        return dfs(nx + dx[(dir + 1) % 4], ny + dy[(dir + 1) % 4], (dir + 1) % 4, now + cost, g);
    }

    if (g[ny][nx] == '#' && g[sy + dy[(dir + 1) % 4]][sx + dx[(dir + 1) % 4]] == '#')
    {
        return dfs(sx, sy, (dir + 3) % 4, now, g);
    }

    return -1;
}
int main()
{

    int n, m;
    cin >> n >> m;
    vector<string> g(n + 2, "");
    // ################################
    string tmp = "";
    rep(i, m + 2)
    {
        tmp += "#";
    }
    g[0] = tmp;
    rep(i, n)
    {
        string t;
        cin >> t;
        t = "#" + t + "#";
        g[i + 1] = t;
    }
    g[n + 1] = tmp;
    int sx, sy, dir;
    rep(i, n + 2) rep(j, m + 2)
    {
        if (g[i][j] == '^')
        {
            sx = j;
            sy = i;
            dir = 0;
        }
        if (g[i][j] == '>')
        {
            sx = j;
            sy = i;
            dir = 1;
        }
        if (g[i][j] == 'v')
        {
            sx = j;
            sy = i;
            dir = 2;
        }
        if (g[i][j] == '<')
        {
            sx = j;
            sy = i;
            dir = 3;
        }
        if (g[i][j] == 'G')
        {
            gx = j;
            gy = i;
        }
    }

    cout << dfs(sx, sy, dir, 1, g) << endl;

    return 0;
}


Measured memory_bytes: 3880
#include <stdio.h>
int main()
{
	int k,a,b;
	int flag = 0;
	
	scanf("%d",&k);
	scanf("%d %d",&a,&b);
	
	for ( int i = a; i <= b; i++)
	{
		if ( i % k == 0)
		{
			flag = 1;
			break;
		}
	}
	
	if (flag == 1)
	{
		printf("OK\n");
	} else {
		printf("NG\n");
	}
	
	return 0;
}

Measured memory_bytes: 1660
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using static System.Console;
using static System.Math;


namespace AtCodeeeer
{
    class AtCOOOOOOOOOOOder
    {
        static void Main(string[] args)
        {
            int N = int.Parse(ReadLine());
            int[] s = ReadLine().Split(' ').Select(int.Parse).ToArray();
            int ans = 1;
            int tmp = s[0];
            for (int i = 1; i < s.Length; i++)
            {
                if (tmp<=s[i])
                {
                    ans++;
                    tmp = s[i];
                }
            }
            WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13396
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

pub fn read_n<T: FromStr>(n: usize) -> Vec<T> {
  read_n_logic::<T>(n, vec![])
}

pub fn read_n_logic<T: FromStr>(n: usize, mut a: Vec<T>) -> Vec<T> {
  match n {
    0 => a,
    _ => {
      a.push(read::<T>());
      read_n_logic(n - 1, a)
    }
  }
}

use std::cmp::{max, min};
use std::collections::HashMap;

fn main() {
  let n: usize = read();
  let q: usize = read();
  let mut map: HashMap<i64, Vec<i64>> = HashMap::new();

  for _ in 0..n - 1 {
    let a = read::<i64>();
    let b = read::<i64>();
    if map.contains_key(&a) {
      let current = map.get_mut(&a).unwrap();
      current.push(b)
    } else {
      map.insert(a, vec![b]);
    }
  }

  let mut points: Vec<i64> = vec![0; n];
  for _ in 0..q {
    let a: usize = read();
    let b: i64 = read();
    points[a - 1] += b;
  }

  let mut ans: Vec<i64> = vec![0; n];
  let node = 1;
  let mut current_p = 0;
  dfs(node, &map, &points, &mut ans, &mut current_p);
  // println!("{:?}", ans);

  for i in ans {
    print!("{} ", i);
  }

}

fn dfs(
  node: i64,
  map: &HashMap<i64, Vec<i64>>,
  points: &Vec<i64>,
  ans: &mut Vec<i64>,
  current_p: &mut i64,
) {
  // println!("node: {}", node);
  *current_p += points[(node - 1) as usize];
  ans[(node - 1) as usize] = *current_p;

  if map.contains_key(&node) {
    for (i, v) in map.get(&node).unwrap().iter().enumerate() {
      let mut current_p = current_p.clone();
      dfs(*v, &map, &points, ans, &mut current_p)
    }
  }

}


Measured memory_bytes: 36408
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
nmax = 2*10**5+1
mod = 10**9+7
fac = [1]*nmax
finv = [1]*nmax
inv = [1]*nmax
def ncr_pre():
    for i in range(2,nmax):
        fac[i] = fac[i-1]*i % mod
        inv[i] = mod - inv[mod%i] * (mod//i) %mod
        finv[i] = finv[i-1] * inv[i] %mod

def ncr(n,r):
    if n<r:
        return 0
    if n<0 or r<0:
        return 0
    return fac[n]* (finv[r] * finv[n-r] %mod) %mod
n = ni()
C = lma();C.sort()
ans = 0
for i in range(1,n+1):
    c = C[i-1]
    ans += c*pow(4,i-1,mod)*pow(2,n-i,mod)*pow(2,n-i,mod)*(n-i+2)
    ans%=mod
print(ans)


Measured memory_bytes: 110568
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
#define int ll
using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define PB push_back

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'[';
  REP(i, a.size()) {out<<a[i];if(i!=a.size()-1)out<<',';}
  out<<']';
  return out;
}

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

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

  int q;
  cin >> q;
  VI a(q), b(q);
  REP(i, q) {
    cin >> a[i] >> b[i];
    if(a[i] > b[i]) swap(a[i], b[i]);
  }

  REP(i, q) {
    if(a[i] == b[i]) {
      cout << 2*a[i]-2 << endl;
    } else if(a[i] + 1 == b[i]) {
      cout << 2*a[i]-2 << endl;
    } else {
      int root = sqrt(a[i]*b[i]);
      if(root*root == a[i]*b[i]) root--;
      if(root*(root+1) >= a[i]*b[i]) {
        cout << 2*root-2 << endl;
      } else {
        cout << 2*root-1 << endl;
      }
    }
  }

  return 0;
}


Measured memory_bytes: 256
def main():
    while True:
        n, x = map(int, input().split())
        if (n == 0) and (x == 0):
            break
        cnt = 0
        for i in range(1, n+1):
            for j in range(i+1, n+1):
                for k in range(j+1, n+1):
                    if i+j+k == x:
                        cnt += 1
        print(cnt)
main()


Measured memory_bytes: 5596
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int X = sc.nextInt();
		int cnt = 0;
		
		for(int a = 0; a <= A; a++) {
			for(int b = 0; b <= B; b++) {
				for(int c = 0; c <= C; c++) {
					int x = (a * 500) + (b * 100) + (c * 50);
					if(X == x) cnt++;
				}
			}
		}
		
		System.out.println(cnt);
		
		sc.close();

	}

}

Measured memory_bytes: 21844
//C++14 (Clang 3.8.0)

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <string>
#define rp(i,a,b) for(int (i)=(int)(a);i<(int)(b);++i)

typedef long long ll;


using namespace std;


int main(){
    int x,y;
    while(1) {cin>>x>>y;
        if(x==0 and y==0) break;
        cout<<min(x,y)<<" "<<max(x,y)<<endl;
    }
    return 0;
};

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template < typename T >
void vprint(T &v){
	REP(i, v.size()){
		cout << v[i] << " ";
	}
	cout << endl;
}

int main(){
	ll N;
	cin >> N;
	vector<double> p(N);
	REP(i, N) cin >> p[i];

	double dp[8000][2];
	REP(i, 8000) dp[i][0] = 0;
	dp[4000][0] = 1.0;
	REP(i, N){
		REP(j, 8000) dp[j][(i+1)%2] = 0;
		for(int j=1;j<7000;j++){
			dp[j+1][(i+1)%2] += dp[j][i%2]*p[i];
			dp[j-1][(i+1)%2] += dp[j][i%2]*(1.0-p[i]);
		}
	}
	double res = 0;
	for(int i=4001;i<8000;i++) res += dp[i][N%2];
	printf("%.10f\n", res);
    return 0;
}

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


#include <bits/stdc++.h>
using namespace std;

int gcd(int a,int b){
    int64_t x = max(a,b);
    int64_t y = min(a,b);
    int64_t r = x%y;

    while(r!=0){
        x = y;
        y = r;
        r = x%r;
    }
    return y;
}

int main(){
    int64_t A,B;
    cin >>A>>B;
    int64_t a = A/gcd(A,B);
    int64_t b = B/gcd(A,B);
    cout <<a*b*gcd(A,B)<<endl;
}

Measured memory_bytes: 256
"
ABC 103 D - Islands War
https://atcoder.jp/contests/abc103/tasks/abc103_d
"

# 要求の構造体
Req = Struct.new(:s, :t)

# 入力
N, M = gets.split.map(&:to_i)
a = []
b = []
r = [] #構造体の配列
M.times do |i|
  a[i], b[i] = gets.split.map(&:to_i)
  r << Req.new(a[i], b[i])
end

# 配列rをtの値で昇順ソート
r = r.sort {
  |r1, r2| r1.t <=> r2.t
}

# greedy
n = r[0].t # tのうち最も小さいもの
ans = 1
r.each do |x|
  # s が t より大きいなら，そのsに関してはnの前の橋を切っても分離されない
  if n <= x.s
    n = x.t
    ans += 1
  end
end
puts ans

Measured memory_bytes: 12812
#include <stdio.h>

int main(int argc, const char * argv[]) {
    // insert code here...
    int a, b, c, d, ans;
    scanf("%d %d %d %d", &a, &b, &c, &d);
    ans = a*b - b*c -(d*(a-c));
    printf("%d\n", ans);
    return 0;
}



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

#define INF 10000000

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

using namespace std;

int main(void){
	
	static int dp1[1000001],dp2[1000001],n,four[501];
	
	fill(four,four+501,0);
	fill(dp1,dp1+1000001,INF);
	fill(dp2,dp2+1000001,INF);
	
	rep(i,501)four[i]=i*(i+1)*(i+2)/6;
	
	dp1[0]=dp2[0]=0;
	
	for(int i=1;i<1000001;i++){
		for(int j=1;four[j]<=i;j++){
			dp1[i]=min(dp1[i],dp1[i-four[j]]+1);
			if(four[j]%2)dp2[i]=min(dp2[i],dp2[i-four[j]]+1);
		}
	}
	
	while(cin >> n,n)cout << dp1[n] << " " << dp2[n] << endl;
	
	
	return 0;
}

Measured memory_bytes: 8972
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (long long i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PL = pair<long long, long long>;
using Pxy = pair<double, double>;
using T = tuple<int, int, bool>;
const int INF = 1001001007;
const int mod = 1000000007;
const int MOD = 998244353;
const ll inf = 1e18;
template <typename AT>
void printvec(vector<AT> &ar){
    rep(i,ar.size()-1) cout << ar[i] << " ";
    cout << ar[ar.size()-1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar){
    rep(i,ar.size()){
        rep(j,ar[0].size()-1) cout << ar[i][j] << " ";
        cout << ar[i][ar[0].size()-1] << endl;
    }
}
template <typename S>
bool range(S a, S b, S x){
    return (a <= x && x < b);
}

void yn(int o){
    if (o == 0) cout << "No" << endl;
    else cout << "Yes" << endl;
}

struct point {
    vector<int> to;
};

int main() {
    string a, b, c; cin >> a >> b >> c;
    cout << a[0] << b[0] << c[0] << endl;
}

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

using namespace std;

int main()
{
  int n;
  scanf("%d", &n);
  
  int ans = 0;
  int tmp = 0;
  for (int i = 1; i <= n; i++) {
    int a;
    scanf("%d", &a);
    
    if (a == i) {
      tmp++;
    }
    else {
      ans += (tmp + 1) / 2;
      tmp = 0;
    }
  }
  printf("%d\n", ans + (tmp + 1) / 2);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef long long int64;

int main() {
	int N, K;
	cin >> N >> K;
	vector<int> A;
	A.reserve(N);
	int tmp;
	rep (i, N) {
		cin >> tmp;
		A.push_back(tmp);
	}
	sort(A.begin(), A.end());
	int ans = 0;
	rep (i, K) {
		ans += A[i];
	}
	
	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) x.begin(),x.end()

int const N = 200001;

int main(){
    int a, b;
    scanf("%d%d", &a, &b);
    int x = a * 100 / 8;
    int an = -1;
    for(x; x<=100000; ++x){
      int y = x*10/100;
      int z = x*8/100;
      if(y == b && z == a){return printf("%d\n", x), 0;}
    }    
    puts("-1");
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/**
*   @Author: MeGaaaaaaaaaa
*   @InitTime: Mon Sep 09 17:35:29 2019
*   @Idea: 
*
*
*
*
* Happy Solving :)
**/
const int N=2e5+7;
int pos[N];
int main(){
#ifndef ONLINE_JUDGE
   // freopen("in","r",stdin)
//    freopen("out","w",stdout)
#endif
     int n;
     cin>>n;
     vector<pair<int,int> >v;
     for(int i=1;i<=n;i++){
     	int a;
     	cin>>a;
     	v.push_back(make_pair(a,i));
     }
     sort(v.rbegin(),v.rend());
     for(int i=0;i<n;i++){
     	pos[v[i].second]=i+1;
     }
     for(int i=1;i<=n;i++){
     	if(pos[i]<=(n/2)){
     	    cout<<v[(int)n/2].first<<endl;
     	}else{
     	   cout<<v[(int)n/2 -1].first<<endl;
     	}
     }





}


Measured memory_bytes: 4976
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S; cin >> S;
    int n = S.length();
    bool ok = true;
    rep(i, n/2) {
        if (S[i] != S[n - i - 1]) ok = false;
    }
    rep(i, n/4) {
        if (S[i] != S[n/2 - i - 1]) ok = false;
    }
    int i = (n + 3)/2;
    int j = n;
    i--; j--;
    while(i < j) {
        if (S[i] != S[j]) ok = false;
        i++;
        j--;
    }
    if(ok) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <utility>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <tuple>
#include <set>
#include <map>
#include <functional>
#include <cmath>
#include <cstring>
using namespace std;
#define sci(n) scanf("%lld", &(n))
#define scd(n) scanf("%Ld", &(n))
typedef long long LL;
typedef long double LD;
typedef pair<LL, LL> pll;
int main(void)
{
	int y, m, d;
	scanf("%d/%d/%d", &y, &m, &d);
	string tbd = "TBD";
	string he = "Heisei";
	if (y > 2019) {
		cout << tbd;
		
	}
	else if(m>4) {
		cout << tbd;
	}
	else {
		cout << he;
	}
	return 0;
}

Measured memory_bytes: 256
N,A,B = gets.split.map(&:to_i)
a = 0
for i in 0..N
    if A <= i.to_s.split("").map{|s| s.to_i}.inject(:+) && i.to_s.split("").map{|s| s.to_i}.inject(:+) <= B
        a += i
    end
end

puts a

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

using namespace std;
int main(){
	long long cnt = 0;
	long long n; cin >> n;
	set<map<char, long long>> st;
	map<map<char, long long>, long long > mpp;
	for(long long i = 0; i < n;i++){
		string s; cin >> s;
		map<char, long long> mp;
		for(long long j = 0; j < s.size(); j++){
			mp[s[j]]++;
		}
		if(st.count(mp) == 1){
			mpp[mp]++;
			cnt += mpp[mp];
		}
		else st.insert(mp);
	}
	cout << cnt << endl;
}

Measured memory_bytes: 62336
def gu(x):
    counter = 0
    while x % 2 == 0 and x != 0:
        x /= 2
        counter += 1
    return counter


N = int(input())
A = list(map(int, input().split()))

ans = 0
for i in range(N):
    if A[i] % 2 == 0:
        ans += gu(A[i])

print(ans)

Measured memory_bytes: 4152
/*
Author : N_o_o_B
Created : April 22 2020 15:57:48 
*/
#include <bits/stdc++.h>
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
*/
#define TRACE
#ifdef TRACE
#define trace(...) { cerr<<"[ "; __trace__(#__VA_ARGS__, __VA_ARGS__);}
#undef endl
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const pair<Arg1,Arg2> &x) {
    return out<<"("<<x.first<<","<<x.second<<")";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const vector<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const set<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const map<Arg1,Arg2> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
void __trace__(const string name, Arg1&& arg1){
    cerr << name << " : " << arg1 << " ] " << endl;
}
 
template <typename Arg1, typename... Args>
void __trace__(const string names, Arg1&& arg1, Args&&... args){
    const string name = names.substr(0,names.find(','));
    cerr<<name<<" : "<<arg1<<" | ";
    __trace__(names.substr(1+(int)name.size()), args...);
}
#else
    #define trace(args...)
#endif
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vll;
typedef vector<vl> vvl;
//typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> oset;
#define fori(i,n) for(int i=0;i<n;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repd(i,a,b) for(int i=a;i>=b;i--)
#define ford(i,n)  for(int i=n-1;i>=0;i--)
#define trav(x,a) for(auto& x:a)
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define sz(a) (int)a.size()
#define fi first
#define se second
clock_t time_p=clock();
void time_taken()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
//const ll mod=998244353;
const ll mod=1e9+7;
const ll INF=1e18;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    cout.precision(12);cout << fixed;

    int n;
    cin >> n;
    const int maxn = 1e5+5;
    vi cnt(maxn);
    int ans = 0;
    fori(_,n){
        int x;
        cin >> x;
        cnt[x]++;
    }
    int cur = 0;
    rep(i,1,maxn-1){
        if(cur == n - cur){
            ans++;
        }
        cur += cnt[i];
    }

    cout << ans << endl;

    time_taken();
    return 0;
}

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

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

    if (a == b && b == c) {
        cout << 1 << endl;
    } else if (a == b && b != c || a == c && c != b || b == c && c != a) {
        cout << 2 << endl;
    } else {
        cout << 3 << endl;
    }


    return 0;
}

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

int main()
{
  int H,W;
  char a[110][110];
  int res=0;
  cin >> H>>W;

  rep(i,H) cin >> a[i];

  rep(j,W+2) cout << '#';
  cout << endl;
  rep(i,H){
    cout << '#';
    cout << a[i];
    cout << '#' << endl;
  }
  rep(j,W+2) cout << '#';
  cout << endl;
}


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


#define ll long long

using namespace std;


int main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

    int n;
    cin >> n;

    string s;
    cin >> s;

    int res = 1;
    for(int i = 1 ; i < s.size(); ++i)
    {
        if(s[i] != s[i-1]) res++;
    }

    cout << res << endl;

    return 0;
}


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

int main() {
  int N;
  cin >> N;
  int min;
  min = 10000;
  
  vector<int> vec(N);
  for(int i=0; i<N;i++){
    cin >> vec.at(i);
    if(vec.at(i) % 10 !=0 && vec.at(i)<min){
      min = vec.at(i);
    }
  }
  
  int count =0;
  for(int j=0;j<N;j++){
    count+= vec.at(j);
  }
  
  if(count % 10 ==0 && min != 10000){
    count -= min;
    cout << count <<endl;
  }
  
  else if (count % 10 == 0 && min == 10000){
    count = 0;
    cout <<count <<endl;
  }
  
  else {
    cout << count <<endl;
  }
      
      
      
  
  
    
}


Measured memory_bytes: 3628
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

int N, M;
typedef pair<int,int> pint;

vector<pint> A;


bool cmp(pint a, pint b) { return a.second < b.second; }

int main() {
    while (cin >> N >> M) {
        A.resize(M);
        for (int i = 0; i < M; ++i) cin >> A[i].first >> A[i].second;
        sort(A.begin(), A.end(), cmp);
        int res = 0;
        int cur = 0;
        for (int i = 0; i < M; ++i) {
            if (A[i].first >= cur) {
                cur = A[i].second;
                ++res;
            }
        }
        cout << res << endl;
    }
}




























Measured memory_bytes: 1024
def base10to(n, b):
    if (int(n/b)):
        return base10to(int(n/b), b) + str(n%b)
    return str(n%b)

def main():
    N,K=map(int,input().split())
    x=base10to(N,K)
    print(len(x))
if __name__=="__main__":
    main()

Measured memory_bytes: 3060
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


const int mod = 1000000007;
struct mint{
	ll x;
	mint(ll x = 0):x((x%mod+mod)%mod){}
	mint operator-() const{return mint(-x);}
	mint& operator+=(const mint a){
		if((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator-=(const mint a){
		if((x += mod-a.x) >= mod) x -= mod;
		return *this;
	}
	mint& operator*=(const mint a){
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const{
		mint res(*this);
		return res+=a;
	}
	mint operator-(const mint a) const{
		mint res(*this);
		return res-=a;
	}
	mint operator*(const mint a) const{
		mint res(*this);
		return res*=a;
	}
	mint pow(ll t) const{
		if(!t) return 1;
		mint a = pow(t>>1);
		a *= a;
		if(t&1) a *= *this;
		return a;
	}
	mint inv() const{
		return pow(mod-2);
	}
	mint& operator/=(const mint a){
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const{
		mint res(*this);
		return res/=a;
	}
};

//istream& operator>>(istream& is, const mint& a){return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a){return os << a.x;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	string s;
	cin >> s;
	map<char, int> cnt;
	mint ans = 1;
	rep(i,n) cnt[s[i]]++;
	for(auto p : cnt){
		ans *= p.second+1;
	}
	ans -= 1;
	cout << ans << endl;
	return 0;
}

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

void mf(){
	freopen("input.in","r",stdin);
	freopen("output.ou","w",stdout);
}
int n;
ll a[100007];
ll s[100007];
void solve(){
	cin>>n;
	for(int i = 0; i<n;i++) cin>>a[i];
	sort(a,a+n);
	s[0] = a[0];
	for(int i = 1; i <n;i++) s[i] = s[i-1] + a[i];
	int res = 0;
	for(int i = n-2; i >= 0; i--){
		if(a[i] != a[i +1] && s[i]*2 < a[i+1]){
			res = i + 1;break;
		}
	}
	cout<<n-res<<endl;
	
}

int main(){
	ios_base::sync_with_stdio(false);
	#ifdef tuanh
	mf();
	#endif
	solve();
	return 0;
}

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

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0) : x((x%mod+mod)%mod) {}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};

int main() {
  ll n;
  int a, b;
  cin >> n >> a >> b;
  mint res(2), temp(1);
  mint ans = res.pow(n);
  if (a > b) swap(a,b);
  for (int i = 1; i <= b; ++i) {
    temp *= (n-i+1);
    temp /= i;
    if (i == a || i == b) ans -= temp;
  }
  std::cout << ans.x-1 << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define clr(x) memset(x,0,sizeof x)
#define For(i,a,b) for (int i=(a);i<=(b);i++)
#define Fod(i,b,a) for (int i=(b);i>=(a);i--)
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define fi first
#define se second
#define outval(x) cerr<<#x" = "<<x<<endl
#define outtag(x) cerr<<"-----------------"#x"-----------------\n"
#define outarr(a,L,R) cerr<<#a"["<<L<<".."<<R<<"] = ";\
                    For(_x,L,R) cerr<<a[_x]<<" ";cerr<<endl;
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair <int,int> pii;
LL read(){
    LL x=0,f=0;
    char ch=getchar();
    while (!isdigit(ch))
        f=ch=='-',ch=getchar();
    while (isdigit(ch))
        x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
    return f?-x:x;
}
const int N=1005,M=200005;
int n,m;
vector <int> o[N];
int Map[N][N];
struct Edge{
	int x,y,res;
}e[M];
int cnt[N],vis[N],Tg=0;
void dfs(int x){
	cnt[x]++;
	vis[x]=Tg;
	for (auto i : o[x])
		if (vis[e[i].y]!=Tg&&cnt[e[i].y]<2)
			dfs(e[i].y);
}
int main(){
	n=read(),m=read();
	For(i,1,m){
		e[i].x=read(),e[i].y=read();
		o[e[i].x].pb(i);
		Map[e[i].x][e[i].y]=i;
	}
	For(i,1,n){
		clr(cnt);
		cnt[i]=2;
		for (auto j : o[i]){
			Tg=j;
			if (cnt[e[j].y]<2)
				dfs(e[j].y);
		}
		for (auto j : o[i])
			e[j].res^=cnt[e[j].y]==2;
		For(j,1,n)
			if (Map[j][i]){
				int k=Map[j][i];
				e[k].res^=cnt[j]>0;
			}
	}
	For(i,1,m)
		puts(!e[i].res?"same":"diff");
	return 0;
}

Measured memory_bytes: 9088
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i))
#define REP_R(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define REP3R(i, m, n) for (int i = (int)(n) - 1; (i) >= (int)(m); -- (i))
#define ALL(x) ::std::begin(x), ::std::end(x)
using namespace std;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;


int64_t solve(int64_t x) {
    return 1 - x;
}

// generated by online-judge-template-generator v4.6.0 (https://github.com/kmyk/online-judge-template-generator)
int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    constexpr char endl = '\n';
    int64_t x;
    cin >> x;
    auto ans = solve(x);
    cout << ans << endl;
    return 0;
}


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

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

  int ans;
  int d = c - a;
  if (d < 0) d = 0;

  if (d > b) puts("NA");
  else cout << d << endl;
}

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

#define pb         push_back

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

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

    int x;

    cin >> x;
    if(x == 1){
        puts("1");
        return 0;
    }

    ll ans = -1;
    for(int i=2; i<=1000; i++){
        for(int j=2;; j++){
            ll cand = pow(i, j);
            if(cand <= x){
                ans = max(ans, cand);
            }else{
                break;
            }
        }
    }

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


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

struct Edge{
    int to;
    int cost;
};
using Graph=vector<vector<Edge>>;
using P = pair<int,int>;

const int INF = 1e9;
int bfs01(int s,int t,const Graph& g){
    int n = g.size();
    vector<int> d(n,INF);
    vector<int> used(n);
    d[s]=0;
    deque<int> deq;
    deq.push_back(s);
    while(!deq.empty()){
        int v = deq.front(); deq.pop_front();
        if(used[v]) continue;
        used[v] = true;
        for(auto &e:g[v]){
            d[e.to] = min(d[e.to],d[v] + e.cost);
            if(e.cost==1) deq.push_back(e.to);
            else deq.push_front(e.to);    
        }
    }
    return d[t];
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,m;
    cin>>n>>m;
    
    Graph g(n+2*m);
    int next_v = n;
    map<P,int> dict;
    auto vertex=[&](int pos,int c){
        if(c==-1) return pos;
        if(!dict.count({pos,c})){
            g[next_v].push_back({pos,0});
            g[pos].push_back({next_v,1});
            dict[{pos,c}]=next_v++;
        }
        return dict[{pos,c}];
    };

    for(int i=0;i<m;i++){
        int p,q,c;
        cin>>p>>q>>c;
        p--,q--,c--;
        int pv = vertex(p,c);
        int qv = vertex(q,c);
        g[pv].push_back({qv,0});
        g[qv].push_back({pv,0});
    }
    
    int ans = bfs01(0,n-1,g);
    if(ans>=INF){
        cout<<-1<<endl;
    }
    else{
        cout<<ans<<endl;
    }

    return 0;
}


Measured memory_bytes: 59648
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

template <typename TYPE>
void print_vec(const vector<TYPE>& v){
	for(int i=0; i<v.size(); i++){
		cout << v[i] << " ";
	}
	cout << endl;
}

template <typename TYPE>
void print_vec2(const vector<vector<TYPE>>& v){
  cout << endl; cout << "       ";
  for(int i=0; i<v[0].size(); i++) cout << i << "   "; 
  cout << endl;
	for(int i=0; i<v.size(); i++){
		cout << "i=" << i << ":   ";
		for(int j=0; j<v[i].size(); j++){
			if(v[i][j] == 0) cout << "\x1B[0m" << v[i][j] << "   ";
      else cout << "\x1B[31m" << v[i][j] << "   ";//https://stackoverrun.com/ja/q/12618775
		}
		cout << "\x1B[0m" << endl;
	}
}


int main(){
  string s;
  cin >> s;
  reverse(s.begin(), s.end());
  int n = s.size();

  const int DIV = 13, MOD = 1e9+7;
  // dp[i][j]: 1の位から i-1の位までを考慮した時の値を13で割ったあまりがj
  vector<vector<ll>> dp(n+1, vector<ll>(DIV, 0));
  dp[0][0] = 1;
  ll pow10_i = 1;
  for(int i=0; i<n; i++){
      for(int j=0; j<DIV; j++){
          for(int k=0; k<10; k++){
              if(s[i] == '?'){
                int c = (j + k*pow10_i) % DIV;
                dp[i+1][c] = (dp[i+1][c] + dp[i][j])%MOD;
                // cout << " i: " << i << " pow10_i: " << pow10_i << " j: " << j << " k: " << k << " c: " << c << " dp[i][j]: " << dp[i][j] << " dp[i+1][c]: " << dp[i+1][c]  << endl; 
              }
              else{
                k = (s[i]-'0');
                int c = (j + (s[i]-'0')*pow10_i) % DIV;
                dp[i+1][c] = (dp[i+1][c] + dp[i][j])%MOD;
                // cout << " i: " << i << " pow10_i: " << pow10_i <<" j: " << j << " k: " << k << " c: " << c << " dp[i][j]: " << dp[i][j] << " dp[i+1][c]: " << dp[i+1][c]  << endl;
                break;
              }
          }

      }
      pow10_i = ((pow10_i * 10) % MOD) % DIV;//こっちが正解（%MODも入れて良い,意味ないけど)
      //pow10_i = ((pow10_i * 10) % DIV) % MOD;//こっちが正解（%MODも入れて良い,意味ないけど)
      //pow10_i = (pow10_i * 10) % MOD;//こっちだけだとダメ
  }

  // cout << " dp: " << endl; print_vec2(dp);
  cout << dp[n][5] << endl;

}


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


bool binarySearch(vector<int> const & A, int key){

    int left = 0;
    int right = A.size();
    int mid;

    while(left < right){
        mid = (left + right)/2;

        if( A[mid] == key ){
            return true;
        }else if( A[mid] > key ){
            right = mid;
        }else{
            left = mid + 1;
        }
    }
    return false;
}


// main
int main(){
    int n, q;
    cin >> n;
    vector<int> S(n, 0);

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

    cin >> q;
    vector<int> T(q, 0);
    for(int i = 0; i < q; ++i){
        cin >> T[i];
    }

    int count = 0;
    for(int i = 0; i< q; ++i){
        if( binarySearch(S, T[i]) ){
            count++;
        }
    }

    cout << count << "\n";
    return 0;
}


Measured memory_bytes: 3272
inp = list(input())

cost_start_with_zero = 0
cost_start_with_one = 0

for i in range(len(inp)):
    if i%2==0 and inp[i]!="0":
        cost_start_with_zero += 1
    if i%2==1 and inp[i]!="1":
        cost_start_with_zero += 1
    if i%2==0 and inp[i]!="1":
        cost_start_with_one += 1
    if i%2==1 and inp[i]!="0":
        cost_start_with_one += 1

print(min(cost_start_with_one,cost_start_with_zero))

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

const int INF = 1145141919;
const int N = 100000;

int n, m;
string s;

vector<int> cl0;
vector<int> rol;

int main() {
  cin >> n >> m >> s;
  rep(i, n+1) if (s[i] == '0') cl0.push_back(i);
  int x = n;
  while (x > 0) {
    int nx = *lower_bound(cl0.begin(), cl0.end(), x-m);
    if (nx >= x) {
      cout << -1 << endl;
      return 0;
    }
    rol.push_back(x - nx);
    x = nx;
  }
  reverse(rol.begin(), rol.end());
  rep(i, rol.size()) {
    printf("%d", rol[i]);
    if (i == rol.size()-1) printf("\n");
    else printf(" ");
  }
  return 0;
}

Measured memory_bytes: 4436
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
#define DBG(X) cout << #X << "=" << (X) << '\n';
#define SAY(X) cout << (X) << '\n';
#else
#define DBG(X)
#define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

std::string pad(int num)
{
    char buffer[4];
    std::snprintf(buffer, sizeof(buffer), "%03d", num);
    return buffer;
}

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

#ifdef _MSC_VER
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#endif

int solve()
{
    int K;

    std::cin >> K;

    vector<int> v = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

    return v[K - 1];
}

int main()
{
    std::cout << solve() << std::endl;
    //solve();

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define maxn 3010
#define mod 998244353
#define LL long long
LL a[maxn],f[maxn],ans;
int main(){
	int i,j,n,m;
	scanf("%d%d",&n,&m);
	for(i=1;i<=n;i++)scanf("%lld",&a[i]);
	for(i=1;i<=n;i++){
		for(j=m;j>=a[i];j--)f[j]=(f[j]+f[j-a[i]])%mod;
		f[a[i]]=(f[a[i]]+i)%mod;
		ans=(ans+f[m]*(n-i+1))%mod;
		f[m]=0;
	}
	printf("%lld\n",ans);
	return 0;
}

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

int main() 
{ 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n, count = 0;
    cin >> n;
    vector<ll> a(n+1);
    map<ll , ll> m;
    for(int i = 1; i <= n; i++) {
        cin >> a[i];
        m[i - a[i]]++;
    }
    for(int i = 1; i <= n; i++) {
        m[i-a[i]]--;
        count += m[a[i] + i];
    }
    cout << count << "\n";
    return 0; 
}

Measured memory_bytes: 27392
#include <bits/stdc++.h>
#define MAXN 50

using namespace std;

long long dp[2][2 * MAXN * MAXN + 1];
int v[MAXN + 1];

int main() {
    //fstream cin("A.in");
    //ofstream cout("A.out");
    int i, n, a, j;
    ios::sync_with_stdio(false);
    cin >> n >> a;
    for(i = 1; i <= n; i++) {
        cin >> v[i];
        v[i] -= a;
    }
    dp[0][MAXN * MAXN] = 1;
    for(i = 1; i <= n; i++) {
       memset(dp[i & 1], 0, sizeof(dp[i & 1]));
        for(j = 0; j <= 2 * MAXN * MAXN; j++)
            dp[i & 1][j] += dp[1 - i & 1][j];
        for(j = v[i]; j <= 2 * MAXN * MAXN; j++)
            dp[i & 1][j] += dp[1 - i & 1][j - v[i]];
    }
    cout << dp[n & 1][MAXN * MAXN] - 1;
    //cin.close();
    //cout.close();
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int C, N;
	int P[1010][1010];
	int ans = 0;

	cin >> C >> N;
	REP(i, N) {
		string S;
		cin >> S;
		REP(j, N) {
			P[i][j] = S[j] - '0';
		}
	}

	int tmp[510][510] = { 0 };
	int k = N - 1, m = N - 1;


	REP(i, N / 2) {
		k = N - 1;
		REP(j, N / 2) {
			tmp[i][j] += P[i][j];
			tmp[i][j] += P[i][k];
			tmp[i][j] += P[m][j];
			tmp[i][j] += P[m][k];
			k--;
			//cout << tmp[i][j];
		}
		//cout << endl;
		m--;
	}
	bool FF = true;

	REP(i, N / 2) {
		REP(j, N / 2) {
			if (tmp[i][j] != 0 && tmp[i][j] != 4) {
				FF = false;
			}
		}
	}

	if(FF)ans++;


	REP(i, C - 1) {
		int D;
		cin >> D;
		REP(j, D) {
			int a, b;
			bool F=false;
			cin >> a >> b;
			a--;
			b--;
			if (P[a][b]) {
				F = true;
				P[a][b]--;
			}
			else
				P[a][b]++;

			if (a < N / 2 && b >= N / 2)b = N - b - 1;
			else if (a >= N / 2 && b >= N / 2) {
				b = N - b - 1;
				a = N - a - 1;
			}
			else if(a>=N/2 && b<N/2){
				a = N - a - 1;
			}
			if (F)
				tmp[a][b]--;
			else
				tmp[a][b]++;
		}
		FF = true;
		
		REP(i, N / 2) {
			REP(j, N / 2) {
				if (tmp[i][j] != 0 && tmp[i][j] != 4) {
					FF = false;
				}
			}
		}
		if (FF)ans++;
	}


	cout << ans << endl;

	return 0;
}




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

const double PI=3.14159265358979323846;
 
int main(void){
    double n;
    cin>>n;
    printf("%.10f\n", 2*PI*n);
    return 0;
}

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

int main()
{
    while (true)
    {
        string S;
        getline(std::cin, S);
        if (S == ".")
            break;

        // 丸括弧、角括弧
        bool OK = true;
        int maru = 0, kaku = 0;
        // 直前の左括弧が何だったか
        enum
        {
            _maru,
            _kaku
        };
        stack<int> prev;

        for (char ch : S)
        {
            if (ch == '(')
            {
                ++maru;
                prev.push(_maru);
            }
            else if (ch == '[')
            {
                ++kaku;
                prev.push(_kaku);
            }
            else if (ch == ')')
            {
                --maru;
                if (prev.empty() || prev.top() != _maru)
                {
                    OK = false;
                    break;
                }
                prev.pop();
            }
            else if (ch == ']')
            {
                --kaku;
                if (prev.empty() || prev.top() != _kaku)
                {
                    OK = false;
                    break;
                }
                prev.pop();
            }

            if (maru < 0 || kaku < 0)
            {
                OK = false;
            }
        }
        if (!(maru == 0 && kaku == 0))
        {
            OK = false;
        }
        cout << (OK ? "yes" : "no") << endl;
    }

    return 0;
}


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

int main() {

        int x;
        std::cin >> x;

        if ((x == 7) || (x == 5) || (x == 3)) {
                std::cout << "YES" << std::endl;
        }
        else {
                std::cout << "NO" << std::endl;
        }

        return 0;
}

Measured memory_bytes: 256