akhauriyash/Code-Regression huggingface dataset:
//
// Created by watemus on 01.05.2020.
//

#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>

using namespace std;

#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define ff first
#define ss second

using ll = long long;
using ld = long double;
#define int ll

constexpr ll INFL = 1'000'000'000'000'000'228;
constexpr int INFI = 1'000'000'228;

#ifdef LOCAL
#else
#endif


void run() {
    string s;
    cin >> s;
    map<int, int> cnt;
    int st = 1;
    int cur = 0;
    cnt[0] = 1;
    reverse(all(s));
    for (auto ch : s) {
        int dg = ch - '0';
        cur += dg * st;
        cur %= 2019;
        cnt[cur]++;
        st *= 10;
        st %= 2019;
    }
    int ans = 0;
    for (auto [x, y] : cnt) {
        ans += y * (y - 1) / 2;
    }
    cout << ans << '\n';
}

signed main() {
#ifdef LOCAL
    std::freopen("input.txt", "r", stdin);
#else
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
#endif
    int t = 1;
//    cin >> t;
    while (t--) {
        run();
    }
    return 0;
}

Measured memory_bytes: 3800
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
template<typename T>
class Fenwick {
private:
  int n;
  vector<T> bit;
public:
  Fenwick() : n(-1) {}
  Fenwick(int n_, T d = T()) : n(n_), bit(n + 1, d) {}

  inline void add(int i, T val) {
    if (i == 0) return;
    for (int x = i; x <= n; x += (x & -x)) bit[x] += val;
  }

  // [1, i);
  inline T get(int i) {
    T res = T();
    for (int x = i; x > 0; x -= (x & - x)) res += bit[x];
    return res;
  }

  // return [i, j);
  inline T get(int i, int j) {
    return get(j - 1) - get(i - 1);
  }

  inline int lower_bound(int val) {
    if (val <= 0) return 0;
    int x = 0, r = 1;
    while (r < n) r <<= 1;
    for (int k = r; k > 0; k >>= 1) {
      if (x + k <= n && bit[x + k] < val) {
        val -= bit[x + k];
        val += k;
      }
    }
    return x + 1;
  }

  const T& operator[](const int &i) const {
    return bit[i];
  }
};
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int lo = 0, hi = 1e9 + 1;
  long long target = 1LL * n * (n + 1) / 2;
  target = (target + 1) / 2;
  int geta = n + 10;
  //cerr << "target -> " << target << endl;
  auto ok = [&] (int bound) -> bool {
    Fenwick<long long>  bit(n * 2 + 100);
    long long res = 0;
    bit.add(geta, 1);
    int cur = geta;
    for (int i = 0; i < n; i++) {
      if (a[i] < bound) cur--;
      else cur++;
      res += bit.get(cur);
      bit.add(cur, 1);
    }
    //cerr << "res -> " << res << endl;
    return res >= target;
  };
  while (hi - lo > 1) {
    int mid = (lo + hi) >> 1;
    //cerr << "mid -> " << mid << endl;
    if (ok(mid)) lo = mid;
    else hi = mid;
  }
  cout << lo << endl;
  return 0;
}

Measured memory_bytes: 2276
/*input
5
1 7 2 11 15
*/

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

#define fast ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#define endl "\n"
#define sp " " 
#define all(v) v.begin(),v.end()
#define makepr(a,b) make_pair(a, b)
#define loop(i,k,n) for(ll i=k;i<n;i++)
#define rlop(i,n,k) for(ll i=n-1;i>=k;i--)
#define lop(i ,a) for(auto i : a)
#define vecl vector<ll>
#define vecprl vector<pair<ll, ll> > v;
#define mpll map<ll, ll>
#define mpsl map<string, ll>
#define setl set<ll>
#define mod(a,b) a%b
#define PI 3.14159265

typedef long long ll;
typedef long double ld;

int main()
{
    fast;
    ll n, m ;
    cin >>n>>m;
    cout<<max(n+n-1, max(m+m-1, m+n));
    return 0;
}

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

using namespace std;
typedef long long LL;

#define re register
#define gc getchar
#define digit(x) (x >= '0' && x <= '9')

int read()
{
	int x = 0, f = 1; char c = gc();
	while (!digit(c)) {if (c == '-') f = -1; c = gc();}
	while (digit(c)) x = (x << 3) + (x << 1) + c - '0', c = gc();
	return x * f;
}

const int N = 105;

char a[N][N];
int stx, sty;
int pre[N][N];
short dp[N][N][N][N];
int n, m;

inline int Calc(int l, int r, int u, int d)
{
	if (l <= r && u <= d)
		return pre[d][r] - pre[d][l - 1] - pre[u - 1][r] + pre[u - 1][l - 1];
	return 0;
}

int main()
{
	n = read(); m = read();
	for (re int i = 1; i <= n; i++)
		scanf("%s", a[i] + 1);
	
	for (re int i = 1; i <= n; i++)
		for (re int j = 1; j <= m ; j++)
		{
			pre[i][j] = pre[i - 1][j] + pre[i][j - 1] - pre[i - 1][j - 1] + (a[i][j] == 'o');
			if (a[i][j] == 'E')
				stx = i, sty = j;
		}
	
	int ans = 0;
	for (re int l = 0; l < sty; l++)
		for (re int r = 0; r <= m - sty; r++)
			for (re int u = 0; u < stx; u++)
				for (re int d = 0; d <= n - stx; d++)
				{
					int tmp;
					
					tmp = 0;
					if (sty - l - 1 > r)
						tmp = Calc(sty - l - 1, sty - l - 1, max(stx - u, d + 1), min(stx + d, n - u));
					dp[l + 1][r][u][d] = max((int)dp[l + 1][r][u][d], dp[l][r][u][d] + tmp);
					
					tmp = 0;
					if (sty + r + 1 <= m - l)
						tmp = Calc(sty + r + 1, sty + r + 1, max(stx - u, d + 1), min(stx + d, n - u));
					dp[l][r + 1][u][d] = max((int)dp[l][r + 1][u][d], dp[l][r][u][d] + tmp);
					
					tmp = 0;
					if (stx - u - 1 > d)
						tmp = Calc(max(sty - l, r + 1), min(sty + r, m - l), stx - u - 1, stx - u - 1);
					dp[l][r][u + 1][d] = max((int)dp[l][r][u + 1][d], dp[l][r][u][d] + tmp);
					
					tmp = 0;
					if (stx + d + 1 <= n - u)
						tmp = Calc(max(sty - l, r + 1), min(sty + r, m - l), stx + d + 1, stx + d + 1);
					dp[l][r][u][d + 1] = max((int)dp[l][r][u][d + 1], dp[l][r][u][d] + tmp);
					
					ans = max(ans, (int)dp[l][r][u][d]);
				}
	
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 55532
import math
from collections import deque
N, D, A = map(int, input().split())
XH = [list(map(int, input().split())) for _ in range(N)]
XH = sorted(XH)
ans = 0
total = 0
q = deque([])

for x, h in XH:
  while q and q[0][0] < x:
    total -= q.popleft()[1]
  h -= total

  if h <= 0:
    continue
  attack = math.ceil(h/A)
  damage = attack*A
  total += damage
  q += [[x+2*D, damage]]
  ans += attack

print(ans)
  

Measured memory_bytes: 117612
// #pragma GCC optimize("Ofast,unroll-loops")
// #pragma GCC target("avx,avx2,fma")

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

#define ll long long
#define ull unsigned long long
#define dd double
#define ld long double
#define sl(n) scanf("%lld", &n)
#define si(n) scanf("%d", &n)
#define sd(n) scanf("%lf", &n)
#define pll pair <ll, ll>
#define pii pair <int, int>
#define mp make_pair
#define pb push_back
#define all(v) v.begin(), v.end()
#define inf (1LL << 62)
#define loop(i, start, stop, inc) for(ll i = start; i <= stop; i += inc)
#define for1(i, stop) for(ll i = 1; i <= stop; ++i)
#define for0(i, stop) for(ll i = 0; i < stop; ++i)
#define rep1(i, start) for(ll i = start; i >= 1; --i)
#define rep0(i, start) for(ll i = (start-1); i >= 0; --i)
#define ms(n, i) memset(n, i, sizeof(n))
#define casep(n) printf("Case %lld:", ++n)
#define pn printf("\n")
#define pf printf
#define EL '\n'
#define fastio std::ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

int main()
{
    ll n, ans = 0;
    cin >> n;

    for1(i, n) {
        ll inp;sl(inp);

        if( (i & 1) && (inp & 1)) ans++;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3680
/*
	submission # - User: herp_sy
	https://atcoder.jp/contests/
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>

int main(int argc, char const *argv[])
{
	char s[7];
	scanf("%s",s);
	for (int i = 1; i < 4; ++i)
	{
		if(s[i - 1] == s[i]){
			puts("Bad");
			return 0;
		}
	}
	puts("Good");
	return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
int main(void) {
	int n;
	int a[100001], b[100000];
	scanf("%d", &n);
	for (int i = 0; i < n + 1; i++)
		scanf("%d", &a[i]);
	for (int i = 0; i < n; i++)
		scanf("%d", &b[i]);

	long long beforesum = 0;
	for (int i = 0; i < n + 1; i++)
		beforesum += a[i];
	int temp;
	for (int i = 0; i < n; i++) {
		if (a[i] >= b[i])
			a[i] -= b[i];
		else if (b[i] <= a[i] + a[i + 1]) {
			temp = a[i];
			a[i] = 0;
			a[i + 1] -= b[i] - temp;
		}
		else {
			a[i] = 0;
			a[i + 1] = 0;
		}
	}

	long long aftersum = 0;
	for (int i = 0; i < n + 1; i++)
		aftersum += a[i];

	printf("%lld\n", beforesum - aftersum);

	return 0;
}

Measured memory_bytes: 896
toInt :: String -> Int
toInt = read :: String -> Int

fizzBuzz :: Int -> Int
fizzBuzz n
  | mod n 3 == 0 = 0
  | mod n 5 == 0 = 0
  | otherwise = n

fizzBuzzArray :: [Int]
fizzBuzzArray = map fizzBuzz [0..]

main = do
  n <- toInt <$> getLine
  print $ sum $ take (n+1) fizzBuzzArray


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

using namespace std;
typedef long long ll;

int main(){
    
    ios_base::sync_with_stdio(0);
    int a,b;
    cin>>a>>b;
    while(1){
        if(a==0 && b==0)    break;
        for(int i=0;i<a;i++){
            for(int j=0;j<b;j++){
                if(i==0 || i==a-1)
                    cout<<"#";
                else{
                    if(j==0 || j==b-1)
                        cout<<"#";
                    else cout<<".";
                }
            }
            cout<<"\n";
        }
        cout<<"\n";
        cin>>a>>b;
    }
    return 0;
}



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

int main(){
    int N;
    cin >> N;
    int flag= 0;
    for(int i=1; i<10; i++){
        if((N % i == 0) && (N / i) < 10){
            flag = 1;
        }
    }
    if(flag == 1){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

// Main
const MAX = int(1e+5) + 1
const MOD = int(1e+9) + 7

var fac [MAX]int
var finv [MAX]int
var inv [MAX]int

func COMinit() {
	fac[0], fac[1] = 1, 1
	finv[0], finv[1] = 1, 1
	inv[1] = 1
	for i := 2; i < MAX; i++ {
		fac[i] = fac[i-1] * i % MOD
		inv[i] = modInv(i, MOD)
		finv[i] = finv[i-1] * inv[i] % MOD
	}
}

func modInv(a, mod int) int {
	b := mod
	u := 1
	v := 0
	for b > 0 {
		t := a / b
		a -= t * b
		a, b = b, a
		u -= t * v
		u, v = v, u
	}
	u %= mod
	if u < 0 {
		u += mod
	}
	return u
}

func COM(n, k int) int {
	if n < k {
		return 0
	}
	if n < 0 || k < 0 {
		return 0
	}
	return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD
}

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	N, K := sc.nextInt(), sc.nextInt()
	A := sc.nextIntSlice(N)
	sort.Ints(A)
	COMinit()
	mx, mn := 0, 0
	for i := 0; i <= N-K; i++ {
		mn += A[i] * COM(N-1-i, K-1)
		mn %= MOD
	}
	for i := K - 1; i < N; i++ {
		mx += A[i] * COM(i, K-1)
		mx %= MOD
	}
	ans := mx - mn
	ans %= MOD
	if ans < 0 {
		ans += MOD
	}

	fmt.Fprintln(wtr, ans)
	wtr.Flush()
}


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

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


Measured memory_bytes: 3072
N, M, X, Y = map(int, input().split())

x_l = list(map(int, input().split()))
y_l = list(map(int, input().split()))

xm = max(x_l)
ym = min(y_l)

ans = 'No War'

if xm >= ym:
    ans = 'War'

elif xm >= Y:
    ans = 'War'

elif X >= ym:
    ans = 'War'

elif X >= Y:
    ans = 'War'

print(ans)

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

#define ll long long

const ll MOD = 998244353;
int h, w;
vector<string> sq;
bool ans = false;

// state[0] = 上
// state[1] = 手前
// state[2] = 右
// state[3] = 左
// state[4] = 奥
// state[5] = 下

int used[101][101];

void dfs(vector<char> state, int x, int y) {
  if (used[x][y] == 1) { return; }
  used[x][y] = 1;
  if (x == h - 1 && y == w - 1) {
    ans = true;
    return;
  }
  if (y - 1 >= 0) {
    if (sq[x][y - 1] == state[3]) {
      dfs({state[2], state[1], state[5], state[0], state[4], state[3]}, x,
          y - 1);
    }
  }
  if (x - 1 >= 0) {
    if (sq[x - 1][y] == state[4]) {
      dfs({state[1], state[5], state[2], state[3], state[0], state[4]}, x - 1,
          y);
    }
  }
  if (y + 1 < w) {
    if (sq[x][y + 1] == state[2]) {
      dfs({state[3], state[1], state[0], state[5], state[4], state[2]}, x,
          y + 1);
    }
  }
  if (x + 1 < h) {
    if (sq[x + 1][y] == state[1]) {
      dfs({state[4], state[0], state[2], state[3], state[5], state[1]}, x + 1,
          y);
    }
  }
}

signed main() {

  cin >> h >> w;
  sq.resize(h);
  vector<char> state(6);
  for (int i = 0; i < 6; i += 1) {
    state[i] = char(int('1') + i);
  }
  for (int i = 0; i < h; i += 1) {
    cin >> sq[i];
  }
  dfs(state, 0, 0);
  if (ans) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}


Measured memory_bytes: 4000
#include "bits/stdc++.h"

using namespace std;

#define int long long
#define ll long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;



signed main(){

	int N;
	string s;
	cin >> N >> s;
	string ans(N,'X');

	char t[2] = { 'S', 'W' };
	for (int i = 0; i < 2; i++){
		ans[0] = t[i];
		for (int j = 0; j < 2; j++){
			ans[1] = t[j];

			for (int n = 2; n < N; n++){
				if (s[n - 1] == 'o' && ans[n - 1] == 'S') ans[n] = ans[n-2];
				if (s[n - 1] == 'o' && ans[n - 1] == 'W') ans[n] = 'S'+'W'-ans[n-2];
				if (s[n - 1] == 'x' && ans[n - 1] == 'S') ans[n] = 'S' + 'W' - ans[n - 2];
				if (s[n - 1] == 'x' && ans[n - 1] == 'W') ans[n] = ans[n - 2];
			}

			char zero;
			if (s[N - 1] == 'o' && ans[N - 1] == 'S') zero = ans[N - 2];
			if (s[N - 1] == 'o' && ans[N - 1] == 'W') zero = 'S' + 'W' - ans[N - 2];
			if (s[N - 1] == 'x' && ans[N - 1] == 'S') zero = 'S' + 'W' - ans[N - 2];
			if (s[N - 1] == 'x' && ans[N - 1] == 'W') zero = ans[N - 2];

			if (zero == ans[0]){
				char one;
				if (s[0] == 'o' && ans[0] == 'S') one = ans[N - 1];
				if (s[0] == 'o' && ans[0] == 'W') one = 'S' + 'W' - ans[N - 1];
				if (s[0] == 'x' && ans[0] == 'S') one = 'S' + 'W' - ans[N - 1];
				if (s[0] == 'x' && ans[0] == 'W') one = ans[N - 1];

				if (one == ans[1]){
					cout << ans << endl;
					return 0;
				}
			}
		}
	}
	cout << -1 << endl;
	return 0;
}

Measured memory_bytes: 512
#include <stdio.h> 
int a[100000],n;       
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
	}
	int x=1,y=0;
	for(int i=1;i<=n;i++)
	{
		x=a[x];
		y++;
		if(x==2)
			break;
	}
	if(x==2)
		printf("%d\n",y);
	else
		printf("-1\n");
	return 0;
}

Measured memory_bytes: 512
// Problem : A - Calc
// Contest : AtCoder - AtCoder Beginner Contest 172
// URL : https://atcoder.jp/contests/abc172/tasks/abc172_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

// #pragma GCC optimize ("O3")
// #pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
 
#define bug(x) cout<<#x<<" "<<x<<endl; 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
 
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const ld pii=3.14159265359; 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 200001; //check the limits, dummy
 
int main() 
{
	// && has higher precedence than ||
	ios_base::sync_with_stdio(0); cin.tie(0);    
	int N;
	cin>>N;
	int val=N+N*N+N*N*N;
	cout<<val<<endl;
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343

Measured memory_bytes: 3656
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a=scan.nextInt();
		int b=scan.nextInt();
		int c=scan.nextInt();
		int d=scan.nextInt();
		if(Math.abs(a-c)<=d||Math.abs(a-b)<=d&&Math.abs(b-c)<=d) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 23252
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))
dmin = 10**5
ans = 0
for i in range(n):
    d = abs(a - (t - h[i] * 0.006))
    if d < dmin:
        dmin = d
        ans = i
print(ans + 1)

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

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
#define D()
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 10000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

int main(){
	int a,b,c,k,x;
	cin >> a >> b>> c>> k;
	if(k<=a){
		x=k;
	}else if(a<k&&k<=a+b){
		x=a;
	}else if(a+b<k&&k<=a+b+c){
		x=a-(k-a-b);
	}else{
		x=a-c;
	}
	cout << x <<endl;
	
}
	

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
const int MOD = 1000000007;

int main() {
  ll ans = 0;
  vector<ll> price(4);
  rep(i,4) cin >> price[i];
  ll n;
  cin >> n;
  vector<ll> cp1 = {price[0]*8,price[1]*4,price[2]*2,price[3]};
  sort(cp1.begin(),cp1.end());
  vector<ll> cp2 = {price[0]*4,price[1]*2,price[2]};
  sort(cp2.begin(),cp2.end());
  if(n/2 > 0) {
    ans += cp1[0]*(n/2);
    if(n%2 == 1) {
      ans += cp2[0];
    }
  }else {
    ans += cp2[0];
  }
  cout << ans << endl;
  return 0;
}

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

#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
const int INF=1e9;
int n;
int r[102],c[102];
int p[102];

int dp[102][102];
// [i,j)
int dfs(int i,int j) {
    //cout<<i<<", "<<j<<endl;
    if(dp[i][j]!=-1) return dp[i][j];
    if(j-i==1) return r[i]*c[i]*c[j-1];
    if(i==j) return 0;
    int ret=INF;
    for(int k=i+1;k<j;k++) {
        //ret=min(ret,dfs(i,k)+dfs(k,j)+r[i]*c[k]*c[j-1]);
        ret=min(ret,dfs(i,k)+dfs(k,j)+p[i]*p[k]*p[j]);
    }

    return dp[i][j]=ret;
}

int main() {
    memset(dp,-1,sizeof(dp));
    cin>>n;
    //rep(i,n) cin>>r[i]>>c[i];
    rep(i,n+1) if(i) cin>>p[i-1]>>p[i];
    cout<<dfs(0,n)<<endl;
    return 0;
}


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

typedef long long ll;
typedef long double ld;
#define size(a) int((a).size())
#define present(c, x) (c.find(x) != c.end()) 
#define printArray(arr) for (int i = 0; i<size(arr); i++) cout << arr[i] << " ";cout << '\n'
#define printVerdict(verdict) cout << (verdict ? "YES": "NO") << '\n'
#define printDecimal(d) printf("%.9f\n", d)
#define inrange(val, start, end) (val >= start && val <= end)

const ll inf = 0x3f3f3f3f;

template <class T1, class T2, class T3> 
void printTuple(tuple<T1, T2, T3> t) {cout << get<0>(t) << " " << get<1>(t) << " " << get<2>(t) << '\n';}
template <class T1, class T2>
void printPair(pair<T1, T2> p) {cout << p.first << " " << p.second << '\n';}

struct segTree {
	int sz; 
	vector<ll> tree;
	void init(ll n) {
		sz = 1;
		while (sz < n) sz *= 2;
		tree.assign(2*sz + 1, 0ll);
	}
	
	void set(int idx, ll val) {set(idx, val, 0, 0, sz);}
	void set(int idx, ll val, int curr, int left, int right) {
		if (right - left == 1) tree[curr] = val;
		else {
			int mid = left + (right - left)/2;
			if (idx < mid) set(idx, val, curr*2+1, left, mid);
			else set(idx, val, curr*2 + 2, mid, right);
			tree[curr] = max(tree[curr*2 + 1], tree[curr*2 + 2]);
		}
	}
	
	ll evaluate(int left, int right) {return evaluate(left, right, 0, 0, sz);}
	ll evaluate(int left, int right, int curr, int curr_left, int curr_right) {
		if (curr_left >= right || left >= curr_right) return 0;
		if (curr_left >= left && curr_right <= right) return tree[curr];
		int mid = curr_left + (curr_right - curr_left)/2;
		ll s1 = evaluate(left, right, curr*2+1, curr_left, mid), s2 = evaluate(left, right, curr*2+2, mid, curr_right);
		return max(s1, s2);
	}
};

int main() {
	std::ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n; cin >> n;
	ll h[n], a[n];
	ll maxHeight = 0;
	for (int i = 0; i<n; i++) {
		cin >> h[i];
		maxHeight = max(maxHeight, h[i]);
	}
	for (int i = 0; i<n; i++) cin >> a[i];
	segTree tree;
	tree.init(maxHeight);
	
	vector<ll> dp(n);
	ll ret = 0;
	for (int i = 0; i<n; i++) {
		ll temp = tree.evaluate(1, h[i]);
		dp[i] = temp + a[i];
		tree.set(h[i], dp[i]);
		ret = max(ret, dp[i]);
	}
	cout << ret << '\n';
	
}



Measured memory_bytes: 11912
#include <iostream>
#include <vector>
#include <algorithm>
#define ll long long
using namespace std;
int main(){
    int n;
    string s;
    cin>>n>>s;
    int cnt=0;
    for(int i=0;i<n-2;i++){
        if('A'==s[i]&'B'==s[i+1]&'C'==s[i+2]) cnt++;
    }
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 256
#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);
    int N, K;
    cin >> N >> K;
    int h[100010];
    rep(i, N) cin >> h[i];
    sort(h, h + N);
    int ans = INF;
    rep(i, N - K + 1) {
        ans = min(ans, h[i + K - 1] - h[i]);
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 640
package main

import (
	"bufio"
	_ "container/heap"
	"fmt"
	"os"
	_ "sort"
	"strconv"
)

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func lcm(a, b int) int {
	return a / gcd(a, b) * b
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

// Main
const MOD = int(1e+9) + 7
const INF = 1 << 60

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	defer wtr.Flush()
	N := sc.nextInt()
	S1 := sc.nextStr()
	S2 := sc.nextStr()
	p := []int{}
	for i := 0; i < N; i++ {
		if S1[i] == S2[i] {
			p = append(p, 0)
		} else {
			p = append(p, 1)
			i++
		}
	}
	ans := 1
	for i := 0; i < len(p); i++ {
		if i == 0 {
			if p[i] == 0 {
				ans *= 3
				ans %= MOD
			} else {
				ans *= (3 * 2)
				ans %= MOD
			}
		} else {
			if p[i-1] == 1 && p[i] == 1 {
				ans *= 3
				ans %= MOD
			} else if p[i-1] == 1 && p[i] == 0 {
				ans *= 1
				ans %= MOD
			} else if p[i-1] == 0 && p[i] == 0 {
				ans *= 2
				ans %= MOD
			} else {
				ans *= 2
				ans %= MOD
			}
		}
	}

	fmt.Fprintln(wtr, ans)
}


Measured memory_bytes: 640
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
import fractions
A,B = map(int,input().split())
ans = factorization(fractions.gcd(A,B))
if ans[0][0] == 1:
    print(len(ans))
else:
    print(len(ans)+1)

Measured memory_bytes: 5560
using System;
  
namespace Aizu
{
    class OnlineJudge
    {
        const int Max = 1000000;
        static void Main()
        {
            var p = new int[Max];
            int c = p[2] = 1;
            for(int i=3; i < Max; i += 2) {
                if(p[i] == 0) {
                    ++c;
                    if(i <= 1000) {
                        int s;
                        for(int l = i; ; ++l) {
                            if((s = i * l) >= Max) {
                                break;
                            }
                            p[s] = -1;
                        }
                    }
                }
                p[i] = c;
            }
            string n;
            while((n = Console.ReadLine()) != null) {
                int v = int.Parse(n);
                if(v != 2 && (v & 1) == 0) {
                    --v;
                }
                Console.WriteLine(p[v]);
            }
        }
    }
}

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

long long recursive(long long n, vector<long long>& memo) {
    if ((memo[n] == -1) && (n >= 2))
        memo[n] = recursive(n - 1, memo) + recursive(n - 2, memo);
    return memo[n];
}

int main(void) {
    int N;
    cin >> N;
    vector<long long> memo(N + 1, -1);
    memo[0] = 2;
    memo[1] = 1;
    cout << recursive(N, memo) << endl;
    return 0;
}


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

using namespace std;

typedef long long ll;

const ll MOD = 1e9 + 7;  

int main(){
    int N;
    cin >> N;
    map<string,int> m;
    int maxi = 0;
    for(int i = 0; i < N; i++){
        string a;
        cin >> a;
        m[a]++;
        maxi = max(maxi,m[a]);
    }
    auto mend = m.end();
    for(auto ite = m.begin(); ite != mend; ++ite){
        if(ite -> second == maxi) cout << ite -> first << endl;
    }
    return 0;
}



Measured memory_bytes: 25216
n=int(input())
lis=list()

for var in range(1,n+1):
    num=int(input())
    lis.append(num)

lis.sort()
if sum(lis)%10==0:
    for var in range(0, len(lis)):
        if lis[var] % 10 != 0:
            m=lis[var]
            break
        else:
            m=None
    if m==None:
        print("0")
    else:
        s=sum(lis)-m
        print(s)
else:
    print(sum(lis))

Measured memory_bytes: 3064
# -*- coding: utf-8 -*-

import sys, re
from collections import deque, defaultdict, Counter
from math import sqrt, hypot, factorial, pi, sin, cos, radians, log10
if sys.version_info.minor >= 5: from math import gcd
else: from fractions import gcd 
from heapq import heappop, heappush, heapify, heappushpop
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul, xor
from copy import copy, deepcopy
from functools import reduce, partial
from fractions import Fraction
from string import ascii_lowercase, ascii_uppercase, digits
from datetime import date

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def round(x): return int((x*2+1) // 2)
def fermat(x, y, MOD): return x * pow(y, MOD-2, MOD) % MOD
def lcm(x, y): return (x * y) // gcd(x, y)
def lcm_list(nums): return reduce(lcm, nums, 1)
def gcd_list(nums): return reduce(gcd, nums, nums[0])
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

# Union-Find木
class UnionFind:
    def __init__(self, n):
        # 親要素のノード番号を格納。par[x] == xの時そのノードは根
        # 1-indexedのままでOK、その場合は[0]は未使用
        self.par = [i for i in range(n+1)]
        # 木の高さを格納する（初期状態では0）
        self.rank = [0] * (n+1)

    # 根の検索(グループ番号と言えなくもない)
    def find(self, x):
        # 根ならその番号を返す
        if self.par[x] == x:
            return x
        else:
            # 走査していく過程で親を書き換える
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    # 併合
    def union(self, x, y):
        # 根を探す
        x = self.find(x)
        y = self.find(y)
        # 木の高さを比較し、低いほうから高いほうに辺を張る
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            # 木の高さが同じなら片方を1増やす
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    # 同じ集合に属するか判定
    def same(self, x, y):
        return self.find(x) == self.find(y)

N,M=MAP()

uf=UnionFind(N)
group=[1]*(N+1)
sm=N*(N-1)//2
ans=[0]*(M)
ans[M-1]=sm
edges=[]
for i in range(M):
    a,b=MAP()
    edges.append((a,b))

for i in range(M-1, 0, -1):
    a,b=edges[i]
    if not uf.same(a, b):
        grpa=uf.find(a)
        grpb=uf.find(b)
        uf.union(a, b)
        sm-=group[grpa]*group[grpb]
        group[grpa]=group[grpb]=group[grpa]+group[grpb]
    ans[i-1]=sm

[print(ans[i]) for i in range(M)]


Measured memory_bytes: 30332
#include <stdio.h>
int main(){
  int i,j,k,H,W;
  while (1){ 
    scanf("%d %d",&H,&W);     
    if (H != 0 && W != 0){    
      for (k = 0; k < H/2; k++){ 
    for (i = 0; i < W/2; i++){
      printf("#.");
    }
    if (W%2 == 1){
      printf("#");
    }
    printf("\n");
    for (j = 0; j < W/2; j++){  
      printf(".#");
    }
    if (W%2 == 1){
      printf(".");
    }
    printf("\n");
      }
      if (H%2 == 1){
    for (i = 0; i < W/2; i++){
      printf("#.");
    }
    if (W%2 == 1){
      printf("#");
    }
    printf("\n");
      }
      printf("\n");
    } else {
      break;
    }
  }
  return 0;
}


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

int main(void)
{
    int a, b, k;
    cin >> a >> b >> k;
    set<int> ans;
    
    for (int i = a; i < min(b + 1, a + k); i++)
    {
        ans.insert(i);
    }
    for (int i = b; i > max(a - 1, b - k); i--)
    {
        ans.insert(i);
    }
    for (int t : ans)
    {
        cout << t << endl;
    }
 
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long int
signed main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);cout.tie(NULL);
  string s;cin>>s;
  if(s.length()==1)cout<<((s=="R")?1:0);
  else if(s.length()==2){
  if(s=="RS"||s=="SR")cout<<1;
    else if(s=="RR")cout<<2;
    else cout<<0;
  }
  else{int ans=0,l=0;
    for(int i=0;i<3;i++){
    if(s[i]=='R'){l++;ans=max(ans,l);}
      else l=0;
    }
       cout<<ans;
   }
  return 0;
}

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

int main() {
  int a,b,c,d,e;
  cin>>a>>b;
  e=0;
  for(int i=22;i<=b;i++){
    c=i/10;
    d=i-c*10;
    if((c>=2)&&(d>=2)){
      if(c*d<=a){
        e++;
      }
    }
  }
  cout<<e<<endl;
}

Measured memory_bytes: 256
//#pragma GCC optimize("Ofast,unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,tune=native")
#include<bits/stdc++.h>

using namespace std;

#define all(x) (x).begin(),(x).end()
#define I(x, a) for(auto x : (a))
#define ins insert
#define F(i, l, r) for(auto i = (l); i < (r); i++)
#define DF(i, l, r) for(auto i = (l); i >= (r); i--)
#define E(i, l, r) for(auto i = (l); i <= (r); i++)
#define pb push_back
#define X first
#define Y second
#define mp make_pair
#define ret return
#define brk break
#define cont continue
#define move fjgjgjgjghd

typedef long long ll;
typedef unsigned long long ull;
typedef long double dbl;
typedef pair<int, int> pii;

const int mod = (int)1e9 + 7;
const int N = 17;

vector<int> bitid;
int A, B, n;

vector<int> solve(int from, int to, int d){
	if(d == 1){return {from, to};}
	if((from&1) == (to&1)){
		auto prv = solve(from>>1, to>>1, d - 1);
		vector<int> res;
		int y = (from&1) ? 1 : 0;
		I(x, prv){
			x <<= 1;
			res.pb(x^y);
			res.pb(x^y^1);
			y ^= 1;
		}
		ret res;
	}
	int nf = from>>1;
	int nt = to>>1;
	auto le = solve(nf, nf^1, d - 1);
	auto ri = solve(nf^1, nt, d - 1);
	int lastbit = from&1;
	for(auto&x : le)
		x = (x<<1)^lastbit;
	for(auto x : ri){
		x = (x<<1)^1^lastbit;
		le.pb(x);
	}
	ret le;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> A >> B;
	if(__builtin_popcount(A^B)%2 == 0){cout << "NO"; ret 0;}
	auto ans = solve(A, B, n);
	cout << "YES\n";
	I(x, ans)cout << x << ' ';
	return 0;
}


Measured memory_bytes: 1716
use proconio::input;

#[allow(unused_imports)]
use std::collections::HashSet;

use std::cmp;


fn main() {
    input! {
        n: usize,
        k: usize,
    }
    solve(n, k);
}

fn prepare(m: usize, k: usize, p :u64) -> Vec<Vec<u64>> {
    let mut v : Vec<Vec<u64>> = Vec::<Vec<u64>>::with_capacity(m + 1);
    let v0 : Vec<u64> = vec![1; 1];
    v.push(v0);
    for i in 1..m+1 {
        //println!("### {}", i);
        let mut vi : Vec<u64>;
        if i <= k {
            vi = vec![0; i+1];
            vi[0] = 1;
            vi[i] = 1;
            for j in 1..i/2+1 {
                vi[j] = (v[i-1][j-1] + v[i-1][j]) % p;
                vi[i-j] = vi[j];
            }
        }
        else {
            vi = vec![0; k+1];
            vi[0] = 1;
            if i < 2 * k {
                for j in 1..i/2+1 {
                    vi[j] = (v[i-1][j-1] + v[i-1][j]) % p;
                    if i-j <= k {
                        vi[i-j] = vi[j];
                    }
                }
            } else {
                for j in 1..k+1 {
                    vi[j] = (v[i-1][j-1] + v[i-1][j]) % p;
                }
            } 
        }
        //println!("--> {:?}", vi);
        v.push(vi);
    }
    return v;
}

fn solve(n: usize, k: usize) {
    let p : u64 = (10u32.pow(9u32) + 7) as u64;

    // 1. Calculate values of combinations
    let m = cmp::max(k-1, n-k+1);
    let c = prepare(m, k, p);

    // 2. Calculate possible ways
    for i in 1..k+1 {
        let b = c[k-1][i-1];
        let r = if i > n-k+1 { 
            0
        } else {
            c[n-k+1][i]
        };
        let t = b * r % p;
        println!("{}", t);
    }
}


Measured memory_bytes: 17756
# coding: utf-8
# Your code here!
import sys
readline = sys.stdin.readline
read = sys.stdin.read

#n = int(input())
#a = [int(i) for i in read().split()]

n,k = [int(i) for i in readline().split()]

res = [0]*n
for i in range(k):
    d = input()
    d = [int(i) for i in readline().split()]
    for i in d:
        res[i-1] = 1

print(res.count(0))


Measured memory_bytes: 9184
/**
 *   author: malviyanshiv
 *   created: 27 July 2019  17:51:47
**/

#include <bits/stdc++.h>

using namespace std;

#define REP(i, a, b) for(int i = a; i < b; i++)
#define RREP(i, a, b) for(int i = a-1; i >= b; i--)
#define FORE(a) for(auto ele : a )
#define ALL(a) begin(a), end(a)
#define RPB(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define PB push_back
#define MP make_pair
#define MOD 1000000007
#define INF 0x7fffffff
#define LINF 2000000000000000007
#define F first
#define S second
#define TC int t; cin >> t; while(t--)
#define SET(a,b) memset(a,b,sizeof(a))

#define TRACE

#ifdef TRACE
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

#else

#define trace1(x)
#define trace2(x, y)
#define trace3(x, y, z)
#define trace4(a, b, c, d)
#define trace5(a, b, c, d, e)
#define trace6(a, b, c, d, e, f)

#endif

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


void optimizeIO(){
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
}

int main(){
	optimizeIO();
	map<int, int> mp = {
		{0, 0},
		{10, 1},
		{7, 2},
		{4, 3},
		{1, 4},
		{11, 5},
		{8, 6},
		{5, 7},
		{2, 8},
		{12, 9},
		{9, 10},
		{6, 11},
		{3, 12},
	};
	string s;
	cin >> s;
	vector< vector<ll> > dp(s.size()+1, vector<ll>(13, 0));
	if( s[0] == '?' ){
		for(int i = 0; i < 10; i++)
			dp[1][i] = 1;
	}else{
		dp[1][s[0]-'0'] = 1;
	}
	for(int i = 1, idx = 2; i < s.size(); i++, idx++){
		if( s[i] == '?' ){
			for(int i = 0; i < 10; i++){
				ll cur = i;
				for(int j = 0; j <= cur; j++){
					dp[idx][j] = (dp[idx][j] + dp[idx-1][mp[(13-cur+j)%13]])%MOD;
				}
				for(int j = cur+1, k = 1; j < 13; j++, k++){
					dp[idx][j] = (dp[idx][j] + dp[idx-1][mp[k]])%MOD;
				}
			}
		}else{
			ll cur = s[i] - '0';
			for(int j = 0; j <= cur; j++){
				dp[idx][j] = dp[idx-1][mp[(13-cur+j)%13]];
			}
			for(int j = cur+1, k = 1; j < 13; j++, k++){
				dp[idx][j] = dp[idx-1][mp[k]];
			}
		}
	}
	
	cout << dp[s.size()][5]%MOD << endl;
	return 0;
}

Measured memory_bytes: 13648
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n;
int cnt=0;
void dfs(ll x){
    if(x>=n){return;}
    else{
        cnt++;
        ll tmp=x+x*0.01;
        dfs(tmp);
    }
}
int main()
{
    cin>>n;
    dfs(100);
    cout<<cnt;
}


Measured memory_bytes: 3648
A, B, C = [int(n) for n in input().split()]

if A == B:
    if B != C:
        kawaisou = True
    else:
        kawaisou = False
else:
    if A == C:
        kawaisou = True
    elif B == C:
        kawaisou = True
    else:
        kawaisou = False

if kawaisou:
    print("Yes")
else:
    print("No")

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

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

    int ans = 0;

    for(int i = 1; i <= n; i++){
        int num = i;
        int sum = 0;

        while(num){
            sum += num % 10;
            num /= 10;
        }
        if(sum >= a && sum <= b) ans += i;
    }
    cout << ans << endl;
}

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

using namespace std;

int main(void) {

    string s;
    cin >> s;

    int ans = 0;

        // solve by dual poiters
        int f = 0;
        int b = s.size() - 1;

        while (f < b) {

            if (s[f] == s[b]) {
                f++;
                b--;                
            } else {
                if (s[f] == 'x') {
                    f++;
                    ans++;
                } else if(s[b] == 'x') {
                    b--;
                    ans++;
                } else {
                    cout << -1 << endl;
                    return 0;
                }
            }
        }

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

Measured memory_bytes: 512
S = input()
N = len(S) - 1
 
ans = 0
for i in range(2 ** N):
    equation = ""
    for j in range(N):
        equation += S[j]
        if (i >> j) & 1:
            equation += "+"
    equation += S[N]
    ans += sum(list(map(int, equation.split("+"))))
 
print(ans)

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

int N;
int M;
int cnt;

void input(){
  cin >> N >> M;
}

void solve(){
  if(M == N){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

int main() {
  input();
  solve();
  return 0;    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define pb push_back
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

int main() {
  string s;
  cin>>s;
  if(s[0]==s[1]&&s[1]==s[2]||s[1]==s[2]&&s[2]==s[3])cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 3564
#include <iostream>
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;       
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin>>n;
	ll arr[n];
	for(int i=0;i<n;i++)
	{
		cin>>arr[i];
	}
	ll val=arr[0];
	for(int i=1;i<n;i++)
	{
		val=val^arr[i];
	}
	for(int i=0;i<n;i++)
	{
		cout<<(val^arr[i])<<" ";
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 5048
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int N;
  cin>>N;
  int M;
  cin>>M;
  if(N>=M) cout<<0;
  else
  {
  vector<int>raw(M);
 for(int i=0;i<M;i++)
 {
 int y;
   cin>>y;
   raw.at(i)=y;
 }
sort(raw.begin(), raw.end());  
int d=raw.at(M-1)-raw.at(0);
  
    vector<int>eaa(M-1);
     for(int i=0;i<M-1;i++)
     {
     eaa.at(i)=raw.at(i+1)-raw.at(i);
     }
  sort(eaa.begin(), eaa.end());
reverse(eaa.begin(), eaa.end());
    for(int i=0;i<N-1;i++)
{d=d-eaa.at(i);

} 
  cout<<d;
  }
  
}


Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<cstring>
#include<climits>
#include<cfloat>
#include<cmath>
#include<map>
#include<complex>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define DBL(x) ((x)*(x))

typedef unsigned int uint;
typedef long long ll;

using namespace std;

int main(){
  char buff[64];
  double w,h;
  while(~scanf(" %[0-9],%lf,%lf",buff,&w,&h))
    if(w/(h*h) >= 25.0) puts(buff);
  return 0;
}

Measured memory_bytes: 0
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    if(a<=b){
      System.out.print(a);
    }else{
      System.out.print(a-1);
    }
    
  }
  

  
}

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

string to_binString(long val)
{
    if( !val )
        return std::string("0");
    std::string str;
    while( val != 0 ) {
        if( (val & 1) == 0 )  // val は偶数か？
            str.insert(str.begin(), '0');  //  偶数の場合
        else
            str.insert(str.begin(), '1');  //  奇数の場合
        val >>= 1;
    }
    return str;
}

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

  if(a == b){
    cout << a << endl;
    return 0;
  }

  long keta = 1;

  long temp = 2;
  while(temp <= b){
    keta++;
    temp *= 2;
  }

  long twoPower = 2;
  //long twoPower = 1;
  long value = 0;

  if((b / 2 - a / 2 + b % 2 )  % 2 != 0){
    value = 1;
  }

  for(long i = 1; i < keta; i++){
  //for(long i = 0; i < keta; i++){
    long tmpPower = twoPower << 1;
    /*long ap = max(a % tmpPower, twoPower);
    long bp = max(b % tmpPower, twoPower);

    long judgevalue = bp - ap;
    if(judgevalue < 0){
      judgevalue = twoPower + judge;
    }else{
      judgevalue ++;
    }*/
    long ap = a % tmpPower;
    long bp = b % tmpPower;
    //cout << ap << ":" << bp << ":";
    long judgevalue = 0;
    if(bp >= ap){
      if(bp < twoPower && ap < twoPower){
        judgevalue = 0;
      }else{
        ap = max(ap, twoPower);
        bp = max(bp, twoPower);
        judgevalue = bp - ap + 1;
      }
    }else{
      ap = max(ap, twoPower);
      bp = max(bp - twoPower + 1, 0l) + twoPower - 1;
      judgevalue = bp - ap + 1;
    }

    //cout << judgevalue << endl;

    if(judgevalue % 2 != 0){
      value += twoPower;
      //cout << "add" << twoPower << endl;
    }

    //cout << ap << ":" << bp << ":" << tmpPower <<endl;

    twoPower = tmpPower;

  }
  cout << value << endl;
  //cout << to_binString(value) << endl;
}


Measured memory_bytes: 256