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

using namespace std;

#define REP(i, n)   for(int i = 0; i < (n); i++)
#define REPS(i, n)  for(int i = 1; i <= (n); i++)
#define RREP(i, n)  for(int i = (n)-1; i >= 0; i--)
#define RREPS(i, n) for(int i = (n); i > 0; i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define mp make_pair
#define mt make_tuple
#define pb push_back

using ll  = long long;
using pi  = pair<int, int>;
using pl  = pair<ll, ll>;
using vi  = vector<int>;
using vl  = vector<ll>;
using vs  = vector<string>;
using vb  = vector<bool>;
using vvi = vector<vi>;
using vvl = vector<vl>;

const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const ll  INFL = 1e18;
const double PI = 3.141592653589793;
const double EPS = 1e-9;

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

ll gcd(ll a, ll b)
{
    if(b == 0) return a;
    return gcd(b, a % b);
}

ll lcm(ll a, ll b)
{
    return a / gcd(a, b) * b; 
}

signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    ll N; cin >> N;
    vl T(N), A(N); REP(i, N) cin >> T[i] >> A[i];

    for(int i = 1; i < N; i++)
    {
        ll x = max((T[i-1]+T[i]-1)/T[i], (A[i-1]+A[i]-1)/A[i]);
        T[i] *= x;
        A[i] *= x;
    }

    cout << T[N-1]+A[N-1] << endl;
}

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

int main(){
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  string print;
  while (true){
    c -= b;
    if ( c <= 0){
      print = "Yes";
      break;
    }
    a -= d;
    if ( a <= 0){
      print = "No";
      break;
    }
  }
  cout << print << endl;
}
    
    


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

#define llint long long int

using namespace std;

int main(){
    int A, B;

    cin >> A >> B;

    for(int i = 1; i < 10000; i ++){
        if((int) (i * 0.08) == A && (int) (i * 0.10) == B){
            cout << i << endl;

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

Measured memory_bytes: 384
let H=Int(String(readLine()!.characters.split(" ")[0]))!
for i in 1...H {
  for (j,s) in readLine()!.characters.split(" ").enumerate() {
    if String(s) == "snuke" {
      print("\("ABCDEFGHIJKLMNOPQRSTUVWXYZ".characters.map{$0}[j])\(i)")
    }
  }
}

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

using namespace std;
using ll = long long;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    //int N;cin >> N;
    auto solved = [](ll N){
        int ans = 0;
        for(int a = 1;a <= N;a++){
            if(N/a == N%a)ans += a;
            //cout<<a<<" "<<N%a<<" "<<N/a<<endl;
        }
        //cout<<N<<": "<<ans<<endl;
        return ans;
    };
    //solved(1000);
    auto t = [](ll N){
        if(N <= 1000000){
            ll ans = 0;
            for(int a = 1;a <= N;a++){
                if(N/a == N%a)ans += a;
                //cout<<a<<" "<<N%a<<" "<<N/a<<endl;
            }
            //cout<<N<<": "<<ans<<endl;
            return ans;
        }
        vector<ll> yakusuu;
        ll ans = 0;
        for(int a = 1;a < sqrt(N);a++){
            if(N/a == N%a)ans += a;
            if(N%a == 0)yakusuu.push_back(a);
        }
        for(int a = 0;a < yakusuu.size();a++){
            ll c = N/yakusuu.at(a);
            ans += c-1;
        }
        return ans;
    };
    /*
    ll N;cin >> N;
    vector<ll> yakusuu;
    ll ans = 0;
    for(int a = 1;a < sqrt(N);a++){
        if(N/a == N%a)ans += a;
        if(N%a == 0)yakusuu.push_back(a);
    }
    for(int a = 0;a < yakusuu.size();a++){
        ll c = N/yakusuu.at(a);
        ans += c-1;
    }
    */
    //solved(N);
    //cout<<ans<<endl;
    /*
    for(int a = 1;a <= 100000;a++){
        if(solved(a) != t(a)){
            cout<<a<<" "<<solved(a)<<" "<<t(a)<<endl;
            break;
        }
    }
    */
    ll N;cin >> N;
    cout<<t(N)<<endl;
}


Measured memory_bytes: 384
#include<iostream>

#include <vector>
#include <list>
#include<stack>
#include<queue>
#include<array>

#include <set>
#include<map>

#include<string>
#include<stdlib.h>

#include<algorithm>
#include <functional>
#include<math.h>

#include<fstream>
#include<iomanip>

using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int,int>;

#define FOR(k,m,n) for(ll (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<<str<<endl

constexpr int INF = (1 << 30);
constexpr ll INFL = (1ll << 60);
constexpr ll MOD = 1000000007;// 10^9+7


//変数
ll H, W;
ll res = INFL;





//サブ関数
//入力
void input()
{
	cin >> H >> W;
}

void verify(ll a, ll b, ll c)
{
	ll ax = max(a, max(b, c));
	ll in = min(a, min(b, c));

	res = min(res, ax - in);
}

void split(ll area, pair<ll, ll> rest)
{
	// split H
	//cerr << "tmp: " << res << endl;
	ll u = (rest.first / 2) * rest.second;
	ll d = (rest.first - rest.first / 2)*rest.second;
	verify(u, d, area);

	//cerr << "tmp: " << res << endl;
	//split W
	ll l = rest.first * (rest.second/2);
	ll r = rest.first*(rest.second - rest.second / 2);
	verify(l, r, area);
	//cerr << "tmp: " << res << endl;
}

//計算
void calc()
{
	FOR(i, 1, H) split(i*W, { H - i,W });
	FOR(i, 1, W) split(H*i, { H,W - i });
}


//出力
void output()
{
	cout << res << endl;
}


//デバッグ
void debug()
{
	int N;
	cin>>N;
}


//メイン関数
int main()
{
	input();
	calc();
	output();
	debug();
	
	return 0;
}


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

#define INF 1e18
#define REP(i, n) for (int i=0; i<n; i++)
#define print(x) cout << x << endl
#define debug(x) cout << #x << " = "<< x << endl

const double PI=3.141592653589793238462643383279502884197169399375105820974944;

typedef long long ll;

using namespace std;

void solve() {
    int N, K;
    cin >> N >> K;
    vector<int> p(N);
    vector<double> E(N);
    REP(i, N) cin >> p[i];


    REP(i, N) {
        E[i] = double(1.0 + p[i]) / 2.0;
    }

    double current = 0.0;
    REP(i, K) {
        current += E[i];
    }
    double ans = current;
    for (int i = K; i < N; i++) {
        current = current - E[i-K] + E[i];
        ans = max(ans, current);
    }

    cout << fixed << setprecision(10) << ans << endl;
}

signed main() {
    solve();
}


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

int main(){
    int r,x,D;

    cin >> r >> D >> x ;

    for(int i=0; i<10; i++){
        x=r*x -D;
        cout << x << endl;
    }

    return 0;
}


Measured memory_bytes: 256
n=int(input())
a=[]
c1=c2=c3=c4=0
for i in range (0,n):
    t=input()
    a.append(t)
    if(a[i]=="AC"):
        c1+=1
    elif(a[i]=="WA"):
        c2+=1
    elif(a[i]=="TLE"):
        c3+=1
    else:
        c4+=1
print("AC x ",end="") 
print(c1)
print("WA x ",end="") 
print(c2)
print("TLE x ",end="") 
print(c3)
print("RE x ",end="") 
print(c4)
  

Measured memory_bytes: 16324
//グループの分け方→集合の集合の作り方。「集合」同士を「グループ人数→先頭の人の番号」でソートすると見通しがよい。
//同じ人数のグループをまとめて作っていくとき、少ない人数のグループから作れば、
//今後の探索に必要な情報が「残り人数n, グループ人数の下限m」だけになる。よって、状態数O(N^2)のDPができる。
//遷移では「m人グループを0 or C～D個」作る。
#include <iostream>
#define int long long
#define rep(i, n) for (i = 0; i < n; i++)
using namespace std;

int powmod(int a, int n, int mod) {
	if (n == 0) return 1;
	if (n & 1) return (a * powmod(a, n - 1, mod)) % mod;
	return powmod((a * a) % mod, n / 2, mod);
}

int mod = 1000000007;
int comb[1001][1001];
int fact[1001];
int factInv[1001];
int powFactInv[1001][1001];

void init() {
	int i, j;
	comb[0][0] = 1;
	for (i = 1; i < 1001; i++) {
		for (j = 0; j < 1001; j++) {
			if (j == 0) comb[i][j] = 1;
			else comb[i][j] = (comb[i - 1][j - 1] + comb[i - 1][j]) % mod;
		}
	}
	
	fact[0] = 1;
	factInv[0] = 1;
	for (i = 1; i < 1001; i++) {
		fact[i] = (fact[i - 1] * i) % mod;
		factInv[i] = powmod(fact[i], mod - 2, mod);
	}
	for (i = 0; i < 1001; i++) {
		for (j = 0; j < 1001; j++) {
			powFactInv[i][j] = powmod(factInv[i], j, mod);
		}
	}
}

int n, a, b, c, d;
int dp[1001][1001];	//dp[i][j] = 残りn人で, グループ人数の下限がmのとき, 分け方が何通りか？

int dfs(int n, int m) {
	if (n == 0){ return 1; }
	if (m > b) { return 0; }
	if (dp[n][m] != -1) return dp[n][m];
	
	int ret = dfs(n, m + 1);
	for (int x = c; x <= d; x++) {
		if (n < m * x) break;
		//n人の中から、m人グループをx個作る
		int way = fact[n] * factInv[n - m * x] % mod * powFactInv[m][x] % mod * factInv[x] % mod;
		int res = dfs(n - m * x, m + 1);
		ret += way * res;
		ret %= mod;
	}
	return dp[n][m] = ret;
}

signed main() {
	int i, j, k, l;
	
	init();
	rep(i, 1001) rep(j, 1001) dp[i][j] = -1;
	
	cin >> n >> a >> b >> c >> d;
	cout << dfs(n, a) << endl;
	return 0;
}

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

#define INF 10000000000

int main(){
	int n, r;
	long maxv = -INF, minv = INF;
	
	cin >> n;
	
	for(int i = 0 ; i < n ; i++){
		cin >> r;
		
		maxv = max(maxv, (long)r - minv);
		minv = min(minv, (long)r);
	}
	
	cout << maxv << endl;
	
	return 0;

}

Measured memory_bytes: 1164
N, M, X, Y = map(int, input().split())
X_list = [int(i) for i in input().split()]
Y_list = [int(i) for i in input().split()]

found = False
for Z in range(X+1, Y+1):
    if max(X_list) < Z and min(Y_list) >= Z:
        found = True
        print("No War")
        break
if not found:
    print("War")

Measured memory_bytes: 3060
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s1,s2;
    boolean eq = true;
    
    s1 = sc.next();
    s2 = sc.next();
    
    for(int i = 0;i < 3 && eq;i++){
      if(s1.charAt(i) != s2.charAt(2-i)) eq = false;
    }
        
    if(eq) System.out.println("YES");
    else System.out.println("NO");
  }
}


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

int main() {
    int D, G; cin >> D >> G; G /= 100;
    vector<int> p(D), c(D);
    for (int i = 0; i < D; i++){
        int r;
        cin >> p[i] >> r;
        c[i] = r/100;
    }
    int ans = 10000;

    for (int bit = 0; bit < (1<<D); bit++){
        int y = -1;
        int g = 0; int num = 0;
        for (int i = 0; i < D; i++){
            if ((bit >> i) & 1){
                g += (i+1) * p[i] + c[i];
                num += p[i];
            }
            else{
                y = max(y, i);
            }
        }
        g = G - g;
        if (g > (y+1) * (p[y] - 1)) continue;
        if (g <= 0){
            num += 0;
        }
        else if (g % (y+1) == 0){
            num += g/(y+1);
        }
        else{
            num += g/(y+1) + 1;
        }
        ans = min(ans, num);
    }
    cout << ans << endl;
    
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <list>

using namespace std;

#define BUF_SIZE (1 << 13)

typedef struct {
  double x;
  double y;
} Point;

Point main_buf[BUF_SIZE];
Point sub_buf[BUF_SIZE];

bool is_end(const Point* point)
{
  return point->x == 100.0 && point->y == 0;
}

void copy_point(Point* dst, const Point* src)
{
  memcpy(dst, src, sizeof(*dst));
}

void rotate_60(Point* res, const Point* src)
{
  res->x = src->x * cos(M_PI / 3.0) - src->y * sin(M_PI / 3.0);
  res->y = src->x * sin(M_PI / 3.0) + src->y * cos(M_PI / 3.0);
}

void compute_rotated_point(Point* res, const Point* p1, const Point* p3)
{
  Point zero_based;
  zero_based.x = p3->x - p1->x;
  zero_based.y = p3->y - p1->y;
  rotate_60(res, &zero_based);
  res->x = res->x + p1->x;
  res->y = res->y + p1->y;
}

void split_edge(Point* dst, const Point* src_left, const Point* src_right)
{
  copy_point(&dst[0], src_left);
  dst[1].x = (src_right->x - src_left->x) / 3.0 + src_left->x;
  dst[1].y = (src_right->y - src_left->y) / 3.0 + src_left->y;
  dst[3].x = 2.0 * (src_right->x - src_left->x) / 3.0 + src_left->x;
  dst[3].y = 2.0 * (src_right->y - src_left->y) / 3.0 + src_left->y;
  copy_point(&dst[4], src_right);
  compute_rotated_point(&dst[2], &dst[1], &dst[3]);
}

void next_state()
{
  int index = 0;
  int sub_index = 0;
  while(!is_end(&main_buf[index])) {
    split_edge(&sub_buf[sub_index], &main_buf[index], &main_buf[index+1]);
    index++;
    sub_index += 4;
  }
  memcpy(main_buf, sub_buf, (sub_index+1) * sizeof(*sub_buf));
}

void print_point(const Point* point)
{
  printf("%f %f\n", point->x, point->y);
}


void print_points()
{
  int index = 0;
  while(!is_end(&main_buf[index])) {
    print_point(&main_buf[index]);
    index++;
  }
  print_point(&main_buf[index]);
}

void init_points()
{
  main_buf[0].x = 0.0;
  main_buf[0].y = 0.0;
  main_buf[1].x = 100.0;
  main_buf[1].y = 0;
}

int main()
{
  int num;
  scanf("%d", &num);
  init_points();
  for(int i = 0; i < num; i++) {
    next_state();
  }
  print_points();
  return 0;
}



Measured memory_bytes: 2816
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($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)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $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, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (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:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
        mut m: usize,
        mut ab: [(usize, usize); n]
    }
    ab.sort_by_key(|x| x.0);
    let mut ans = 0;
    for (a, b) in ab {
        if b >= m {
            ans += a * m;
            break;
        } else {
            ans += a * b;
            m -= b;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 6396
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <queue>
#include <map>
#include <stack>
#include <bitset>
#include <numeric> //lcm
#include <iomanip> //double精度 setprecision

using namespace std;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = n-1; i >= 0; --i)
#define rep1(i,n) for(int i = 1; i <= (n); ++i)
#define all(vec) (vec).begin(),(vec).end()

#define debug(vec) for(auto v : vec) cout << v << " "; cout << endl;
#define debug2D(vec2D) for(auto vec : vec2D) { for (auto v : vec) cout << v << " "; cout << endl; } 
#define debugP(vec) for(auto v : vec) cout << "(" << v.first << "," << v.second << ") "; cout << endl;
#define debug2DP(vec2D) for(auto vec : vec2D) { for (auto v : vec) cout << "(" << v.first << "," << v.second << ") "; cout << endl; } 

typedef long long ll;

constexpr ll INF = 1000000000; //10^10
//const ll MOD = 998244353;
constexpr ll MOD = 1000000007;

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

int main() {

		int n; cin >> n;
		vector<int> a(n);
		rep(i,n) cin >> a[i];

		ll ans = 0;
		int r = 0;
		int sum = 0;
		rep(l, n) {
			while (r < l) r++;
			
			while (r < n && (sum & a[r]) == 0) {
				sum ^= a[r];
				r++;
			}
			ans += (r-l);

			sum ^= a[l];
		}
		cout << ans << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


char buf[4];

int main(){

	scanf("%s",buf);

	if(buf[1] == 'B'){

		printf("ARC\n");

	}else{

		printf("ABC\n");
	}

	return 0;
}


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

#define ll          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;
string s[1000006];
vii neg,pos;
vi tr;
void solve(){
	cin>>n;
	string w;
	rep(i,0,n){
		cin>>s[i];
		int cur=0,res=hell;
		for(auto j:s[i]){
			if(j=='(') cur++;
			else cur--;
			res=min(res,cur);
		}
		if(res<0){
			if(cur>0) pos.pb({res,i});
			else if(res-cur) neg.pb({res-cur,i});
			else    tr.pb(i);
		}
		else w+=s[i];
	}
	sort(all(pos));
	reverse(all(pos));
	//sort(all(neg));
	for(auto i:pos) w+=s[i.y];
	for(auto i:neg) w+=s[i.y];
	for(auto i:tr) w+=s[i];
	int cur=0;
	for(auto i:w){
		if(i=='(') cur++;
		else cur--;
		if(cur<0){
			cout<<"No"<<endl;
			return;
		}
	}
	if(cur) cout<<"No"<<endl;
	else cout<<"Yes"<<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: 39256
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <numeric>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

const int D = 60;
const int MAX_N = 200005;
int to[D][MAX_N];

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

	int a;
	a = N % 10;

	string str;

	switch (a) {
	case 2:
		str = "hon";
		break;
	case 4:
		str = "hon";
		break;
	case 5:
		str = "hon";
		break;
	case 7:
		str = "hon";
		break;
	case 9:
		str = "hon";
		break;
	case 0:
		str = "pon";
		break;
	case 1:
		str = "pon";
		break;
	case 6:
		str = "pon";
		break;
	case 8:
		str = "pon";
		break;
	case 3:
		str = "bon";
		break;
	}

	cout << str;
}


Measured memory_bytes: 3628
#pragma region
#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define reps(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; --i)
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define eb emplace_back
#define debug(x) cerr << #x << ": " << x << '\n'
#define INF 1e9
using namespace std;
template <class T = int>
T in() {
  T x;
  cin >> x;
  return (x);
}

typedef long long ll;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}

#pragma endregion

int main() {
  int n = in(), m = in();
  int sum = 0;
  rep(i, m) { sum += in(); }
  cout << max(-1, n - sum) << endl;
  return 0;
}


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

int main() {
  int64_t a,b;
  cin >> a; 
  for(int j=1;j<sqrt(a)+1;j++){
    if(a%j==0){
    b=j;
    }
  }
  cout << ((a/b)-1)+(b-1) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define int long long
#define INF 1000000000000000000
using namespace std;

#define ANS(f) if(f) cout << "YES" << endl; else cout << "NO" << endl;

typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;

template<typename T>
void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readi(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }
void debug(mat m){REP(i, m.size()){ REP(j, m[i].size()){ cout << m[i][j] << ","; } cout << endl; }}



signed main(){

    int N; cin >> N;
    vec a(N); readv(a);

    vec asum(N + 1);
    asum[0] = 0;
    REP(i, N) asum[i + 1] = a[i] + asum[i];

    mat dp(N, vec(N, INF));
    REP(i, N) dp[i][i] = 0;

    FOR(d, 1, N){
        REP(i, N - d){
            int j = i + d;
            int c = asum[j + 1] - asum[i];
            REP(k, d){
                dp[i][j] = min(dp[i][j], dp[i][i + k] + dp[i + k + 1][j] + c);
            }
        }
    }
    //debug(dp);
    cout << dp[0][N - 1];
    
    return 0;
}

Measured memory_bytes: 1536
#![allow(unused_imports)]
#![allow(dead_code)]

use proconio::input;
use std::collections::*;

fn main() {
    input! {
        n:usize,
        a:[usize;n-1]
    }
    let b: Vec<usize> = a.iter().map(|x| x - 1).collect();
    let mut ans = vec![0; n];
    for e in b.iter() {
        ans[*e] += 1;
    }
    for e in ans.iter() {
        println!("{}", e);
    }
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,a,b) for(int i=a;i<b;i++)
#define each(it,v) for(auto it : v)
#define mod 1000000007
#define all(v) (v).begin(),(v).end()
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define vpii vector<pair<int,int>>
#define vv vector<vector<int>>
using namespace std;

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


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

using namespace std;

#define LOG(...) fprintf(stderr,__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

vector<string> te = {"Rock", "Fire", "Scissors", "Snake", "Human", "Tree", "Wolf", "Sponge", "Paper", "Air", "Water", "Dragon", "Devil", "Lightning", "Gun"};

int main() {
    map<string, int> te_idx;
    REP(i, te.size()) {
        te_idx[te[i]] = i;
    }

    int n;
    while (cin >> n, n) {
        vb attack(15);
        vb defeat(15);
        vb seen(15);
        REP(i, n) {
            string t;
            cin >> t;
            seen[te_idx[t]] = true;
        }
        REP(i, 15) {
            if (seen[i]) {
                FOR(j, i, i + 7) {
                    int idx = (j+1) % 15;
                    if (seen[idx]) {
                        attack[i] = true;
                        defeat[idx] = true;
                    }
                }
            }
        }
        REP(i, 15) {
            if (seen[i] && !defeat[i] && attack[i]) {
                cout << te[i] << endl;
                goto NEXT;
            }
        }
        cout << "Draw" << endl;
    NEXT: {}
    }
}

Measured memory_bytes: 1216
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto N = readln.chomp.to!int;
    int[] AS, cs;
    foreach (_; 0..N) AS ~= readln.chomp.to!int;
    foreach (a; AS) {
        if (cs.empty || cs[$-1] >= a) {
            cs ~= a;
        } else if (cs[0] < a) {
            cs[0] = a;
        } else {
            int l, r = cs.length.to!int-1;
            while (l+1 < r) {
                auto m = (l+r)/2;
                if (a > cs[m]) {
                    r = m;
                } else {
                    l = m;
                }
            }
            cs[r] = a;
        }
    }
    writeln(cs.length);
}

Measured memory_bytes: 3964
#include<bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define dofloat cout<<fixed<<setprecision(8)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define bitcount __builtin_popcount
#define all(vec) vec.begin(),vec.end()
#define rall(vec) vec.rbegin(),vec.rend()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<long long> vl;
typedef pair<long long,long long> pll;
typedef vector<pair<long long,long long> > vll;
typedef vector<pair<int,int> > vii;
typedef vector<int> vi;
typedef pair<int,int> ii;
const long long MOD=1000000007;
const long long MAX=100005;
const long double PI=3.14159265359;
const long double G=9.807;
const long long INF=1e18;
const long double EPS=1e-6;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
bool isprime(ll a){
  if(a==2)return 1;
  if(!(a&1))return 0;
  for(ll i=3;i*i<=a;i+=2)
    if(a%i==0)return 0;
  return 1;
}
ll mpow(ll base,ll exponent,ll modulus){
  if(modulus==1)return 0;
  long long result = 1;
  base=base%modulus;
  while(exponent){
    if(exponent%2 == 1)
	  result=(result*base)%modulus;
	  exponent=exponent>>1;
	  base=(base*base)%modulus;
  }
  return result;
}
ll minv(ll a,ll mod){
  ll _gcd=gcd(a,mod);
  assert(_gcd==1);
  return mpow(a,mod-2,mod);
}


/*
ll ncr(ll N,ll K){
	if(N<K)return 0;
	if(K==0)return 1;
	if(N==0)return 0;

	ll den=1;
	for(ll i=1;i<=K;i++)den*=i;
	ll num=1;
	while(K--){
		num*=N;
		if(num%den==0){
			num/=den;
			den=1;
		}
		N--;
	}

	return num;
}
*/
ll a,b,k;
int main(){FAST;
cin>>a>>b>>k;
for(ll i=a;i<=b;i++){
	if(i<=a+k-1 or i>=b-k+1){
		cout<<i<<'\n';
	}
}
return 0;
}

Measured memory_bytes: 256
S = input()
first = int(S[:2])
last = int(S[2:])
if 1 <= first <= 12 and 1 <= last <= 12:
    print('AMBIGUOUS')
elif 1 <= first <= 12:
    print('MMYY')
elif 1 <= last <= 12:
    print('YYMM')
else:
    print('NA')

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

int main(){
	const int nmax = 1000;
	int a[nmax], next[nmax];
	int N, M;
	while(cin >> N >> M){
		if(N == 0 && M == 0) break;
		int i = 1;
		for(; i < N; i++){
			a[i] = i; next[i] = i+1;
		}
		a[N] = N;
		next[N] = 1;
		while(next[i] != i){
			for(int j = 1; j < M; j++) i = next[i];
			next[i] = next[next[i]];
		}
		cout << a[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
typedef double db;
typedef long long ll;
const ll mod=1e9+7;
ll n,a[300010],ans;
ll cnt[2][64],p,sv[64],pow2[64];
int main(){
	cin>>n;
	pow2[0]=1;
	for(int i=1;i<=62;i++){
		pow2[i]=2ll*pow2[i-1]%mod;
	}
	for(int i=1;i<=n;i++){
		scanf("%lld",&a[i]);
	}
	for(int i=n;i>=1;i--){
		p=0;memset(sv,0,sizeof(sv));
		while(a[i]){
			sv[++p]=a[i]%2ll;
			a[i]/=2ll;
		}
		for(int i=1;i<=62;i++){
			ans=(ans+pow2[i-1]*cnt[1-sv[i]][i]%mod)%mod;
		}
		for(int i=1;i<=62;i++){
			cnt[sv[i]][i]++;
		}
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 2560
//  @ /\/\ BESH //

#include <bits/stdc++.h>
#define inp_out_work ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define testCase    int T; cin>>T; while(T--)
#define fr(i,n) for(int i=0;i<n;i++)
#define fro(i,s,e) for(int i=s;i<=e;i++)
#define endl '\n'
#define debug(P) cout<<#P<<" = "<<P<<endl;
#define pb push_back


using namespace std;

typedef long long ll;
typedef long double ld;

const int MAXN = 2000001;
const ll mod = 1000000007;

ll fac[MAXN];
ll inv[MAXN];

ll modPower(ll x,ll y){
    x%=mod;
    ll res = 1;
    while(y){
        if(y&1)res= (res*x)%mod;
        x = (x*x)%mod;
        y>>=1;
    }
    return res;
}

void pre(){
    fac[0] = 1;
    for(ll i = 1; i < MAXN; i++)fac[i] = (i * fac[i-1])%mod;
    inv[MAXN-1] = modPower(fac[MAXN-1] , mod-2);
    for(ll i = MAXN-2; i >= 0; i--)inv[i] = (inv[i+1] * (i+1))%mod;
}

int main(){
    pre();
    int x, y;
    cin>>x>>y;
    if(2*x < y || 2*y < x || (2*x-y) %3 || (2*y-x)%3){
        cout<< 0 << endl;
        return 0;
    }

    ll p = (2*x - y)/3, q = (2*y - x)/3;

   // debug(p); debug(q);

    ll ans = fac[p+q] * inv[p] %mod;
    ans = ans * inv[q] %mod;
    cout<< ans << endl;

}


Measured memory_bytes: 31488
import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_matrix(H):
    '''
    H is number of rows
    '''
    return [list(map(int, read().split())) for _ in range(H)]


def read_map(H):
    '''
    H is number of rows
    文字列で与えられた盤面を読み取る用
    '''
    return [read()[:-1] for _ in range(H)]


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H, n_cols):
    '''
    H is number of rows
    n_cols is number of cols

    A列、B列が与えられるようなとき
    '''
    ret = [[] for _ in range(n_cols)]
    for _ in range(H):
        tmp = list(map(int, read().split()))
        for col in range(n_cols):
            ret[col].append(tmp[col])

    return ret


N = read_a_int()
print((N + 1) // 2)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/adaptor/indexed.hpp>

using namespace std;
using boost::irange;
using namespace boost::adaptors;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;
constexpr ll INF = 1000000000000000ll;

int main() {
  ll n,m,l;
  cin>>n>>m>>l;
  vector<vecll> md(n,vecll(n,INF));
  for(ll i:irange(0l,m)) {
    ll a,b,c;
    cin>>a>>b>>c;
    --a;--b;
    md[a][b] = c;
    md[b][a] = c;
  }
  for(ll k:irange(0l,n))
    for(ll i:irange(0l,n))
      for(ll j:irange(0l,n))
        md[i][j] = min(md[i][j], md[i][k]+md[k][j]);
  vector<vecll> mc(n,vecll(n,INF));
  for(ll i:irange(0l,n))
    for(ll j:irange(0l,n))
      if (md[i][j] <= l)
        mc[i][j] = 1;
  for(ll k:irange(0l,n))
    for(ll i:irange(0l,n))
      for(ll j:irange(0l,n))
        mc[i][j] = min(mc[i][j], mc[i][k]+mc[k][j]);
  ll q;
  cin>>q;
  for(ll cnt:irange(0l,q)) {
    ll s,t;
    cin>>s>>t;
    --s;--t;
    if (mc[s][t] < INF) {
      cout<<mc[s][t]-1<<endl;
    } else {
      cout<<-1<<endl;
    }
  }
  return 0;
}


Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(0);cin.tie();cout.tie();
#define ff first
#define ss second
#define pb push_back
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll inf = 9223372036854775807;
const ll mininf = -9223372036854775807;
const ll nax = 0;
ll n, ans=0;

int main(){
	IOS
	cin >> n;
	for(int i=2;i<=1000001;i++){
		int cur=0;
		while(n%i==0){
			cur++;
			n/=i;
		}
		for(int j=1;j<=1000000;j++){
			if(j>cur){
				break;
			}
			cur-=j;
			ans++;
		}
	}
	if(n>1){
		ans++;
	}
	cout << ans << '\n';
}

Measured memory_bytes: 3636
N=int(input())
dic={}
for i in range(N):
    s=input()
    if s in dic:
        dic[s]+=1
    else:
        dic[s]=0
m=max(dic[i] for i in dic)
ans=[]
for j in dic:
    if dic[j]==m:
        ans.append(j)
ans.sort()
for k in range(len(ans)):
    print(ans[k])

Measured memory_bytes: 92376
import sys
input = sys.stdin.readline
RS = input
RI = lambda x=int: x(RS())
RA = lambda x=int: map(x, RS().split())
RSS = lambda: RS().split()


def solve():
    start = h1*60 + m1
    end = h2*60 + m2
    print(end- k - start)
    return



h1, m1, h2, m2, k = RA()
solve()


Measured memory_bytes: 61696
// In the name of God

#include <bits/stdc++.h>
using namespace std;
long double a[55];
long double ans(int l, int r) {
	if(l==r) return a[l];
	if(r-l==1) return (a[l]+a[r])/2;
	else return a[l]/2.0+ans(l+1, r)/2.0;
}
int main() {
	ios_base::sync_with_stdio(0), cin.tie(0);
	int n;
	cin >> n;
	for(int i=0;i<n;i++) {
		long double x;
		cin >> x;
		a[i]=x;
	}
	sort(a, a+n, greater<long double>());
	cout << ans(0, n-1);
	return 0;
}


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

def func(num):
    for item in A:
        num=num//item*item
    return num

ok=10**20
ng=0

while ok-ng>1:
    mid=(ok+ng)//2
    if func(mid)>=2:
        ok=mid
    else:
        ng=mid

low=ok

ok=10**20
ng=0

while ok-ng>1:
    mid=(ok+ng)//2
    if func(mid)>=4:
        ok=mid
    else:
        ng=mid

high=ng

if func(low)==2 and func(high)==2:
    print(low,high)
else:
    print(-1)


Measured memory_bytes: 14252
#include <iostream>
#include <string>
using namespace std;
int main(int argc, const char * argv[]) {
    int N,ans=0;
    cin>>N;
    int a[N];
    for(int i=0;i<N;i++) {cin>>a[i]; a[i]--;}
    
    for(int i=0;i<N;i++){
        if(a[a[i]]==i)ans++;
    }
    cout<<ans/2<<endl;
    return 0;
}


Measured memory_bytes: 768
import os, sys, re, math

N = int(input())

a = list(map(int,input().split(' ')))

memo = [0 for _ in range(N+1)]

for i in range(N,0,-1):
    temp_s = 0
    m = 2
    while m * i <= N:
        temp_s += memo[m*i]
        m += 1

    memo[i] = (temp_s % 2) ^ a[i-1]

ret = [i for i in range(1,N+1) if memo[i] == 1]
if len(ret) == 0:
    print(0)
else:
    print(len(ret))
    ret = list(map(str,ret))
    print(' '.join(ret))


Measured memory_bytes: 72164
#include<iostream>
using namespace std;
int main(){
   int n,h,w;
   cin>>n>>h>>w;
   int ans=0;
   for(int i=0;i<n;i++){
      int a,b;
      cin>>a>>b;
      if(a>=h&&b>=w)ans++;
   }
   cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N, A;
    cin >> N;
    int count = 0;
    for(int i = 0; i < N; i++) {
        cin >> A;
        int tmp = 0;
        while(A%2 == 0) {
            A = A / 2;
            tmp++;
        }
        if(i == 0){
            count = tmp;
        }else{
            count = min(count, tmp);    
        }
         
    }
    cout << count << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

#define N 100000
#define NIL -1

int depth(int);
int height(int);

struct Node{
    int parent;
    int left;
    int right;
};

struct Node T[N];

int main(){

    int n,i,id;

    scanf("%d",&n);

    for(i=0;i<n;i++) T[i].parent=T[i].left=T[i].right=NIL;
    
    for(i=0;i<n;i++){

        scanf("%d",&id);

        scanf("%d%d",&T[id].left,&T[id].right);

        if(T[id].left!=NIL) T[T[id].left].parent=id;

        if(T[id].right!=NIL) T[T[id].right].parent=id;

    }

    for(i=0;i<n;i++){

        printf("node %d: parent = %d, sibling = ",i,T[i].parent);

        if(T[i].parent==NIL) printf("-1, ");

        else{

            if(T[T[i].parent].left==i) printf("%d, ",T[T[i].parent].right);

            else printf("%d, ",T[T[i].parent].left);

        }

        printf("degree = ");

        if(T[i].left==NIL && T[i].right==NIL) printf("0, ");

        else{

            if(T[i].left!=NIL && T[i].right!=NIL) printf("2, ");

            else printf("1, ");

        }

        printf("depth = %d, height = %d, ",depth(i),height(i));

        if(T[i].parent==NIL) printf("root");

        else{

            if(T[i].left==NIL && T[i].right==NIL) printf("leaf");

            else printf("internal node");
        }

        printf("\n");

    }

    return 0;

}

int depth(int x){

    if(T[x].parent==NIL) return 0;

    return depth(T[x].parent)+1;

}

int height(int x){

    int left=0,right=0;

    if(T[x].left==NIL && T[x].right==NIL) return 0;

    if(T[x].left!=NIL) left=height(T[x].left)+1;

    if(T[x].right!=NIL) right=height(T[x].right)+1;

    if(left>right) return left;

    else return right;

}

Measured memory_bytes: 604
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <vector>

// lib/detail/ceil_and_floor.hpp
#ifndef DETAIL_CEIL_AND_FLOOR_HPP
#define DETAIL_CEIL_AND_FLOOR_HPP

namespace tools {
  template <typename T>
  constexpr T floor(T lhs, T rhs);

  template <typename T>
  constexpr T ceil(T lhs, T rhs);

  template <typename T>
  constexpr T floor(const T lhs, const T rhs) {
    return
      lhs >= 0 && rhs >= 0 ?
        lhs / rhs :
      lhs < 0 && rhs >= 0 ?
        -ceil<T>(-lhs, rhs) :
      lhs >= 0 && rhs < 0 ?
        -ceil<T>(lhs, -rhs) :
        floor<T>(-lhs, -rhs);
  }

  template <typename T>
  constexpr T ceil(const T lhs, const T rhs) {
    return
      lhs >= 0 && rhs >= 0 ?
        (lhs - 1 + rhs) / rhs :
      lhs < 0 && rhs >= 0 ?
        -floor<T>(-lhs, rhs) :
      lhs >= 0 && rhs < 0 ?
        -floor<T>(lhs, -rhs) :
        ceil<T>(-lhs, -rhs);
  }
}

#endif

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef ::std::int_fast64_t i64;
typedef ::std::uint_fast64_t u64;
typedef ::std::int_fast32_t i32;
typedef ::std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(::std::istream& is, ::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    vector.reserve(size);
    ::std::copy_n(::std::istream_iterator<T>(is), size, ::std::back_inserter(vector));
  }
  template <typename T>
  void read(::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    ::tools::read(::std::cin, vector, size);
  }

  template <typename T, ::std::size_t N>
  void read(::std::istream& is, ::std::array<T, N>& array) {
    ::std::copy_n(std::istream_iterator<T>(is), N, array.begin());
  }
  template <typename T, ::std::size_t N>
  void read(::std::array<T, N>& array) {
    ::tools::read(::std::cin, array);
  }
}

#endif

// lib/ceil.hpp
#ifndef CEIL_HPP
#define CEIL_HPP


/*
usage:

tools::ceil(5, 3) // => 2 (i.e., ceil(5 / 3))
*/

#endif

// main.cpp

int main() {
  i64 N;
  std::cin >> N;
  std::cout << tools::ceil<i64>(N, 2) << std::endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <limits>
#include <algorithm>
#include <utility>
#include <sstream>
#include <numeric>
#include <iterator>

using namespace std;

#define repd(i,a,b) for (int i=(a);i<(b);++i)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef pair<int, int> P;

int main(int argc, const char * argv[]) {
  double r;
  cin >> r;
  printf("%.16f\n", 2*r*3.14);
  return 0;
}


Measured memory_bytes: 3232
n = gets.to_i
x = gets.split.map(&:to_i)
pmax = x.max

dist = Hash.new(0)
1.upto(pmax) do |p|
  sum = x.inject(0) do |r, a|
    r + ((a - p).abs**2)
  end
  dist[p] = sum
end

puts dist.values.min

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s,t;
  cin>>s>>t;
  int ans=100000;
  int n=t.size();
  int m=s.size();
  for(int i=0;i+n<=m;i++){
    string moji=s.substr(i,n);
    int res=0;
    for(int j=0;j<n;j++){
      if(t[j]!=moji[j])res++;
    }
    ans=min(ans,res);
  }
  cout<<ans<<endl;
  return 0;
}

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

int main() {
  int N;
  cin >> N;
  
  vector<string> ss(N);
  for (int i = 0; i < N; i++) {
    cin >> ss.at(i);
  }
  
  int M;
  cin >> M;
  
  vector<string> ts(M);
  for (int i = 0; i < M; i++) {
    cin >> ts.at(i);
  }
  
  int max = 0;
  for (int i = 0; i < N; i++) {
    int c = 0;
    for (int j = 0; j < N; j++) {
      if (ss[i] == ss[j]) c++;
    }
    
    for (int j = 0; j < M; j++) {
      if (ss[i] == ts[j]) c--;
    }
    
    if (c > max) max = c;
  }
  
  cout << max << endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
def main():
    import sys
    import numpy as np

    input = sys.stdin.readline

    A, B, H, M = map(int, input().split())

    pi = np.pi
    time = 60 * H + M
    theta_H = (time * 2 * pi) / (12 * 60)
    theta_M = (M * 2 * pi) / 60
    res = abs(theta_H - theta_M)
    theta = min(res, 2 * pi - res)
    ans = np.sqrt(A ** 2 + B ** 2 - 2 * A * B * np.cos(theta))
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 26848
#include<bits/stdc++.h>
using namespace std;
const long long INF=0x3f3f3f3f3f3f3f3fLL;
const int M=100005;
long long dp[M];
int P[M],Q[M];
long long mi=INF;
int n,e,t,l,r;
int main(){
	scanf("%d%d%d",&n,&e,&t);
	for(int i=1;i<=n;++i)
		scanf("%d",P+i);
	Q[r++]=0;
	for(int i=0,j=1;j<=n;++j){
		while(t<=2*(P[j]-P[i+1])){
			mi=min(mi,dp[i]-P[i]-2*P[i+1]);
			if(l<r && Q[l]<=i)
				++l;
			++i;
		}
		dp[j]=3LL*P[j]+mi;
		if(l<r)
			dp[j]=min(dp[j],dp[Q[l]]+P[j]-P[Q[l]]+t);
		while(l<r && dp[j]-P[j]<=dp[Q[r-1]]-P[Q[r-1]])
			--r;
		Q[r++]=j;
	}
	printf("%lld\n",dp[n]+e-P[n]);
	return 0;
}


Measured memory_bytes: 5328
#084_C
#二分探索
import bisect

n=int(input())
a=sorted(list(map(int,input().split())))
b=sorted(list(map(int,input().split())))
c=sorted(list(map(int,input().split())))
ans=0

for i in range(n):
    #a
    res_a=bisect.bisect_left(a,b[i])
    #c
    res_c=n-bisect.bisect_right(c,b[i])
    
    ans+=res_a*res_c
    
print(ans)

Measured memory_bytes: 23092
#include <bits/stdc++.h> 
#define ll long long
#define ull unsigned long long
#define endl '\n'
#define pb push_back
#define mp make_pair
#define sp(x) fixed<<setprecision(x)
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;

int main()
{
    int n;
    cin>>n;
    double p;
    double ans=0;
    
    vector<double> dp(n+1);
    dp[0] = 1;
    
    for(int coins=0;coins<n;coins++)
    {
        cin>>p;
        for(int i=coins+1;i>=0;i--)
        {
           // double s = (i==0) ? 0 : p*dp[i-1];
            dp[i] = (i==0 ? 0 : p*dp[i-1] )+ dp[i]*(1-p);
        }
    }
    
    for(int heads=0;heads<=n;heads++)
    {
        int tails = n-heads;
        if(heads > tails)
        ans += dp[heads];
    }
    cout<<sp(10)<<ans<<endl;
    
    return 0;
    
}


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

typedef long long ll;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)

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

ll A, B, C, D, E, F, G, H, I, J, K, L, M,
N, O, P, Q, R, S, T, U, V, W, X, Y, Z;

//* ?????????n??????????????\??????????????????????????????????????????
template <typename T>
vector<T> INP(ll n)
{
	vector<T> x;
	REP(i, n) {
		T tmp; cin >> tmp;
		x.push_back(tmp);
	}
	return x;
}
//* n??????1????????????????????\?????????????????????????????¨??????????????????
vector<char> SPRIT_STRING(ll n)
{
	string str; cin >> str;
	vector<char> cs(n);
	REP(i, n) cs[i] = str[i];
	return cs;
}
//* ??§?¨?nx, ny???Width,Height?????????????????????????????????????????§??????
inline bool rangeCheck2D(int nx, int ny, int Width, int Height)
{
	return nx >= 0 and nx < Width and ny >= 0 and ny < Height;
}
//* ?´???°?????? is_prime<unsigned>(N)
template<typename T, std::enable_if_t<std::is_unsigned<T>::value, std::nullptr_t> = nullptr>
bool is_prime(const T n) {
	if (n < 4) return n == 2 || n == 3;
	if (n % 2 == 0 || n % 3 == 0 || (n % 6 != 1 && n % 6 != 5)) return false;
	for (T i = 5; i * i <= n; i += 6) if (n % i == 0 || n % (i + 2) == 0) return false;
	return true;
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2007
namespace makePurseLight {
	void makePurseLight()
	{
		cin >> N;
		int n[] = { 500, 100, 50, 10 };
		while (true) {
			int num[4];
			REP(i, 4) cin >> num[3-i];
			int sum = 0;
			REP(i, 4) sum += n[i] * num[i];
			int ret = sum - N;
			vector<int> cnt(4);
			while (ret > 0) {
				REP(i, 4) if (ret >= n[i]) {
					ret -= n[i]; cnt[i]++;
					break;
				}
			}
			REP(i, 4) {
				int ri = 3 - i;
				int ans = num[ri] - cnt[ri];
				if (ans > 0) cout << n[ri] << " " << ans << endl;
			}
			cin >> N;
			if (N == 0)
				break;
			else
				cout << endl;
		}
	}
}

int main()
{
	makePurseLight::makePurseLight();
	return 0;
}


Measured memory_bytes: 3076
#include<bits/stdc++.h>
/*
g++ -std=c++11 -Wall -g -fsanitize=undefined -D_GLIBCXX_DEBUG abc/abc118/c.cpp
*/
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define SZ(x) ((int)(x).size())
#define INF (1e16)
typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<ll> a(n);
    int m = 1e9 + 1;
    int ind;
    rep(i, n){
        cin >> a[i];
        if(a[i] < m){
            m = a[i];
            ind = i;
        }
    }
    
    // int ans = 1e9 + 1;
    int next = m;
    int next_ind = ind;
    while(1){
        int cnt = 0;

        rep(i, n){
            if(i == ind) continue;
            if(a[i] == 0){
                cnt++;
                continue;
            }

            a[i] = a[i] %= m;
            if(a[i] != 0 && a[i] < next){
                next = a[i];
                next_ind = i;
            }
        }
        if(cnt == n - 1){
            cout << m << "\n";
            return 0;
        }
        m = next;
        ind = next_ind;
    }


    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define f(i,a,b) for(int i(a);i<b;i++)
#define rep(i,n) for(int i(0);i<n;i++)
#define fast  ios_base::sync_with_stdio(0); cin.tie(0);
#define pres(x) cout<<fixed; cout<<setprecision(x);
#define open freopen("input.txt","r",stdin) ; freopen("output.txt","w",stdout);
#define watch(x) cout<<(#x)<<" is "<<x<<"\n";
#define out(x) cout<<x<<"\n";
#define mod 1000000007

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

int32_t main(){
	
	fast;
	//open;

	int n,d;
	cin>>n>>d;
	cout<<c(n , 2*d + 1);




	return 0;
}

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

using namespace std;

#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<(n);++i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(int)(n);i>=0;--i)
#define RFOR(i, a, b) for(int i=(int)(a);i>=(int)(b);--i)
#define ALL(a) (a).begin(),(a).end()
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;

const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

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

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

template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  REP(i, SZ(v)) {
    if (i) os << " ";
    os << v[i];
  }
  return os;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int n, k;
  cin >> n >> k;
  vi vl, vr;
  for (ll i = 1; i * i <= n; ++i) {
    int tmpr = n / i;
    int tmpl = n / (i + 1);
    vl.push_back(1);
    if (n / i != i)vr.push_back(tmpr - tmpl);
  }
  //cout << vl << endl;
  //cout << vr << endl;

  vi v = vl;
  RREP(i, SZ(vr) - 1) {
    v.push_back(vr[i]);
  }
  int sz = SZ(v);

  vvll dp(k + 1, vll(sz, 0));
  dp[0][0] = 1;
  REP(i, k) {
    vll su(sz + 1);
    REP(j, sz) {
      su[j + 1] = (su[j] + dp[i][j]) % MOD;
    }

    RREP(j, sz - 1) {
      dp[i + 1][sz - 1 - j] = su[j + 1] * v[sz-1-j] % MOD;
    }
  }

  ll ans = 0;
  REP(i, sz) {
    (ans += dp[k][i]) %= MOD;
  }
  cout << ans << endl;

  return 0;
}








Measured memory_bytes: 54332