akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll unsigned long long int
#define vi vector<ll>
#define pi pair<ll,ll>
#define vp vector<pi>
#define pb push_back
#define mp map<ll,ll>
#define endl '\n'
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
ll gcd(ll a, ll b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);  
      
}
int32_t main(){
    fast;
    ll a,b;
    cin>>a>>b;
    ll i;
    ll g=gcd(a,b);
    cout<<(a*b)/g;
    return 0;
}


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

int N, Q, K;
const int MAX_N = 1.0e5 + 100;
vector<pair<ll, ll> > tree[MAX_N];
ll distance_from_K[MAX_N];
bool visited[MAX_N];
/*
bool visited[MAX_N];
ll ans[MAX_N];

void rec(int v) {
    for (int i = 0; i < tree[v].size(); i++) {
        if (!visited[tree[v][i]]) {
            ans[tree[v][i]] += ans[v];
            visited[tree[v][i]] = true;
            rec(tree[v][i]);
        }
    }
    return;
}
*/

void dfs(int v) {
    for (int i = 0; i < tree[v].size(); i++) {
        if (!visited[tree[v][i].first]) {
            distance_from_K[tree[v][i].first] = distance_from_K[v] + tree[v][i].second;
            visited[tree[v][i].first] = true;
            dfs(tree[v][i].first);
        }
    }
    return;
}

int main() {
    cin >> N;
    for (int i = 0; i < N-1; i++) {
        ll a, b, c;
        cin >> a >> b >> c;
        tree[a].push_back(make_pair(b, c));
        tree[b].push_back(make_pair(a, c));
    }
    cin >> Q >> K;

    memset(distance_from_K, 0, sizeof(distance_from_K));
    memset(visited, false, sizeof(visited));
    distance_from_K[K] = 0;
    visited[K] = true;
    dfs(K);

    for (int i = 0; i < Q; i++) {
        int x, y;
        cin >> x >> y;
        cout << distance_from_K[x] + distance_from_K[y] << endl;
    }

    return 0;
}


Measured memory_bytes: 14464
//パソコン甲子園2010 問題番号04 人気のアイスクリーム店
#include<stdio.h>

int main(void){

	int i1, i2, n, s, k[10];

	scanf("%d",&n);
	while(n != 0){

		for(i1 = 0; i1 < 10; i1++)
			k[i1] = 0;

		for(i1 = 1; i1 <= n;i1++){
			scanf("%d",&s);
			k[s]++;
		}

		for(i1 = 0; i1 < 10; i1++){

			if(k[i1] >= 1)
				for(i2 = 1; i2 <= k[i1]; i2++)
					printf("*");
			else
				printf("-");

			printf("\n");
		}

		scanf("%d",&n);
	}
	return 0;
}

Measured memory_bytes: 0
N = int(input())

CSF = []

for i in range(N-1):

    C,S,F = map(int,input().split())

    CSF.append([C,S,F])


for i in range(N):


    time = 0

    for j in range(N-1-i):

        j += i

        c = CSF[j][0]
        s = CSF[j][1]
        f = CSF[j][2]

        if time < s:

            time = s + c

        elif time % f == 0:

            time += c

        else:

            time = (time // f + 1) * f + c

    print (time)


Measured memory_bytes: 41708
N = int(input())
L = list(map(int, input().split()))

max = 0
maxidx = 0
sum = 0
for i in range(N):
    sum += L[i]
    if L[i] > max:
        max = L[i]
        maxidx = [i]

sum -= max

if max < sum:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3064
#include "bits/stdc++.h"

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

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

const int MAX = 10000;

void Main() {
  int n, p;
  cin >> n >> p;
  vector<int> s(n);
  rep(i, n) {
    char c;
    cin >> c;
    s[i] = (c - '0')%p;
  }

  ll ans = 0;
  if (10%p == 0) {
    rep(i, n) if (s[i]%p == 0) ans += i + 1;
    cout << ans << endl;
    return;
  }

  reverse(s.begin(), s.end());
  map<int, int> dp;
  dp[0] = 1;
  int x = 0;
  int ten = 1;
  rep(i, n) {
    (x += s[i]*ten) %= p;
    ans += dp[x];
    dp[x]++;
    (ten *= 10) %= p;
  }
  cout << ans << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}

Measured memory_bytes: 1536
#include <stdlib.h>
#include <cmath>
#include <cstdio>
#include <cstdint>
#include <string>
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
using namespace std;
using ll = long long;

int main(){
  ll A,B,C;
  cin >> A >> B >> C;
  ll new_A=A,new_B=B,new_C=C;
  ll ans=0;
  while(1){
    if(new_A%2==1 || new_B%2==1 || new_C%2==1) break;
    ll temp_A=new_A/2, temp_B=new_B/2, temp_C=new_C/2;
    new_A=temp_B+temp_C;
    new_B=temp_C+temp_A;
    new_C=temp_A+temp_B;
    ++ans;
    if(new_A==A && new_B==B && new_C==C){
      ans=-1;
      break;
    }
  }

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


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
using namespace std;
const int maxn=110;
int n,m,x,y;
int a[maxn],b[maxn];
int main() {
    scanf("%d%d%d%d",&n,&m,&x,&y);
    for (int i=0;i<n;i++) scanf("%d",&a[i]);
    sort(a,a+n);
    for (int i=0;i<m;i++) scanf("%d",&b[i]);
    sort(b,b+m);
    if (a[n-1]<b[0] && a[n-1]<y && b[0]>x) puts("No War");
    else puts("War");
    return 0;
}

Measured memory_bytes: 128
#include<cstdio>
#include<algorithm>
#include<functional>
using namespace std;
int main(void)
{
	int r,c,i,j,a[101][101];
	scanf("%d %d",&r,&c);
	for(i=0;i<r;i++)	{
		for(j=0;j<c;j++)	{
			scanf("%d",&a[i][j]);
		}
	}
	for(i=0;i<r;i++)	{
		a[i][c]=0;
		for(j=0;j<c;j++)	{
			a[i][c]+=a[i][j];
		}
	}
	for(j=0;j<=c;j++)	{
		a[r][j]=0;
		for(i=0;i<r;i++)	{
			a[r][j]+=a[i][j];
		}
	}
	for(i=0;i<=r;i++)	{
		printf("%d",a[i][0]);
		for(j=1;j<=c;j++)	{
			printf(" %d",a[i][j]);
		}
		printf("\n");
	}
	return 0;
}


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

using ll=long long;
#define int ll

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

int read(){
	int i;
	scanf("%lld",&i);
	return i;
}

signed main(){
	int A,B,C;
	cin >> A >> B >> C;
	if(C >= A && C <= B) cout << "Yes";
	else cout << "No";
}

Measured memory_bytes: 764
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.util.ArrayList;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		SC sc = new SC(System.in);
		int N=sc.nextInt();
		int K=sc.nextInt();
		long[] NUM=new long[N];
		for(int i=0; i<N; i++) {
			NUM[i]=NUM[Math.max(i-1, 0)]+sc.nextLong();
		}
		ArrayList<Long> split=new ArrayList<Long>();
		for(int i=0; i<N; i++) {
			split.add(NUM[i]);
			for(int j=0; j<N; j++) {
				if(i>j) {
					split.add(NUM[i]-NUM[j]);
				}
			}
		}
		long max=0L;
		long[] ary=new long[64];
		ary[0]=1;
		for(int i=1; i<64; i++) {
			ary[i]=ary[i-1]*2;
		}
		int counter=0;
		long tmp=0;
		for(int h=63; h>=0; h--) {
			tmp=max+ary[h];
			counter=0;
			for(int i=0; i<split.size(); i++) {
				if((split.get(i)&tmp)==tmp) {
					counter++;
				}
			}
			if(counter>=K) {
				max+=ary[h];
			}
		}
		pl(max);
	}
	public static void pl(Object o) {
		System.out.println(o);
	}
	public static void pl() {
		System.out.println();
	}
	public static void p(Object o) {
		System.out.print(o);
	}
	static class SC {
		private BufferedReader reader = null;
		private StringTokenizer tokenizer = null;
		public SC(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
		}
		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new UncheckedIOException(e);
			}
		}
	}
}

Measured memory_bytes: 50644
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long a = sc.nextLong();
    long b = sc.nextLong();
    int negative_count = 0;
		for(long i = a; i <= b; i++) {
			if(i==0) {
				System.out.println("Zero");
				return;
			}
			if(i < 0) {
				negative_count++;
			}
		}
		if(negative_count%2 == 0) {
			System.out.println("Positive");
		}
		else {
			System.out.println("Negative");
		}
	}
}
      

Measured memory_bytes: 35716
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  int n,m,k;
  cin >> n>> m>> k;
  int isK = false;
  rep(i,n+1){
    rep(j,m+1){
      int l = (m-j)*i+(n-i)*j;
      if(l == k) isK = true;
    }
  }
  if(isK) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007

using namespace std;

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

  int ok = 0;
  for (int i = 1; i < 10; i++){
    for (int j = 1; j < 10; j++){
      if (n == i * j)
        ok = 1;
    }
  }

  if (ok)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;


  return 0;
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> mat;
#define FOR(i,a,b) for(int i=(a);i<(int)(b);++i)
#define rep(i,n) FOR(i,0,n)
#define mset(a,x) memset(a,x,sizeof(a))

const int MOD = int(1e9 + 7);
ll n;

int main() {
    cin >> n;
    vector<ll> t(n), a(n);
    rep(i, n) scanf("%lld", &t[i]);
    rep(i, n) scanf("%lld", &a[i]);

    if(t[n - 1] != a[0]) {
        puts("0"); return 0;
    }

    if(n == 1) {
        puts(t[0] == a[0] ? "1" : "NO");
        return 0;
    }

    vector<ll> mi(n, 1145141919810);
    mi[0] = mi[n - 1] = 1;
    FOR(i, 1, n-1) {
        if(t[i] != t[i - 1]) {
            mi[i] = 1;
        }
    }

    for(int i = n - 2; i >= 1; --i) {
        if(mi[i] == 1 && t[i] > a[i]) {
            puts("0"); return 0;
        }
        if(a[i] != a[i + 1]) mi[i] = 1;
        if(mi[i] == 1) continue;
        mi[i] = min(t[i], a[i]);
    }

    ll ans = 1;
    rep(i, n) {
        ans *= mi[i];
        ans %= MOD;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 2560
/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2020-03-01 20:30:37
**/

#include <iostream>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
#include <bitset>
#include <cassert>
#include <cctype>
#include <iomanip>
#include <random>
#include <utility>
#include <chrono>

using namespace std;

using int64 = long long;

template<class T> using binary_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;
template<class T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) { os << '{'; size_t n = vec.size(); for (size_t i = 0; i < n; ++i) { os << vec[i]; if (i != n - 1) os << ','; } os << '}'; return os; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) { return os << '{' << p.first << " " << p.second << '}'; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) { os << '{'; for (auto it = mp.begin(); it != mp.end(); ++it) { os << '{' << it->first << ':' << it->second << '}'; if (it != --mp.end()) os << ','; } os << '}'; return os; }
template<class T> std::ostream& operator<<(std::ostream& os, const std::set<T>& st) { os << '{'; for (auto it = st.begin(); it != st.end(); ++it) { os << *it; if (it != --st.end()) os << ','; } os << '}'; return os; }
template<class T> std::istream& operator>>(std::istream& is, std::vector<T>& vec) { size_t n = vec.size(); for (size_t i = 0; i < n; ++i) is >> vec[i]; return is; }

#define all(_) begin(_), end(_)
#define rall(_) rbegin(_), rend(_)

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...) 1728
#endif

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}

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

  vector<vector<int>> a(3, vector<int>(3)); cin >> a;
  vector<vector<int>> ans(3, vector<int>(3, -1));

  int n; cin >> n;
  for (int i = 0; i < n; ++i) {
    int b; cin >> b;
    for (int j = 0; j < 3; ++j) {
      for (int k = 0; k < 3; ++k) {
        if (a[j][k] == b) {
          ans[j][k] = b;
        }
      }
    }
  }

  bool flag = false;

  auto ok = [](int x) -> bool {
    return x != -1;
  };

  if (ok(ans[0][0]) && ok(ans[0][1]) && ok(ans[0][2])) flag = 1;
  if (ok(ans[1][0]) && ok(ans[1][1]) && ok(ans[1][2])) flag = 1;
  if (ok(ans[2][0]) && ok(ans[2][1]) && ok(ans[2][2])) flag = 1;

  if (ok(ans[0][0]) && ok(ans[1][0]) && ok(ans[2][0])) flag = 1;
  if (ok(ans[0][1]) && ok(ans[1][1]) && ok(ans[2][1])) flag = 1;
  if (ok(ans[0][2]) && ok(ans[1][2]) && ok(ans[2][2])) flag = 1;
  
  if (ok(ans[0][0]) && ok(ans[1][1]) && ok(ans[2][2])) flag = 1;
  if (ok(ans[0][2]) && ok(ans[1][1]) && ok(ans[2][0])) flag = 1;

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

  return 0;
}

Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;
use std::iter::FromIterator;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn readc() -> char {
    let s: String = read();
    return s.chars().nth(0).unwrap();
}

fn read_vec<T: FromStr>(n: usize) -> Vec<T> {
    return (0..n).map(|_| read()).collect();
}

fn main() {
    let n: usize = read();
    let ai: Vec<f32> = read_vec(n);

    let ai_sum: f32 = ai.iter().sum();
    let ave = ai_sum / ai.len() as f32;
    let mut diff: f32 = 1000.0;
    let mut ans = 0;
    for i in 0..ai.len() {
        let a = ai[i];
        let tmp_diff;
        if a > ave {
            tmp_diff = a - ave;
        } else {
            tmp_diff = ave - a;
        }
        if tmp_diff < diff {
            ans = i;
            diff = tmp_diff;
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
int q;
int l[100005];
bool w[100005];
int main() {
	cin>>q;
	for(int i=1;i<=q;i++) scanf("%d",&l[i]);
	if(q==1) {cout<<"Yes";return 0;}
	for(int i=1;i<q;i++) 
		if(l[i]-l[i+1]>1||l[i]-l[i+1]==1&&w[i]) {cout<<"No";return 0;}
		else if(l[i]-l[i+1]==1||l[i]==l[i+1]&&w[i]) w[i+1]=1;
	cout<<"Yes";
	return 0;
}

Measured memory_bytes: 768
#include<iostream>
#include<algorithm>
using namespace std;
//1-indexed
#include<vector>
template<typename T>
struct BIT{
	int n;
	vector<T>bit;
	BIT(int n_=0,T a=0):n(n_),bit(n_+1,a){}
	T sum(int i)
	{
		T ans=0;
		for(;i>0;i-=i&-i)ans=max(ans,bit[i]);
		return ans;
	}
	void add(int i,T a)
	{
		if(i==0)return;
		for(;i<=n;i+=i&-i)bit[i]=max(bit[i],a);
	}
};
int n,h[2<<17],a[2<<17];
main()
{
	cin>>n;
	for(int i=0;i<n;i++)cin>>h[i];
	BIT<long>P(n);
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		P.add(h[i],P.sum(h[i])+a[i]);
	}
	cout<<P.sum(n)<<endl;
}

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

using namespace std;

#define ll long long int
#define loop(a,b,c) for(ll a=b; a<c; a++)
#define eloop(a,b,c) for(ll a=b; a<=c; a++)
#define nl printf("\n")

int main(){
    ll x;
    cin >> x;
    ll p = 100;
    ll y= 0;
    while(p < x){
        p = p + (p * 0.01) ;
        y++;

        }
        cout << y << endl;

    return 0;
}    

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) ((int)(x).size())
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

int calc(int N) { return N*N*N; }

signed main()
{
    int N,K; cin>>N>>K;
    int ans=calc(N/K);
    if(K%2==0) ans+=calc((N+K/2)/K);
    cout<<ans<<endl;
}


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

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

  string s;
  for(int i = 0;i < N; ++i){
    cin >> s;
    if(s == "Y"){
      cout << "Four" << endl;
      return 0;
    }
  }
  cout << "Three" << endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;



int main(){

  int n,u,k,x;
  int array[124][124] = {{}};
  cin >> n;



  for(int i = 0;i < n;i++){
    cin >> u >> k;
    for(int j = 0;j < k;j++){
      cin >> x;
      array[u - 1][x - 1] = 1;
    }
  }
  for (int i = 0;i < n;i++){
    for(int j = 0;j < n;j++){
      if(j == n - 1) cout << array[i][j];
      else cout << array[i][j] << " ";
    }
    cout << endl;
  }
}

Measured memory_bytes: 3108
import math

n = int(input())
x = list(map(int, input().split()))
p = sum(x) / len(x)

a1 = sum([(a - math.floor(p)) * (a - math.floor(p)) for a in x])
a2 = sum([(a - math.ceil(p)) * (a - math.ceil(p)) for a in x])
print(min(a1, a2))

Measured memory_bytes: 3064
#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<int, int>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
 
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<int> a(n), b(n);
	rep(i, n){
		cin >> a[i];
		b[i] = a[i];
	}
	sort(b.begin(), b.end());
	int ans = 0;
	rep(i, n){
		int idx = lower_bound(b.begin(), b.end(), a[i])-b.begin();
		if(i%2 != idx%2) ans++;
	}
	cout << ans/2 << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define IN(x,S) (S.count(x) != 0)
using namespace std;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef long long ll;
//////////////////////////////////////////////////////
int count(int n){
	if (n % 2 == 0){
		return (1 + count(n/2));
	}else{
		return 0;
	}
}


int main(){
	int N; SCD(N);
	vector<int> a;
	
	REP(i,N){
		int x; SCD(x);
		a.PB(x);
	}
	
	int ans = 0;
	REP(i,N){
		ans += count(a[i]);
	}
	
	PRINTD(ans);
	
	return 0;
}



Measured memory_bytes: 384
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0;i<int(n);++i)
using namespace std;
template<class A>void pr(A a){cout << setprecision(11) << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
// for copy
// for(int i=0;i<N;++i) {
const double PI=3.1415926535897932384643383279502884;

int main(void) {
  double a,b,x;cin>>a>>b>>x;
  double y,z;
  y = 2*b-2*x/(a*a);
  if (y<b) {
    long double ans = atan2(y,a)*180/PI;
    pr(ans);
  } else {
    z = 2*x/(a*b);
    long double ans = atan2(b,z)*180/PI;
    pr(ans);
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm> 
#include <cstring>
using namespace std;
#define int long long
int n, a[100];
signed main(){
	scanf("%lld", &n);
	a[0] = 2, a[1] = 1;
	for(int i = 2; i <= n; ++i) a[i] = a[i - 1] + a[i - 2];
	printf("%lld", a[n]);
	return 0;
}

Measured memory_bytes: 256
import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List
import Data.Char (isDigit, digitToInt)

main :: IO ()
main = do
  xs <- getc id
  print $ solve xs

solve :: [String] -> Int
solve = sum . map secretNumber

secretNumber :: String -> Int
secretNumber = uncurry (+) . foldl f (0,0)
  where
    f :: (Int, Int) -> Char -> (Int, Int)
    f (s, t) c 
      | isDigit c = (s, 10 * t + digitToInt c)
      | otherwise = (s + t, 0)

getc :: (String -> a) -> IO [a]
getc f = map f . lines <$> getContents

Measured memory_bytes: 3740
#include<cstdio>
#include<cstring>
using namespace std;
char s[500];
int main()
{
	int i,len;
	scanf("%s",s+1);
	len=strlen(s+1);
	for(i=1;i<=len-8;i++)
		printf("%c",s[i]);
	printf("\n");
	return 0;
}

Measured memory_bytes: 128
import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
bool DEBUG = 0; void log(A ...)(lazy A a){ if(DEBUG) print(a); }
void main(string[] args){ args ~= ["", ""]; string cmd = args[1]; if(cmd == "-debug") DEBUG = 1;
if(cmd == "-gen") gen; else if(cmd == "-jury") jury; else solve; } 
void print(){ writeln(""); } void print(T)(T t){ writeln(t); } void print(T, A ...)(T t, A a){ std.stdio.write(t, " "), print(a); }
string unsplit(T)(T xs){ return xs.array.to!(string[]).join(" "); }
string scan(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T scan(T)(){ return scan.to!T; } T[] scan(T)(int n){ return n.iota.map!(i => scan!T()).array; }
T lowerTo(T)(ref T x, T y){ if(x > y) x = y; return x; } T raiseTo(T)(ref T x, T y){ if(x < y) x = y; return x; }

// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- //
void gen(){
}
void jury(){
}
void solve(){
    int h = scan!int, w = scan!int, k = scan!int;
    int[][] uf;
    foreach(i; 0 .. h) uf ~= scan!(char[]).map!(c => c == '#'? 1 : 0).array;
    int ans = 0;
    foreach(x; 0 .. 1<<h) foreach (y; 0 .. 1<<w){
        int tmp;
        foreach(i; 0 .. h) foreach(j; 0 .. w){
            if((1<<i) & x) continue;
            if((1<<j) & y) continue;
            tmp += uf[i][j];
        }
        if(tmp == k) log(x, y), ans += 1;
    }
    ans.writeln;
}
 

Measured memory_bytes: 3208
#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>

using ll = long long int;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int main(void){
	int k,i,t=0;
	std::cin >> k;
	for(i=1; i<=k; ++i){
		t *= 10;
		t += 7;
		t %= k;
		if(!t){
			std::cout << i << std::endl;
			return 0;
		}
	}
	std::cout << "-1" << std::endl;
	return 0;
}


Measured memory_bytes: 3632
# https://atcoder.jp/contests/diverta2019/tasks/diverta2019_c

n = gets.to_i
res = 0

def is_left(word)
  word[0] != 'B' && word[-1] == 'A'
end

def is_mid(word)
  word[0] == 'B' && word[-1] == 'A'
end

def is_right(word)
  word[0] == 'B' && word[-1] != 'A'
end


lefts = []
rights = []
mids = []
words = []

n.times do
  word = gets.chomp
  res += word.scan('AB').size
  if is_left(word)
    lefts << word
  elsif is_mid(word)
    mids << word
  elsif is_right(word)
    rights << word
  end
  words << word
end

minsize = [lefts.size, rights.size].min

if mids.size == 0
  res += minsize
# elsif minsize > mids.size
#   res += mids.size + 1
#   res += minsize - mids.size
# elsif mids.size >= minsize
#   res += mids.size + 1
elsif lefts.size + rights.size == 0
  res += mids.size - 1
else
  res += [lefts.size, rights.size].min + mids.size
end

puts res

Measured memory_bytes: 3068
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
 
int N;
 
int main(int argc, char* argv[]) {
    ios::sync_with_stdio(false);
    cin.tie(0);
 
    cin >> N;
 
    ll t = 1;
    ll a = 1;
 
    ll T;
    ll A;
 
    for (int i = 0; i < N; ++i) {
        cin >> T >> A;
        
        ll c = max((t-1)/T+1, (a-1)/A+1);

        t = T * c;
        a = A * c;
 
        //cout << "t: " << t << ", a: " << a << endl;
    }
 
    cout << (t + a) << 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;
typedef long long ll;
using P = pair<int,int>;

int main() {
    int n;
    double sum = 0.0;
    cin>>n;
    vector<int> a(n);
    rep(i,n) cin>>a.at(i);

    rep(i,n) {
        sum += (double)1/(double)a.at(i);
    }

    sum = (double)1/sum;
    printf("%.10f\n", sum);
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX = 200000;

int main() {
    int R[MAX], n;

    cin >> n;
    for(int i = 0; i < n; i++) cin >> R[i];

    int maxv = -2000000000;
    int minv = R[0];

    for(int i = 1; i < n; i++) {
        maxv = max(maxv, R[i] - minv);
        minv = min(minv, R[i]);
    }

    cout << maxv << endl;

    return 0;
}


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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n){
    cin >> a.at(i);
  }
  queue<int> que;
  int breaking = 0;
  rep(i,n){
    if((que.empty() == true && a.at(i) == 1)||(que.empty() == false && a.at(i) == que.back()+1)){
       que.push(a.at(i));
    }else{
      breaking++;
    }
  }
  
  if(que.empty() == false){
    cout << breaking << endl;
  }else{
    cout << -1 << endl;
  }
}
       


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

using namespace std;
#define ll long long 
#define pb(a) push_back(a)
#define fi first
#define se second
#define rep(a,b,c) for(int a = b ;a<=c;a++)
#define repn(a,b,c) for(int a = b ; a>=c ; a--)
#define FOR(a,b,c) for(int a = b ; a<c ;a++)
#define mem(a,b) memset(a,b , sizeof(a))
#define ll long long
#define mp make_pair
#define fi first
#define se second
#define Size(a) ((int)a.size())
#define ii int
const int INF=0x3f3f3f3f;
const int maxn=5e9+10;
const int maxk=30;


ll f[(int)1e5 + 10];
ll a[(int)1e5 + 10];

ll min(ll a, ll b){
	return (a > b) ? b : a;
}

 int main(){

 	ll n,k;
 	cin>>n>>k;

 	vector<int>h(n);

 	FOR(i,0,n){
 		cin>>h[i];
 	}

 	vector<int>dp(n , INF);

 	dp[0] = 0;

 	FOR(i, 0 , n){
 		for(int j = i + 1 ; j <= i + k ; j ++){
 			if(j < n){
 				dp[j] = min(dp[j] , dp[i] + abs(h[i] - h[j]));
 			}
 		}
 	}

 	cout<<dp[n-1]<<endl;

    return 0;
 }

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define M_PI  3.1415926535
#define ll long long
#define ld long double
#define all(a) a.begin(),a.end()
#define Summon_Tourist ios::sync_with_stdio(false);cin.tie(0);
ll gcd(ll a , ll b) { return b==0?a: gcd( b, a%b); }
ll lcm(ll a , ll b) { return a/gcd(a,b) * b ; }
ll inf = 998244353;
ll modexp( ll base ,ll power)
 {
     if( power == 0  ) return 1;
     if( power & 1) return base*modexp( base , power-1 )%inf;
     return modexp(base*base%inf,power/2);
 }
///////////////////////////////////////--CKMKB--//////////////////////////////////////////////////
///////////////////////////////////////--PKMKB--//////////////////////////////////////////////////
 int main()
{
  Summon_Tourist
  //freopen("input.txt" , "r" , stdin );
  ll t = 1;
  //cin>>t;
   while(t--)
  {
    ll n,m,k;
    cin>>n>>m>>k;
    vector<ll> bincof(k+1,0);
    bincof[0] = 1 ;
    for( ll i = 1 ; i<=k ; i++ ){
        bincof[i] = ((bincof[i-1]%inf*(n-1-i+1)%inf)%inf*modexp(i,inf-2))%inf;
    }
    //for( ll i = 0 ; i<=k ; i++ ) cout<<bincof[i]<<" ";
    ll sum = 0 ;
    for( ll i =  0 ; i<=k ; i++ )
    {
         sum +=  ( m%inf * bincof[i]%inf * modexp( m-1 , n-i-1) )%inf;

    }
    cout<<sum%inf;

  }
  return 0;

}


Measured memory_bytes: 4736
#include<stdio.h>

int main() {
	unsigned long int n = 0;
	unsigned long int a = 0;
	unsigned long int b = 0;
	unsigned long int c = 0;
	unsigned long int d = 0;
	unsigned long int e = 0;
	unsigned long int f = 0;
	scanf("%lu%lu%lu",&n ,&a ,&b);//_sの排除
	c = a + b;
	d = n / c;
	e = n % c;
	f = a * d;
	if (e < a) {
		f += e;
	}
	if (e > a) {
		f += a;
	}
	printf("%lu", f);
	return 0;
}

Measured memory_bytes: 128
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <climits>
using namespace std;
#define MOD int(1e9 + 7)
#define INF (long long)(1e18)

int main()
{
    cout.precision(18);
    
    long long A, B;
    vector<long long> a(3, 0);

    cin >> A >> B;
    a[A-1] = 1;
    a[B-1] = 1;

    for(long long i = 0; i < 3; i++){
      if(a[i] == 0){
        cout << i + 1 << endl;
        return 0;
      }
    }

    return 0;

}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
//using Debug;
//using static System.Globalization.CultureInfo;
//using Edge = Pair<long, int>;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
        Solve();
        //WriteLine(Solve());
    }
    static void Solve()
    {
        var num = Input.num;
        var ws = Input.ar;var m = int.MaxValue;
        for(var i=1;i<num;i++)
        {
            var s = ws.Take(i).Sum();
            var w = ws.Skip(i).Sum();
            m = Min(m, Abs(s - w));
        }
        WriteLine(m);
    }
}

public class Input
{
    public static string read => ReadLine().Trim();
    public static int[] ar => read.Split(' ').Select(int.Parse).ToArray();
    public static int num => ToInt32(read);
    public static long[] arL => read.Split(' ').Select(long.Parse).ToArray();
    public static long numL => ToInt64(read);
    public static char[][] gred(int h)
        => Enumerable.Repeat(0, h).Select(_ => read.ToCharArray()).ToArray();
    public static int[] ar1D(int n)
        => Enumerable.Repeat(0, n).Select(_ => num).ToArray();
    public static long[] arL1D(int n)
        => Enumerable.Repeat(0, n).Select(_ => numL).ToArray();
    public static string[] strs(int n)
        => Enumerable.Repeat(0, n).Select(_ => read).ToArray();
    public static int[][] ar2D(int n)
        => Enumerable.Repeat(0, n).Select(_ => ar).ToArray();
    public static long[][] arL2D(int n)
        => Enumerable.Repeat(0, n).Select(_ => arL).ToArray();
    public static T getValue<T>(string g)
    {
        var t = typeof(T);
        if (t == typeof(int))
            return (T)(object)int.Parse(g);
        if (t == typeof(long))
            return (T)(object)long.Parse(g);
        if (t == typeof(string))
            return (T)(object)g;
        if (t == typeof(char))
            return (T)(object)char.Parse(g);
        if (t == typeof(double))
            return (T)(object)double.Parse(g);
        if (t == typeof(bool))
            return (T)(object)bool.Parse(g);
        return default(T);
    }
    public static string[] Make<T1, T2>(out T1 v1, out T2 v2)
    {
        var r = read.Split(' ');
        v1 = getValue<T1>(r[0]);
        v2 = getValue<T2>(r[1]);
        return r;
    }
    public static string[] Make<T1, T2, T3>(out T1 v1, out T2 v2, out T3 v3)
    {
        var r = Make(out v1, out v2);
        v3 = getValue<T3>(r[2]);
        return r;
    }
    public const long Inf = (long)1e18;
    public const double eps = 1e-6;
    public const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public const int MOD = 1000000007;
}

Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int t;
	scanf("%d",&t);
	if(t%1000==0)
		printf("0");
	else 
	{
		int a;
		a=t%1000;
		printf("%d",1000-a);
	}
 } 

Measured memory_bytes: 3824
#include<stdio.h>

int main()
{
	int r, g, b;
	scanf("%d %d %d", &r, &g, &b);
	int sum = 100 * r + 10 * g + b;
	if (sum % 4 == 0)
	{
		printf("YES\n");
	}
	else
	{
		printf("NO\n");
	}
	return 0;
}

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

int main()
{
  int n, m;
  ll x;
  cin >> n >> m >> x;
  vector<ll> c(n);
  vector<vector<ll>> a(n, vector<ll>(m));
  for (int i = 0; i < n; i++)
  {
    cin >> c[i];
    for (int j = 0; j < m; j++)
    {
      cin >> a[i][j];
    }
  }

  ll ans = 1e9;
  bool ng = false;
  for (int bit = 0; bit < (1 << n); bit++)
  {
    vector<int> test;
    for (int i = 0; i < n; i++)
    {
      if (bit & (1 << i))
      {
        test.push_back(i);
      }
    }
    ll ctest = 0;
    vector<ll> atest(m);
    for (int i = 0; i < test.size(); i++)
    {
      ctest += c[test[i]];
      for (int j = 0; j < m; j++)
      {
        atest[j] += a[test[i]][j];
      }
    }
    bool ok = true;
    for (int i = 0; i < m; i++)
    {
      if (atest[i] < x)
      {
        ok = false;
      }
    }
    if (ok)
    {
      ans = min(ans, ctest);
      ng = true;
    }
  }
  if (ng)
  {
    cout << ans << endl;
  }
  else
  {
    cout << -1 << endl;
  }
}


Measured memory_bytes: 3636
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <set>

#define lowbit(x) (x&(-x))
#define MAX(a,b) (a<b?b:a)
#define MIN(a,b) (a<b?a:b)
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
const int N = 1e7;
const int maxn = 3e5 + 5;
ll mod = 1e9 + 7;

int n;
ll a[maxn], f[maxn];

int main()
{
	scanf("%d", &n);
	for (int i = 1; i <= 3*n; i++) scanf("%lld", a + i);

	multiset<ll> s;
	ll sum = 0;
	for (int i = 1; i <= n; i++)
	{
		sum += a[i];
		s.insert(a[i]);
	}
	f[n] = sum;
	for (int i = n + 1; i <= 2 * n; i++)
	{
		auto it = s.begin();
		if (*it < a[i])
		{
			sum += a[i] - *it;
			s.erase(it);
			s.insert(a[i]);
		}
		f[i] = sum;
	}

	sum = 0;
	s.clear();
	for (int i = 3 * n; i > 2 * n; i--)
	{
		sum += a[i];
		s.insert(a[i]);
	}

	ll ans = f[2 * n] - sum;
	for (int i = 2 * n; i > n; i--)
	{
		auto it = s.end();
		--it;
		if (*it > a[i])
		{
			sum -= *it - a[i];
			s.erase(it);
			s.insert(a[i]);
		}
		ans = MAX(ans, f[i-1] - sum);
	}
	printf("%lld", ans);
}

Measured memory_bytes: 8320
#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;
}

const string YES = "Yes";
const string NO = "No";

void solve(long long N, long long M, std::vector<long long> A) {
    // sort(A.begin(), A.end());
    ll all = 0;
    for (auto item :A) {
        all += item;
    }

    ll valid = 0;
    for (auto item:A) {
        if (item * 4 * M >= all) {
            valid++;
        }
    }
    if (valid < M) {
        cout << NO << endl;
    } else {
        cout << YES << endl;
    }
}

int main() {
    long long N;
    std::cin >> N;
    long long M;
    std::cin >> M;
    std::vector<long long> A(N);
    for (int i = 0; i < N; i++) {
        std::cin >> A[i];
    }
    solve(N, M, std::move(A));
    return 0;
}


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

using namespace std;

int main()
{
    int N;

    int b[] = { 46656, 7776, 1296, 216, 36, 6};
    int c[] = { 59049, 6561, 729, 81, 9, 1};

    scanf("%d", &N);

    int ans = INT_MAX, ntmp, btmp, ctmp, ktmp;

    for(int k = 0; k <= N; k += 6)
    {
        ntmp = N - k;
        ktmp = k;
        btmp = 0;
        ctmp = 0;

        for(int i = 0; i < 6; i++)
        {
            btmp += ktmp / b[i];
            ktmp %= b[i];
        }
        for(int i = 0; i < 6; i++)
        {
            ctmp += ntmp / c[i];
            ntmp %= c[i];
        }

        if(btmp + ctmp < ans) {
            ans = btmp + ctmp;
        }
    }

    printf("%d\n", ans);

    return 0;
}


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

int main(void)
{
    int count=0;
    char s[101]={};
    scanf("%s",s);
    for(int i=0;i<strlen(s)/2;i++){
        if(s[i]-s[strlen(s)-1-i]!=0) count+=1;
    }
    printf("%d",count);
    return 0;
}


Measured memory_bytes: 1708
#include <iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
  
int main(){
int N,T;
cin>>N>>T;
vector<int> vec(N);
vector<int> a(N);
for(int i=0;i<N;i++){
    cin>>vec.at(i)>>a.at(i);
}
for(int l=0;l<N;l++){
    if(T<a.at(l)){
        vec.at(l)=100000;
    }
}
sort(vec.begin(),vec.end());
if(vec.at(0)==100000){
    cout<<"TLE"<<endl;
}
else{
    cout<<vec.at(0)<<endl;
}
}

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

#define ll long long

int main() {
    int N;
    scanf("%d", &N);
    int H[N];
    for(int i = 0;i < N;i++) {
        scanf("%d", &H[i]);
    }
    int max_h = -334;
    int count = 0;
    for(int i = 0;i < N;i++) {
        if(max_h <= H[i]) {
            max_h = H[i];
            count++;
        }
    }
    printf("%d\n", count);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<tuple<long long int,long long int,long long int> > ab;
  int a,b;
  for(int i=0; i<n; i++){
    cin >> a >> b;
    ab.emplace_back(a+b,a,b);
  }
  sort(ab.begin(),ab.end());
  reverse(ab.begin(),ab.end());
  bool t = true;
  long long int a1=0,b1=0;
  for(int i=0; i<n; i++){
    if(t){
      a1 += get<1>(ab[i]);
    }else{
      b1 += get<2>(ab[i]);
    }
    t = !t;
  }
  cout << a1-b1 << endl;
}

Measured memory_bytes: 4852
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a,b,c;
  cin>>a>>b>>c;
  if(a==b&&b!=c)
  {
    cout<<"Yes";
  }
  else if(a==c&&b!=c)
  {
    cout<<"Yes";
  }
  else if(b==c&&a!=b)
    cout<<"Yes";
  else
    cout<<"No";
  return 0;
}

Measured memory_bytes: 256
n = int(input())
sn = {}
for _ in range(n):
    s = ''.join(sorted(input()))
    sn[s] = sn.get(s, 0) + 1

ans = 0
for k, v in sn.items():
    if v == 1:
        continue
    ans += (v-1) * v / 2

print(int(ans))


Measured memory_bytes: 17852
n,k=map(int,input().split())
a=list(map(int,input().split()))
m=10**9+7
print(sum((((sum(a[i]>j for j in a[i:])*(k*(k+1)//2)%m)+(sum(a[i]>j for j in a[:i+1])*(k*(k-1)//2)%m))%m) for i in range(n))%m)

Measured memory_bytes: 9228
n = int(input())
xn = list(map(int, input().split()))
yn = list(map(int, input().split()))

fact = [1, 1, 2, 6, 24, 120, 720, 5040, 40320]
def rank(an):
  used = []
  n = len(an)
  rank = 1
  for i, a in enumerate(an):
    b = a - len([c for c in used if c < a]) - 1
    rank += fact[n-i-1] * b
    used.append(a)
  return rank

print(abs(rank(xn) - rank(yn)))

Measured memory_bytes: 3064
S = input()

N = len(S)

def check(SS):
    L = len(SS)
    f = 0
    for i in range(L):
        if SS[i] != SS[L - i - 1]:
            f = 1
    if f == 1:
        return False
    else:
        return True


if check(S) and check(S[:(N-1)//2]) and check(S[(N+3)//2-1:]):
    print("Yes")
else:
    print("No")


Measured memory_bytes: 38516
s=input()
n=len(s)
if s[-1]=="1":
    print(-1)
    exit()

if s[0]=="0":
    print(-1)
    exit()

data=[]
for i in range(0,n-1):
    if s[i]=="1":
        data.append(i+1)
        if s[n-2-i]=="0":
            print(-1)
            exit()
m=len(data)
edge=[]
for i in range(1,m):
    edge.append((i,i+1))
index=m+1
for i in range(1,m):
    if i!=1:
        size=data[-i]
        nextsize=data[-i-1]
        E=size-1-nextsize
        count=0
        while E>count:
            edge.append((i,index))
            index+=1
            count+=1
    else:
        size=n
        nextsize=data[-2]
        E=size-1-nextsize
        count=0
        while E>count:
            edge.append((i,index))
            index+=1
            count+=1

for i in range(n-1):
    u,v=edge[i]
    print(u,v)


Measured memory_bytes: 51976
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
//#include <utility>
//#include <memory>
//#include <functional>
//#include <deque>
//#include <cctype>
//#include <ctime>
//#include <numeric>
//#include <list>
//#include <iomanip>

//#if __cplusplus >= 201103L
//#include <array>
//#include <tuple>
//#include <initializer_list>
//#include <forward_list>
//
//#define cauto const auto&
//#else

//#endif

using namespace std;


typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

void mainmain(){
	int n;
	while(cin>>n,n){
		vvint vv;
		vint used(100);
		initvv(vv,100,100,INF);
		rep(i,100) vv[i][i]=0;
		rep(i,n){
			int a,b,c;
			cin>>a>>b>>c;
			used[a]=1;
			used[b]=1;
			mins(vv[a][b],c);
			mins(vv[b][a],c);
		}
		rep(k,100){
			rep(i,100){
				rep(j,100){
					mins(vv[i][j],vv[i][k]+vv[k][j]);
				}
			}
		}
		pii ans(INF,INF);
		rep(i,100){
			if(!used[i]) continue;
			int tmp=0;
			rep(j,100){
				if(used[j]){
					tmp+=vv[i][j];
				}
			}
			mins(ans,pii(tmp,i));
		}
		cout<<ans.S<<" "<<ans.F<<endl;
	}
}


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

Measured memory_bytes: 3244
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>
#define max(x,y)(x>y?x:y)
#define min(x,y)(x>y?y:x)
#define MOD (int)1e9+7
int dx4[]={1,0,-1,0};
int dy4[]={0,-1,0,1};
typedef long long int ll;
typedef unsigned long long int ull;
ll gcd(ll x,ll y){if(!y)return x;return gcd(y,x%y);}
ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
void swap(ll *x,ll *y){ll tmp=*x;*x=*y;*y=tmp;}
int asc_cmp(const void* X,const void* Y){ll x=*(int*)X,y=*(int*)Y;if(x<y)return -1;else if(x==y)return 0;else return 1;}
int desc_cmp(const void* X,const void* Y){ll x=*(int*)X,y=*(int*)Y;if(x<y)return 1;else if(x==y)return 0;else return -1;}

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

    char num[20];strcpy(num,"");
    for(int i=0;i<n;i++){
        num[i]='.';
    }
    num[n]='\0';

    for(int i=0;i<m;i++){
        if(num[s[i]-1]=='.'||num[s[i]-1]==c[i]+'0'){
            num[s[i]-1]=c[i]+'0';
        }else{
            printf("-1\n");
            return 0;
        }
    }

    if(num[0]=='0'&&n>1){
        printf("-1\n");
        return 0;
    }
    if(num[0]=='.'&&n>1){
        num[0]='1';
    }else if(num[0]=='.'&&n==1){
        num[0]='0';
    }
    for(int i=1;i<n;i++){
        if(num[i]=='.')num[i]='0';
    }

    
    printf("%s\n",num);
    


}

Measured memory_bytes: 128
using System;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC137A
{
    class Program
    {
        static void Main(string[] args)
        {
            int A, B;
            var word = Console.ReadLine().Split(' ');
            A = int.Parse(word[0]);
            B = int.Parse(word[1]);
            int c = A + B;
            int d = A - B;
            int e = A * B;

            if (c >= e && c >= d)
                Console.WriteLine(c);
               
            else if (d >= c && d >= e)
                Console.WriteLine(d);
            
           else if (e >= c && e >= d)
                Console.WriteLine(e);
            
            Console.ReadKey();
        }
    }
}

Measured memory_bytes: 13140
N, A,B = map(int,input().split(' '))
def conv(x):
    s = str(x)
    i=0
    c0=0
    while i < len(s):
        p = int(s[i])
        c0 += p
        i += 1
    return c0

L = []
for r in range(1,N+1):
    L.append([r,conv(r)])

L2 = [x for x in L if A<=x[1]<=B]
ans=0
for i in range(0,len(L2)):
    ans += L2[i][0]
print(ans)

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

int main()
{
priority_queue<int> que;
for(int i=0;i<10;i++)
{
int t;
cin>>t;
que.push(t);
}
for(int i=0;i<3;i++)
{
cout<<que.top()<<endl;
que.pop();
}
return 0;
}

Measured memory_bytes: 1216
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import itertools
import random
from collections import deque
from decimal import *
import queue

input = sys.stdin.readline

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
def inputStr(): return input()[:-1]

inf = float('inf')
mod = 1000000007

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

def main():
	N,D = inputMap()
	ans = 0
	for i in range(N):
		X,Y = inputMap()
		tmp = math.sqrt(X**2 + Y**2)
		if tmp <= D:
			ans += 1

	print(ans)


#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
if __name__ == "__main__":
	main()


Measured memory_bytes: 78564