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

#define FastRead        ios_base::sync_with_stdio(false);cin.tie(NULL);
#define endl            "\n"
#define sq(x)           ((x)*(x))
#define pi              acos(-1.0)
#define NUM             1000000007

typedef long long ll;


int main()
{
    FastRead

    vector<ll>c;

    ll n,sum=0,ans=0;

    cin>>n;

    vector<ll>v(n);

    for(ll i=0;i<n;i++)
    {
        cin>>v[i];
        sum+=v[i];
        c.push_back(sum);
    }

    for(ll i=0;i<n-1;i++)
        ans+=(((v[i]%NUM)*((sum-c[i])%NUM))%NUM)%NUM;

    ans = ans%NUM;

    cout<<ans<<endl;
}


Measured memory_bytes: 6776
#include <atcoder/fenwicktree>
#include <bits/stdc++.h>

using namespace std;
using namespace atcoder;

int main() {
  int N,Q;
  cin>>N>>Q;
  fenwick_tree<long long> fw(N);
  long long a;
  for(int i=0;i<N;i++){
    cin>>a;
    fw.add(i,a);
  } 
  long long t,u,v;
  for(int i=0;i<Q;i++){
    cin>>t>>u>>v;
    if(t==0){
      fw.add(u,v);
    }
    if(t==1){
      long long ans=fw.sum(u,v);
      cout<<ans<<endl;
    }
  }
  return 0;
}



Measured memory_bytes: 8220
a, b, m  = [int(x) for x in input().split()]
a_l = [int(x) for x in input().split()]
b_l = [int(x) for x in input().split()]
ans = min(a_l) + min(b_l)
for mm in range(m):
    xm, ym, cm = [int(x) for x in input().split()]
    anss = a_l[xm - 1] + b_l[ym - 1] - cm
    if anss < ans:
        ans = anss
print(ans)

Measured memory_bytes: 70860
#include <iostream>
#include <iomanip>
using namespace std;
const double PI = 3.14159265358979323846;
int main(){
	double r;
	cin>>r;
	cout << fixed << setprecision(6) << r*r*PI << " " << fixed << setprecision(6) << 2*PI*r << endl;
	return 0;
}

Measured memory_bytes: 1288
W = input()
T = []
len_w = len(W)
count = 0

str_in = input()
while (str_in != 'END_OF_TEXT'):
    T.append(str_in.lower().split())
    str_in = input()

for item in T:
    for i in item:
        if (i == W):
            count += 1
            
print(count)


Measured memory_bytes: 5560
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::cmp::{min, max};
use std::io::{Write, BufWriter};
use std::collections::HashSet;
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, usize);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input!{
        n: usize,
        d: [i32; n],
    }
    let mut set = HashSet::new();
    for i in 0..n{
        set.insert(d[i]);
    }
    puts!("{}\n", set.len());
    
}

Measured memory_bytes: 4352
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <set>
#include <stack>
#include <climits>
#include <cmath>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
#define reps(i,s,n) for(int i=s, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
typedef long long ll;
const char sp = ' ';


using namespace std;

int main(void){
    ll N, A;
    cin>>N>>A;
    cout<<(N%500<=A ? "Yes" : "No")<<endl;
    return 0;
}


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

int main() {
  int N,B=100;
  cin >> N;
  for(int i=0; i<N; i++){
    int A,C=0;
    cin >> A;
    for(int j=0;A%2==0;A/=2){
      C++;
    }
    if(C<B)
      B=C;
  }
  cout << B << endl;
}


Measured memory_bytes: 3608
#include <iostream>
#include <stdio.h>
#include <math.h>
typedef long long ll;
using namespace std;
int main() {
	int n, i=0;
	cin >> n;
  ll cnt = 10;
  ll bcnt = 0;
  ll ans = 0;
  int flag = 0;
  while(true) {
    if(bcnt <= n && n < cnt) {
      if(!flag) {
        ans += (n - bcnt + 1);
      }
      break;
    } else if (cnt <= n) {
      if(!flag) {
        ans += (cnt - bcnt);
        flag = 1;
      } else {
        flag = 0;
      }
    }
    bcnt = cnt;
    cnt *= 10;
  }
  cout << ans - 1 << endl;
  return 0;
}

Measured memory_bytes: 256
require 'prime'
x = gets.to_i

(1..x).to_a.reverse.each do |n|
  primes = n.prime_division
  primes = primes.map{|a| a[1]}.uniq
  if n == 1 || (primes.size == 1 && 1 < primes[0])
    puts n
    exit
  end
end

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

int main() {
  ll n,k;cin>>n>>k;
  ll ans=k;
  ans *= pow(k-1, n-1);
  cout << ans;
}


Measured memory_bytes: 256
import std.stdio : writeln, writefln;
import std.array;
import std.range;
import std.math : sqrt, acos, PI;

const int INF = 1<<28;

double d(double[2] a){
	return sqrt(a[0]*a[0] + a[1]*a[1]);
}

double ep(double[2] a, double[2] b){
	return a[0]*b[1] - a[1]*b[0];
}

double g(double[2] a, double[2] b){
	double cos_ = (a[0]*b[0] + a[1]*b[1])/(a.d*b.d);
	double theta = acos(cos_);
	if(ep(a, b)>0){
		theta+=PI;
	}
	
	return theta;
}

void swap(T)(ref T a, ref T b){
	T tmp = a;
	a = b;
	b = tmp;
}

void main(){
	double[2][] list;
	
	
	delim = ",";
	double min_ = INF;
	while(hasNext){
		double[2] v_ = [next!double(), next!double()];
		if(v_[0] < min_){
			list = [v_] ~ list;
			min_ = v_[0];
		}else{
			list = list ~ [v_];
		}
	}
	
	int[] sorted;
	sorted ~= 0;
	
	auto n = list.length;
	double[2] v = [0.,1.];
	double[2] node = list[0];
	while(true){
		min_ = INF;
		int min_idx;
		for(int i=0; i<n; ++i){
			double[2] v_ = list[i];
			v_[] -= node[];
			double theta = g(v, v_);
			
			if(theta<min_){
				min_ = theta;
				min_idx = i;
			}
		}
		
		if(min_idx==0) break;
		
		sorted ~= min_idx;
		
		double[2] v_ = list[min_idx];
		v_[] -= node[];
		
		node = list[min_idx];
		v = v_;
	}
	
	double S=0.;
	for(int i=1; i<sorted.length-1; ++i){
		double[2] a = list[sorted[i]];
		double[2] b = list[sorted[i+1]];
		
		a[]-=list[sorted[0]][];
		b[]-=list[sorted[0]][];
		
		double value = ep(a, b);
		value = sqrt(value*value)/2.;
		
		S += value;
	}
	
	writefln("%.6f", S);
}


import std.stdio : readln, chomp;
import std.conv : to;
import std.string : split;
shared string[] input;
shared string delim = " ";
T next(T)()
in
{
	assert(hasNext());
}
out
{
	input.popFront;
}
body
{
	return input.front.to!T;
}

void next(T)(ref T v){
	v = next!T();
}

bool hasNext(){
	if(input.length > 0){
		return true;
	}
	
	string str = readln;
	if(str.length > 0){
		input ~= str.chomp.split(delim);
		return true;
	}else{
		return false;
	}
}


void dbg(T...)(T vs)
{
	import std.stdio : stderr;
	foreach(v; vs)
		stderr.write(v.to!string ~ " ");
	stderr.write("\n");
}

T clone(T)(T v){
	T v_;
	static if(isInputRange!(T)){
		foreach(ite; v){
			v_ ~= ite.clone;
		}
	}else{
		v_ = v;
	}
	
	return v_;
}

Measured memory_bytes: 1100
a,b = map(int,input().split())

if a > 0:
  print("Positive")
  exit(0)
  
if (a == 0 or b == 0) or (a < 0 and b > 0):
  print("Zero")
  exit(0)
  
# only negative a,b cases left from this point on
if (a == b):
  print("Negative")
  exit(0)
  
if (a - b) % 2 == 1:
  print("Positive")
else:
  print("Negative")


Measured memory_bytes: 9060
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <stack>

using namespace std;

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

const ll mod = 1000000007;

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

  int a, b, m;
  cin >> a >> b >> m;
  vector<int> alpha(a), beta(b);
  for (auto &x: alpha) cin >> x;
  for (auto &x: beta) cin >> x;
  vector<vector<int> > xyc(m, vector<int>(3));
  for (int i = 0; i < m; i++) cin >> xyc[i][0] >> xyc[i][1] >> xyc[i][2];

  int minimum = 1000000007;
  for (int i = 0; i < m; i++) {
    int discountPrice = alpha[xyc[i][0]-1] + beta[xyc[i][1]-1] - xyc[i][2];
    if (discountPrice < minimum) minimum = discountPrice;
  }

  sort(alpha.begin(), alpha.end());
  sort(beta.begin(), beta.end());
  if (alpha[0] + beta[0] < minimum) minimum = alpha[0] + beta[0];

  cout << minimum << endl;

  return 0;
}


Measured memory_bytes: 6528
#include <cstdio>
#include <climits>
#include <cassert>
#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <tuple>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <vector>
#include <iterator>
#include <regex>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define FOR(x,xs) for(auto &x: xs)

using namespace std;
typedef long long ll;
typedef pair<int,int> PI;
typedef pair<ll,ll> PL;
typedef vector<int> VI;
typedef vector<ll> VL;

template <class T, template <class, class> class C, class charT = char>
void vdump(const C<T, allocator<T>> &v, const charT* delimiter = ", ",
           ostream &stream = cout) {
  copy(v.begin(), v.end(), ostream_iterator<T>(stream, delimiter));
  stream << endl;
}

int main() {
  ios::sync_with_stdio(false);
  int rr, gg, bb, n;
  cin >> rr >> gg >> bb >> n;
  int ans = 0;
  REP(r,0,n/rr+1) {
    REP(g,0,(n-rr*r)/gg+1) {
      if ((n - rr * r - gg * g) % bb == 0) {
        ans++;
      }
    }
  }
  cout << ans << endl;

  return 0;
}


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

Graph friend_, block_;
vector<int> group_, size_;

void dfs(int i, int n) {
    group_[i] = n;
    size_[n]++;
    for (int j : friend_[i]) {
        if (group_[j] == -1) dfs(j, n);
    }
}

int main() {
    int N, M, K;
    cin >> N >> M >> K;
    friend_.assign(N, {});
    for (int i=0; i<M; i++) {
        int a, b;
        cin >> a >> b;
        friend_[a-1].push_back(b-1);
        friend_[b-1].push_back(a-1);
    }
    block_.assign(N, {});
    for (int i=0; i<K; i++) {
        int a, b;
        cin >> a >> b;
        block_[a-1].push_back(b-1);
        block_[b-1].push_back(a-1);
    }
    
    group_.assign(N, -1);
    size_.assign(N, 0);
    for (int i=0; i<N; i++) {
        if (group_[i] == -1) dfs(i, i);
    }

    for (int i=0; i<N; i++) {
        int g = group_[i];
        int ans = size_[g] - 1;
        ans -= friend_[i].size();
        for(int j : block_[i]) if(group_[j]==g) ans--;
        cout << ans << " ";
    }
    cout << endl;    
}


Measured memory_bytes: 12672
h,w=map(int,input().split())
s=[input() for _ in range(h)]

check = [[False for _ in range(w)]for __ in range(h)]

import queue
q=queue.Queue()
nh = [1,0,-1,0]
nw = [0,1,0,-1]

ans = 0
for i in range(h):
    for j in range(w):
        if check[i][j]:continue
        check[i][j] =True
        cnt = [0]*2
        cnt[s[i][j] == '#']+=1
        q.put([i,j])
        while not q.empty():
            nowi,nowj = q.get()
            for ne in range(4):
                ni = nowi + nh[ne]
                nj = nowj + nw[ne]
                if ni<0 or h <=ni or nj<0 or w<=nj:continue
                if s[nowi][nowj] == s[ni][nj]:continue
                if check[ni][nj]:continue
                check[ni][nj]=True
                cnt[s[ni][nj]=='#']+=1
                q.put([ni,nj])
        ans += cnt[0]*cnt[1]
print(ans)


Measured memory_bytes: 73172
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <limits>
#include <cassert>
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
#define REPI(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define INF numeric_limits<double>::infinity()
constexpr long MOD = 1e9 + 7;
long gcd(long a, long b) {return b % a ? gcd(b % a, a) : a;}
long lcm(long a, long b) {return a / gcd(a, b) * b;}
using namespace std;
using P = pair<long, long>;
using VI = vector<long>;

long n;
VI as;

bool ok() {
    if (as.front()) return false;
    for (long i = 1; i < n; i++) {
        if (as[i] >= as[i-1]) {
            if (as[i] - as[i-1] > 1) return false;
        }
    }
    return true;
}

long cnt() {
    long ans = 0;
    long i = n - 1;
    while (i > 0) {
        if (as[i]) {
            ans += as[i];
            while (as[i-1] == as[i] - 1) {
                i--;
            }
        }
        i--;
    }
    
    return ans;
}


int main() {
    cin >> n;
    REP(i,n) {
        long a;
        cin >> a;
        as.push_back(a);
    }
    if (!ok()) {
        cout << -1 << endl;
        return 0;
    }
    
    cout << cnt() << endl;
}


Measured memory_bytes: 2420
def main():
    n = int(input())
    a = [int(x) for x in input().split()]
    answer = 0
    for aa in a:
        while aa > 0 and aa % 2 == 0:
            aa //= 2
            answer += 1
    print(answer)


if __name__ == '__main__':
    main()



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

int main() {
    int n;
    cin >> n;
    lint ans = 0;
    for (lint i = 1; i <= n; i++) {
        if (i % 3 != 0 && i % 5 != 0) {
            ans += i;
        }
    }
    cout << ans << endl;
}

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

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

    long long T, A;
    long long t = 0;
    long long a = 0;
    for (int i = 0; i < N; i++)
    {
        cin >> T >> A;
        long long coef = max(1ll, max(t / T, a / A));
        while (t > coef * T || a > coef * A)
        {
            coef++;
        }
        t = coef * T;
        a = coef * A;
    }
    cout << t + a << endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    int a,b;
    string op;
    while(1){
    cin >> a >> op >> b;
    if(op == "+") cout << a + b <<endl;
    else if (op == "-") cout << a - b <<endl;
    else if (op == "*") cout << a * b <<endl;
    else if (op == "/") cout << a / b << endl;
    else if (op == "?") break;
    }
    return 0;
}

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

using namespace std;

#define endl "\n"
#define ll unsigned long long
//#define int long long int
#define vi vector <int >
#define vii vector < pii >
#define vll vector <ll >
#define pii pair <int, int>
#define pdd pair< double, double>
#define piii pair < pii, int > 
#define pll pair<ll, ll >
#define umap unordered_map
#define pb push_back
#define pq priority_queue
#define forn(i, n) for(int i = 0; i < (int)n; i++)
#define rep(i,b,c) for(int i = (int)b; i < (int)c; i++)
//#define double long double
#define a first
#define b second

double dp[302][302][302];
vi arr(302);
int n;
double zero = 0;

double f(int a1, int a2, int a3){
    if(a1 == 0 && a2 == 0 && a3 == 0){
        return 0;
    }

    if(dp[a1][a2][a3] != -1) return dp[a1][a2][a3];

    double ans = 0;

    if(a1)
        ans += f(max(a1 - 1, 0), a2, a3)*((double)a1/double(a1 + a2 + a3));
    if(a2)
        ans += f(a1 + 1, max(a2 - 1, 0), a3)*((double)a2/double(a1 + a2 + a3));
    if(a3)
        ans += f(a1, a2 + 1, max(a3 - 1, 0))*((double)a3/double(a1 + a2 + a3));

    return dp[a1][a2][a3] = ans + double(n)/(double(a1 + a2 + a3));
}

int32_t main(){
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);

    cin >> n;
    int a1 = 0, a2 = 0, a3 = 0;
    forn(i, n){
        cin >> arr[i];
        a1 += (arr[i] == 1);
        a2 += (arr[i] == 2);
        a3 += (arr[i] == 3);
    }
    forn(i, 302)
        forn(j, 302)
            forn(k, 302)
                dp[i][j][k] = -1;

    printf("%.16f\n", f(a1, a2, a3));

    return 0;
}

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

using namespace std;

class DICE {
public:
	int top;
	int bottom;
	int right;
	int left;
	int front;
	int back;
	void South();
	void North();
	void East();
	void West();
	void RF();
	void LF();
};

void DICE::South() {
	int kari = front;
	front = top;
	top = back;
	back = bottom;
	bottom = kari;
}

void DICE::North() {
	int kari = front;
	front = bottom;
	bottom = back;
	back = top;
	top = kari;
}

void DICE::West() {
	int kari = top;
	top = left;
	left = bottom;
	bottom = right;
	right = kari;
}

void DICE::East() {
	int kari = top;
	top = right;
	right = bottom;
	bottom = left;
	left = kari;
}

void DICE::RF() {
	int kari = right;
	right = back;
	back = left;
	left = front;
	front = kari;
}

void DICE::LF() {
	int kari = left;
	left = back;
	back = right;
	right = front;
	front = kari;
}

int main() {
	DICE d;
	cin >> d.top >> d.front >> d.left >> d.right >> d.back >> d.bottom;
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		int t, f;
		cin >> t >> f;
		if (d.top != t) {
			d.South();
			if (d.top != t) {
				d.South();
				if (d.top != t) {
					d.South();
					if (d.top != t) {
						d.East();
						if (d.top != t) {
							d.East();
							d.East();
						}
					}
				}
			}
		}
		if (d.front != f) {
			d.RF();
			if (d.front != f) {
				d.RF();
				if (d.front != f) {
					d.RF();
				}
			}
		}
		cout << d.left << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
/*************************************************************************
  > File Name: f.cpp
  > Author: Samuel
  > Mail: enminghuang21119@gmail.com
  > Created Time: Tue Mar 17 19:27:57 2020
*************************************************************************/

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

typedef long long ll;
int n, d, a;
pair<ll, ll> monsters[200010];
ll tree[800010];
ll lazy[800010];
int make_tree(int ind, int l, int r) {
    if (l == r)
        return tree[ind] = monsters[l].second;
    int m = (l + r) / 2;
    int ind2 = ind * 2;
    return tree[ind] = max(make_tree(ind2 + 1, l, m), make_tree(ind2 + 2, m + 1, r));
}
void change(int ind, int l, int r, int s, int e, int dx) {
    if (s > r || e < l)
        return;
    if (s <= l && r <= e) {
        lazy[ind] += dx;
        return;
    }
    int m = (l + r) / 2;
    int ind2 = ind * 2;
    change(ind2 + 1, l, m, s, e, dx);
    change(ind2 + 2, m + 1, r, s, e, dx);
    tree[ind] = max(tree[ind2 + 1] + lazy[ind2 + 1], tree[ind2 + 2] + lazy[ind2 + 2]);
}
int query(int ind, int l, int r, int s, int e) {
    if (s > r || e < l)
        return 0;
    if (s <= l && r <= e)
        return tree[ind] + lazy[ind];
    int m = (l + r) / 2;
    int ind2 = ind * 2;
    return max(query(ind2 + 1, l, m, s, e), query(ind2 + 2, m + 1, r, s, e)) + lazy[ind];
}
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> d >> a;
    for (int i = 0; i < n; i++)
        cin >> monsters[i].first >> monsters[i].second;
    sort(monsters, monsters + n);
    make_tree(0, 0, n);
    long long ans = 0;
    for (int i = 0; i < n; i++) {
        ll t = monsters[i].first;
        ll tt = t + 2 * d;
        int ind = lower_bound(monsters, monsters + n, pair<ll, ll>(tt, 0)) - monsters;
        if (ind == n || monsters[ind].first > tt)
            ind--;
        ll now = query(0, 0, n, i, i);
        if (now <= 0)
            continue;
        ll dx = now / a;
        dx += now % a != 0;
        ans += dx;
        change(0, 0, n, i, ind, -dx * a);
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 15872
#include <iostream>
using namespace std;
int main(){
int n;
int g;
while(cin >>n){
g=1;
while(g<1000){
if(n%(2*g)==g&&n!=g){cout <<g<<" "; n=n-g;}
else if(n%(2*g)==g&&n==g){cout <<g<<endl; n=n-g;}
g=g*2;}
}
}

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

int main() {
	int N, M;
	char blue[100][10], red[100][10];
	cin >> N;
	for (int i = 0; i < N; ++i) {
		cin >> blue[i];
	}
	cin >> M;
	for (int i = 0; i < M; ++i) {
		cin >> red[i];
	}

	int ans = 0, cnt;
	for (int i = 0; i < N; ++i) {
		cnt = 0;
		// count blue
		for (int j = 0; j < N; ++j) {
			if (!strcmp(blue[i], blue[j])) cnt++;
		}
		// count red
		for (int j = 0; j < M; ++j) {
			if (!strcmp(blue[i], red[j])) cnt--;
		}
		if (ans < cnt) ans = cnt;
	}
	cout << ans << endl;
}

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

using namespace std;

int brute(int argc, char *argv[]) {
   return 0;
}

int tests(int argc, char *argv[]) {
   return 0;
}

int _main(int argc, char *argv[]) {
   long long a, b, x;
   cin >> a >> b >> x;
   long long res = (b / x);
   if(a - 1 >= 0) res -= ((a - 1) / x);
   else ++res;
   cout << res << endl;
   return 0;
}

int main(int argc, char *argv[]){
   if(argc >= 2 && argv[1][0] == '1') {
      brute(argc, argv);
   } else if(argc >= 2 && argv[1][0] == '2') {
      tests(argc, argv);
   } else {
      _main(argc, argv);
   }
   return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>     
#include <numeric>
#include <utility>
#include <queue>
#include <set>
#include <sstream>
#include <iomanip>
#include <stack>
#include <string>
#include <limits>
#include <vector>
using namespace std;
#define ll long long
#define ld long double
#define rep(a,t) for(int a=0;a<t;++a) 
#define forever while(true)
#define Sort(a) sort(a.begin(),a.end())
#define Reverse(a) reverse(a.begin(),a.end())
#define pb push_back
#define print_double(val,a) cout << fixed << setprecision(a) << val << endl;
ll mod = 1e9 + 7;
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
int n,k;
cin>>n>>k;
if(n==k){cout<<1<<endl;return 0;}
vector<int>a(n);
k--;n--;
if((n/k)*k==n){cout<<n/k;}
else{cout<<n/k+1;}
cout<<endl;
return 0;
}

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

ll N, M;
vector <int> Graph[int(1e5+5)];
bool two = true;
bool visited[int(1e5+5)], color[int(1e5+5)];

int Check(){
  visited[1] = true;
  queue <int> que; que.push(1);
  while (!que.empty()){
    int Q = que.front(); que.pop();
    for (int v : Graph[Q]){
      if (!visited[v]){
        que.push(v);
        visited[v] = true;
        color[v] = 1 - color[Q];
      }else{
        if (color[v] == color[Q]){
          two = false;
          return 0;
        }
      }
    }
  }
  return 0;
}

int main(){
  cin >> N >> M;
  for (int i = 0; i < M; i++){
    int A, B; cin >> A >> B;
    Graph[A].push_back(B);
    Graph[B].push_back(A);
  }
  Check();

  if (!two){
    cout << N * (N - 1) / 2 - M << endl;
    return 0;
  }

  ll cnt[2] = {};
  for (int i = 1; i <= N; i++){
    cnt[color[i]]++;
  }
  cout << cnt[0] * cnt[1] - M << endl;

  return 0;
}


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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0 ,sizeof(a))

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

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; }

int main(void){
    ll N; cin >> N;
    cout << (N%2 ? 2*N : N) << endl;
    return 0;
}

Measured memory_bytes: 256
module RawUnionFind = struct
  type t = {rank : int array; parent : int array}
  type elt = int
  let make n =
    {rank = Array.make n 0;
     parent = Array.init n (fun c -> c)}

  let rec find uf x =
    if x = uf.parent.(x) then x
    else (
      let y = find uf uf.parent.(x) in
      uf.parent.(x) <- y; y
    )

  let unite uf i j =
    let x = find uf i in
    let y = find uf j in
    if x <> y then (
      if uf.rank.(x) < uf.rank.(y) then uf.parent.(x) <- y
      else (
        uf.parent.(y) <- x;
        if uf.rank.(x) = uf.rank.(y) then
          uf.rank.(x) <- 1 + uf.rank.(x)
      )
    )
end

let () =
  let n, m = Scanf.scanf "%d %d " (fun a b -> a, b) in
  let p = Array.to_list @@ Array.init n (fun _ -> Scanf.scanf "%d " (fun a -> a-1)) in
  let xy = Array.to_list @@ Array.init m (fun _ -> Scanf.scanf "%d %d " (fun a b -> (a-1,b-1))) in

  let uf = RawUnionFind.make (n+1) in
  List.iter (fun (x, y) -> RawUnionFind.unite uf x y) xy;
  List.mapi (fun i p -> RawUnionFind.find uf i = RawUnionFind.find uf p) p
  |> List.filter (fun x -> x)
  |> List.length
  |> Printf.printf "%d\n"


Measured memory_bytes: 20224
s = input()
t = input()
len_s = len(s)
len_t = len(t)
ans = len_t
for i in range(len_s - len_t + 1):
    tmp_cnt = 0
    tmp_s = s[i:i + len_t]
    for c1, c2 in zip(tmp_s, t):
        if c1 != c2:
            tmp_cnt += 1
    ans = min(ans, tmp_cnt)
print(ans)

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


using namespace std;


void func142b (){
	int n, k, h, cnt = 0;
	cin >> n;
	cin >> k;
	for (int i = 0; i < n;i++) {
		cin >> h;
		if (h >= k)cnt++;
	}
	cout << cnt;
}

int main()
{
	func142b();
	return 0;	
}



Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))

c = [0]*n
d = [0]*n

for i, j in enumerate(a):
    c[i] = i + j

for i, j in enumerate(a):
    d[i] = i - j

x = {}
for i, j in enumerate(c):
    if j not in x:
        x[j]=[i]
    else:
        x[j].append(i)
ans = 0
for i in d:
    if i not in x:
        continue
    else:
        ans += len(x[i])
print(ans)

Measured memory_bytes: 70632
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define fi first
#define se second
#define bigger (char)toupper
#define smaller (char)tolower
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef long long ll;
typedef unsigned long long ull;

int main() {
    string S;
    cin>>S;
    ll zero=0,one=0;
    ll N=S.size();
    rep(i,N) {
        if(S.at(i)=='0') zero++;
        else one++;
    }
    cout<<min(zero,one)*2<<endl;
}

Measured memory_bytes: 512
n = int(input())
li = list(map(int,input().split()))

ans = 0
li.sort()

for i in range(n):
    for j in range(n-i):
        for k in range(n-i-j):
            if li[i]+li[i+j]>li[i+j+k] and li[i]<li[i+j] and li[i+j]<li[i+j+k]:
                ans+=1
print(ans)

Measured memory_bytes: 9188
#D in [S_i-X_i,T_i-X_i) → Xiで止まる
import sys
input = sys.stdin.readline
from heapq import heappop,heappush
from collections import defaultdict

N,Q = map(int,input().split())
task = []

STX = [[int(x) for x in input().split()] for _ in range(N)]
for s,t,x in STX:
  task.append((t-x,0,x)) # xで止まらなくなる
  task.append((s-x,1,x)) # xで止まる

for i in range(Q):
  d = int(input())
  task.append((d,2,i)) # 止まる位置を答える
answer = [-1]*Q

task.sort()

# 引っかかってる場所の管理
se = set()
se_hp = [] # heapでソートを保つ

# 小さい時刻から順に見ていく
for a,b,c in task:
  if not b: # b == 0
    se.remove(c)
  elif b&1: # b == 1
    se.add(c)
    heappush(se_hp,c)
  else: # b == 2
    while se_hp and se_hp[0] not in se:
      heappop(se_hp)
    answer[c] = se_hp[0] if se_hp else -1

print('\n'.join(map(str,answer)))


Measured memory_bytes: 142384
import java.util.*;

public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);
    
    int N = sc.nextInt();
    int[][] A = new int[2][N];

    for (int i = 0; i < 2; i++){
      for (int j = 0; j < N; j++) {
        A[i][j] = sc.nextInt();
      }
    }

    sc.close();

    int count = 0;
    int count_ = 0;

    // 右に A 回移動する
    // 下に 1 回移動する
    // 右に N - A 回移動する

    for (int i = 0; i < N; i++) {
      for (int j = 0; j <= i; j++) {
        count_ += A[0][j];
      }
      for (int j = i; j < N; j++) {
        count_ += A[1][j];
      }
      count = Math.max(count, count_);
      count_ = 0;
    }

    System.out.println(count);

  }

}

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

//#define int long long
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i < b; i++)
#define out(x) cout << x << endl
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<bool> > vvb;
typedef vector<vector<double> > vvd;
typedef vector<vector<string> > vvs;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
    gearup;
    ll n; cin >> n;
    if(n&1){
        out(0);
        return 0;
    }
    ll res = 0;
    n/=2;
    while(n > 0){
        res += n/5;
        n/=5;
    }
    out(res);
}


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

using namespace std;

int main(void){
    int64_t n;
    vector<int64_t> a(5);
    cin >> n;
    for(int i = 0; i < 5; i++)
        cin >> a[i];
    vector<int64_t>::iterator minIt = min_element(a.begin(), a.end());
    auto idx = distance(a.begin(), minIt);
    int64_t time = ceil((double) n/ (double)*minIt);
    cout << time + 4 << endl;
}

Measured memory_bytes: 256
n = int(input())
l = list(map(int, input().split(' ')))

def gcd(a, b):
    return b if a % b == 0 else gcd(b, a % b)
def lcm(a, b):
    return a * b // gcd(a, b)
hoge = 1
for p in l:
    hoge = lcm(hoge, p)
ans = 0
for p in l:
    ans += hoge // p
print(ans % int(1e9 + 7))  # TLE ????

Measured memory_bytes: 75972
#include <bits/stdc++.h>
#define rep(i, a, n) for(int (i) = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int (i) = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int (i) = (int)(a);(x);++(i))
#define repr(i, a, n) for(int (i) = (int)(a);(i) > (int)(n);--(i))
#define reper(i, a, n) for(int (i) = (int)(a);(i) >= (int)(n);--(i))
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define SIZE(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define RNG(x, a, n) &((x)[a]), &((x)[n])
#define ADD(a, b) ((((a)%MOD)+((b)%MOD))%MOD)
#define MUL(a, b) ((((a)%MOD)*((b)%MOD))%MOD)
#define CEIL(x) ((int)ceil(((double)x)))
#define UNIQUE(x) (x).erase(unique(ALL((x))), (x).end())
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define fcout cout << fixed << setprecision(10)
#define pb push_back
#define pf push_front
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define EPS (1e-20)
#define INF 2147483647
#define MOD 1000000007
using llint = long long;
using VI = std::vector<int>;
using PII = std::pair<int, int>;
using SI = std::set<int>;
using MII = std::map<int, int>;
using TIII = std::tuple<int, int, int>;
using VLL = std::vector<llint>;
using MCI = std::map<char, int>;
using namespace std;


int D, G;
int p[20], c[20];
int dp[20][105510];


void makeDP(){
	repe(i, 0, D) fill(RNG(dp[i], 1, 105510), INF);
	repe(i, 1, D){
		rep(j, 0, p[i])
			chmin(dp[i][min(G, i*j)], j);
		chmin(dp[i][min(G, i*p[i]+c[i])], p[i]);
	}
	repe(i, 2, D){
		repe(j, 1, G){
			if(dp[i-1][j] == INF) continue;
			rep(k, 0, p[i]) chmin(dp[i][min(G, j+i*k)], dp[i-1][j]+k);
			chmin(dp[i][min(G, j+i*p[i]+c[i])], dp[i-1][j]+p[i]);
		}
	}
}


signed main(){
	cin >> D >> G, G/=100;
	repe(i, 1, D) cin >> p[i] >> c[i], c[i]/=100;

	makeDP();

	cout << dp[D][G] << endl;

	return 0;
}


Measured memory_bytes: 6400
#include <bits/stdc++.h>
 
using namespace std;
 
int main()
{
    int N, M, T, a;
    cin >> N >> M >> T;
    vector<bool> used(T+1, 0);
    for (int i = 0; i < N; i++) {
        cin >> a; 
        for (int j = a; j >= max(a-M, 0); j--) {
            used[j] = 1;
        }
        for (int j = a; j < min(a+M, T); j++) {
            used[j] = 1;
        }
    }
    cout << count(used.begin(), used.end()-1, 0) << endl;
    return 0;
}

Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;using ll=int_fast64_t;using ld=long double;using pll=pair<ll,ll>;constexpr ll INF=1LL<<60,MOD=1e9+7;//998244353;
void solve();int main(){cin.tie(nullptr);ios::sync_with_stdio(false);cout<<fixed<<setprecision(10);solve();return 0;}
#define SELECTOR(_1,_2,_3,_4,SELECT,...) SELECT
#define rep(...) SELECTOR(__VA_ARGS__,_rep2,_rep1,_rep0)(__VA_ARGS__)
#define _rep0(i,n) for(ll i=0;i<n;++i)
#define _rep1(i,k,n) for(ll i=k;i<n;++i)
#define _rep2(i,k,n,d) for(ll i=k;d>0?i<n:i>n;i+=d)
#define endl "\n"
#ifdef __LOCAL
#include "ostreams.h"
#endif
template<class T> inline bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
template<class T> vector<T> make_vector(size_t a,T b){return vector<T>(a,b);}
template<class... Ts> auto make_vector(size_t a,Ts... ts){return vector<decltype(make_vector(ts...))>(a,make_vector(ts...));}
void print(){cerr<<endl;} template<class T,class... Ts> void print(const T& a,const Ts&... ts){cerr<<a<<' ';print(ts...);}

void solve(){
    ll m, n; cin >> m >> n;
    vector<string> grid(m);
    rep(i, m){
        cin >> grid[i];
    }

    vector<pll> D{{-1, 0}, {1, 0}, {0, -1}, {0, 1}};
    auto used = make_vector(m, n, false);
    auto dfs = [&](ll i, ll j){
        if(used[i][j]){
            return (ll)0;
        }
        used[i][j] = true;
        vector<pll> stack{{i, j}};
        ll white = 0, black = 0;
        while(!stack.empty()){
            ll i, j; tie(i, j) = stack.back(); stack.pop_back();
            (grid[i][j] == '.' ? white : black) ++;
            for(auto& d : D){
                ll di, dj; tie(di, dj) = d;
                ll ni = i + di, nj = j + dj;
                if(!(0 <= ni and ni < m and 0 <= nj and nj < n)){
                    continue;
                }
                if(used[ni][nj]){
                    continue;
                }
                if(grid[i][j] != grid[ni][nj]){
                    used[ni][nj] = true;
                    stack.emplace_back(ni, nj);
                }
            }
        }
        return white * black;
    };

    ll res = 0;
    rep(i, m){
        rep(j, n){
            res += dfs(i, j);
        }
    }
    cout << res << endl;
}

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

namespace c
{
    class Program
    {
        static void Main(string[] args)
        {
            var _ = Console.ReadLine().Split();
            var n = int.Parse(_[0]);
            var m = int.Parse(_[1]);

            var minPos = 0;
            var maxPos = int.MaxValue;
            for(var i = 0; i < m; i++){
                var t = Console.ReadLine().Split();
                var l = int.Parse(t[0]);
                var r = int.Parse(t[1]);

                minPos = Math.Max(minPos, l);
                maxPos = Math.Min(maxPos, r);
            }

            var count = maxPos - minPos + 1;
            Console.WriteLine(count > 0 ? count : 0);
        }
    }
}


Measured memory_bytes: 17216
#include <bits/stdc++.h>
using namespace std;
int main(){
  int A,B,C,D,X,Y;
  cin >> A >> B >> C >> D;
  X = A+B;
  Y = C+D;
  if(X > Y) cout << "Left" << endl;
  else if(X < Y) cout << "Right" << endl;
  else cout << "Balanced" << endl;
}

Measured memory_bytes: 256
using System;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            Tuple<string, int,int>[] val = new Tuple<string, int,int>[n];
            for (int i = 0; i < n; i++)
            {
                var r = Console.ReadLine().Split();
                val[i] = new Tuple<string, int,int>(r[0],int.Parse(r[1]),i);
            }
            var a = val.OrderBy(v => v.Item1)
                .ThenByDescending(v => v.Item2).ToArray();
            Console.WriteLine(string.Join("\n",a.Select(v=>v.Item3+1)));
        }
    }
}

Measured memory_bytes: 13792
#include <bits/c++0x_warning.h>
#include <bits/stdc++.h>
using namespace std;

int x[100005], y[100005], par[100005];
vector<tuple<int, int, int>> edges;
int n, in[100005][2], z, cnt;

int dist(int x1, int y1, int x2, int y2) {
	return min(abs(x1 - x2), abs(y1 - y2));
}

int find(int index) {
	return par[index] == index ? index : par[index] = find(par[index]);
}

int merge(int p, int q) {
	return ((p = find(p)) != (q = find(q)) ? par[p] = q : 0);
}

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		par[i] = i;
		cin >> in[i][0] >> in[i][1];
	}
	for (int i = 0; i < n; i++) {
		x[i] = y[i] = i;
	}
	sort(x, x + n, [](int u, int v) {
		return in[u][0] < in[v][0];
	});
	for (int i = 0; i < n - 1; i++) {
		edges.emplace_back(in[x[i + 1]][0] - in[x[i]][0], x[i], x[i + 1]);
	}
	sort(y, y + n, [](int u, int v) {
		return in[u][1] < in[v][1];
	});
	for (int i = 0; i < n - 1; i++) {
		edges.emplace_back(in[y[i + 1]][1] - in[y[i]][1], y[i], y[i + 1]);
	}
	sort(edges.begin(), edges.end());
	for (auto i : edges) { 
		if (find(get<1>(i)) != find(get<2>(i))) {
			merge(get<1>(i), get<2>(i));
			cnt += get<0>(i);
		}
	}
	cout << cnt; 
}

Measured memory_bytes: 6644
//#define NDEBUG
#include <cstddef>
#include <cstdint>
#include <vector>

using i8 = ::std::int_least8_t;
using i32 = ::std::int_least32_t;
using i64 = ::std::int_least64_t;
using u8 = ::std::uint_least8_t;
using u32 = ::std::uint_least32_t;
using u64 = ::std::uint_least64_t;
using isize = ::std::ptrdiff_t;
using usize = ::std::size_t;

template <class T = usize> class rep {
	const T f, l;

public:
	class itr {
		friend rep;
		T i;
		constexpr itr(T x) noexcept : i(x) {}

	public:
		void operator++() noexcept { ++i; }
		T operator*() const noexcept { return i; }
		bool operator!=(const itr x) const noexcept { return i != x.i; }
	};
	constexpr rep(const T first, const T last) noexcept : f(first), l(last) {}
	itr begin() const noexcept { return itr(f); }
	itr end() const noexcept { return itr(l); }
};
template <class T = usize> class revrep {
	const T f, l;

public:
	class itr {
		friend revrep;
		T i;
		constexpr itr(T x) noexcept : i(x) {}

	public:
		void operator++() noexcept { --i; }
		T operator*() const noexcept { return i; }
		bool operator!=(const itr x) const noexcept { return i != x.i; }
	};
	constexpr revrep(const T first, const T last) noexcept : f(first), l(last) {}
	itr begin() const noexcept { return itr(l - 1); }
	itr end() const noexcept { return itr(f - 1); }
};
template <class T> bool maxi(T &a, const T &b) {
	return a <= b ? (a = b, 1) : 0;
}
template <class T> bool mini(T &a, const T &b) {
	return b <= a ? (a = b, 1) : 0;
}
template <class T> bool smaxi(T &a, const T &b) {
	return b <= a ? 0 : (a = b, 1);
}
template <class T> bool smini(T &a, const T &b) {
	return a <= b ? 0 : (a = b, 1);
}
template <class T> using vec_alias = ::std::vector<T>;
template <class T> auto md_vec(usize n, const T &value) {
	return ::std::vector<T>(n, value);
}
template <class... Args> auto md_vec(usize n, Args... args) {
	return ::std::vector<decltype(md_vec(args...))>(n, md_vec(args...));
}
template <class T> const T &as_const(const T &v) noexcept { return v; }

template <class T> T difference(const T &a, const T &b) {
	return a <= b ? b - a : a - b;
}


#include <algorithm>
#include <iostream>
#include <utility>

int main() {
	usize n;
	::std::cin >> n;
	::std::vector<char> s(n);
	for (auto &e : s) {
		::std::cin >> e;
	}
	usize q;
	::std::cin >> q;
	while (q--) {
		usize k;
		::std::cin >> k;
		u64 cntall = 0,cntd = 0, cntm = 0;
		u64 ans = 0;
		for (const auto i : rep<u64>(0, n)) {
			if (i >= k) {
				if (s[i - k] == 'D') {
					--cntd;
					cntall -= cntm;
				}
				else if (s[i - k] == 'M') {
					--cntm;
				}
			}
			if (s[i] == 'C') {
				ans += cntall;
			}
			else if (s[i] == 'M') {
				cntall += cntd;
				++cntm;
			}
			else if (s[i] == 'D') {
				++cntd;
			}
		}
		::std::cout << ans << ::std::endl;
	}
	return 0;
}


Measured memory_bytes: 1280
/*
オーダー
10**6	余裕を持って間に合う	
10**7	おそらく間に合う	余裕を持って間に合う
10**8	非常にシンプルな処理でない限り厳しい	おそらく間に合う
10**9		非常にシンプルな処理でない限り厳しい
logn	:OK
n		:10^7
nlogn	:10^6
n**2	:10^4
n**3	:300
2**n	:20
n!		:10



// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

sort(a, a + N, greater<int>());  // a[0:N] を大きい順にソート

int num[110] = {0};  // バケット
for (int i = 0; i < N; ++i) {
    num[d[i]]++;  // d[i] が 1 個増える
}

map<string, int> mp; // 連想配列 map<キー型, 値型> オブジェクト名
for (int i = 0; i < N; ++i) {
    auto itr = mp.find(s[i]);        // s[i] が設定されているか？
    if(itr != mp.end() ) {
         mp[s[i]] += 1;
    }
    else {
         mp[s[i]] += 1 ;
    }
}
stack<int> s;	//intをデータとするスタックを用意
s.push(1);		//{} -> {1}
printf("%d\n", s.top());	// 3
s.pop();

queue<int> que;	//intをデータとするキューを用意
que.push(1);		//{} -> {1}
printf("%d\n", que.front());	// 1
que.pop();
*/

#include <iostream>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <string.h>

using namespace std;

// #define for(i,a,b) for (int i=(a);i<(b);++i)
typedef long long ll;
typedef pair<ll,ll> P;
#define REP(i,n) for(long long i = 0; i < (long long)(n); i++)
#define pb push_back // vectorに要素追加
#define INF (ll)1e18
// int 
// // 各桁の和を計算する関数
// int findSumOfDigits(int n) {
//   int amari = 0;
//   int keta = 0;
//   while (n > 0) { // n が 0 になるまで
//     amari += n % 2;
//     if (keta%2==0)
//     n /= 10;
//   }
//   return sum;
// }
 
ll gcd(ll a, ll b) {
	if(b == 0) return a;
	return gcd(b, a % b);
}

// const ll MAX_N = 1e5;
// ll N;
// ll h[MAX_N];
// ll dp[MAX_N+1]; // メモ化テーブル
 
// // i番目以降の品物から重さの総和がj以下になるように選ぶ
// void rec(ll i){
// 	if (i==0) dp[i] = 0;
// 	else if (i==1) dp[i] = abs(h[1]-h[0]);
// 	else dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]));
// 	return;
// }
 
 
int main() {
	// 入力
	float T,X;
	cin >>T>>X;
	
	// 解法
	float ans = T/X;
	
	//出力
	cout << ans << endl;
}


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

#define si(a) scanf("%d",&a)
#define sl(a) scanf("%lld",&a)
#define sd(a) scanf("%lf",&a)
#define sc(a) scahf("%c",&a);
#define ss(a) scanf("%s",a)
#define pi(a) printf("%d\n",a)
#define pl(a) printf("%lld\n",a)
#define pc(a) putchar(a)
#define ms(a) memset(a,0,sizeof(a))
#define repi(i, a, b) for(register int i=a;i<=b;++i)
#define repd(i, a, b) for(register int i=a;i>=b;--i)
#define reps(s) for(register int i=head[s];i;i=Next[i])
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define pii pair<int,int>
#define mii unordered_map<int,int>
#define msi unordered_map<string,int>
#define lowbit(x) ((x)&(-(x)))
#define ce(i, r) i==r?'\n':' '
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define INF 0x3f3f3f3f
#define pr(x) cout<<#x<<": "<<x<<endl
using namespace std;

inline int qr() {
    int f = 0, fu = 1;
    char c = getchar();
    while (c < '0' || c > '9') {
        if (c == '-')fu = -1;
        c = getchar();
    }
    while (c >= '0' && c <= '9') {
        f = (f << 3) + (f << 1) + c - 48;
        c = getchar();
    }
    return f * fu;
}

const int N = 3e3 + 10;
int a[N][N];
ll dp[N][N][4];
int n, m, k;

int main() {
    n = qr(), m = qr(), k = qr();
    while (k--) {
        int x = qr(), y = qr(), z = qr();
        a[x][y] = z;
    }
    repi(i, 1, n)
        repi(j, 1, m) {
            dp[i][j][0] = max({dp[i - 1][j][0], dp[i - 1][j][1], dp[i - 1][j][2], dp[i - 1][j][3]});
            dp[i][j][1] = dp[i][j][0] + a[i][j];
            repi(u, 1, 3)dp[i][j][u] = max({dp[i][j][u], dp[i][j - 1][u - 1] + a[i][j], dp[i][j - 1][u]});
        }
    pl(max({dp[n][m][0], dp[n][m][1], dp[n][m][2], dp[n][m][3]}));
    return 0;
}

Measured memory_bytes: 321220
fn main() {
    proconio::input! {
        x: usize,
    }
    let n=x*2;
    let mut p=vec![true;n];
    let mut i=2;
    while i*i<=n {
        if p[i] {
            let mut k=2;
            while i*k<n {
                p[i*k]=false;
                k+=1;
            }
        }
        i+=1;
    }
    for i in x..n {
        if p[i] {
            println!("{}",i);
            break;
        }
    }
}

Measured memory_bytes: 2244
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,a,b,c,d;
  cin >> N;
  a=N/1000;
  b=N/100%10;
  c=N/10%10;
  d=N%10;
  if (a==b&&b==c)
    cout << "Yes" <<endl;
  else if (b==c&&d==c)
    cout << "Yes" <<endl;
  else
    cout << "No" <<endl;
}

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

typedef long long i64;

i64 N, S;
i64 getSum(i64 x, i64 base)
{
    i64 ans = 0;
    while(x)
    {
        ans += x % base;
        x /= base;
    }
    return ans;
}

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

    if (S > N)
    {
        cout << -1 << endl ;
        return 0;
    }
    if(S == N)
    {
        cout << N+1 << endl ;
        return 0;
    }

    for(i64 b = 2; b * b <= N; b++)
    {
        if(getSum(N, b) == S)
        {
            cout << b << endl ;
            return 0;
        }
    }

    for(i64 i = sqrt(N-S); i > 0; i--)
    {
        i64 b = (N - S) / i + 1;
        if((N-S) % i)
            continue;

        if(getSum(N, b) == S)
        {
            cout << b << endl ;
            return 0;
        }
    }

    cout << -1 << endl ;
    return 0;
}


Measured memory_bytes: 256