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

int main() {
    int N;
    cin >> N;
    map<int, int> odd, even;
    vector<int> vec(N);
    for (int i = 0; i < N; i++) {
        cin >> vec[i];
    }
    for (int i = 0; i < N; i++) {
        if (i % 2 == 0) odd[vec[i]] ++;
        else even[vec[i]] ++;
    }

    // 最頻値から答えを求める１
    int max1 = 0;
    int key = 0;
    for(pair<int, int> m: odd)
    {
        if(m.second > max1)
        {
            max1 = m.second;
            key = m.first;
        }
    }

    int max2 = 0;
    for(pair<int, int> m: even)
    {
        // mp1の最頻値となるkeyとは異なる値を選ぶ
        if(m.second > max2 && m.first != key) max2 = m.second;
    }
    int ans1 = (N/2 - max1) + (N/2 - max2);

     // 最頻値から答えを求める２
    max1 = 0;
    key = 0;
    for(pair<int, int> m: even)
    {
        if(m.second > max1)
        {
            max1 = m.second;
            key = m.first;
        }
    }
    max2 = 0;
    for(pair<int, int> m: odd)
    {
        // mp2の最頻値となるkeyとは異なる値を選ぶ
        if(m.second > max2 && m.first != key) max2 = m.second;
    }
    int ans2 = (N/2 - max1) + (N/2 - max2);
    
    int ans = min(ans1, ans2);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5376
#include <bits/stdc++.h>
#define rep(i,x) for(long long i=0;i<x; i++)
typedef long long  ll;
using namespace std;
int main(){
  ll N;
  cin>>N;
  
  ll A[N],Ch[2*100000+5];
  
  rep(i,2*100000+5) Ch[i]=0;
  rep(i,N) cin>>A[i];
  rep(i,N) Ch[A[i]]++;
  
  ll ans=0;
  
  rep(i,2*100000+5){
  	if(Ch[i]>1){
    	ans+=(Ch[i]*Ch[i]-Ch[i])/2;
    }
  }
  
  
  rep(i,N){
  	if(Ch[A[i]]>1){
    	cout<<ans-Ch[A[i]]+1<<endl;
    }else{
    	cout<<ans<<endl;
    }
  }
  
  
  
}


Measured memory_bytes: 5760
lst=list(str(input()))
temp = []
for i in range(len(lst)):
  if lst[i] not in temp:
    temp.append(lst[i])
cnt=0
for j in range(len(temp)):
  if lst.count(temp[j])%2==1:
    cnt+=1
if cnt==0:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

int main(void){
  int x;
  cin >> x;
  if(x < 1200) cout << "ABC" << endl;
  else cout << "ARC" << endl;
  return 0;
}

Measured memory_bytes: 256
let rec popcnt acc = function
  | 0 -> acc
  | n -> popcnt (acc + (acc land 1)) (n lsr 1)
let popcnt = popcnt 0

let rec drop n = function
  | [] -> []
  | (_ :: t) as l ->
      if n = 0
      then l
      else drop (n - 1) t

let sort_count ( <= ) xs =
  let rec merge_count acc xs ys n cnt =
    match xs, ys with
    | _, [] -> cnt, List.rev_append acc xs
    | [], _ -> cnt, List.rev_append acc ys
    | x :: xs', y :: ys' ->
        if x <= y
        then merge_count (x :: acc) xs' ys (n - 1) cnt
        else merge_count (y :: acc) xs ys' n (n + cnt) in
  let rec sort_count xs = function
    | 0 -> 0, []
    | 1 -> 0, [List.hd xs]
    | n ->
        let c, ys = sort_count xs (n / 2) in
        let d, zs = sort_count (drop (n / 2) xs) ((n + 1) / 2) in
        merge_count [] ys zs (n / 2) (c + d) in
  sort_count xs (List.length xs)

let () = Scanf.scanf "%d\n" @@ fun n ->
  let as_ = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun a -> a in
  let bs = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun b -> b in
  let ans =
    Array.fold_left min max_int @@
    Array.init (1 lsl n) @@ fun s ->
      if popcnt s mod 2 = 1 then max_int else
      let f i = if s land (1 lsl i) = 0 then as_.(i) else bs.(i) in
      let (inv, xs) =
        sort_count (fun i j -> f i <= f j) @@
        Array.to_list @@
        Array.init n @@ fun i -> i in
      match
        List.mapi (fun i j ->
          (f j, (i mod 2 = j mod 2) = (s land (1 lsl j) = 0))) xs
      with
      | [] -> max_int
      | [(_, true)] -> inv
      | [(_, false)] -> max_int
      | (x, b) :: (x', b') :: xbs ->
          try
            let (x, b, x', b', inv) =
              List.fold_left (fun (x, b, x', b', inv) (x'', b'') ->
                match b, x = x', b',    x' = x'', b'' with
                | true,  _,      _,     _,        _ ->     (x', b', x'', b'', inv)
                | false, false,  _,     _,        _ ->     raise Not_found
                | false, true,   false, _,        _ ->     (x', true, x'', b'', inv + 1)
                | false, true,   true,  false,    _ ->     raise Not_found
                | false, true,   true,  true,     false -> raise Not_found
                | false, true,   true,  true,     true ->  (x', true, x'', false, inv + 2))
              (x, b, x', b', inv) xbs in
            if b && b'
            then inv
            else if not b && not b' && x = x'
            then inv + 1
            else max_int
          with Not_found -> max_int in
  Printf.printf "%d\n" @@ if ans = max_int then -1 else ans

Measured memory_bytes: 6144
while True:

    input_data1 = input()

    if input_data1 == "0":
        break

    input_data2 = input()
    input_data3 = input()

    output = "NA"

    if input_data1[0] != "+" and input_data1[0] == input_data1[1] == input_data1[2]:
        output = input_data1[0]
    elif input_data2[0] != "+" and input_data2[0] == input_data2[1] == input_data2[2]:
        output = input_data2[0]
    elif input_data3[0] != "+" and input_data3[0] == input_data3[1] == input_data3[2]:
        output = input_data3[0]

    elif input_data1[0] != "+" and input_data1[0] == input_data2[0] == input_data3[0]:
        output = input_data1[0]
    elif input_data1[1] != "+" and input_data1[1] == input_data2[1] == input_data3[1]:
        output = input_data1[1]
    elif input_data1[2] != "+" and input_data1[2] == input_data2[2] == input_data3[2]:
        output = input_data1[2]

    elif input_data1[0] != "+" and input_data1[0] == input_data2[1] == input_data3[2]:
        output = input_data1[0]
    elif input_data1[2] != "+" and input_data1[2] == input_data2[1] == input_data3[0]:
        output = input_data1[2]

    print(output)



Measured memory_bytes: 5560
# -*- coding: utf-8 -*-
import sys
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))

ans = 0
i = 1
while i != 2:
    i = a[i-1]
    #print(i)
    ans += 1
    if ans >= n:
        print(-1)
        sys.exit()
print(ans)


Measured memory_bytes: 7468
#include <bits/stdc++.h>
#define LL long long
#define mem(i, j) memset(i, j, sizeof(i))
#define rep(i, j, k) for(int i = j; i <= k; i++)
#define dep(i, j, k) for(int i = k; i >= j; i--)
#define pb push_back
#define make make_pair
#define INF INT_MAX
#define inf LLONG_MAX
#define PI acos(-1)
#define fir first
#define sec second
using namespace std;

const int N = 2e5 + 10;

pair < LL, LL > a[N], tmp;
LL c[N];
LL dp[100];

bool cmp(pair < LL, LL > A, pair < LL, LL > B) {
    return A.fir * (B.sec + 1) > B.fir * (A.sec + 1);
}

void solve() {

    int n; LL T;
    scanf("%d %lld", &n, &T);
    int cnt1 = 0, cnt2 = 0;
    rep(i, 1, n) {
        scanf("%lld %lld", &tmp.fir, &tmp.sec);
        if(tmp.fir == 0) c[cnt2++] = tmp.sec + 1;
        else a[cnt1++] = tmp;
    }

    sort(c, c + cnt2);
    sort(a, a + cnt1, cmp);

    rep(i, 1, 30) dp[i] = T + 1;
    dp[0] = 0;
    rep(i, 1, cnt2 - 1) c[i] += c[i - 1];

    rep(i, 0, cnt1 - 1) {
        dep(j, 1, 30) {
            dp[j] = min(dp[j], (a[i].fir + 1) * (dp[j - 1] + 1) + a[i].sec);
        }
//        cout<<dp[i]<<endl;
    }

    int ans = 0;
    rep(i, 0, 30) {
//    	cout<<dp[i]<<endl;
//    	cout<<ans<<endl; 
        if(dp[i] > T) continue;
        int add = 0;
        if(cnt2) add = upper_bound(c, c + cnt2, T - dp[i]) - c;
//        cout<<add<<' '<<ans<<endl;
        ans = max(ans, i + add);
    }
    printf("%d\n", ans);
    return ;
}

int main() {

    solve();

    return 0;
}

Measured memory_bytes: 6940
import java.lang.*;
import java.util.*;
public class Main
{
    static Scanner sc = new Scanner(System.in);

    public static void main(String args[])
    {
        while(true){
            int n = sc.nextInt();
            if(n==0) break;
            
            int[] a = new int[5001];
            for(int i=0; i<n; i++){
                a[i] = sc.nextInt();
            }
            
            int max = a[0];
            for(int i=0; i<n; i++){
                int sum = 0;
                for(int j=i; j<n; j++){
                    sum += a[j];
                    if(max < sum) max = sum;                    
                }
            }
            System.out.println(max);
            
        }
    }
}

	    
	    

Measured memory_bytes: 26352
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int ans = 1;
    for (int i = 0; i < n; i++) {
      if ((sc.nextInt() % 2) == 0) {
        ans *= 2;
      }
    }

    System.out.println((int) Math.pow(3, n) - ans);

  }
}

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

const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;

ll N;
vector<ll> g[100100]; 

ll dp[100100][2];

// 木DP?
// color: 0: w
// color: 1: b
void dfs(int cur, int par = -1) {
    // 遷移
    dp[cur][0] = dp[cur][1] = 1;

    // 潜っていく
    for (int i = 0; i < g[cur].size(); i++) {
        int to = g[cur][i];
        if (to == par) continue;

        dfs(to, cur);
        dp[cur][0] *= (dp[to][0] + dp[to][1]); 
        dp[cur][0] %= mod;

        dp[cur][1] *= dp[to][0]; 
        dp[cur][1] %= mod;
    }
}

int main() {
    cin >> N;

    rep(i, N - 1) {
        ll x, y;
        cin >> x >> y;
        x--; y--;
        g[x].push_back(y);
        g[y].push_back(x);
    }

    dfs(0);

    ll ans = dp[0][0] + dp[0][1];
    ans %= mod;
    cout << ans << endl;
}

Measured memory_bytes: 17612
#include <iostream>
using namespace std;
int main(){
    int n;cin>>n;
    for(int i = 0; n > i; i++){
        int x,y,b,p;cin>>x>>y>>b>>p;
        cout << min((max(b,5)*x+max(p,2)*y)*4/5,x*b+y*p) << endl;
    }
}


Measured memory_bytes: 3120
import math

import sys

sys.setrecursionlimit(10000)
INF = float('inf')

Q = int(input())
A, B = zip(*[list(map(int, input().split())) for _ in range(Q)])


def solve(a, b):
    a, b = min(a, b), max(a, b)
    assert a <= b

    if a == b:
        # print('c', a, b)
        # a * b > (a-n) * (b+n) なので、
        # (a-1, b+1), (a-2, b+2), ..., (1, b*2-1) まで選ぶ。x, y 逆にしても同じなので * 2
        return (a - 1) * 2
    if a == b - 1:
        # print('d', a, b)
        # 上と同じ
        # (a-1, b+1), (a-2, b+2), ..., (1, b*2-1) まで選ぶ。x, y 逆にしても同じなので * 2
        # y == a == b-1 は選べない。(a+1)*(b-1) == a*b なので x は a 以下にする必要があるため
        return (a - 1) * 2

    # a*b より小さい最大の c^2
    # math.sqrt(a*b-1) だとだめ
    # (10**9) * (10**9) - 1 がギリギリすぎて 10**9 になっちゃう
    c = int(math.sqrt(a * b))
    if c ** 2 == a * b:
        c -= 1

    # (a-1, b+1), (a-2, b+2), ..., (1, b+a-1) を選ぶ
    ret = a - 1
    if c * (c + 1) < a * b:
        # print('a', a, b)
        # (c, c+1), (c-1, c+2), ..., (a+1, c+(c-a)+1) まで
        ret += c - a
        # (c+1, c), (c+2, c-1), ..., (c+c-1, 1)
        ret += c
    else:
        # print('b', a, b)
        # (c, c), (c-1, c+1), ..., (a+1, c+(c-a)) まで
        ret += c - a
        # (c+1, c-1), (c+2, c-2), ..., (c+c-1, 1)
        ret += c - 1
    return ret


for a, b in zip(A, B):
    print(solve(a, b))


Measured memory_bytes: 3188
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>

#include <cstdio>

using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrep1(i, s, n) for (int i = (s); i >= (n); i--)
#define print_array(ary, size) cout << ary[0]; rep1(i, 1, size - 1) cout << ' ' << ary[i]; cout << endl;
typedef long long ll;
typedef unsigned long long ull;


int dp[1000][1000];

int getLCS(string* s1, string* s2, int s1i, int s2i)
{
	int ret;
	int cand1, cand2;

	if (s1i < 0 || s2i < 0) {
		return 0;
	}
	else if (dp[s1i][s2i] != -1) ret = dp[s1i][s2i];
	else if ((*s1)[s1i] == (*s2)[s2i]) {
		ret = getLCS(s1, s2, s1i - 1, s2i - 1) + 1;
	}
	else {
		cand1 = getLCS(s1, s2, s1i, s2i - 1);
		cand2 = getLCS(s1, s2, s1i - 1, s2i);
		ret = max(cand1, cand2);
	}
	dp[s1i][s2i] = ret;

	return ret;
}

int main()
{
	int q;
	int ans;
	string s1, s2;

	cin >> q;
	rep(i, q) {
		rep(j, 1000) {
			rep(k, 1000) dp[j][k] = -1;
		}
		cin >> s1 >> s2;
		ans = getLCS(&s1, &s2, s1.length() - 1, s2.length() - 1);
		cout << ans << endl;
	}

	return 0;
}


Measured memory_bytes: 7164
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=int(a);i<int(b);i++)
#define INF 1200000000

struct card{
    char sui;
    int num;
};   

card x;

int parti(card A[],int p,int r){
    x=A[r];
    int i=p-1;
    card a;
    rep(j,p,r){
        if(A[j].num<=x.num){
            i++;
            a=A[i];
            A[i]=A[j];
            A[j]=a;
        }
    }
    a=A[i+1];
    A[i+1]=A[r];
    A[r]=a;
    return i+1;
}

void quicksort(card A[],int p,int r){
    int q;
    if (p<r){
        q=parti(A,p,r);
        quicksort(A,p,q-1);
        quicksort(A,q+1,r);
    }
}


card L[50015],R[50010];

void merge(card A[],int left,int mid,int right){
    int n1=mid-left;
    int n2=right-mid;
    for(int i=0;i<n1;i++)L[i]=A[left+i];
    for(int i=0;i<n2;i++)R[i]=A[mid+i];
    L[n1].num=INF;R[n2].num=INF;
    int i=0,j=0;
    for(int k=left;k<right;k++){
        if(L[i].num<=R[j].num){
            A[k]=L[i];
            i++;
        }
        else{
            A[k]=R[j];
            j++;
        }
    }
}
    

void mergesort(card A[],int left,int right){
    if(left+1<right){
        int mid=(left+right)/2;
        mergesort(A,left,mid);
        mergesort(A,mid,right);
        merge(A,left,mid,right);
    }
}



int main(){
    int n;
    card C[100010],D[100010];
    cin>>n;
    rep(i,0,n){
        cin>>C[i].sui>>C[i].num;
        D[i]=C[i];
    }
    quicksort(C,0,n-1);
    mergesort(D,0,n);
    
    bool jud=1;
    rep(i,0,n){
        if(C[i].sui!=D[i].sui || C[i].num!=D[i].num){
            jud=0;
            break;
        }
    }
    if(jud)cout<<"Stable"<<endl;
    else cout<<"Not stable"<<endl;
    
    rep(i,0,n){
        cout<<C[i].sui<<" "<<C[i].num<<endl;
    }
    
}





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

const int MAXN=1e5+5;

int n,N,a[MAXN<<1],b[MAXN<<1];

struct data{
	int l,r,val;	
}d[MAXN];

int re(int limit){
	memset(b,-1,sizeof(b));
	int num=0;
	for(int i=1;i<=N;i++){
		b[i]=a[i]>=limit?1:0;
	}
	for(int i=1;i<N;i++){
		if(b[i]==b[i+1]){
			d[++num].l=i;
			d[num].val=b[i];
			while(i<=N&&b[i]==b[i+1]){
				++i;
			}
			d[num].r=i;
		}
	}
	//cout<<num;
	if(!num)return b[1];
	d[0].r=0;
	for(int i=1;i<=num;i++){
		int l1=d[i-1].r+1,r1=d[i].l-1;//交替区域 
		if(l1>r1)continue;
		int mid=(l1+r1)>>1;
		d[i-1].r=mid;d[i].l=mid+1;
	}
	//注意1和num的，两头的范围。 
	int l1=d[num].r+1,r1=N;
	if(l1<=r1){
		int mid=(l1+r1)>>1;
		d[num].r=mid;
	}
	for(int i=1;i<=num;i++){if(d[i].l<=n&&d[i].r>=n)return d[i].val;}
}

int main(){	
	scanf("%d",&n);
	N=2*n-1;
	for(int i=1;i<=N;i++){
		scanf("%d",&a[i]);
	}
	int l=1,r=N,ans;
	while(l<=r){
		int mid=(l+r)>>1;
		if(re(mid))ans=mid,l=mid+1;
		else r=mid-1;	
	}
	printf("%d\n",ans);
	return 0;
}

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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    vi a(5);
    rep(i, 5) cin >> a[i];
    int k;
    cin >> k;
    bool ans = true;
    if (a[4]-a[0] > k) ans = false;
    cout << (ans?"Yay!":":(") << endl;
    return 0;
}


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

using namespace std;
using ll = long long;
#define MOD 1000'000'007

int main(){
    cin.sync_with_stdio(0);
    cin.tie(0);
    int i, n, m, j;
    cin >> n;
    vector<ll> v(n), suff(n, 0);
    for (i = 0; i < n; i++)
        cin >> v[i];
    suff[n - 1] = v[i - 1];
    for(i = n - 2; i >= 0; i--)
        suff[i] = (suff[i + 1] + v[i]) % MOD;
    ll ans = 0;
    for(i = 0; i < n - 1; i++)
        ans = (ans + v[i] * suff[i + 1])%MOD;
    
    cout << ans << endl;
}

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

const long double EPS = 1e-10;
const long long INF = 1e18;
const int MOD = (int)1e9 + 7;
const long double PI = acos(-1.0L);

int main() {
  int n;
  cin >> n;
  vector<int> seq(n, 0);
  int red = 0;
  rep(i, n) {
    char s;
    cin >> s;
    if (s == 'R') {
      seq[i] = 1;
      red++;
    }
  }
  int ans = 0;
  rep(i, red) {
    if (seq[i] == 0) {
      ans++;
    }
  }
  cout << ans << endl;

  return 0;
}

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

int main(){
    int n, x;
    for(int a = 0;;a++){
        cin >> n >> x;
        if( n == 0 && x == 0) break;
        int i, j, k, cnt = 0;
        for( i = 1; i <= n; i++){
            for(j = i + 1; j <= n; j++){
                for(k = j + 1; k <= n; k++){
                    if(x == i + j + k) cnt++;
                }
            }
        }
        cout << cnt << endl;
    }
}


Measured memory_bytes: 3092
#include<iostream>
#include<queue>
#include<limits>
// #include<bits/stdc++.h>
#include<algorithm>
#include<vector>
#include<cmath>
#include<math.h>
#include<iomanip>  
#include<deque> 
#include<stack>
#include<string> 
#include<string.h>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#define ll long long
#define tc(t)  while(t--)
#define V vector
#define Vp vector< pair<int,int> >
#define pb push_back
#define UM unordered_map
#define IT iterator
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define PQ priority_queue
#define _FI ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;

 char ar[140000];
vector<ll> SieveOfEratosthenes(ll n) 
{ 
  vector<ll> result;
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
    int count=1;
    for (ll p=2; p*p<=n; p++) 
    { 
        if (prime[p] == true) 
        {  
            for (ll i=p*p; i<=n; i += p) 
                {
                  prime[i] = false; 
                }
            count++;
        } 
    } 
  
    for (ll p=2; p<=n; p++) 
       if (prime[p]) 
          {
            result.push_back(p);
          }
    return result;
}



vector<ll> Divisors (ll n)
{
  vector<ll> res;
  for(ll i=1;i<=sqrt(n);i++)
  {
    if(n%i==0)
    {
      if(n/i==i)
      {
        res.pb(i);
      }
      else
      {
        res.pb(i);
        res.pb(n/i);
      }
    }
  }

  return res;
}

int a[4][2]={ {1,0}, {1,-1}, {1,1}, {2,0} } ;
bool validPoint(int x,int y, int N)
{
    return (x>=0 && x<N && y>=0 && y<N);
}


 
int main()
{
  _FI 
  
  int h;
  cin>>h;
  int a;
  cin>>a;
  if(h%a==0)
  {
    cout<<h/a;
  }
  else
  {
    cout<<h/a +1;
  }


  return 0;
}












 // V<double> arr(2*n);
 //  V<double> proper;
 //  V<double> improper;
 //  double sum=0;
 //  for(int i=0;i<2*n;i++)
 //  {
 //      cin>>arr[i];
 //      sum+=arr[i];
 //      if(arr[i]-floor(arr[i])==0)
 //        proper.pb(arr[i]);
 //      else
 //        improper.pb(arr[i]);
 //  }


Measured memory_bytes: 3168
from itertools import accumulate

N, X, M = map(int, input().split())
s = []
A = X
ind = {}
i = 0
while A not in ind:
    s.append(A)
    ind[A] = i
    A = A * A % M
    i += 1
L = i - ind[A]
s = [0] + list(accumulate(s))
ans = s[ind[A]] + (s[-1] - s[ind[A]]) * ((N - ind[A]) // L) + s[ind[A] + (N - ind[A]) % L] - s[ind[A]]
print(ans)

Measured memory_bytes: 81644
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
using namespace std;


int a[3][3];

void solve()
{
	for (int i = 0; i < 3; i++)
	{
		for (int k = 0; k < 3; k++)
		{
			cin >> a[i][k];
		}
	}


	int m;
	cin >> m;
	for (int i = 0; i < m; i++)
	{
		int x;
		cin >> x;

		for (int i = 0; i < 3; i++)
		{
			for (int k = 0; k < 3; k++)
			{
				if (a[i][k] == x)
				{
					a[i][k] = -1;
				}
			}
		}
	}

	bool yes = false;

	for (int i = 0; i < 3; i++)
	{
		bool t1 = true, t2 = true;
		for (int k = 0; k < 3; k++)
		{
			if (a[i][k] != -1)
			{
				t1 = false;
			}

			if (a[k][i] != -1)
			{
				t2 = false;
			}
		}

		yes = max(yes, max(t1, t2));
	}

	bool d1 = true, d2 = true;

	for (int i = 0; i < 3; i++)
	{
		if (a[i][i] != -1)
		{
			d1 = false;
		}

		if (a[i][3 - i - 1] != -1)
		{
			d2 = false;
		}
	}

	yes = max(yes, max(d1, d2));

	if (yes)
	{
		cout << "Yes";
	}
	else
	{
		cout << "No";
	}
}

int main()
{
	solve();
}

Measured memory_bytes: 256
public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
    int n = sc.nextInt();
    int[][] d = new int[n][6];
    int i, j;
    for(i = 0;i < n;i++)for(j = 0;j < 6;j++)d[i][j] = sc.nextInt();
    if(solve(d, n))out.println("Yes");
    else out.println("No");

    sc.close();
  }
  private static boolean solve(int[][] d, int n){
    int i, j;
    for(i = 0;i < n - 1;i++)for(j = i + 1;j < n;j++)
      if(isisom(d[i], d[j]))return false;
    return true;
  }
  private static boolean isisom(int[] d, int[] e){
    int i, j, k;
    for(i = 0;i < 6;i++){
      for(j = 0;j < 4;j++){
        for(k = 0;k < 6;k++)if(d[k] != e[k])break;
        if(k == 6)return true;
        rroll(d);
      }
      for(k = 0;k < 6;k++)if(d[k] != e[k])break;
      if(k == 6)return true;
      if(i % 2 == 0)nroll(d);
      else eroll(d);
    }
    return false;
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
  private static void nroll(int[] dice){ //(1265)
    int tmp;
    tmp = dice[0]; dice[0] = dice[1]; dice[1] = dice[5];
    dice[5] = dice[4]; dice[4] = tmp;
    return;
  }
  private static void eroll(int[] dice){ //(1463)
    int tmp;
    tmp = dice[0]; dice[0] = dice[3]; dice[3] = dice[5];
    dice[5] = dice[2]; dice[2] = tmp;
    return;
  }
  private static void rroll(int[] dice){ //(2354)
    int tmp;
    tmp = dice[1]; dice[1] = dice[2]; dice[2] = dice[4];
    dice[4] = dice[3]; dice[3] = tmp;
    return;
  }
}

Measured memory_bytes: 29044
#include <iostream>
#include <stdio.h>

#include <vector>
#include <cctype>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>

using namespace std;




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

    vector<long long> arr(n);

    for (int i = 0; i < n; i++)cin >> arr[i];
   
    long long ans = 0;
    
    long long standard = arr[0];
    
    for (int i = 0; i < n; i++) {
        //int
        if (arr[i] > standard) {
            standard = arr[i];
        }

        long long dai = standard - arr[i];
        //cout << dai << endl;
        ans = ans + dai;
    }

    cout << ans << endl;

    return 0;
}

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

using ll = long long;
//typedef long long ll;

#define INF (1LL << 31 - 1)
#define INFLL ((1LL << 62) - 1)
#define MOD int(1e9+7)
#define repi(i,j,n) for(int i = (j); i < (n); ++i)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) for (int i = n; i >= 0; --i)
#define fi first
#define se second
#define all(v) (v).begin(), (v).end()

int vx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, vy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};

inline bool check(int ux, int uy, int x, int y) {
  return (0 <= x and x < ux and 0 <= y and y < uy);
}

inline void init() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

string s;

int main() {
  cin >> s;

  int n = s.size(), l, r;
  l = 0, r = 1; // [l, r]
  map<char, int> mp;

  mp[s[0]]++, mp[s[1]]++;

  while(true) {
    //cout << l << " " << r << endl;
    //cout << s.substr(l, r - l + 1) << endl;

    if (l == r and r > n - 1) break;
    
    if (l == r) {
      if (r < n - 1) {
        r++;
        mp[s[r]]++;
      }
      else {
        break;
      }
    }
    else {
      int len = r - l + 1;

      if (len >= 2) {
        //cout << "in" << endl;
        for (char c = 'a'; c <= 'z'; ++c) {
          //cout << "char is " << c << " , " << mp[c] << endl;
          if (mp[c] > (len / 2)) {
            cout << l + 1 << " " << r + 1 << endl;
            return 0;
          }
        }
      }

      if (r < n - 1 and mp[s[r + 1]] > 0) {
        r++;
        mp[s[r]]++;
        
      }
      else {
        mp[s[l]]--;
        l++;
        
      }
    }
  }

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


Measured memory_bytes: 512
import java.util.Scanner;
public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		double T = sc.nextInt();

		double A = sc.nextInt();
		double min = 999999999;
		int ans = 0;

		for (int i = 0; i < N; i++) {
			int H = sc.nextInt();

			double AverageTemperature = T - H * 0.006;

			double difference = Math.abs(A - AverageTemperature);
			if (min > difference) {
				min = difference;
				ans = i + 1;
			}
		}

		System.out.println(ans);
	}

}


Measured memory_bytes: 22868
def main():
    minus = []
    N = int(input())
    T, A = map(int, input().split())
    *H, = map(int, input().split())
    for i in range(N):
        minus.append(abs(A - (T - H[i] * 0.006)))
    print(minus.index(min(minus)) + 1)
main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll f[20001][20];
int main()
{
    ll n,m;
    cin>>n>>m;
    ll c[10];
    c[1]=2;
    c[2]=5;
    c[3]=5;
    c[4]=4;
    c[5]=5;
    c[6]=6;
    c[7]=3;
    c[8]=7;
    c[9]=6;
    ll a[m+1];
    for(ll i=1;i<=m;i++)
    {
        cin>>a[i];
        f[c[a[i]]][a[i]]=1;
    }
    sort(a+1,a+m+1);
    a[0]=0;
    for(ll i=2;i<n;i++)
    {
        for(ll j=1;j<=m;j++)
        {
            if(f[i][a[j]])
            {
                for(ll k=1;k<=m;k++)
                {
                    f[i+c[a[k]]][a[k]]=max(f[i+c[a[k]]][a[k]],f[i][a[j]]+1);
                }
            }
        }
    }
    ll k;
    for(ll i=n;i>0;i-=c[a[k]])
    {
        k=0;
        for(ll j=1;j<=m;j++)
        {
            if(f[i][a[j]] && f[i][a[j]]>=f[i][a[k]])
            {
                k=j;
            }
        }
        cout<<(char)('0'+a[k]);
    }
}

Measured memory_bytes: 1792
#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>;
constexpr ll MOD = 1e9 + 7;


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

    int ans=0;
    set<int> P;
    for (int i=0;i<N;i++){
        int p;
        cin >>p;
        auto iter = P.insert(p);
        if(iter.first == P.begin()){
            ans++;
        }
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 9600
use std::io::prelude::*;

fn input<T: std::str::FromStr>() -> T {
    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()
}

fn main() {
    let n: usize = input();
    let a: Vec<i32> = (0..n).map(|_| input()).collect();

    let mut b = a.clone();
    b.sort_by_key(|b| -b);
    for a in a {
        if a == b[0] {
            println!("{}", b[1]);
        } else {
            println!("{}", b[0]);
        }
    }
}


Measured memory_bytes: 7676
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
    
using namespace std;    
typedef long long ll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

int main(){

    string s;
    cin >> s;

    int cnt[26] = {0};
    for(int i = 0; i < s.size(); i++){
        cnt[s[i] - 'a'] ++;
    }
    
    for(int i = 0; i < 26; i++){
        if(cnt[i] % 2 == 1 ){
            cout << "No" << endl;
            return 0;
        }
    }

            cout << "Yes" << endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int ed(string x,string y){
	vector<vector<int>> tb(vector<vector<int>>((int)x.size()+1,vector<int>(y.size()+1,0)));
	for(int i=0;i<(int)x.size()+1;i++) tb[i][0]=i;
	for(int i=0;i<(int)y.size()+1;i++) tb[0][i]=i;
	int tmp;
	for(int i=1;i<(int)x.size()+1;i++){
		for(int j=1;j<(int)y.size()+1;j++){
			if(x[i-1]==y[j-1])  tmp=tb[i-1][j-1];
			else tmp=tb[i-1][j-1]+1;
			tb[i][j]=min(tmp,min(tb[i-1][j],tb[i][j-1])+1);
		}
	}
	return tb[(int)x.size()][(int)y.size()];
}
int main(){
	string x,y;
	cin>>x>>y;
	cout<<ed(x,y)<<endl;
	return 0;
}


Measured memory_bytes: 6896
#include<bits/stdc++.h>
using namespace std;
int main(){
    int M,D;
    cin>>M>>D;
    int k,l;
    k=D/10;
    int cont=0;

    for(int i=2;i<=k;i++){
        for(int j=2;j<10;j++){
            if(i*j<=M && (i*10+j)<=D){

                cont++;
            }
        }
        
    }
    cout<<cont<<'\n';
        
}

Measured memory_bytes: 256
#include <stdio.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
#include <unordered_map>

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

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

int N, M;
std::string S, T;

int main(int argc, char **argv) {
    std::cin >> N >> M;
    std::cin >> S;
    std::cin >> T;

    long long cand = lcm(N, M);
    long long stepS = cand / N;
    long long stepT = cand / M;

    for (int i = 0; i < N; i++) {
        if ((i * stepS) % stepT == 0) {
            int j = (i * stepS) / stepT;
            //std::cout << i << " " << j << " " << S[i] << " " << T[j] << std::endl;
            if (S[i] != T[j]) {
                std::cout << -1 << std::endl;
                return 0;
            }
        }
    }

    for (int i = 0; i < M; i++) {
        if ((i * stepT) % stepS == 0) {
            int j = (i * stepT) / stepS;
            if (T[i] != S[j]) {
                std::cout << -1 << std::endl;
                return 0;
            }
        }
    }

    std::cout << cand << std::endl;
    
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long
#define endl '\n'
#define PI acos(-1)
#define sz 100010
#define RUN_FAST ios::sync_with_stdio(false);
using namespace std;

int main()
{
    RUN_FAST; cin.tie(nullptr);
    ll n, a, b, tmp, sum, mod, cnt;
    cin >> n >> a >> b;
    cout << n/(a+b)*a + min(a, n%(a+b)) << endl;
    return 0;
}


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

#define ll long long
#define ld long double
typedef vector <ll> vi;                 // Vector of long long
typedef vector <vi> vvi;                // Vector of vi
typedef vector <pair<ll,ll>> ii;        // Vector of pairs
#define ff first                        // For pairs
#define ss second                       // For pairs
#define sz(a) int((a).size())           // Function to determine size of any container
#define pb push_back                    // Pushback to vector
#define mp make_pair                    // Makes pairs to be stored as pair
#define all(c) (c).begin(), (c).end()   // Mainly used by me in sorting
// ordered_set adds two new functions to set - (set).find_by_order([kth element based on zero indexing]) and order_of_key()
// order_of_key returns number of elements less that parameter. If element exists, that order is its index
#define ordered_set tree < ll ,  null_type ,  less<ll> ,  rb_tree_tag ,  tree_order_statistics_node_update >
#define MAX (ll)(1e5 + 5)

using cd = complex<ld>;
const ld PI = acos(-1);

void fft(vector<cd> & a, bool invert) {
    ll n = a.size();
    if (n == 1)
        return;

    vector<cd> a0(n / 2LL), a1(n / 2LL);
    for (int i = 0; 2 * i < n; i++) {
        a0[i] = a[2LL*i];
        a1[i] = a[2LL*i+1LL];
    }
    fft(a0, invert);
    fft(a1, invert);

    ld ang = 2LL * PI / n * (invert ? -1LL : 1LL);
    cd w(1LL), wn(cos(ang), sin(ang));
    for (int i = 0; 2 * i < n; i++) {
        a[i] = a0[i] + w * a1[i];
        a[i + n/2] = a0[i] - w * a1[i];
        if (invert) {
            a[i] /= 2;
            a[i + n/2] /= 2;
        }
        w *= wn;
    }
}

    vector<ll> multiply(vector<ll> const& a, vector<ll> const& b) {
    vector<cd> fa(a.begin(), a.end()), fb(b.begin(), b.end());
    ll n = 1;
    while (n < a.size() + b.size()) 
        n <<= 1;
    fa.resize(n);
    fb.resize(n);

    fft(fa, false);
    fft(fb, false);
    for (int i = 0; i < n; i++)
        fa[i] *= fb[i];
    fft(fa, true);

    vector<ll> result(n);
    for (int i = 0; i < n; i++)
        result[i] = round(fa[i].real());
    return result;
}

int main(void)
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll n, m;
    cin >> n >> m;

    vi a(MAX, 0);
    for (int i = 0; i < n; i++)
    {
        ll x;
        cin >> x;

        a[x]++;
    }

    vi b = a;
    vi c = multiply(a, b);

    ll s = 0, score = 0;
    for (int i = c.size() - 1; i >= 0; i--)
    {
        score += max(0LL, min(c[i], m - s)) * i;
        s += c[i];

        if (s >= m)
            break;
    }

    cout << score << "\n";
}


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

int main(){
  int N;
  std::cin >> N;
  std::vector<int> a(N);
  for(int i = 0; i < N; i++) std::cin >> a.at(i);
  std::sort(a.begin(), a.end());
  int ans;
  ans = a.at(a.size()-1) - a.at(0);
  std::cout << ans << std::endl;
}

Measured memory_bytes: 256
s=list(input())
data =[]
for i in s:
  if i=="0":
    data.append(0)
  elif i=="1":
    data.append(1)
  else:
    if data!=[]:
      del data[-1]
 #joinはリストが文字列のみ
data = map(str,data)
print(''.join(data))

Measured memory_bytes: 2940
#include<iostream>
#include<string>
#include<vector>
#include<unordered_map>
#include<algorithm>
#include<cmath>
#include<limits>
#include<cstdio>
using namespace std;

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

typedef long long ll;

int main() {
	
	char a[26] = { 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z' };
	int n;
	string s;
	cin >> n;
	cin >> s;
	int size;
	size = s.size();
	int h = 0;
	REP(i, size) {
		h = (int)s[i] - 65 + 26;
		cout << a[(h + n % 26)%26];
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

#define MAX(p,q) (p>q)?p:q
#define MIN(p,q) (p<q)?p:q

#define REP(i,n) for(i=0;i<n;i++)

int main(void)
{
  int n,k;
  scanf("%d%d",&n,&k);
  char s[n+1];
  scanf("%s",s);
  s[k-1] = s[k-1] + 32;
  printf("%s",s);
  return 0;
}


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

int main(){
	int H,W;
	char a[101][101];
	scanf("%d%d",&H,&W);
	getchar();
	for(int i=0;i<H;i++){
		scanf("%s",&a[i]);
		getchar();
	}
	for(int i=0;i<H;i++){
		printf("%s\n",a[i]);
		printf("%s\n",a[i]);
	}
} 

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ul unsigned long int
#define ld long double
#define f(t) for(ll i =0;i<t;i++)
#define vi vector<int>
#define vl vector<ll>
#define pri pair<int,int>
#define mpi map<int,int>
#define prl pair<ll,ll>
#define mp make_pair
#define mpl map<ll,ll>
#define umpl unordered_map<ll,ll>
#define pb push_back
#define ff first
#define ss second
#define MOD 1000000007
#define inf 2e18
#define EPS 1e-3
#define PI 3.1415926535897932385
const double h = 1e-6;
const int MAX_  = 100005;
#define display(v) f(v.size())cout << v[i] << " "
#define all(v) v.begin(),v.end()

inline ll mul(ll a, ll b){ return (a * 1ll * b) % MOD; }
inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += MOD; return c; }
inline ll add(ll a, ll b){ ll c = a + b; if(c > MOD) c -= MOD; return c; }
 //////////////////////*********CODE***********/////////////////////
 //////////////////////////////////////////////////////////////////

int main()
{
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   cout.tie(NULL);
   int x,y,a,b,c; cin>>x>>y>>a>>b>>c;
   ll red[a] ; f(a)cin>>red[i];  sort(red,red+a,greater<ll>());
   ll green[b]; f(b)cin>>green[i];  sort(green,green+b,greater<ll>());
   vl cl;  ll val ;f(c){cin>>val;cl.pb(val);}
   f(x)cl.pb(red[i]);
   f(y)cl.pb(green[i]);
   sort(all(cl),greater<int>());
   ll ans = 0;
   f(x+y)ans+=cl[i];
   cout << ans;
   

   return 0;
}     

Measured memory_bytes: 7920
#[allow(unused_imports)]
use proconio::{
    fastout, input,
    marker::{Bytes, Chars, Isize1, Usize1},
};

#[allow(unused_macros)]
macro_rules! echo {
    ($($e:expr),+) => ( { $(println!("{}", $e))+ } );
}

fn main() {
    input! {
        x: usize,
        a: usize,
        b: usize,
    }

    if b <= a {
        echo!("delicious");
        return;
    }

    if b <= a + x {
        echo!("safe");
        return;
    }

    echo!("dangerous");
}


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

#define int long long

#define pii pair<int,int> 

int N;
int a[100010];
map<int,int> mp;

vector<pii> e;
int sz[100010];
int dp[100010];

vector<pii> ans;

bool cmp_d(pii p,pii q)
{
	return p>q;
}

pii norm(int p,int q)
{
	return {min(p,q),max(p,q)};
}

main()
{
	cin>>N;
	for(int i=1;i<=N;i++)
	{
		cin>>a[i];
		mp[a[i]]=i;
		e.push_back({a[i],i});
		sz[i]=1;
	}
	sort(e.begin(),e.end(),cmp_d);
	int x=e.back().first;
	for(int i=0;i<e.size();i++)
	{
		pii& cur=e[i];
		if(cur.first!=x)
		{
			if(sz[cur.second]*2>=N) goto FAIL;
			int p=cur.first-N+2*sz[cur.second];
			if(mp.find(p)==mp.end()) goto FAIL;
			int q=mp[p];
			dp[q]+=dp[cur.second]+sz[cur.second];
			sz[q]+=sz[cur.second];
			ans.push_back(norm(cur.second,q));
		}
	}
	if(dp[e.back().second]!=x) goto FAIL;
	
	sort(ans.begin(),ans.end());
	for(int i=0;i<ans.size();i++)
	{
		cout<<ans[i].first<<" "<<ans[i].second<<endl;
	}
	return 0;
	
	
	
	FAIL:;
	{
		cout<<"-1"<<endl;
		return 0;
	}
}








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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second

int main(int argc, char const *argv[]) {
    double w,h,x,y;
    // cin >> w >> h >> x >> y;
    scanf("%lf%lf%lf%lf",&w,&h,&x,&y);
    double area = w * h;
    double ans = area / 2;
    printf("%.10f",ans);
    if (w/2 == x && h / 2 == y)
        printf(" 1\n");
    else 
        printf(" 0\n");
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long h,w;
	int mod=1000000007;
	cin>>h>>w;
		long long dp[h][w];
	 
for(int i=0;i<h;i++)
	{
		for(int j=0;j<w;j++)
		{
			dp[i][j]=0;
			char t;
			cin >> t;
			if(t=='#')
			dp[i][j]=-1;
		}
	}
     dp[0][0]=1;
	 for(int i=0;i<h;i++)
	 {
	 	for(int j=0;j<w;j++)
	 	{
	 		if(i-1>=0 && dp[i][j]!=-1 && dp[i-1][j]!=-1)
	 		{
			 dp[i][j]=(dp[i][j]+dp[i-1][j])%mod;
			}
			if(j-1>=0 && dp[i][j]!=-1 && dp[i][j-1]!=-1)
			{
			dp[i][j]=(dp[i][j]+dp[i][j-1])%mod;
			}
		 }
	 }
	
	 
	 cout<<dp[h-1][w-1];
	 
}

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

int main()
{
    int N,K;
    cin >> N >> K;
    int x[N];
    for(int i=0;i<N;i++){
        cin >> x[i];
    }
    int sum=0;
    for(int i=0;i<N;i++){
        if(x[i] <= K-x[i])
            sum+=x[i]*2;
        else
            sum+=(K-x[i])*2;
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
vector<int> G[100005];
long long N,M;
int viz[100005];
bool baga;
long long nr[2];
void dfs(int nod,int tata,int nvl)
{
    viz[nod]=nvl;
    nr[nvl%2]++;
    for(auto it:G[nod])
    {
        if(it!=tata)
        {
            if(!viz[it])dfs(it,nod,nvl+1);
            else if(viz[nod]%2==viz[it]%2)baga=1;
        }
    }
}
int main()
{
    cin>>N>>M;
    for(long long i=1;i<=M;i++)
    {
        long long a,b;
        cin>>a>>b;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    dfs(1,0,1);
    if(baga)cout<<N*(N-1)/2-M;
    else cout<<nr[0]*nr[1]-M;
    return 0;
}


Measured memory_bytes: 7296
import copy
"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def iprow():
    return [int(i) for i in input().split()]
def ips():
    return (int(i) for i in input().split())
def printrow(a):
    for i in a:
        print(i)

n ,m = ips()
tree = [[] for i in range(n+1)]
for i in range(n-1):
    x,y = ips()
    tree[x].append(y)
    tree[y].append(x)
total = [0 for i in range(n+1)]
for i in range(m):
    x,adder = ips()
    total[x]+=adder
base = copy.copy(total)
q = [1]
pos = 0
cs = set([1])
while len(q) > pos:
    #print("adding up",pos,q)
    i = q[pos]
    value = total[i]
    cs.add(i)
    if len(tree[i]):
        for k in tree[i]:
            if k not in cs:
                q.append(k)
                total[k]+=value
    pos+=1
for i in range(1,n):
    print(total[i],end=" ")
print(total[n])

Measured memory_bytes: 116352
s = input()
c = False
for l in range(10):
    l = 10 - l
    sl = [s[i:i+l] for i in range(len(s)-l+1)]
    for w in sl:
        if set(w).issubset(set("AGCT")):
            c = True
            print(l)
            break
    else:
        continue
    break
if not c:
    print(0)

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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

LL n, x, a[100];

int main() {
	cin >> n >> x;
	inc(i, n) { cin >> a[i]; }
	
	sort(a, a + n);
	
	LL ans = 0, sum = 0;
	inc(i, n) {
		sum += a[i];
		if(sum <= x) { ans++; }
	}
	if(ans == n && sum != x) { ans--; }
	
	cout << ans << endl;
	
	return 0;
}


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


#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

// vector<vector<uint64_t> > v(n+1, vector<uint64_t>(n+1, 0))
// v[n][k]に組み合わせ数が入る。
void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

// フェルマーの小定理
// mod. m での a の逆元 a^{-1} を計算する
// (a/b)%m = a*movinv(b,m)%m  
int64_t modinv(int64_t a, int64_t m) {
    int64_t b = m, u = 1, v = 0;
    while (b) {
        int64_t t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

// 円周率
// M_PI

// #include <iomanip> // setprecisionを使用するのに必要
// cout << std::fixed << std::setprecision(15) << y << endl;

// 昇順
// priority_queue<int, vector<int>, greater<int> > queue;

signed main() {
  int n;
  cin >> n;
  int64_t h = 0;
  int64_t hPrev = 0;
  int count = 0;
  int countMax = 0;
  for(int i=0;i<n;i++){
    cin >> h;
    if(h<=hPrev){
      count++;
      countMax = max(countMax, count);
    }
    else{
      count = 0;
    }
    hPrev = h;
  }
  cout << countMax << endl;
  return 0;
}




Measured memory_bytes: 3588
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
typedef unsigned int ui;
typedef long double ld;
const ld eps = 1e-8;
#define rep(i,n) for(int i=0;i<n;i++)
#define stop char nyaa;cin>>nyaa;
bool chked[200000];
vector<int> al1[26],al2[26];
int main(){
	string s, t; cin >> s >> t; int n = s.length();
	fill(chked, chked + n, false);
	rep(i, n) {
		al1[s[i] - 'a'].push_back(i);
		al2[t[i] - 'a'].push_back(i);
	}
	bool ans = true;
	rep(i, n) {
		if (chked[i])continue;
		int l1 = al1[s[i] - 'a'].size();
		int l2 = al2[t[i] - 'a'].size();
		if (l1 != l2) {
			ans = false; break;
		}
		rep(j, l1) {
			if (al1[s[i] - 'a'][j] != al2[t[i] - 'a'][j]) {
				ans = false; break;
			}
			chked[al1[s[i] - 'a'][j]] = true;
		}
		if (!ans)break;
	}
	if (ans)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 3208