akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

#define FOR(i,a,b)  for(ll i=a;(i)<(b);++(i))
#define RFOR(i,a,b) for(ll i=a;(i)>=(b);--(i))
#define REP(i,n)    FOR(i,0,n)
#define RREP(i,n)   RFOR(i,n,0)
#define ALL(v)      v.begin(), v.end()
#define UNIQ(v)     sort(ALL(v)); v.erase(unique(ALL(v)), v.end())
#define BIT(n)      (1LL<<(n))
#define DEBUG(a)    cerr << #a << " = " << a << endl

//const int inf = 1001001001;
//const int mod = (int)1e9+7;
const ll inf = 1e15;
const ll mod = 1e9+7;

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

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

    map<ll, ll> primes;
    ll div = 2;
    while(true) {
        if (N%div == 0) {
            ++primes[div];
            N = N / div;
        } else {
            ++div;
        }
        if (N == 1) break;
        else if (N != 1 && div > sqrt(N)) {
            ++primes[N];
            break;
        }
    }

    //for(auto [k, v] : primes) {
    //    cout << k << "=>" << v << endl;
    //}

    int ans = 0;
    for (auto& [k, v] : primes) {
        FOR(i, 1, v+1) {
            if (v >= i) {
                v -= i;
                ++ans;
            } else {
                break;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3712
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        StringBuilder s = new StringBuilder(sc.next());
        if(s.length() == 2) {
            System.out.println(s);
        } else {
            System.out.println(s.reverse());
        }
    }
}

Measured memory_bytes: 35700
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007
sys.setrecursionlimit(1000000)

#A
def A():
    s = LI()
    s.sort(reverse = True)
    print(10*s[0]+s[1]+s[2])
    return

#B
def B():
    return

#C
def C():
    s = S()
    t = S()
    n = len(s)
    d = defaultdict(list)
    for i in range(n):
        d[s[i]].append(t[i])
    d2 = defaultdict(list)
    for i in range(n):
        d2[t[i]].append(s[i])
    for i in d.keys():
        k = d[i]
        k = list(set(d[i]))
        if len(k) > 1:
            print("No")
            quit()
    for i in d2.keys():
        k = d2[i]
        k = list(set(d2[i]))
        if len(k) > 1:
            print("No")
            quit()
    print("Yes")
#D
def D():
    n,m = LI()
    if m == 1:
        print(1)
        quit()
    d = defaultdict(int)
    i = 2
    a = m
    while i**2 <= m:
        if not a%i:
            while not a%i:
                a//=i
                d[i] += 1
        i += 1
    if a != 1:
        d[a] += 1
    fact = [1 for i in range(n+31)]
    for i in range(n+30):
        fact[i+1] = fact[i]*(i+1)%mod
    inv_fact = [None for i in range(n+31)]
    inv_fact[n+30] = pow(fact[n+30],mod-2,mod)
    for i in range(n+30)[::-1]:
        inv_fact[i] = inv_fact[i+1]*(i+1)%mod
    ans = 1
    for i in d.values():
        ans *= fact[i+n-1]*inv_fact[i]*inv_fact[n-1]%mod
        ans %= mod
    print(ans)
#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == "__main__":
    A()


Measured memory_bytes: 40048
class UnionFind
  def initialize(n)
    @size = Array.new(n, 1)
    @parent = []

    n.times do |i|
      @parent[i] = i
    end
  end

  def find(x)
    if @parent[x] == x
      x
    else
      @parent[x] = find(@parent[x])
    end
  end

  def unite(x, y)
    x = find(x)
    y = find(y)
    return if x == y

    @parent[y] = x
    @size[x] += @size[y]
  end

  def same?(x, y)
    find(x) == find(y)
  end

  def size(x)
    @size[find(x)]
  end
end

N, K, L = gets.chomp.split.map(&:to_i)

road_uf = UnionFind.new(N + 1)
rail_uf = UnionFind.new(N + 1)

K.times do
  from, to = gets.chomp.split.map(&:to_i)
  road_uf.unite(from, to)
end

L.times do
  from, to = gets.chomp.split.map(&:to_i)
  rail_uf.unite(from, to)
end

counter = Hash.new { |h, k| h[k] = [] }

(1..N).each do |i|
  counter[[road_uf.find(i), rail_uf.find(i)]] << i
end

ans = Array.new(N + 1, 0)

counter.values.each do |v|
  v.each do |i|
    ans[i] = v.size
  end
end

puts (1..N).map { |i| ans[i] }.join(' ')


Measured memory_bytes: 49092
#include <iostream>


int main() {
	unsigned long long int vNum, vCount = 0, vSum = 0;
	std::cin >> vNum;

	vCount = (vNum / 11) * 2;
	vSum = (vCount / 2) * 11;

	if (vSum < vNum) {
		vSum += 6;
		vCount++;
		if (vSum < vNum) {
			vSum += 5;
			vCount++;
		}
	}

	std::cout << vCount;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>

#define REP(n) for(int i = 0;i < n;i++)
#define LLREP(n) for(long long int  i = 0;i < n;i++)
typedef long long int ll;
using namespace std;
#define MAX_A 1000000005

int main(){

    int x;
    cin >> x;

    int ans = x*800-200*(x/15);
    cout << ans << endl;


    return 0;
}

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
//typedef tuple<int, int, int> T;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)
#define ALL(c) c.begin(), c.end()
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define UNIQUE(c) sort(ALL(c)), c.erase(unique(ALL(c)), c.end())

const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = {0, 1, 0, -1};

template<typename T> struct RangeSumQuery {
  int N;
  vector<T> dat;

  RangeSumQuery(int N) : N(N) {
    assert(N > 0);
    dat.resize(N, 0);
  }

  void add(int k, T val) {
    assert(0 <= k && k < N);
    for (int x = k; x < N; x |= x + 1) {
      dat[x] += val;
    }
  }

  // [0, k)
  T sum(int k) {
    assert(k >= 0);
    T ret = 0;
    for (int x = k - 1; x >= 0; x = (x & (x + 1)) - 1) {
      ret += dat[x];
    }
    return ret;
  }
  // [l, r)
  T sum(int l, int r) {
    assert(0 <= l && l <= r && r <= N);
    return sum(r) - sum(l);
  }

  T index(int k) {
    assert(0 <= k && k < N);
    return sum(k+1) - sum(k);
  }
};


int main() {
  // use scanf in CodeForces!
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int N, K; cin >> N >> K;
  vector<int> A(N); REP(i, N) cin >> A[i];

  RangeSumQuery<int> dp_left(K + 1);
  vector<bool> dp_right(K + 1);
  vector<int> prev(K + 1, -1);
  dp_right[0] = true;
  for (int i = N - 1; i >= 0; i--) {
    for (int j = K; j >= 0; j--) {
      //cout << i << ' ' << j << endl;
      if (j - A[i] >= 0 and dp_right[j - A[i]] and not dp_right[j]) {
        dp_right[j] = true;
        prev[j] = i;
      }
    }
  }
  dp_left.add(0, 1);

  int ans = 0;
  REP(i, N) {
    bool flag = true;
    for (int j = K; j >= 0; j--) {
      if (prev[j] == i) dp_right[j] = false;
      if (dp_right[j] and dp_left.sum(max(0, K - A[i] - j), K - j) > 0) {
        flag = false;
      }
    }
    if (flag) ans++;
    for (int j = K; j >= 0; j--) {
      if (j - A[i] >= 0 and dp_left.index(j - A[i]) == 1 and dp_left.index(j) == 0) {
        dp_left.add(j, 1);
      }
    }
    //for (auto x : dp_right) cout << x << ' ';
    //cout << endl;
    //REP(i, K + 1) cout << dp_left.index(i) << ' ';
    //cout << endl;
  }
  cout << ans << endl;





  return 0;
}


Measured memory_bytes: 384
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
typedef unsigned int uint;
using namespace std;

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

  int sum[N+1];
  sum[0] = 0;
  for(int i=1;i<=N;i++){
    if(s[i-1] == 'I'){
      sum[i] = sum[i-1] + 1;
    }
    if(s[i-1] == 'D'){
      sum[i] = sum[i-1] - 1;
    }
  }

  cout << *max_element(sum,sum+N+1) << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		long sum = 0;
		Integer [] l = new Integer[N];

		for(int i = 0; i < N; i++) {
			l[i] = sc.nextInt();
		}
		Arrays.sort(l,Collections.reverseOrder());

		for(int i = 0; i < K; i++) {
			sum += l[i];
		}
		System.out.println(sum);
	}
}


Measured memory_bytes: 23636
_, _, m = gets.split.map(&:to_i)
a = gets.split.map(&:to_i)
b = gets.split.map(&:to_i)
c = m.times.map {gets.split.map(&:to_i)}
min = a.min + b.min
c.each do |x, y, cc|
    t = a[x - 1] + b[y - 1] - cc
    min = t if t < min
end
puts min

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

using namespace std;

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

  int c = 0;
  int x;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    if (i % 2 == 1 && x % 2 == 1)
      c++;
  }

  cout << c;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
const long long INF = 1LL << 60;
using pll = pair<long long, long long>;

int main() {
  // 標準入力が早くなる。Cスタイルの入出力とC++スタイルの入出力を混合させてはならない。
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);

  string S;

  cin >> S;

  int A = 0;
  int B = 0;
  for (int i = 0; i < 3; i++) {
    if (S[i] == 'A') {
      ++A;
    } else {
      ++B;
    }
  }

  if (A > 0 && B > 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <vector>
#define REP(i, n) for(int i = 0; i < (n); ++i)
typedef long long ll;
const int MOD = 1000000007;
using namespace std;

vector<ll> fact_inv, fact;
 
ll pow(int a, int b) {
	if (!b) {
		return 1;
	}
	else if (b % 2 == 0) {
		ll d = pow(a, b/2);
		return (d * d) % MOD;
	}
	else {
		return (a*pow(a, b-1)) % MOD;
	}
}
 
 
ll inv(int a){
    return pow(a, int(MOD-2));
}
 
ll comb(int a, int b){
    if(a < b) return 0;
    if(a < 0 || b < 0) return 0;
    ll ret = fact[a];
    ret = ret * fact_inv[b] % MOD;
    ret = ret * fact_inv[a-b] % MOD;
    return ret;
}
 
void precom(int n){
    fact.resize(n);
    fact_inv.resize(n);
    fact[0] = fact[1] = 1;
    fact_inv[0] = fact_inv[1] = 1;
    for(int i = 2; i < n; ++i) fact[i] = fact[i-1] * i % MOD;
    for(int i = 2; i < n; ++i) fact_inv[i] = inv(fact[i]);
    return;
}

int main(){
    int x, y; cin >> x >> y;
    if((x+y)%3){
        cout << 0 << "\n"; return 0;
    }
    int n = (x+y) / 3;
    precom(n+5);
    cout << comb(n, x-n) << "\n";
    return 0;
}

Measured memory_bytes: 10624
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<stdlib.h>
#include<iomanip>
#include<limits>
#include<queue>
#include<stack>
#include<math.h>
#include<array>
const int INF = 1e9;
const int MOD = 1e9 + 7;
using namespace std;
int main(){
    int N;
    cin >> N;
    int p[N];
    for(int i = 0; i< N; i++){
        cin >> p[i];
    }
    sort(p, p+ N, greater<int>() );
    int sum = p[0]/2;
    for(int i = 1; i< N; i++){
        sum += p[i];
    }
    cout << sum <<endl;
    return 0;
}

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

using ll = long long;
using P = pair<int, int>;

const int INF = 1e9;
const int MOD = 1e9 + 7;

// 4近傍、8近傍
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

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

  vector<string> v = {"SUN","MON","TUE","WED","THU","FRI","SAT"};
  for (int i = 0; i < 7; i++) {
    if (s == v[i]) {
      cout << 7 - i << endl;
      return 0;
    }
  }

  return 0;
}


Measured memory_bytes: 256
def solve():
	N = int(input())
	arr = list(map(int, input().split()))
	summ = sum(arr)
	freq = dict()
	for x in arr:
		freq[x] = freq.get(x, 0) + 1
	Q = int(input())
	for _ in range(Q):
		B, C = map(int, input().split())
		Bfreq = freq.get(B, 0)
		summ -= B * Bfreq
		summ += C * Bfreq
		freq[C] = freq.get(C, 0) + Bfreq
		if (B in freq):
			freq.pop(B)
		print(summ)


def main():
	# for _ in range(int(input())):
	solve()


if __name__ == '__main__':
	main()


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

#define all(v) v.begin(), v.end()
#define sz(v) (int)v.size()

using namespace std;
using ll = long long;
using ld = long double;

const int L = 1e5 + 1;
const ll MOD = 1e9 + 7;
const ll INF = (1LL << 61);

ll n;
map <ll, ll> m;

ll ans(ll x) {
    if (m.find(x) == m.end()) {
        m[x] = 2 * ans(x / 2) + 1;
    }

    return m[x];
}

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

    cin >> n;
    m[1] = 1;
    cout << ans(n);

    return 0;
}

/// ACTUAL CODE STARTS HERE:
/*
     ▄▀▀▀▄
▄███▀░◐░░░▌
    ▌░░░░░▐
    ▐░░░░░▐
    ▌░░░░░▐▄▄
    ▌░░░░▄▀▒▒▀▀▀▀▄
   ▐░░░░▐▒▒▒▒▒▒▒▒▀▀▄
   ▐░░░░▐▄▒▒▒▒▒▒▒▒▒▒▀▄
    ▀▄░░░░▀▄▒▒▒▒▒▒▒▒▒▒▀▄
      ▀▄▄▄▄▄█▄▄▄▄▄▄▄▄▄▄▄▀▄
           ▌▌░▌▌
           ▌▌░▌▌
         ▄▄▌▌▄▌▌        */


Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <bitset>
#include <chrono>
#include <cmath>
#include <iostream>
#include <numeric>
#include <random>
#include <set>
#include <unordered_set>
#include <vector>
#include <list>
#include <functional>

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

using namespace std;

#define LOCAL 1

#if LOCAL
#define pv(val) cerr << #val << " = " << (val) << endl
#define pvn(name, val) cerr << name << " = " << (val) << endl
#define pl cerr << '@' << __LINE__ << endl
#else
#define pv(val)
#define pvn(name, val)
#define pl
#endif

template <class T>
ostream& operator<<(ostream& os, vector<T> const& vec) {
  if (vec.empty()) {
    os << "{}";
  } else {
    os << '{';
    for (size_t i = 0; i < vec.size() - 1; i++) os << vec[i] << ", ";
    os << vec.back() << '}';
  }
  return os;
}

template <class T, size_t S>
ostream& operator<<(ostream& os, array<T, S> const& arr) {
  if (arr.empty()) {
    os << "{}";
  } else {
    os << '{';
    for (size_t i = 0; i < arr.size() - 1; i++) os << arr[i] << ", ";
    os << arr.back() << '}';
  }
  return os;
}

template <class T, class U>
ostream& operator<<(ostream& os, pair<T, U> const& p){
  os << '(' << p.first << ", " << p.second << ')';
  return os;
}

template<class T, class U>
pair<T, U> operator+(pair<T, U> const& lhs, pair<T, U> const& rhs){
  return {lhs.first + rhs.first, lhs.second + rhs.second};
}

template<class T, class U>
pair<T, U> operator-(pair<T, U> const& lhs, pair<T, U> const& rhs){
  return {lhs.first - rhs.first, lhs.second - rhs.second};
}

template<class T, class U>
U lowerBound(function<T(U)> f, T const& val, U l, U r){
  while(l < r){
    auto m = l + (r - l) / 2;
    auto fm = f(m);
    if(fm < val){
      l = m;
    }else{
      r = m;
    }

  }
}


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

  set<string> ss;
  for(int i = 0; i < s.size(); i++){
    for(int j = 1; j <= 5; j++) {
      if(i + j > s.size()) break;
      ss.insert(s.substr(i, j));
    }
  }

  cout << *(next(ss.begin(), K - 1)) << endl;

  return 0;
}


Measured memory_bytes: 1152
#include<iostream>
using namespace std;
int main(){
    int n;
    cin >> n;
    for(int i=0; i<n; i++){
        int a,b,c;
        cin >> a >> b >> c;
        a *= a;
        b *= b;
        c *= c;
        if(a == b + c || b == a + c || c == a + b){
            cout << "YES\n";
        }else{
            cout << "NO\n";
        }
    }
    return 0;
}


Measured memory_bytes: 2944
#include<iostream>
#include<string>
#include<vector>
#include<list>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<set>
#include<map>
#include<queue>
#include<cstring>
#include<sstream>
using namespace std;

typedef long long ll;

int main() {
  int N; cin >> N;
  
  int pm[101];
  memset(pm,0,sizeof(pm));
  for ( int i = 2; i <= N; i++ ) {
    int x = i;
    for ( int j = 2; x > 1; j++ ) {
      while(x%j==0) {
	pm[j]++;
	x /= j;
      }
    }
  }

  int dp[101];
  memset(dp,0,sizeof(dp));
  dp[1] = 1;
  for ( int i = 0; i <= 100; i++ ) {
    if ( pm[i] ) {
      for (int j = 75; j >= 1; j-- ) {
	for ( int k = 1; k<=pm[i]; k++ ) {
	  if ( j*(k+1) <= 75 )  dp[j*(k+1)] += dp[j];
	}
      }
    }
  }

  cout << dp[75] << endl;
  return 0;
}


Measured memory_bytes: 256
N=int(input())
S=input()
cnt=0
for i in range(1000):
  con=0
  if i<10:
    a="00"+str(i)
  elif i<100:
    a="0"+str(i)
  else:
    a=str(i)
  for j in range(N):
    if S[j]==a[con]:
      con+=1
      if con==3:
        cnt+=1
        break
print(cnt)

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

int main() {
  string s;
  cin >> s;
  int p;
  p = s.size();
  for (int i=0; i<p-1;i++){
    for (int j=i+1;j<p;j++){
      if (s[i] == s[j]){
        cout << "no" << endl;
        return 0;
      }
    }
  }
  cout << "yes" << endl;
  return 0;
}

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

int main() {
    int r, g, b;
    cin >> r >> g >> b;
    int number = r * 100 + g * 10 + b;
    if (number % 4 == 0) {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 256
use std::io::stdin;

fn input1<T: std::str::FromStr> () -> Result<T, T::Err> {
    let mut n = String::new();
    stdin().read_line(&mut n).unwrap();
    n.trim().parse()
}

fn input_arr<T: std::str::FromStr> () -> Vec<T> {
    let mut s = String::new();
    stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().flat_map(str::parse).collect()
}

fn main () {
    let n: usize = input1().unwrap();
    let mut h: Vec<usize> = input_arr();
    h.reverse();
    h.push(0);

    let mut c = 1;
    let mut cr = -1;
    let mut r = 0;
    for hi in h.into_iter() {
        if c <= hi {
            cr += 1;
        } else {
            r = if r < cr { cr } else { r };
            cr = 0;
        }
        c = hi;
    }
    println!("{}", r);
}


Measured memory_bytes: 8444
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int x,k,d;
	cin>>x>>k>>d;
	x=abs(x);
	if(k<x/d)
	{
		if(x<0) cout<<abs(x+k*d)<<endl;
		else    cout<<x-k*d<<endl;
		return 0;
	}
	k-=x/d;
	if(k%2==0)
	{
		if(x>=0) cout<<x%d<<endl;
		else     cout<<abs(x%d-d)<<endl;
	}
	else
	{
		if(x>=0) cout<<abs(x%d-d)<<endl;
		else     cout<<x%d<<endl;
	}
	return 0;
}

Measured memory_bytes: 3628
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <math.h>
#include <complex>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> pr;
typedef complex<double> com;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const ll INF = 1e18;


int main() { 
	int h,w; cin>>h>>w;
	vector<string> b(h);
	rep(i,0,h) cin>>b[i];
	vector<vector<bool>> coin(h+w);
	rep(i,0,h+w) coin[i].resize(h+w,false);
	vector<vector<int>> sum(h+w);
	rep(i,0,h+w) sum[i].resize(h+w,0);
	rep(i,0,h)rep(j,0,w){
		if(b[i][j]=='#'){
			coin[i+j][i-j+w-1]=true;
			sum[i+j][i-j+w-1]=1;
		}
	}
	h+=w;
	rep(i,0,h)rep(j,0,h){
		if(j!=0) sum[i][j]+=sum[i][j-1];
	}
  	ll ans=0;
	rep(i,0,h)rep(j,0,h)rep(k,j+1,h){
		if(coin[i][j]&&coin[i][k]){
			int dis=k-j;
			if(i-dis>=0)ans+=sum[i-dis][k]-(j==0?0:sum[i-dis][j-1]);
			if(i+dis<h)ans+=sum[i+dis][k]-(j==0?0:sum[i+dis][j-1]);
		}
	}
	rep(i,0,h)rep(j,0,h){
		sum[i][j]=0;
	}
	h-=w;
	rep(i,0,h)rep(j,0,w){
		if(b[i][j]=='#'){
			sum[i+j][i-j+w-1]=1;
		}
	}
	h+=w;
	rep(i,0,h)rep(j,0,h){
		if(i!=0) sum[i][j]+=sum[i-1][j];
	}
	rep(i,0,h)rep(j,0,h)rep(k,j+1,h){
		if(coin[j][i]&&coin[k][i]){
			int dis=k-j;
			if(i-dis>=0)ans+=sum[k][i-dis]-(j==0?0:sum[j-1][i-dis])-coin[j][i-dis]-coin[k][i-dis];
			if(i+dis<h) ans+=sum[k][i+dis]-(j==0?0:sum[j-1][i+dis])-coin[j][i+dis]-coin[k][i+dis];
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 2048
#include<bits/stdc++.h>
#define ll long long int
#define v vector
#define pub push_back
#define pob pop_back
#define puh push_heap
#define poh pop_heap
#define com(x) x.begin(),x.end()
#define fast(); ios::sync_with_stdio(0);cin.tie(0);
#define popcount __builtin_popcount
#define F first
#define S second
#define LB lower_bound
#define UB upper_bound 
#define MP make_pair
#define MH make_heap
#define NLmax(x) numeric_limits<x>::max()
#define NLmin(x) numeric_limits<x>::min()
#define bisearch(s) binary_search(s.begin(),s.end())
#define loop(i,a,b,x) for(ll i=a;i<b;i=i+x)
#define M 1000000007
using namespace std;
int main()
{
    fast();
    char b;
    cin>>b;
    if(b=='A') cout<<'T';
    if(b=='T') cout<<'A';
    if(b=='C') cout<<'G';
    if(b=='G') cout<<'C';
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define REP(LoopVariable,numberOFend) for(int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)


int main(){

    long long int n,a,b;
    cin>>n>>a>>b;
    if(n==0||(n==1&&a!=b)||a>b){
        cout << 0 << endl;
    }else{
        cout << 1 + ((n - 2) * (b - a)) << endl;
    }
    return 0;
}   

Measured memory_bytes: 384
//ABC140 A
//20190907

using System;
using System.Linq;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            // Console.WriteLine("Hello World!");
            int N = int.Parse(Console.ReadLine());

            int ans = N*N*N;
            Console.WriteLine(ans);


        }
    }
}


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

#include <bits/stdc++.h>
#include <x86intrin.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template <typename T> using ordered_set = tree<T, null_type, std::less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define ll long long
#define ull unsigned long long
//#define int ll
#define ld long double
#define rep(i, l, r) for (int i = l; i < r; i++)
#define repb(i, r, l) for (int i = r; i > l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp(a, b) make_pair(a, b)
#define ret(a) {cout << a; exit(0);}

using namespace std;

mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

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

const int N = 300 + 1;

int n , m , k , cnt[4];
ld dp[N][N][N];
bool was[N][N][N];
ld solve(int i , int j , int k){
	if(i + j + k > n or i + j + k == 0)
		return 0;
	if(was[i][j][k])
		return dp[i][j][k];
	was[i][j][k] = 1;
	ld p = 1.0 / (i + j + k);
	ld &cur = dp[i][j][k];
	if(i)
		cur += (ld)i * p * solve(i - 1, j, k);
	if(j)
		cur += (ld)j * p * solve(i + 1, j - 1 , k);
	if(k)	
		cur += (ld)k * p * solve(i , j + 1 , k - 1);
	cur += (ld)(n)/(ld)(i + j + k);
	return cur;          
}
main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;
	for(int i = 1; i <= n; i++){
		int x;
		cin >> x;
		cnt[x]++;
	}
	solve(cnt[1] , cnt[2], cnt[3]);
	cout << setprecision(20) << fixed << dp[cnt[1]][cnt[2]][cnt[3]] ;
}

Measured memory_bytes: 452992
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(c) (c).begin(), (c).end()
#define pb push_back
#define eb emplace_back
const long long INF = 1LL<<60; // 仮想的な無限大の値;
using namespace std;
using ll = long long;
using P  = pair<int, int>;
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; }

int main()
{
    int D, T, S;
    cin >> D >> T>> S;
    double time =(double)(D)/(double)(S);
    if(time <= (double)T)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#pragma GCC optimize("O3")

#define fi first
#define se second
#define em emplace
#define eb emplace_back
#define mp make_pair
#define pi pair<int,int>
#define vi vector<int>
#define vpi vector<pair<int,int>>
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define endl '\n'

#define si(v) int(v.size())
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep2(i, n, m) for (ll i = n; i <= (m); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (m); --i)

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

using ll = long long;
using ld = long double;
using namespace std;

constexpr ll MOD = 1000000007;

signed main()
{
  cout << fixed << setprecision(20);
  ios::sync_with_stdio(false);
  cin.tie(0);
  
  ll n, k; cin >> n >> k;
  string s; cin >> s;

  ll ans = 0;
  rep(i, n-1) if (s[i] == s[i+1]) ++ans;

  ll cnt = 0;
  rep(i, n) {
    int j = i;
    while (s[j] == s[j+1] && j < n-1) ++j;

    ++cnt;
  }

  cout << min(n-1, ans + min(cnt, k) * 2) << endl;
  
  return (0);
}

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

int main() {
    int n,m;
    cin >> n >> m;
    vector<int>s(m);
    vector<char>c(m);
    for(int i=0;i<m;i++){
        cin >> s.at(i) >> c.at(i);
    }
    string ans;
    if(n==3) ans="100";
    else if(n==2) ans="10";
    else if(n==1) ans="0";
    for(int i=0;i<m;i++){
        ans.at(s.at(i)-1)=c.at(i);
    }
    if(ans.at(0)=='0'&&ans.size()>=2){
        ans="-1";
    }
    for(int i=1;i<m;i++){
        for(int j=0;j<i;j++){
            if(s.at(i)==s.at(j)&&c.at(i)!=c.at(j)){
                ans="-1";
            }
        }
    }
    cout << ans << endl;
}

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

int main(){

  int N, Q, num=0;
  cin >> N >> Q;
  string S;
  cin >> S;
  int l[Q], r[Q], ans[N];
  for(int i=0; i<Q; i++){
    cin >> l[i] >> r[i];
  }

  for(int i=0; i<N; i++){
    if(i){
      if(S[i]=='C' && S[i-1]=='A'){
        num++;
      }
    }
    ans[i] = num;
  }


 for(int i=0; i<Q; i++){
   cout << ans[r[i]-1] - ans[l[i]-1] << endl;
 }

  return 0;
}


Measured memory_bytes: 2176
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<numeric>
#include<algorithm>
#include<cmath>
#include<climits>

//エイリアス
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;

class Stream{
public:
    Stream(){

    }
    //配列以外の入力を受け取る
    void read(){

    }
    template<typename First, typename... Rest>
    void read(First& first, Rest&... rest){
        cin >> first;
        read(rest...);
    }
    template<typename T>
    vector<T> read_vec(size_t n){
        vector<T> tmp(n);
        for(size_t i = 0; i < n; i++){
            cin >> tmp[i];
        }
        return tmp;
    }
    //配列を区切って出力する
    template<typename T>
    void write_vec(vector<T>& v, char divider){
        for(size_t i = 0; i < v.size(); i++){
            cout << v[i] << divider;
        }
    }
};



int main(){
    Stream io;
    
    int N, K;
    string S;
    io.read(N, K, S);

    int ans = 0;
    int len = 1;
    char d = S[0];
    for(int i = 1; i < S.size(); i++){
        if(d == S[i]){
            ans++;
        }
        else {
            len++;
            d = S[i];
        }
    }

    if(len % 2 == 0){
        ans += 2 * min(K, (len - 2) / 2);
        K -= (len - 2) / 2;
        if(K > 0) ans++;
    }
    else{
        ans += 2 * min(K, (len - 1) / 2);
    }
    
    cout << ans;

    return 0;
}


Measured memory_bytes: 3732
use std::collections::HashMap;

fn main() {
    proconio::input! {
        n: usize,
        sc: [(String, u64); n],
    }

    let mut nsc = Vec::new();
    let mut rev = Vec::new();

//    let mut rev: Vec<_> = sc
//        .iter()
//        .map(|(s, _)| s.chars().rev().collect::<String>())
//        .collect();

    let mut cost = u64::max_value();
    for (s, c) in sc {
        let r = s.chars().rev().collect::<String>();
        if s == r {
            cost = cost.min(c);
        } else {
            nsc.push((s, c));
            rev.push(r);
        }
    }
    let n = nsc.len();
    for i in 0..n {
        let mut solver = Solver::new(n, &nsc, &rev);
        cost = cost.min(solver.calc(nsc[i].0.as_str(), nsc[i].1, true));
//        cost = cost.min(if sc[i].0 == solver.rev[i] {
//            sc[i].1
//        } else {
//            solver.calc(sc[i].0.as_str(), sc[i].1, true)
//        });
    }

    if cost < u64::max_value() {
        println!("{}", cost);
    } else {
        println!("-1");
    }
}

struct Solver<'a> {
    done: HashMap<(&'a str, bool), u64>,
    n: usize,
    sc: &'a Vec<(String, u64)>,
    rev: &'a Vec<String>,
}

impl<'a> Solver<'a> {
    fn new(n: usize, sc: &'a Vec<(String, u64)>, rev: &'a Vec<String>) -> Solver<'a> {
        Solver {
            done: HashMap::new(),
            n: n,
            sc: sc,
            rev: rev,
        }
    }

    fn calc(&mut self, s: &'a str, cost: u64, is_left: bool) -> u64 {
        let mut v = u64::max_value();
        if if let Some(&c) = self.done.get(&(s, is_left)) { cost >= c } else { false } {
            v
        } else {
            self.done.insert((s, is_left), cost);
            for i in 0..self.n {
                let oppo = if is_left { &self.rev[i] } else { &self.sc[i].0 };
                let next = if s.starts_with(oppo) {
                    Some((&s[oppo.len()..], is_left))
                } else if oppo.starts_with(&s) {
                    Some((&oppo[s.len()..], !is_left))
                } else {
                    None
                };
                if let Some((next, is_left)) = next {
                    let cost = cost + self.sc[i].1;
                    v = v.min(if next == next.chars().rev().collect::<String>() {
                        cost
                    } else {
                        self.calc(next, cost, is_left)
                    });
                }
            }
            v
        }
    }
}


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

using namespace std;

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

typedef pair<int,int> PII;

int di0[] = {0,0,1,-1};
int dj0[] = {-1,1,0,0};

int di1[] = {0,0,1,-1};
int dj1[] = {1,-1,0,0};

void solve(int h, int w){
    string b1[h];
    string b2[h];
    rep(i,h){
        cin >> b1[i] >>  b2[i];
    }
    int si1=0,si2=0,sj1=0,sj2=0;
    int gi1 = 0,gi2 = 0, gj1 = 0, gj2 = 0;
    rep(i,h)rep(j,w){
            if(b1[i][j] == 'L'){
                si1 = i;
                sj1 = j;
            }
            if(b1[i][j] == '%'){
                gi1 = i;
                gj1 = j;
            }
            if(b2[i][j] == '%'){
                gi2 = i;
                gj2 = j;
            }
            if(b2[i][j] == 'R'){
                si2 = i;
                sj2 = j;
            }
        }
    bool mp[50][50][50][50];
    memset(mp,false,sizeof(mp));
    deque<pair<PII,PII>> que;
    que.push_back({{si1,sj1},{si2,sj2}});
    mp[si1][sj1][si2][sj2] = true;

    while(! que.empty()){
        if(mp[gi1][gj1][gi2][gj2]) {
            cout << "Yes" << endl;
            return;
        }
        pair<PII,PII> p = que.front();
        que.pop_front();
        int ci[2],cj[2];

        ci[0] = p.first.first;
        cj[0] = p.first.second;

        ci[1] = p.second.first;
        cj[1] = p.second.second;

        rep(dir,4){
            int ni[2],nj[2];
            ni[0] = ci[0] + di0[dir];
            nj[0] = cj[0] + dj0[dir];

            ni[1] = ci[1] + di1[dir];
            nj[1] = cj[1] + dj1[dir];


            rep(i,2) if(ni[i] < 0) ni[i] = 0;
            rep(i,2) if(ni[i] >= h) ni[i] = h-1;
            rep(i,2) if(nj[i] < 0) nj[i] = 0;
            rep(i,2) if(nj[i] >= w) nj[i] = w-1;
            if(b1[ni[0]][nj[0]] == '#') {
                ni[0] = ci[0];
                nj[0] = cj[0];
            }
            if(b2[ni[1]][nj[1]] == '#') {
                ni[1] = ci[1];
                nj[1] = cj[1];
            }
            bool flag1 = (ni[0] == gi1 && gj1 == nj[0] );
            bool flag2 = (ni[1] == gi2 && nj[1] == gj2);
            if(mp[ni[0]][nj[0]][ni[1]][nj[1]] == false && !(flag1 ^ flag2)) {
                que.push_back({{ni[0], nj[0]},
                               {ni[1], nj[1]}});
                mp[ni[0]][nj[0]][ni[1]][nj[1]] = true;
            }

        }
    }



    cout << "No" << endl;
}
int main(){
    int w,h;
    while(true){
        cin  >> w >> h;
        if(h == 0 && w == 0) break;
        solve(h,w);

    }
    return 0;
}



Measured memory_bytes: 10116
f(a,b,u,c,d){u?d=(a^b)&u,u^=d&=-d,f(a,c=a^u&-u,u),f(c^d,b,u):printf("%d ",a);}main(n,a,b){scanf("%d%d%d",&n,&a,&b);__builtin_parity(a^b)?puts("YES"),f(a,b,(1<<n)-1):puts("NO");}

Measured memory_bytes: 896
#include <iostream>
#include <cmath>

using namespace std;

int main() {
  string s;
  cin >> s;
  int64_t result = 0;
  for (size_t i = 0; i < pow(2, s.size() - 1); ++i) {
    size_t flags = i;
    int64_t cur = s[0] - '0';
    for (size_t j = 1; j < s.size(); ++j) {
      bool keep = flags & 0x1;
      flags = flags >> 1;
      if (keep) {
        cur *= 10;
      } else {
        result += cur;
        cur = 0;
      }
      cur += s[j] - '0';
    }
    result += cur;
  }
  cout << result << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
  int n,a[100];
  cin>>n;
  for(int i=0;i<n;i++)
    cin>>a[i];
  for(int i=1;i<=n-1;i++){
    for(int k=0;k<n-1;k++)
      cout<<a[k]<<" ";
    cout<<a[n-1]<<endl;
    int v=a[i];
    int j=i-1;
    while(j>=0&&a[j]>v){
      a[j+1]=a[j];
      j--;
    }
    a[j+1]=v;
  }
  for(int i=0;i<n-1;i++)
    cout<<a[i]<<" ";
  cout<<a[n-1]<<endl;
  return 0;
}

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

const double pi  = 2 * acos(0.0);
const double eps = 1e-8;

#define REP(i,a,b) for(int i=(a); i<(b);++i)
#define rep(i,n) REP(i,0,n)
#define INF (1<<29)
#define INFLL (1LL<<62)

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

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

int main(void) {
  ios_base::sync_with_stdio(false); cin.tie(0);
  int n, k;
  bool hate[10];

  cin >> n >> k;

  rep(i, 10) hate[i] = false;
  rep(i, k) {
    int d; cin >> d;
    hate[d] = true;
  }

  for (int i = n; i <= 100000; i++) {
    string si = to_string(i);
    bool ok = true;
    for (auto c : si) {
      ok = ok && !hate[c-'0'];
    }
    if (ok) {
      cout << i << endl;
      break;
    }
  }

  return 0; 
}

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

int main(){
  int n,prime[1000001],key,lf=0;
  prime[0]=2;
  key=1;
  for(int i=3;i<=1000100;i+=2)
    {
      for(int j=2;j<=sqrt(i);j++)
	{
	  if(i%j == 0)
	    {
	      lf=1;
	      break;
	    }
	}
      if(lf == 1)
	{
	  lf=0;
	}
      else 
	{
	  prime[key]=i;
	  key++;
	}
    }

  while(cin >> n)
{
  int cou=0;
  for(int i=0;;i++)
    {
      if(prime[i] <= n)
	{
	  cou++;
	}
      else break;
    }

  cout << cou << endl;
 }
}

Measured memory_bytes: 1064
import numpy as np
s = input()
x, y = map(int, input().split())

i = 0
stock = 0
sl = []
while i < len(s):
    if s[i] == 'F':
        stock+=1
        i+=1
    else:
        sl.append(stock)
        stock = 0
        i+=1
else:
    sl.append(stock)

x-=sl[0]
ymove = sl[1::2]
xmove = sl[2::2]

dpx = np.zeros(16002).astype(int)
dpx[8000] = 1
for i in range(len(xmove)):
    idx = np.where(dpx==1)[0]
    ndpx = np.zeros(16002)
    ndpx[idx+xmove[i]] = True
    ndpx[idx-xmove[i]] = True
    dpx = ndpx

dpy= np.zeros(16002).astype(int)
dpy[8000] = 1
for i in range(len(ymove)):
    idx = np.where(dpy==1)[0]
    ndpy = np.zeros(16002)
    ndpy[idx+ymove[i]] = True
    ndpy[idx-ymove[i]] = True
    dpy = ndpy

if dpx[x+8000] == 1 and dpy[y+8000] == 1:
    print('Yes')
else:
    print('No')



Measured memory_bytes: 27772
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int mod = 1e9+7;

vector<int> num;
vector<int> a(50),b(50),c(50),d(50);
int n,m,q;
int ans = 0;

void solve(){
    if(num.size() == n){
        int can = 0;
        for(int i = 0; i < q; i++){
            if(num[b[i]]-num[a[i]] == c[i]) can += d[i];
        }
        if(can > ans) ans = can;
    }
    else{
        if(num.size() == 0){
            for(int i = 1; i <= m; i++){
                num.push_back(i);
                solve();
                num.pop_back();
            }
        }
        else{
            for(int i = num[num.size()-1]; i <= m; i++){
                num.push_back(i);
                solve();
                num.pop_back();
            }
        }
    }
}


int main(){
    cin >> n >> m >> q;
    for(int i = 0; i < q; i++){
        cin >> a[i] >> b[i] >> c[i] >> d[i];
        a[i]--;
        b[i]--;
    }
    solve();
    cout << ans << endl;
}

Measured memory_bytes: 3612
#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))
  
n,m,k=input2()
A=input_array()
B=input_array()
acc_A=[0]
acc_B=[0]

for i in range(n):
	acc_A.append(A[i]+acc_A[i])
for i in range(m):
	acc_B.append(B[i]+acc_B[i])

ans=0
tmp_m=m
for i in range(n+1):
	if acc_A[i]>k:
		break
	for j in range(tmp_m,-1,-1):
		if acc_B[j]<=k-acc_A[i]:
			ans=max(i+j,ans)
			tmp_m=j #探索開始地点の更新
			break
print(ans)

Measured memory_bytes: 48840
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;


int main()
{
	string s,t;
	cin>>s>>t;
	if(s[0]==t[2]&&s[1]==t[1]&&s[2]==t[0])cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
#define RF(x) freopen(x,"r",stdin)
#define WF(x) freopen(x,"w",stdout)
typedef long long LL;
using namespace std;
typedef pair<LL,LL> PLL;
typedef pair<int,int> PII;
const LL MOD = (LL)1e9+7;
const int MAXN = 1e5+5;
const LL INF = 1LL<<60;
const double eps = 1e-8;
const double PI=3.1415926535897932;

int mm[109][109];

int main(){
	LL a,b;cin>>a>>b;
	if(abs(a-b)<=1)printf("Brown\n");
	else printf("Alice\n");
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;

public class Main {
  public static void main(String[] args ){

    Scanner sc = new Scanner(System.in);

    int A = sc.nextInt();
    int B = sc.nextInt();

    int addAB = A + B;
    int subAB = A - B;
    int mulAB = A * B;

    System.out.println(Math.max(addAB, Math.max(subAB, mulAB)));
  }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1000000007;
using P = pair<int,int>;
 
signed main(){
  int n;
  cin >> n;
  map<P,int> ans;
  vector<int>a(n),b(n);
  
  for(int i=0 ;i<n ;i++){
    cin >> a[i] >> b[i];
  }
  int ANS = 0;
  for(int i=0; i<n ;i++){
    for(int j=0; j<n; j++){
      if(i != j){
        ans[make_pair(a[i]-a[j],b[i]-b[j])]++;
      }
    }
  }
  for(auto i:ans){
    ANS = max(ANS,i.second);
  }
  cout << n - ANS << endl;
}
        
      
  
    


Measured memory_bytes: 3608
#include <cstdio>
#include <vector>
#include <set>
#include <utility>
#include <algorithm>
using namespace std;
  
long long int n;
pair<long long int, long long int> microbe[300000]; // 微生物の値(b, a)のpair

/*
    k個の微生物をシャーレに入れられるか判定する。
    シャーレに入れられるかどうかは、
    選んだk個の微生物のaの値、bの値の集合をal, blとして、
    sum(al)/k <= min(bl) ⇔  sum(al) <= k * min(bl)が成り立つかで分かる。
    今、微生物を配列microbeの区間[0, t]からk個選ぶ時、
    microbeはbの値で降順に並べられているから、
    任意のblについてmin(bl) >= b(t)である。
    ∴ sum(al) <= k * b(t) <= k * min(bl) ー ?
        または k * b(t) <= sum(al) <= k * min(bl) ー ?
            が成り立つのは自明
    ここで、? が成り立つとき、それはb(t)&#8713;blであることを意味していて、
    [0, t]より小さな区間[0, s](k-1 <= s <= t-1)を予め考えていた時、
    その区間において既に? が成り立っているはずである。
    よって、区間[0, t]について? のみを考えれば良い。
    次にalについて、「sum(al)が最小となるal」をminalと定義した時、
    minalで? が成り立たないならば、任意のalについて? は成り立たない。
    以上から
    区間[0, t]でminalとb(t)と比較することをk-1 <= t <= n-1の範囲で繰り返せば良いことが分かる。
    今、[0, t]におけるminalをsetで管理しているなら、
    [0, t+1]におけるminalはsetにa(t+1)を追加した上で
    set内の最も大きい値を1つ削除すれば求まる。
    よって、setへの挿入、削除をn-k+1回繰り返すからO(nlogn)である。
 */
long long int check(long long int k) {
     long long int sum = 0; // sum(minal)
     multiset<long long int, greater<long long int> > order; // aを降順に並べる
   
     if (k == 0) return 1; // k=0の時常に成立
  
     /* とりあえず[0, k-1]におけるalは1通りしかないので
        sum(al)を求めて、これをsetで管理する */
     for (long long int i=0; i<k; i++) {
          sum += microbe[i].second;
          order.insert(microbe[i].second);
     }
     if (sum <= k*microbe[k-1].first) return 1; // 既に不等式が成り立つなら1を返す
  
     /* k <= t <= n-1について考える */
     for (long long int i=k; i<n; i++) { 
          /* [0, t]におけるsum(minal)を求める */
          sum += microbe[i].second;
          order.insert(microbe[i].second);
          sum -= *order.begin();
          order.erase(order.begin());
           
          if (sum <= k*microbe[i].first) return 1; //不等式が成り立つなら1を返す
     }
     return 0; //全てのtで成り立たないなら0を返す
}
  
int main() {
     long long int high;
     long long int low;

     scanf("%lld", &n);
     for (long long int i=0; i<n; i++) {
           long long int a;
           long long int b;

           scanf("%lld %lld", &a, &b);
           microbe[i] = make_pair(b, a); //b, aの順にpairにする
     }
     sort(microbe, microbe+n, greater<pair<long long int, long long int> >()); //bで降順にソート
  
     /* 区間(-1, n+1) ⇔  [0, n]をcheck関数で二分探索 */
     low = -1;
     high = n+1;
     while (high-low > 1) {
          long long int mid = (low+high)/2;
          if (check(mid)) low = mid;
          else high = mid;
     }
     printf("%lld\n", low);
}

Measured memory_bytes: 19672
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <ctime>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T> inline void print(T &a){
    rep(i,a.size()) cout << a[i] << " ";
    cout << "\n";
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << "\n";}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
const int mod = 1e9 + 7;
//const int mod = 998244353;

int main(){
	ll a; string b; cin >> a >> b;
	ll t = (b[0]-'0')*100 + (b[2]-'0')*10 + (b[3]-'0');
	ll ans = a * t / 100;
	cout << ans << endl;
}


Measured memory_bytes: 3616
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
using namespace std;

int main() {
  int64_t n, k;
  cin >> n >> k;

  vector<pair<int, int>> c;
  c.reserve(n);
  for (int64_t i = 0; i < n; ++i) {
    int a, b;
    cin >> a >> b;

    c.emplace_back(make_pair(a, b));
  }
  sort(c.begin(), c.end());
  
  for (int64_t i = 0; i < n; ++i) {
    const auto &t = c[i];
    if (t.second >= k) {
      cout << t.first << endl;
      break;
    } else {
      k -= t.second;
    }
  }
  return 0;
}


Measured memory_bytes: 1024
M, D = map(int, input().split())

ans = 0
for m in range(1, M+1):
  for d1 in range(2, 10):
    if m % d1 == 0:
      d10 = m // d1
      if 2 <= d10 <= 9 and 10*d10 + d1 <= D:
        ans += 1

print(ans)

Measured memory_bytes: 3060
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, SP):
    SP = [(i+1, s, int(p)) for i, (s, p) in enumerate(SP)]
    SP.sort(key=lambda x: x[2], reverse=True)
    SP.sort(key=lambda x: x[1])

    for i, _, _ in SP:
        print(i)


def main():
    N = read_int()
    SP = [read_str_n() for _ in range(N)]
    slv(N, SP)


if __name__ == '__main__':
    main()


Measured memory_bytes: 7772
#include<bits/stdc++.h>
#define inf ((int)(1e9))
using namespace std;
int n,m,s,t;
vector<int> graph[100005];
int main()
{
	cin>>n>>m;

	for(int i=0;i<m;i++)
	{
		int u,v;
		cin>>u>>v;
		--u,--v;
		graph[u].push_back(v);
	}
	cin>>s>>t;
	--s,--t;
	vector<int> d(n*3,inf);
	d[s]=0;
	queue<int> q;
	q.push(s);
	while(!q.empty())
	{
		int x=q.front();
		q.pop();
		int now=x%n;
		for(int i=0;i<graph[now].size();i++)
		{
			int dd=d[x]+1;
			int y=graph[now][i]+n*(dd%3);
			if(d[y]!=inf)
				continue;
			d[y]=dd;
			q.push(y);
		}
	}
	cout<<(d[t]==inf?-1:(d[t]/3))<<endl;
	return 0;
}


Measured memory_bytes: 6912