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

#define rep(i, n) for(int i=0; i < n; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

using namespace std;
using ll=long long;


// aよりもbが大きいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}


int main(){
  int A,B;
  cin >> A >> B;
  int ans =0;
  if (A>=13) ans =B;
  if(A>=6 && A <13) ans =B/2;
  if (A <6) ans = 0;

   cout << ans;
}


Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
#from decimal import *

N = INT()
A = LIST()
B = LIST()

if sum(A) < sum(B):
	print(-1)
	exit()

l = [A[i]-B[i] for i in range(N)]
l.sort()

idx = bisect_left(l, 0)
p = sum(l[:idx])

tmp = 0
ans = idx 
i = 0

while tmp + p < 0:
	i += 1
	tmp += l[-i]
	

print(ans + i)



Measured memory_bytes: 20180
nc = input()
n = int(nc)
h = [ [0] * 10 for i in range(10)]
for i in range(1, n+1):
	c = str(i)
	a = int(c[0])
	b = int(c[-1])
	h[a][b] = h[a][b] + 1
ans = 0
for i in range(1, 10):
	for j in range(1, 10):
		ans += h[i][j] * h[j][i]
print(ans)

Measured memory_bytes: 3064
#include<stdio.h>
int main(void){
    int a,b,n,i;
    a=100000;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        a=a+a*0.05;
        b=a%1000;
        if(b!=0){
            a=a+1000;
            a=a-b;
        }
    }
    printf("%d\n",a);

return 0;
}

Measured memory_bytes: 592
#![allow(unused_imports, unused_macros, dead_code)]

macro_rules! min {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(z) = it.next() {
            Some(it.fold(z, |x, y| min!(x, y)))
        } else {
            None
        }
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = min!($($ys),*);
        if $x < t { $x } else { t }
    }}
}
macro_rules! max {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(z) = it.next() {
            Some(it.fold(z, |x, y| max!(x, y)))
        } else {
            None
        }
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = max!($($ys),*);
        if $x > t { $x } else { t }
    }}
}


macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => { ewriteln!(">>> {} = {:?}", stringify!($x), $x) };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! put {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(x) = it.next() { print!("{}", x); }
        for x in it { print!(" {}", x); }
        println!("");
    }};
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

const M: i64 = 1_000_000_007;

fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.cin();
    let mut a: Vec<(usize, usize)> = (0..n).map(|i| (sc.cin(), i)).collect();
    a.sort();
    put!((0..n).filter(|&i| i % 2 == 0 && a[i].1 % 2 == 1).count())
}

use std::io::{self, Write};
use std::str::FromStr;
use std::collections::VecDeque;

struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
impl Scanner {
    fn new() -> Self { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
}


Measured memory_bytes: 6396
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
    int A, B;
    cin >> A >> B;
 
    int count = 0;
  	int num = 0;
  
  	for( int i=0 ; i<100 ; i++ )
    {
      if( 1 == B ) break;
      
      num += i == 0 ? A : A - 1;
      count++;
      if( num >= B ) break;
    }
 
    cout << count << endl; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define FASTIO cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false)
#define ll long long int
#define F first
#define S second
#define pll pair<ll,ll>
#define vl vector<ll>
#define vi vector<int>
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vpii vector<pair<int,int> >
#define vvpii vector<vpii >
#define vpll vector<pair<ll,ll> >
#define vvpll vector<vpll >
#define pb push_back
#define MOD 1000000007

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> new_data_set;

struct compare {
	bool operator() (const pair<int, int> &a, const pair<int, int> &b) const {
		if ((a.S - a.F) != (b.S - b.F)) return ((a.S - a.F) > (b.S - b.F));
		else return (a.F < b.F);
	}
};

const ll INF = 1e18 + 2;

int main() {
// #ifndef ONLINE_JUDGE
// 	freopen("input.txt", "r", stdin);
// 	freopen("output.txt", "w", stdout);
// #endif
	FASTIO;
	ll n; cin >> n;
	vl v(n);
	vvl cost(n, vl(n));
	vvl sum(n, vl(n));
	for (auto &i : v) cin >> i;
	for (ll i = 0; i < n; i++) {
		ll s = 0;
		for (ll j = i; j < n; j++) {
			s += v[j];
			sum[i][j] = s;
		}
	}
	for (ll i = 0; i < n; i++) cost[i][i] = 0;
	for (ll len = 2; len <= n; len++) {
		for (ll start = 0; start < n - len + 1; start++) {
			ll ans = LLONG_MAX, end = start + len - 1;
			for (ll i = start; i < end; i++) {
				ans = min(ans, (cost[start][i] + cost[i + 1][end]) + sum[start][end]);
			}
			cost[start][end] = ans;
		}
	}
	cout << cost[0][n - 1] << endl;
}

Measured memory_bytes: 2816
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigDecimal;

public class Main {
	public static void main(String[] args) throws Exception {
		int eNum;//????????????????´???°????´???¨

		InputStreamReader is = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(is);

		String str = br.readLine();//????????????????´???°???????´?
		eNum = Integer.parseInt(str);

		String[] element = new String[eNum];

		str = br.readLine();
		element = getElement(str);//????????????????´????????´?

		System.out.println(getMin(element, eNum) + " " +
				getMax(element, eNum) + " " + getSum(element, eNum));
	}

	//?????§???????±???????????????????
	public static int getMax(String[] element, int num) {
		int max = Integer.parseInt(element[0]);
		for (int i = 0; i < num; i++) {
			max = Math.max(max, Integer.parseInt(element[i]));
		}
		return (max);
	}

	//????°????????±???????????????????
	public static int getMin(String[] element, int num) {
		int min = Integer.parseInt(element[0]);
		for (int i = 0; i < num; i++) {
			min = Math.min(min, Integer.parseInt(element[i]));
		}
		return (min);
	}

	//????¨?????±???????????????????
	public static BigDecimal getSum(String[] element, int num) {
		BigDecimal sum = new BigDecimal("0");

		for (int i = 0; i < num; i++) {
			sum = sum.add(new BigDecimal(element[i]));
//			System.out.println("i="+i+" "+element[i]);
		}
		return (sum);
	}

	//??????????????????????????????????????????
	public static String[] getElement(String element) {
		return (element.split(" "));
	}

}

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

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
 
	#ifdef ARTHUR_LOCAL
		ifstream cin("input.txt");
	#endif
	
	int n;
	cin>>n;
	
	vector<int> ans(n+1);
	
	for(int i=1; i<n; i++)
	{
	    int a;
	    cin>>a;
	    ans[a]++;
	}
	
	for(int i=1; i<=n; i++)
	{
	    cout << ans[i] << "\n";
	}
}

Measured memory_bytes: 3988
#include <bits/stdc++.h>
#define rep(i,n) for( int i=0; i<(n);++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int main(){
    int n , m , x ;
    cin >> n >> m >> x ;
    vector<int> C(12);
    vector<vector<int>> pa(n, vector<int>(m));
    rep(i,n) {
        cin >> C.at(i);
        rep(j,m){
            cin >> pa.at(i).at(j);
        }
    }
    int ans = 100100100;
    int count = 0;
    
    for (int tmp = 0; tmp < (1 << 12); tmp++) {
  bitset<12> s(tmp);
  // (ビット列sに対する処理)
      count =0;
      vector<int> Ans(m);
  rep(i,n){
       
      if (s.test(i)){
      count += C.at(i);
      rep(j,m){
          Ans.at(j) += pa.at(i).at(j);
      }

      }
  }
  bool can = true;
  rep(i,m){
      if(Ans.at(i)< x){
          can = false;
      }
  }
  if(can){
      ans = min(count,ans);
  }
}
if(ans == 100100100){
    cout << -1 << endl;
}
else cout << ans << endl;
}

Measured memory_bytes: 3640
A = int(raw_input())
B = int(raw_input())
C = int(raw_input())
S = 3 * C
X13 = S - A - B
X21 = 2*S - 2*A- 2*C - B
X23 = 2*A + B + C - S
X31 = 2*C + A + B - S
X32 = S - B - C
X33 = S - A - C
print "%d %d %d" % (A, B, X13)
print "%d %d %d" % (X21, C, X23)
print "%d %d %d" % (X31, X32, X33)


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

using namespace std;

long double calc_a_probabolity(int element, int k){
  int count = 0;
  while(element < k){
    element *= 2;
    count++;
  }
  
  return 1.0 / pow(2.0, count);
}

int main(){
  int n,k;
  long double sum = 0;
  cin >> n >> k;

  for(int i = 0; i < n; i++){
    sum += calc_a_probabolity(i+1, k);
  }

  cout << fixed << setprecision(12) << sum / n << endl;


}

Measured memory_bytes: 256
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		int ABCD = sc.nextInt();

		sc.close();

		int A = ABCD / 1000;
		int B = ABCD / 100 % 10;
		int C = ABCD / 10 % 10;
		int D = ABCD % 10;

		int ans = 0;
		for (int i = 0; i < 1 << 3; i++) {

			int res = A;

			if (((i >> 0) & 0x1) == 0) {
				res += B;
			} else {
				res -= B;
			}

			if (((i >> 1) & 0x1) == 0) {
				res += C;
			} else {
				res -= C;
			}

			if (((i >> 2) & 0x1) == 0) {
				res += D;
			} else {
				res -= D;
			}

			if (res == 7) {
				ans = i;
				break;
			}
		}

		StringBuilder sb = new StringBuilder();
		sb.append(A);
		sb.append(((ans >> 0) & 0x1) == 0 ? "+" : "-");
		sb.append(B);
		sb.append(((ans >> 1) & 0x1) == 0 ? "+" : "-");
		sb.append(C);
		sb.append(((ans >> 2) & 0x1) == 0 ? "+" : "-");
		sb.append(D);
		sb.append("=7");

		out.println(sb.toString());
	}

	public static void main(String[] args) {
		new Main()._main(args);
	}
}


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

use itertools::Itertools;
use proconio::*;
use text_io::*;

const U_INF: usize = 1 << 60;
const I_INF: isize = 1 << 60;

fn main() {
    input! {
        n:usize,
        ps:[usize;n],
    }

    println!(
        "{}",
        ps.iter().sum::<usize>() - ps.iter().max().unwrap() / 2
    );
}


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

using namespace std;
using ll = long long;
#define int ll
using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define PB push_back

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'[';
  REP(i, a.size()) {out<<a[i];if(i!=a.size()-1)out<<',';}
  out<<']';
  return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};

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

  int n;
  cin >> n;
  if(n%2) cout << 2*n << endl;
  else cout << n << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()

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

    pair<ld, ld> seq[n];
    rep(i, 0, n){
        cin >> seq[i].first;
    }
    rep(i, 0, n){
        cin >> seq[i].second;
    }

    ll max_time = 0;
    rep(i, 0, n){
        max_time += seq[i].first * 2;
    }

    ld v[max_time + 1];
    fill(v, v + max_time + 1, 100000000);
    ll nt = 0;
    rep(i, 0, n){
        rep(j, 0, seq[i].first){
            ll t1 = nt + j * 2;
            ll t2 = nt + j * 2 + 1;
            v[t1] = min(v[t1], seq[i].second);
            v[t2] = min(v[t2], seq[i].second);
        }
        nt += seq[i].first * 2;
        v[nt] = min(v[nt], seq[i].second);
    }

    v[0] = 0.0;
    v[max_time] = 0.0;

    rep(i, 0, max_time + 1){
        v[i + 1] = min(v[i + 1], v[i] + 0.5);
    }
    rrep(i, max_time + 1, 0){
        v[i] = min(v[i], v[i + 1] + 0.5);
    }


    ld dist = 0;
    rep(i, 0, max_time){
        dist += (v[i] + v[i + 1]) * 0.5 / 2.0;
    }
    printf("%.10Lf\n", dist);

}


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

typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> pll;
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);

ll const inf = 1e18;
ll const maxn = 1e6+5;
ll const mod = 1e9+7;

// code begins here

int main(){
    fast;
    
    ll n;
    cin>>n;
    
    vector<ll> arr(n);
    for(auto &u: arr)   
        cin>>u;
    
    vector<ll> brr(n);
    brr[n-1] = arr[n-1];
    for(ll i=n-2;i>=0;i--){
        brr[i] = arr[i] + brr[i+1];
        brr[i] %= mod;
    }
    
    ll ans = 0;
    
    for(ll i=0;i<n-1;i++){
        ll x = arr[i]*brr[i+1];
        x %= mod;
        ans = ( ans + x )%mod;
        ans %= mod;
    }
    
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 6344
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <utility>
#include <numeric>
#include <iomanip>

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

using namespace std;

bool check(char c) {
    if (c == 'A' || c == 'C' || c == 'G' || c == 'T')
    {
        return true;
    }
    else
    {
        return false;
    }
}

int main() {
    string s; cin >> s;
    int len = s.length();

    int ans = 0;
    int count = 0;
    for (int i = 0; i < len; i++)
    {
        count = 0;
        while ((i+count) < len && check(s.at(i+count)))
        {
            count++;
        }
        
        if (ans < count)
        {
            ans = count;
        }
        
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
A = int(input())
B = int(input())
C = int(input())
X = int(input())

count =0
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if 500*i+100*j+50*k ==X:
                count += 1
print(count)

Measured memory_bytes: 3060
from collections import Counter

#input
N,K = list(map(int,input().split()))
R,S,P = list(map(int,input().split()))

T = list(input())
T_ =T.copy()

# N=2*10**5
# T=[random.choice(['s', 'r', 'p']) for _ in range(N)]

check=set(['s', 'r', 'p'])

#得点
point={'r':P,'s':R,'p':S}
point

T_point = [0]*N
for n in range(N):
    T_point[n]=point[T[n]]
    
for k in range(K,N):
    check_out = set()
    if T[k] == T[k-K]: # K回前の手と同じ場合
        check_out.add(T[k])
        if k+K < N:
            check_out.add(T[k+K])
            
        check_out=check-check_out
        
        T[k]=list(check_out)[0]
         
ans=0

for t in range(len(T)):
    if T[t] == T_[t]:
        ans += point[T[t]]
print(ans)


Measured memory_bytes: 79612
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
struct edge{ll to,cost;};
const int inf = 1<<27;
const ll INF = 1LL<<60;
const int COMBMAX = 1001001;
const ll MOD = 1000000007;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define eachdo(v, e) for(const auto& e : (v))
#define all(v) (v).begin(), (v).end()
#define lower_index(v, e) (ll)distance((v).begin(), lower_bound((v).begin(), (v).end(), e))
#define upper_index(v, e) (ll)distance((v).begin(), upper_bound((v).begin(), (v).end(), e))
ll mpow(ll a, ll n, ll mod = MOD){ll res = 1; while(n > 0){if(n & 1)res = res * a % mod; a = a * a % mod; n >>= 1;} return res;}
void YesNo(bool j){cout << (j ? "Yes" : "No") << endl; return;}
void yesno(bool j){cout << (j ? "yes" : "no") << endl; return;}
template<class Head> void pt(Head&& head){cout << head << endl; return;}
template<class Head, class... Tail> void pt(Head&& head, Tail&&... tail){cout << head << " "; pt(forward<Tail>(tail)...);}
template<class T> void debug(T v){rep(i, v.size()) cout << v[i] << " " ; cout << endl;}
template<class T> void debug2(T v){rep(i, v.size()){rep(j, v[i].size()) cout << v[i][j] << " " ; cout << endl;}}
template<class T1, class T2> ll bcount(T1 v, T2 a){return upper_index(v, a) - lower_index(v, a);} 
template<class T1, class T2> inline bool chmin(T1 &a, T2 b){if(a > b){a = b; return true;} return false;}
template<class T1, class T2> inline bool chmax(T1 &a, T2 b){if(a < b){a = b; return true;} return false;}
template<class T1, class T2> void sortTwoVecter(vector<T1> &f, vector<T2> &s, bool isReverse = false){
    vector<pair<T1, T2>> p;
    rep(i, f.size()) p.emplace_back(make_pair(f[i], s[i]));
    if (!isReverse) sort(p.begin(), p.end());
    else sort(p.rbegin(), p.rend());
    rep(i, f.size()) tie(f[i], s[i]) = p[i];
    return;
}

int main(){
    ll N, M; cin >> N >> M;
    vector<ll> f(M, 0);
    rep(i, N){
        ll k; cin >> k;
        rep(j, k){
            ll a; cin >> a;
            f[--a]++;
        } 
    }
    ll ans = 0;
    rep(i, M) if(f[i] == N) ans++;
    cout << ans << endl; 
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var A, B, K, N int
	fmt.Scan(&A, &B, &K)
	N = B - A + 1
	if 2*K >= N {
		for i := A; i <= B; i++ {
			fmt.Println(i)
		}
	} else {
		for i := A; i < A+K; i++ {
			fmt.Println(i)
		}
		for i := B - K + 1; i <= B; i++ {
			fmt.Println(i)
		}
	}
}


Measured memory_bytes: 512
this_month = {}
while True:
    line = raw_input()
    if line == '': break
    num, day = map(int, line.split(','))
    if not num in this_month:
        this_month[num] = 1
    else:
        this_month[num] = this_month[num] + 1

last_month = {}    
while True:
    try:
        line = raw_input()
        num, day = map(int, line.split(','))
        if not num in last_month:
            last_month[num] = 1
        else:
            last_month[num] = last_month[num] + 1
    except EOFError:
        a = set(this_month)
        b = set(last_month)
        bigbang = sorted(a&b)
        for num in bigbang:
            print '%s %s' % (num, this_month[num] + last_month[num])
        break

Measured memory_bytes: 4240
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define pi pair<int ,int >
#define pl pair<ll ,ll >
#define pb push_back
#define vl vector <long long int >
#define vi vector <int >
#define vp vector <pi>
#define mod 1000000007
#define eps 1e-9
#define fi first
#define se second
#define _ <<" "<<
#define forn(x,	n) for(int x = 0; x < n ;++ x) 
#define forn1(x,n) for(int x = 1; x <= n ;++ x)
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#pragma GCC optimize ("Ofast")
void scan(){}
template<typename F, typename... R> void scan(F &f,R&... r){cin>>f;scan(r...);}
int di_; string dnms_, co_ = ",";
void debug_(){cout<<endl;}
template<typename F, typename... R> void debug_(F &f, R&... r){while(dnms_[di_] != ',')cout<<dnms_[di_++];di_++;cout<<": "<<f<<",";debug_(r...);}
#define debug(...) dnms_=#__VA_ARGS__+co_,di_=0,debug_(__VA_ARGS__)

template<class A, class B> ostream& operator<<(ostream& out, const pair<A, B> &a){
    return out<<"("<<a.first<<","<<a.second<<")";}
template<class A> ostream& operator<<(ostream& out, const vector<A> &a){
	out<<"";for(auto it=a.begin();it!=a.end();it++){if(it!=a.begin())out<<" ";out<<*it;}out<<"";
	return out;}
template<class A, class B> istream& operator>>(istream& in, pair<A,B> &a){in>>a.first>>a.second;return in;}
template<class A> istream& operator>>(istream& in, vector<A> &a){for(A &i:a)in>>i;return in;}

int main(){
	IOS

	int m,d;
	cin>>m>>d;
	int c=0;
	for(int i=1;i<=m;i++)
	{
		for(int j=22;j<=d;j++)
		{
			int d1 = j%10;
			int d10 = (j/10)%10;
			if(d1>1&&d10>1&&(d1*d10==i))
				c++;
		}
	}	
 	cout<<c;
	return 0;	
}

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

int a, b, c, d;

int main(void){
  // Here your code !
  scanf("%d %d %d %d", &a, &b, &c, &d);

  if (abs(a - c) <= d || (abs(a - b) <= d && abs(b - c) <= d)) printf("Yes\n");
  else printf("No\n");

  return 0;
}


Measured memory_bytes: 764
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <numeric>
#include <set>
#include <list>
#include <map>
#include<queue>

const int INF = 1 << 28;
using namespace std;
using Graph = vector<vector<int>>;

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

vector<int> seen(50,-1);
int counter_for_dfs = 0;
void dfs(Graph &G, int v) {
	seen[v] = counter_for_dfs;
	counter_for_dfs++;
	for (auto v_next : G[v]) {
		if (seen[v_next]>=0)continue;

		dfs(G, v_next);
	}
}

void bfs(Graph &G) {
	vector<int> dist(G.size(), -1);
	queue<int> que;
	
	dist[0] = 0;
	que.push(0);
	while (!que.empty()) {
		int v = que.front();
		que.pop();

		for (int g : G[v]) {
			if (dist[g] != -1)continue;
			dist[g] = dist[v] + 1;
			que.push(g);
		}
	}
	for (auto i : dist) {
		cout << i << " ";
	}
}

int main()
{
	int n;
	std::vector<int> v;
	double sum ;
	std::cin >> n;
	for (int i = 0; i < n; i++) {
		int a;
		std::cin >> a;
		v.push_back(a);
	}
	std::sort(v.begin() , v.end());
	sum = v[0];
	for (int i = 1; i < n; i++) {
		sum = (sum + v[i]) / 2;
	}
	std::cout << sum;

}

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

using namespace std;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep(i,j,n) for(ll (i)=(j);(i)<(n);(i)++)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
#define en '\n'
typedef pair<ll, ll> P;
const long long INF = 1LL << 60;
const long long MOD = 1e9 + 7;
typedef vector<ll> Array;
typedef vector<Array> Matrix;
const int loose = 0;
const int tight = 1;

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

//グラフ関連
struct Edge {//グラフ
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
		to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

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

	ll n,k;
	cin>>n>>k;
	Array a(n,0);
	REP(i,n) cin>>a[i];

	sort(all(a));

	auto check = [&](ll x, ll ai)->ll{
		if(ai >= 0){
			ll l=-1;
			ll r=n;
			while(r-l>1){
				ll mid=l+r>>1;
				if(a[mid]*ai<=x) l=mid;
				else r=mid;
			}
			return r;
		}else{
			ll l=-1;
			ll r=n;
			while(r-l>1){
				ll mid=l+r>>1;
				if(a[mid]*ai<=x) r=mid;
				else l=mid;
			}
			return n-r;
		}	
	};

	ll l=-INF;
	ll r=INF;
	while(r-l>1){
		ll mid=l+r>>1;
		ll con=0;
		REP(i,n){
			con+=check(mid,a[i]);
			if(a[i]*a[i]<=mid) con--;
		}
		con/=2;
		if(con>=k) r=mid;
		else l=mid;
	}

	cout<<r<<en;
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const LL mod=1000000007;
const LL LINF=1LL<<60;
const int INF=1<<30;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};



int main(){
    int a,b;cin >> a >> b;
    cout << (a^b) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
long long int prime(long long int n)
{
	if (n < 2)
		return n;
	long long int i;
	for (i = 2; i * i <= n; i++)
		if (n % i == 0)
			return i;
	return n;
}
long long int fact[200005];
long long int modpow(long long int a, long long int n, long long int p)
{
	if (n < 0)
		return 0;
	long long int res = 1;
	while (n > 0)
	{
		if (n % 2 > 0)
			res = res * a % p;
		a = a * a % p;
		n /= 2;
	}
	return res;
}
long long int comb(long long int n, long long int r, long long int p)
{
	if (n < 0 || r < 0 || n < r)
		return 0;
	long long int res = fact[n];
	res = res * modpow(fact[r], p - 2, p) % p;
	res = res * modpow(fact[n - r], p - 2, p) % p;
	return res;
}
int main()
{
	long long int n, m;
	scanf("%lld %lld", &n, &m);
	long long int ans = 1;
	long long int p = 1000000007;
	long long int c, q;
	fact[0] = 1;
	for (c = 1; c < 200005; c++)
		fact[c] = fact[c - 1] * c % p;
	while (m > 1)
	{
		q = prime(m);
		c = 0;
		while (m % q == 0)
		{
			c++;
			m /= q;
		}
		ans = ans * comb(c + n - 1, c, p) % p;
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 1664
//                                               KEEP GRINDING
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 

using namespace std;
using namespace __gnu_pbds; 

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>   new_data_set;

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 

#define int long long
#define ld long double
#define MOD 1000000007
#define mod 998244353
#define precise(i) fixed << setprecision(10) << i
#define f(i,a,b) for(int i=a;i<b;++i)

#define endl '\n'
#define debug cout<<"\n========================================\n"<<endl;
#define err1(a) cout<<#a<<" "<<a<<endl;
#define err2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl;
#define err3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl;
#define err4(a,b,c,d) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl;

#define all(a) a.begin(),a.end()
#define show(a) for(auto xyz:a)cout<<xyz<<" ";cout<<endl;
#define PQ priority_queue
#define mx(a) *max_element(a)
#define mn(a) *min_element(a) 
#define LB lower_bound  //THIS GIVES THE ITR TO THE ELEMENT IN RANGE [SI,EI) THAT IS >= OUR VALUE 
#define UB upper_bound  //THIS GIVES THE ITR TO THE ELEMENT IN RANGE [SI,EI) THAT IS > OUR VALUE 

#define fr first
#define sc second

#define MAXN 500000
#define INF 9223372036854775807
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
int h , w , k;
bool in(int &i,int &j){
	return ( i>=1 && j>=1 && i<=h && j<=w );
}
signed main(){
    fastio
    cin >> h >> w >> k;
    int si , sj , ei , ej;
    cin >> si >> sj >> ei >> ej;
    char a[h+1][w+1];
    int  d[h+1][w+1];
    f(i,1,h+1)
    	f(j,1,w+1){
    		cin >> a[i][j];
    		d[i][j]=INF;
		}
    d[si][sj]=0;
    PQ< pair< int , pair< int , int > > > pq; 

    f(i,1,h+1)
    	f(j,1,w+1)
    		if(a[i][j]!='@')
    		    pq.push( { (-1)*d[i][j] , {i,j} } );
		
    	  
    	    
    while(pq.size()){
    	auto ft=pq.top();
    	pq.pop();
    	int i=ft.sc.fr,j=ft.sc.sc;
    	if(d[i][j]==INF){
    		puts("-1");
    		return 0;
		}
    	if( i==ei && j==ej ){
    		cout<< d[ei][ej] ;
    		return 0;
		}
		f(dir,0,4){
			int ni=i+dx[dir],nj=j+dy[dir],cnt=0;
			while( in(ni,nj) && cnt<k && a[ni][nj]=='.'){
				if( d[ni][nj] > 1 + d[i][j] ){
					d[ni][nj] = 1 + d[i][j];
					pq.push( { (-1)*d[ni][nj] , {ni,nj} } );
				}else if(d[ni][nj] < 1 + d[i][j]){
					break;
				}
				ni+=dx[dir],nj+=dy[dir],cnt++;
			}
		}
	}
}

Measured memory_bytes: 36656
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
	int n,i;
	scanf("%i",&n);
	vector<int> a(n);
	map<ll,int> cnt;
	ll sum=0,ans=0;
	cnt[0]++;
	for(i=0;i<n;i++) scanf("%i",&a[i]),sum+=a[i],ans+=cnt[sum],cnt[sum]++;
	printf("%lld\n",ans);
	return 0;
}

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

const int inf = 1e9 + 19;

bool ok (string &s) {
    set < char > cs;
    for (char c: s)
        cs.insert(c);
    return bool(int(cs.size()) == 1);
}

signed main () {
    string t;
    cin >> t;
    int ans = inf;
    for (char here = 'a'; here <= 'z'; ++here) {
        int now = 0;
        string s = t;
        while (!ok(s)) {
            string cur(int(s.size()) - 1, '0');
            map < char, int > cnt;
            for (int i = 0; i < int(s.size()) - 1; ++i) 
                ++cnt[s[i]];
            for (int i = 0; i < int(s.size()) - 1; ++i) {
                if (s[i] == here || s[i + 1] == here)
                    cur[i] = here;
                else if (rand() & 1)
                    cur[i] = s[i];
                else
                    cur[i] = s[i + 1];
            }
            s = cur;
            ++now;
        }
        ans = min(ans, now);
    }
    cout << ans << '\n';
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::{max, min};

struct Scanner {
    ptr: usize,
    length: usize,
    buf: Vec<u8>,
    small_cache: Vec<u8>,
}

#[allow(dead_code)]
impl Scanner {
    // from kenkoooooo
    fn new() -> Scanner {
        Scanner {
            ptr: 0,
            length: 0,
            buf: vec![0; 1024],
            small_cache: vec![0; 1024],
        }
    }

    fn load(&mut self) {
        use std::io::Read;
        let mut s = std::io::stdin();
        self.length = s.read(&mut self.buf).unwrap();
    }

    fn byte(&mut self) -> u8 {
        if self.ptr >= self.length {
            self.ptr = 0;
            self.load();
            if self.length == 0 {
                self.buf[0] = b'\n';
                self.length = 1;
            }
        }

        self.ptr += 1;
        return self.buf[self.ptr - 1];
    }

    fn is_space(b: u8) -> bool {
        b == b'\n' || b == b'\r' || b == b'\t' || b == b' '
    }

    fn read_vec<T>(&mut self, n: usize) -> Vec<T>
    where
        T: std::str::FromStr,
        T::Err: std::fmt::Debug,
    {
        (0..n).map(|_| self.read()).collect()
    }

    fn usize_read(&mut self) -> usize {
        self.read()
    }

    fn read<T>(&mut self) -> T
    where
        T: std::str::FromStr,
        T::Err: std::fmt::Debug,
    {
        let mut b = self.byte();
        while Scanner::is_space(b) {
            b = self.byte();
        }

        for pos in 0..self.small_cache.len() {
            self.small_cache[pos] = b;
            b = self.byte();
            if Scanner::is_space(b) {
                return String::from_utf8_lossy(&self.small_cache[0..(pos + 1)])
                    .parse()
                    .unwrap();
            }
        }

        let mut v = self.small_cache.clone();
        while !Scanner::is_space(b) {
            v.push(b);
            b = self.byte();
        }
        return String::from_utf8_lossy(&v).parse().unwrap();
    }
}

fn main() {
    let mut sc = Scanner::new();
    let n: i64 = sc.read();
    let mut m = n;
    let mut s = 0;
    while m != 0 {
        s += m % 10;
        m /= 10;
    }
    if n % s == 0 {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.IntStream;
//import java.io.*;
//import java.util.stream.IntStream;

public class Main {
    static int minR = Integer.MAX_VALUE;
    static int maxL = 0;

    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        // BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        // try{
        // int n = Integer.parseInt(br.readLine());
        int n = Integer.parseInt(sc.nextLine());
        int[] T = Arrays.stream(sc.nextLine().split(" ")).mapToInt(Integer::parseInt).toArray();
        int q = Integer.parseInt(sc.nextLine());
        int[] S = Arrays.stream(sc.nextLine().split(" ")).mapToInt((s) -> Integer.parseInt(s)).toArray();
        
        AtomicInteger count = new AtomicInteger();

        Arrays.stream(S)
            .forEach((elm)->{
                boolean flag = binarySearch(elm, T, 0, T.length);
                        if (flag) {
                            count.getAndIncrement();
                        }
                    });
        
        System.out.println(count);

        }

        public static boolean binarySearch(int elm, int[] T, int l, int r) {
        int m = (l + r) / 2;
        if(elm == T[m]){
            return true;
        }
        if(m == l){
            return false;
        }
        if(elm < T[m]){
            return binarySearch(elm, T, l, m);
        }else{
            return binarySearch(elm, T, m, r);
        }
    }
}


Measured memory_bytes: 70328
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
ll inf =  1e9+7;


int main(){
	ll n,m;
	cin>>n>>m;
	vector<ll> dp(n+2,0);
	vector<bool> used(n+2,true);
	dp[0] = 1;
	for(int i = 0; i<m ;i++){
		int tmp;
		cin>>tmp;
		used[tmp] = false;
	}
	for(int i=0;i<n;i++){
		if(used[i]){
			dp[i+1] += dp[i];
			dp[i+1] %= inf;
			dp[i+2] += dp[i];
			dp[i+2] %= inf;
		}
	}
	if(used[n]){
		cout<<dp[n]<<endl;
	}else{
		cout<<0<<endl;
	}


	return 0;
}


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

#define FOR(i,a,n) for (int i = a; i < (int)n; ++i)
#define REP(i,n) FOR(i,0,n)
#define whole(f,x,...) ([&](decltype((x)) whole) { \
    return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
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;}

using ll = int_fast64_t;

constexpr ll INF = (1e9);
constexpr ll MOD = (1e9+7);

vector<ll> v[4];

int main() {
  ll n, w; cin >> n >> w;
  ll w0, v0; cin >> w0 >> v0;
  v[0].push_back(v0);
  FOR(i,1,n) {
    ll wt, vt;
    cin >> wt >> vt;
    v[wt-w0].push_back(vt);
  }
  REP(i,4) whole(sort, v[i], greater<ll>());
  REP(i,4) v[i].insert(v[i].begin(), 0);
  REP(i,4) FOR(j,1,v[i].size()) v[i][j] += v[i][j-1];
  ll ans = 0;
  REP(i0, v[0].size()) REP(i1, v[1].size()) REP(i2, v[2].size()) REP(i3, v[3].size()) {
    if (i0*w0 + i1*(w0+1) + i2*(w0+2) + i3*(w0+3) <= w) {
      chmax(ans, v[0][i0]+v[1][i1]+v[2][i2]+v[3][i3]);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#pragma region Macros
#include <bits/stdc++.h>
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
using namespace std;
#pragma endregion
int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	int A, B, C, D;
	cin >> A >> B >> C >> D;

	if (A + B > C + D)
	{
		cout << "Left" << '\n';
	}
	else if (A + B < C + D)
	{
		cout << "Right" << '\n';
	}
	else
	{
		cout << "Balanced" << '\n';
	}

	return 0;
}


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


inline int popcount(unsigned int x){
	x = (x>>1 & 0x55555555)+(x & 0x55555555);
	x = (x>>2 & 0x33333333)+(x & 0x33333333);
	x = (x>>4 & 0x0f0f0f0f)+(x & 0x0f0f0f0f);
	x = (x>>8 & 0x00ff00ff)+(x & 0x00ff00ff);
	return (x>>16)+(x & 0x0000ffff);
}

int main(){
	char rev[256];
	for(int i=0;i<256;i++)rev[i]=i;
	rev['(']=')';
	rev['{']='}';
	rev['[']=']';
	rev[')']='(';
	rev['}']='{';
	rev[']']='[';
		
	string s;
	int ans=0;
	cin>>s;
	int n=s.size();
	for(int i=1;i<(1<<n);i++){
		string t;
		for(int j=0;j<n;j++){
			if(i>>j&1)t+=s[j];
		}
		if(t.find("iwi",0)==string::npos)continue;
		int len=popcount(i);
		if(len<=ans)continue;
		bool ok=true;
		for(int j=0;j<len/2;j++){
			if(rev[t[j]]!=t[len-1-j])ok=false;
		}
		if(len%2&&t[len/2]!=rev[t[len/2]])ok=false;
		if(ok)ans=len;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1196
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>

using namespace std;

#define ll long long
int main(){
   
   int N,ans=0,cnt=0;
   string S;
   cin>>N>>S;
   bool flag[30];
   
   for(int i=1;i<N;i++){
       for(int j=0;j<26;j++)flag[j]=false;
       
       for(int j=0;j<i;j++){
           
           for(int k=i;k<N;k++){
               
               if(S[j]==S[k])flag[S[j]-'a']=true;
               
           }
           
       }
       cnt=0;
       for(int j=0;j<26;j++)if(flag[j])cnt++;
       ans=max(ans,cnt);
       
   }
   cout<<ans<<endl;
   
   return 0;
}

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

#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define for1(i, n) for (int i = 1; i <= int(n); ++i)
#define ms(a, x) memset(a, x, sizeof(a))
#define F first
#define S second
#define all(x) (x).begin(),(x).end()
#define pb push_back

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 0x3f3f3f3f;
mt19937 gen(chrono::steady_clock::now().time_since_epoch().count());
template<typename... T> void rd(T&... args) {((cin>>args), ...);}
template<typename... T> void wr(T... args) {((cout<<args<<" "), ...);cout<<endl;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int x;
    cin>>x;
    x%=10;
    if(x==2||x==4||x==5||x==7||x==9) cout<<"hon";
    else if(x==3) cout<<"bon";
    else cout<<"pon";
    return 0;
}



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

int main()
{
ll n ;
cin >> n ;
rep(i,n){
  if((i+1)%3!=0&&(i+1)%5!=0)ans+=i+1;
}
cout << ans << endl;
return 0;
}

Measured memory_bytes: 3636
#include<stdio.h>
 
int main()
{
  int t[4][14];
  int n, i,j,c;
  char m, d;
  for(i=0; i < 4; i++){
    for(j=0; j < 14; j++){
      t[i][j]=0;
    }
  }
 scanf("%d", &c);
  for(i = 0; i < c; i++){
    scanf("%c", &d);
    scanf("%c %d", &m, &n);
    if(m == 'S'){
      t[0][n] = 1;
    }
    else if(m == 'H'){
      t[1][n] = 1;
    }
    else if(m == 'C'){
      t[2][n] = 1;
    }
    else if(m == 'D'){
      t[3][n] = 1;
    }
  }
  for(j=1; j < 14; j++){
    if(t[0][j] != 1){
      printf("S %d\n", j);
    }
  }
 
 for(j=1; j < 14; j++){
    if(t[1][j] != 1){
      printf("H %d\n", j);
    }
  }
 
 for(j=1; j < 14; j++){
    if(t[2][j] != 1){
      printf("C %d\n", j);
    }
  }
 
 for(j=1; j < 14; j++){
    if(t[3][j] != 1){
      printf("D %d\n", j);
    }
  }
 return 0;
}


Measured memory_bytes: 2104
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cstring>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <stack>
#include <cmath>
#include <time.h>
#include <unordered_set>
#include <unordered_map>
#define ll long long
#define LINF 0x3f3f3f3f3f3f3f3f
#define INF 0x3f3f3f3f
#define PI 3.14159265
#define RAND (rand()*rand())
#define MAX(x, y) ((x) > (y) ? (x):(y)) 
#define MIN(x, y) ((x) > (y) ? (y):(x))
#define ABS(x) ((x) > 0 ? (x) : -(x))
#define CEIL(x, y) (((x) + (y) - 1)/(y))
using namespace std;
const int MAXN = 1e5 + 5;
const ll MOD = 1e9 + 7;
int N, M, K, Q, L;
int dist[305][305][2];

void floyd(int opt) {
	for (int k = 1; k <= N; ++k) {
		for (int i = 1; i <= N; ++i) {
			if (i == k) continue;
			for (int j = 1; j <= N; ++j) {
				if (k == j || i == j) continue;
				if (dist[i][k][opt] == INF || dist[k][j][opt] == INF) continue;
				if (dist[i][j][opt] > dist[i][k][opt] + dist[k][j][opt]) dist[i][j][opt] = dist[i][k][opt] + dist[k][j][opt];
			}
		}
	}
	return;
}



int main()
{
	int i, j, u, v, c;
	scanf("%d%d%d", &N, &M, &L);
	for (i = 1; i <= N; ++i) {
		for (j = 1; j <= N; ++j) {
			if (i == j) dist[i][j][0] = dist[i][j][1] = 0;
			else dist[i][j][0] = dist[i][j][1] = INF;
		}
	}

	for (i = 1; i <= M; ++i) {
		scanf("%d%d%d", &u, &v, &c);
		if (c > L) continue;
		dist[u][v][0] = dist[v][u][0] = c;
	}
	floyd(0);
	
	for (i = 1; i <= N; ++i) {
		for (j = 1; j <= N; ++j) {
			if (i == j) continue;
			if (dist[i][j][0] <= L) dist[i][j][1] = 1;
		}
	}
	floyd(1);
	scanf("%d", &Q);
	for (i = 1; i <= Q; ++i) {
		scanf("%d%d", &u, &v);
		if (dist[u][v][1] == INF) printf("-1\n");
		else printf("%d\n", dist[u][v][1] - 1);
	}
	return 0;
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e18
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pb push_back
#define ff first
#define ss second
#define vll vector<ll>
#define pii pair<ll,ll>
#define sz(v) (v).size()
#define srt(v) sort(v.begin(),v.end())
#define ull unsigned long long
#define tell(a) cout<<a<<" "
#define el cout<<endl
#define rev(v) reverse(v.begin(),v.end())
#define rep(i,a,n) for(int i=a;i<n;i++)
#define M 1000000007
ll power(ll x, ll y, ll p){ll res = 1;x = x % p;while (y > 0){   if (y & 1)res = (res*x) % p;y = y>>1;
x = (x*x) % p;}return res;}
 
 
 
int main()
{
	IOS;
	double r;
	cin>>r;
	r=2*(M_PI)*r;
	cout<<r;
	
	
	
	
	
	
	
}

Measured memory_bytes: 3800
#include<iostream>
#include<vector>

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

using namespace std;
typedef long long ll;

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

    vector<int> v(n);

    rep(i,n){
        int a;
        cin >> a;
        v.at(a-1) = i;
    }

    rep(i,n){
        cout << v.at(i) + 1 << " ";
    }


    return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
const ll mod=1e9+7;

int main(){
	int N;
	cin >> N;
	vi A(N+2,0);
	vi dist(N+1);
	for(int i=1; i<=N; i++){
		cin >> A[i];
		dist[i-1]=abs(A[i]-A[i-1]);
	}
	dist[N]=abs(A[N]);

	int sum=0;
	for(int i=0; i<N+1; i++){
		sum+=dist[i];
	}

	for(int i=1; i<N+1; i++){
		cout << sum-dist[i-1]-dist[i]+abs(A[i+1]-A[i-1]) << endl;
	}

	return 0;
}

Measured memory_bytes: 2048
#include <iostream>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
const long long MOD = 1e9 + 7;
using namespace std;
typedef long long ll;

map<ll, int> mp;
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << setprecision(20);
	int n, x;
	cin >> n >> x;
	vector<int> a(n);
	int sum = 0;
	int counter = 1;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		sum += a[i];
		if (sum > x) break;
		else counter++;
	}
	cout << counter << endl;
	return 0;
}


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

fn main() {
    let n: usize = read();
    let x: Vec<usize> = (0..n).map(|_| read::<usize>() - 1).collect();
    let mut data: Vec<(usize, usize)> = vec![(0, 0); n];
    for i in 0..n {
        data[i] = (x[i], i);
    }
    data.sort();

    let mut check = true;
    let inf = 1 << 29;
    let mut ans: Vec<usize> = vec![inf; n * n];
    for i in 0..n {
        ans[data[i].0] = i;
    }
    let mut now = 0;
    let mut count = 0;
    let mut before = true;
    for i in 0..n * n {
        if ans[i] == inf {
            if before {
                if data[now].1 == 0 {
                    now += 1;
                    count = 0;
                }
                ans[i] = data[now].1;
                count += 1;
                if count >= data[now].1 {
                    if now == n - 1 || (now == n - 2 && data[now + 1].1 == 0) {
                        before = false;
                        now = 0;
                        count = data[now].1;
                    } else {
                        now += 1;
                        count = 0;
                    }
                }
            } else {
                if data[now].1 == n - 1 {
                    now += 1;
                    count = data[now].1;
                }
                ans[i] = data[now].1;
                count += 1;
                if count >= n - 1 {
                    now += 1;
                    if now < n {
                        count = data[now].1;
                    }
                }
            }
        } else {
            if (before && ((now < ans[i]) || (now == ans[i] && count < data[now].1)))
                || (!before && ((now > ans[i]) || (now == ans[i] && count > data[now].1)))
            {
                check = false;
                break;
            }
            ans[i] = data[ans[i]].1;
        }
    }

    if check {
        println!("Yes");
        for i in 0..n * n {
            if i != 0 {
                print!(" ");
            }
            print!("{}", ans[i] + 1);
        }
        println!();
    } else {
        println!("No");
    }
}

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


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

const int mod = 1e9+7;
const int INF = 2000000;

int main() {
    
    int N,W;
    cin >> N >> W;
    int v[N+1],w[N+1];
    for(int i=1;i<=N;++i) cin >> v[i] >> w[i];
    int dp[W+1005];
    memset(dp, 0, sizeof(dp));
    for(int i=1;i<=N;++i) {
        for(int j=0;j+w[i]<=W;++j) dp[j+w[i]] = max(dp[j+w[i]], dp[j]+v[i]);
    }
    cout << dp[W] << endl;
}



Measured memory_bytes: 3140
N, K = map(int, input().split())
LRs = [tuple(map(int, input().split())) for _ in range(K)]

MOD = 998244353

dp = [0] * (N + 1)
dp_csum = [0] * (N + 2)
dp[1] = 1
dp_csum[2] = 1
for i in range(2, N + 1):
    for L, R in LRs:
        dp[i] += dp_csum[max(0, i - L + 1)] - dp_csum[max(0, i - R)]
        dp[i] %= MOD
    dp_csum[i + 1] = dp_csum[i] + dp[i]
    dp_csum[i + 1] %= MOD

# print(dp)
# print(dp_csum)

print(dp[N])

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

int main(){
    string s;
    cin >> s;
    if (s.size()%2!=0) {
        puts("No");
        return 0;
    } 
    bool ok = true;
    for (int i=0; i<s.size(); i+=2) {
        char h = s[i];
        char ii = s[i+1];
        if (h!='h'||ii!='i') {
            ok = false;
            break;
        }
    }
    if (ok) puts("Yes");
    else puts("No");
    return 0;
}

Measured memory_bytes: 256