akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n;
  cin>>n;
  vector<vector<char>> ss(n, vector<char>(10));
  for(int i=0; i<n; i++){
    for(int j=0; j<10; j++){
      cin>>ss.at(i).at(j);
    }
    sort(ss.at(i).begin(), ss.at(i).end());
  }
  
  int64_t count =0;
  map<vector<char>, int> ma;
  for(int i=0; i<n ; i++){
    if(ma.count(ss.at(i))){
      count +=ma.at(ss.at(i));
      ma.at(ss.at(i))++;
    }
    else ma[ss.at(i)] = 1;
  }
  cout<<count<<endl;
}
        
    
    

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

#define loop(s, e, i) for (int i = s; i < e; ++i)
#define print(s) cout << s << endl;
#define DIV 1000000007
using namespace std;
using ll = long long;
using lld = long long;

/*
浮動小数点の入力
cout << fixed << setprecision(9) << endl;
*/

ll gcd(ll a, ll b)
{
  if (a < b)
  {
    return gcd(b, a);
  }
  while (b != 0)
  {
    ll tmp = b;
    b = a % b;
    a = tmp;
  }
  return a;
}

ll modinv(ll a, ll m) {
  ll b = m, u = 1, v = 0;
  while(b) {
    ll t =  a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

int bit_counter(int x) {
  if (x == 0) return 0;
  return bit_counter(x >> 1) + (x&1);
}

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

  vector<int> A(K+1);
  A[0] = 7%K;
  loop(1, K+1, i) {
    A[i] = (10 * A[i-1] + 7)%K;
  }

  ll result = -1;
  loop(0, K+1, i) {
    if (A[i] == 0) {
      result = i+1;
      break;
    }
  }
  print(result);
  
}


Measured memory_bytes: 7136
n,l=map(int,input().split())
t=[l+i for i in range(n)]
t1=[abs(item) for item in t]
eat=min(t1)

def check_eat(L,X):
  for i in range(n):
    if abs(L[i])==X:
      break
  return i

print(sum(t)-t[check_eat(t,eat)])

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
 
void __print(int x) {cout << x;}
void __print(long x) {cout << x;}
void __print(long long x) {cout << x;}
void __print(unsigned x) {cout << x;}
void __print(unsigned long x) {cout << x;}
void __print(unsigned long long x) {cout << x;}
void __print(float x) {cout << x;}
void __print(double x) {cout << x;}
void __print(long double x) {cout << x;}
void __print(char x) {cout << '\'' << x << '\'';}
void __print(const char *x) {cout << '\"' << x << '\"';}
void __print(const string &x) {cout << '\"' << x << '\"';}
void __print(bool x) {cout << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cout << '{'; __print(x.first); cout << ','; __print(x.second); cout << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __print(i); cout << "}";}
void _print() {cout << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cout << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cout << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
#define fi first
#define se second
#define FIO {ios::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);}
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define all(x) (x).begin(), (x).end()
#define pow10(n) stoll("1"+string(n,'0'))
//fill(all(arr),1)
//if(map.count(key)){}
//bitset<20>(n);
//int mini=min({a,b,c,d,e});
 
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef long double ld;
const int N=1e6+5;
int have[N],mark[N];
void fun()
{
for(int i=1;i<N;i++)
{
  if(have[i])
  {
    if(have[i]>=2)mark[i]=1;
  
      for(int j=2;i*j<N;j++)
      {
        mark[i*j]=1;
      }
    
  }
}
}
int32_t main()
{
int n;
cin>>n;
int a[n];
forn(i,n){cin>>a[i];have[a[i]]++;}
fun();
int cnt=0;
for(int i=0;i<n;i++)
{
  if(mark[a[i]]!=1)cnt++;
}
cout<<cnt;  

}

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

int main() {
    int x, ans = 0;
    cin >> x;
    if(x < 100) {
        cout << 0 << '\n';
        return 0;
    } else {
        string s = to_string(x);
        int n = s[s.size()-1]-'0' + 10*(s[s.size()-2]-'0');
        if(n == 0) {
            cout << 1 << '\n';
            return 0;
        }
        int fi = n/5;
        n = n%5;
        if(n == 0) {
            if(x/100 >= fi) {
                cout << 1 << '\n';
                return 0;
            }
        }
        int fo = n/4;
        n = n%4;
        if(n == 0) {
            if(x/100 >= fi+fo) {
                cout << 1 << '\n';
                return 0;
            }
        }
        int th = n/3;
        n = n%3;
        if(n == 0) {
            if(x/100 >= fi+fo+th) {
                cout << 1 << '\n';
                return 0;
            }
        }
        int tw = n/2;
        n = n%2;
        if(n == 0) {
            if(x/100 >= fi+fo+th+tw) {
                cout << 1 << '\n';
                return 0;
            }
        }
        int on = n/1;
        n = n%1;
        if(n == 0) {
            if(x/100 >= fi+fo+th+tw+on) {
                cout << 1 << '\n';
                return 0;
            }
        }
        cout << 0 << '\n';
    }

}


Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

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

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

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

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

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        k: i64,
        a: i64,
        b: i64,
    }

    for i in 1..1001 {
        if a <= i && i <= b && i%k == 0 {
            println!("OK");
            std::process::exit(0);
        } 
    }
    println!("NG");
}


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

int main(){
    int r, c;
    cin >> r >> c;

    int table[r+1][c+1];

    for (int i = 0; i < r+1; i++){
        for (int j = 0; j < c+1; j++) table[i][j] = 0;
    }

    for (int k = 0; k < r; k++){
        for (int l = 0; l < c; l++){
            cin >> table[k][l];
        }
    }

    for (int m = 0; m < r; m++){
        int total = 0;
        for (int n = 0; n < c; n++){
            total += table[m][n];
        } 
        table[m][c] = total;
    }

    for (int o = 0; o < c + 1; o++){
        int total2 = 0;
        for (int p = 0; p < r; p++){
            total2 += table[p][o];
        } 
        table[r][o] = total2;
    }

    for (int x = 0; x < r + 1; x++){
        for (int y = 0; y < c + 1; y++){
            if (y == 0) cout << table[x][y];
            else cout << " " << table[x][y];
        }
        cout << endl;
    }

    return 0;
}


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

using namespace std;

struct edge
{
  int to, cost;
};

double p, all;
int N;
vector< edge > g[100000];

double getCost(int idx, int par = -1)
{
  double ret = 0;
  for(auto &e : g[idx]) {
    if(e.to == par) continue;
    auto get = getCost(e.to, idx) + e.cost;
    ret += p * get;
  }
  return (ret);
}

double rec(int idx, int par = -1)
{
  double ret = all;
  for(auto &e : g[idx]) {
    if(e.to == par) continue;
    auto get = rec(e.to, idx) + e.cost;
    ret += p * get;
  }
  return (ret);
}

int main()
{
  cin >> p;
  cin >> N;
  for(int i = 0; i < N - 1; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    --a, --b;
    g[a].push_back((edge) {b, c});
    g[b].push_back((edge) {a, c});
  }
  all = getCost(0);
  cout << fixed << setprecision(10) << rec(0) << endl;
}

Measured memory_bytes: 14976
import sys
d=0
for e in sys.stdin:
 c=list(map(int,e.split()))
 if len(c)>1:
  s,t=c;d=1
  if s>t:a+=s+t
  elif s<t:b+=s+t
  else:a+=s;b+=t
 else:
  if d:print(a,b)
  a=b=0


Measured memory_bytes: 5608
#include<bits/stdc++.h>
using namespace std;
long N,H,i,a,max_a,t,cnt;
vector<long>b;
int main(){
  cin>>N>>H;
  b.resize(N);
  for(i=0;i<N;i++){
    cin>>a>>b[i];
    max_a=max(max_a, a);
  }
  sort(b.begin(),b.end());
  while(H>0&&!b.empty()){
    t=b.back();
    if(t<=max_a)break;
    cnt++;
    H-=t;
    b.pop_back();
  }
  if(H>0)cnt+=(H+max_a-1)/max_a;
  cout<<cnt<<endl;
  return 0;
}


Measured memory_bytes: 1024
#define _GLIBCXX_DEBUG //test only

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

// macro
#define rep(i,n) for(i=0;i<n;i++)
#define ll long long
#define all(v) v.begin(), v.end()

// code starts
#define INF 1020304050
#define LINF 1020304050607080901

int main()
{
  int n,m; 
  ll l;
  cin >> n >> m >> l;
  vector<int> a(m);
  vector<int> b(m);
  vector<int> c(m);
  int i,j,k;
  rep(i,m)
  {
    cin >> a[i] >> b[i] >> c[i];
    a[i]--;
    b[i]--;
  }
  int q;
  cin >> q;
  vector<int> s(q);
  vector<int> t(q);
  rep(i,q)
  {
    cin >> s[i] >> t[i];
    s[i]--;
    t[i]--;
  }
  vector<vector<ll>> cost(n,vector<ll>(n,LINF));
  rep(i,n) cost[i][i] = 0;
  rep(i,m)
  {
    cost[a[i]][b[i]] = c[i];
    cost[b[i]][a[i]] = c[i];
  }
  rep(k,n)rep(i,n)rep(j,n)
  {
    cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);
  }
  vector<vector<int>> steps(n,vector<int>(n,INF));
  rep(i,n)rep(j,n)
  {
    if(cost[i][j] == 0)
    {
      steps[i][j] = 0;
    }
    else if(cost[i][j] <= l)
    {
      steps[i][j] = 1;
    }
  }
  rep(k,n)rep(i,n)rep(j,n)
  {
    steps[i][j] = min(steps[i][j], steps[i][k] + steps[k][j]);
  }
  rep(i,q)
  {
    if(steps[s[i]][t[i]] == INF)
    {
      cout << -1 << endl;
    }
    else
    {
      cout << steps[s[i]][t[i]]-1 << endl;
    }
  }
}


Measured memory_bytes: 2688
#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 int long long
using namespace std;

typedef pair<int, int> Pii;

void readint(int N, vector<int> &a);
void readdouble(int N, vector<double> &a);
void readindex(int N, vector<int> &a);



signed main(){

    int N, D, X;
    cin >> N >> D >> X;
    vector<int> A(N);
    REP(i, N){
        cin >> A[i];
    }
    int ans = X;
    REP(i, N){
        ans += 1 + (D - 1) / A[i];
    }
    cout << ans;

    return 0;
}








void readint(int N, vector<int> &a){
    string s;
    for(int i = 0; i < N - 1; i++){
        getline(cin, s, ' ');
        a[i] = atoi(s.c_str());
    }
    getline(cin, s, '\n');
    a[N - 1] = atoi(s.c_str());
}
void readdouble(int N, vector<double> &a){
    string s;
    for(int i = 0; i < N - 1; i++){
        getline(cin, s, ' ');
        a[i] = atof(s.c_str());
    }
    getline(cin, s, '\n');
    a[N - 1] = atof(s.c_str());
}
void readindex(int N, vector<int> &a){
    string s;
    for(int i = 0; i < N - 1; i++){
        getline(cin, s, ' ');
        a[i] = atoi(s.c_str()) - 1;
    }
    getline(cin, s, '\n');
    a[N - 1] = atoi(s.c_str()) - 1;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<string.h>
using namespace std;
#define NIL -2000000001
#define MAX 2000000

int main() {
  int n;
  scanf("%d", &n);

  if (n>=1000) {
    printf("ABD\n");
  } else {
    printf("ABC\n");
  }



  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define REP(i, n) for (ll i = 0; i < (ll)n; i++)
#define REPvec(itr, mp) for (auto itr = mp.begin(); itr != mp.end(); itr++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007  // 1e9+7
using namespace std;
typedef long long int ll;
typedef vector<int> vecint;
typedef vector<ll> vecll;
typedef vector<double> vecd;
typedef vector<string> vecstr;
typedef vector<char> vecchar;
typedef vector<bool> vecbool;
typedef vector<vector<bool> > vec2bool;
typedef vector<vector<int> > vec2int;
typedef vector<vector<double> > vec2d;
////////////////////////////////////////////////
void init() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}
////////////////////////////////////////////////
int main() {
  init();
  int n;
  cin >> n;
  vecll a(n, 0);
  vecll b(n, 0);
  vecll c(n, 0);
  for (auto& e : a) cin >> e;
  for (auto& e : b) cin >> e;
  for (auto& e : c) cin >> e;
  sort(all(a));
  sort(all(b));
  sort(all(c));
  vecll nab(n, 0), nbc(n, 0);
  REP(i, n) { nab[i] = lower_bound(all(a), b[i]) - a.begin(); }
  REP(i, n) { nbc[i] = c.end() - lower_bound(all(c), b[i] + 1); }
  // REP(i, n) { cout << nab[i] << endl; }
  // REP(i, n) { cout << nbc[i] << endl; }
  ll ans = 0;
  REP(i, n) { ans += nab[i] * nbc[i]; }
  cout << ans << endl;
}


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

int main(){
	char b; cin>>b;
	if(b=='A') cout << 'T' << endl;
	else if(b=='T') cout << 'A' << endl;
	else if(b=='C') cout << 'G' << endl;
	else if(b=='G') cout << 'C' << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <deque>
#include <set>
#include <iomanip>
#include <utility>
typedef long long ll;
typedef long double ld;
using namespace std;

int main() {
	ll A, B, C, K;
	cin >> A >> B >> C >> K;
	if(K<=A) cout << K << endl;
	else if(K<=A+B) cout << A << endl;
	else cout << A-(K-A-B) << endl;
	return 0;
}

Measured memory_bytes: 3636
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <string>
#include <vector>
#include <queue>
#include <map>

std::string s;
int n, q;
int f[500010];

int main()
{
	std::ios::sync_with_stdio(0);
	std::cin.tie(0);
	std::cin >> n >> q;
	std::cin >> s;
	for (int i = 1; i < n; ++i)
	{
		f[i] = f[i - 1];
		if (s[i - 1] == 'A' && s[i] == 'C')
			++f[i];
	}
	//for (int i = 0; i < n; ++i)
	//	std::cout << f[i] << " "; std::cout << "\n";
	for (int i = 1; i <= q; ++i)
	{
		int l = 0, r = 0;
		std::cin >> l >> r;
		std::cout << f[r - 1] - f[l - 1] << "\n";
	}
	return 0;
}

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

using namespace std;

typedef long long ll;
#define mems(p) memset(p,-1,sizeof(p))
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define nl "\n"

const int mxN = 1e5;
const ll MOD = 1e9 + 7;

void fast()
{ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);}

ll gcd(ll a, ll b) {
	return b ? gcd(b, a%b) : a;
}

int main() {
	fast();
	ll n;
	cin >> n;
	ll powers[12];
	powers[0] = 1ll;
	for (int i = 1; i < 12; ++i)
	{
		powers[i] = powers[i-1] * 26ll;
	}
	int leng = 0;
	ll sum = 0;
	for (int i = 1; i < 12; ++i) {
		sum += powers[i];
		if (sum >= n) {
			leng = i;
			break;
		}
	}
	for (int i = 1; i < leng; ++i)
	{
		n -= powers[i];
	}
	//cout << "n: " << n << " leng: "<<leng<< nl;
	string ans;
	for (ll i = leng; i > 0; --i) {
        ll tmp = powers[i-1];
        
        ll which = 1;
        while (tmp * which < n) {
            ++which;
        }
        //cout << "i: " << i << " which: " << which << nl;
        n -= tmp * (which - 1);
        ans += ('a'+(which-1));
    }
    cout << ans << nl;
}

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

int main(){
	long long n;
	int ans = 0;
	scanf("%lld", &n);
	for (long long i = 2; i * i <= n; i++){
		if (n % i == 0){
			int cnt = 0;
			while (n % i == 0){
				cnt++;
				n /= i;
			}
			for (int j = 1; j <= cnt; j++){
				ans++;
				cnt -= j;
			}
		}
	}
	if (n > 1)
		ans++;
	printf("%d\n", ans);
	return 0;
}


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

bool erat[2000000];
set<int> primes; 
int main(){
	for(int i = 0; i < 2000000; i++){
		erat[i] = true;
	}
	for(int i = 2; i < 2000000; i++){
		if(erat[i]){
			primes.insert(i);
			for(int j = i + i; j < 2000000; j += i){
				erat[j] = false;
			}
		}
	}
	int N;
	while(cin >> N, N){
		if(primes.count(N)){
			cout << 0 << endl;
		}else{
			auto it = primes.lower_bound(N);
			cout << (*it - *(--it)) << endl;
		}
	}
}

Measured memory_bytes: 11992
#include<stdio.h>
#include<cstdio>
using namespace std;

int main() {
  int N;
  scanf("%d", &N);
  int min = 100000000;
  for (int i=1 ; i<N ; i++) {
    int a = i;
    int b = N - i;
    int x = 10;
    int sum = 0;
    while (x <= 100000) {
      sum += (a%x)/(x/10) + (b%x)/(x/10);
      a -= (a%x);
      b -= (b%x);
      x *= 10;
    }
    if (sum < min) min = sum;
  }
  printf("%d\n", min);
}

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

int main(){
    ll k;
    cin >> k;
    ll r = k%50;
    cout << 50 << endl;
    for(int i = 0;i < 50;i ++){
        cout << 49 + k/50 + (i<r) - i << " ";
    }
    cout << endl;
    return 0;
}

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

vector<int> l;

int binary_search(vector<int> &a, int left, int right, int key) { // // a[i]<keyを満たすiの個数(範囲はleft<=i<=right)
    int ok = left - 1; // 常にtrue
    int ng = right + 1; // 常にfalse
    while (ok + 1 < ng) {
        int mid = (ok + ng) / 2;
        if (a[mid] < key) ok = mid;
        else ng = mid;
    }
    return ok - left + 1;
}

int main() {
    int n;
    cin >> n;
    l.resize(n);
    rep(i, n) {
        cin >> l[i];
    }
    sort(l.begin(), l.end());
    long sum = 0;
    for (int i = 0; i < n-2; i++) {
        for (int j = i+1; j < n-1; j++) {
            // sum += binary_search(l, j+1, n-1, l[i]+l[j]) - binary_search(l, j+1, n-1, l[j]-l[i]+1);          
            sum += lower_bound(l.begin()+j+1, l.end(), l[i]+l[j]) - upper_bound(l.begin()+j+1, l.end(), l[j]-l[i]);
        }
    }
    cout << sum << endl;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
using ll = int64_t;
bool solve(ll a, ll b, ll mid){
    if(mid < b){
        return true;
    }else{
        ll ana = ((mid + 1) / 2);
        ll bi = (mid + 2) / 2 + ((mid + 2) / 2 >= b ? 1 : 0);
        ll po = max(ana * bi, (ana + 1) * (bi - 1));
        ll yo = (b + 1) * (mid - b + 1);
        if(max(po, yo) < a * b) return true;
        else return false;
    }
}
int main(){
    ll q;
    cin >> q;
    for(ll poyo = 0; poyo < q; poyo++){
        ll a, b;
        cin >> a >> b;
        if(a == b){
            cout << 2 * a - 2 << endl;
            continue;
        }
        if(a < b) a ^= b ^= a ^= b;
        ll low = 0, up = a + b - 2;
        while(up - low > 1){
            ll mid = (up + low) / 2;
            if(solve(a, b, mid)) low = mid;
            else up = mid;
        }
        cout << low << endl;
    }
    return 0;
}

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

int main() {
    int s = 0;
    string str;
    cin >> str;
    
    for(int i = 0; i < str.size(); i++) {
        if (str.at(i) == '+') s++;
        else s--; 
    }
   cout << s << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int cnt = 0;
      int a = 0;
      for(int i = 0;i < n;i++){
        int x = sc.nextInt();
        while(x%2==0&&a <=1){
          cnt++;
          a++;
          x =x/2;
        }
        a=0;
      }
      if(n%2==0){
      	if(cnt >= n)System.out.println("Yes");
      	else System.out.println("No");
      }else{
      	if(cnt >= n-1)System.out.println("Yes");
        else System.out.println("No");
      }
    }
}


Measured memory_bytes: 48596
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
int main(int argc, char const *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, h, w;
  int ans = 0;
  cin >> n >> h >> w;
  for (int i = 0; i < n; ++i)  {
    int a, b;

    cin >> a >> b;
    if (a >= h && b >= w)ans++;
  }


  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

void print(int array[], int size) {
	for(int i = 0; i < size-1; i++) {
		printf("%d ", array[i]);
	}
	printf("%d\n", array[size-1]);

	return;
}

void insertion_sort(int array[], int size) {
	for(int i = 1; i < size; i++) {
		int tmp = array[i];
		int j = i - 1;
		while(j >= 0 && array[j] > tmp) {
			array[j+1] = array[j];
			j--;
		}
		array[j+1] = tmp;

		print(array, size);
	}
}
int main() {
	int N;
	int A[100];
	scanf("%d", &N);
	for(int i = 0; i < N; i++) {
		scanf("%d", &A[i]);
		/*printf("%d-%d, ", i, A[i]);*/
	}

	print(A, N);
	insertion_sort(A, N);

	return 0;
}




Measured memory_bytes: 2032
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vint;
typedef vector<vint> vvint;

int solve(string s, string t){
	int n = s.length(), m = t.length(), res = INT_MAX;

	for(int i = 0; i <= n-m; i++){
		int cnt = 0;
		for(int j = i; j < i+m; j++){
			if(s[j] != t[j-i])
				cnt++;
		}

		res = min(res, cnt);
	}

	return res;
}

int main()
{
	string s, t;
	while(cin >> s >> t){
		cout << solve(s, t) << "\n";
	}
	
	return 0;
}


Measured memory_bytes: 3576
#include<bits/stdc++.h>
using namespace std;
char a[350000];
int b[3][3],r,n;
int main(){
	scanf("%d%*c",&n);
	scanf("%s",&a);
	r=1<<24;
	for(int i=0;i<n;i++){
		if(a[i]=='E')
			b[0][0]++;
		else
			b[0][1]++;
	}
	for(int i=n-1,k;i>=-1;i--)
	{
		k=b[0][1]+b[1][0];
		if(k<r)r=k;
		if(i>=0&&a[i]=='E'){b[0][0]--;b[1][0]++;}
		else {b[0][1]--;b[1][1]++;}
	}
	printf("%d",r);
	return 0;
} 

Measured memory_bytes: 512
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n, -1);
  for (int i = 0; i < n; i++) {
    int r, c;
    cin >> r >> c;
    r--;
    c--;
    if (a[r] != -1) {
      cout << -1 << '\n';
      return 0;
    }
    a[r] = c;
  }
  int ans = n;
  for (int i = 0; i < n; i++) {
    if (a[i] == -1) continue;
    int x = i;
    while (a[x] != -1) {
      int nx = x;
      x = a[x];
      a[nx] = -1;
    }
    ans--;
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 3264
#include<bits/stdc++.h>
using namespace std;
struct node{
  node* l;
  node* r;
  node* p;
  int key;
};

node L;
node* nil=&L;
node* t=nil;

node* find(node* a,int t){
  if(a->key==t)return a;
  if(a==nil)return nil;
  if(a->key<t)return find(a->r,t);
  return find(a->l,t);
}

void insert(node* a){
  node* y=nil;
  node* x=t;
  while(x!=nil){
    y=x;
    if(a->key<x->key)x=x->l;
    else x=x->r;
  }
  a->p=y;
  if(y==nil)t=a;
  else if(a->key<(y->key))y->l=a;
  else y->r=a;
}

node* treeMinimum(node* a){
  while(a->l!=nil)
    a=a->l;
  return a;
}

node* treeSuccessor(node* a){
  if(a->r!=nil)
    return treeMinimum(a->r);
  node* b=a->p;
  while(b!=nil&&a==b->r){
    a=b;
    b=b->p;
  }
}

void del(node* z){
  node* x,*y;
  if(z->l==nil||z->r==nil)y=z;
  else y=treeSuccessor(z);
  if(y->l!=nil)x=y->l;
  else x=y->r;
  if(x!=nil)x->p=y->p;
  if(y->p==nil)t=x;
  else if(y==y->p->l)y->p->l=x;
  else y->p->r=x;
  if(y!=z)z->key=y->key;
}

void pri(node* b,int a){
  if(b==nil)return;
  if(!a)cout<<" "<<b->key;
  pri(b->l,a);
  if(a)cout<<" "<<b->key;
  pri(b->r,a);
}

int main(){
  int n,a;
  string s;
  cin>>n;
  
  for(int i=0;i<n;i++){
    cin>>s;
    if(s[0]=='i'){
      cin>>a;
      node* b=(node *)malloc(sizeof(node));
      b->l=nil;
      b->r=nil;
      b->key=a;
      insert(b);
    }
    else if(s[0]=='f'){
      cin>>a;
      if(find(t,a)!=nil)cout<<"yes"<<endl;
      else cout<<"no"<<endl;
    }
    else if(s[0]=='d'){
      cin>>a;
      del(find(t,a));
    }
    else{
      pri(t,1);
      cout<<endl;
      pri(t,0);  
      cout<<endl;
    }
  }
  return 0;
}

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

int main(){
	int n; cin >> n;
  	vector<int> a(n);
  	for(int i = 0; i < n; i++){cin >> a.at(i);}
  	
  	vector<int> eve;
  	for(int i = 0; i < n; i++){
    	if(a.at(i)%2 == 0)	eve.push_back(a.at(i));}
  	
  	bool fct  =true;
  	for(int i = 0; i < eve.size(); i++){
    	if(eve.at(i)%5 != 0 && eve.at(i)%3 != 0)	fct = false;
    }
  	
  	if(fct)	cout << "APPROVED" << endl;
  	else	cout << "DENIED" << endl;
}   

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
#include<cstdio>
#include<cstdlib>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

const double EPS = 1e-10;

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;



int main(){
    ll n; cin >> n;
    ll now = 1;
    int siz = 1;
    rep(i,15){
        now*=26;
        if(n-now <= 0) break;
        siz++;
        n -= now;  
    }
    n--;
    string ans;
    while(n){
        int k = n%26;
        ans += 'a'+k;
        n /= 26;
    }
    while(ans.size() != siz) ans += 'a';
    reverse(ans.begin(),ans.end());
    cout << ans << endl;

}


Measured memory_bytes: 3632
#include<iostream>
using namespace std;
int main(void){
	int n,k;
	int i,j;
	int a,b;
	cin>>n>>k;
	for(i=0;i<n;i++){
		cin>>j;
	}
	a=n-1;
	b=k-1;
	cout<<(a+(b-1))/b<<endl;
	return 0;
}


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

using namespace std;

int a, b;

int main() {
  scanf("%d%d", &a, &b);
  int mem = max(a, b) - min(a, b);
  mem = mem * (mem + 1) / 2;
  printf("%d\n", mem - max(a, b));
  return 0;
}


Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
a.sort()
ok=[0]*(a[-1]+1)
for i in range(n):
  ok[a[i]]+=1
for i in range(n):
  if ok[a[i]]>1:
    ok[a[i]]=0
  elif ok[a[i]]==0:
    continue
  j=a[i]
  while 1:
    j += a[i]
    if j > a[-1]:
      break
    ok[j]=0
    
print(sum(ok))


Measured memory_bytes: 32376
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * 0003：Is it a Right Triangle?
 * 
 * @author Lyu
 * @version 2015/07/12
 */
public class Main {

    /** 区切り文字：スペース */
    private static final String DELIMITER_SPACE = " ";

    /**
     * データセットで与えられた数を3辺とする三角形が直角三角形かを判断する。
     * 
     * @param args
     * @throws IOException
     * @throws NumberFormatException
     */
    public static void main(String[] args) throws NumberFormatException, IOException {

        List<String[]> dataSets = new ArrayList<String[]>();
        int countOfDataSet = getInput(dataSets);

        for (int i = 0; i < countOfDataSet; ++i) {
            System.out.println(getResult(dataSets.get(i)));
        }
    }

    private static String getResult(String[] dataSets) {
        int[] lengths = new int[3];
        toIntArray(3, lengths, dataSets);
        Arrays.sort(lengths);

        if (isRightTriangle(lengths)) {
            return "YES";
        } else {
            return "NO";
        }
    }

    private static boolean isRightTriangle(int[] lengths) {
        if (lengths[2] * lengths[2] == lengths[0] * lengths[0] + lengths[1] * lengths[1]) {
            return true;
        }
        return false;
    }

    private static void toIntArray(int lengthOfArray, int[] intArray, String[] stringArray) {
        for (int i = 0; i < lengthOfArray; ++i) {
            intArray[i] = Integer.parseInt(stringArray[i]);
        }
    }

    private static int getInput(List<String[]> target) throws NumberFormatException, IOException {
        // 入力読取り
        InputStreamReader streamReader = new InputStreamReader(System.in);
        BufferedReader bufferedReader = new BufferedReader(streamReader);

        String line = null;
        boolean isFirst = true;
        int numberOfDataSet = 0;

        try {
            while ((line = bufferedReader.readLine()) != null) {
                if (isFirst) {
                    numberOfDataSet = Integer.parseInt(line);
                    isFirst = false;
                } else {
                    String[] lengths = line.split(DELIMITER_SPACE);
                    target.add(lengths);
                }
            }
            return numberOfDataSet;
        } finally {
            bufferedReader.close();
            streamReader.close();
        }
    }
}

Measured memory_bytes: 20216
H,W=gets.chomp.split.map(&:to_i)
dp = Array.new(W+1,0)
MOD = 1000000007
dp[1] = 1
H.times do
  a = gets.chomp.split("")
  a.each_with_index do |c, i|
    if c == '#'
      dp[i+1] = 0
    else
      dp[i+1] += dp[i]
      dp[i+1] %= MOD
    end
  end
end
p dp[W]

Measured memory_bytes: 2556
import java.util.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	final int MOD = 1000000007;
	final int MAX = Integer.MAX_VALUE;
	final long LMAX = Long.MAX_VALUE;


	void doIt() {
		int n = sc.nextInt();
		System.out.println((double)(n - n / 2)/n);
	}


	public static void main(String[] args) {
		new Main().doIt();
	}
}


Measured memory_bytes: 23892
main=print.solve.lines=<<getContents
solve[_,s,t]=(`mod`(10^9+7)).fst$foldr f(1,0)$zipWith(==)s t
f b(k,p)
  |p>2=(k,2)
  |b=(k*(3-p),1)
  |otherwise=(k*[6,2,3]!!p,3)

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


int main(){
	int N;cin >> N;
	cout << (N + (N % 2))/2 << endl;
	return 0;
}













Measured memory_bytes: 3624
def main():
    s = input()

    for i, c in zip(range(1, len(s) + 1), s):
        if (i % 2 == 0 and c not in "LUD") or (i % 2 == 1 and c not in "RUD"):
            print("No")
            break
    else:
        print("Yes")


main()


Measured memory_bytes: 2940
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val amount = IntArray(n) { readLine()!!.toInt() }
        .sortedDescending()
        .mapIndexed { i, p -> if (i == 0) p shr 1 else p }
        .sum()
    println(amount)
}


Measured memory_bytes: 35568
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int c = scanner.nextInt();

		int m = 0;

		for(int i = a; i <= b; i++){
            if (c % i == 0) {
                m++;
            }
		}

		System.out.println(m);
	}
}



Measured memory_bytes: 26332
#include<bits/stdc++.h>
using namespace std;
int n,m,r,i,a[1<<17],b[1<<17];
int main(){
	cin>>n>>m;
	for(i=0;i<m;i++)cin>>a[i];
	sort(a,a+m);
	for(i=1;i<m;i++)b[i-1]=a[i]-a[i-1];
	sort(b,b+m-1);
	for(i=0;i<m-n;i++)r+=b[i];
	cout<<r<<endl;
	return 0;
}


Measured memory_bytes: 1024
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	static Scanner scanner;

	public static void main(String[] args) {
	    scanner = new Scanner(System.in);

	    int N=gi();
	    long[] A=new long[N];
	    Map<Long, Integer> m=new HashMap<Long, Integer>();
	    
	    
	    for (int i=0; i<N; i++) {
	    	A[i]=gl();
	    	if(m.containsKey(A[i])) {
	    		System.out.print("NO");
              return;
	    	} else {
	    		m.put(A[i],1);
	    	}
	    }

        System.out.print("YES");
//        if (s.charAt(0)=='0' && N!=1) {
//        	System.out.println(-1);
//        }else {
//        	System.out.println(s);
//        }
	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

Measured memory_bytes: 76404
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if ((100 * a + 10 * b + c) % 4 == 0 ) {
    cout << "YES" <<endl;
  }
  else {
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <float.h>
#include <iomanip>
#include <iostream>
using namespace std;
 
int gcd(int x,int y){
    if(y==0)return x;

    return gcd(y,x%y);
}
int lcm(int x,int y){
    return x*y/gcd(x,y);
}

int main(){

    int N,p[70]={},x=0;
    cin>>N;

    for(int i=1;i<=N;i++){
        cin>>p[i];
        if(p[i]!=i)x++;
    }

    if(x<=2){
        cout << "YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

const int INF = 1e9;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main() {
    int H, W;
    cin >> H >> W;
    int Ch, Cw;
    cin >> Ch >> Cw;
    --Ch; --Cw;
    int Dh, Dw;
    cin >> Dh >> Dw;
    --Dh; --Dw;
    vector<string> S(H);
    rep(i, H) {
        string s;
        cin >> s;
        S[i] = s;
    }
    vector<vector<int>> dist(H, vector<int> (W, INF));
    deque<P> que;
    auto update = [&] (int i, int j, int d) {
        if (dist[i][j] <= d) return;
        dist[i][j] = d;
        que.emplace_front(i, j);
    };
    auto updateWarp = [&] (int i, int j, int d) {
        if (dist[i][j] != INF) return;
        dist[i][j] = d;
        que.emplace_back(i, j);
    };
    update(Ch, Cw, 0);
    while (!que.empty()) {
        int ci = que.front().first;
        int cj = que.front().second; que.pop_front();
        rep(dir, 4) {
            int ni = ci + dx[dir];
            int nj = cj + dy[dir];
            if (ni < 0 || ni >= H || nj < 0 || nj >= W) continue;
            if (S[ni][nj] == '#' || dist[ni][nj] <= dist[ci][cj]) continue;
            update(ni, nj, dist[ci][cj]);
        }
        for (int i = -2; i <= 2; i++) {
            for (int j = -2; j <= 2; j++) {
                int ni = ci + i;
                int nj = cj + j;
                if (ni < 0 || ni >= H || nj < 0 || nj >= W) continue;
                if (S[ni][nj] == '#' || dist[ni][nj] != INF) continue;            
                updateWarp(ni, nj, dist[ci][cj] + 1);
            }            
        }
    }
    int ans = dist[Dh][Dw];
    if (ans == INF) ans = -1;
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 8700
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define xx first.first
#define yy first.second
#define __V vector
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define oit ostream_iterator
#define mod 1000000007ll
using namespace __gnu_pbds;
using namespace std;
void doin() {
	cin.tie();
	cout.tie();
	ios::sync_with_stdio(0);
#ifdef LOCALc
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
template<typename T, typename l>
void getv(T& a, int n, l f) {
	a.resize(n);
	for (auto& i : a)
		cin >> i, f(i);
}
template<typename T>
void getv(T& a, int n) {
	a.resize(n);
	for (auto& i : a)
		cin >> i;
}
typedef unsigned long long ull;
typedef long long ll;
typedef double ld;
typedef ll _I;
typedef pair<_I, _I> pi;
typedef pair<ld, ld> pd;
typedef map<_I, _I> mii;
typedef __V <_I> vi;
typedef __V <char> vc;
typedef __V <ld> vd;
typedef __V <vd> vvd;
typedef __V <pi> vpi;
typedef __V <__V<_I>> vvi;
typedef __V <__V<char>> vvc;
typedef __V <__V<pi>> vvpi;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll a, b;
int main() {
	doin();
	cin >> a >> b;
	if(a < 6)
		cout << 0;
	else if(a < 13)
		cout << b/2;
	else
		cout << b;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define rrep(i, n) for (int i = (int)n-1; i >= 0; --i)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;

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

__attribute__ ((constructor))
void fastio() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
}

int main(){
    int k, t;
    cin >> k >> t;
    map<int,int> mii;
    rep(i,t){
        int a;
        cin >> a;
        mii[i] = a;
    }
    priority_queue<pair<int, int>> que;
    for(auto u : mii){
        que.push({u.second, u.first});
    }
    int ans = 0;
    int pre = -1;
    while(!que.empty()){
        int top_first = que.top().first;
        int top_second = que.top().second;
        que.pop();
        if(top_second == pre){
            if(!que.empty()){
                int second_first = que.top().first;
                int second_second = que.top().second;
                que.pop();
                pre = second_second;
                que.push({top_first, top_second});
                if(second_first > 1){
                    que.push({second_first - 1, second_second});
                }
                
            }else{
                ans += top_first;
                break;
            }
        }else{
            pre = top_second;
            if(top_first > 1){
                que.push({top_first - 1, top_second});
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3624
import sys
stdin = sys.stdin

sys.setrecursionlimit(10 ** 7)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x) - 1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

h, w = li()
grid = [list(li()) for _ in range(h)]

cnt = 0
ans = []

for hi in range(h):
    for wi in range(w-1):
        if grid[hi][wi] % 2:
            cnt += 1
            grid[hi][wi] -= 1
            grid[hi][wi+1] += 1
            ans.append((hi+1, wi+1, hi+1, wi+2))

for hi in range(h-1):
    if grid[hi][-1] % 2:
        cnt += 1
        grid[hi][-1] -= 1
        grid[hi+1][-1] += 1
        ans.append((hi+1, w, hi+2, w))

print(cnt)
for ansi in ans:
    print(*ansi)

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

using namespace std;

int main(){
  int64_t a,b,c,d;
  cin >> a >> b >> c >> d;
  int64_t lcm = c*d/__gcd(c,d);
  a--;
  int64_t res = 0;
  if(c != d)res = (b - a) - ((b/c + b/d - b/lcm) - (a/c + a/d - a/lcm));
  else res = (b - a) - (b/d - a/d);
  cout << res;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define M (998244353)
#define INF 1e16
typedef long long ll;
typedef pair<int,int> P;

ll sum[200010];

int main(void){
    int n;
    cin>>n;
    vector<ll>a(n),b(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int i=n;i>0;i--){
        if(sum[i]%2==a[i-1])continue;
        else{
            sum[i]++;
            b[i-1]=i;
            for(int j=1;j*j<=i;j++){
                if(i%j==0){
                    sum[j]++;
                    int t=i/j;
                    if(t==j)continue;
                    sum[t]++;
                }
            }
        }
    }
    int num = 0;
    vector<int>ans;
    for(int i=1;i<=n;i++){
        if(b[i-1])num++,ans.push_back(b[i-1]);
    }
    cout<<num<<endl;
    for(int i=0;i<ans.size();i++){
        if(i==ans.size()-1)cout<<ans[i]<<endl;
        else cout<<ans[i]<<" ";
    }
    return 0;
}

Measured memory_bytes: 6136
m,d = map(int, input().split())
ans = 0

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


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


int main() {
	int n; cin >> n;
  	int ac = 0, wa = 0, tle = 0, re = 0;
  	while (n--) {
    	string s; cin >> s;
      	if (s == "AC") ac++;
      	else if (s == "WA") wa++;
      	else if (s == "TLE") tle++;
      	else if (s == "RE") re++;
    }
  	cout << "AC x " << ac << '\n';
  	cout << "WA x " << wa << '\n';
  	cout << "TLE x " << tle << '\n';
  	cout << "RE x " << re << '\n';
}


Measured memory_bytes: 3612
#include<iostream>
#define _USE_MATH_DEFINES
#include<math.h>
#include<vector>
#include<array>
#include<algorithm>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vec;
typedef vector<vector<ll>> mat;
typedef pair<ll,ll> P;
typedef map<ll,ll> MP;
typedef priority_queue<ll> PQ;
typedef stack<ll> ST;
typedef queue<ll> QUE;
#define pb push_back
#define st first
#define nd second
#define SZ(x) ((int)(x).size())
#define FOR(i,s,n) for(int i=(int)(s); i< (int)(n); i++)
#define rep(i,n) FOR(i,0,n)
#define all(x) (x).begin(),(x).end()
#define each(x,c) for(auto x: (c))
#define LB(x,a) lower_bound(all(x), a)
#define UB(x,a) upper_bound(all(x), a)
const ll mod=1e9+7;
const ll INF=1e18;
const double EPS=1.0e-10;
const double PI=M_PI;

struct Point {double x,y;};
struct Line {double a,b,c;};
struct Circle {double r; Point p;};

//2点間の距離
double kyori(Point p,Point q){
    return sqrt((p.x-q.x)*(p.x-q.x)+(p.y-q.y)*(p.y-q.y));
}

//点と直線の符号付距離
double dist(Point p, Line l){
    return -(l.a*p.x+l.b*p.y+l.c)/sqrt(l.a*l.a+l.b*l.b);
}

//円と直線の交点
vector<Point> LCInter(Circle cir,Line l){
    vector<Point> res;
    double d=dist(cir.p,l);
    if(fabs(d)>cir.r) return res;
    double h=sqrt(cir.r*cir.r-d*d);
    Point H={d*l.a/sqrt(l.a*l.a+l.b*l.b)+cir.p.x,d*l.b/sqrt(l.a*l.a+l.b*l.b)+cir.p.y};
    res.push_back({H.x-h*l.b/sqrt(l.a*l.a+l.b*l.b),H.y+h*l.a/sqrt(l.a*l.a+l.b*l.b)});
    res.push_back({H.x+h*l.b/sqrt(l.a*l.a+l.b*l.b),H.y-h*l.a/sqrt(l.a*l.a+l.b*l.b)});
    return res;
}

//2円の交点
vector<Point> CCInter(Circle c1,Circle c2){
    Line l={2.0*(c1.p.x-c2.p.x),2.0*(c1.p.y-c2.p.y),
    -c1.p.x*c1.p.x-c1.p.y*c1.p.y+c2.p.x*c2.p.x+c2.p.y*c2.p.y+c1.r*c1.r-c2.r*c2.r};
    return LCInter(c1,l);
}

int N,K;
vector<double> c;
vector<Point> niku;

bool b(double T){
    rep(i,N){
        int count=0;
        rep(j,N){
            if(j==i || kyori(niku[i],niku[j])<T/c[j]) count++;
        }
        if(count>=K) return true;
    }
    rep(i,N){
        FOR(j,i+1,N){
            vector<Point> v=CCInter(Circle{T/c[i],niku[i]},Circle{T/c[j],niku[j]});
            rep(k,SZ(v)){
                int count=0;
                rep(l,N){
                    if(l==i || l==j || kyori(v[k],niku[l])<T/c[l]) count++;
                }
                if(count>=K) return true;
            }
        }
    }
    return false;
}
double BS(double l,double r){
    if(r-l<EPS) return r;
    double m=(l+r)/2.0;
    if(b(m)) return BS(l,m);
    else     return BS(m,r);
}

int main(){
    cin>>N>>K;
    rep(i,N){
        double x,y,C; cin>>x>>y>>C;
        niku.push_back({x,y});
        c.push_back(C);
    }
    printf("%.10lf\n",BS(0.0,1.0e10));
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
 
int main(){
  int n, f, t = 0, h = 0;
  char c1[101], c2[101];
  scanf("%d", &n);
  while(n--){
    scanf("%s%s", c1, c2);
    f = strcmp(c1, c2);
    if(!f) t++,h++;
    else if(f > 0) t += 3;
    else if(f < 0) h += 3;
  }
  printf("%d %d\n", t, h);
  return 0;
}


Measured memory_bytes: 2112
#include <stdio.h> 
#include <math.h>

int main(void)
{	
	double x1, y1, x2, y2, ans = 0;

	scanf("%lf %lf %lf %lf",&x1, &y1, &x2, &y2);

	ans = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1);

	printf("%f\n",sqrt(ans));

	return 0;
}

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



int main() {

	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	struct Monster {
		int attack;
		int health;
	};

	Monster takahashi;
	Monster aoki;

	cin >> takahashi.health;
	cin >> takahashi.attack;
	cin >> aoki.health;
	cin >> aoki.attack;

	while (takahashi.health > 0 && aoki.health > 0) {
		aoki.health -= takahashi.attack;
		if (aoki.health <= 0) {
			cout << "Yes";
			break;
		}
		takahashi.health -= aoki.attack;
		if (takahashi.health <= 0) {
			cout << "No";
			break;
		}
	}







}


Measured memory_bytes: 3616
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>
#include <string>
#include <time.h>
#include <bitset>

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }

ll N;

int main() {

	cin >> N;
	if (N % 2) {
		cout << 0 << endl;
		return 0;
	}

	ll ans = 0;
	N /= 10;
	while (N) {
		ans += N;
		N /= 5;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
 
int main() {
	int n;
  	cin >> n;
  	ll arr[n];
  	ll g;
  	for(int i = 0 ; i < n ;i ++) {
    	ll x;
      	cin >> x;
      	if(i == 0) {
        	g = x;
        }
      else g = __gcd(g , x);
    }
  	cout << g;
}

Measured memory_bytes: 384
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<map>
#include<set>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repn(i, n) for(int i = 1; i <= n; i++)
#define repr(i, n) for(int i = (n-1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define lint long long

int main(){
    int a, b; cin >> a >> b;
    if((a * b) % 2 == 0) cout << "No" << endl;
    else cout << "Yes" << endl;
}

Measured memory_bytes: 256
import numpy as np
import math
import scipy as sp
import queue
import collections

MOD = 10 ** 9 + 7
INF = 10 ** 9

def main(kwargs):
    a = kwargs["a"]
    b = kwargs["b"]
    c = kwargs["c"]
    d = kwargs["d"]
    res = max([a * c, a * d, b * c, b * d])
    return res

if __name__ == "__main__":
    kwargs = {}

    cin = input().split()
    kwargs["a"], kwargs["b"], kwargs["c"], kwargs["d"] = [int(i) for i in cin]

    cout = main(kwargs)
    print(cout)

Measured memory_bytes: 31184
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> p(m+1);
  vector<string> s(m+1);
  for(int i=1; i<=m; i++) cin >> p[i] >> s[i];
  vector<int> waNum(n+1);
  int acNum = 0;
  vector<bool> ok(n+1);
  for(int i=1; i<=m; i++){
    if(s[i]=="WA" && !ok[p[i]]){
      waNum[p[i]]++;
    }
    if(s[i]=="AC" && !ok[p[i]]){
      acNum++;
      ok[p[i]] = true;
    }
  }
  int waAns = 0;
  for(int i=1; i<=n; i++){
    if(!ok[i]) continue;
    waAns += waNum[i];
  }
  cout << acNum << " " << waAns << endl;
}

Measured memory_bytes: 6528
#include <iostream>
#include <string>
#include <vector>

using namespace std;


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

    long long a = 7 % K, ans = 1;
    for(int i=0; i<K; ++i)
    {
        if(a == 0)
        {
            cout << ans << endl;
            return 0;
        }
        a = (10*a + 7) % K;
        ++ans;
    }
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 3640