akhauriyash/Code-Regression huggingface dataset:
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath> // sqrt
#define _GLIBCXX_DEBUG // check []
#define DIVISOR 1000000007

using namespace std;
typedef pair<int,int> pii;
typedef pair<int64_t, int64_t> pII;

template<typename T>
void cins(vector<T>& arr) { for(T& e: arr) cin >> e; }

#ifdef DEBUG
#define debug(fmt, ...) \
    printf("[debug: %s] " fmt, __func__, __VA_ARGS__)
#define ps(arr) \
    debug("size %ld: ", arr.size()); \
    for(auto e: arr) cout << e << " "; \
    cout << endl;
#else
#define debug(fmt, ...)
#define ps(arr)
#endif

int get_head(int val) {
    while(val>=10) {
        val /= 10;
    }
    return val;
}

int main(void) {
    int num;
    cin >> num;
    map<pii, int> counts;
    for(int n = 1; n <= num; n++) {
        pii p = make_pair(get_head(n), n%10);
        counts[p]++;
    }

    int64_t sum = 0;
    for(int val = 1; val <= num; val++) {
        pii p = make_pair(val%10, get_head(val));
        sum += counts[p];
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 3608
n = int(input())
h = list(map(int, input().split()))

dp = [0, abs(h[1]-h[0])]
for i in range(2, n):
  dp.append(min(dp[-2]+abs(h[i]-h[i-2]), dp[-1]+abs(h[i]-h[i-1])))
print(dp[-1])

Measured memory_bytes: 20620
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const double EPS = 1e-8;

template<typename T> T chmax(T& a, const T& b){return a = (a > b ? a : b);}
template<typename T> T chmin(T& a, const T& b){return a = (a < b ? a : b);}

struct Sieve {
    vector<int> primes;
    vector<int> _isPrime;
    Sieve(int n) : _isPrime(n+1, 1) {
        buildPrimes();
    }
    void buildPrimes() {
        _isPrime[0] = _isPrime[1] = 0;
        int n = _isPrime.size();
        REP(i, 2, n) {
            if(_isPrime[i]) {
                primes.push_back(i);
                for(int j = i+i; j < n; j += i) _isPrime[j] = false;
            }
        }
    }
    bool isPrime(int i) {
        return _isPrime[i];
    }
};

int main(){
    const int n = 1e5+10;
    Sieve seive(n);
    vector<int> sum(n);
    rep(i, n) {
        if(i&1) if(seive.isPrime(i) && seive.isPrime((i+1)/2)) sum[i] = 1;
    }
    rep(i, n-1) sum[i+1] += sum[i];
    int q;
    cin >> q;
    rep(i, q) {
        int l, r;
        cin >> l >> r;
        --l;
        cout << sum[r] - sum[l] << endl;        
    }
    return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
const ll INF=1e18;
const int MOD=1e9+7;
const double pi=acos(-1);


int main(){
  string s;
  cin >> s;
  ll a=0,b=0;
  rep(i,s.size()){
    if(s[i]=='0')a++;
    else b++;
  }
  cout << min(a,b)*2 << endl;
  
}


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

using namespace std;

#define int long long
#define endl '\n'
#define maxn 100010
const int MOD = 1000000007;

void solve() {
    int x, k, d;
    cin >> x >> k >> d;

    x = abs(x);
    int tp = x / d;
    x -= min(tp, k) * d;
    k -= min(k, tp);

    if (k & 1)x -= d;
    cout << abs(x) << endl;
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
//    cin >> t;

    while (t--)
        solve();
    return 0;
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 1LL << 30;
int MOD = 1e9+7;
main(){
    int H,W;
    cin >> H >> W;
    string field[H];
    for(int i = 0;i < H;i++){
        cin >> field[i];
    }
    int dx[] = {-1,0,1,-1,1,-1,0,1};
    int dy[] = {-1,-1,-1,0,0,1,1,1};
    for(int i = 0;i < H;i++){
        for(int j = 0;j < W;j++){
            if(field[i][j] == '#')continue;
            int cnt = 0;
            for(int k = 0;k < 8;k++){
                int x = j + dx[k],y = i + dy[k];
                if(x < 0 || x >= W || y < 0 || y >= H)continue;
                if(field[y][x] == '#')cnt++;
            }
            field[i][j] = '0' + cnt;
        }
    }
    for(int i = 0;i < H;i++)cout << field[i] << endl;
}

Measured memory_bytes: 256
function Main(input) {
  input = input.split(" ");
  let a = parseInt(input[0], 10);
  let b = parseInt(input[1], 10);
  if ((a * b) & 1) {
    console.log("Odd");
  } else {
    console.log("Even");
  }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include<bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define sz 200009
ll n,m,i,j,k,l,t,arr[sz],brr[sz],crr[sz];
vector<ll>v;
int main()
{
    scanf("%lld",&t);
    if(t>=400 && t<600)
        printf("8\n");
    else if(t>=600 && t<800)
        printf("7\n");
    else if(t>=800 && t<1000)
        printf("6\n");
    else if(t>=1000 && t<1200)
        printf("5\n");
    else if(t>=1200 && t<1400)
        printf("4\n");
    else if(t>=1400 && t<1600)
        printf("3\n");
    else if(t>=1600 && t<1800)
        printf("2\n");
    else
        printf("1\n");
    return 0;
}


Measured memory_bytes: 3688
#include <iostream>
#include <cstdio>
#define NMAX 100000
using namespace std;
int main(){
	int N,A[NMAX] = {},B[NMAX] = {},sup = 0,ans;
	scanf("%d",&N);
	for (int i = 0; i < N; ++i) {
		scanf("%d",&A[i]);
		B[A[i]]++;
		if(B[A[i]] >=2){
			sup++;
		}
	}
	ans = N - (sup/2*2 + sup%2 * 2);
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<stdlib.h>
#include<stdio.h>
using namespace std;
int top=0,s[100000];

int pop(){
  top--;
  return s[top];
}

void push(int x){
  s[top]=x;
  top++;
}

int main(){
  int a,b;
  char n[100];
  while(scanf("%s",n)!=EOF){
    if(n[0]=='+'){
      a=pop(),b=pop(),push(a+b);
    }else if(n[0]=='-'){
      a=pop(),b=pop(),push(b-a);
    }else if(n[0]=='*'){
      a=pop(),b=pop(),push(a*b);
    }else{
      push(atoi(n));
    }
  }
  cout<<s[0]<<endl;
  return 0;
}

Measured memory_bytes: 3256
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).size()
#define MAX(list) std::max(list)
#define MIN(list) std::min(list)
#define YESNO(cond,yes,no){cout <<((cond)?(yes):(no))<<endl; }

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

using ll = long long;
using namespace std;
ll mod = 1'000'000'007;

const int INF = 1'050'000'000;

int main() {
    string s, t;
    cin >> s >> t;
    sort(ALL(s));
    sort(ALL(t), [](auto c1, auto c2) {return c1 > c2; });
    YESNO(s < t, "Yes", "No");
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
	string S;
	cin >> S;
	int num = 0;
	for (int i = 0; i < S.size(); ++i)
	{
		num += S[i]-'0';
	}
	if(num%9 == 0) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 3760
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
using namespace std;

int main(){
    int N,K;
    cin >> N>>K;
    int h[N];
    int c=0;
    for(int i=0;i<N;++i){
        cin >>h[i];
        if(h[i]>=K){
            c+=1;
        }
    }
    cout << c;
    
    return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<vector>
#include <cstdlib>
#include<cctype>
#include <algorithm>    
using namespace std;
typedef long long ll;
#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--)
#define VCOUT(num) for(auto& num:vec)
#define GET_ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0]))
#define LLINF 1000000000000000000//10^18
#define INF 1000000000000 //10^12
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000
#define MAX 100
#define MX 10

//int main(int argc, char const* argv[]){

int main(){ 
    vector<int>vec;
     vector<char>cvec;
      vector<string>svec;
    
   int a[MAXR],b,x,y,z,count=0;
   string answer;
   REP(i,3)cin>>a[i];
   sort(a,a+3);
  
   
   
   
    
    cout<<a[0]<<" "<<a[1]<<" "<<a[2]<<endl;
  
    return 0;
}


Measured memory_bytes: 3096
from collections import Counter

N=int(input())
A=list(map(int,input().split()))
Q=int(input())
#BC=[]
#for i in range(Q):
#    BC.append(list(map(int,input().split())))
A_sum=sum(A)
A_count=Counter(A)

for i in range(Q):
    B,C=(map(int,input().split()))
    A_sum+=(C-B)*A_count[B]
    A_count[C]+=A_count[B]
    A_count[B]=0
    print(A_sum)

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

using namespace std;

int main()
{
  int n;
  long long sum=0;
  cin>>n;
  for(int i=1;i<=n;i++){
    if(i%3==0||i%5==0)
    {
    }
  	else
    {
      sum+=i;
    }
  }
  cout<<sum<<endl;
  return 0;
}


Measured memory_bytes: 3632
N = int(input())
a = list(map(int, input().split()))

is_found = False
current = 1
num_of_broken_bricks = 0
for ai in a:
    if ai == current:
        is_found = True
        current += 1
    else:
        num_of_broken_bricks += 1

if not is_found:
    print(-1)
    exit()

print(num_of_broken_bricks)


Measured memory_bytes: 24744
#include <stdio.h>
#include <stdlib.h>

int main(){
    int N,M,X,Y;
    scanf("%d %d %d %d",&N,&M,&X,&Y);
    int * x = malloc(sizeof(int)*N);
    int * y = malloc(sizeof(int)*M);
    int i, x_max = X, y_min = Y;
    for(i=0;i<N;i++){
        scanf("%d", &x[i]);
        if(x_max < x[i]) x_max = x[i];
    }
    for(i=0;i<M;i++){
        scanf("%d", &y[i]);
        if(y_min > y[i]) y_min = y[i];
    }

    if(x_max < y_min){
        printf("No War");
    } else {
        printf("War");
    }
    return 0;
}

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

#define li long long int
#define rep(i, to) for (li i = 0; i < ((li)(to)); i++)
#define repp(i, start, to) for (li i = (li)(start); i < ((li)(to)); i++)


li n, m;
map<li, vector<li>> maps;

li pi[100001];
li yi[100001];

int main(void)
{
    cin >> n >> m;
    rep(i, m) {
        li p, y;
        cin >> p >> y;
        if (maps.find(p) != maps.end()) {
            maps[p].push_back(y);
        } else {
            maps[p] = vector<li>(1, y);
        }
        pi[i] = p;
        yi[i] = y;
    }

    map<li, map<li, li>> new_map;
    for (auto& e : maps) {
        sort(e.second.begin(), e.second.end());
        map<li, li> val_map;
        for (int i = 0; i < e.second.size(); ++i) {
            val_map[e.second[i]] = i;
        }
        new_map[e.first] = val_map;
    }

    rep(i, m) {
        printf("%06lld%06lld\n", pi[i], new_map[pi[i]][yi[i]] + 1);
    }


    return 0;
}


Measured memory_bytes: 29568
N,K = gets.chomp.split.map(&:to_i)
A = gets.chomp.split.map(&:to_i)
gen = []
gen[0] = 1
cnt = [0] * (N + 1)
count = 0

while count < K
  p = A[gen[count]-1]
  gen[count+1] = p
  count += 1
  cnt[p] += 1
  if cnt[p] == 2
    q = gen.find_index(p)
    r = gen.rindex(p)
    s = (K - q) % (r - q) + q
    puts gen[s]
    exit
  end
end

puts gen[K]

Measured memory_bytes: 31584
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>

using namespace std;

void vec_cout(vector<int> &vec){
    for(int i=0; i<vec.size(); i++){
        if (i!=0){
            cout << ' ';
        }
        cout << vec[i];
    }
    cout << endl;
}

int main(){
    int N;
    cin >> N;
    vector<int> h(N,0);
    for(int i=0; i<N; i++){
        cin >> h[i];
    }

    vector<int> dp(N,0);
    dp[1]=abs(h[1]-h[0]);
    for(int i=2; i<N; i++){
        dp[i]=min(dp[i-2]+abs(h[i]-h[i-2]), dp[i-1]+abs(h[i]-h[i-1]));
    }
    //vec_cout(dp);
    cout << dp[N-1] << endl;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include<vector>
#include<iomanip>

using namespace std;

long long int combination(long long int n, long long int r){
    if (n == r || r == 0)  return 1;
    else  return combination(n, r - 1) * (n - r + 1) / r;
}

int main(void){
    
   int n;
   cin>>n;
   double sum = 0.0;

   for(int i=0;i<n;i++){
       double a;
       cin>>a;
       sum += 1.0/a;

   }

   double ans;
   ans = 1.0/sum;
   cout<<setprecision(10)<<ans<<endl;    
    return 0;

}

Measured memory_bytes: 256
h,w,d=map(int,input().split())
a=[list(map(int,input().split())) for _ in range(h)]
q=int(input())
lr=[list(map(int,input().split())) for _ in range(q)]
arys=[[] for i in range(d)]
sumarys=[[0] for i in range(d)]
biarys=[[] for i in range(d)]
for i in range(h):
  for j in range(w):
    x=a[i][j]%d
    arys[x].append((a[i][j],i,j))
for i in range(d):
  arys[i].sort(key=lambda x:x[0])
  tmp=0
  y,pi,pj=arys[i][0]
  biarys[i].append(y)
  for j in range(1,len(arys[i])):
    y,ni,nj=arys[i][j]
    biarys[i].append(y)
    tmp+=abs(pi-ni)+abs(pj-nj)
    sumarys[i].append(tmp)
    pi,pj=ni,nj
from bisect import bisect_left
for l,r in lr:
  x=l%d
  li=bisect_left(biarys[x],l)
  ri=bisect_left(biarys[x],r)
  print(sumarys[x][ri]-sumarys[x][li])


Measured memory_bytes: 63468
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define endl '\n'
//cout.setf(ios::fixed); cout.precision(18)
typedef long long ll;
typedef long double ld;

int main(){
	cin.tie(0);ios_base::sync_with_stdio(0);
	int n;
	ld t,a;
	cin>>n>>t>>a;
	ld b[n];
	ld mn = 1e9;
	rep(i,0,n){
		ld x;
		cin>>x;
		b[i] = fabs(t-x*(0.006)-a);
		mn = min(mn,b[i]);
	}
	rep(i,0,n){
		if(b[i]==mn){
			cout<<i+1<<endl;
			return 0;
		}
	}
}

Measured memory_bytes: 256
package main

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

// input scanner
var sc = bufio.NewScanner(os.Stdin)

const (
	initialBufSize = 10e4
	maxBufSize     = 10e6
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextInt64() int64 {
	a, _ := strconv.ParseInt(next(), 10, 64)
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

// util
func max(l []int) (int, int) {
	idx := 0
	ans := l[idx]
	for i, n := range l {
		if n > ans {
			idx = i
			ans = n
		}
	}
	return idx, ans
}

func min(l []int) (int, int) {
	idx := 0
	ans := l[idx]
	for i, n := range l {
		if n < ans {
			idx = i
			ans = n
		}
	}
	return idx, ans
}

func check(s string) bool {
	n := len(s)
	ss := make([]string, n)
	for i := 0; i < len(s); i++ {
		ss[i] = s[n-i-1 : n-i]
	}
	rs := strings.Join(ss, "")
	if s == rs {
		return true
	}
	return false
}

// main
func main() {
	buf := make([]byte, initialBufSize)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords)
	s := next()
	n := len(s)
	if !check(s) {
		fmt.Println("No")
		return
	}
	if !check(s) {
		fmt.Println("No")
		return
	}
	if !check(s[0:((n - 1) / 2)]) {
		fmt.Println("No")
		return
	}
	if !check(s[((n+3)/2 - 1):n]) {
		fmt.Println("No")
		return
	}
	fmt.Println("Yes")
}


Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<string>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= (int)end; --i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return 0;}
template<typename T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return 0;}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    cin >> S;
    vector<string> days = {"SUN","MON","TUE","WED","THU","FRI","SAT"};
    rep(i, 0, 7) {
        if (S == days[i]) {
            rep(j, 1, 8) {
                if (days[(i + j) % 7] == "SUN") {
                    cout << j << endl;
                    return 0;
                }
            }
        }
    }
    return 0;
}

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

int main(){
	while(1){
		string bun;
		int N;
		
		cin >> bun;
		if(bun == "-") break;
		cin >> N;
		for(int i=0; i<N; ++i){
			int x;
			cin >> x;
			
			string add = bun.substr(0,x);
			bun = bun+add;
			bun = bun.substr(x, bun.size());
		}
		cout << bun << endl;
	}
	return 0;
	
}



Measured memory_bytes: 3208
n = int(input())
h = [list(map(int, input().split())) for _ in range(n)]
dp = [[0, 0, 0] for _ in range(2)]
for i, (a, b, c) in enumerate(h):
    dp[i % 2][0] = a + max(dp[1 - i % 2][1], dp[1 - i % 2][2])
    dp[i % 2][1] = b + max(dp[1 - i % 2][0], dp[1 - i % 2][2])
    dp[i % 2][2] = c + max(dp[1 - i % 2][0], dp[1 - i % 2][1])
print(max(dp[i % 2]))


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

#define ll long long

int main()
{

    string str;

    cin>>str;


        int r=0; ll s = 0;
        int l=str.size();

        for(int i=0;i<l;i++)
        {
        s=r*10+(str[i]-'0');

        r=s % 9;
        }


       if(r==0) cout<<"Yes"<<endl;

        else

        cout<<"No"<<endl;

    return 0;
}



Measured memory_bytes: 3704
K, N = map(int, input().split())
A = list(map(int, input().split()))

m = 0 
for i in range(N - 1): 
        m = max(m, A[i + 1] - A[i])
    
m = max(m, K - A[N - 1] + A[0])

print(K - m)

Measured memory_bytes: 26436
#include <cstdio>
#include <utility>
#include <vector>
#include <complex>
#include <cmath>
#include <algorithm>
#include <set>

using namespace std;

static const double EPS=1e-12;
static const double INF=1e24;

using Point=complex<double>;
using Plane=vector<Point>;
using Polygon=vector<Point>;

namespace std {
    bool operator<(const Point &a, const Point &b) {
        return real(a)!=real(b)? real(a)<real(b) : imag(a)<imag(b);
    }
}

double cross_prod(const Point &a, const Point &b) {
    return imag(conj(a)*b);
}

double dot_prod(const Point &a, const Point &b) {
    return real(conj(a)*b);
}

struct Line: public pair<Point, Point> {
    Line() {}
    Line(const Point &a, const Point &b) {
        first = a;
        second = b;
    }
};

struct Circle {
    Point p;
    double r;
    Circle() {}
    Circle(const Point &p, const double r): p(p), r(r) {}
};

vector<Point> get_ctangents(Circle c1, Circle c2) {
    Point v=c2.p-c1.p;
    double d=abs(v);

    vector<Point> g;
    if (abs(d) < EPS)
        return g;

    double R=max(c1.r, c2.r), r=min(c1.r, c2.r);
    if (R+r-d < -EPS) {
        double t=acos((R+r)/d);
        g.push_back(c1.p+(c1.r/d*v)*polar(1.0, t));
        g.push_back(c1.p+(c1.r/d*v)*polar(1.0, -t));
    } else if (R+r-d < EPS) {
        g.push_back(c1.p+c1.r/d*v);
    }

    if (R-r-d < -EPS) {
        double t=acos((c1.r-c2.r)/d);
        g.push_back(c1.p+(c1.r/d*v)*polar(1.0, t));
        g.push_back(c1.p+(c1.r/d*v)*polar(1.0, -t));
    } else if (R-r-d < EPS) {
        if (c1.r < c2.r) {
            g.push_back(c2.p-c2.r/d*(c2.p-c1.p));
        } else {
            g.push_back(c1.p+c1.r/d*(c2.p-c1.p));
        }
    }

    sort(g.begin(), g.end());
    return g;
}

int main() {
    double x, y, r;
    scanf("%lf %lf %lf", &x, &y, &r);
    Circle c1(Point(x, y), r);

    scanf("%lf %lf %lf", &x, &y, &r);
    Circle c2(Point(x, y), r);

    vector<Point> ctangents=get_ctangents(c1, c2);
    for (const Point &t: ctangents)
        printf("%.9f %.9f\n", real(t), imag(t));

    return 0;
}

Measured memory_bytes: 3116
#include <algorithm>
#include <complex>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <vector>
#include <cctype>

using std::cin;
using std::cout;
using std::endl;

using std::string;
using std::to_string;
using std::vector;
using std::set;
using std::queue;
using std::priority_queue;

using std::min;
using std::max;
using std::sort;
using std::abs;

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

    string ans;
    ans.push_back(toupper(s1.front()));
    ans.push_back(toupper(s2.front()));
    ans.push_back(toupper(s3.front()));
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 888
#include<iostream>
using namespace std;
#define MAX 100000
typedef long long llong;

int n, k;
llong T[MAX];

int check(llong P){
    int i=0;
    for(int j=0; j<k; j++){
        llong s=0;
        while(s + T[i] <= P){
            s += T[i];
            i++;
            if (i==n) return n;
        }
    }
    return i;
}

int solve(){
    llong left =0;
    llong right = 100000*10000;
    llong mid;
    while (right-left>1){
        mid=(left+right)/2;
        int v=check(mid);
        if(v>=n) right=mid;
        else left=mid;
    }
    return right;
}

main(){
    cin>>n>>k;
    for(int i=0; i<n; i++) cin>>T[i];
    llong ans=solve();
    cout<<ans<<endl;
}


Measured memory_bytes: 3892
#include "bits/stdc++.h"
#include "math.h"
#include "string.h"
#include "algorithm"
 
using namespace std;
typedef int64_t ll;
typedef vector<int64_t> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SIZE(a) int((a).size())


vector<pair<ll,int>> factorize(ll n) {
    vector<pair<ll,int>> res;
    for (ll i = 2; i * i <= n; i++) {
        if (n % i != 0) continue;
        res.emplace_back(i,0);
        while (n % i == 0) {
            n /= i;
            res.back().second++;
        } 
    }
    if (n != 1) res.emplace_back(n,1);
    return res;
}
int main (){
  ll n;cin>>n;
  vb fac(100001,false);
  vll sum(100001,0);
  FOR(i,2,100001){
    vector<pair<ll,int>> v=factorize(i);
    if(v.size()==1&&v[0].second==1){fac[i]=true;}
  }
  FOR(i,2,100001){
    sum[i]=sum[i-1];
    if(i%2==0)continue;
    if(fac[i]&&fac[(i+1)/2]){sum[i]++;}
  }
  FOR(i,0,n){
    ll l,r;cin>>l>>r;
    cout<<sum[r]-sum[l-1]<<endl;
  }
  
}

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

typedef long long int ll;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define sz(x) int(x.size())
const ll mod = 1000000007;
const ll INF = 10010010010010010;


int main() {
    int n; cin >> n;
    int a[n]; rep(i,n) cin >> a[i];
    int ans = 0, cnt = 0;
    rep(i,n-1) {
        if (a[i] >= a[i+1]) {
            cnt++;
        } else {
            ans = max(ans,cnt);
            cnt = 0;
        }
    }
    cout << max(ans, cnt) << endl;
    return 0;
}


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

int main(){
	int zu[52][52],w,h,i,j,flag,land;
	
	while(0<=scanf("%d%d",&h,&w)){
		if(w==0&&h==0)break;
		
		memset(zu,0,sizeof(zu));
		
		for(i=1;i<=w;i++){
			for(j=1;j<=h;j++){
				scanf("%d",&zu[i][j]);
			}
		}
		
		flag=1;
		land=1;
		while(flag!=0){
			++land;
			flag=0;
			for(i=1;i<=w;i++){
				for(j=1;j<=h;j++){
					if(zu[i][j]==1){
						zu[i][j]=land;
						flag=1;
						break;
					}
				}
				if(flag==1)break;
			}
			
			while(flag==1){
				flag=2;
				for(i=1;i<=w;i++){
					for(j=1;j<=h;j++){
						if(zu[i][j]!=1)continue;
						if(zu[i+1][j]==land || zu[i-1][j]==land || zu[i][j+1]==land || zu[i][j-1]==land ||
							zu[i+1][j+1]==land|| zu[i+1][j-1]==land||zu[i-1][j+1]==land||zu[i-1][j-1]==land){
							zu[i][j]=land;
							flag=1;
						}
					}
				}
			}
		}
		for(i=1;i<=w;i++){
			for(j=1;j<=h;j++){
//				printf("%d ",zu[i][j]);
			}
//			printf("\n");
		}
		
		
		printf("%d\n",land-2);
	}
	return 0;
}

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

namespace ConsoleApp2
{
    public class Program
    {
        static long mod = (long)Math.Pow(10, 9) + 7;

        public static void Main(string[] args)
        {
            long N = int.Parse(Console.ReadLine());
            int[] ans = new int[N];

            for (int i = 0; i < N-1; i++)
            {
                string[] stringTrainProperties = Console.ReadLine().Split(' ');
                int C = int.Parse(stringTrainProperties[0]);
                int S = int.Parse(stringTrainProperties[1]);
                int F = int.Parse(stringTrainProperties[2]);

                for (int j = 0; j <= i; j++)
                {
                    if (ans[j] < S) ans[j] = S;
                    ans[j] += (F-ans[j]%F)%F;
                    ans[j] += C;
                }
            }


            foreach (var item in ans)
            {
                Console.WriteLine(item);
            }
            Console.ReadLine();
        }
    }
}


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

int main()
{
    int n, minHeight, friends, counter=0;
    cin >> n >> minHeight;
    for(int i=0; i<n; ++i)
    {
        cin >> friends;
        if(friends >= minHeight)
            ++counter;
    }
    cout << counter;
    return 0;
}


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

using namespace std;

int main()
{
    int n;
    while (cin >> n) {
        bool f = false;
        for (int i = 0; i <= 9; ++i) {
            if (n >> i & 1) {
                printf(f ? " %d" : "%d", 1 << i);
                f = true;
            }
        }
        printf("\n");
    }
}

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

int main() {
  vector<vector<int>> a(3, vector<int>(3));
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> a.at(i).at(j);
    }
  }
  int n;
  cin >> n;
  vector<vector<int>> con(3, vector<int>(3, 0));
  vector<int> b(n);
  for (int i = 0; i < n; i++) {
    cin >> b.at(i);
  }
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      for (int k = 0; k < n; k++) {
        if (a.at(i).at(j) == b.at(k)) {
          con.at(i).at(j) = 1;
        }
      }
    }
  }
  bool res = false;
  vector<int> d = {1, 1, 1};
  for (int i = 0; i < 3; i++) {
    if (con.at(i) == d) {
      res = true;
    }
    if (con.at(0).at(i) == 1 && con.at(1).at(i) == 1 && con.at(2).at(i) == 1) {
      res = true;
    }
  }
  if (con.at(0).at(0) == 1 && con.at(1).at(1) == 1 && con.at(2).at(2) == 1) {
    res = true;
  }
  if (con.at(0).at(2) == 1 && con.at(1).at(1) == 1 && con.at(2).at(0) == 1) {
    res = true;
  }
  if (res) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
PROGRAM piyo
      IMPLICIT NONE
      integer :: n
      
      read*,n
      
      n = n - n/10*10
      
      select case( n )
        case( 2,4,5,7,9 )
          print*,'hon'
        case( 0,1,6,8 )
          print*,'pon'
        case( 3 )
          print*,'bon'
          
      end select
      
      
      
      
      END PROGRAM

Measured memory_bytes: 2796
#include <bits/stdc++.h>
typedef long long int lint;

#define PI acos(-1)
#define INF64 1LL << 60
#define INF32 1 << 29
#define all(a) (a).begin(), (a).end()
#define INV ((long long int)1000000007)

using namespace std;

void execute()
{
	int N;
	cin >> N;

	vector<int> data(N);
	for (int i = 0; i < N; i++)
	{
		int tmp;
		cin >> data[i];
		data[i]--;
	}

	int ans = 0;
	for (int i = 0; i < N - 1; i++)
	{
		if (data[i] == i)
		{
			swap(data[i], data[i + 1]);
			ans++;
		}
		else
		{
			if (data[i + 1] == i + 1)
			{
				if (data[i + 2] != i + 1)
				{
					swap(data[i + 1], data[i + 2]);
					ans++;
				}
				else
				{
					swap(data[i], data[i + 1]);
					ans++;
				}
			}
		}
	}

	if (data[N - 1] == N - 1 || data[N - 2] == N - 2)
		ans++;

	cout << ans << endl;

	return;
}

int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	execute();

	int stop;
	cin >> stop;

	return 0;
}

Measured memory_bytes: 640
N = int(input())
h = list(map(int,input().split()))
e = []
for i in range(0,N):
    if h[i] % 2 == 0:
        e.append(h[i])
c = 0
for j in range(0,len(e)):
    if e[j] % 3 == 0 or e[j] % 5 == 0:
        c += 1
if c == len(e):
    print('APPROVED')
else:
    print('DENIED')

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include<map>
#include<string>
#include<algorithm>
#include<sstream>
#include<cmath>
#include<typeinfo>
#include<queue>
using namespace std;
int main() {
	int H, W;
	cin >> H >> W;
	vector<string> a(H);
	vector<bool> whitex(W, true);
	vector<bool> whitey(H, true);
	vector<int>colomn, raw;
	for (int i = 0; i < H; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (a[i][j] == '#'){
				whitex[j] = false;
				whitey[i] = false;
				}

		}
	}
	for (int i = 0; i < H; i++) {
		if (whitey[i])raw.push_back(i);
	}
	for (int j = 0; j < W; j++) {
		if (whitex[j])colomn.push_back(j);
	}
	for (int k = 0; k < raw.size(); k++) {
		for (int j = 0; j < W; j++) {
			a[raw[k]][j]='0';
		}
	}
	for (int k = 0; k <colomn.size(); k++) {
		for (int i = 0; i < H; i++) {
			a[i][colomn[k]]='0';
		}
	}
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (a[i][j] != '0') {
				cout << a[i][j];
			}
		}
		int flag = false;
		for (int j = 0; j < W; j++) {
			if (a[i][j] != '0') {
				flag = true;
			}
		}
		if (flag) {
			cout << endl;
		}
	}
}

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

using lint = long long;

int main() {
    lint K;
    cin >> K;

    int N = 50;
    vector<lint> ans(N);
    for (int i = 0; i < N; i++) {
        ans[i] = i;
    }

    lint rep = K/N;
    lint res = K%N;
    for (int i = 0; i < N; i++) {
        ans[i] += rep;
    }
    for (int i = 0; i < res; i++) {
        ans[i] += N;
        for (int j = 0; j < N; j++) {
            if (j != i) {
                ans[j] -= 1;
            }
        }
    }

    cout << N << endl;
    for (int i = 0; i < N; i++) {
        if (i > 0) {
            cout << ' ';
        }
        cout << ans[i];
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
from sys import stdin,setrecursionlimit
s = stdin.readline().rstrip()
if s != s[::-1]:
    print("No")
    exit()
mae = s[:len(s)//2]
ushiro = s[(len(s)+1)//2:]
if mae != mae[::-1]:
    print("No")
    exit()
if ushiro != ushiro[::-1]:
    print("No")
    exit()
print("Yes")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int h,w;
    cin>>h>>w;
    string s;
    for (int i=0;i<h;i++) {
        for (int j=0;j<w;j++) {
            cin>>s;
            if (s=="snuke") {
                char c=j+65;
                cout<<c<<i+1<<endl;
            }
        }
    }
}

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

#define int          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;
int n,a[200005],ans;
void solve(){
    cin>>n;
    rep(i,0,n){
        cin>>a[i];
    }
    if(a[0]){
        cout<<-1<<endl;
        return;
    }
    rep(i,1,n){
        if(a[i]==a[i-1]+1){
            ans++;
        }
        else if(a[i]>a[i-1]+1){
            cout<<-1<<endl;
            return;
        }
        else{
            ans+=a[i];
        }
    }
    cout<<ans<<endl;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 1792
#include<cstdio>
#include<cstring>
#include<cmath>
#include<bitset>
#include<iostream>
#include<algorithm>
#include<string>
#include<utility>
#include<tuple>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<numeric>
#include<functional>
#include<iomanip>
#include<random>

#define IOS ios::sync_with_stdio(false),cin.tie(0)
#define REP(i,n) for(int i = 0;i < n;i++)
#define FOR(i,a,b) for(int i = a;i < b;i++)
#define MEM(a,b) memset(a,b,sizeof(a))
#define ALL(x) (x).begin(),(x).end()
#define LMAX 9223372036854775807
#define LMIN -9223372036854775808

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ull, ull> UP;
typedef tuple<int, int, int> T;

struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) {}
	void unionSet(int x, int y) {
		x = root(x), y = root(y);
		if (x != y) {
			if (data[y] < data[x])swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};

ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	int k = a % b;
	if (k == 1)return 1;
	if (k == 0)return b;
	int ans = gcd(b, k);
	return ans;
}
ll digisum(ll a) {
	int sum = 0;
	while (a) {
		sum += a % 10;
		a /= 10;
	}
	return sum;
}
ll countpow(ll a, ll b) {
	int ans = 0;
	if (b == 0)return -1;
	while (1) {
		if (a % b == 0) {
			a /= b;
			ans++;
		}
		else break;
	}
	return ans;
}


int main() {
	int n;
	cin >> n;
	ll a[87];
	a[0] = 2, a[1] = 1;
	FOR(i, 2, 87) {
		a[i] = a[i - 1] + a[i - 2];
	}
	cout << a[n] << endl;
}



Measured memory_bytes: 384
N = int(input())
s = [[0 for i in range(9)]for i in range(9)]
for k in range(1,N+1):
    if k % 10 == 0:
        continue
    a = list(str(k))
    s[int(a[0])-1][int(a[len(a)-1])-1] += 1
p = 0
for i in range(1,10):
    for j in range(1,10):
        p = p + s[i-1][j-1]*s[j-1][i-1]
print(p)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int repeat(int n,int way){
  //way 0=U,1=23
  string X;
  switch (way) {
    case 0: X='U';
    break;
    case 1: X='D';
    break;
    case 2: X='L';
    break;
    case 3: X='R';
    break;
    default:break;
  }
  for(int i;i<n;i++){
    cout<<X;
  }
}
int main()
{
    int sx, sy, tx, ty , x , y,a;
    cin>>sx>>sy>>tx>>ty;
    x=tx-sx;
    y=ty-sy;
    //一回目
    repeat(y,0);
    repeat(x,3);

    repeat(y,1);
    repeat(x+1,2);
    //二回目
    repeat(y+1,0);
    repeat(x+1,3);

    repeat(1,1);
    repeat(1,3);

    repeat(y+1,1);
    repeat(x+1,2);
    repeat(1,0);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i = (m); i < (n); i++)
#define rrep(i,m,n) for(int i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << " \n"[i == n-1];}
#define printp(x,n) for(int i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e18)
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
typedef pair<ll, ll> lpair;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    ll K;
    cin >> s;
    cin >> K;
    ll N = s.size();
    char ans[100010];
    rep(i,0,N){
        ans[i] = ' ';
    }
    bool short_flg = false;
    rep(i,0,N){
        if(s[i] == 'a'){
            ans[i] = 'a';
            continue;
        }
        ll diff_a = 'z' - s[i] + 1;
        if(diff_a <= K){
            K -= diff_a;
            ans[i] = 'a';
        }else{
            short_flg = true;
        }
    }
    rrep(i,N-1,0){
        if(ans[i] == ' '){
            ans[i] = s[i] + K;
            break;
        }
    }
    if(!short_flg){
        ans[N-1] = ans[N-1] + (K % 26);
    }
    rep(i,0,N){
        if(ans[i] == ' '){
            cout << s[i];
        }else{
            cout << ans[i];
        }
    }
    cout << endl;

}


Measured memory_bytes: 720
package main

import "fmt"

func main() {
	var s, t string
	fmt.Scanf("%s", &s)
	fmt.Scanf("%s", &t)

	ans := 0
	for k, _ := range s {
		if s[k] != t[k] {
			ans = ans + 1
		}
	}
	fmt.Println(ans)
}

Measured memory_bytes: 4580
p=int(1e9+7)
def calc(n,l,r):
    f=[0]* (n+1)
    f[0]=1
    sum=0
    for i in range (1,n+1):
        if i>=l:
            sum+=f[i-l]
        f[i]=sum%p
        if (i>=r):
            sum-=f[i-r]
    ans=0
    for i in range (l,r+1):
        ans=(ans+f[n-i]*i)%p
    return ans

n,m=input().split()
n=int(n)
m=int(m)
s=input()
a=s.split(chr(ord('R')+ord('B')-ord(s[0])))
if len(a)==1:
    print((calc(n,2,n)+1)%p)
elif n%2==1:
    print(0)
else:
    r=len(a[0])+1-len(a[0])%2
    for i in range(1,len(a)-1):
        if len(a[i])%2==1 :
            r=min(r,len(a[i]));
    n=n//2
    r=(r+1)//2
    print(calc(n,1,r)*2%p)


Measured memory_bytes: 11240
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
#include <ctime>
#include <tuple>
#include <bitset>
#include <assert.h>
#include <deque>
#include <functional>
using namespace std;
typedef long long ll;

#define fi first
#define se second
#define rep(i, n) for (ll i = 0; i < n; i++)
#define debugA cerr << "AAAAA" << endl
#define debug_ cerr << "-------------" << endl
#define debug(x) cerr << #x << ": " << x << endl
#define debug_vec(v)                   \
    cout << #v << endl;                \
    for (int i = 0; i < v.size(); i++) \
    {                                  \
        cout << v[i] << " ";           \
    }                                  \
    cout << endl;
#define debug_vec2(v)                         \
    cout << #v << endl;                       \
    for (int i = 0; i < v.size(); i++)        \
    {                                         \
        for (int j = 0; j < v[i].size(); j++) \
        {                                     \
            cout << v[i][j] << " ";           \
        }                                     \
        cout << endl;                         \
    }

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

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

using Graph = vector<vector<int>>;
using P = pair<int, int>;
using P1 = pair<int, pair<int, int>>; // クラスカル法とかで、{cost, {from, to}}的に使う。
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double pi = acos(-1);

int main()
{
    int h, w, k;
    cin >> h >> w >> k;
    vector<vector<char>> c(h, vector<char>(w));
    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < w; j++)
        {
            cin >> c[i][j];
        }
    }
    int ans = 0;

    for (int bit1 = 0; bit1 < (1 << h); bit1++)
    {
        for (int bit2 = 0; bit2 < (1 << w); bit2++)
        {
            int cnt = 0;
            for (int i = 0; i < h; i++)
            {
                for (int j = 0; j < w; j++)
                {
                    if (bit1 & (1 << i))
                    {
                        continue;
                    }
                    if (bit2 & (1 << j))
                    {
                        continue;
                    }
                    if (c[i][j] == '#')
                    {
                        cnt++;
                    }
                }
            }
            if (cnt == k)
            {
                ans++;
            }
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3576
m, d = map(int, input().split())

seki = 0
for a in range(1, m + 1):
    for b in range(1, d + 1):
        if b < 10:
            continue
        c = list(map(int, list(str(b))))
        if c[0] >= 2 and c[1] >= 2 and c[0] * c[1] == a:
            seki += 1

print(seki)

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

int main() {
	string A, B;
	cin >> A >> B;
	
	if (A.size() > B.size()) {
		cout << "GREATER" << endl;
		return 0;
	}
	else if (A.size() < B.size()) {
		cout << "LESS" << endl;
		return 0;
	}

	for (int i = 0; i < A.size(); i++) {
		if (A[i] > B[i]) {
			cout << "GREATER" << endl;
			return 0;
		}
		else if (A[i] < B[i]) {
			cout << "LESS" << endl;
			return 0;
		}
	}

	cout << "EQUAL" << endl;
	return 0;
}


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

int main(){
  int P[20], Q[20] = {0, 2, 3, 4, 5, 6, 7, 2, 3, 4, 5, 6}, temp, temp2, count = 0, ans = -1;
  string str;

  cin>>str;

  for(int i = 0; i < 12; i++) {
    P[11-i] = str[i] - '0';
    if(str[i] == '?')temp = 11-i;
  }

  for(int i = 0; i < 10; i++){
    P[temp] = i;
    temp2 = 0;

    for(int j = 1; j < 12; j++){
      temp2 += P[j] * Q[j];
    }
    temp2 = ((temp2%11 <= 1)? 0 :11 -  temp2%11);

    if(temp2 == P[0]) {//cout<<P[0]<<" "<<i<<" "<<count<<endl;
      if(ans != i) count++;
      ans = i;
    }
  }

  if(count == 1){
    cout<<ans<<endl;
  } else  cout<<"MULTIPLE"<<endl;

 
  
  
  return 0;
}



Measured memory_bytes: 3196
#include <stdio.h>

int binarysearch(int);

int A[10000000],n;

int main(){
  int i,m,key,sum=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  scanf("%d",&m);
  for(i=0;i<m;i++){
    scanf("%d",&key);
    if(binarysearch(key)){
      sum++;
    }
  }
  printf("%d\n",sum);
  return 0;
}

int binarysearch(int key){
  int left=0;
  int right=n;
  int mid;
  while(left<right){
    mid=(left+right)/2;
    if(key==A[mid]){
      return 1;
    }
    else if(key>A[mid]){
      left=mid+1;
    }
    else {
      right=mid;
    }
  }
  return 0;
}



Measured memory_bytes: 2132
#include <stdio.h>
#include <stdlib.h>

int compare(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}

int main(void)
{
    int N, M, X, Y, x[100], y[100], i;
    scanf("%d%d%d%d", &N, &M, &X, &Y);
    for (i = 0; i < N; ++i) scanf("%d", &x[i]);
    for (i = 0; i < M; ++i) scanf("%d", &y[i]);
    qsort(x, N, sizeof(int), compare);
    qsort(y, M, sizeof(int), compare);
    if (y[0] > x[N - 1] && y[0] > X && Y >= y[0]) puts("No War");
    else puts("War");
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define pb push_back
#define mp make_pair
#define IOS ios_base::sync_with_stdio(false),cin.tie(0);
#define F first
#define S second
using namespace std;
typedef long long ll;
ll a,b,c;
const ll maxn=200005;
const ll mod=1e9+7;
typedef pair<ll,ll> pii;
ll num[100005];
ll n,k,m;
ll sum[100005];
ll s[2005],t[2005];
ll dp[2005][2005];
int main()
{
    //IOS
    //cout<<(-5)%mod<<"\n";
    while(cin>>n>>m)
    {


        rep(i,n) cin>>s[i];
        rep(i,m) cin>>t[i];
        for(int i=0;i<=n;i++) for(int j=0;j<=m;j++) dp[i][j]=0;
        rep1(i,n)
        {
            rep1(j,m)
            {
                if(s[i-1]==t[j-1])
                {
                    dp[i][j]=((1+dp[i][j-1])%mod+dp[i-1][j])%mod;
                }
                else
                {
                    dp[i][j]=((dp[i][j-1]+dp[i-1][j])%mod+mod-dp[i-1][j-1])%mod;
                }
                //cout<<i<<" "<<j<<" "<<dp[i][j]<<"\n";
            }
        }
        cout<<(dp[n][m]+1)%mod<<"\n";
    }


}


Measured memory_bytes: 33024
#include <cstdint>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>

int main(void)
{
    int64_t n;
    std::cin >> n;

    std::vector<int64_t> h(n);
    std::vector<int64_t> cost(n);

    for (int64_t i=0; i < n; ++i) {
        std::cin >> h.at(i);
    }

    cost.at(1) = std::abs(h.at(0) - h.at(1));
    for (int64_t i=2; i < n; ++i) {
        int64_t cost1 = cost.at(i-2) + std::abs(h.at(i-2) - h.at(i));
        int64_t cost2 = cost.at(i-1) + std::abs(h.at(i-1) - h.at(i));
        if (cost1 < cost2) {
            cost.at(i) += cost1;
        } else {
            cost.at(i) += cost2;
        }
        
    }

    std::cout << cost.at(n-1) << std::endl;

    return 0;
}


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

int main(){
    int N;
    cin >> N;
    int alice = 0;
    int bob = 0;
    std::vector<int> cards(N);
    for(int i=0; i < N; i++){
        cin >> cards.at(i);
    }
    sort(cards.begin(), cards.end(), greater<int>());
    // for(int i=0; i < N; i++){
    //     cout << cards.at(i) << endl;
    // }
    for(int i=0; i < N; i+=2){
        // cout << cards.at(i) << endl;
        alice += cards.at(i);
    }
    for(int i=1; i < N; i +=2){
        // cout << cards.at(i) << endl;
        bob += cards.at(i);
    }
    cout << alice - bob << endl;
    return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(a)  (a).begin(),(a).end()
#define PI 3.14159265358979
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll mod = 1e9+7LL;

int main() {
    int L, R, d; cin >> L >> R >> d;
    int ans = 0;
    for(int i = L; i <= R; ++i){
        if(i%d==0) ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
string s;
int a[200005],b[200005];
int main()
{
    memset(a,0,sizeof a);
    memset(b,0,sizeof b);
    int n,k,c,jqs=1;
    cin>>n>>k>>c>>s;
    for(int i=0;i<n;i++)
    {
        if(s[i]=='o'){a[i+1]=jqs;i+=c;jqs++;}
        if(jqs>k)break;
    }
    jqs--;
    for(int i=n-1;i>=0;i--)
    {
        if(s[i]=='o'){b[i+1]=jqs;i-=c;jqs--;}
        if(jqs==0)break;
    }
    for(int i=1;i<=n;i++)
    {
        if(a[i]&&b[i]&&a[i]==b[i])cout<<i<<endl;
    }
    return 0;
}

Measured memory_bytes: 3332
#include<bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
//g++ -std=c++11 

using namespace std;

long long N;
string S;

int main(){
	cin >> N >> S;
	rep(i, S.size()) {
		cout << char('A' + (S[i] - 'A' + N)%26);
	}
	cout << endl;

}

Measured memory_bytes: 3664
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
using namespace std;
typedef long long LL;
const int L0 = 2;
const int L1 = 1;
int n, i, j;
LL res[100];
int main()
{
	res[0] = L0;
	res[1] = L1;
	scanf("%d", &n);
	if(n == 1)
		printf("%d\n", res[1]);
	else{
		for(i = 2; i <= n; i++)
			res[i] = res[i - 1] + res[i - 2];
		printf("%lld\n", res[n]);
	}
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import math
import itertools
 
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    N = inputInt()
    a = inputList()
    
    tmp = 0
    gu = 0
    for i, val in enumerate(a):
        if val % 4 == 0:
            tmp += 1
            continue
        if val % 2 == 0:
            gu += 1
            
    if tmp >= N // 2:
        print("Yes")
        sys.exit()
    
    aaa = (N // 2) - tmp
    gugu = gu // 2
    #print("{} {}".format(aaa, gu))
    if aaa <= gugu:
        print("Yes")
        sys.exit()
        
    print("No")
    
    
if __name__ == "__main__":
	main()


Measured memory_bytes: 63852