akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <stdlib.h>
using namespace std;

int main()
{
	int N, A, B;
	cin >> N >> A >> B;

	int d = N * A;
	int t = B;

	int ans = d;
	if (d > t)
	{
		ans = t;
	}

	cout << ans << endl;
}

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

int a[10009];
vector<int> p;
map<int,int> m;

void sieve()
{
    int i,j,t1,t2;
    for(i=0;i<10003;i++)
        a[i]=1;
    a[0]=a[1]=0;
    for(i=2;i<=10000;i++)
    {
        if(a[i]==1)
        {
            p.push_back(i);
            for(j=2*i;j<=10000;j+=i)
            {
                a[j]=0;
            }
        }
    }
    for(i=0;i<p.size();i++)
    {
        t1=0;
        for(j=i;j<p.size();j++)
        {
            t1+=p[j];
            m[t1]++;
        }
    }
    return;
}


int main()
{
    int i,j,t1,t2,n,ans;
    sieve();
    while(1)
    {
        scanf("%d",&n);
        if(n==0)
            break;
        ans=m[n];
        printf("%d\n",ans);
    }
    return 0;
}

Measured memory_bytes: 35720
#include<bits/stdc++.h>
using namespace std;
int ans,n,a,k;

int f(int a,int k){
	if(a<k) return 0;
	if(a%k==0) return a/k;
	int now=(a/k)*k;
	int val=a/k+1;
	int ci=(a-now-1)/val+1;
	return f(a-val*ci,k);
}

int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d %d",&a,&k);
		ans^=f(a,k);
	}
	if(ans==0) puts("Aoki");
	else puts("Takahashi");
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B;
  string op;
  cin >> A >> op >> B;
  
  if(op=="+"){
    cout << A+B << endl;
  }
  else if(op=="-"){
    cout << A-B << endl;
  }
}

Measured memory_bytes: 256
a=int(input())
b=int(input())
c=int(input())
x=int(input())

cnt=0
for i in range(0,x//500+1):
    if i<=a:
        for j in range((x-500*i)//100+1):
            if j<=b:
                for k in range((x-500*i-100*j)//50+1):
                    if k<=c:
                        if (500*i+100*j+50*k)==x:
                            cnt+=1
print(cnt)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+5;
int n,a[N],b[N];
struct node
{
    int x,pos;
    node(int x=0,int pos=0):x(x),pos(pos){}
    bool operator<(const node&o)const
    {
        return x<o.x;
    }
};
priority_queue<node>q;
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%d",&a[i]);
    for(int i=1;i<=n;i++)
        scanf("%d",&b[i]),q.push(node(b[i],i));
    long long ans=0;
    while(!q.empty())
    {
        int u=q.top().pos;q.pop();
        if(b[u]==a[u]) continue;
        int l=u-1,r=u+1;
        if(l==0) l=n;
        if(r==n+1) r=1;
        if((b[u]-a[u])%(b[l]+b[r])==0)
        {
            ans+=(b[u]-a[u])/(b[l]+b[r]);
            b[u]=a[u];continue;
        }
        int now=max(a[u],max(b[l],b[r]));
        if((b[u]-now)/(b[l]+b[r])>0)
        {
            ans+=(b[u]-now)/(b[l]+b[r]);
            b[u]-=(b[u]-now)/(b[l]+b[r])*(b[l]+b[r]);
        }
        else
        {
            b[u]-=b[l]+b[r];
            ans++;
        }
        if(b[u]<a[u])
        {
            printf("-1\n");return 0;
        }
        if(b[u]!=a[u])
            q.push(node(b[u],u));
    }
    printf("%lld\n",ans);
}


Measured memory_bytes: 3700
use std::cmp;
use std::collections::BinaryHeap; // 優先度付きキュー
use std::collections::HashMap; // 連想配列
use std::collections::HashSet; // 連想配列 キーのみ
use std::collections::VecDeque; // キュー or スタック
use std::io::Read;
use std::usize::MAX;

macro_rules! input {(source = $s:expr, $($r:tt)*) => {let mut iter = $s.split_whitespace();let mut next = || { iter.next().unwrap() };input_inner!{next, $($r)*}};($($r:tt)*) => {let stdin = std::io::stdin();let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));let mut next = move || -> String{bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect()};input_inner!{next, $($r)*}};}
macro_rules! input_inner {($next:expr) => {};($next:expr, ) => {};($next:expr, $var:ident : $t:tt $($r:tt)*) => {let $var = read_value!($next, $t);input_inner!{$next $($r)*}};}
macro_rules! read_value {($next:expr, ( $($t:tt),* )) => {( $(read_value!($next, $t)),* )};($next:expr, [ $t:tt ; $len:expr ]) => {(0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()};($next:expr, chars) => {read_value!($next, String).chars().collect::<Vec<char>>()};($next:expr, usize1) => {read_value!($next, usize) - 1};($next:expr, [ $t:tt ]) => {{let len = read_value!($next, usize);(0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()}};($next:expr, $t:ty) => {$next().parse::<$t>().expect("Parse error")};}

fn solve() {
    input! {
        n: usize
    }

    let mut ans = 0;
    for i in 1..n + 1 {
        if i % 5 != 0 && i % 3 != 0 {
            ans += i;
        }
    }

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

fn main() {
    let thd = std::thread::Builder::new().stack_size(104_857_600);
    thd.spawn(|| solve()).unwrap().join().unwrap();

    /*
    // 入力を一括で読み込む場合
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut input = buf.split_whitespace();

    // inputに対しnext()で読み込んでいく
    let q: usize = input.next().unwrap().parse().unwrap();
    */
}

const LARGE_PRIME: u64 = 1_000_000_007;

// @〜でsnippet


Measured memory_bytes: 2240
import java.util.Scanner;

public class Main {

    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int r = sc.nextInt();
        int D = sc.nextInt();
        int x = sc.nextInt();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < 10; i++) {
            sb.append(r*x-D).append("\n");
            x = r*x-D;
        }
        System.out.println(sb);
    }

}

Measured memory_bytes: 35688
#include <iostream>
using namespace std;
int main()
{
	long a,b,x,ans=1;
	cin >> a >> b;
	if(b==1){
		cout << '0' << endl;
		return 0;
	}
	x=a;
	while(x<b){
		x+=(a-1);
		ans++;
	}
	cout << ans << endl;
	return 0;
}


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

 int main() {
     int k,s;
     int ans =0;
     cin >> k >> s;
     for (int i =0; i<=k;i++){
         for(int j=0;j<=k;j++){
             if (0<=s-j-i && s-j-i <=k){
                 ans++;
             }
             }
         }
          cout << ans  << endl;
     }


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

using namespace std;

typedef long long ll;

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n;
    cin >> n;
    ll k = 0;
    ll t = 1;
    while (k * 10 + 9 <= n) {
        k = k * 10 + 9;
        t *= 10;
    }
    for (ll i = 9; i >= 1; --i) {
        if (i * t + k <= n) {
            k = i * t + k;
            break;
        }
    }
    int s = 0;
    while (k) {
        s += k % 10;
        k /= 10;
    }
    cout << s;
    return 0;
}

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

#define ll long long
#define mod 1000000007

using namespace std;

ll power(ll x, ll N){
	ll res = 1;
	for(ll i=1; i<=N; i++){
		res*=x;
		res%=mod;
	}
	return res;
}


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

	ll total = power(10, N);
	ll noZero = power(9, N);
	ll noNine = power(9, N);
	ll neitherZeroNorNine = power(8, N);

	ll ans = total - ((noNine + noZero)%mod) + neitherZeroNorNine;
	ans%=mod;
	ans = (ans+mod)%mod;
	cout<<ans;

	return 0;
}

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

int main() {
	int a, b, c, k;

	cin >> a >> b >> c >> k;

	int sum = 0;

	if (a >= k)
	{
		cout << k << endl;
	}
	else if (a + b >= k)
	{
		cout << a << endl;
	}
	else
	{
		sum = 2 * a + b - k;
		cout << sum << endl;
	}
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
long long int mod=1000000007;
long long int dp[100001][2];
vector<int>adj[100001];
void dfs(int curr,int pt)
{
	for(int i=0;i<adj[curr].size();i++)
	{
		int temp=adj[curr][i];
		if(temp!=pt)
		{
			dfs(temp,curr);
			dp[curr][0]=((dp[temp][0]+dp[temp][1])%mod*dp[curr][0]%mod)%mod;
			dp[curr][1]=(dp[temp][0]%mod*dp[curr][1]%mod)%mod;
		}
	}
}
int main()
{
	int n;
	cin >> n;
	int i,j,k,x,y;
	for(i=1;i<n;i++)
	{
		cin >> x >> y;
		adj[x].push_back(y);
		adj[y].push_back(x);
	}
	for(i=1;i<=n;i++)
	{
		dp[i][0]=1;
		dp[i][1]=1;
	}
	dfs(1,-1);
	cout << (dp[1][0]+dp[1][1])%mod;
	return 0;
}

Measured memory_bytes: 14208
#include<stdio.h>
#include<stdlib.h>
#define ll long long
#define rep(i,l,r) for(ll i=(l);i<(r);i++)

ll a,b,n;
ll h[100010];

ll bserch(){
	ll l=0,r=0;//lはNG、rはOK
	rep(i,0,n)r+=(h[i]+b-1)/b;
	while(r-l>1){
		ll m=(l+r)/2;
		ll temp=0;
		rep(i,0,n)if(h[i]-b*m>0)temp+=(h[i]-b*m+(a-b)-1)/(a-b);
		if(temp<=m)r=m;
		else l=m;
	}
	return r;
}

int main(){
	scanf("%lld%lld%lld",&n,&a,&b);
	rep(i,0,n)scanf("%lld",h+i);
	printf("%lld\n",bserch());
	return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(long long i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,n-1,0)
#define RREPS(i,n) RFOR(i,n,1)
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
const int INF=1e18;
const int MOD=1e9+7;

signed main(){
    int n,m;cin>>n>>m;
    map<int,int>memo;
    REP(i,m){
        int a,b;cin>>a>>b;a--;b--;
        memo[a]++;memo[b]++;
    }
    for(auto v:memo){
        if(v.second%2==1){
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;
}

Measured memory_bytes: 5632
#include<cstdio>
#include<algorithm>
#include<string>
#include<set>
#include<iostream>
#include<vector>
#include <map>
#include <utility>
#include <cmath>
#include<cstdlib>
#include<sstream>

using namespace std;

int main(){
  int n,count,i=1,sum;
  while(true){
    cin >> n;
    if (!n)
      break;
    int i=1;
    int j=0;
    sum = 1;
    count = 0;
    while(true){
      for(;sum<n;i++,sum+=i);
      if (i==n)
	break;
      while(sum>n){
	j++;
	sum-=j;
      }
      if (n == sum){
	count++;
	j++;
	sum-=j;
      }
    }
    cout << count << endl;
  }
  return 0;
}

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

// #define int long long
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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; }

const ll INF = 1e15;
const int MOD = 1e9+7;
const ll LINF = 1e18;

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

const ll maxf = 10000000;
ll fact[maxf+5];

void fact_init(){
  fact[0] = 1;
  for(ll i=1; i<=maxf; i++){
    fact[i] = (fact[i-1] * i) % MOD;
  }
}

ll comb(ll a, ll b){
  if(a<b || a<0 || b<0) return 0;
  if(fact[0] == 0) fact_init();
  return (fact[a] * modpow((fact[a-b]*fact[b])%MOD, MOD-2)) % MOD;
}


signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n,k; cin>>n>>k;
  vll a(n);
  rep(i,n) cin>>a[i];
  ll p=0;
  rep(i,n) irep(j,i+1,n) if(a[i]>a[j]) p++;
  ll q=0;
  rep(i,n) rep(j,n) if(a[i]>a[j]) q++;
  p=(p*k)%MOD;
  q=k*(k-1)%MOD*modpow(2,MOD-2)%MOD*q%MOD;
  cout<<(p+q)%MOD<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back 
#define eb emplace_back
#define fn for(int i =0 ;i <n;i++)
#define fn1 for( int i =1;i<=n;i++)
#define fm for(int j =0 ;j <m;j++)
#define fm1 for(int j =1;j<=m;j++)
#define fi first
#define se second
#define endl '\n'
# define PI  3.14159265358979323846
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
const int N = 2e6+5;
const int INF = 1e18L;
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
int ar[N];
int dp[N];
signed main(){
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	// #endif
	IOS;
	int T=1;
	// cin >> T;
	while(T--){
		int n;
		cin >> n ;
		int x = n;
		int ans =0;
		ans+=1000*(x/500);
		x%=500;
		ans+=5*(x/5);
		int ans2 =5*(n/5);
		cout << max(ans2,ans);
	
	
	}
	cerr << "Time Taken : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    int n,x,c=0;
    vector<int>v,u;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>x;
        v.push_back(x);
        u.push_back(x);
    }
    sort(u.begin(),u.end());
    for(int i=0;i<n;i++)
    {
        if(v[i]!=u[i])
        {
            c++;
        }
    }
    if(c<=2)
    {
        cout<<"YES"<<endl;
    }
    else cout<<"NO"<<endl;
    return 0;
}


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

int main(){
	int N,M,X,Y;
	cin >> N >> M >> X >> Y;
	auto x = vector<int>(N,0);
	auto y = vector<int>(M,0);
	
  	for(int i = 0; i< N;i++){
    	cin >> x[i];
    }
  	
  	for(int i = 0; i< M;i++){
    	cin >> y[i];
    }
  	
	auto z_min = X+1;
	auto z_max = Y;

	auto max_x = *max_element(x.begin(),x.end());
	auto min_y = *min_element(y.begin(),y.end());

	bool flag = false;
	for (int z = z_min; z <= z_max; z++)
	{
		if(max_x < z && min_y >= z){
			flag = true;
			break;
		}
	}
	
	if(flag){
		cout << "No War";
	}else{
		cout << "War";
	}

}


Measured memory_bytes: 256
def get_prime_count(n)
  sqrt_num = Math.sqrt(n)
  is_prime = [false, false] + [true]*(n - 1)

  2.upto(sqrt_num) do |i|
    next unless is_prime[i]
    (i*i).step(n, i) do |j|
      is_prime[j] = false
    end
  end

  result = []
  count = 0
  0.upto(n) do |i|
    count += 1 if is_prime[i]
    result[i] = count
  end

  return result
end

n = 1000000
prime_count = get_prime_count(n)

while gets do
  n = $_.to_i
  puts prime_count[n]
end

Measured memory_bytes: 31380
// Template from https://techracho.bpsinc.jp/jhonda/2019_08_05/78537

// input macro for competive-programming from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

    ($iter:expr, bytes) => {
        read_value!($iter, String).into_bytes()
    };

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

fn main() {
    use std::io::Read;
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();

    println!("{}", solve(&s));
}

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
r#"4
3 8 5 1"# => r#"Yes"#,
r#"4
3 8 4 1"# => r#"No"#,
r#"10
1 8 10 5 8 12 34 100 11 3"# => r#"No"#,
}

fn solve(src: &str) -> String {
    input! {
        source = src,
        n: usize,
        mut l: [usize; n]
    }
    l.sort();

    if l.pop().unwrap() < l.into_iter().sum::<usize>() {
        "Yes".to_string()
    } else {
        "No".to_string()
    }
}

Measured memory_bytes: 4352
#include <cstdio>
#include <cmath>
#include <cstring>
#include <iostream>

#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <deque>

#include <algorithm>

using namespace std;


int main(int argc, char *argv[]) {
	int n, k;
	string s;
	cin >> n >> k >> s;
	s[k-1] -= 'A' - 'a';	
	cout << s;
}

Measured memory_bytes: 256
using System;
class Program
{
	static void Main(string[] args)
	{
		var count500 = int.Parse(Console.ReadLine());
		var count100 = int.Parse(Console.ReadLine());
		var count50 = int.Parse(Console.ReadLine());
		var target = int.Parse(Console.ReadLine());

		var combinationCount = 0;
		for (var i = 0; i <= count500 && i * 500 <= target; ++i) {
			var rest500 = target - (i * 500);
			if (rest500 == 0) {
				++combinationCount;
			} else {
				for (var j = 0; j <= count100 && j * 100 <= rest500; ++j) {
					var rest100 = rest500 - (j * 100);
					if (rest100 == 0) {
						++combinationCount;
					} else if (rest100 % 50 == 0 && rest100 / 50 <= count50) {
						++combinationCount;
					}
				}
			}
		}

		Console.WriteLine(combinationCount);
	}
}

Measured memory_bytes: 13140
using System;
using System.Linq;
using System.Collections.Generic;
using System.Numerics;
using static System.Console;

class Program {
    internal static void Main(string[] args) {
        var S = ReadLine();
        var K = long.Parse(ReadLine());

        var ans = '1';
        for (int i = 0; i < S.Length; i++) {
            if (S[i] != '1') { 
                ans = S[i];
                break;
            }

            if (K-1 == i) {
                ans = '1';
                break;
            }
        }

        WriteLine(ans);
    }
}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
#define lson now<<1
#define rson now<<1|1
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int mod=1e9+7;
const double eps = 1e-10;
const double pi=acos(-1.0);
const int maxn=2e5+10;
const ll inf=0x3f3f3f3f;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    int a[3];
    cin>>a[0]>>a[1]>>a[2];
    sort(a,a+3);
    if(a[0]==a[1]&&a[1]!=a[2])cout<<"Yes"<<endl;
    else if(a[1]==a[2]&&a[0]!=a[1])cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdbool.h>
#include<ctype.h>
#include<math.h>
#define PI 3.14159265359
#define NUM 1000
#define min(x,y) x < y ? x : y
#define max(x,y) x > y ? x : y

int main()
{
  double a, b, c, s, l, h;
  scanf("%lf %lf %lf", &a, &b, &c);
  s = 0.5*a*b*sin(c*PI/180);
  l = sqrt(pow(a,2)+pow(b,2)-2*a*b*cos(c*PI/180))+a+b;
  h = b*sin(c*PI/180);
  printf("%lf\n%lf\n%lf\n",s,l,h);
  return 0;
}

Measured memory_bytes: 676
#include <iostream>
#include <string>

int main()
{
    int a, b;

    std::cin >> a >> b;

    if (a < b) std::cout << "a < b" << std::endl;
    else if (a > b) std::cout << "a > b" << std::endl;
    else std::cout << "a == b" << std::endl;

    return 0;
}


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

using namespace std;

#define ll long long

int main (){

    ll r,x,n,k,i;

    cin>>n>>k;

    if(n <= k) {

        for(i=0; i<n; i++) cin>>r;

        cout<<0<<endl;

    }

    else if(k == 0){

        ll sum=0;

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

            cin>>r;

            sum+=r;

        }

        cout<<sum<<endl;

    }

    else{

        vector<ll>v;
        ll res=0;

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

            cin>>r;

            v.push_back(r);

        }

        sort(v.begin(),v.end());

        for(i=0; i<n-k; i++) res+=v[i];

        cout<<res<<endl;

    }

    return 0;

}


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

int main() {
	int a, b, c, d; cin >> a >> b >> c >> d;
	
	bool p1 = true;
	while(true) {
		if (c - b <= 0)
			break;
		c -= b;
		if (a - d <= 0) {
			p1 = false;
			break;
		}
		a -= d;
	}
	
	if (p1) cout << "Yes\n";
	else cout << "No\n";
	
	return 0;
}


Measured memory_bytes: 3624
#include<iostream>
using namespace std;
int main(){
  long long  a,b;
  while(cin>>a>>b){
    //Eucledean algorithm                                                                                                     
    long long c,d,r,GCD,LCM;
    c=a;d=b;
    do{
      r=c%d;
      c=d;d=r;
    }while(r);
    GCD=c;
    LCM=a*b/GCD;
    cout << GCD << ' ' << LCM <<endl;
  }
  return 0;
}

Measured memory_bytes: 1156
#include <stdio.h>

int main(void)
{
	int H;
	int W;
	int a;  /*??°???????????¨?????°*/
	int b;  /*??°???????????¨?????°*/
	int c;  /*??°???????????¨?????°*/
	int d;  /*??°???????????¨?????°*/
	
		while(1){
			scanf("%d %d", &H, &W);
				if(H == 0 && W == 0){
			break;
		}
		for (a = 1; a <= W; a++){
			printf("#");
		}
		printf("\n");
		for (b = 1; b <= (H-2); b++){
			printf("#");
			for(c = 1; c <= (W-2); c++){
				printf(".");
			}
			printf("#");
				printf("\n");
			}
		for (d = 1; d <= W; d++){
			printf("#");
			
			}
			printf("\n");
		printf("\n");
		}
	
		
		return (0);
}

Measured memory_bytes: 572
#include<bits/stdc++.h>
#include<iomanip>
#include<numeric>

using namespace std;
using ll = long long;
constexpr int mo = 1e9+7;
constexpr int  mod = mo;
constexpr int inf = 1<<30;
constexpr int mo2 = 998244353;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int a,b;
    cin>>a>>b;
    cout << max(a-2*b,0) << endl;
    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
int main(void) {
	int i,s[50],max=0;
	double w[50],h[50];
	for(i=0;i<50;i++){
		int ret=scanf("%d,%lf,%lf",&s[i],&w[i],&h[i]);
		if(ret==EOF) break;
		if(i>max) max=i;
	}
	double b[50];
	for(i=0;i<=max;i++){
		b[i]=w[i]/(h[i]*h[i]);
		if(b[i]>=25.0){
			printf("%d\n",s[i]);
		}
	}
	return 0;
}


Measured memory_bytes: 2052
import java.io.*;
import java.util.Arrays;
import java.util.Scanner;

public class Main{
    public static void main(String []args) throws IOException
    {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();

        int arr [] = new int[3];
        arr[0]=a;
        arr[1]=b;
        arr[2]=c;

        Arrays.sort(arr);

        int x = (arr[2]*10 + arr[1]);
        System.out.println(x+arr[0]);
    }
}

Measured memory_bytes: 23508
#include <iostream>
using namespace std;
 
int main()
{
    int a,b,c;
    
 
cin>> a>>b>>c;
 
if ((a+b+c)>=22)
{
 
    cout<< "bust";
}
else
    cout<<"win";
 
    return 0;
}
 
 
 
 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
  int ans = 0;
  int n;
  long long d;
  cin >> n >> d;
  long long a,b;
  for(int i = 0; i < n; i++) {
    cin >> a >> b;
    if(d >= sqrt(a*a + b*b)) {
      ans++;
    }
  }
  cout << ans;
}

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
template<typename T>
void print(T x) {
    cout << x << endl;
}
int main(void) {
    int n; cin >> n;
    double sum = 0;
    rep(i, n) {
        double x; string u;
        cin >> x >> u;
        if(u == "JPY") sum += x;
        else sum += x * 380000;
    }
    printf("%.10f\n",sum);
}


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))
#define sz(v) ((int) v.size())

using namespace std;

using i64 = long long;
using f80 = long double;
using vi32 = vector<int>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << endl; exit(0); }
inline void no() { cout << "No" << endl; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); return a / gcd(a, b) * b; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { x = max(x, y); }
template <typename T> inline void amin(T &x, T y) { x = min(x, y); }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

void solve() {
  string s;
  cin >> s;
  i64 k;
  cin >> k;
  rep(i, (int) min(k, (i64) 1e9)) {
    if (s[i] != '1') {
      cout << s[i] << endl;
      return;
    }
  }
  cout << s[k - 1] << endl;
}

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

using namespace std;

const int N = (1<<19) , mod = 1e9 +7 , mx = 1e6 +5;


long long A , B , n ;


int main()
{
    cin>>n >>A >>B ;
    if(abs(A-B)%2==0)
    {
        cout<<fixed<<setprecision(0)<<(B-A)/2LL;
    }
    else
    {
        cout<<fixed<<setprecision(0)<<min(A + (B-A-1)/2 , n-B+1 + (n - (A+n-B+1) )/2 );
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <sstream>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef vector <vector <int>> vii;
typedef vector <long long> vll;
typedef vector <string> vs;
typedef vector <char> vc;
typedef set <int> si;
typedef set <string> ss;
typedef queue <int> qi;
typedef queue <long long> qll;
typedef queue <string> qs;
typedef queue <char> qc;
typedef struct board board;
typedef pair <int, int> pi;
typedef pair <long long, long long> pll;
typedef pair <int, pair<int, int>> pii;

#define eb emplace_back
#define ppb pop_back
#define clr(a) a.clear()
#define F first
#define S second
#define mkp make_pair

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

#define left(x) x * 2
#define right(x) x * 2 + 1

#define meme(a, b, c) fill(a + 1, a + 1 + b, c)

#define max(a, b) (a > b ? a : b)
#define min(a, b) (a > b ? b : a)
#define abs(a) (a > 0? a : -(a))

#define move(s) s += "#"

#define fr(i, a, b) for (ll i = a; i <= b; ++ i)
#define rf(i, a, b) for (ll i = a; i >= b; -- i)

#define eprintf(...) fprintf(stderr, __VA_ARGS__);

void to_pray() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cerr << "Ready\n";
}

const int N = 4e6 + 10;
const int NN = 1e3 + 10;
const int NNN = 2e3 + 9;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const ll LLINF = 1e12 + 7;
const ll P = 53;
const int EPS = 1e-9 - 8;
const int vN = 2e4 + 10;
const int sz = (1 << 22) - 1;
const double PI = acos(-1);

int main () {
    to_pray();

    int n;
    cin >> n;
    cout << n * n;
    
    //eprintf("%.18lf seconds\n", (double)clock() / CLOCKS_PER_SEC);
    cout << '\n';
    return 0;
}

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

#define ll long long
#define pb push_back
int main()
{
   string ss;
   cin>>ss;
   int len= ss.size();
   if(ss[len-1]=='C'&& ss[len-2]=='B'&& ss[len-3]=='A')cout<<"ARC"<<endl;
   if(ss[len-1]=='C'&& ss[len-2]=='R'&& ss[len-3]=='A')cout<<"ABC"<<endl;
   

}

Measured memory_bytes: 3516
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;


public class B
{
	public static void Main()
	{
		string[] args = Console.ReadLine().Split(' ');
		int a = Int32.Parse(args[0]);
		int b = Int32.Parse(args[1]);

		int sum = 0;
		for(int i = 1; i < (b - a); i++)
			sum += i;

		Console.WriteLine(sum - a);
	}
}





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

#define rep(i,n) for(int i=0; i<n; i++)
#define rept(i,a,b) for(int i=a; i<b; i++)
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> P;

const int mod = 1e9 + 7;


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

	int n;
	cin >> n;

	if(n % 2 == 0){
		n = n / 2 - 1;
	}else{
		n = n / 2;
	}
	cout << n  << endl;



    return 0;
}



Measured memory_bytes: 256
N = int(input())
txy = [list(map(int, input().split())) for _ in range(N)]

now_x, now_y = 0, 0
pre_t = 0

for t, x, y in txy:
    walk = abs(now_x - x) + abs(now_y - y)
    if t - pre_t < walk:
        print('No')
        exit()
    if (t-pre_t) % 2 != walk % 2:
        print('No')
        exit()
    now_x = x
    now_y = y
    pre_t = t

print('Yes')

Measured memory_bytes: 85404
#include <iostream>
#include<cstring>
#include<cmath>
#include <algorithm>
#include <vector>
using namespace std;
long long n;
int main()
{
  long long k,ans=pow(10,10);
  cin>>n>>k;;
  long long dp[n+1];
  dp[0]=0;
  dp[1]=0;
  long long h[n];
  for(long long i=0; i<n;i++)
    cin>>h[i];
  dp[2]=abs(h[1]-h[0]);
  for(long long i=3; i<=n;i++)
  {
    ans=pow(10,10);
    for(long long j=1;j<=k;j++)
    {
      if(i-j>=0)
      ans=min(dp[i-j]+abs(h[i-1]-h[i-j-1]),ans);
    }
   dp[i]=ans;
   }
  cout<<dp[n];
  return 0;
}

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


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

  cout << min(a, b) + min(c, d) << endl;
  
  return 0;
}

Measured memory_bytes: 3600
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <complex>
#include <cstdint>
#include <tuple>
#include <numeric>
#define M_PI       3.14159265358979323846


using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FILL(a, x) memset(a, x, sizeof(a))

//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)

int main() {
	int a[5];
	REP(i, 5)cin >> a[i];
	int k = 10;
	int ret = 0;
	REP(i, 5) {
		if (a[i] % 10 == 0) {
			ret += a[i];
		}
		else {
			ret += (a[i] / 10 + 1) * 10;
			k = min(k, a[i] % 10);
		}
	}
	ret = ret - 10 + k;
	cout << ret << endl;
	return 0;
}

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

using ll = long long;
using ull = unsigned long long;

const double PI = acos(-1);
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;

#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
#define REP(i,n) for (int i = 0; i<n; i++)
#define ALL(a) begin(a), end(a)

int main (void) {
    int N;
    cin>>N;
    vector<int> m(N);
    REP(i,N) cin>>m[i];
    sort(ALL(m),greater<int>());
    int ans = 1;
    for (int i=1;i<N;i++) {
        if (m[i] < m[i-1]) ans++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
al = list(map(int,input().split()))

bine1 = 0
bine4 = 0
bine2 = 0

for a in al:
    if a % 4 == 0:
        bine4 += 1
    if a % 4 != 0 and a % 2 == 0:
        bine2 += 1
    if a % 2 != 0:
        bine1 += 1

if bine4 == 0 and bine1 > 0:
    print("No")
elif bine2 == 0 and bine4 +1 >= bine1:
    print('Yes')
elif bine4 >= bine1:
    print('Yes')
else:
    print('No')



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

int main(void){
    int n,i;
    int room[4][3][10]={0}; //room[buldings][floors][rooms]
    int b,f,r,v;
    
    for (b=0; b<4; b++) {
        for (f=0; f<3; f++) {
            for (r=0; r<10; r++) {
                room[b][f][r]=0;
            }
        }
    }
    
    scanf("%d",&n);
    
    if(n<0){
        printf("error\n");
        return 0;
    }
    
    
    for(i=0;i<n;i++){
        scanf("%d  %d %d %d",&b,&f,&r,&v);
        if(b<1||4<b){
            printf("error\n");
            return 0;
        }
        if(f<1||3<f){
            printf("error\n");
            return 0;
        }
        if(r<1||10<r){
            printf("error\n");
            return 0;
        }
        
        room[b-1][f-1][r-1]+=v;
        if(room[b-1][f-1][r-1]<0||9<room[b-1][f-1][r-1]){
            printf("error\n");
            return 0;
        }
    }
 
    for(b=0;b<4;b++){
        if(b>0){
            for(i=0;i<20;i++){
                putchar('#');
            }
            putchar('\n');
        }
        for(f=0;f<3;f++){
            for(r=0;r<10;r++){
                printf(" %d",room[b][f][r]);
                if(r==9){
                    putchar('\n');
                }
                else{
                    //putchar(' ');
                }
            }
        }
    }
    
    return 0;
}


Measured memory_bytes: 2104
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int k = scan.nextInt();
        int l[] = new int[n];

        for(int i = 0;i < n;i++){
            l[i] = scan.nextInt();
        }
        Arrays.sort(l);

        int sum = 0;
        for(int i = 0;i < k;i++){
            sum += l[n-1-i];
        }

        System.out.println(sum);
    }
}


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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int N;
    vector<int> vec;
    cin >> N;
    vec.resize(N);

    for (int i = 0; i < N; ++i) {
        cin >> vec[i];
    }
    sort(vec.begin(), vec.end());

    cout << (vec[N - 1] - vec[0]) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;




int main()
{
    int n;scanf("%d",&n);
    int now=1;
    for (int i=0;i<n;++i){
        int tmp;scanf("%d",&tmp);
        if (tmp==now) now++;
    }
    if (now==1) printf("-1");
    else printf("%d\n",n-now+1);


}


Measured memory_bytes: 128
r, g, b, n = map(int, input().split())

ans = 0
for i in range(n+1):
    for j in range(n+1):
        s = n - r*i - g*j
        if s < 0:
            continue
        else:
            if s%b == 0:
                ans += 1
print(ans)


Measured memory_bytes: 40812
from decimal import Decimal as D

from bisect import bisect_left as bl


# 最長増加部分列の長さを求める。
def LIS(L):
    best = []
    for i in L:
        # ソートされた順序を保ったまま、bestにiを挿入できる位置がpos
        pos = bl(best, i)
        if len(best) <= pos:
            best.append(i)
        else:
            best[pos] = i
    return len(best)


if __name__ == '__main__':
    xflip = 1
    yflip = 1
    x1, y1, x2, y2 = map(int, input().split())
    if x1 > x2:
        xflip = -1
        x1, x2 = x2, x1
    if y1 > y2:
        yflip = -1
        y1, y2 = y2, y1
    # スタートとゴールの間にある噴水の座標
    points = []
    # 噴水の個数
    n = int(input())
    for i in range(n):
        x, y = map(int, input().split())
        if x1 <= x <= x2 and y1 <= y <= y2:
            points.append((x * xflip, y * yflip))
    # xの順序でソートし、yを入れたリスト
    points = [y for x, y in sorted(points)]
    # 通る噴水の数
    foun = LIS(points)
    dist = D(100) * (x2 - x1 + y2 - y1)
    dx = D('-4.2920367320510338076867835') * foun
    # 噴水を横切らねばならないとき
    if foun == min(x2 - x1 + 1, y2 - y1 + 1):
        dx += D('15.7079632679489661923132165')
    print(dist + dx)


Measured memory_bytes: 36288
#include <bits/stdc++.h>
using namespace std;
using ll =  long long;
const int MAX_N = 1e5+10;
ll H, W, N;
int a[MAX_N], b[MAX_N];
ll cnt[10];
set<pair<int,int>> s0, s1;

void solve()
{
	for(int i=0;i<N;++i){
		s0.emplace(a[i],b[i]);
		for(int j=0;j<3;++j)for(int k=0;k<3;++k)s1.emplace(a[i]-j,b[i]-k);
	}
	cnt[0] = (H-2)*(W-2);
	for(const auto& p : s1){
		int x = p.first, y = p.second;
		if(x<=0 || x+2>H) continue;
		if(y<=0 || y+2>W) continue;
		int res = 0;
		for(int i=0;i<3;++i)for(int j=0;j<3;++j)res += s0.count(make_pair(x+i,y+j));
		cnt[res]++;
		cnt[0]--;
	}
	for(int i=0;i<10;++i)cout <<cnt[i]<<"\n";
}

int main()
{
	cin >> H >> W >> N;
	for(int i=0;i<N;++i)cin >> a[i] >> b[i];
	solve();
	return 0;
}

Measured memory_bytes: 49920
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

if __name__ == '__main__':
    a = [int(i) for i in input().split()]
    
    print(a[0]-a[1]+1)

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

int main() {
    int a, b, c; cin >> a >> b >> c;
    if (a == b && b == c) puts("1");
    else if (a == b || b == c || c == a) puts("2");
    else puts("3");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long lli;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<vector<lli> > mat;
typedef vector<vector<bool> > matb;
typedef vector<string> vst;
typedef pair<lli,lli> pll;
typedef pair<double,double> pdd;
typedef vector<map<lli,lli>> graph;

lli n;
vll a;
vll b_,_b;

int main(){
	cin >> n;
	a = vll(n);
	for(lli i = 0;i < n;i++) cin >> a[i];
	for(lli i = 0;i < n;i++){
		if(i%2){
			_b.push_back(a[i]);
		}else{
			b_.push_back(a[i]);
		}
	}
	if(n%2 == 0){
		for(lli i = _b.size()-1;i >= 0;i--){
			cout << _b[i] << " ";
		}
		for(lli i = 0;i < b_.size();i++){
			cout << b_[i];
			if(i != b_.size()-1) cout << " ";
		}

	}else{
		for(lli i = b_.size()-1;i >= 0;i--){
			cout << b_[i] << " ";
		}
		for(lli i = 0;i < _b.size();i++){
			cout << _b[i];
			if(i != _b.size()-1) cout << " ";
		}
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 5484
#include <stdio.h>

void Operation(int *X, int *Y){
  if(*X % 2 == 1) (*X)--;
  *X *= 0.5;
  *Y += *X;
}

void Do(int A, int B, int K){
  int i;
  for(i = 0;i < K;i++){
    if(i % 2 == 0) Operation(&A, &B);
    else Operation(&B, &A);
  }
  printf("%d %d\n", A, B);
}
      
int main(void){
  int A, B, K;
  scanf("%d %d %d", &A, &B, &K);
  Do(A, B, K);
  return 0;
}


Measured memory_bytes: 128
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline

def main():
    attended_people=[]
    sorted_attended_people=[]
    index_number=[]
    answer=[]
    n = int(input())
    attended_people=list(map(int,input().split()))
    index_number=[[idx,number] for idx,number in enumerate(attended_people)]
    sorted_attended_people=sorted(index_number,key=lambda x:x[1])
    for idx,data in sorted_attended_people:
        answer.append(str(idx+1))
    print(" ".join(answer))

if __name__=="__main__":
    main()

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

typedef long long ll;
typedef long double ld;

int a[100005];

int main(){
    ios_base::sync_with_stdio(false), cin.tie(0);
    cout.precision(10);
    cout << fixed;

    int n, k;
    cin >> n >> k;
    for(int i=1; i<=n; i++) cin >> a[i];
    sort(a+1, a+1+n);
    int sum = 0;
    for(int i=1; i<=k; i++) sum += a[i];
    cout << sum;
    return 0;
}


Measured memory_bytes: 3632
import bisect
n = int(input())
al = [int(a) for a in input().split()]
bl = [int(b) for b in input().split()]
cl = [int(c) for c in input().split()]

al.sort()
bl.sort()
cl.sort()

k = 0
for b in bl:
    k += bisect.bisect_left(al, b) * (n - bisect.bisect_right(cl, b))
print(k)

Measured memory_bytes: 23232
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>

using namespace std;

#define INF 2140000000
#define MOD 1000000007

int main() {
	int n, r = 0, b = 0;
	string s;

	cin >> n >> s;

	for (int i = 0; i < s.size(); ++i) {
		if (s[i] == 'R') {
			r++;
		}
		else {
			b++;
		}
	}

	if (r > b) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
string word;
int main() {
	cin >> word;

	if (word[0] == word[1] && word[2] == word[3] && word[0] != word[3])
		cout << "Yes";

	else if (word[0] == word[2] && word[1] == word[3] && word[0] != word[1])
		cout << "Yes";

	else if (word[0] == word[3] && word[2] == word[1] && word[0] != word[2])
		cout << "Yes";

	else
		cout << "No";

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdio.h>
#include <vector>
#include <algorithm> // sort
#include <map>
using namespace std;

int main(){
    int n;
    cin>>n;
    int a[n];
    long long int b[n+1];
    for(int i=0;i<n+1;i++){
        b[i]=0;
    }
    for(int i=0;i<n;i++){
        cin>>a[i];
        b[a[i]]++;
    }
    long long int m=0;
    for(int i=1;i<n+1;i++){
        m+=(b[i]-1)*b[i]/2;
    }
    for(int i=0;i<n;i++){
        cout<<m-b[a[i]]*(b[a[i]]-1)/2+(b[a[i]]-1)*(b[a[i]]-2)/2<<endl;
    }
}

Measured memory_bytes: 4992
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>

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

using namespace std;

int main() {
  while(1){
    int n;
    cin>>n;
    if(!n)break;
    int cnt=0;
    for(int i=1;i<n;++i){
      int sum=0;
      int j=i;
      while(sum<n){
        sum+=j;
        ++j;
      }
      if(sum==n)++cnt;
    }
    cout<<cnt<<endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include<stdio.h>
int main()
{
  int n,tmp,co,min;
  int i;
  min=1000000001;
  scanf("%d",&n);
  for(i=0;i<n;i++)
    {
      scanf("%d",&tmp);
      co=0;
      while(tmp%2==0)
	{
	  co++;
	  tmp/=2;
	}
      if(co<min)
	{
	  min=co;
	}
 
    }
  printf("%d\n",min);
  return 0; 
}

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

int main() {
    ll a, ans;
    double b;
    cin >> a >> b;
    ll ib = b * 100 + 0.5;
    a *= ib;
    a /= 100;
    printf("%lld\n", a);
    return 0;
}

Measured memory_bytes: 3776
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.NothingToLearn
{
    class ABC082_B
    {
        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            SetOut(sw);

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            string s = Read();
            string t = Read();
            char[] ss = s.ToCharArray();
            char[] tt = t.ToCharArray();
            Array.Sort(ss);
            Array.Sort(tt);
            Array.Reverse(tt);
            s = new string(ss);
            t = new string(tt);
            if (s.CompareTo(t) == -1)
            {
                WriteLine("Yes");
            }
            else
            {
                WriteLine("No");
            }
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 13408
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
x.sort()
y.sort()

if x[-1] < y[0] and X < y[0] and x[-1] < Y:
    print('No War')
else:
    print('War')


Measured memory_bytes: 61872