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

using namespace std;

#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"
#define Printv(v)                                                              \
    {                                                                          \
        FOREACH(x, v) { cout << x << " "; }                                    \
        cout << "\n";                                                          \
    }

typedef long long ll;
typedef unsigned long long ul;
typedef vector<ll> VL;
typedef pair<ll, ll> PL;
typedef priority_queue<ll> PQ;
typedef priority_queue<ll, VL, greater<ll>> PQG;

const int INF = 1e9;
const int MOD = 1e9 + 7;
// const int MOD = 998244353;
const ll LINF = 1e18;
const ll dx[] = {1, -1, 0, 0};
const ll dy[] = {0, 0, 1, -1};

ll N, Q;
vector<tuple<string, ll, ll>> tup;

int main() {
    cin >> N;
    REP(i, N) {
        SCIN(s);
        LCIN(p);
        tup.emplace_back(s, -p, i + 1);
    }
    sort(All(tup));
    FOREACH(t, tup) { cout << get<2>(t) << "\n"; }
    return 0;
}

Measured memory_bytes: 256
if __name__ == "__main__":
    x,y = map(int,input().split())
    flag = 0
    for i in range(x + 1) :
        if i * 4 + (x - i) * 2 == y :
            print("Yes")
            flag = 1
            break 

    if flag == 0 :
        print("No")

Measured memory_bytes: 9176
#![allow(unused_imports)]
#![allow(unused_variables)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(deprecated)]

use std::cell::{Cell, Ref, RefCell, RefMut};
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;
use std::usize;

const MOD_10_9_7: u64 = 1_000_000_007;
const INF: i64 = 1_000_000_000_000;
const MIN_INF: i64 = -1_000_000_000_000;

/// FYI: https://github.com/vain0x/scan-bench
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($t:ty) =>
        (rl().parse::<$t>().unwrap());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}

#[allow(unused_macros)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn main() {
    let (n, k) = read!(usize, usize);
    let h: Vec<i32> = read![[i32]];

    let mut dp = vec![0; n];
    dp[0] = 0;

    for i in 1..n {
        let mut min_cost = 1 << 30;
        for j in 1..(k + 1) {
            // 足場iに i - j から飛んでくるとき
            if i < j {
                break;
            }
            let cost_ij = match dp.get(i - j) {
                Some(&a) => a,
                None => break,
            };
            min_cost = min(min_cost, cost_ij + (h[i - j] - h[i]).abs());
        }
        dp[i] = min_cost;
    }

    println!("{}", dp[n - 1]);
}


Measured memory_bytes: 4352
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <unordered_map>
#include <queue>
#define LL long long
using namespace std;
LL read() {
    LL k = 0, f = 1; char c = getchar();
    while(c < '0' || c > '9') {
        if(c == '-') f = -1;
        c = getchar();
    }
    while(c >= '0' && c <= '9')
        k = k * 10 + c - 48, c = getchar();
    return k * f;
}
struct zzz {
    int c, v;
    bool operator < (const zzz &y) const{
		return v < y.v;
	}
}a[100010];
bool cmp(zzz x, zzz y) {
    if(x.c != y.c) return x.c < y.c;
    return x.v > y.v;
}
struct hhh {
    int c, v;
    bool operator < (const hhh &y) const{
		return v < y.v;
	}
};
priority_queue <hhh> q;
int main() {
    int n = read(), m = read();
    for(int i = 1; i <= n; ++i)
        a[i].c = read(), a[i].v = read();
    sort(a+1, a+n+1, cmp);
    //for(int i = 1; i <= n; ++i) cout << a[i].c << endl;
    int ans = 0, pos = 1;
    for(int i = 1; i <= m; ++i) {
        while(pos <= n) {
            if(a[pos].c <= i) q.push((hhh){a[pos].c, a[pos].v});
            else break;
            ++pos;
        }
        if(!q.empty())
            ans += q.top().v, q.pop();
    }
    cout << ans;

    return 0;
}

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

using namespace std;

#define int long long

void solve() {
    int k;
    cin >> k;

    string s;
    cin >> s;
    if (k >= s.size()) cout << s;
    else {
        for (int i = 0; i < k; ++i) cout << s[i];
        cout << "...";
    }
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}


Measured memory_bytes: 3608
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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

const ll mod=1e9+7;

int main()
{
    ll n,x;
    cin >> n >> x;
    vector<ll> l(n);
    rep(i,n){
        cin >> l[i];
    }
    ll cnt=1;
    ll sum=0;
    while(sum+l[cnt-1]<=x){
        sum+=l[cnt-1];
        cnt++;
        if(cnt==n+1) break;
    }
    cout << cnt << endl;
    return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(t) t.begin(), t.end()
#define inrange(i, a, b) (((i)>= min((a), (b))) && ((i) <= max((a), (b))))
#define show(x) cout << #x << " is " << x << "\n";
typedef vector<ll> vi;
#define fi first
#define se second
const ll inf = 9e18;
const ll mod = 1e9 + 7;

void print(ll a[], ll n){for(ll i=0;i<n;i++){cout<<a[i]<<" ";}cout<<"\n";}
ll power(ll x, ll y, ll M = inf){
    ll ans = 1;
    x %= M;
    while(y){
        if(y&1)
            ans = (x * ans) % M;

        x = (x * x) % M;
        y >>= 1;
    }
    return ans;
}
ll modInverse(ll n) {return power(n, mod-2, mod);}
inline ll mul(ll a, ll b){ return (a * b) % mod; }
inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += mod; return c; }
inline ll add(ll a, ll b){ ll c = a + b; if(c > mod) c -= mod; return c; }
inline ll divi(ll a, ll b){ return mul(a, modInverse(b)); }

//const ll N = 1e5 + 1;
//vector<ll> adj[N];
//bool visited[N];

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

	ll n;
	cin>>n;
	ll a[n];
	ll sum = 0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		sum+=a[i];
	}
	ll x = sum;
	for(int i=1;i<n-1;i+=2){
		sum-=2*(a[i]);
	}
	cout<<sum<<" ";
	ll temp = sum;
	for(int i=1;i<n;i++){
		cout<< 2*a[i-1] - temp<<" ";
		temp = 2*a[i-1] - temp;
	}
	return 0;
}


Measured memory_bytes: 2176
#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() {
  vector<vector<int>> A(3, vector<int>(3));
  rep(i, 3) rep(j, 3){
    cin >> A.at(i).at(j);
  }
  int N;
  cin >> N;
  rep(i, N){
    int b;
    cin >> b;
    rep(x, 3) rep(y, 3){
      if(A.at(x).at(y) == b){
        A.at(x).at(y) = 0;
      }
    }
  }
  bool bingo = false;
  rep(i,3){
    int all = 0;
    rep(j,3){
      all += A.at(i).at(j);
    }
    if(all==0){
      bingo = true;
      break;
    }
  }
  rep(j,3){
    int all = 0;
    rep(i,3){
      all += A.at(i).at(j);
    }
    if(all==0){
      bingo = true;
      break;
    }
  }
  if(A.at(0).at(0) + A.at(1).at(1) + A.at(2).at(2) == 0){
    bingo = true;
  }
  if(A.at(0).at(2) + A.at(1).at(1) + A.at(2).at(0) == 0){
    bingo = true;
  }
  if(bingo){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
	int a,b;
	char op;
	for(;;){
		scanf("%d %c %d",&a,&op,&b);
		if(op=='+'){
			printf("%d\n",a+b);
		}else if(op=='-'){
			printf("%d\n",a-b);
		}else if(op=='*'){
			printf("%d\n",a*b);
		}else if(op=='/'){
			printf("%d\n",a/b);
		}else if(op=='?'){
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 600
import java.io.*;

class Main{
  public static void main(String[] args) throws IOException{
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String s = br.readLine();
    String p = br.readLine();
    s += s;
    if (s.contains(p)){
      System.out.println("Yes");
    }
    else {
      System.out.println("No");
    }
  }
}

Measured memory_bytes: 24408
l=[]
m=[]
for i in range(10):
    n=int(input())
    l.append(n)
    l.sort()
    l.reverse()
for k in range(10):
    a=int(input())
    m.append(a)
    m.sort()
    m.reverse()
print(sum(l[0:3]),sum(m[0:3]))


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

int main()
{
    int n;
    std::cin >> n;
    std::vector<int> a(n);
    std::vector<int> res;
    for (int i = 0; i < n; i++) { std::cin >> a[i]; }

    int cnt = 0;
    int now = 1;
    for (int i = 0; i < n; i++) {
        if (a[i] != now)
            cnt++;
        else {
            res.push_back(now);
            now++;
        }
    }

    if (res.size() < 1 || res.back()!= now-1)
        cnt = -1;

    std::cout << cnt << std::endl;
    return 0;
}


Measured memory_bytes: 2168
#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()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a/gcd(a,b)*b; }
typedef pair<int, int> P;
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const ll MOD = 1e9+7;

int main() {
	int n;
	cin >> n;
    vector<ll> a(n);
    set<ll> s;
    rep(i,n) {
        cin >> a[i];
        s.insert(a[i]);
    }
    if (a.size() == s.size()) cout << "YES" << endl;
    else                      cout << "NO"  << endl;
	return 0;
}


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

int main() {
  string S;
  cin >> S;
  int res = 10000;
  for (int i = 0; i < S.length(); i++) {
    string tmp;
    int tmpi;
    if (i+3 <= S.length()) {
      for (int j = 0; j < 3; j++) {
        tmp += S[i+j];
      }
    }
    if (tmp.length() == 0) continue;
    tmpi = stoi(tmp);
    res = min(res, abs(tmpi - 753));
    if (i+4 <= S.length()) {
      for (int j = 0; j < 4; j++) {
        tmp += S[i+j];
      }
    }
    if (tmp.length() == 0) continue;
    tmpi = stoi(tmp);
    res = min(res, abs(tmpi - 753));
  }
  cout << res << endl;
  return 0;
}

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a*b/gcd(a, b);
}

int main()
{
    cout << fixed << setprecision(15);
    ll N, K;
    cin >> N >> K;

    // ll count = 0;
    // REP(i, N){
    //     ll a;
    //     cin >> a;
    //     count++;
    //     if(a == 1){
    //         break;
    //     }
    // }

    // ll ans = 0;
    // while(ans*K - (ans-1) < N){
    //     ans++;
    // }

    cout << ((N-2)/(K-1)) + 1 << endl;

    return 0;
}

Measured memory_bytes: 256
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>

auto& in = std::cin;
auto& out = std::cout;
#define all_range(C) std::begin(C), std::end(C)
const double PI = 3.141592653589793238462643383279502884197169399375105820974944;

template<typename T, typename U>
std::enable_if_t<std::rank<T>::value == 0> fill_all(T& arr, const U& v) {
	arr = v;
}
template<typename ARR, typename U>
std::enable_if_t<std::rank<ARR>::value != 0> fill_all(ARR& arr, const U& v) {
	for (auto& i : arr) {
		fill_all(i, v);
	}
}

bool used[2001];
int32_t N,K,Q;
int32_t A[2000];

int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);
	in.tie(nullptr);
	out.tie(nullptr);

	in >> N>>K>>Q;
	for (int32_t i = 0; i < N; i++)
	{
		in >> A[i];
	}

	int32_t res = 1000000000 + 1;
	for (int32_t MIN_INDEX = 0; MIN_INDEX < N; MIN_INDEX++)
	{
		auto min = A[MIN_INDEX];



		using BS_INT = int32_t;
		BS_INT ok_range = 1000000000 + 1, ng_range = -1;
		while (std::abs(ok_range - ng_range) > 1) {
			BS_INT mid = (ok_range + ng_range) / 2;
			BS_INT max = min + mid;//[]
			bool is_ok = false;

			//ここに書く
			auto iter_used = 0;
			int useable = 0;
			int unuseable = 0;
			int32_t deleted_useable = 0;
			int32_t count = 0;
			for (int32_t i = 0; i < N; i++)
			{
				if (A[i] < min) { unuseable++; }
				if (min<=A[i]&&A[i] <= max) { useable++; }
				if (i < K-1) { continue; }


				if (unuseable <= 0&& useable>0) {
					++count;
					--useable;
					++deleted_useable;
				}
				else {
					while (iter_used < N) {
						auto a = A[iter_used];
						if (min <= a && a <= max) { 
							if (deleted_useable > 0) { --deleted_useable;++iter_used; continue; }
							--useable;
						}
						if (a < min) {
							--unuseable;
						}
						++iter_used;
						break;
					}
				}
			}

			is_ok = count >= Q;
			if (is_ok) {
				ok_range = mid;
			}
			else {
				ng_range = mid;
			}
		}

		res = std::min(ok_range, res);
	}
	out << res << endl;

	return 0;
}
#endif


Measured memory_bytes: 888
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
int INF = 1000000009;
int main()
{
    int n;
    cin >> n;
    ll fib[60];
    fib[0]=1;
    fib[1]=1;
    rep(i,n-1){
        fib[i + 2] = fib[i] + fib[i + 1];
    }
    cout << fib[n] << endl;
}


Measured memory_bytes: 3100
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;

inline bool is_prime(ll a){
    if(a<=1){return false;}
    for(ll i=2;i*i<=a;i++){
        if(a%i==0){return false;}
    }
    return true;
}


int main(){
    ll n;
    cin>>n;
    ll count=0;
    for(int i=0;i<n;i++){
        ll a;
        cin>>a;
        if(is_prime(a)){count++;}
    }
    cout<<count<<endl;
    
    
    
    return 0;
}



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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
#ifdef LOCAL
	std::ifstream in("in");
	std::cin.rdbuf(in.rdbuf());
#endif

	double t, x;
	cin >> t >> x;

	cout << t / x << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n;
int main(){
  cin>>n;
  long long res = 1e9;
  vector<int> vec(n, 0);
  for_each(vec.begin(), vec.end(), [&](int & x){cin>>x;});
  for(int i = 0; i <= 100; ++i){
    long long p = 0;
    for(auto x : vec){
      p += (x - i) * (x - i);
    }
    res = min(res, p);
  }
  cout<<res<<endl;
  return 0;
}


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

int main(){
  ll N; cin >> N;
  deque<ll> deq;
  for(ll i = 0; i < N; i++){
    ll a; cin >> a;
    if((N - i) % 2){
      deq.emplace_front(a);
    }else{
      deq.emplace_back(a);
    }
  }
  for(auto e : deq){
    cout << e << ' ';
  }
}

Measured memory_bytes: 3840
import java.util.HashSet;
import java.util.Scanner;

public class Main  {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        HashSet<Integer> hashSet = new HashSet<>();
        while (n > 0 ) {
            int val = sc.nextInt();
            if(hashSet.contains( val)) {
                System.out.println( "NO");
                return;
            }
            hashSet.add( val );
             n--;
        }

            System.out.println("YES");

    }
}


Measured memory_bytes: 102928
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long n,ans=0;
  cin >> n;
  vector<long> a(n);
  map<long,long> mp;
  for(long i=0;i<n;i++) {
    cin >> a[i];
    mp[a[i]]++;
  }
  for(auto itr=mp.begin();itr!=mp.end();itr++) {
    if((*itr).second%2!=0) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 10232
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

template<typename T>
struct RectangleSum {
	int H, W;
	vector<vector<T>> sum;
	RectangleSum(vector<vector<T>> v)
		:H(v.size()), W(v.front().size()), sum(H + 1, vector<T>(W + 1)) {
		rep(i, 0, H + 1)rep(j, 0, W + 1) {
			sum[i][j] = (i == 0 || j == 0) ? 0 :
				sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1] + v[i - 1][j - 1];
		}
	}
	//[si, ti), [sj, tj)
	T get(int si, int sj, int ti, int tj) {
		return sum[ti][tj] - sum[si][tj] - sum[ti][sj] + sum[si][sj];
	}
};


using P = pair<int, int>;
P dp[33][33][33][33];

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

	for (int h, w, s; cin >> h >> w >> s&&h;) {
		memset(dp, 0, sizeof(dp));
		int all = 0;
		vector<vector<int>> u(h, vector<int>(w));
		rep(i, 0, h) {
			rep(j, 0, w) {
				cin >> u[i][j];
				all += u[i][j];
			}
		}

		RectangleSum<int> rs(u);

		// (?????§??°???????????°. ?????§?????????)
		function<P(int, int, int, int)> dfs = [&](int si, int sj, int ti, int tj) {
			if (dp[si][sj][ti][tj].first != 0)
				return dp[si][sj][ti][tj];
			P ret(1, s - (all - rs.get(si, sj, ti, tj)));
			rep(i, si, ti) {
				if (all - rs.get(si, sj, i, tj) > s
					|| all - rs.get(i, sj, ti, tj) > s)
					continue;
				P a = dfs(si, sj, i, tj);
				P b = dfs(i, sj, ti, tj);
				P c(a.first + b.first, min(a.second, b.second));
				chmax(ret, c);
			}
			rep(j, sj, tj) {
				if (all - rs.get(si, sj, ti, j) > s
					|| all - rs.get(si, j, ti, tj) > s)
					continue;
				P a = dfs(si, sj, ti, j);
				P b = dfs(si, j, ti, tj);
				P c(a.first + b.first, min(a.second, b.second));
				chmax(ret, c);
			}
			return dp[si][sj][ti][tj] = ret;
		};

		int a, b;
		tie(a, b) = dfs(0, 0, h, w);
		cout << a << " " << b << endl;
	}
	return 0;
}

Measured memory_bytes: 12416
#include <cstdio>
using namespace std;
int pa, flag[11], N, ans[20];    //前面已经出现了几次 
int maxn; 
void print()
{
	for(int i=0;i<pa;i++)
	    printf("%c", ans[i]+96);
	printf("\n");
}
int MAX(int a, int b)
{
	return (a>b) ? a : b;
}
void dfs(int k)
{
//	printf("k = %d\n", k);
	for(int i=1;i<=k;i++)
	{
		if(i<=maxn||i==maxn+1)     //第k位 可以添加第i个字母
		{
			int temp = maxn;
			maxn = MAX(i, maxn);
			ans[pa++] = i;
			if(k==N)
			{
				print();
			}
			else dfs(k+1);
			ans[--pa] = 0;
			maxn = temp;
		}
		else return;
	}
}
int main()
{
	scanf("%d", &N);
	dfs(1);
	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)

int gcd(int a,int b){
	if(a%b==0) return b;
	else{
		a%=b;
		gcd(b,a);
	}
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,x;cin >> n >> x;
	vector<int> a(n);
	rep(i,n){
		cin >> a.at(i);
		a.at(i)=abs(x-a.at(i));
	}
	if(n==1){
		cout << a.at(0) << endl;
		return 0;
	}
	int g=gcd(a.at(0),a.at(1));
	rep(i,n-2){
		g=gcd(g,a.at(i+2));
	}
	cout << g << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i,j,sum=0;
    long long wt;
    cin>>n>>wt;
    int w[n],v[n];
    for(i=0;i<n;i++)
    {
        cin>>w[i]>>v[i];
        sum+=v[i];
    }
    vector<long long int> c(sum+1,0x3f3f3f3f);
    c[0]=0;
    for(i=0;i<n;i++)
    {
        for(j=sum-v[i];j>=0;j--)
        {
            c[j+v[i]]=min(c[j+v[i]],c[j]+w[i]);
        }
    }
    int ans=0;
    for(i=0;i<=sum;i++)
    {
        if(c[i]<=wt)
        {
            ans=max(ans,i);
        }
    }
    cout<<ans;
}


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

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
#ifdef _MSC_VER
inline unsigned int __builtin_popcount(unsigned int x) { return __popcnt(x); }
#endif // _MSC_VER
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan0
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














int N;
string X;
int cnt[201010];
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> N >> X;

	rep(i, 1, 201010) {
		int pp = __builtin_popcount(i);
		cnt[i] = cnt[i % pp] + 1;
	}

	reverse(all(X));

	int cn = 0;
	rep(i, 0, N) if (X[i] == '1') cn++;

	int tot1 = 0, p1 = 1;
	int tot2 = 0, p2 = 1;
	rep(i, 0, N) {
		if (X[i] == '1') {
			tot1 = (tot1 + p1) % (cn + 1);
			if (2 <= cn) tot2 = (tot2 + p2) % (cn - 1);
		}

		p1 = (p1 * 2) % (cn + 1);
		if (2 <= cn) p2 = (p2 * 2) % (cn - 1);
	}

	vector<int> ans;
	p1 = 1;
	p2 = 1;
	rep(i, 0, N) {
		if (X[i] == '1') {
			if (cn == 1) {
				ans.push_back(0);
			}
			else {
				int x = (tot2 - p2 + cn - 1) % (cn - 1);
				ans.push_back(cnt[x] + 1);
			}
		}
		else {
			int x = (tot1 + p1 + cn + 1) % (cn + 1);
			ans.push_back(cnt[x] + 1);
		}

		p1 = (p1 * 2) % (cn + 1);
		if (2 <= cn) p2 = (p2 * 2) % (cn - 1);
	}

	reverse(all(ans));
	rep(i, 0, N) printf("%d\n", ans[i]);
}







Measured memory_bytes: 5212
#include<stdio.h>

int main(){

    int a, b, c;

    scanf("%d %d %d", &a, &b, &c);

    if (a >= b) {
    	printf("No\n");
    	return 0;
    } else if (b >= c) {
    	printf("No\n");
    	return 0;
    } else {
    	printf("Yes\n");
    }

    return 0;
}

Measured memory_bytes: 580
#include <assert.h>
#include <limits.h>
#include <cmath>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <complex>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using ll = long long;
using P = std::pair<ll, ll>;

#define rep(i, a, b) for (ll(i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(i) std::cerr << i << "\n"

//const ll MOD = 998244353;
const ll MOD = 1e9+7;
 
int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  //問題文中の添え字が0-indexか1-indexか確認!

  ll n;
  std::cin>>n;

  std::cout<<0<<"\n"<<std::flush;

  std::string temp,leftst;

  std::cin>>leftst;

  if(leftst=="Vacant"){
    return 0;
  }

  ll left=0,right=n;

  while(1){
    ll mid=left+(right-left)/2;

    std::cout<<mid<<"\n"<<std::flush;

    std::cin>>temp;
    if(temp=="Vacant"){
      return 0;
    }

    if((temp==leftst)^((mid-left)%2)){
      left=mid;
      leftst=temp;
    }else{
      right=mid;
    }
  }

  return 0;
}

Measured memory_bytes: 852
#include <iostream>
using namespace std;
int main()
{
  int b,c,d;
  //b:奇数　c:偶数 d:4の倍数
  b=0;
  c=0;
  d=0;
  int n;
  cin>>n;
  int a[n-1];
  for(int i=0;i<n;i++){
    cin>>a[i];
    if(a[i]%4==0)d+=1;
    else if(a[i]%2==0)c+=1;
    else b+=1;
  }
  if(c==0){
    if(d+1>=b)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }else{
    if(b<=d)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }
  return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
#define swap(a, b, type) { type _tmp = a; a = b; b = _tmp; }
typedef long long ll;
typedef unsigned long long ull;

string a[100];

int main()
{
	int H, W;

	cin >> H >> W;
	rep(i, H) cin >> a[i];

	rep(i, W + 2) cout << '#';
	cout << endl;
	rep(i, H) cout << '#' << a[i] << '#' << endl;
	rep(i, W + 2) cout << '#';
	cout << endl;

	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <algorithm>

const int MAXN = 2e5 + 5;

int n;
long long ans = 0, maxn = 0, a[MAXN];

int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		scanf("%lld", &a[i]);
	}
	//std::sort(a + 1, a + 1 + n);
	maxn = -1;
	for (int i = 1; i <= n; i++) {
		maxn = std::max(maxn, a[i]);
		ans += abs(maxn - a[i]);
	}
	printf("%lld", ans);
	return 0;
}

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

#define pb push_back
#define pf push_front
#define pp pop_back
#define sz(a) (int)(a.size())
#define mp make_pair
#define F first
#define S second
#define next _next
#define prev _prev
#define left _left
#define right _right
#define y1 _y1
#define all(x) x.begin(), x.end()
#define what_is(x) #x << " is " << (x)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int N = (int)1e6 + 123;
const ll INF = (ll)1e18 + 123;
const int inf = (int)1e9 + 123;
const int MOD = (int)1e9 + 7;

void megaRandom() {
	unsigned int FOR;
 	asm("rdtsc" : "=A"(FOR));
  srand(FOR);
}

int cnt[256];
string s;

int main() {
	megaRandom();
	cin >> s;
	for(int i = 0; i < sz(s); i ++)
		cnt[s[i]] ++;
	string t = s;
	for(int it = sz(s); it >= 0; it --) {
		if(it < sz(s)) {
			t.pp();
			cnt[s[it]] --;
			bool ok = 0;
			for(int k = s[it] + 1; k <= 'z'; k ++) {
				if(!cnt[k]) {
					ok = 1;
					t.pb(char(k));
					break;
				}
			}
			if(ok) {
				cout << t;
				return 0;
			}
		} else {
			bool ok = 0;
			for(int k = 'a'; k <= 'z'; k ++) {
				if(!cnt[k]) {
					ok = 1;
					t.pb(char(k));
					break;
      	}
			}
			if(ok) {
				cout << t;
				return 0;
			}
		}
	}
	cout << -1;
	return 0;  
}


Measured memory_bytes: 256
N, A, B = map(int, input().split())
if abs(A - B) % 2 == 0:
    print(abs(A - B) // 2)
else:
    print(min(min(A, B) + abs(A - B) // 2, N - max(A, B) + 1 + abs(A - B) //2))


Measured memory_bytes: 9120
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    int N;
    cin >> N;
    int a[N],b[N],c[N];
    for(int i = 0; i < N; i++)
    {
        cin >> a[i] >> b[i] >> c[i];
    }
    ll dp[N+1][3];
    dp[0][0] = 0;
    dp[0][1] = 0;
    dp[0][2] = 0;
    for(int i = 1; i <= N; i++)
    {
        dp[i][0] = a[i - 1] + max(dp[i - 1][1], dp[i - 1][2]);
        dp[i][1] = b[i - 1] + max(dp[i - 1][0], dp[i - 1][2]);
        dp[i][2] = c[i - 1] + max(dp[i - 1][1], dp[i - 1][0]);
    }
    ll x = 0;
    x = dp[N][0];
    if(x < dp[N][1])
    {
        x = dp[N][1];
    }
    if(x < dp[N][2])
    {
        x = dp[N][2];
    }
    cout << x;
    
}

Measured memory_bytes: 3712
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline

INF = 2**62-1


def read_int():
    return int(buff_readline())


def read_int_n():
    return list(map(int, buff_readline().split()))


def read_float():
    return float(buff_readline())


def read_float_n():
    return list(map(float, buff_readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


class Mod:
    def __init__(self, m):
        self.m = m

    def add(self, a, b):
        return (a + b) % self.m

    def sub(self, a, b):
        return (a - b) % self.m

    def mul(self, a, b):
        return ((a % self.m) * (b % self.m)) % self.m

    def div(self, a, b):
        return self.mul(a, pow(b, self.m-2, self.m))

    def pow(self, a, b):
        return pow(a, b, self.m)


class Bisect:
    def __init__(self, func):
        self.__func = func

    def bisect_left(self, x, lo, hi):
        while lo < hi:
            mid = (lo+hi)//2
            if self.__func(mid) < x:
                lo = mid+1
            else:
                hi = mid
        return lo

    def bisect_right(self, x, lo, hi):
        while lo < hi:
            mid = (lo+hi)//2
            if x < self.__func(mid):
                hi = mid
            else:
                lo = mid+1
        return lo


@mt
def slv(N, M, S):

    from functools import lru_cache
    @lru_cache(maxsize=None)
    def dfs(x):
        if x == 0:
            return []

        for i in range(M, 0, -1):
            if 0 <= x-i and S[x-i] == '0':
                r = dfs(x-i)
                if r is not None:
                    r.append(i)
                    return r
        return None
    ans = dfs(N)
    if ans is None:
        ans = [-1]
    return ans




def main():
    N, M = read_int_n()
    S = read_str()
    print(*slv(N, M, S))


if __name__ == '__main__':
    main()


Measured memory_bytes: 266724
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
using namespace std;
using LL = long long;

int N, M;
set<int>A;

int main(void)
{
	cin >> N >> M;
	for (int i = 0; i < M; ++i) {
		int a;
		cin >> a;
		A.insert(a);
	}
	vector<pair<bool, int>>X;
	for (int i = 0; i < N; ++i) {
		X.push_back(make_pair(!A.count(i), i));
	}
	int ans = 0;
	while (X.size() > 1) {
		vector<pair<bool, int>>nX;
		for (int i = 0; i < X.size() / 2; ++i) {
			int u = i * 2;
			int v = u + 1;
			nX.push_back(max(X[u], X[v]));
			ans += (X[u].first && X[v].first) ? 1 : 0;
		}
		X = nX;
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 3108
#pragma warning(disable:4996)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <float.h>

#pragma region 定義
typedef long long  ll;
typedef unsigned long long  ull;


#define _itoa(A,N) sprintf(A, "%d", N);

int i_dsort(const void* a, const void* b);
int i_asort(const void* a, const void* b);

int  _gcd(int a, int b);
int  _swp(int* a, int* b);
int _cknum(char* a, int n);
int _atoi(char* s, int len);

int s_asort(const void* a, const void* b);
int s_dsort(const void* a, const void* b);

//昇順
int s_asort(const void* a, const void* b) {
	return(strcmp((char*)a, (char*)b));
}
int s_dsort(const void* a, const void* b) {
	return(strcmp((char*)b, (char*)a));
}

int i_dsort(const void* a, const void* b) {
	return(*(int*)b - *(int*)a);
}
int i_asort(const void* a, const void* b) {
	return(*(int*)a - *(int*)b);
}


int i_gcd(int a, int b);
int i_gcd(int a, int b) {
	if (!b)return a;
	return i_gcd(b, a % b);
}
int i_lcm(int a, int b);
int i_lcm(int a, int b) {
	return (a * b) / i_gcd(a, b);
}
int ll_gcd(ll a, ll b);
int ll_gcd(ll a, ll b) {
	if (!b)return a;
	return ll_gcd(b, a % b);
}
int ll_lcm(ll a, ll b);
int ll_lcm(ll a, ll b) {
	return (a * b) / ll_gcd(a, b);
}

// puts("Yes\n") puts("No\n")
// scanf("%d.%d") 浮動小数点入力を整数２つで得る


//#define pai  3.1415926535 
//#define  _USE_MATH_DEFINES でM_PIが使える

#define deg_rad(X)  (X*(M_PI/180))


int _swp(int* a, int* b)
{
	int tmp;
	tmp = *b; *b = *a; *a = tmp;
	return 0;
}
#define _abs(x) ((x)>0?(x):-(x))
#define _min(x,y) ((x)<(y)?(x):(y))
#define _max(x,y) ((x)<(y)?(y):(x))

int _cknum(char* a, int n) {
	int i;
	char t = '0';

	for (i = 0; i < n; i++) {
		if (a[i] < '0' || a[i]>'9') return 1;
	}
	return 0;
}


int _atoi(char* s, int len) {
	char tmp[20];
	memcpy(tmp, s, len);
	tmp[len] = 0x00;
	return (atoi(tmp));
}

//素因数分解　pf素数が入る　pc 素数の数
//ll _pfact(ll a);
//static ll pf[100000000];
//static ll pc;
//
//ll _pfact(ll a) {
//	long i, r;
//	if (a % 2 == 0) {
//		pf[pc] = 2; pc++;
//		return(_pfact(a / 2));
//	}
//	r = sqrt(a);
//	for (i = 3; i <= r; i += 2) {
//		if (a % i == 0) {
//			pf[pc] = i; pc++;
//			return(_pfact(a / i));
//		}
//	}
//	if (a != 1) {
//		pf[pc] = a; pc++;
//	}
//	return 0;
//
//}

//同じものの最初の文字をNULLにして降順
int _sort(const void* a, const void* b);
int _sort(const void* a, const void* b) {
	char rc;

	rc = strcmp((char*)b, (char*)a);
	if (rc == 0) {
		*(char*)a = 0x00;
		return(1);
	}
	return(rc);
}
// 立っている ビットの数
int bitcount(unsigned int uc);
int bitcount(unsigned int uc)
{
	int bit;

	for (bit = 0; 0 != uc; uc = (unsigned int)(uc >> 1))
		if (0 != (uc & 1))++bit;

	return bit;
}//bitco

#define _rnd(a,b)    ((a+b-1)/b) //　A/Bの余りを繰り上げる

#pragma endregion

// ABC102 B -  Maximum Difference

int main(void) {
	int n,a[101],i,res=0,min,max;

	scanf("%d", &n);
	scanf("%d", &a[0]);
	min = a[0]; max = a[0];

	for (i = 1; i < n; i++) {
		scanf("%d", &a[i]);
		min = _min(min, a[i]);
		max = _max(max, a[i]);
	}
	
	printf("%d\n", max-min);
	return 0;
}

Measured memory_bytes: 1676
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size1,init=nil,size2=-1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

N,Q=get_i
tree=array(N)
$lazy=array(N,0)
$ans=array(N,0)
(N-1).times do|i|
    a,b=get_i
    a-=1
    b-=1
    tree[a]=[] if tree[a].nil?
    tree[a].push(b)
    tree[b]=[] if tree[b].nil?
    tree[b].push(a)
end
Q.times do|i|
    p,x=get_i
    p-=1
    $lazy[p]+=x
end
def bfs(g,r)
    queue=[]
    queue.push(r)
    visit=array(N,false)
    until queue==[]
        cur=queue.shift
        visit[cur]=true
        $ans[cur]+=$lazy[cur]
        if g[cur].nil?
            $lazy[cur]=0
            next
        end
        g[cur].each do|v|
            next if visit[v]
            $lazy[v]+=$lazy[cur]
            queue.push(v)
        end
        $lazy[cur]=0
    end
end
#N.times do|i|
  #bfs(tree,i) unless $lazy[i].zero? 
#end
bfs(tree,0)
puts $ans.join(" ")

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

using namespace std;

bool flag[11];
int p[11];
long long int N, M, Q, score = 0;
vector<long long int> a, b, c, d;

void calc() {
  long long int ans = 0;

  for (int i = 0; i < Q; i++) {
    if (p[b[i]] - p[a[i]] == c[i]) {
      ans += d[i];
    }
  }

  if (score < ans) {
    score = ans;
  }
}

void func(int ord, int start) {
  if (ord > N) {
    calc();
    return;
  }

  for (int i = 1; i <= M; i++) {
    if (i >= start) {
      p[ord] = i;
      func(ord + 1, i);
    }
  }
}

int main() {
  cin >> N >> M >> Q;
  for (int i = 0; i < Q; i++) {
    long long int tmp1, tmp2, tmp3, tmp4;

    cin >> tmp1 >> tmp2 >> tmp3 >> tmp4;
    a.push_back(tmp1);
    b.push_back(tmp2);
    c.push_back(tmp3);
    d.push_back(tmp4);
  }

  func(1 ,1);
  cout << score << endl;

  return 0;
}

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

int main() {
    int n;
    cin >> n;
    
    vector<vector<int>> card(4, vector<int> (13, -1));
    for(int i = 0; i < n; i++) {
        char suit;
        int num;
        cin >> suit >> num;
        if(suit == 'S') card.at(0).at(num-1) = 0;
        else if(suit == 'H') card.at(1).at(num-1) = 0;
        else if(suit == 'C') card.at(2).at(num-1) = 0;
        else if(suit == 'D') card.at(3).at(num-1) = 0;
    }

    for(int i = 0; i < 4; i++) {
        for(int j = 0; j < 13; j++) {
          int k = j+1;
            if(card.at(i).at(j) == -1) {
                if(i==0) cout << "S " << k << endl;
                if(i==1) cout << "H " << k << endl;
                if(i==2) cout << "C " << k << endl;
                if(i==3) cout << "D " << k << endl;
            }
        }
    }
}


Measured memory_bytes: 3140
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(c) (c).begin(), (c).end()
#define pb push_back
#define eb emplace_back
using namespace std;
const long long INF = 1LL<<60; // 仮想的な無限大の値;
using ll = long long;
using P  = pair<int, int>;
#define vi vector<int>
#define vll vector<ll>
#define vs vector<string>
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 int mod = 1000000007;

vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0; // 指数

        // 割れる限り割り続ける
        while (N % a == 0) {
            ++ex;
            N /= a;
        }

        // その結果を push
        res.push_back({a, ex});
    }

    // 最後に残った数について
    if (N != 1) res.push_back({N, 1});
    return res;
}

int main()
{
    int N;
    cin >> N;
    int ans = 0;
    rep2(i, 1, N){
        int a = N/i;
        int b = N%i;
        if(b != 0)
        {
            ans += a;
            //if(a >=i) --ans;
        }else{
            --a;
            ans += a;
            //if(a >=i) --ans;
        }

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

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

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

//#endif

using namespace std;


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

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

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

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

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

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

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

map<pii,int> ma;
ll H,W,n;

bool inside(int a,int b){
	return 0<=a&&a<H&&0<=b&&b<W;
}


void mainmain(){
	cin>>H>>W>>n;
	rep(i,n){
		int a,b;
		cin>>a>>b;
		a--,b--;
		rep(j,3){
			rep(k,3){
				int na = a-j;
				int nb = b-k;
				if(inside(na,nb) && inside(na+2,nb+2)){
					if(ma.count(pii(na,nb))==0){
						ma[pii(na,nb)]=0;
					}
					ma[pii(na,nb)]++;
				}
			}
		}
	}
	vll ans(10,0);
	for(auto x: ma){
		ans[x.S]++;
		ans[0]++;
	}
	ans[0] = (H-2)*(W-2)-ans[0];
	rep(i,10){
		cout<<ans[i]<<endl;
	}
}


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

Measured memory_bytes: 56576
<?php
//error_reporting(0);
//$N = trim(fgets(STDIN));
list($A,$B,$K) = explode(" ",trim(fgets(STDIN)));
//$A = explode(" ",trim(fgets(STDIN)));

for($i=0;$i<$K;$i++) {
  if (($i%2)==0) {
    if (($A%2)==1) {
      $A=$A-1;
    }
    $m = floor($A/2);
    $A-=$m;
    $B+=$m;
  }
  else {
    if (($B%2)==1) {
      $B=$B-1;
    }
    $m = floor($B/2);
    $B-=$m;
    $A+=$m;
  }
}
printf("%d %d\n",$A,$B);


Measured memory_bytes: 3828
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;
int main() {
	long long int n, a[1000], b[1000];
	cin >> n;
	long long int ans = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i] >> b[i];
		ans += b[i] - a[i] + 1;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define IFOR(i, m, n) for(int i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
const int MOD = 1000000007;
/* テンプレートここまで */

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

  vector<ll> a(3*N);
  REP(i, 3*N ){
    cin >> a[i];
  }
  sort(ALL(a));
  
  ll ans = 0;
  for(ll i=N; i < 3*N-1; i+=2){
    ans += a[i];
  }

  cout << ans << endl;
}


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

int main() {
    int N,D;
    cin >> N >> D;
    int ans;
    ans = N/(2*D + 1);
    if (N%(2*D + 1) == 0){
        cout << ans <<  endl;
    }
    else {
        cout << ans + 1 << endl;
    }
    
}

Measured memory_bytes: 256
"use strict";

function main(input){
  const args = input.trim().split(' ').map(_=>parseInt(_,10));
  const a = args[0];
  const b = args[1];
  
  console.log(a*b%2==0 ? "Even" : "Odd");
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));  

Measured memory_bytes: 7372
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    l,r,d=parseMap(split(readline()))
    ans=0
    for i in l:r
        if i%d==0
            ans+=1
        end
    end
    println(ans)
end
main()

Measured memory_bytes: 164416
#include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<functional>
#include<queue>
#include<stack>
#include<set>
using namespace std;
	int d[1000000];
	
	int n,m,p,ans,tmp;	
	int kyori(int a,int b,string f){
		if(f=="right"){
			if(a<b)return b-a;
			else return n-(a-b);
		}
		else{
			if(a>b)return a-b;
			else return n-(b-a);
		}
	}
	int main(){
		cin>>n>>m>>p;
		for(int i=0;i<m;i++)cin>>d[i];
		sort(d,d+m);
		string r="right",l="left";
		tmp=0;
		for(int i=0;i<m;i++)tmp=max(tmp,kyori(p,d[i],r));
		ans=tmp;
		tmp=0;
		for(int i=0;i<m;i++)tmp=max(tmp,kyori(p,d[i],l));
		ans=min(ans,tmp);
		
		int e;
		for(int i=0;i<m;i++){
			tmp=0;
			tmp=kyori(p,d[i],r);
			e=i+1;
			if(e==m)e=0;
			tmp+=kyori(d[i],d[e],l);
			ans=min(tmp,ans);
			//cout<<tmp<<endl;
			tmp=0;
			tmp=kyori(p,d[i],l);
			e=i-1;
			if(e<0)e=m-1;
			tmp+=kyori(d[i],d[e],r);
			ans=min(tmp,ans);
			//cout<<tmp<<endl;
		}
		cout<<ans*100<<endl;
	
	return 0;
} 

Measured memory_bytes: 1264