akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>

using namespace std;
typedef long long int ll;

int main(int argc, char const *argv[])
{
    ll n;
    cin >> n;

    ll sum = 0;

    for (ll i = 1; i < n; i++)
    {
        sum += i;
    }

    cout << sum << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define sz(x) ((int)(x).size())
#define mt make_tuple
#define fi first
#define se second
#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 fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
using namespace std;
 
typedef long long lld;
typedef vector<lld> vlld;
const lld mod=(lld)1e9+7;
 
int main() {
     lld n;
     cin>>n;
     lld ans=0;
    for(int i=1;i<=n;i++)
    {
          for(int j=1;j<=n;j++)
          {
                if(n<=i*j)
                break;
                ans++;
          }
    }
    
     
     cout<<ans<<"\n";
  return 0;
}

Measured memory_bytes: 3632
#include <iostream>

using namespace std;

#define MAX 100000

int partition(int A[], int p, int r);

int main()
{
	int A[MAX], n;
	cin >> n;
	for (int i = 0; i < n; i++) cin >> A[i];
	
	int r = partition(A, 0, n-1);
	
	for (int i = 0; i < n; i++)
	{
		if (i) cout << ' ';
		if (i == r)
			cout << '[' << A[i] << ']';
		else 
			cout << A[i];
	}
	cout << endl;
	
		
}


int partition(int A[], int p, int r)
{
	int key = A[r], i = p-1;
	for (int j = p; j < r; j++)
	{
		if (A[j] <= key) swap(A[j], A[++i]);
	}
	swap(A[++i], A[r]);
	return i;
}


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


int minCost(int a[], int n)
{
	int dp[n + 1];
	dp[1] = 0;
	dp[2] = abs(a[2] - a[1]);

	for (int i = 3; i <= n; i++)
	{
		int op1 = dp[i - 1] + abs(a[i] - a[i - 1]);
		int op2 = dp[i - 2] + abs(a[i] - a[i - 2]);
		dp[i] = min(op1, op2);
	}

	return dp[n];
}


int main()
{

	int n;
	cin >> n;

	int a[n + 1];

	for (int i = 1; i <= n; i++)
		cin >> a[i];

	cout << minCost(a, n) << endl;

}

Measured memory_bytes: 4408
#![allow(unused_imports)]
#![allow(dead_code)]
use std::io::prelude::*;
use std::cmp::{max, min};
use std::collections::BinaryHeap;

const MOD: i64 = 1e9 as i64 + 7; 

fn main(){
    let a: isize = read();
    let b: isize = read();
    let c: isize = b - a;
    let ans = (1 + c) * c / 2 - b;
    println!("{}", ans);
}

fn read<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


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

using namespace std;

const int N = 1e5 + 1;
int a[N], n, m;

int main() {
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= m; ++i)
		scanf("%d", &a[i]);
	sort(a + 1, a + 1 + m);
	vector<int> f;
	int sum = 0, sub = 0;
	for (int i = 1; i < m; ++i) {
		f.push_back(a[i + 1] - a[i]);
		sum += f.back();
	}
	sort(f.begin(), f.end(), greater<int>());
	for (int i = 0; i < min(n - 1, int(f.size())); ++i)
		sub += f[i];
	printf("%d", sum - sub);
	return 0;
}


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

void solve(long long N, long long M, std::vector<long long> x, std::vector<long long> y){
    vector<bool> flag(N,false);
    vector<int> cnt(N,1);
    flag[0] = true;
    cnt[0] = 1;
    for (int i = 0; i < M; i++)
    {
        int xi = x[i] - 1;
        int yi = y[i] - 1;
        cnt[xi]--; cnt[yi]++;
        if(flag[xi])flag[yi] = true;
        if(cnt[xi]==0) flag[xi]=false;
    }
    
    auto n = std::count(std::begin(flag), std::end(flag), true);
    std::cout << n << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> x(M);
    std::vector<long long> y(M);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&x[i]);
        scanf("%lld",&y[i]);
    }
    solve(N, M, std::move(x), std::move(y));
    return 0;
}


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

int main() {
  string s;
  cin>>s;
  int a,b;
  a=0;b=0;
  for(int i=0;i<s.size();i++)if(s[i]=='A'){a=i;break;}
  for(int i=0;i<s.size();i++)if(s[s.size()-i]=='Z'){b=s.size()-i;break;}
  cout<<b-a+1<<endl;
}


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

int main (void){
	long long int n,i,a[100004],b[100004],c[100004],suma=0,sumb=0,fn=0,fsum=0,ans;
	cin >> n;
	for(i=0;i<n;i++) {
		cin >> a[i];
		suma+=a[i];
	}
	for(i=0;i<n;i++) {
		cin >> b[i];
		sumb+=b[i];
	}
	if(suma<sumb){
		cout << "-1" << endl;
		return 0;
	}
	for(i=0;i<n;i++){
		if(a[i]<b[i]){
			fn++;
			fsum+=(b[i]-a[i]);
			c[i]=0;
		} else {
			c[i]=a[i]-b[i];
		}
	}
	ans=fn;
	if(fn==0){
		cout << "0" << endl;
		return 0;
	}
	sort(c,c+n);
	for(i=n-1;i>=0;i--){
		fsum=fsum-c[i];
		ans++;
		if(fsum<=0) break;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
signed main(){
  int n,t;
  while(cin>>n>>t,n){
    vector<int> m(n),l(n),k(n);
    for(int i=0;i<n;i++) cin>>m[i]>>l[i]>>k[i];
    auto check=[&](int x){
      vector<int> a(n,0);
      vector<int> o(x,0);
      int cnt=0;
      for(int i=0;i<=t;i++){
	int p=0;
	for(int j=0;j<n;j++){
	  if(a[j]<0||a[j]>i) continue;
	  while(p<x&&o[p]>i) p++;
	  if(p==x) break;
	  if(i+m[j]>t) return 0;
	  //if(i+m[j]>t) continue;
	  o[p]=i+m[j];
	  a[j]=-1;
	  cnt++;
	  //cout<<i<<" "<<j<<":"<<i+m[j]<<endl;
	}
	for(int j=0;j<n;j++)
	  if(a[j]>=0&&i>=a[j]+l[j]) a[j]=i+k[j];
      }
      //cout<<x<<":"<<cnt<<":"<<n<<endl;
      return 1*(cnt==n);
    };
    for(int i=1;i<=n;i++){
      //cout<<i<<":"<<check(i)<<endl;
      if(check(i)){
	cout<<i<<endl;
	break;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 3076
s = input()
t = input()
n, m = len(s), len(t)
a = [0] * (n + 1)
b = [0] * (m + 1)
for i in range(n):
    a[i + 1] = a[i]
    if s[i] == 'A':
        a[i + 1] += 1
    else:
        a[i + 1] += 2
for i in range(m):
    b[i + 1] = b[i]
    if t[i] == 'A':
        b[i + 1] += 1
    else:
        b[i + 1] += 2
q = int(input())
for _ in range(q):
    i, j, k, l = map(int, input().split())
    if (a[j] - a[i - 1]) % 3 == (b[l] - b[k - 1]) % 3:
        print('YES')
    else:
        print('NO')


Measured memory_bytes: 13556
#include<stdio.h>
 
int main(void)
{
    char x[1001];
    int sum[10000];
    int number;
    int i, j;
    int last = 0;
     
    for(i = 0; last != 1; i++)
    {
        scanf("%s", x);
        for(j = 0; x[j] != '\0'; j++)
        {
            if(j == 0)
            {
                sum[i] = (int)(x[j] - '0');
            }
            else
            {
                sum[i] += (int)(x[j] - '0');
            }
 
        }
        if(x[0] == '0' && x[1] == '\0')
        {
            last = 1;
            number = i;
        }
    }
     
    for(i = 0; i < number; i++)
    {
        printf("%d\n", sum[i]);
    }
    return 0;
}

Measured memory_bytes: 544
#include <iostream>
using namespace std;
int main()
{
    long A, B, K;
    cin >> A >> B >> K;
    if (A >= K)
    {
        cout << A-K << " " << B << endl;
    }else if(K <= A+B) {
        cout << 0 << " " << B-(K-A) << endl;
    }else {
        cout << 0 << " " << 0 << endl;
    }
    return 0;
}

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

int main(){
  int N;
  cin >> N;
  vector<string> S(N);
  for(int i=0;i<N;i++){
    cin >> S.at(i);
    sort(S.at(i).begin(),S.at(i).end());
  }
  ll count = 0;
  sort(S.begin(),S.end());
  ll i=0;
  while(i<N){
    ll j=1;
    while(i+j<N){
      if(S.at(i)==S.at(i+j)){
        j++;
      }else{
        break;
      }
    }
    count += j*(j-1)/2;
    i += j;
  }
  cout << count << endl;
}


Measured memory_bytes: 7296
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <utility>
#include <numeric>
using namespace std;
#define ll long long
#define INF 1000000007
ll ggd(ll a,ll b){
    ll x = a * b;
    ll tmp;
    /* 自然数 a > b を確認・入替 */
    if(a<b){
        tmp = a;
        a = b;
        b = tmp;
    }
    ll r;
    /* ユークリッドの互除法 */
    r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    
    return x/b;
}
signed main(){
    int n;
    cin>>n;
    vector<pair<int,int>> a(n);
    for(int i=0;i<n;i++){
        int k,l;
        cin>>k>>l;
        a[i]=make_pair(l, k);
    }
    sort(a.begin(),a.end());
    int count=0;
    bool ans=true;
    for(int i=0;i<n;i++){
        count+=a[i].second;
        if(count>a[i].first)ans=false;
    }
    if(ans)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}





Measured memory_bytes: 1792
#include <stdio.h>

int main(void){
	int i = 9, am, pm;
	char s[20];
	while (i--) {
		scanf("%s%d%d", s, &am, &pm);
		printf("%s %d %d\n", s, am+pm, am*200+pm*300);
	}
	return 0;
}

Measured memory_bytes: 596
N, M, X = map(int, input().split(' '))
price, exp, rst = [], [ [] for i in range(N) ], -1
for i in range(N):
    ls = list(map(int, input().split(' ')))
    price.append(ls[0])
    exp[i] = ls[1:]
for i in range(1 << N):
    price_combi, exp_combi, exp_sum, cnt_ls = [], [], [0] * M, []
    for j in range(N):
        if i >> j & 1:
            price_combi.append(price[j])
            exp_combi.append(exp[j])
    for s in exp_combi:
        for t in range(M):
            exp_sum[t] += s[t]
    [ cnt_ls.append(x) for x in exp_sum if x >= X ]
    if len(cnt_ls) == M:
        if rst == -1:
            rst = sum(price_combi)
        else:
            rst = min(rst, sum(price_combi))
print(rst)


Measured memory_bytes: 9172
#include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
#define INF 1e18
#define PI 3.14159265358979

using namespace std;

ll power(ll n, ll k);
ll inv(ll n);
ll genfact(ll n, ll k);
ll fact(ll n);
ll nck(ll n, ll k);

int main(void){
  int a, b, c;
  cin >> a >> b >> c;

  cout << max(0, c - a + b) << endl;

  return 0;
}


ll power(ll n, ll k){
  ll res = 1;
  while(k > 0){
    if (k & 1) 
      res = res * n % MOD;
    n = n * n % MOD;
    k >>= 1;
  }
  return res;
}

ll genfact(ll n, ll k){

  ll res = 1;
  while (k >= 0){
    res = (res * (n - k)) % MOD;
    k--;
  }

  return res;
}

ll inv(ll n){
  return power(n, MOD - 2);
}

ll fact(ll n){
  return genfact(n, n - 1);
}

ll nck(ll n, ll k){
  if (k == 0)
    return 1;
  if (n <= 0)
    return 0;

  return ((genfact(n, k) % MOD) * inv(fact(k))) % MOD;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    
    ll n,i,j;
    vector <ll> v;
    
    cin>>n;
    ll dp[n];
    for(i=0;i<n;i++){
        cin>>j;
        v.push_back(j);
    }
    dp[0]=0;
    dp[1]=max(v[1],v[0]) - min(v[1],v[0]);
    for(i=2;i<n;i++)dp[i]= min((abs(v[i]-v[i-1])+dp[i-1]), abs(v[i]-v[i-2])+dp[i-2]);
        cout<<dp[n-1]<<endl;
    return 0;
}

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

long long A, B, num;

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

int main(){
	cin >> A >> B;
	long long gc = gcd(A, B);
	long long k = gc;

	num++;
	for(long long i = 2; i*i <= gc; i++){
		if(k%i == 0){
			num++;
			while(k % i == 0){
				k /= i;
			}
		}
	}

	if(k > 1){
		num++;
	}
	cout << num << endl;
}


Measured memory_bytes: 256
-- https://github.com/minoki/my-atcoder-solutions
{-# LANGUAGE BangPatterns #-}
import Data.Int (Int64)
import Data.Coerce
import qualified Data.ByteString.Char8 as BS
import Control.Exception (assert)

main = do
  n <- readLn
  s <- BS.getLine
  assert (BS.length s == 2 * n) $ return ()
  let loop :: N -> Int -> Int -> N
      loop !acc !k !i | BS.length s == i = if k == 0 then acc else 0
                      | BS.index s i == 'W' = if even k
                                              then loop (acc * fromIntegral k) (k-1) (i+1)
                                              else loop acc (k+1) (i+1)
                      | otherwise = if even k
                                    then loop acc (k+1) (i+1)
                                    else loop (acc * fromIntegral k) (k-1) (i+1)
  print $ loop (product $ map fromIntegral [1..n]) 0 0

--
-- Modular Arithmetic
--

modulo :: Int64
modulo = 10^9+7
addMod, subMod, mulMod :: Int64 -> Int64 -> Int64
addMod !x !y | x + y >= modulo = x + y - modulo
             | otherwise = x + y
subMod !x !y | x >= y = x - y
             | otherwise = x - y + modulo
mulMod !x !y = (x * y) `rem` modulo

newtype N = N { unwrapN :: Int64 } deriving (Eq)
instance Show N where
  show (N x) = show x
instance Num N where
  (+) = coerce addMod
  (-) = coerce subMod
  (*) = coerce mulMod
  fromInteger n = N (fromInteger (n `mod` fromIntegral modulo))
  abs = undefined; signum = undefined

fromIntegral_Int64_N :: Int64 -> N
fromIntegral_Int64_N n | 0 <= n && n < modulo = N n
                       | otherwise = N (n `mod` modulo)

fromIntegral_Int_N :: Int -> N
fromIntegral_Int_N n | 0 <= n && fromIntegral n < modulo = N (fromIntegral n)
                     | otherwise = N (fromIntegral n `mod` modulo)

{-# RULES
"^9/Int" forall x. x ^ (9 :: Int) = let u = x; v = u * u * u in v * v * v
"^9/Integer" forall x. x ^ (9 :: Integer) = let u = x; v = u * u * u in v * v * v
 #-}

{-# RULES
"fromIntegral/Int->N" fromIntegral = fromIntegral_Int_N
"fromIntegral/Int64->N" fromIntegral = fromIntegral_Int64_N
 #-}


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

int main()
{
    int n;
    cin >> n;
    vector<string> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    a.erase(unique(a.begin(), a.end()), a.end());
    if (a.size() == n)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
    return 0;
}

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

int main() {
    int d,i,f,a;
    while(cin >> d ) {
		if (d==-1) break;
		if (d==0) cout << 0; 
		for (f=0,i=20 ; i>-1 ; i-=2) {
		a=d & ((1<< (i+1))+( 1 << i));
		 if (f==0 && a>0) f=1;
		 if (f==1) cout << (a >> i);
	 }
	 cout << endl;
 } 
	return 0;
}

Measured memory_bytes: 1160
N = int(input())
S = [input() for _ in range(N)]
M = int(input())
T = [input() for _ in range(M)]
Get = {}
for s in S:
    if s in Get:
        Get[s] += 1
    else:
        Get[s] = 1
for t in T:
    if t in Get:
        Get[t] += -1
    else:
        Get[t] = -1
ans = max(Get.values())
print(ans if ans > 0 else 0)

Measured memory_bytes: 8876
n=int(input())
A=list(map(int,input().split()))
 
dp=list(range(0,n))
dp[0]=0
dp[1]=abs(A[1]-A[0])
for i in range(n-2):
  temp1=dp[i]+abs(A[i+2]-A[i])
  temp2=dp[i+1]+abs(A[i+2]-A[i+1])
  dp[i+2]=min(temp1,temp2)
 
print(dp[n-1])

Measured memory_bytes: 13980
#include<iostream>
#include<algorithm>
using namespace std;
#define int long long
const int mod=1e9+7;

signed main(){

   int N;
   cin>> N;
   int a[N];
   for(int i=0; i<N; i++) cin>> a[i];

   sort(a, a+N);
   if(N%2){
      if(a[0]!=0){
         cout<< 0<< endl;
         return 0;
      }
      for(int i=1; i<N-1; i+=2){
         if(a[i]!=a[i+1]){
            cout<< 0<< endl;
            return 0;
         }
      }
   }else{
      for(int i=0; i<N-1; i+=2){
         if(a[i]!=a[i+1]){
            cout<< 0<< endl;
            return 0;
         }
      }
   }

   int k=N/2;
   int s=1;
   for(int i=0; i<k; i++){
      (s*=2)%=mod;
   }

   cout<< s<< endl;

   return 0;
}


Measured memory_bytes: 1024
object Main extends App {
  import scala.io.StdIn._
  solve
  def solve: Unit = {
    val Array(n, m, d) = readLine.trim.split(' ').map(_.toInt)
    val state = Array.tabulate(n){_ ⇒ readLine.trim.toCharArray.map(_ == '.')}
    val maxVertical = Array.tabulate(n){h ⇒ Array.tabulate(m){w ⇒ if (state(h)(w)) 1 else 0}}
    for (h ← 1 until n) for (w ← 0 until m) if (state(h)(w)) maxVertical(h)(w) += maxVertical(h - 1)(w)
    val maxHorizontal = Array.tabulate(n){h ⇒ Array.tabulate(m){w ⇒ if (state(h)(w)) 1 else 0}}
    for (w ← 1 until m) for (h ← 0 until n) if (state(h)(w)) maxHorizontal(h)(w) += maxHorizontal(h)(w - 1)
    println(
      maxVertical.map{_.count(_ >= d)}.sum + maxHorizontal.map{_.count(_ >= d)}.sum
    )
  }
  implicit class ScopeFunc[T](private val value: T) {
    def let[A](func:T ⇒ A): A = func(value)
    def also(func:T ⇒ Unit): T = {
      func(value)
      value
    }
  }
}




Measured memory_bytes: 44892
#pragma GCC optimize ("-O3")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
using namespace std;

#define all(c) (c).begin(),(c).end()
#define endl "\n"
#define ff first
#define ss second
#define allr(c) (c).rbegin(),(c).rend()
#define ifr(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define pof pop_front
#define pob pop_back
#define pb emplace_back
#define pf emplace_front
#define fstm(m,n,r) m.reserve(n);m.max_load_factor(r)
#define mp make_pair
#define mt make_tuple
#define inf LLONG_MAX
#define os tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
//order_of_key (k) : Number of items strictly smaller than k .
//find_by_order(k) : K-th element in a set (counting from zero).
const double PI = acos(-1);
typedef complex<double> cd;
typedef long long ll;
ll gcd(){return 0ll;} template<typename T,typename... Args> T gcd(T a,Args... args) { return __gcd(a,(__typeof(a))gcd(args...)); }
typedef map<ll,ll> mll;
typedef map<string,ll> msll;
typedef unordered_map<ll,ll> umap;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
typedef long double ld;
#define mod 1000000007 
#define N 100001

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,m;
    cin>>n>>m;
    if(n==m) cout<<"Yes\n";
    else cout<<"No\n";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define all(v) begin(v), end(v)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};
int const MOD = 1000000007;
ll mod_pow(ll x, ll n) {return (!n)?1:(mod_pow((x*x)%MOD,n/2)*((n&1)?x:1))%MOD;}
int madd(int a, int b) {return (a + b) % MOD;}
int msub(int a, int b) {return (a - b + MOD) % MOD;}
int mmul(int a, int b) {return (a * b) % MOD;}
int minv(int a) {return mod_pow(a, MOD-2);}
int mdiv(int a, int b) {return mmul(a, minv(b));}

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

signed main() {
    int n, t; cin >> n; cin.ignore();
    rep(i,0,n) {
        string s; getline(cin, s);
        while((t = s.find("Hoshino")) != string::npos) {
            s.replace(t, 7, "Hoshina");
        }
        cout << s << endl;
    }
    return 0;
}

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

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

using namespace std;


//v.push_back(123);
//sort(v.begin(), v.end(),greater<int>());
//for(int x : v) {cout << x << endl;}

//for(int x: v) cout << x << endl;
//vector<vector<char>> v(H, vector<char>(W));
// vector<int> v(1000);

long long pow_mod(long long x, long long y, long long MOD){
	long long ret = 1;
	while(y){
		if (y & 1) ret = ret * x % MOD;
		x = x * x % MOD;
		y>>=1;
	}
	return ret;
}

signed main(){
  double N, D;
  cin>>N>>D;
  cout << ceil(N/(2*D+1)) << endl;

  return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

func countDivisor(n int) (x int) {
	for i := 1; i <= n; i++ {
		if n%i == 0 {
			x++
		}
	}
	return x
}

func main() {
	var n int
	fmt.Scan(&n)
	var ans int
	for i := 1; i <= n; i = i + 2 {
		if countDivisor(i) == 8 {
			ans++
		}
	}
	fmt.Println(ans)
}


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

using namespace std;
typedef long long ll;
//typedef unsigned long long ll;

//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<ll, int> P;
//typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX / 10;
//const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)

bool contain(set<char> &s, int a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

void print_line(vector<int> &line) {
    if (line.size() == 0ll) {
        cout << endl;
        return;
    }
    for (ll i = 0; i < line.size(); i++) {
        cout << line[i];
        if (i == line.size() - 1) cout << endl;
        else cout << ' ';
    }
}


typedef priority_queue<long long, vector<long long>, greater<long long> > PQ_ASK;
const int mod = 1000000007;

typedef pair<ll, ll> P;


int partition(vector<int> &a, int p, int r) {
    int x = a[r];
    int i = p - 1;
    for (int j = p; j < r; j++) {
        if (a[j] <= x) {
            i++;
            swap(a[i], a[j]);
        }
    }
    swap(a[i + 1], a[r]);
    return i + 1;
}

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

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

    int p = partition(a, 0, n - 1);

    for (int i = 0; i < n; i++) {
        if (i == p) {
            printf("[%d] ", a[i]);
        } else if (i < n - 1) {
            printf("%d ", a[i]);
        } else {
            printf("%d\n", a[i]);
        }
    }

}



Measured memory_bytes: 3552
#include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>
#include<stdio.h>
#include<locale.h>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long int ll;
int main()
{
 int N,K;
 int loc1;
 scanf("%d %d",&N,&K);
 for(int i=1;i<=N;i++)
 {
	int a; scanf("%d",&a);
	if(a==1){loc1=i;}
 }
 int z=K-1;
 int ans=(N-1)/z;
 if((N-1)%z!=0){ans++;}
 printf("%d",ans);
} 

Measured memory_bytes: 3772
#include <bits/stdc++.h>
#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++)
#define INF 2e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
int GCD(int a,int b){return b?GCD(b,a%b):a;}
int LCM(int a,int b){return (a*b)/GCD(a,b);}
int abs(int x){return x>0?x:-x;}
 
const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int sea[50][50];
int w, h;
void dfs(int x, int y)
{
	sea[x][y] = 0;
	for (int i = 0; i < 8; i++){
		int nx = x + dx[i], ny = y + dy[i];
		if (0 <= nx and nx < h and 0 <= ny and ny < w and sea[nx][ny] == 1){
			dfs(nx, ny);
		}
	}

	return;
}

int main()
{
	while (1){
		int ans = 0;
		cin >> w >> h;
		if (!w and !h) return 0;
		REP(i, h){
			REP(j, w){
				cin >> sea[i][j];
			}
		}

		for (int i = 0; i < h; i++){
			for (int j = 0; j < w; j++){
				if (sea[i][j] == 1){
					dfs(i, j);
					ans++;
				}
			}
		}

		cout << ans << endl;
	}

}



Measured memory_bytes: 3116
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main()
{
    int n;
    cin>>n;
    int A[n];
    unordered_map<int,int>mp;
    for(int  i=0; i<n; i++){
        cin>>A[i];
        mp[A[i]]++;
    }
    int odd=0,even=0;
    for(auto p:mp){
        if(p.second%2==0)even++;
        else odd++;
    }
    if(even%2==1)cout<<even+odd-1<<endl;
    else cout<<even+odd<<endl;
}


Measured memory_bytes: 4772
#include <stdio.h>          // printf(), scanf()
#include <stdbool.h>

#define N 8

const int nil = -1;
bool x[N][N];
int row[N];
bool col[N];
bool dpos[2 * N - 1], dneg[2 * N - 1];

void
print_board()
{
	int i, j;

	for (i = 0; i < N; ++i)
	{
		for (j = 0; j < N; ++j)
		{
			if (x[i][j] && row[i] != j)
				return;
		}
	}

	for (i = 0; i < N; ++i)
	{
		for (j = 0; j < N; ++j)
			printf("%c", (row[i] == j) ? 'Q' : '.');

		printf("\n");
	}
}

void
backtrack(int i)
{
	int j;

	if (i == N)
	{
		print_board();
		return;
	}

	for (j = 0; j < N; ++j)
	{
		if (!col[j] && !dpos[i + j] && !dneg[i - j + N - 1])
		{
			row[i] = j;
			col[j] = dpos[i + j] = dneg[i - j + N - 1] = true;

			backtrack(i + 1);
			row[i] = nil;
			col[j] = dpos[i + j] = dneg[i - j + N - 1] = false;
		}
	}
}

void
initialize()
{
	int i, j;

	for (i = 0; i < N; ++i)
	{
		row[i] = nil;
		col[i] = false;

		for (j = 0; j < N; ++j)
			x[i][j] = false;
	}

	for (i = 0; i < 2 * N - 1; ++i)
	{
		dpos[i] = false;
		dneg[i] = false;
	}
}

int
main(int argc, char** argv)
{
	int r, c;
	int k;
	int i;

	initialize();

	scanf("%d", &k);
	for (i = 0; i < k; ++i)
	{
		scanf("%d %d", &r, &c);
		x[r][c] = true;
	}

	backtrack(0);
	return 0;
}

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

/* #pragma */
/*
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
*/

/*alias*/
#define F first
#define S second

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define itn int

/*template*/
template<class T>inline bool amax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>inline bool amin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

/* func */
int GCD(int a,int b){return b?GCD(b,a%b):a;}
long long GCD(long long a, long long b){return b ? GCD(b, a%b) : a;}
int LCM(int a, int b){return a * b / GCD(a, b);}
long long LCM(long long a, long long b){return a * b / GCD(a, b);}

/*struct*/
struct aaa {
	aaa() {
		cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20);
	};
}aaaaaaa;

/* const */
const int INF = 1001001001;
const long long LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7; //10^9
const double EPS = 1e-9;
const int dx[] = { 1, 1, 0, -1, -1, -1, 0, 1 }, dy[] = { 0, 1, 1, 1, 0, -1, -1, -1 };
//const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
//Counterclockwise from the 6o'clock direction
//Take the x-axis downward and the y-axis right

//#define int long long

//g++ -std=c++14 -Wall --pedantic-errors -o template template.cpp
//g++ -std=c++14 -Wall --pedantic-errors template.cpp
//chcp 65001

/*global*/




signed main()
{
	int n;
	cin >> n;
	int ans{};
	int sum{};
	for(int i = 1; i <= n; ++i){
		int carry = 1;
		int d = i;
		while(d > 0){
			d/=10;
			if(d < 1){
				break;
			}
			carry++;
		}
		if((carry % 2) == 1){
			ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
n = int(input())
t = 0
for a in range(1, 3501):
    if t != 0:
        break
    for b in range(1, 3501):
        if (4 * a * b - n * (a + b)) != 0:
            if (n * a * b) % (4 * a * b - n * (a + b)) == 0 and (n * a * b) // (4 * a * b - n * (a + b)) > 0:
                print(a, b, (n * a * b) // (4 * a * b - n * (a + b)))
                t = 1
                break


Measured memory_bytes: 41068
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int p=max(a,c),q=min(b,d);
    if(q-p<0)cout<<0<<endl;
    else cout<<q-p<<endl;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;

namespace atcoderA
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            int[] input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            int x = input[0];
            int y = input[1];

            var list1 = new List<int> { 1, 3, 5, 7, 8, 10, 12 };
            var list2 = new List<int> { 4, 6, 9, 11 };
            var list3 = new List<int> { 2 };

            if (list1.Contains(x) && list1.Contains(y))
            {
                Console.WriteLine("Yes");
            }
            else if(list2.Contains(x) && list2.Contains(y))
            {
                Console.WriteLine("Yes");
            }
            else if (list3.Contains(x) && list3.Contains(y))
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}

Measured memory_bytes: 13140
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
//#include <stack>
//#include <queue>
//#include <cstdio>
#include <cmath>
#include <iterator>
#include <map>
//#include <list>
#include <iomanip>

using namespace std;

#define IOS ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define prec std::cout << std::fixed << std::setprecision(15);
#define endl "\n"
#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define ssort(z) sort(z.begin(), z.end())
#define rsort(z) sort(z.rbegin(), z.rend())
#define eerase(z) z.erase(unique(z.begin(), z.end()), z.end())
#define ccnt(z, w) count(z.begin(), z.end(), w)
#define rep(i,a,n) for(Int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(Int (i)=(a); (i)<=(n); (i)++)
const int MAX_N = 1000000;
const Int MAX_N_Int = 1000000000000;

template <typename T>
void printV(const std::vector<T>& v, const char * const separator = " ")
{
    if(!v.empty())
    {
        std::copy(v.begin(),
                  --v.end(),
                  std::ostream_iterator<T>(std::cout, separator));
        std::cout << v.back() << "\n";
    }
}

bool isPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}
Int gcd(Int a, Int b) {
    return b != 0 ? gcd(b, a % b) : a;
}

Int lcm(Int a, Int b) {
    return a / gcd(a, b) * b;
    //a*bは64bit integer overflow
}

int Max(int a, int b, int c) {
    int temp = max(a, b);
    return max(temp, c);
}

int Min(int a, int b, int c) {
    int temp = min(a, b);
    return min(temp, c);
}

bool integer(double num) {
    return floor(num) == num;
}

Int fact(int num) {
    if (num == 0)
        return 1;
    else
        return num * fact(num - 1);
}

Int yakusu(int n) {
    int cnt = 0;
    for (int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            cnt++;
            if (i * i != n) cnt++;
        }
    }
    return cnt;
}


Int fact_mod(Int n, Int mod) {
    Int f = 1; repq(i,2,n) f = f * (i % MOD) % MOD;
    return f;
}

// 繰り返し二乗法 (modの世界での累乗)
Int mod_pow(Int x, Int n, Int mod) {
    Int res = 1;
    while(n > 0) {
        if(n & 1) res = (res * x) % mod;
        x = (x * x) % mod;
        n >>= 1;
    }
    return res;
}

// 組み合わせ nCr を求める
Int combination_mod(Int n, Int r, Int mod) {
    if(r > n-r) r = n-r;
    if(r == 0) return 1;
    Int a = 1;
    rep(i, 0, r) a = a * ((n-i) % mod) % mod;
    Int b = mod_pow(fact_mod(r, mod), mod-2, mod);
    return (a % mod) * (b % mod) % mod;
}

int main() {
    //COMinit();
    IOS;
    prec;
    Int a,b,c,d,n,m,k,x,y=0,ans=0,ans1=0;
    string str,s="",t,u;
    cin>>a>>b>>c;
    if((a<=c and c<=b) or (b<=c and c<=a))cout<<"Yes";
    else cout<<"No";



    cout<<endl;
    return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	double L; cin>>L; cout<<setprecision(10)<<fixed<<pow(L/3,3)<<"\n";
	return 0;
}

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


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

    int a;
    if(n/9.0 > 9){
        cout<<"No"<<endl;
        return 0;
    }else{
        for(int i=1; i<=9; ++i){
            a = n/i;
            if(a <= 9 && n == a*i ){
                cout<<"Yes"<<endl;
                return 0;
            }
        }
    }
    cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,ans;
bool pd(int x)
{
	int sum=0;
	for(int j=1;j<=n;j++)
		if(x%j==0) sum++;
	if(sum==8) return 1;
	return 0;
}
int main()
{
	scanf("%d",&n);
	for(int j=1;j<=n;j+=2)
		if(pd(j)) ans++;
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
 {
    double a,b,c=0,d,e,f,i,j,k,r,l,m,n;
    char x[100],y[100];

scanf("%lf",&r);
r=2*3.1416*r;

printf("%lf\n",r);
return 0;
 }


Measured memory_bytes: 1748
// #pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define N 1000000007
#define N2 998244353
#define Nmax 100001
#define INF (ll)1e18
#define pll pair<ll,ll>
#define pii pair<ll,ll>
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(ll i=m;i<(n);i++)
#define get(n) ll (n); scanf("%lld",&(n));
#define get2(n,k) ll (n),(k); scanf("%lld%lld",&(n),&(k));
#define get3(n,m,k) ll (n),(m),(k); scanf("%lld%lld%lld",&(n),&(m),&(k));
#define gets(s) string (s); cin >> (s);
#define ALL(c) (c).begin(),(c).end()
#define fill_nums(A,n) vector<ll> A((n)); for(ll i=0;i<n;i++) scanf("%lld",&A[i]);
#define fill_edges(adj,m) for(ll i=0;i<m;i++) {ll a, b; scanf("%lld %lld",&a,&b); adj[a-1].pb(b-1); adj[b-1].pb(a-1);}
#define fill_direct(adj,m) for(ll i=0;i<m;i++) {ll a, b; scanf("%lld %lld",&a,&b); adj[a-1].pb(b-1);}
#define pi 3.1415926535897



int main() {

    get(n);
    fill_nums(A,n);

    ll sum=0;
    for(int i=0;i<n;i++)
        sum+=A[i];

    ll res = sum, lsum=0;
    for(int i=0;i<n;i++) {
        lsum += A[i];
        sum -= A[i];
        res = min(res, abs(lsum-sum));
    }

    printf("%lld\n", res);

    return 0;  
}

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

using namespace std;


int main(void){
    int N;
    string s[2];
    
    cin >> N;
    cin >> s[0];
    cin >> s[1];

    vector<int> v;
    for(int i=0;i<N;i++){
        if(i == N-1 || s[0][i] != s[0][i+1]) v.push_back(0); // tate
        else { // yoko
            v.push_back(1);
            i++;
        }
    }

    long long ans = v[0] == 0 ? 3 : 6;
    int prev = v[0];
    for(int i=1; i < v.size(); i++){
        if(v[i] == 0){
            if(prev == 0){
                ans *= 2;
            } else {
                ans *= 1;
            }
        } else {
            if(prev == 0){
                ans *= 2;
            } else {
                ans *= 3;
            }
        }

        prev = v[i];
        ans %= 1000000007;
    }

    cout << ans << endl;

    return 0;
}

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

int main(){
    int n;
    cin >> n;
    vector<string> s;
    rep(i, n){
        string s0;
        cin >> s0;
        sort(s0.begin(), s0.end());
        s.push_back(s0);
    }
    sort(s.begin(), s.end());
    ll ans = 0;
    ll cnt = 1;
    for(int i = 1; i<n; i++){
        if(s[i-1] == s[i])cnt++;
        else{
            ans += cnt*(cnt-1)/2;
            cnt = 1;
        }
    }
    ans += cnt*(cnt-1)/2;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 7472
#include <bits/stdc++.h>
using namespace std;
int n,ans=0;
int num[100011];
int main()
{
	cin >>n;
	for(int i=0;i<n;i++)
	{
		int x;
		cin >>x;
		num[x-1]++;
		num[x]++;
		num[x+1]++;
	}
	for(int i=0;i<100011;i++)
	ans=max(ans,num[i]);
	cout <<ans<<endl;
	return 0;
}

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

using namespace std;
using ll = int64_t;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using mii = map<int, int>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using tpi = tuple<int, int, int>;

using vqi = vector<queue<int>>;
using vpi = vector<pii>;
using bs = bitset<60>;
using vbi = vector<bs>;

ll gcd(ll a, ll b) {
    if (a < b) {
        swap(a, b);
    }

    /* ユークリッドの互除法 */
    ll r = a % b;
    while (r != 0) {
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

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

constexpr int64_t __pow_mod(int64_t n, int64_t p, int64_t mod) noexcept {
    if (p == 0) {
        return 1;
    }
    if (p % 2 == 0) {
        int64_t t = __pow_mod(n, p / 2, mod);
        return (t * t) % mod;
    }
    return (n * (__pow_mod(n, p - 1, mod) % mod)) % mod;
}

constexpr int64_t pow_mod(int64_t n, int64_t p, int64_t mod) noexcept {
    int64_t res = __pow_mod(n, p, mod);
    if (res == 0) {
        res = mod;
    }
    return res;
}

constexpr int64_t nCr_mod(int64_t n, int64_t r, int64_t mod) noexcept {
    int64_t count = 1;
    auto a = r;
    for (auto i = n; i > n - r; i--) {
        count *= i;
        if (count % mod != 0) {
            count %= mod;
        }
        int64_t inv = pow_mod(a, mod - 2, mod);
        count *= inv;
        if (count % mod != 0) {
            count %= mod;
        }
        a--;
    }
    return count;
}

void solve(long long N) {
    ll sum = 0;
    for (int i = 1; i <= N; i++) {
        if (i % 3 != 0 && i % 5 != 0) {
            sum += i;
        }
    }
    cout << sum << endl;
}

int main() {
    long long N;
    std::cin >> N;
    solve(N);
    return 0;
}


Measured memory_bytes: 3620
#include <limits.h>
#include <stdio.h>

using namespace std;

int a[2 * 100000] = {0};

int main(){
  int n;
  scanf("%d", &n);
  for(int i = 0; i < n; i++){
    scanf("%d", &a[i]);
  }

  int min = INT_MAX;

  int cnt = 0; // 答えはminを更新した回数 ただし等号含む
  for(int i = 0; i < n; i++){
    if(a[i] <= min){
      ++cnt;
      min = a[i];
    }
  }
  printf("%d\n", cnt);
  return 0;
}


Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
 
#define pb push_back
#define ll long long
#define maxn 100005
#define fr(i,j,k) for(int i=j;i<k;i++)
#define f(n) fr(i,0,n)
#define f1(n) fr(i,1,n+1)
#define ms(i) memset(i,0,sizeof(i));
#define ms1(i) memset(i,-1,sizeof(i));
#define F first
#define S second
#define all(x) x.begin(), x.end()
const int mod = 1e9+7;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    if (n == 3) {
        cout << "2 5 63\n";
    }
    else if (n == 4) {
        cout << "2 5 20 63\n";
    }
    else {
            cout << "2 3 4 9 ";
            n -= 4;
        int v[30002] = {};
        v[2] = v[3] = v[4] = v[9] = 1;
        if (n >= 2) {
            v[8] = v[10] = 1;
            n -= 2;
            cout << "8 10 ";
        }
        for (int i = 6 ;i + 3 <= 30000 ; i+= 6) {
            if (n >= 2) {
                if (!v[i-2] && !v[i+2]) {
                    cout << i - 2 <<' '<<i + 2<<' ';
                    n -= 2;
                    v[i-2] = v[i+2] = 1;
                }
            }
            if (n >= 2) {
                if (!v[i-3] && !v[i+3]) {
                    cout << i - 3 <<' '<<i + 3<<' ';
                    n -= 2;
                    v[i-3] = v[i+3] = 1;
                }
            }
            if (n >= 2) {
                if (!v[i-4] && !v[i+4]) {
                    cout << i - 4 <<' '<<i + 4<<' ';
                    n -= 2;
                    v[i-4] = v[i+4] = 1;
                }
            }
        }
        for (int i = 6 ;i <= 30000 ; i+= 6) {
            if (n) {
                if (!v[i]) {
                    cout << i <<' ';
                    n--;
                }
            }
        }
        //cout << n <<"here"<< endl;
        cout << '\n';
    }
}


Measured memory_bytes: 512
#include<iostream>
#include<iomanip>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<string>
#include<algorithm>
#include<functional>
#include<math.h>
#include<unordered_set>
using namespace std;
const int INF = 2147483647;
const int MAX = 50;

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

int main() {
	int H, W;
	char grid[MAX][MAX];
	int cnt[MAX][MAX] = { 0 };

	cin >> H >> W;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {

			cin >> grid[i][j];

			if (grid[i][j] == '#') {

				for (int k = 0; k < 8; k++) {
					int y = i + dy[k];
					int x = j + dx[k];
					if (y < 0 || y >= H || x < 0 || x >= W)continue;
					cnt[y][x]++;
				}

			}
		}
	}

	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (grid[i][j] == '.')cout << cnt[i][j];
			else cout << '#';
		}
		cout << endl;
	}
	return 0;
}

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

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define IMOD 1000000007 
#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define lrep(i,n) for(long long  i = 0; i < (long long)(n); i++)
#define lrep2(i,a,n) for(long long i = (long long)(a); i <= (long long)(n); i++)

#define irrep(i,n) for(int i = (int)(n); i > -1; i--)
#define irrep2(i,a,n) for(int i = (int)(n); i >= (int)(a); i--)

typedef long long ll;
typedef std::vector<char> v_char;
typedef std::vector<v_char > v2_char;
typedef std::vector<double> v_double;
typedef std::vector<v_double > v2_double;
typedef std::vector<int> v_int;
typedef std::vector<v_int > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<v_ll > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<v_string > v2_string;
typedef std::vector<bool> v_bool;
typedef std::vector<v_bool > v2_bool;
typedef std::pair<ll, ll> pll;
typedef std::pair<int, int> pii;

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

using namespace std; 

int main(void)
{
    string n, m;
    cin >> n >> m;

    int q = 0;
    irep(i, n.size()) {
        cout << n[i];
        if(q < m.size()) {
            cout << m[q++];
        }
    }
    
    return 0;
}   
/** atcoder **/


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

int main()
{
	int n;

	while( cin >> n && n ){
		set< int > list;
		int size = ( n - 1 ) / 2;
		int* counts = new int[ size + 1 ]();
		for( int i = 1; i < n; ++i ){
			list.insert( i * i % n );
		}
		set< int >::iterator itr1 = list.begin();
		set< int >::iterator itr2 = list.begin();
		while( itr1 != list.end() ){
			while( itr2 != list.end() ){
				if( itr1 == itr2 ){
					++itr2;
					continue;
				}
				int a = *itr1;
				int b = *itr2;
				int diff = a - b;
				if( diff < 0 ){
					diff += n;
				}
				if( diff > size ){
					diff = n - diff;
				}
				++counts[ diff ];

				++itr2;
			}
			++itr1;
			itr2 = list.begin();
		}

		for( int i = 1; i <= size; ++i ){
			cout << counts[ i ] << endl;
		}

		delete[] counts;
	}

	return 0;
}

Measured memory_bytes: 1448
a,b,k=map(int,input().split())
mi=min(a,b)
ma=max(a,b)
flag=0
nim=0
ans=0

while True:
    tmp = mi - nim
    if flag == k:
        break
    else:
        if ma%tmp == 0:
            if mi%tmp == 0:
                ans = tmp
                nim += 1
                flag += 1
            else:
                nim += 1
        else:
            nim += 1
print(ans)

Measured memory_bytes: 3064
<?php
  	fscanf(STDIN, "%d %d", $N, $M);
	// corner case
	if ($N == 1 && $M == 1) {
      	$result = 0; 
    } else {
      	if ($N <= 1){
      		$evenNum = 0;
    	} else {
         	$evenNum = factorial($N)/(2*factorial($N-2));
        }
      
      	if ($M <= 1) {
      		$oddNum = 0;
    	} else {
         	$oddNum = factorial($M)/(2*factorial($M-2));
        }
    	$result = $evenNum + $oddNum;
    }
	
	echo $result;

    function factorial($num){
      $res = 1;
        for($tmp=1;$tmp<=$num;$tmp++) {
          $res *= $tmp;
        }
        return $res;
    }


Measured memory_bytes: 3576
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;

#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

fn main(){
    let line = read_as_vec::<usize>();
    let (h, w, d) = (line[0], line[1], line[2]);

    let mut grid: Vec<(i64, i64)> = vec![(0,0);h*w+1];
    for i in 1..h+1{
        let line = read_as_vec::<usize>();
        for j in 1..w+1{
            grid[line[j-1]] = (i as i64, j as i64);
        }
    }
    let mut cost = vec![0;h*w+1];
    for i in 1..d+1{
        cost[i] = 0;
    }

    for i in d+1..h*w+1{
        cost[i] = cost[i - d] + (grid[i].0 - grid[i-d].0).abs() + (grid[i].1 - grid[i-d].1).abs();
    }

    //queries
    let q: usize = read_as_vec()[0];

    for _ in 0..q{
        let line = read_as_vec::<usize>();
        let (l, r) = (line[0], line[1]);

        println!("{}",cost[r] - cost[l]);
    }
}


Measured memory_bytes: 7292
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <array>
#include <queue>
#include <map>
#include <stack>
#include <cstdint>
#include <unordered_set>
typedef long long int llint;

int main(void){
  std::string s, t;
  std::cin >> s >> t;

  std::cout << t << s << std::endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*

fun main(args:Array<String>) {
    val N = 1000000
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val a = (0 until n).map { sc.next().toInt() }
    val ac = a.sorted().groupingBy { it }.eachCount()
    //println(ac)
    val erato : MutableList<Boolean> = MutableList(N+1) { false }
    var ans = 0
    ac.forEach {
        if (it.value == 1 && !erato[it.key]) ans += 1
        for (i in it.key..N step it.key) erato[i] = true
    }

    println(ans)

}

Measured memory_bytes: 87396