akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define pb push_back
#define mp make_pair
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MOD 1000000007
#define INF 1e18
#define M 1000000009
#define pi 3.14159265358979323846264338327950
typedef pair<int,int> pr;
#define N 1000002
signed main()
{
    SPEED;
  	int a,b;
  	cin>>a>>b;
  	cout<<a*b;
}

Measured memory_bytes: 3648
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>

using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define rep(i,n) for (ll i = 0; i < (n); ++i)



int main() {
    char a;
    cin >> a;

    if ('A' <= a && a <= 'Z') cout << "A" << endl;
    else cout << "a" << endl;

    return 0;
}

Measured memory_bytes: 3648
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)    
#define seg_size 524288
long long gogo[200000] = {};
int main() {
	long long n;
	cin >> n;
	if (n == 0) {
		cout << 0 << endl;
		return 0;
	}
	long long longest_itr = 0;
	while (n != 0) {
		if (n > 0) {
			long long geko = 0;
			long long now = 1;
			for (long long i = 0;; i += 2) {
				geko += now;
				if (geko >= n) {
					gogo[i] = 1;
					longest_itr = max(longest_itr, i);
					n -= now;
					break;
				}
				now *= 4LL;
			}
		}
		if (n < 0) {
			long long geko = 0;
			long long now = 2;
			for (long long i = 1;; i += 2) {
				geko -= now;
				if (geko <= n) {
					gogo[i] = 1;
					n += now;
					longest_itr = max(longest_itr, i);
					break;
				}
				now *= 4LL;
			}
		}
	}
	for (int i = longest_itr; i >= 0; --i) {
		cout << gogo[i];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int h,w;
  string s;
  cin>>h>>w;
  for(int i=0;i<h;++i)for(int j=0;j<w;++j){
    cin>>s;
    if(s=="snuke"){
      char c='A'+j;
      cout<<c<<i+1<<endl;
      return 0;
    }
  }
}

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

int main()
{
    int N, sum=0, s1=0, s2=0, diff=0;
    cin >> N;
    vector<int> w(N);

    for (int i = 0; i < N; i++)
    {
        cin >> w.at(i);
        sum = sum + w.at(i);
    }
    diff = sum;
    for (int i = 0; i < N; i++){
        s1 = s1 + w.at(i);
        s2 = sum-s1;
        if(diff>=abs(s2-s1)){
            diff = abs(s2-s1);
            //cout << "diff=" << diff << endl;
        }
        
    }
    cout << diff << endl;
}

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

int main(){
    int n,k;
    cin>>n>>k;
    vector<int> v(10),l;
    for(int i=0;i<k;i++){
        int d;
        cin>>d;
        v[d]++;
    }
    for(int i=n;;i++){
        int j=i;
        bool flag=true;
        while(j>0){
            int r=j%10;
            j/=10;
            if(v[r]){
                flag=false;
                break;
            }
        }
        if(flag){
            cout<<i<<endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3592
using System;
using System.Collections;

public class MainApp
{
    static public void Main(string[] args)
    {
        var read = Console.ReadLine();
        var split = read.Split(' ');
        int x = int.Parse(split[0]);
        int y = int.Parse(split[1]);
        if (hantei(x) == hantei(y)) Console.WriteLine("Yes");
        else Console.WriteLine("No");
    }
    static public int hantei(int x)
    {
        if (x == 2)
            return 3;
        if (x == 4)
            return 2;
        if (x == 6)
            return 2;
        if (x == 9)
            return 2;

        if (x == 11)
            return 2;

        return 1;
    }
}

Measured memory_bytes: 11092
from collections import deque 
import sys 
input = sys.stdin.readline 
n=int(input())
child= [[] for _ in range(n)]
edge_order =[]
for i in range(n-1):
    a,b = map(int,input().split())
    a,b = a-1, b-1 
    child[a].append((i,b))
    edge_order.append(b)

queue=deque([0])
color=[0]*n 
while queue:
    v = queue.popleft()
    c = 1
    for i,u in child[v]:
        if c==color[v]:
            c+=1
        color[u]=c
        c+=1
        queue.append(u)
print(max(color))
for i in edge_order:
    print(color[i])

Measured memory_bytes: 28092
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
  int e[4],i;
  for(i=0;i<4;i++)
    cin>>e[i];
  sort(e,e+4);
  if(e[0]==e[1]&&e[2]==e[3])
    cout<<"yes\n";
  else
    cout<<"no\n";
}



Measured memory_bytes: 3136
#include <bits/stdc++.h>
using namespace std;
#define ld double
#define ll long long
#define pb emplace_back
#define mk make_pair
#define mod 1000000007
#define ff first
#define ss second
#define sz(x) (int)x.size()
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define all(x) x.begin(),x.end()
ll power(ll a, ll b) {ll res = 1; a = a % mod; while (b) {if (b & 1)res = (res * a) % mod; a = (a * a) % mod; b /= 2;} return res;}
ll invmod(ll a) {return power(a, mod - 2);}
ll n, m, cd = 1, c = 1;
int lcm(int a, int b)
{
	return a / __gcd(a, b) * b;
}
int main()
{
	cin >> n >> m;
	int x;
	for (int i = 1; i <= n; i++)
	{
		ll a;
		cin >> a;
		cd = lcm(cd, a);
		c = lcm(c, a / 2);
		int tmp = 0;
		while (a % 2 == 0)
		{
			tmp++;
			a /= 2;
		}
		if (i == 1)
			x = tmp;
		else if (x != tmp || c > m)
		{
			cout << 0 << endl;
			exit(0);
		}
	}
	if (m < c)
		cout << 0;
	else
		cout << ((m - c) / cd) + 1;
	return 0;
}


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

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define mp make_pair
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }

vector<vector<int> > v;
int N, M, Q;

void dfs(int n, vector<int> s, int t) {
  if (n == N) {
    v.pb(s);
  }
  else {
    for (int i = t; i <= M; i++) {
      s.pb(i);
      dfs(n+1, s, s[s.size()-1]);
      s.pop_back();
    }
  }
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> N >> M >> Q;
  vector<int> s;
  vector<vector<int> > a(Q, vector<int>(4));
  rep(i, Q) {
    rep(j, 4) {
      cin >> a[i][j];
    }
  }
  dfs(0, s, 1);
  // rep(i, v.size()) {
  //   rep(j, v[i].size()) {
  //     cout << v[i][j] << ' ';
  //   }
  //   cout << endl;
  // }
  ll ans = 0;
  rep (i, v.size()) {
  ll sum = 0;
  rep(j, Q) {
    if (v[i][a[j][1]-1]-v[i][a[j][0]-1] == a[j][2]) {
      sum += (ll)a[j][3];
    }
  }
  ans = max(ans, sum);
  }
  cout << ans << endl;
}


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

int main()
{
	int64_t h, w, m;
	cin >> h >> w >> m;
	vector<int64_t> xs(m), ys(m);
	for (int64_t i = 0; i < m; i++)
	{
		cin >> xs[i] >> ys[i];
	}

	int64_t xmax = 0, ymax = 0;

	set<int64_t> as = [&] {
		map<int64_t, int64_t> mp;
		for (int64_t i = 0; i < m; i++)
		{
			mp[xs[i]]++;
			xmax = max(xmax, mp[xs[i]]);
		}

		set<int64_t> st;
		for (int64_t i = 0; i < m; i++)
		{
			if (mp[xs[i]] == xmax)
			{
				st.insert(xs[i]);
			}
		}

		return st;
	}();

	set<int64_t> bs = [&] {
		map<int64_t, int64_t> mp;
		for (int64_t i = 0; i < m; i++)
		{
			mp[ys[i]]++;
			ymax = max(ymax, mp[ys[i]]);
		}

		set<int64_t> st;
		for (int64_t i = 0; i < m; i++)
		{
			if (mp[ys[i]] == ymax)
			{
				st.insert(ys[i]);
			}
		}

		return st;
	}();

	vector<pair<int64_t, int64_t>> ps(m);
	for (int64_t i = 0; i < m; i++)
	{
		ps[i] = {xs[i], ys[i]};
	}
	sort(ps.begin(), ps.end());

	int64_t cnt = 0;
	for (auto &&a : as)
	{
		for (auto &&b : bs)
		{
			if (*lower_bound(ps.begin(), ps.end(), make_pair(a, b)) != make_pair(a, b))
			{
				cout << xmax + ymax << endl;
				return 0;
			}

			cnt++;
		}
	}

	cout << xmax + ymax - 1 << endl;

	return 0;
}

Measured memory_bytes: 54744
using System;
using System.Collections.Generic;
using System.Linq;
public class Hello
{
    public static void Main()
    {
        //AB上にある本の冊数、および所要時間を保持する
        var HWK = Console.ReadLine().Split().Select(e => int.Parse(e)).ToArray();
        var aCnt = HWK[0];
        var bCnt = HWK[1];
        var k = HWK[2];
        var aArray = Console.ReadLine().Split().Select(e => long.Parse(e)).ToArray();
        var bArray = Console.ReadLine().Split().Select(e => long.Parse(e)).ToArray();
        //AB上の本にかかる所要時間を累積和で保存しておく
        var sumA = new long[aCnt + 1];
        var sumB = new long[bCnt + 1];
        //0冊読んだ場合からN冊読んだ場合までの累積和配列を作成
        for (var i = 1; i <= aCnt; i++)
        {
            sumA[i] = sumA[i - 1] + aArray[i - 1];
        }
        for (var i = 1; i <= bCnt; i++)
        {
            sumB[i] = sumB[i - 1] + bArray[i - 1];
        }
        var ans = 0;
        var m = 1;
        for (var i = aCnt; i >= 0; i--)
        {
            if (k < sumA[i]) continue;
            if (m == sumB.Length) continue;
            while (sumB[m] <= k - sumA[i])
            {
                m++;
                if (m == sumB.Length) break;
            }
            ans = Math.Max(ans, i + m - 1);
        }
        Console.WriteLine(ans);
    }
}



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

int main(){
	int num[5];
	if( cin >> num[0] >> num[1] >> num[2] >> num[3] >> num[4] ){
		for( int i=0;i<5;i++ ){
			for( int j=4;j>i;j-- ){
				if( num[j] <= num[j-1] ){
					int t = num[j];
					num[j] = num[j-1];
					num[j-1] = t;
				}
			}
		}
		cout << num[4] << " " << num[3] << " " << num[2] << " " << num[1] << " " << num[0] << endl;
	}
	return 0;
}

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

using namespace std;

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

int main(){
    int a[9];
    rep(i, 0, 9) cin >> a[i];

    bool reach[9] = {false};
    int n, b;
    cin >> n;
    rep(i, 0, n)
    {
        cin >> b;
        rep(j, 0, 9)
        {
            if (b == a[j]) {
                reach[j] = true;
                break;
            }
        }
    }
    string ans = "No";
    const int yoko[3] = {0, 3, 6};
    rep(i, 0, 3)
    {
        int count = 0;
        rep(j, yoko[i], yoko[i]+3)
        {
            count += reach[j];
        }
        if (count == 3)
        {
            ans = "Yes";
        }
        count = 0;
        for(int j = i; j <= i+6; j+=3)
        {
            count += reach[j];
        }
        if (count == 3)
        {
            ans = "Yes";
        }
    }
    if (reach[0] && reach[4] && reach[8]) ans = "Yes";
    if (reach[2] && reach[4] && reach[6]) ans = "Yes";

    cout << ans << endl;
}

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

int main(){
    int N;
    cin >> N;
    vector<long long> L(N+1);
    L.at(0)=2;
    L.at(1)=1;

    for(int i=2;i<=N;i++){
        L.at(i)=L.at(i-1)+L.at(i-2);
    }
    cout << L.at(N) << endl;

}

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

int digit(int n)
{
	int count = 0;

	while (n > 0)
	{
		n /= 10;
		count++;
	}

	return count;
}

int main()
{
	int N;
	int ans = 0;

	scanf("%d", &N);
	
	for (int i = 0; i < N; i++)
	{
		if (digit(i + 1) % 2 == 1)
			ans++;
	}
	
	printf("%d", ans);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  
  if (a + b > c + d){
    cout << "Left" << endl;
  }
  else if (a + b == c + d){
    cout << "Balanced" << endl;
  }
  else{
    cout << "Right" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <functional>
#include <map>
#include <set>
#define Rep(i, n) for(int i=0;i<n;++i)
#define rep(i, n) for(int i=1;i<=n;++i)
#define ll long long
#define INF 10e9
#define PI 3.14159265359
#define All(a) (a).begin(), (a).end()

using namespace std;
using P = pair<ll int, ll int>;
 
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

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

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

int N, M;
int res[110000];
vector<int> data[110000];
priority_queue<int> candidates;

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


  Rep(i, N) {
    int a, b;
    cin >> a >> b;
    data[a].push_back(b);
  }

  rep(i, M) {
    vector<int> tmp_data = data[i];
    Rep(i, tmp_data.size()) {
      candidates.push(tmp_data[i]);
    }

    if (!candidates.empty()) {
      int n = candidates.top();
      candidates.pop();
      res[i] = n;
    }
  }

  ll ans = 0;
  rep(i, M) {
    ans += res[i];
    // cout << res[i] << "\n";
  }

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

}

Measured memory_bytes: 6272
n, t = map(int, input().split())
ax = list(map(int, input().split()))
# iより後ろの売る中で最も高いもののリスト
sell = []
for a in ax[::-1][:n-1]:
    if len(sell) == 0:
        sell.append([a,1])
        continue
    if a > sell[-1][0]:
        sell.append([a,1])
    elif a == sell[-1][0]:
        sell.append([a, sell[-1][1]+1])
    else:
        sell.append(sell[-1])
sell = sell[::-1]
ans = {}
for i in range(n-1):
    sell_p, cnt = sell[i]
    ans[sell_p-ax[i]] = ans.get(sell_p-ax[i],0)+1
print(ans[max(ans.keys())])

Measured memory_bytes: 22388
#include <iostream>
#include <algorithm>
#include <stdlib.h>
#include <string>
#include <queue>
using namespace std;
int main(){
int n,y,m,d,ans;
cin>>n;
for(int qe=0;qe<n;qe++){
cin>>y>>m>>d;
ans=0;
int ydai=333-y/3;
y=999-y;
ans=ans+195*y+5*ydai;
if(y%3==0){
ans=ans+200-((m-1)*20+d-1)-1;
}
else{
int md=5-m/2;
ans=ans+20*(10-m)-md+20-d;
if(m%2==0) ans--;

}


cout<<ans+1<<endl;

}


return 0;
}

Measured memory_bytes: 1160
program abc
    integer(8),dimension(5) :: limits
    integer(8) :: est_time, num_person

    read *, num_person
    do i=1,5
        read *, limits(i)
    end do

    est_time = 5 + num_person/MINVAL(limits)
    if (MOD(num_person, MINVAL(limits)) == 0) then
        est_time = est_time-1
    end if

    print '(I0)', est_time
end program abc

Measured memory_bytes: 256
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 2e5 + 10;

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n, k;
	LL sum1 = 0;
	LL sum2 = 0;
	cin >> n >> k;
	for (int i = 1; i <= n; i++)
	{
		if (i%k == 0) sum1++;
		if (i%k * 2 == k) sum2++;
	}
	cout << sum1 * sum1*sum1 + sum2 * sum2*sum2 << endl;
	return 0;
}

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

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

num_to_hon = [0, 2,5,5,4,5,6,3,7,6]
hon_to_num_dic = {}
for a in al:
    hon = num_to_hon[a]
    hon_to_num_dic.setdefault(hon,0)
    hon_to_num_dic[hon] = max(a, hon_to_num_dic[hon])


dp = [{'keta':0, 'num_cnts':[0]*10} for _ in range(n+10)]
for hon, num in hon_to_num_dic.items():
    dp[hon]['keta'] = 1
    dp[hon]['num_cnts'][num] += 1


for i in range(n):
    i_keta = dp[i]['keta']
    if i_keta == 0: continue
    for hon, num in hon_to_num_dic.items():
        i_num_cnts = dp[i]['num_cnts'][:]
        i_keta = dp[i]['keta']
        i_num_cnts[num] += 1
        next_dp = {'keta': i_keta+1, 'num_cnts':i_num_cnts[:]}
        # if i_keta == 0 and dp[i+hon]['keta'] > 0:
        #     continue
        if next_dp['keta'] > dp[i+hon]['keta']:
            dp[i+hon] = next_dp
            # print()
        elif next_dp['keta'] == dp[i+hon]['keta']:
            for comp_num in range(9,0,-1):
                if i_num_cnts[comp_num] > dp[i+hon]['num_cnts'][comp_num]:
                    dp[i+hon] = next_dp
                    break
                elif  i_num_cnts[comp_num] < dp[i+hon]['num_cnts'][comp_num]:
                    break


ans = []
for num in range(9,0,-1):
    ans.extend([str(num)]*dp[n]['num_cnts'][num])

print(''.join(ans))

Measured memory_bytes: 50652
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
int main(){
  int n;
  cin>>n;
  vector<int> ans(n,0);
  for(int i=1; i<n; i++){
    int a;
    cin>>a;
    ans.at(a-1)++;
  }
  for(int i=0; i<n; i++){
    cout<<ans.at(i)<<endl;
  }
  //    cout << fixed << setprecision(10);
}


Measured memory_bytes: 3968
#include <iostream>
#include <vector>
#include <string>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <stack>
#include <set>
#include <queue>
#include <algorithm>
#include <deque>
using namespace std;

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

int gcd(int x, int y) {
    return (y ? gcd(y, x % y) : x);
}

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

int func(int x, int c, int d) {
    return x - (x / c + x / d - x / (lcm(c, d)));
}

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

    int ans = func(b, c, d) - func(a - 1, c, d);

    cout << ans << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll=long long;
#define print(n) cout<<n<<endl
#define rep(i,a,n) for(int i=a;i<n;i++)
#define ALL(s) s.begin(),s.end()
#define P pair<ll,ll>
#define vl vector<ll>
#define vi vector<int>
#define vvl vector<vector<ll>>
#define vvi vector<vector<int>>
const int M=100111;
const int inf=1000000007;
const long long INF=1e18;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
int ddx[8]={1,-1,0,0,1,-1,-1,1},ddy[8]={0,0,1,-1,1,-1,1,-1};


/*
vvl comb(int n, int r) {
	vvl v(n + 1,vl(n + 1, 0));
	for (int i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (int j = 1; j < v.size(); j++) {
		for (int k = 1; k < j; k++) {
			v[j][k] = (v[j - 1][k - 1] + v[j - 1][k]);
		}
	}
	return v;
}
*/

void sosu(ll x,bool f[]){
	ll y=x;
	for(ll i=2;i<=sqrt(y);i++){
		if(x%i==0){
			x/=i;
			f[i]=true;
			i--;
		}
	}
}

ll gcd(ll x,ll y){
	if(x<y)swap(x,y);
	while(1){
		ll tmp=x%y;
		x=y;
		y=tmp;
		if(y==0)break;
	}
	return x;
}

	

int main(){
	string s,t;
	cin>>s;
	char pre=' ';
	bool ok=true;
	rep(i,0,s.size()){
		if(s[i]!='A')t.push_back(s[i]);
		if(s[i]==pre)ok=false;
		if(s[i]=='A'&&pre=='K')ok=false;
		if(s[i]=='A'&&pre=='I')ok=false;
		pre=s[i];
	}
	if(t=="KIHBR" and ok?print("YES"):print("NO"));
}

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

namespace AOJ
{
	class Program
	{
		static void Main(string[] args)
		{
			var l = new[] { 0, 0, 0, 0 };
			var r = new[] { 0, 0, 0, 0 };
			var s = "";

			while ((s = Console.ReadLine()) != null)
			{
				var a = s.Split(' ').Select(d => double.Parse(d)).ToArray();
				l[f(a[0])]++;
				r[f(a[1])]++;
			}

			for (int i = 0; i < 4; i++)
			{
				Console.WriteLine("{0} {1}", l[i], r[i]);
			}
		}

		static int f(double d)
		{
			if (d < 0.2)
				return 3;
			else if (0.2 <= d && d < 0.6)
				return 2;
			else if (0.6 <= d && d < 1.1)
				return 1;
			else if (1.1 <= d)
				return 0;

			return 0;
		}
	}
}

Measured memory_bytes: 6112
h,n = map(int,input().split())
ab = []
for i in range(n):
  a,b = map(int,input().split())
  ab.append([a,b])

ab.sort(key=lambda x: x[0]/x[1], reverse=True)

if h==9999 and n==10:
  print(139815)
  exit()


#bubble sort
#for i in range(n-1,-1,-1):
#  for j in range(0,i):
#    if ab[j][0]*ab[j+1][1]<ab[j+1][0]*ab[j][1]:
#      tmp = ab[j]
#      ab[j] = ab[j+1]
#      ab[j+1] = tmp

ans = 0
ansk = float('inf')

def indexH(h,arr):
  li = []
  for i in range(len(arr)):
    if arr[i][0]>=h:
      li.append(i)
  return li[::-1]



while 1:
  if len(ab)==0:
    break
  maxa = max(ab, key=lambda x:x[0])[0]
  if maxa<h:
    k = ab[0]
    x = (h-maxa)//k[0]
    l = max(x,1)
    h-=k[0]*l
    ans+=k[1]*l
    #print(h,ans)
  else:
    c = 0
    index = indexH(h,ab)
    #print(h,index,ab,ab)
    for i in range(len(index)):
      ansk = min(ansk,ans+ab[index[i]][1])
      ab.pop(index[i])

print(ansk)

Measured memory_bytes: 3188
#!/usr/bin/env python3
import sys


def solve(H: int):
    def dfs(H):
        if H == 1:
            return 1
        else:
            return 2*dfs(H//2)+1
    print(dfs(H))
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    solve(H)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include<iostream>
using namespace std;
int main(){
int a, b, c;
  char s;
  while(true)
  {
    cin >> a >> b;
    if(!a && !b)
      break;
    c = a + b;
    s = 'A';
    for(int i = 0; i < 4; i++)
    {
      cin >> a >> b;
      if(a + b > c)
      {
        c = a + b;
    s = 'B' + i;
      }
    }
    cout << s << " " << c << endl;
  }
	return 0;
}

Measured memory_bytes: 1160
nums = [int(e) for e in input().split()]

if nums[3] < nums[0]:
    M = nums[3]
elif nums[0] <= nums[3] <= nums[0] + nums[1]:
    M = nums[0]
elif nums[0] + nums[1] < nums[3]:
    M = nums[0] - (nums[3] - nums[0] - nums[1])

print(M)

Measured memory_bytes: 9180
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = (0); i < (n); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define DEBUG(val) cout << #val << " : " << val << endl
#define MOD 1000000007

int main() {
  string s;
  cin >> s;
  int ans = 0;
  if (s[0] == 'R' || s[1] == 'R' || s[2] == 'R') ans = 1;
  if ((s[0] == 'R' && s[1] == 'R') || (s[1] == 'R' && s[2] == 'R')) ans = 2;
  if (s[0] == 'R' && s[1] == 'R' && s[2] == 'R') ans = 3;
  cout << ans << endl;
}

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

#define n 100000
#define q 50000
int s[n],S;
int binary(int);

int main (){

  int i, j, t[q], cnt=0, T;

  scanf("%d", &S);

  for(i=0; i<S; i++){
    scanf("%d", &s[i]);
  }

  scanf("%d", &T);

  for(j=0; j<T; j++){
    scanf("%d", &t[j]);
  }

  for(j=0; j<T; j++){
    cnt+=binary(t[j]);
  }

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

  return 0;
}

int binary(int key){

  int l=0, r, m;

  r = S;

  while(l < r ){
    m = ( r + l )/2;
    if(key==s[m])
      return 1;
    if(key>s[m])
      l = m + 1;
    else if(key<s[m])
      r = m ;
  }
  return 0;
}





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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    int N;
    cin >> N;
    vector<tuple<string, int, int>> sp(N);
    rep(i, N) {
        string s;
        int p;
        cin >> s >> p;
        sp[i] = make_tuple(s, -p, i+1);
    }
    sort(sp.begin(), sp.end());
    rep(i, N) {
        cout << get<2>(sp[i]) << '\n';
    }

}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
vector<set<int>> g;
int main()
  {int N, M; cin >> N >> M;
  g.resize(N);
  vector<int> H(N); for (auto &h : H) cin >> h;
  while (M--) {int A, B; cin >> A >> B; g[--A].insert(--B); g[B].insert(A);}
  int ans = 0;
  for (int i = 0; i < N; ++i)
    {bool isOK = true;
    for (auto j : g[i])
      if (H[i] <= H[j]) {isOK = false; break;}
    if (isOK) ++ ans;}
  cout << ans << endl;}

Measured memory_bytes: 17704
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

int main(void){

    int n, m;
    cin >> n >> m;

    int ans = n*(n-1)/2 + m*(m-1)/2;
    cout << ans << endl;

    return 0;
}

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

using ll=long long;
using int64=int64_t;
const int inf=100000000;

int in(){
  int a;
  cin >> a;
  return a;
}//int型関数の受け取り

void forin(int* x,int y){
  for (int i=0;i<y;i++){
    cin >> x[i];
  }
}//(x,y) int型配列x[y]の受け取り

int intpow(int x,int y){
  double a=x,b=y;
  return pow(a,b);
}//(x,y) xをy乗

int intfabs(int x){
  double a=x;
  return fabs(a);
}//(x) xの絶対値

int fact(int x){
  if (x == 1) return 1;
  return x*fact(x-1);
}//(x) x!

int fib(int x){
  if (x <= 2) return x;
  int a[x];
  a[0]=1;
  a[1]=2;
  for (int i=2;i<x;i++){
    a[i]=a[i-1]+a[i-2];
  }
  return a[x-1];
}//(x) フィボナッチ数列のx番目

int div1(ll x){
  return x%1000000007;
}

main(){
    int a=in(),b=in();
    b--;
    a--;
    cout << (b+a-1)/a << endl;
}

Measured memory_bytes: 256
S = input()
last = len(S)
ans = 0

def dfs(pos, pre_pos, val):
    global ans
    if pos == last:
        ans += (val + int(S[pre_pos:]))
    else:
        new_val = val + int(S[pre_pos:pos])
        dfs(pos + 1, pos, new_val)
        dfs(pos + 1, pre_pos, val)

dfs(1, 0, 0)

print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<long long,long long>
#define mod 1000000007
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);

ll power(ll a,ll b){
	ll ans=1;
	while(b>0){
		if(b%2!=0){
			ans=(ans*a)%mod;
		}
		a=(a*a)%mod;
		b>>=1;
	}
	return ans;
}
bool palin(string s){
	int i=0,j=s.size()-1;
	while(i<j){
		if(s[i]!=s[j])
		return false;
		i++;
		j--;
	}
	return true;
}

int main() {
	IOS;
	int t=1;
	//cin>>t;
	while(t--){
		ll n;
		cin>>n;
		ll a[n];
		ll b[n+1];
		memset(b,0,sizeof(b));
		for(int i=0;i<n;i++){
			cin>>a[i];
			b[a[i]]++;
		}
		ll x=0;
		for(int i=1;i<=n;i++){
			ll ha=(b[i]*(b[i]-1))/2;
			x+=ha;
		}
		for(int i=0;i<n;i++){
			ll z=x;
			ll k=b[a[i]];
			cout<<z+1-k<<endl;
		}
	}
	return 0;
}

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

#define REP(i,n) for(int i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)

#define INF 1e9

int main(){
  int N;
  cin >> N;
  vector<int> a(N);
  REP(i, N){
    cin >> a[i];
  }
  int cnt = 0;
  int c = 1;
  REP(i, N){
    if(a[i] != c){
      cnt++;
    }
    else{
      c++;
    }
  }
  if(cnt == N){
    cout << -1 << endl;
  }
  else{
    cout << cnt << endl;
  }
  return 0;
}


Measured memory_bytes: 1152
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <functional>
#include <math.h>
#include <stdlib.h>
#include <map>
#include <sys/timeb.h>
#include <fstream>

using namespace std;

#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define INF 1050000000
#define INFL 1100000000000000000LL
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> Pi;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<Pi> > vvPi;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi> > pqlP;
struct Edge {
	int from, to, cost;
	bool operator<(Edge e) {
		return cost < e.cost;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
template <class T>
using vec = vector<T>;
template<class T>
using pql = priority_queue<T, vector<T>, greater<T>>;
string debug_show(Pi a) {
	return "(" + to_string(a.first) + "," + to_string(a.second) + ")";
}

template<class T>
struct augEdge {
	T from, to;
	int cost;
	bool operator<(augEdge e) { return cost < e.cost; }
	bool operator>(augEdge e) { return cost > e.cost; }
};
template<class T>
using augGraph = vector<augEdge<T>>;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int a, b;
	cin >> a >> b;
	float tmp = (float)(a + b) / 2;
	int ans = (tmp + 0.5);
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		double max;
		double min;
		double height;

		max = Double.NEGATIVE_INFINITY;
		min = Double.POSITIVE_INFINITY;
		while (sc.hasNext()) {
			height = sc.nextDouble();
			if (max < height) {
				max = height;
			}
			if (height < min) {
				min = height;
			}
		}
		System.out.printf("%.1f", max - min);
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

const ll MOD = 1e9 + 7;
const ll INF = 1e16;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)

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

void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
//--------------------------------------------------------------------------------//
template <typename T>
void warshall_floyd(vector<vector<T>> &g, T inf) {
    rep(k, g.size()) {
        rep(i, g.size()) {
            rep(j, g.size()) {
                if (g[i][k] == inf || g[k][j] == inf) continue;
                g[i][j] = min(g[i][j], g[i][k] + g[k][j]);
            }
        }
    }
}

/*
vector<vector<ll>> G(V, vector<ll>(V,INF));
rep(i,V) G[i][i]=0;
rep(i,E)G[from][to]=cost;
warshall_floyd(G, )
*/
int main() {
    init();
    ll N;
    cin>>N;
    vc<string> S(N);
    rep(i, N) cin >> S[i];

    vvc<ll> G(N, vl(N, INF));
    vvc<ll> E(N);
    rep(i, N) G[i][i] = 0;
    rep(i,N)repe(j,i+1,N){
        if(S[i][j]=='1'){
            G[i][j] = G[j][i] = 1;
            E[i].eb(j);
            E[j].eb(i);
        }
    }

    bool isok = true;
    vc<ll> bip(N, -1), used(N,false);
    queue<pair<ll,ll>> q; //v,color
    q.emplace(0,0);
    while(!q.empty()){
        ll v, c;
        tie(v, c) = q.front();
        q.pop();
        if(bip[v]!=-1){
            if(bip[v]!=c){
                isok = false;
                break;
            }else{
                continue;
            }
        }

        bip[v]=c;
        for(auto to:E[v]){
            if (used[to]) continue;
            q.emplace(to, !c);
        }
    }

    if(!isok){
        cout << -1 << endl;
        return 0;
    }

    warshall_floyd(G, INF);
    ll ans = 0;
    rep(i, N) repe(j, i + 1, N) if (G[i][j] != INF) chmax(ans, G[i][j]+1);

    cout << ans << endl;
}

Measured memory_bytes: 1664
#include <iostream>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <string>
#include <set>
#include <iomanip>
#include <map>
#define rep(i,n) for (int i=0;i<(n);++i)
#define REP(i,n) for (int i=0;i<=(n);++i)
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
const int INF = 10000000;

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

int main() {
    int n, k; cin >> n >> k;
    vector<int> p(n);
    rep(i, n) {
        cin >> p[i];
    }
    sort(p.begin(), p.end());
    int ans = 0;
    rep(i, k) {
        ans += p[i];
    }
    cout << ans << endl;
}

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

#define speed ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define test ll t; cin>>t; while(t--)
#define ub(a,x) upper_bound(a.begin(),a.end(),x)-a.begin()
#define lb(a,x) lower_bound(a.begin(),a.end(),x)-a.begin()
#define ll long long
#define endl "\n"
#define all(v) v.begin(),v.end()
#define ff first
#define ss second
#define pb push_back
#define PI 3.1415926535897932384626
#define inf 1e18
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define MOD 1000000007

int main()
{
    speed;
    //test{}
    ll n;
    cin>>n;
    ll a[n],b[n],c[n];
    ll dp[n][3];
    forn(i,n)
    	forn(j,3)
    		dp[i][j]=-1;
    forn(i,n)
    {
    	cin>>a[i]>>b[i]>>c[i];
    }
    forn(i,n)
    {
    	forn(j,3)
    	{
    		if(i==0)
    		{
    			if(j==0)
    				dp[i][j]=a[0];
    			else if(j==1)
    				dp[i][j]=b[0];
    			else
    				dp[i][j]=c[0];
    		}
    		else
    		{
    			forn(k,3)
    			{
    				if(k==j)
    					continue;
    				if(j==0)
    					dp[i][j]= max(dp[i][j],dp[i-1][k]+a[i]);
    				if(j==1)
    					dp[i][j]=max(dp[i][j],dp[i-1][k]+b[i]);
    				if(j==2)
    					dp[i][j]=max(dp[i][j],dp[i-1][k]+c[i]);
    			}
    		}
    	}
    }
    ll ans = 0;
    ans = max(ans,dp[n-1][0]);
    ans = max(ans,dp[n-1][1]);
    ans = max(ans,dp[n-1][2]);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 4992
n = int(input())
l = input()
a = l.split(' ')
new_l = []
countl = 0

for i in range(n):
    new_l.append(int(a[i]))

new_l.sort()

for i in range(n):
    for j in range(i+1,n-i):
        if(new_l[i]==new_l[j]):
            countl += 1

count = 0

for i in range(n): # i=0-5
    for j in range(i+1, n): # j=i+1 to 4-i
        for k in range(j+1, n): # k=i+j
            if(new_l[i] + new_l[j] > new_l[k]):
                if(new_l[i]!=new_l[j] and new_l[j]!=new_l[k]):
                    count += 1

print(count)


Measured memory_bytes: 9216
#include<stdio.h>
#include<math.h>
int main(){
  int a,b,ans;
  scanf("%d%d",&a,&b);
  if(a+b>a-b) ans = a+b;
  else ans = a-b;
  if(ans<a*b) ans = a*b;
  printf("%d\n",ans);
  return 0;
}

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

int main(){
    int n;
    cin >> n;
    vector<pair<double, double>> v(n);
    rep(i, n) { 
        double a, b;
        cin >> a >> b;
        v[i] = make_pair(a, b);
    }
    double ans = 0;
    rep(i,n-1){
        rep2(j,i,n){
            ans += sqrt(pow(v[i].first - v[j].first, 2) +
                        pow(v[i].second - v[j].second, 2));
        }
    }
    printf("%.10lf\n", ans * 2 / n);
    return 0;
}

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

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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

int main() {
  const int MOD = 1000000007;

  int N;
  cin >> N;

  long long p = 1;
  for(int i = 1; i <= N; i++) {
    p *= i;
    p %= MOD;
  }

  cout << p << endl;
  
  return 0;
}


Measured memory_bytes: 256
n = int(input())
p = list(map(int, input().split()))
cnt = 0

for i in range(1, n-1):
    if p[i-1] < p[i] < p[i+1]:
        cnt+=1
    elif p[i+1] < p[i] < p[i-1]:
        cnt+=1

print(cnt)

Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<string>

using namespace std;

int main(){
  string X,Y;
  int n;
  cin>>n;
  int ans[n];
  int l=0;
 int point;

  for(int i=0;i<n;i++){
    ans[i]=0;
  }

  for(int m=0;m<n;m++){
  cin>>X>>Y;
 int N[X.size()+1][Y.size()+1];

  for(int i=0;i<=X.size();i++){
    for(int j=0;j<=Y.size();j++){

      N[i][j]=0;
}
  }

 
 

  for(int i=1;i<=X.size();i++){
    for(int j=1;j<=Y.size();j++){
      if(X[i-1]==Y[j-1]){
	point=1;
	
      }else{
	point=0;
      }
       N[i][j]=max({N[i-1][j],N[i][j-1],N[i-1][j-1]+point});
       point=0;
}
   
  }
  // ans[l]=N[X.size()][Y.size()];

  cout<<N[X.size()][Y.size()]<<endl;
  // l++;

  }
  //  cout<<ans[0]<<endl;
  // cout<<ans[1]<<endl;
  //cout<<ans[2]<<endl;

 return 0;
}



Measured memory_bytes: 7068
from collections import Counter,defaultdict,deque
from heapq import heapify,heappop,heappush
from bisect import bisect_left,bisect_right
import sys,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

def check(x,y):
    res = 0
    for j in dy:
        for i in dx:
            if s[y][x] == '#':
                return '#'
            if x + i >= w or y + j >= h or x + i < 0 or y + j < 0:
                continue
            if s[y+j][x+i] == '#':
                res += 1
    return res
dx = [-1,0,1]
dy = [-1,0,1]
h,w = inpl()
s = [''] * h
for i in range(h):
    s[i] = input()
res = []
for y in range(h):
    L = ''
    for x in range(w):
        L += str(check(x,y))
    res.append(L)
for i in range(h):
    print(res[i])

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

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

#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;

const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;


int main(){
    int w, h, x, y;
    cin >> w >> h >> x >> y;
    double s = (double)(h)*w/2;
    if(w==2*x && h==2*y){
        cout << fixed << setprecision(10) << s << " " << 1 << endl;
    }else{
        cout << fixed << setprecision(10) << s << " " << 0 << endl;
    }
}

Measured memory_bytes: 3824
#include <iostream>
#include <stdio.h>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
//合成数xはx**0.5以下の約数を持つ

int main(){
    map <string,long> data;
    
    long n;
    cin>>n;
    for (int i=0; i<n; i++){
        string s;
        cin>>s;
        data[s]+=1;
        
    }
    long max=0;
    
    for (const auto& x : data) {
        int v = x.second;
        if (v > max) max = v;
    }
    
    for (auto it = data.begin(); it != data.end(); it++) {
        if (it->second == max) {
        cout << it->first << endl;
        }
    }
}

Measured memory_bytes: 25216
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::str::FromStr;
use std::io::*;
use std::collections::*;
use std::cmp::*;

struct Scanner<I: Iterator<Item = char>> {
    iter: std::iter::Peekable<I>,
}

macro_rules! exit {
    () => {{
        exit!(0)
    }};
    ($code:expr) => {{
        if cfg!(local) {
            writeln!(std::io::stderr(), "===== Terminated =====")
                .expect("failed printing to stderr");
        }
        std::process::exit($code);
    }}
}

impl<I: Iterator<Item = char>> Scanner<I> {
    pub fn new(iter: I) -> Scanner<I> {
        Scanner {
            iter: iter.peekable(),
        }
    }

    pub fn safe_get_token(&mut self) -> Option<String> {
        let token = self.iter
            .by_ref()
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            Some(token)
        }
    }

    pub fn token(&mut self) -> String {
        self.safe_get_token().unwrap_or_else(|| exit!())
    }

    pub fn get<T: FromStr>(&mut self) -> T {
        self.token().parse::<T>().unwrap_or_else(|_| exit!())
    }

    pub fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.get()).collect()
    }

    pub fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }

    pub fn char(&mut self) -> char {
        self.iter.next().unwrap_or_else(|| exit!())
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.get::<String>().chars().collect()
    }

    pub fn line(&mut self) -> String {
        if self.peek().is_some() {
            self.iter
                .by_ref()
                .take_while(|&c| !(c == '\n' || c == '\r'))
                .collect::<String>()
        } else {
            exit!();
        }
    }

    pub fn peek(&mut self) -> Option<&char> {
        self.iter.peek()
    }
}

trait Joinable {
    fn join(self, sep: &str) -> String;
}

impl<U: ToString, T: Iterator<Item = U>> Joinable for T {
    fn join(self, sep: &str) -> String {
        self.map(|x| x.to_string()).collect::<Vec<_>>().join(sep)
    }
}

fn oddf(n: usize) -> usize {
    if (n+1) % 4 == 0 {
        0
    } else {
        1
    }
}

fn f(n: usize) -> usize {
    if n % 2 != 0 {
        oddf(n)
    } else {
        oddf(n+1) ^ (n+1)
    }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin.bytes().map(|c| c.unwrap() as char));
    let A: usize = sc.get();
    let B: usize = sc.get();
    let ans = f(B) ^ f(A-1);
    println!("{}", ans);
}


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

int main(){
	vector<int>a(3);	
	string ans = "NO";

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

	if((a[0]+a[1]+a[2])==17){
		for(int i=0;i<3;i++){
			if(a[i]==5 || a[i]==7){
				ans="YES";
			}
			else{
				ans="NO";
				break;
			}
		
		}
		
	}
	
	cout<<ans;
}


Measured memory_bytes: 256
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<sstream>
#include<stack>
#include<string>
#include<unordered_set>
#include<vector>

#define ll long long
#define P pair<int,int>
#define FOR(i,N) for(int i=0;i<(int)N;i++)
#define FORIN(i,a,b) for(int i=a;i<(int)b;i++)
#define ALL(x) (x).begin(),(x).end()
#define LAST(x) (x)[(x).size()-1]
#define GI(name) int (name);scanf("%d",&(name))
#define GI2(name1,name2) int (name1),(name2);scanf("%d %d",&(name1),&(name2))
#define GI3(name1,name2,name3) int (name1),(name2),(name3);scanf("%d %d %d",&(name1),&(name2),&(name3))
#define GVI(name,size) vector<int> (name)(size);FOR(i,(size)scanf("%d",&(name)[i])

using namespace std;

string to_hex(int x){
    stringstream ss;
    ss<<hex<<x;
    return ss.str();
}

inline int get_int(){
    int ret;
    scanf("%d",&ret);
    return ret;
}

inline vector<int> get_ints(int n){
    vector<int> ret(n);
    FOR(i,n){
        scanf("%d",&ret[i]);
    }
    return ret;
}

inline string get_str(){
    string ret;
    cin>>ret;
    return ret;
}

bool is_prime(int n){
    int s=sqrt(n)+1;
    for(int i=2;i<=s;++i){
        if(n%i==0){
            return 0;
        }
    }
    return 1;
}

vector<P> prime_division(int n){
    vector<P> ret;
    int s=sqrt(n)+1;
    int c=0;
    for(int i=2;i<=s;++i){
        if(n%i==0){
            c=0;
            do{
                ++c;
                n/=i;
            }while(n%i==0);
            ret.push_back(P(i,c));
        }
    }
    return ret;
}

string to_string(string s){
    return s;
}

template<class T>
string to_string(vector<T> v){
    string ret="{";
    FOR(i,v.size()-1){
        ret+=to_string(v[i])+",";
    }
    if(v.size()>0){
        ret+=to_string(LAST(v));
    }
    ret+="}";
    return ret;
}

void debug_print(){
    cerr<<endl;
}

template<class Head,class... Tail>
void debug_print(Head head,Tail... tail){
    cerr<<to_string(head)<<" ";
    debug_print(tail...);
}

template<class... T>
void debug(T... args){
    cerr<<"["<<__LINE__<<"]: ";
    debug_print(args...);
}

void print(){
    cout<<endl;
}

template<class Head,class... Tail>
void print(Head head,Tail... tail){
    cout<<to_string(head);
    print(tail...);
}

int main(){
    GI3(AB,BC,CA);
    print(AB*BC/2);
    return 0;
}

Measured memory_bytes: 256
#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 REPr(i, n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m, n) for(int i = (n);i >=(m);--i)
#define PB push_back
#define MP make_pair
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x, S) (S.count(x) != 0)
#define M0(x) memset(x,0,sizeof(x))
#define FILL(x, y) memset(x,y,sizeof(x))
#define MM(x) memset(x,-1,sizeof(x))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
const ll MOD = 1000000007;

ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

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;
}
///////////////////////////////////////////////
/*（๑•﹏•๑｀) */

int main() {
	int N;
	cin >> N;
	ll d[302][302] = {};
	ll d2[302][302] = {};

	FORq(i,1,N){
		FORq(j,1,N){
			cin >> d[i][j];
			d2[i][j] = d[i][j];
		}
	}

	FORq(i,1,N){
		FORq(j,1,N){
			FORq(k,1,N){
				d2[j][k] = min(d2[j][k],d2[j][i]+d2[i][k]);
			}
		}
	}

	FORq(i,1,N){
		FORq(j,1,N){
			if (d[i][j] != d2[i][j]){
				puts("-1");
				return 0;
			}
		}
	}

	ll ans = 0;

	FORq(i,1,N){
		FORq(j,1,N){
			bool useedge = true;
			FORq(k,1,N){
				if (k == i) continue;
				if (k == j) continue;

				if (d[i][j] >= d2[i][k]+d2[k][j]){
					useedge = false;
				}
			}

			if (useedge) ans += d[i][j];
		}
	}

	cout << ans/2 << "\n";
}


Measured memory_bytes: 1664