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

//type
#define ll long long
typedef pair<int, int> P;
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素
#define Z class
// OTHER
// xの二乗を返す (関数テンプレート版)
template <typename T>
T square(T x) { return x * x; }
#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))
// loop
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= ll(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= ll(b); i--)
#define FORA(i, I) for (const auto &i : I)

// vector
#define ALL(x) x.begin(), x.end()

// output
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n", (x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define ln cout << '\n'
template <Z A>
void pr(A a)
{
  cout << a;
  ln;
}
template <Z A, Z B>
void pr(A a, B b)
{
  cout << a << ' ';
}

int ans = 0;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

int main()
{
  int a, b, c, n, x, y;
  string s;
  cin >> n;
  rep(i, n)
      ans += (i + 1);
  pr(ans);
  return 0;
}

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

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

    int H[N];

    for(int i = 0; i < N; i++){
        cin >> H[i];
    }

    int cou = 1;
    int max = H[0];

    for(int i = 1; i < N; i++){
        if(max <= H[i]){
            cou++;
            max = H[i];
        }
    }

    cout << cou << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
    using namespace std;
 
    #define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
    #define mod 1000000007
    #define qmod 998244353
    #define M 1000001
    #define endl "\n"
    #define all(a) (a).begin(),(a).end()
    #define rep(i,a,b) for(int i=a;i<b;++i)
    #define repr(i,a,b) for(int i=a;i>=b;--i)
    #define F first
    #define S second
    #define pb push_back
    #define mp make_pair

    typedef long long ll;
    typedef pair<int,int> pii;
    typedef vector<int> vi;
    typedef vector<string> vs;
    typedef vector<pii> vii;
    typedef vector<vi> vvi; 

    int main(){
        
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt","r",stdin); 
    // freopen("output.txt","w",stdout);   
    // #endif  
 
        fast;
        ll n,a,b,ans;
        cin>>n>>a>>b;
        ans=n/(a+b)*a+min(n%(a+b),a);
        cout<<ans;
        return 0;  
    } 

Measured memory_bytes: 256
#!/usr/bin/env python3

#                 N    N'
#   | 1  2  3  4  5
# 1 | 1  2  3  4  5 :  N // 1   1 * N' (N'+1) // 2
# 2 |    2     4    :  N // 2   2 * N' (N'+1) // 2
# 3 |       3       :  N // 3   3 * N' (N'+1) // 2
# 4 |          4    :  N // 4   4 * N' (N'+1) // 2
# 5 |             5 :  N // 5   5 * N' (N'+1) // 2


def solve(N):
    answer = 0
    for i in range(1, N + 1):
        mprime = N // i
        answer += i * (mprime * (mprime + 1)) // 2
    return answer


def main():
    N = int(input())  # type: int
    answer = solve(N)
    print(answer)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9072
n=int(input())

a=[]
b=[]

for i in range(n):
    aa,bb=list(map(int,input().split()))
    a.append(aa*2)
    b.append(bb*2)

a.sort()
b.sort()

if n%2==1:
    amed=a[(n-1)//2]
    bmed=b[(n-1)//2]

    ans=(bmed-amed)//2+1
else:
    amed=(a[n//2-1]+a[n//2])/2
    bmed = (b[n // 2 - 1] + b[n // 2]) / 2

    ans=bmed-amed+1

print(int(ans))

Measured memory_bytes: 25480
#include <bits/stdc++.h>
using namespace std;
int main(){
    // Your code here!
    int n,k;
    cin>>n>>k;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    int dp[n];
    for(int i=0;i<n;i++)
    {
        dp[i]=INT_MAX;
    }
    dp[0]=0;
    for(int i=1;i<n;i++)
    {
        /*int q1=INT_MAX,q2=INT_MAX;
        if(i>=1)
        {
          
            q1=dp[i-1]+abs(a[i]-a[i-1]);
        }
        if(i>=2)
        {
            q2=dp[i-2]+abs(a[i]-a[i-2]);
        }
        dp[i]=min(q1,q2);*/
        for(int j=1;j<=k;j++)
        {
            if(i>=j)
            {
                dp[i]=min(dp[i],dp[i-j]+abs(a[i]-a[i-j]));
            }
        }
    }
    cout<<dp[n-1]<<'\n';
    return 0;
}


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

int dist(int x1, int y1, int x2, int y2) {
	return sqrt(abs(x1-x2)*abs(x1-x2) + abs(y1-y2)*abs(y1-y2));

}
int main()  
{   
    cin.tie(0); ios::sync_with_stdio(false);  
	//freopen("input.txt", "rt", stdin);
	int n, k; cin >> n >> k;
	int a[101];
	int ans = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		int ballx = a[i];
		int bally = i + 1;
			int robotAx = 0;
			int robotAy = i + 1;

			int robotBx = k;
			int robotBy = i + 1;
			int distA = dist(ballx,bally, robotAx, robotAy);
			//cout << "a: " << distA << endl;
			
			int distB =  dist(ballx,bally, robotBx, robotBy);
			//cout << "b: " << distB << endl;
			
			ans += 2*min(distA, distB);
	}

	cout << ans << '\n';

	return 0;   
}  


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef unsigned long long int ulli;
#define vec(s) vector

#define vvec(s) vector<vector
>
typedef vector<lli> vi;
typedef vector<vi> vvi;
typedef pair<lli, lli> pii;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YN(x) cout << (bool x ? "Yes" : "No") << endl;
#define out(s) cout << s << endl;
#define pb(s) push_back(s);
#define sp " ";
#define INF 10000000000
#define all(s) s.begin(), s.end()
void vout(vi v)
{
    for (int i = 0; i < v.size(); i++)
        cout << v.at(i) << endl;
}
int main()
{
    lli h, w, k;
    lli res = 0;
    cin >> h >> w >> k;
    vector<string> ans(h);
    rep(i, h) cin >> ans[i];
    rep(i, pow(2, h))
    {
        rep(j, pow(2, w))
        {
            bitset<6> hi(i);
            bitset<6> wi(j);
            lli cnt = 0;
            rep(k, 6)
            {
                if (k == ans.size())
                {
                    break;
                }
                if (hi[k] == 0)
                {
                    rep(l, 6)
                    {   
                        if(l==ans[0].size()){
                            break;
                        }
                        if(ans[k][l]=='#'){
                            cnt++;
                        }
                    }
                }

            }
            rep(k, 6)
            {
                if(k==ans[0].size()){
                    break;
                }
                if (wi[k] == 0)
                {
                    rep(l, 6)
                    {
                        if(l==ans.size()){
                            break;
                        }
                        if (ans[l][k] == '#'&&hi[l]==0)
                        {
                            cnt--;
                        }
                    }
                }
            }
            if(cnt==k){
                res++;
            }
        }
    }
    out(res);
}

Measured memory_bytes: 4076
//shan61916
#include <bits/stdc++.h>
  using namespace std;
typedef   long long ll;
typedef   unsigned long long ull ;
typedef   double dll ;

#define   mp make_pair
#define   pb push_back
#define   ff first 
#define   ss second
#define   IOS ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define   endl "\n" 
#define   pll pair<ll, ll>
#define   all(x) x.begin(), x.end()
#define   vll vector<ll> 

const ll inf = (ll)(1e17 + 17);
const ll mod = (ll)(1e9 + 7);


int main(){
 IOS
#ifdef SHAN
    freopen("input.txt" , "r" , stdin);  
#endif
  ll n;
  cin >> n;
  vll a(n);
  ll curr = 1;
  ll ct = 0;
  for(ll i = 0; i < n; i++) {
    cin >> a[i];
    if(a[i] == curr) ct++, curr++;
  }
  if(ct == 0) cout << -1 ;
  else cout << n - ct << endl;
  return 0;
} //good night.

Measured memory_bytes: 1792
#include <bits/stdc++.h>
typedef long long i64;
using std::cout;
using std::endl;
using std::cin;

bool f(std::string a, std::string b) {
	if(a.size() > b.size()) return true;
	else if(a.size() == b.size()) {
		for(int i = 0; i < a.size(); i++) {
			if(a[i] > b[i]) return true;
			if(a[i] < b[i]) return false;
		}
	}
	return false;
}

std::string max(std::string a, std::string b) {
	if(f(a, b)) return a;
	return b;
}

std::string min(std::string a, std::string b) {
	if(f(a, b)) return b;
	return a;
}

i64 calc(std::string a, std::string b) {
	for(int i = 0; i < a.size(); i++) {
		if(a[i] == b[i]) continue;
		if(a.size() - i > 18) return 1LL << 60;
		i64 A = stoll(a.substr(i, a.size() - i));
		i64 B = stoll(b.substr(i, b.size() - i));
		return A - B;
	}
	return 0;
}

int main() {
	std::string s; cin >> s;
	i64 ans = 1LL << 60;
	{
		int ma = 0, mi = 1 << 30, c = 0;
		for(int i = 0; i < s.size(); i++) {
			c++;
			if(s[i] == '1' and i + 1 < s.size()) {
				int tmp = stoi(s.substr(i, 2));
				ma = std::max(ma, tmp);
				mi = std::min(mi, tmp);
				i++;
			} else if(s[i]) {
				int tmp = s[i] - '0';
				ma = std::max(ma, tmp);
				mi = std::min(mi, tmp);
			}
		}

		if(c > 1) ans = ma - mi;
	}
	for(int i = 1; i * i <= s.size(); i++) {
		if(s.size() % i) continue;
		std::string ma = "", mi = std::string(s.size() + 1, '9');
		for(int j = 0; j < s.size(); j += i) {
			auto tmp = s.substr(j, i);
			ma = max(ma, tmp);
			mi = min(mi, tmp);
		}
		ans = std::min(ans, calc(ma, mi));
		
		if(i == 1) continue;
		ma = "", mi = std::string(s.size() + 1, '9');
		for(int j = 0; j < s.size(); j += s.size() / i) {
			auto tmp = s.substr(j, s.size() / i);
			ma = max(ma, tmp);
			mi = min(mi, tmp);
		}
		ans = std::min(ans, calc(ma, mi));
	}
	cout << ans << endl;
	return 0;
}



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

int N;
string S[333];

int check(int A,int B){
  rep(i,N) rep(j,N){
    int x=(i+A)%N,y=(j+B)%N;
    int x2=(j+A)%N,y2=(i+B)%N;
    if(S[x][y]!=S[x2][y2]) return 0;
  }
  return 1;
}

int main(){
  cin>>N;
  rep(i,N) cin>>S[i];
  ll ans=0;
  rep(i,N){
    ans+=check(i,0)?N:0;
  }
  cout<<ans<<endl;
  return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> A(N), C;
  map<int, int> MA;
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
    MA[A.at(i)]++;
  }
  sort(A.begin(), A.end());
  C = A;
  int mx = A.at(N - 1);
  C.erase(unique(C.begin(), C.end()), C.end());
  vector<int> B(mx + 1, 1);
  for (int i = 0; i < (int) C.size(); i++) {
    for (int j = C.at(i) + C.at(i); j <= mx; j += C.at(i)) B.at(j) = 0;
  }
  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (MA[A.at(i)] != 1) continue;
    if (B.at(A.at(i))) ans++;
  }
  cout << ans << "\n";
}

Measured memory_bytes: 17840
#include<bits/stdc++.h>
#define Fst first
#define Snd second
#define RG register
#define mp make_pair
#define mem(a,b) memset(a,b,sizeof(a))
using namespace std;
typedef long long LL;
typedef long double LD;
typedef unsigned int UI;
typedef unsigned long long ULL;
template<typename T> inline void read(T& x) {
	char c = getchar();
	bool f = false;
	for (x = 0; !isdigit(c); c = getchar()) {
		if (c == '-') {
			f = true;
		}
	}
	for (; isdigit(c); c = getchar()) {
		x = x * 10 + c - '0';
	}
	if (f) {
		x = -x;
	}
}
template<typename T, typename... U> inline void read(T& x, U& ... y) {
	read(x), read(y...);
}
int n,m;
int In[100010];
//#define rua
int main() {
//	ios::sync_with_stdio(false);
#ifdef rua
	freopen("GG.in","r",stdin);
#endif
  read(n,m);
  for(int i=1;i<=m;++i) {
    int u,v; read(u,v);
    ++In[u]; ++In[v];
  }
  for(int i=1;i<=n;++i) if(In[i]&1) return puts("NO"),0;
  puts("YES");
  return 0;
}



Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
	ll n,k,sum=0,i,count=0;
	cin>>n>>k;
	ll a[n];
	for(i=0;i<n;i++){
		cin>>a[i];
	}
	count=0;
	while(sum<n){
		if(sum+k==n){
			count++;
			break;
		}
		else{
			sum+=k;
			sum--;
			count++;
		}
	}
	cout<<count;
	
}

Measured memory_bytes: 1024
// B - Exponential
#include <bits/stdc++.h>
using namespace std;

int main(){
	int x; cin>>x;
	int ans = 1;
	for(int i=2; i*i<=x; ++i){ // [2, sqrt(x)]
		int a = i*i; // a^2
		while(a <= x){
			ans = max(ans, a);
			a *= i; // a^{2<n}
		}
	}
	cout<< ans <<endl;
}


Measured memory_bytes: 256
def abc114_c():
    import numpy as np
    s = input()
    n = int(s)
    ans = 0

    nums = np.array([3, 5, 7])
    tmp = nums.copy()
    for i in range(1, len(s)):
        tmp = (tmp + [[3 * 10 ** i], [5 * 10 ** i], [7 * 10 ** i]]).flatten()
        nums = np.append(nums, tmp)

    for val in nums:
        str_val = str(val)
        if val <= n and "3" in str_val and "5" in str_val and "7" in str_val:
            ans += 1

    return ans


print(abc114_c())

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

int main(){
  int n;
  cin >> n;
  vector<int> a(3*n);
  for(int i=0;i<3*n;i++) cin >> a[i];
  sort(a.begin(),a.end());
  long long int ans=0;
  for(int i=0;i<n;i++) ans = ans + a[(3*n)-(2*i)-2];
  cout << ans << endl;
  return 0;
}

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

using namespace std;

using ll = long long;

int main() {
  int n;
  cin >> n;
  vector<ll> v(n);
  for (int i = 0; i < n; ++i) {
    cin >> v[i];
  }
  reverse(v.begin(), v.end());
  ll mi = 2, ma = 2;
  for (int i = 0; i < n; ++i) {
    if (mi % v[i])
      mi += v[i] - mi % v[i];
    if (ma % v[i])
      ma -= ma % v[i];
    if (mi > ma) {
      cout << -1 << endl;
      return 0;
    }
    ma += v[i] - 1;
  }
  cout << mi << " " << ma << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>
#include <deque>
using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
const int INF = 1<<29;
const ll MOD = 1000000007;
const int MAX = 200000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// 法mでのaの逆元を計算
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
//最大公約数
int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }
//最小公倍数
int lcm(int x, int y) { return x / gcd(x, y) * y; }
// nが大きく,kが10^7程度の時の二項係数
long long com[200005];
void combination(long long n,long long k){
    com[0] = 1;
    for(int i=1;i<=k;i++){
        com[i] = (com[i-1]*(n-i+1)%MOD)*modinv(i,MOD)%MOD;
    }
}

int main(){
    int N; cin >> N;
    cout << (N+2-1)/2 << endl;
    return 0;
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($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() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input! {
        n: usize,
        a: [i64; n],
    }
    let mut a = a;
    a.sort();
    let mut pos = 1;
    while pos + 1 < n {
        if a[pos] >= 0 {
            break;
        }
        pos += 1;
    }
    let mut m: i64 = 0;
    let mut ops = vec![];
    for i in 0..pos {
        m -= a[i];
    }
    for i in pos..n {
        m += a[i];
    }
    let mut cur = a[pos - 1];
    for i in pos..n - 1 {
        ops.push((cur, a[i]));
        cur -= a[i];
    }
    ops.push((a[n - 1], cur));
    cur = a[n - 1] - cur;
    for i in 0..pos - 1 {
        ops.push((cur, a[i]));
        cur -= a[i];
    }
    assert_eq!(cur, m);
    assert_eq!(ops.len(), n - 1);
    puts!("{}\n", m);
    for i in 0..n - 1 {
        let (a, b) = ops[i];
        puts!("{} {}\n", a, b);
    }
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


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

const int Nmax=200010;
//#define FOR(i,a,b) for(int i=(a);i<(b);i++)
//#definr REP(i,n) FOR(i,0,n)
//#define dump(x) cout << #x << "=" << (x) << endl;
//#define debug(x) cout << #x << "=" << (x) << "(L" << _LINE_ << ")" << "" << _FILE_ << endl;
//ll a[Nmax];
//int* P = new int[N];

int main() {
	int N,X,m[Nmax];
	cin >> N >> X;
	int weight=0,MIN=1000;
	for(int i=0;i < N;i++){
      cin >> m[i];
      weight+=m[i];
    }
	
	for(int i=0;i < N;i++) MIN = min(MIN,m[i]);
	cout << N + (X-weight)/MIN << endl;
	
	return 0;
}

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

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

#define loop(i, n) for(int i = 0;i < n;i++)
#define IINF 2e9
#define MOD 1e9+7

int main(void){

    double x, y;
    cin >> x >> y;

    if((int)y % 2 != 0){
        cout << "No" << endl;
        return 0;
    }

    if(y/2 - x >= 0 && 2*x - y/2 >= 0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 3736
#include<stdio.h>
int main(){
  int n,i,d;
  while(1){
    scanf("%d",&n);
    if(n==0)break;
    int r[7]={0};
    for(i=0;i<n;i++){
      scanf("%d",&d);
      if(d<10)r[0]++;
      else if(d<10)r[0]++;
      else if(d<20)r[1]++;
      else if(d<30)r[2]++;
      else if(d<40)r[3]++;
      else if(d<50)r[4]++;
      else if(d<60)r[5]++;
      else         r[6]++;
    }
    for(i=0;i<7;i++){
      printf("%d\n",r[i]);
    }
  }
  return 0;
}

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

int main() {
  int n;
  cin >> n;
  
  bool flag = false;
  for(int i = 0; i < n; i++) {
    char x;
    cin >> x;
    if(x == 'Y') 
      flag = true;
  }
  if(flag)
    cout << "Four" << endl;
  else
    cout << "Three" << endl;
}
    

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.NoSuchElementException;

public class Main{
	public static void main(String[] args) {
		FastScanner fs = new FastScanner();
		List<Integer> list = new ArrayList<Integer>();
		int q = fs.nextInt();
		for(int i = 0; i < q; i++) {
			int query = fs.nextInt();
			if(query == 0) {
				list.add(fs.nextInt());
			}else if(query == 1) {
				System.out.println(list.get(fs.nextInt()));
			}else {
				list.remove(list.size() - 1);
			}
		}
	}
	static class FastScanner {
	    private final InputStream in = System.in;
	    private final byte[] buffer = new byte[1024];
	    private int ptr = 0;
	    private int buflen = 0;
	    private boolean hasNextByte() {
	        if (ptr < buflen) {
	            return true;
	        }else{
	            ptr = 0;
	            try {
	                buflen = in.read(buffer);
	            } catch (IOException e) {
	                e.printStackTrace();
	            }
	            if (buflen <= 0) {
	                return false;
	            }
	        }
	        return true;
	    }
	    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
	    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
	    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
	    public String next() {
	        if (!hasNext()) throw new NoSuchElementException();
	        StringBuilder sb = new StringBuilder();
	        int b = readByte();
	        while(isPrintableChar(b)) {
	            sb.appendCodePoint(b);
	            b = readByte();
	        }
	        return sb.toString();
	    }
	    public long nextLong() {
	        if (!hasNext()) throw new NoSuchElementException();
	        long n = 0;
	        boolean minus = false;
	        int b = readByte();
	        if (b == '-') {
	            minus = true;
	            b = readByte();
	        }
	        if (b < '0' || '9' < b) {
	            throw new NumberFormatException();
	        }
	        while(true){
	            if ('0' <= b && b <= '9') {
	                n *= 10;
	                n += b - '0';
	            }else if(b == -1 || !isPrintableChar(b)){
	                return minus ? -n : n;
	            }else{
	                throw new NumberFormatException();
	            }
	            b = readByte();
	        }
	    }
	    public int nextInt() {
	        long nl = nextLong();
	        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
	        return (int) nl;
	    }
	    public double nextDouble() { return Double.parseDouble(next());}
	}
}


Measured memory_bytes: 60264
#include<bits/stdc++.h>
using namespace std;
const int N=305;
int f[N][N][N],n,K;char s[N];
int main(){
  scanf("%s%d",s+1,&K);n=strlen(s+1);
  for(int i=1;i<=n;i++)
	  for(int k=0;k<=K;k++)f[i][i][k]=1;
  for(int len=2;len<=n;len++){
	  for(int i=1;i+len-1<=n;i++){
		  int j=i+len-1;
		  for(int k=0;k<=K;k++){
			  f[i][j][k]=max(f[i+1][j][k],f[i][j-1][k]);
			  if(s[i]==s[j])f[i][j][k]=max(f[i][j][k],f[i+1][j-1][k]+2);
			  if(k)f[i][j][k]=max(f[i][j][k],f[i+1][j-1][k-1]+2);
		  }
	  }
  }
  cout<<f[1][n][K]<<endl;
  return 0;
}


Measured memory_bytes: 110464
import copy
ls=list(input())
ans=0
#ans1=0
ans_ls=[]
#print(ls)
for i in range(len(ls)):
    if ls[i]=='A' or ls[i] == 'C' or ls[i] == 'G' or ls[i] == 'T':
        ans=ans+1
        #print(ans)
    else:
        #print(ans)
        ans1=ans
        #print(ans1)
        ans_ls.append(ans1)
        ans=0
ans_ls.append(ans)
#print(ans_ls)
print(max(ans_ls))

Measured memory_bytes: 3444
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
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 INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;



int main(){
    int N; cin >> N;
    double ans = 0.0;
    if(N % 2 == 0) ans = 0.5;
    else{
        ans = (double)(N/2+1)/N;
    }
    cout << fixed << setprecision(7) << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
    
int main(){
    int n;
    cin >> n;
    int a[n], b[n];
    long long sb = 0, sa = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        sa += a[i];
    }
    for(int i = 0; i < n; i++){
        cin >> b[i];
        sb += b[i];
    }
    long long sum = sb - sa;
    if(sum < 0){
        cout << "No" << endl;
        return 0;
    }
    long long cnt = 0;
    for(int i = 0; i < n; i++){
        cnt += a[i] < b[i] ? (b[i] - a[i] + 1) / 2 : 0;
    }
    cout << (cnt <= sum ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 384
def abc098_b():
    n = int(input())
    s = input()
    count_max = 0
    if len(s) == 2:
        return [0, 1][s[0] == s[1]]
    for i in range(1, n - 1):
        x = s[:i]
        y = s[i:]
        count = 0
        for let in set(x):
            if let in set(y):
                count += 1
        count_max = max(count,count_max)
    return count_max

print(abc098_b())

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

int main(){
  int N;
  cin >> N;
  priority_queue<int> q;
  for(int i=0; i<N; i++){
    int a; cin >> a;
    q.push(a);
  }
  int alice=0, bob=0;
  for(int i=0; i<N; i++){
    if(i%2==0) alice+=q.top();
    else bob+=q.top();
    q.pop();
  }
  cout << alice-bob << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<tuple>
#define rep(i,n) for(int i =0;i<(int)(n);i++)
typedef long long ll;
using namespace std;
int main() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	char now = s[0];
	int cnt = -1;
	rep(i, n) {
		if (s[i] == now) {
			cnt++;
		}
		else {
			now = s[i];
		}
	}
	cout << n - cnt << endl;
	return 0;
}


Measured memory_bytes: 512
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define show(x) cout << #x << " = " << x << endl;
using namespace std;
using ll = long long;
using pii = pair<int,int>;
int main(){
    int a,b;
    cin >> a>> b;
    int ans = 0;
    int x = 1,y = 1;
    while(1){
        if(x == y)ans++;
        if(x == a and y == b)break;
        if(y > 31){
            x++;
            y=1;
        }else{
            y++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
  
#define IO ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define f first
#define s second
#define pb push_back
#define all(a) a.begin(), a.end()
using namespace std;
  
typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef unsigned long long ull;

template<typename T1, typename T2> inline void chkmax(T1 & x, T2 y) {if (x < y) x = y;}
template<typename T1, typename T2> inline void chkmin(T1 & x, T2 y) {if (x > y) x = y;}

const int MAXN = 1e5 + 1;
int a[MAXN], b[MAXN];

bool check(ll t) {

}

int main() {
    IO;
    // freopen("input.txt", "r", stdin);
    int n;
    ll h, ma = 0;
    cin >> n >> h;
    for (int i = 0; i < n; ++i) {
        cin >> a[i] >> b[i];
        chkmax(ma, a[i]);
    }
    sort(b, b + n);
    ll ans = 0;
    for (int i = n - 1; i >= 0 && h > 0 && b[i] > ma; --i) {
        h -= b[i];
        ++ans;
    }
    if (h > 0)
        ans += (h + ma - 1) / ma;
    cout << ans;
    return 0;
}

// 1 5 10

// {a[i] * t - b[i]} 

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

const int32_t MAX_N = 2e5;
const int32_t MAX_H = 2e5;

class SegmentTree {
private:
	void Update(int32_t node, int32_t low, int32_t high, int32_t qInd, int64_t qVal) {
		if(low > qInd || high < qInd) {
			return;
		}
		else if(low >= qInd && high <= qInd) {
			data[node] = qVal;
			return;
		}

		int32_t mid = (low + high) / 2;
		Update(2 * node, low, mid, qInd, qVal);
		Update(2 * node + 1, mid + 1, high, qInd, qVal);

		data[node] = std::max(data[2 * node], data[2 * node + 1]);
	}

	int64_t Query(int32_t node, int32_t low, int32_t high, int32_t qLow, int32_t qHigh) {
		if(low > qHigh || high < qLow) {
			return 0;
		}
		else if(low >= qLow && high <= qHigh) {
			return data[node];
		}

		int32_t mid = (low + high) / 2;

		return std::max(Query(2 * node, low, mid, qLow, qHigh), Query(2 * node + 1, mid + 1, high, qLow, qHigh));
	}

public:
	int32_t treeSize;
	int64_t data[4 * MAX_H + 5];

	void Init(int32_t pTreeSize) {
		treeSize = pTreeSize;
	}

	void Update(int32_t ind, int64_t val) {
		Update(1, 1, treeSize, ind, val);
	}

	int64_t Query(int32_t low, int32_t high) {
		return Query(1, 1, treeSize, low, high);
	}
};

int32_t h[MAX_N + 5], a[MAX_N + 5];
SegmentTree segTree;

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

	int32_t n;
	std::cin >> n;

	for(int32_t i = 1; i <= n; i++) {
		std::cin >> h[i];
	}

	for(int32_t i = 1; i <= n; i++) {
		std::cin >> a[i];
	}

	segTree.Init(MAX_H);

	int64_t ans = 0;
	for(int32_t i = 1; i <= n; i++) {
		int64_t curr = a[i] + segTree.Query(1, h[i]);
		segTree.Update(h[i], curr);

		ans = std::max(ans, curr);
	}

	std::cout << ans << '\n';
}



Measured memory_bytes: 7936
#pragma region ヘッダー
#define _CRT_SECURE_NO_WARNINGS

#ifdef _____MY_DEBUG_____
#define VS_ENDPAUSE()	(system("pause"))
#else
#define VS_ENDPAUSE()
#endif

#include <stdio.h>
#include <string.h>
#include <iostream>
#include <math.h>
#include <cmath>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;
typedef signed char int8;
typedef signed short int16;
typedef signed int int32;
typedef signed long long int64;
typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;
typedef unsigned long long uint64;
#define int int64

#ifndef INT8_MIN
#define INT8_MIN	(-127)
#endif
#ifndef INT8_MAX
#define INT8_MAX	( 128)
#endif
#ifndef UINT8_MAX
#define UINT8_MAX	( 255)
#endif
#ifndef INT16_MIN
#define INT16_MIN	(-32768)
#endif
#ifndef INT16_MAX
#define INT16_MAX	( 32767)
#endif
#ifndef UINT16_MAX
#define UINT16_MAX	( 65535)
#endif
#ifndef INT32_MIN
#define INT32_MIN	(-2147483648)	// -2 * 10^9
#endif
#ifndef INT32_MAX
#define INT32_MAX	( 2147483647)	//  2 * 10^9
#endif
#ifndef UINT32_MAX
#define UINT32_MAX	( 4294967295)	//  4 * 10^9
#endif
#ifndef INT64_MIN
#define INT64_MIN	(-9223372036854775808)	// -9 * 10^18
#endif
#ifndef INT64_MAX
#define INT64_MAX	( 9223372036854775807)	//  9 * 10^18
#endif
#ifndef UINT64_MAX
#define UINT64_MAX	( 18446744073709551615)	// 18 * 10^18
#endif

void func(void);
#pragma endregion

int32 main(void)
{
	func();
	VS_ENDPAUSE();
	return 0;
}

void func(void)
{
	uint32 N, K;
	cin >> N >> K;
	vector<uint32> a(N);
	for(uint32 i=0; i<N; i++){
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	a.erase(unique(a.begin(), a.end()), a.end());
	N = a.size();
	if(a[N-1] < K){
		cout << "IMPOSSIBLE" << endl;
		return;
	}

	// search
	uint32 diff;
	for(uint32 i=0; i<N; i++){
		if(a[i] == K){
			cout << "POSSIBLE" << endl;
			return;
		}
		if(a[i] > K){
			diff = a[i] - K;
			break;
		}
	}

	int32 p = 0;
	uint32 aSize = a.size();
#if 0
	while(p < aSize){
		for(int32 i=aSize-1; i>p; i--){
			if(a[i] % a[p] == 0){
				a.erase(a.begin() + i);
			}
		}
		aSize = a.size();
		p++;
	}
#endif

	if(a.size() < 2){
		if(diff % a[0] == 0){
			cout << "POSSIBLE" << endl;
			return;
		}
	}
	if(aSize > 100){ aSize /= 10; }
	if(aSize > 100){ aSize /= 10; }
	for(uint32 i=0; i<aSize-1; i++){
		for(uint32 j=i+1; j<aSize; j++){
			uint32 val = a[j] % a[i];
			if(val>0){
				if(diff % val == 0){
					cout << "POSSIBLE" << endl;
					return;
				}
			}
		}
	}
	cout << "IMPOSSIBLE" << endl;

	return;
}


Measured memory_bytes: 640
#pragma region
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <iomanip>
#include <cstdint>
#include <bitset>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()

#pragma region UnionFind
struct UnionFind
{
	vector<int> par;

	UnionFind(int n) : par(n, -1) {}
	void init(int n) { par.assign(n, -1); }

	int root(int x)
	{
		if (par[x] < 0) return x;
		else return par[x] = root(par[x]);
	}

	bool issame(int x, int y)
	{
		return root(x) == root(y);
	}

	bool merge(int x, int y)
	{
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y);
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x)
	{
		return -par[root(x)];
	}
};
#pragma endregion
#pragma region GCD
ll gcd(ll a, ll b)
{
	if (b == 0)return a;
	return gcd(b, a%b);
}
#pragma endregion
#pragma region LCM
ll lcm(ll a, ll b)
{
	return a / gcd(a, b) * b;
}
#pragma endregion
#pragma region chmin
template<class T> inline bool chmin(T& a, T b)
{
	if (a > b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma region chmax
template<class T> inline bool chmax(T& a, T b)
{
	if (a < b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma endregion


int main()
{
	int n; cin >> n;
	bool allEven = true;
	rep(i, n)
	{
		int a; cin >> a;
		if (a % 2 == 1)allEven = false;
	}
	if (allEven)cout << "second" << endl;
	else cout << "first" << endl;
}

Measured memory_bytes: 3620
Scanf.scanf "%d %d" (fun n m ->
    let num = Array.make (n + 1) 0 in
    for i = 1 to m do
        Scanf.scanf " %d %d" (fun a b ->
            num.(a) <- num.(a) + 1;
            num.(b) <- num.(b) + 1;
        )
    done;
    for i = 1 to n do
        Printf.printf "%d\n" num.(i)
    done
)

Measured memory_bytes: 3808
import java.io.PrintWriter
import java.util.*
import java.math.*
import java.lang.*

val pw = PrintWriter(System.out)
val MOD: Long = (1e+9 + 7).toLong()

fun main(args: Array<String>) {
    val n = readInt()
    val a = mutableListOf<Int>()
    for(i in 0 until n) {
        a.add(readInt())
    }
    val sortedA = a.sorted().reversed()
    for(i in 0 until n) {
        val ans = if(a[i] != sortedA[0]) sortedA[0] else sortedA[1]
        println(ans)
    }

    pw.flush()
}

/****** Decrared Functions and Data Structures ******/
// IO
fun read() = readLine()!!
fun readInt() = read().toInt()
fun readLong() = read().toLong()
fun readDouble() = read().toDouble()
fun readListOfString() = read().split(" ")
fun readListOfInt() = readListOfString().map { it.toInt() }
fun readListOfLong() = readListOfString().map { it.toLong() }
fun readListOfDouble() = readListOfString().map { it.toDouble() }

fun Double.format(digits: Int) = String.format("%.${digits}f", this)

fun print(value: Any) { pw.print(value) }
fun println(value : Any) { pw.println(value) }

fun<T> permutations(src: List<T>): List<List<T>> {
    if(src.size == 1) return listOf(src)
    val perms = mutableListOf<List<T>>()
    val insertElement = src[0]
    permutations(src.drop(1)).forEach { perm ->
        for(i in 0..perm.size) {
            val newPerm = perm.toMutableList()
            newPerm.add(i, insertElement)
            perms.add(newPerm.toList())
        }
    }
    return perms
}

// return nCr, if you want nCr, please access v[n][r]
fun combinations(n: Long): List<List<Long>> {
    val v = (0..n).map { (0..n).map{0L}.toMutableList() }.toMutableList()
    for(i in 0 until v.size) {
        v[i][0] = 1L
        v[i][i] = 1L
    }
    for(i in 0 until v.size) {
        for(j in 1 until i) {
            v[i][j] = (v[i-1][j-1] + v[i-1][j] % MOD)
        }
    }
    val rtn = v.map { it.toList() }.toList()
    return rtn 
}

fun gcd(a: Long, b: Long): Long = 
if(b != 0L) a else gcd(b, a % b)

fun lcm(a: Long, b: Long) = 
if(b==0L) a else gcd(b, a % b)

fun sumDigits(num_: Long): Long {
    var num = num_
    var rtn: Long = 0
    while(num != 0.toLong()) {
        val tmp = num % 10
        rtn += tmp
        num /= 10
    }
    return rtn
}

fun isDecimal(v: Double): Boolean = ((v - Math.floor(v)) != 0.0)

// Data Structures
class Stack<T>(private var st: MutableList<T> = mutableListOf<T>()) {
    fun isEmpty() = st.isEmpty()
    fun top(): T = st.last()
    fun push(e: T) { st.add(e) }
    fun pop() { st = st.dropLast(1).toMutableList() }
}

class Queue<T>(private var que: MutableList<T> = mutableListOf<T>()) {
    fun isEmpty() = que.isEmpty()
    fun top(): T = que.first()
    fun push(e: T) { que.add(e) }
    fun pop() { que = que.drop(1).toMutableList() }
}


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

using i64 = int64_t;

#define rep(i, x, y) for (i64 i = i64(x), i##_max_for_repmacro = i64(y); i < i##_max_for_repmacro; ++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf = 1.01e9;
const i64 inf64 = 4.01e18;
const double eps = 1e-9;

template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "(" << p.first << ", " << p.second << ")";
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}

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

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

template <class T>
class segtree {
public:
    int n;
    vector<T> dat, sum;  //区間の和,区間に一様に足された値
    segtree(int size, T x) {
        n = 1;
        while (n < size) n *= 2;
        dat.assign(2 * n - 1, 0);
        sum.assign(2 * n - 1, 0);
        add(0, size, x);
    }
    void add(int a, int b, T x) { add(a, b, x, 0, 0, n); }
    T add(int a, int b, T x, int k, int l, int r) {
        if (b <= l or r <= a) return dat[k];
        if (a <= l and r <= b) {
            sum[k] += x;
            return dat[k] += x;
        }
        int m = (l + r) / 2;
        return dat[k] = max(add(a, b, x, 2 * k + 1, l, m), add(a, b, x, 2 * k + 2, m, r)) + sum[k];
    }
    T query(int a, int b) { return query(a, b, 0, 0, n); }
    T query(int a, int b, int k, int l, int r) {
        if (b <= l or r <= a) return -inf64;
        if (a <= l and r <= b) return dat[k];
        int m = (l + r) / 2;
        return max(query(a, b, 2 * k + 1, l, m), query(a, b, 2 * k + 2, m, r)) + sum[k];
    }
};

void solve() {
    //const i64 mod = 1'000'000'007;

    i64 N,M;
    cin >> N >> M;

    vector<vector<pair<i64,i64>>> r_to_la(N);
    rep(i,0,M){
        i64 l,r,a;
        cin >> l >> r >> a;
        --l;
        --r;
        r_to_la[r].emplace_back(make_pair(l,a));
    }

    const i64 maxn=200010;
    segtree<i64> dp(maxn,-inf64);
    rep(i,0,N){
        // [max(0,i+1-N), i]
        i64 j=max(i64(0),i+1-N);

        // [j, i]

        i64 val=max(i64(0),dp.query(j,i));
        i64 tmp=dp.query(i,i+1);
        dp.add(i,i+1,-tmp);
        //assert(dp.query(i,i+1) == 0);
        dp.add(i,i+1,val);

        i64 r=i;
        for(auto &p:r_to_la[i]){
            i64 l=p.first,a=p.second;
            dp.add(i-(r-l),i+1,a);
        }
    }

    cout << max(i64(0),dp.query(0,N)) << endl;
}

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


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

// コンテスト中のみ
//#define int long long

#define ll long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define P pair<ll,ll>
int MOD = 1000000007;
const int inf = 1001001001;
const ll INF = 1LL << 60;

int v, e;
vector<P>edge[1000010];

vector<ll>dijkstra(int s) {
	priority_queue<P, vector<P>, greater<P>>pq;
	vector<ll>dist(v, INF);
	dist[s] = 0;
	pq.push({ dist[s],s });
	while (!pq.empty()) {
		P p = pq.top(); pq.pop();
		int from = p.second; ll d = p.first;
		if (dist[from] < d)continue;
		for (auto nv : edge[from]) {
			int to = nv.first; ll c = nv.second;
			if (dist[from] + c < dist[to]) {
				dist[to] = dist[from] + c;
				pq.push({ dist[to],to });
			}
		}
	}
	return dist;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cin >> v >> e;
	int r; cin >> r;
	rep(i, e) {
		int s, t; ll d; cin >> s >> t >> d;
		edge[s].push_back({ t,d });
	}
	auto d = dijkstra(r);
	rep(i, v) {
		if (d[i] == INF)cout << "INF" << endl;
		else cout << d[i] << endl;
	}
	return 0;
}


Measured memory_bytes: 40644
#include <bits/stdc++.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

using namespace std;

typedef long long int lli;
typedef pair<int, int> ii;

int main() {
    int N;
    cin >> N;
    int bit[40] = {};
    int i = 0;
    for (; N != 0; i++) {
        int r = N % (-2);
        if (r == -1) {
            r += 2;
        }
        bit[i] = r;
        N = (N - r)/(-2);
    }

    for (;i > 0 && bit[i] == 0; i--);

    for (; i >= 0; i--) {
        cout << bit[i];
    }
    cout << endl;
    return 0;
}


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

#define ST_ARR_LEN(array) (sizeof(array)/sizeof(*array))
#define MOD 1000000007

using namespace std;

using ll = long long;
const ll MAX = LLONG_MAX;
const ll MIN = LLONG_MIN;

typedef stack<ll> llStack;
typedef queue<ll> llQueue;
typedef vector<ll> llVector;
typedef list<ll> llList;

typedef struct S{
  int a;
  int b;
} Object;

int main(){
  ll N;
  cin >> N;
  
  llQueue q;
  for(int i=1;i<10;i++){
    q.push(i);
  }
  ll a;
  for(int i=0;i<N-1;i++){
    a = q.front();
    q.pop();
    if(a%10 != 0){
      q.push(10*a+(a%10)-1);
    }
    q.push(10*a+(a%10));
    if(a%10 != 9){
      q.push(10*a+(a%10)+1);
    }
  }
  
  cout << q.front() << endl;
}

Measured memory_bytes: 1792
list = input().split(' ')
n = int(list[0])
k = int(list[1])
q = int(list[2])

score = [k - q] * n  # 最初にn人のスコアをk-q点で初期化
for i in range(q):
    a = int(input())
    score[a - 1] += 1  # 正解した人に1点を加える

for item in score:
    if(0 < item): print("Yes")  # 0より大きいスコアの場合、Yesを出力
    else: print("No")  # 0以下のスコアの場合、Noを出力


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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	string s;
	cin>>s;
	bool b;
	if(s.at(0)=='B')b=false;
	else b=true;
	int ans=-1;
	for(int i=0;i<s.size();++i){
		if(s.at(i)=='B'&&b==false){
			++ans;
			b=true;
		}
		else if(s.at(i)=='W'&&b==true){
			++ans;
			b=false;
		}
	}
	cout<<ans<<"\n"s;
}

Measured memory_bytes: 512
import sys

n, *a = map(int, sys.stdin.read().split())
a = [0] + a + [0]

def main():
    s = sum([abs(a[i+1] - a[i]) for i in range(n + 1)])
    for i in range(1, n + 1):
        if a[i-1] <= a[i] <= a[i+1]: res = s
        elif a[i-1] >= a[i] >= a[i+1]: res = s
        else: res = s - 2 * min(abs(a[i] - a[i-1]), abs(a[i+1] - a[i]))
        print(res)
            
if __name__ ==  '__main__':
    main()

Measured memory_bytes: 14188
//{{{
#include <bits/stdc++.h>
using namespace std;
#define repX(a,b,child,x,...) x
#define repN(a) repX a
#define rep(...) repN((__VA_ARGS__,rep3,rep2,loop))(__VA_ARGS__)
#define rrep(...) repN((__VA_ARGS__,rrep3,rrep2))(__VA_ARGS__)
#define loop(n) rep2(i_,n)
#define rep2(i,n) rep3(i,0,n)
#define rep3(i,begin,end) for(int i=(int)(begin),i##_end=(int)(end);i<i##_end;++i)
#define rrep2(i,n) rrep3(i,n,0)
#define rrep3(i,begin,end) for(int i=(int)(begin-1),i##_end=(int)(end);i>=i##_end;--i)
#define foreach(x,a) for(auto&x:a)
using ll=long long;
const ll mod=(ll)1e9+7;
//}}}

int main(){
  map<int, int> mp;
  rep(i, 6){
    int a;
    cin >> a;
    mp[a]++;
  }
  bool ans = true;
  rep(i, 1, 5){
    if(mp[i] > 2) ans = false;
  }
  puts(ans ? "YES" : "NO");
  return 0;
}


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

using namespace std;

typedef long long ll;

#define eps 1e-9
#define all(a)   a.begin(),a.end()
#define mp make_pair
#define F first
#define S second
#define pb push_back
#define sz size()
#define rd(inp) scanf("%lld",&inp)
#define rd2(inp1, inp2) scanf("%lld %lld",&inp1, &inp2)
#define rl(inp) scanf("%d",&inp)
#define pf(out) printf("%lld\n", out);

const long long linf = 1e18+5;
const int mod = (int) 1e9 + 7;
const int inf = 1e9;

ll read(){
	bool minus = false;
	ll result = 0;
	char ch;
	ch = getchar();
	while (true) {
		if (ch == '-') break;
		if (ch >= '0' && ch <= '9') break;
		ch = getchar();
	}
	if (ch == '-') minus = true; else result = ch-'0';
	while (true) {
		ch = getchar();
		if (ch < '0' || ch > '9') break;
		result = result*10 + (ch - '0');
	}
	if (minus){
		return -result;
	}
	else{
		return result;
	}
}

ll fpow(ll base,ll power){
	ll result = 1;
	while (power > 0){
		if (power%2 == 1) result=(result*base);
  		base = (base*base);
  		power /= 2;
  	}
	return result;
}

ll cnt(ll x){
	ll res = 0;
	while ( x > 0 ){
		x /= 10;
		res ++;
	}
	return res;
}

int main(){
	ll n;
	cin >> n;
	ll i, j, ans = 70;
	for ( i = 1 ; i <= sqrt(n) ; i ++ ){
		j = n / i;
		if ( i * j == n ){
			ans = min(ans, max(cnt(i), cnt(j)));
		}
	}
	cout << ans << "\n";
	return 0;	
}

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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)

using ll = long long;
using ld = long double;
ll INF = LLONG_MAX;

using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;

namespace output {
	void pr(int x) { cout << x; }
	void pr(long x) { cout << x; }
	void pr(ll x) { cout << x; }
	void pr(unsigned x) { cout << x; }
	void pr(unsigned long x) { cout << x; }
	void pr(unsigned long long x) { cout << x; }
	void pr(float x) { cout << x; }
	void pr(double x) { cout << x; }
	void pr(ld x) { cout << x; }
	void pr(char x) { cout << x; }
	void pr(const char* x) { cout << x; }
	void pr(const string& x) { cout << x; }
	void pr(bool x) { pr(x ? "true" : "false"); }
	template<class T> void pr(const complex<T>& x) { cout << x; }
	
	template<class T1, class T2> void pr(const pair<T1,T2>& x);
	template<class T> void pr(const T& x);
	
	template<class T, class... Ts> void pr(const T& t, const Ts&... ts) { 
		pr(t); pr(ts...); 
	}
	template<class T1, class T2> void pr(const pair<T1,T2>& x) { 
		pr("{",x.f,", ",x.s,"}"); 
	}
	template<class T> void pr(const T& x) { 
		pr("{"); // const iterator needed for vector<bool>
		bool fst = 1; for (const auto& a: x) pr(!fst?", ":"",a), fst = 0; 
		pr("}");
	}
	
	void print() { pr("\n"); } // print w/ spaces
	template<class T, class... Ts> void print(const T& t, const Ts&... ts) { 
		pr(t); if (sizeof...(ts)) pr(" "); print(ts...); 
	}
}

using namespace output;

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int N, A, B; cin >> N >> A >> B;
	string S; cin >> S;
	for (char c : S) {
		if (c == 'c') {
			print("No");
		} else if (c == 'b') {
			print((B > 0 && A + B > 0) ? "Yes" : "No");
			B -= (B > 0 && A + B > 0);
		} else if (c == 'a') {
			print((A + B > 0) ? "Yes" : "No");
			--A;
		}
	}
}

Measured memory_bytes: 3748