akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main() {
  int n; cin >> n;
  vector<string> S(n);
  rep(i, n) cin >> S[i];
  int m; cin >> m;
  vector<string> T(m);
  rep(i, m) cin >> T[i];

  int ans = 0;
  rep(i, n) {
    int tmp = 0;
    rep(j, n) if (S[i]==S[j]) tmp++;
    rep(j, m) if (S[i]==T[j]) tmp--;
    ans = max(ans, tmp);
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 256
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>
#include <cassert>

#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 62;
//const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll conbinationMemo[100][100];

void cmemoInit(){
    rep(i, 100){
        rep(j, 100){
            conbinationMemo[i][j] = -1;
        }
    }
}
 
ll nCr(ll n, ll r){
    if(conbinationMemo[n][r] != -1) return conbinationMemo[n][r];
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return conbinationMemo[n][r] = (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
//-----------------------ここから-----------
int main(void){
    int a, b;
    cin >> a >> b;
    cout << a * b << endl;
}


Measured memory_bytes: 3584
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
#include <sstream>
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);
#define Mod 1000000007
#define eps 1e-6
#define ll long long
#define INF 0x3f3f3f3f 
#define MEM(x,y) memset(x,y,sizeof(x))
#define Maxn 10005
#define P pair<int,int>
using namespace std;
int main()
{
	int h, a;
	cin >> h >> a;
	int ans =0;
	int b=0;
	for (int i = 0; i < a; i++)
	{
		cin >> b;
		ans += b;
	}
	if (ans < h)
		cout << "No" << endl;
	else
		cout << "Yes" << endl;
}



Measured memory_bytes: 256
// input! macro is published in the following URLs.
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
// https://github.com/tanakh/competitive-rs.git
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

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

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

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

fn main() {
    input! {
        n: usize,
        csfs: [(i64, i64, i64); n - 1],
    }
    for i in 0..n - 1 {
        let mut count = 0;
        for &(c, s, f) in csfs[i..].iter() {
            let wait = if count <= s {
                s - count
            } else {
                let w = f - (count - s) % f;
                if w == f {
                    0
                } else {
                    w
                }
            };
            count += wait + c;
        }
        println!("{}", count);
    }
    println!("0");
}


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

typedef long long ll;
const ll INF = 1010000000000000017LL;
const ll MOD = 998244353;

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

//#define DEBUG(fmt, ...)
#define DEBUG(fmt, ...) fprintf(stderr, fmt "\n", ##__VA_ARGS__)

ll totalOnes = 0;
ll table[301][301][301];

int main(){
    std::cout<<std::fixed<<std::setprecision(10);

    string S;
    ll K;

    cin >> S >> K;

    vector<int> boxes;

    ll numOne = 0;
    for(int i = 0; i < S.size(); i++ ){
        if( S[i] == '0' ){
            boxes.push_back(numOne);
            numOne = 0;
        }else{
            numOne++;
            totalOnes++;
        }
    }
    boxes.push_back(numOne);

    REP(i,301){ REP(j,301) { REP(k,301) {
       if( i == 0 ){
          table[i][j][k] = 1;
       }else{
          table[i][j][k] = 0;
       }
    }}}

    ll currentOnes = boxes[0];
    for( int box = 1; box <= boxes.size()-1; box++ ){
        currentOnes += boxes[box];
        for( int ones = 0; ones <= (totalOnes-currentOnes); ones++){
           for( int ops = 0; ops <= min(K,totalOnes); ops++){
               for( int b = 0; b <= boxes[box]+ones; b++ ){
                  ll new_ops= ops - max(boxes[box]-b,0);
                  if( new_ops >= 0 ){
                     table[box][ones][ops] += (table[box-1][boxes[box]+ones-b][new_ops]%MOD);
                     table[box][ones][ops]%=MOD;
                  }
               }
           }
        }
    }

    cout << table[boxes.size()-1][0][min(K, totalOnes)] << endl;
}


Measured memory_bytes: 216632
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vc = vector<char>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using stkll = vector<pll>;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
#define rep(i, n) for (ll i = 0; i < (n); i++)
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
#ifndef ONLINE_JUDGE
    #define debug(x) cerr << #x << ": " << x << endl;
#else
    #define debug(x)
#endif

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    double a, b, h, m;
    cin >> a >> b >> h >> m;

    double thm = 2 * M_PI * m / 60.0;
    double thh = 2 * M_PI * h / 12.0 + 2 * M_PI * m / 12.0 / 60.0;

    double th1 = abs(thm - thh);
    if(th1 > M_PI) th1 = 2 * M_PI - th1;

    double ans = sqrt(a*a + b*b - 2 * a * b * cos(th1));
    cout << ans << endl;
}


Measured memory_bytes: 4244
public class Main {
	MyScanner sc = new MyScanner();

	void run() {
		int H = sc.nextInt();
		int W = sc.nextInt();
		int[][] dp = new int[H][W];
		int max = 0;
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				int c = sc.nextInt();
				dp[i][j] = (c == 0) ? 1 : 0;
				max = Math.max(max, dp[i][j]);
			}
		}
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				if (i == 0 || j == 0 || dp[i][j] == 0)
					continue;
				dp[i][j] = Math.min(dp[i - 1][j],
						Math.min(dp[i][j - 1], dp[i - 1][j - 1])) + 1;
				max = Math.max(max, dp[i][j]);
			}
		}
		System.out.println(max * max);
	}

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

	class MyScanner {
		int nextInt() {
			try {
				int c = System.in.read();
				while (c != '-' && (c < '0' || '9' < c))
					c = System.in.read();
				if (c == '-')
					return -nextInt();
				int res = 0;
				do {
					res *= 10;
					res += c - '0';
					c = System.in.read();
				} while ('0' <= c && c <= '9');
				return res;
			} catch (Exception e) {
				return -1;
			}
		}
	}
}

Measured memory_bytes: 33468
/**
 * @Author:      G_BG
 * @DateTime:    2018-10-06 21:38:57
 * @Description: 
 */
#include<bits/stdc++.h>
using namespace std;
#define MST(a, b) memset(a, b, sizeof(a));
#define CLR(a) MST(a, 0);
#define pb push_back
#define rep(x, y, z) for (int x = y; x < z; ++x)
#define dwn(x, y, z) for (int x = y; x >= z;--x)
#define lowbit(x) (x & (-x))
typedef long long LL;
typedef unsigned long long ULL;
const double PI = 3.1415926535898;
const double E = 2.718281828459;
const int INF = 0x7fffffff;
const int mod = 1e9+7;
const int maxn=1e5+10;
int main(int argc, char const *argv[]) {
	ios::sync_with_stdio(0);cin.tie(0);
	int n ;cin >> n;
	if(n == 1) cout << "Hello World" << endl;
	else {
		int a,b;cin >> a >> b;
		cout << a+b << endl;
	}
	//system("pause");
	return 0;
}

Measured memory_bytes: 256
//  Created by conan1024hao on 2019/11/19.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll>P;
#define INF 10e16
#define MOD 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define PI acos(-1.0)
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
ll cmp(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    int n,m;
    cin>>n>>m;
    vector<int>x(m);
    for(int i=0;i<m;i++)
        cin>>x[i];
    if(n>=m){
        cout<<0<<endl;
        return 0;
    }
    sort(all(x));
    vector<int>y;
    for(int i=0;i<m-1;i++){
        y.push_back(x[i+1]-x[i]);
    }
    ll ans=0;
    sort(all(y));
    reverse(all(y));
    for(int i=0;i<n-1;i++)
        ans+=y[i];
    cout<<x[m-1]-x[0]-ans<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------


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

using namespace std;

int main(){

  int n;

  cin>>n;
  
  vector<int> movie(n+1,0);
  vector<int> a(n+1);
  vector<int> b(n+1);
  int total=0;
  
  for(int i=1;i<=n;++i)
	cin>>a[i]>>b[i];

  for(int i=1;i<=31;++i){
	int index=0;
	for(int j=1;j<=n;++j){
	  if(i >= a[j] && i <= b[j] && movie[j] == 0){
		if(index==0 || b[index]>b[j])
		  index=j;
	  }
	}
	if(index!=0){
	  total+=100;
	  movie[index]=1;
	}
	else if(index==0)
	  total+=50;
	}

  cout<<total<<endl;
  
}



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

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

int dp[100010],a[100010];

int main(void) {
	int N;
	cin >> N;
	REP(i,N) cin >> a[i];
	memset(dp, 0x7f, sizeof(dp));
	dp[0] = 0;
	dp[1] = abs(a[0]-a[1]);
	for(int i=2; i<N; i++)
		dp[i] = min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
	cout << dp[N-1] << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define debug(x) cerr << x << " = "(x) << endl;
#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll x; cin >> x;
    ll ans = 1;
    ll i = 1;
    while(ans<x){
        i++;
        ans += i;
    }
    cout << i << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

class UnionFind {
    int n;
    vector<int> uni;
    int forest_size;
public:
    explicit UnionFind(int n) : n(n), uni(static_cast<u32>(n), -1), forest_size(n) {};

    int root(int a){
        if (uni[a] < 0) return a;
        else return (uni[a] = root(uni[a]));
    }

    bool unite(int a, int b) {
        a = root(a);
        b = root(b);
        if(a == b) return false;
        if(uni[a] > uni[b]) swap(a, b);
        uni[a] += uni[b];
        uni[b] = a;
        forest_size--;
        return true;
    }
    int size(){ return forest_size; }
    int size(int i){ return -uni[root(i)]; }
    bool same(int a, int b) { return root(a) == root(b); }
};

int main() {
    int n;
    cin >> n;
    vector<array<int, 3>> v(n);
    vector<int> inv(n), invv(n);
    for (int i = 0; i < n; ++i) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        v[i] = {a, b, i};
        inv[b] = i;
        invv[a] = i;
    }
    UnionFind uf(n);
    sort(v.begin(),v.end());
    set<int> s;
    for (int i = 0; i < n; ++i) {
        auto l = s.lower_bound(v[i][1]);
        if(l != s.begin()){
            l--;
            uf.unite(v[i][2], inv[*l]);
        }
        s.emplace(v[i][1]);
    }
    s.clear();
    reverse(v.begin(),v.end());
    for (int i = 0; i < n; ++i) {
        auto l = s.lower_bound(v[i][1]);
        if(l != s.end()){
            uf.unite(v[i][2], inv[*l]);
        }
        s.emplace(v[i][1]);
    }
    s.clear();
    sort(v.begin(),v.end(), [&](array<int, 3> &a, array<int, 3> &b){ return a[1] < b[1]; });
    for (int i = 0; i < n; ++i) {
        auto l = s.lower_bound(v[i][0]);
        if(l != s.begin()){
            l--;
            uf.unite(v[i][2], invv[*l]);
        }
        s.emplace(v[i][0]);
    }
    s.clear();
    reverse(v.begin(),v.end());
    for (int i = 0; i < n; ++i) {
        auto l = s.lower_bound(v[i][0]);
        if(l != s.end()){
            uf.unite(v[i][2], invv[*l]);
        }
        s.emplace(v[i][0]);
    }
    for (int i = 0; i < n; ++i) {
        cout << uf.size(i) << "\n";
    }
    return 0;
}

Measured memory_bytes: 17260
#include<bits/stdc++.h>
using namespace std;
#include<cstdio>
#define el "\n"
#define sp " "
typedef long long ll;

main()
{
  ll n,i;
  cin>>n;
  ll a[n+1],dp[n+1]={0};
  for(i=1;i<=n;i++)
    cin>>a[i];
  dp[0]=0;
  dp[1]=0;
  dp[2]=abs(a[2]-a[1]);
  for(i=3;i<=n;i++)
    dp[i]=min(dp[i-2]+abs(a[i]-a[i-2]),dp[i-1]+abs(a[i-1]-a[i]));
    cout<<dp[n];
}
  

Measured memory_bytes: 1792
#include <stdio.h>
int main(void){
  while(1){int n,ans=0;
  scanf("%d",&n);
  if(n==0){
      break;
  }
  n=1000-n;
  ans+=n/500;
  n%=500;
  ans+=n/100;
  n%=100;
  ans+=n/50;
  n%=50;
  ans+=n/10;
  n%=10;
  ans+=n/5;
  printf("%d\n",ans+n%5);
  }
}

Measured memory_bytes: 2688
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<set>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

using namespace std;

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


template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}


#define ARRAY_MAX 100005
const int INF = 1e9 + 7;


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

const ll MOD = 1e9 + 7;



//ユークリッド互除法
template<typename T>
T gcd(T x, T y) {

	if (y == 0) {
		return x;
	}
	else {
		return gcd(y, x % y);
	}
}
/*最小公倍数*/
template<typename T>
T lcm(T x, T y) {
	T tmp = gcd(x, y);
	return (x / tmp) * y;
}


/******************************************************************************************/

ll dp[100055];

int main() {

	ll n, m;
	cin >> n >> m;

	for (int i = 0; i < m; i++)
	{
		int tmp;
		cin >> tmp;
		dp[tmp] = -1;
	}

	dp[0] = 1;

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

		

		if (dp[i] == -1) {
			continue;
		}

		if (dp[i + 1] != -1) {
			dp[i + 1] += dp[i];
			dp[i + 1] %= MOD;
		}

		if (dp[i + 2] != -1) {
			dp[i + 2] += dp[i];
			dp[i + 1] %= MOD;
		}
	}


	cout << dp[n] << endl;


	return 0;
}


Measured memory_bytes: 1024
N,K = map(int,input().split())
S = input()
x = [0]
hoge = 1
for i in S:
    i = int(i)
    if i == hoge:
        x[-1] += 1
    else:
        hoge = (hoge+1)%2
        x.append(1)
x.append(0)
l = len(x)
hoge = 2*K+1
saka = [0]
if hoge > l:
    print(N)
else:
    for i in range(hoge):
        saka[0] += x[i]
    for i in range(int((l-hoge)/2)):
        saka.append(saka[i]-x[i*2]-x[i*2+1]+x[i*2+hoge]+x[i*2+1+hoge])
    print(max(saka))

Measured memory_bytes: 5528
#ifdef __GNUC__
#include <bits/stdc++.h>
#endif // __GNUC_

using namespace std;

int main() {
    long long int N, b = 0, a[100000 * 2] = {}, ans = 0, sum[100000 * 2 + 1] = {}, dif = 0, mini = 1000000000 * 2 + 1;
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> a[i];
        sum[i + 1] = sum[i] + a[i];
    }
    for (int i = 0; i < N - 1; i++) {
        b = (sum[N] - sum[i + 1]) - sum[i + 1];
        dif = abs(b);
        mini = min(dif, mini);
    }
    cout << mini;
    return 0;
}


Measured memory_bytes: 3328
using System;
using System.Linq;
using System.Collections.Generic;

using E = System.Linq.Enumerable;

public class Program
{
    public static void Main()
    {
        var nq = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
        var n = nq[0];
        var q = nq[1];
        var s = Console.ReadLine().Trim();
        var qs = new Tuple<int, int>[q];
        for (int i = 0; i < qs.Length; i++)
        {
            var lr = Console.ReadLine().Split().Select(x => int.Parse(x) - 1).ToArray();
            qs[i] = Tuple.Create(lr[0], lr[1]);
        }

        var ac = new int[n];
        for (int i = 1; i < s.Length; i++)
        {
            ac[i] = ac[i - 1];

            if (s[i - 1] != 'A' || s[i] != 'C')
            {
                continue;
            }

            ac[i]++;
        }
        
        foreach (var lr in qs)
        {
            var k = ac[lr.Item2] - ac[lr.Item1];
            Console.WriteLine(k);
        }
    }
}


Measured memory_bytes: 21688
import java.io.*;
import java.util.*;
public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int n = sc.nextInt();
		int[] arr = new int[n];
		Multiset ms = new Multiset();
		for(int i = 0; i < n; i++) {
			int a = sc.nextInt();
			arr[i] = a;
			ms.add(a);
		}
		long count = 0;
		for(int x: ms.map.keySet()) {
			long a = ms.count(x);
			count += a*(a-1)/2;
		}
		StringBuilder sb = new StringBuilder();
		for(int i = 0; i < n; i++) {
			long a = ms.count(arr[i]);
			long dif = a*(a-1)/2 - (a-2)*(a-1)/2;
			sb.append((count - dif)+"\n");
		}
		PrintWriter pw = new PrintWriter(System.out);
//		sb.replace(sb.length()-1, sb.length(), "\n");
		pw.print(sb.toString());
		pw.flush();
	}
	
	static class Multiset{
		HashMap<Integer, Long> map;
		public Multiset() {
			map = new HashMap<>();
		}
		public void add(int a) {
			if(!map.containsKey(a)) map.put(a, 1L);
			else map.put(a, map.get(a)+1);
		}
		public void remove(int a) {
			map.put(a, map.get(a)-1);
			if(map.get(a) == 0) map.remove(a);
		}
		public boolean contains(int a) {
			return map.containsKey(a);
		}
		public long count(int a) {
			if(!map.containsKey(a)) return 0;
			else return map.get(a);
		}
		public boolean isEmpty() {
			return map.isEmpty();
		}
		public boolean equals(Multiset ms) {
			for(int k: map.keySet()) {
				if(count(k) != ms.count(k)) return false;
			}
			return true;
		}
		public String toString() {
			return map.toString();
		}
	}
	
	static class FastScanner {
		public BufferedReader reader;
		public StringTokenizer tokenizer;
		public FastScanner() {
			reader = new BufferedReader(new InputStreamReader(System.in), 32768);
			tokenizer = null;
		}
		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch(IOException e) {
				throw new RuntimeException(e);
			}
		}
	}

}


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

vector<pair<long long, long long>>dp[1 << 18];
long long n, a[1 << 18];

int main() {
	cin >> n;
	for (int i = 0; i < (1 << n); i++) { cin >> a[i]; dp[i].push_back(make_pair(a[i], i)); }
	for (int i = 1; i < (1 << n); i++) {
		vector<int>vec; for (int j = 0; j < n; j++) { if ((i / (1 << j)) % 2 == 1) vec.push_back(j); }
		for (int j = 0; j < vec.size(); j++) { for (pair<long long, long long> k : dp[i - (1 << vec[j])]) dp[i].push_back(k); }
		sort(dp[i].begin(), dp[i].end()); reverse(dp[i].begin(), dp[i].end());

		vector<pair<long long, long long>>DP;
		for (int j = 0; j < dp[i].size(); j++) {
			if (j == 0 || dp[i][j].second != dp[i][j - 1].second) DP.push_back(dp[i][j]);
			if (DP.size() == 2) break;
		}
		dp[i] = DP;
	}
	long long maxn = 0;
	for (int i = 1; i < (1 << n); i++) {
		maxn = max(maxn, dp[i][0].first + dp[i][1].first);
		printf("%lld\n", maxn);
	}
	return 0;
}

Measured memory_bytes: 130688
#include<stdio.h>

int main() {
    int a, b, c, d; //変数の宣言
    
    //入力
    scanf("%d", &a);
    scanf("%d", &b);
    scanf("%d", &c);
    scanf("%d", &d);
    
    //出力
    printf("%d\n%d\n", (a+b+c+d)/60, (a+b+c+d)%60);
    
    return 0;
}



Measured memory_bytes: 2048
// The moment you think of giving up you have already lost the battle
#include <iostream>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long int ll;
typedef long double dl;
#define PI  3.14159265358979323846
#define M   1000000007
ll fast(ll n,ll a,ll m)
{
    if(n==0)
        return 1;
    else if(n==1)
        return a;
    else
    {
        ll r=fast(n/2,a,m);
        if(n%2==0)
        {
            return (((r%m)*(r%m))%m);
        }
        else
        {
            return (((((r%m)*a)%m)*r)%m);
        }

    }
}
ll dp[2001][2001];
ll rp[2001][2001];
int main()
{
   ll S;
   cin>>S;
   if(S<3)
     cout<<0;
   else
   {
       ll len=S/3;
       ll i,j;

       memset(dp,0,sizeof(dp));
       memset(rp,0,sizeof(rp));
       for(i=3;i<=S;i++)
       {
           dp[1][i]=1;
       }
       rp[1][3]=1;

       for(i=4;i<=S;i++)
       {
           rp[1][i]=rp[1][i-1]+dp[1][i];
       }
       for(i=2;i<=len;i++)
       {
           for(j=3;j<=S;j++)
           {
               dp[i][j]=(dp[i][j]%M+rp[i-1][j-3]%M)%M;
           }
           rp[i][3]=dp[i][3];
           for(j=3;j<=S;j++)
           {
              rp[i][j]=(rp[i][j-1]%M+dp[i][j]%M)%M;
           }
       }
       ll ans=0;
       for(i=1;i<=len;i++)
       {
           ans=(ans%M+dp[i][S]%M)%M;
       }
       cout<<ans<<"\n";

   }
}



Measured memory_bytes: 66196
using System;
using System.Linq;

namespace Aizu
{
    class OnlineJudge
    {
        public static void Main()
        {
            Console.WriteLine((from q in Enumerable.Range(0, 5) let d = int.Parse(Console.ReadLine()) select d < 40 ? 40 : d).Average());
        }
    }
}

Measured memory_bytes: 5864
def main():
    H, W = (int(i) for i in input().split())
    c = [input() for i in range(H)]
    for h in range(H):
        for w in range(W):
            if c[h][w] == "#":
                for dh, dw in ((-1, 0), (1, 0), (0, -1), (0, 1)):
                    nh = h + dh
                    nw = w + dw
                    if nh < 0 or H <= nh or nw < 0 or W <= nw:
                        continue
                    if c[nh][nw] == "#":
                        break
                else:
                    return print("No")
    print("Yes")


if __name__ == '__main__':
    main()


Measured memory_bytes: 39152
#include <bits/stdc++.h>
#include <cstdio>
#include <algorithm>
#include <iomanip>
#include <functional>
using namespace std;
int main()
{
	double d;
	double t; 
	double s;
	cin>>d>>t>>s;
	if(((double)d/t)<=s) cout<<"Yes"<<endl;
	else cout<<"No";
	return 0;
	
}

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

int main()
{	
	int a, b, c, r = 0, s = 0;
	char d;

	while (cin >> a >> d >> b >> d >> c) {
		if (a * a + b * b == c * c)
			r++;

		if (a == b)
			s++;
	}

	cout << r << endl << s << endl;

	return 0;
}



Measured memory_bytes: 2992
#include <stdio.h>
#include <string.h>
int main() {
  char s[10];
  if(scanf("%s", s) <= 0) {
    printf("fail");
  }
  int len = strlen(s);
  int i = 0;
  int flag = 0;
  while(i < len) {
    flag = 0;
    if(i % 2 == 0) {
      if(s[i] != 'h') { break; }
    } else {
      if(s[i] != 'i') { break; }
      flag = 1;
    }
    i++;
  }
  if (flag == 1) {
    printf("Yes");
  } else {
    printf("No");
  }
  return 0;
}

Measured memory_bytes: 128
n = int(input())
s = input()

left = 0
stack = []
for i in range(n):
    if s[i] == '(':
        stack.append('(')
    else:
        if len(stack) == 0:
            left += 1
        else:
            stack.pop()
right = len(stack)

t = ('(' * left) + s + (')' * right)
print(t)

Measured memory_bytes: 3060
def main():
    n, k = map(int, input().split())
    ans = 0
    for i in range(1, n+1):
        temp = i
        j = 0
        while temp < k:
            temp *= 2
            j += 1
        ans += (1/2)**j
    print(ans/n)


if __name__ == "__main__":
    main()


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

int main() {
	int k;
	cin>>k;
	string s;
	cin>>s;
	if(s.length()<=k)
	{
		cout<<s<<endl;
	}
	else
	{
		for(int i=0;i<k;i++)
		cout<<s[i];
		for(int i=0;i<=2;i++)\
		cout<<".";
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 3548
#include <bits/stdc++.h>
 
using namespace std;
 
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fileio freopen("in.in", "r", stdin),freopen("out.out", "w", stdout);
#define ll long long int
#define FF first
#define SS second
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<long long int,long long int>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d\n",x)
#define plld(x) printf("%lld\n",x)
#define pss printf
#define MOD 1000000007
#define INF 1e18
#define eps 0.00001
#define endl '\n'
#define debug(n1) cout<<n1<<endl
int n,k;
ll f[5];
int main()
{
	SPEED;
	cin>>n>>k;
	int cnt=0;
	for(int i=1;i<=n;i++)
		if((i*2)%k==0)
			f[((i*2)/k)%2]++;
	ll ans=0;
	for(int i=0;i<2;i++)
		for(int j=0;j<2;j++)
			for(int k=0;k<2;k++)
				if((i+j)%2==0&&(j+k)%2==0&&(i+k)%2==0)
					ans=ans+f[i]*f[j]*f[k];
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sys/time.h>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>

using namespace std;

void solve(long long X, long long Y){
    if (X%Y == 0) {
        std::cout << -1 << std::endl;
    } else {
        std::cout << X << std::endl;
    }
}

int main(){	
    struct timeval start,end;
    long long span;
    gettimeofday(&start,NULL);

    long long Y;
    long long X;
    scanf("%lld",&X);
    scanf("%lld",&Y);
    solve(X, Y);

    gettimeofday(&end,NULL);
    span = (end.tv_sec -start.tv_sec)*1000000LL + (end.tv_usec - start.tv_usec);
    std::cerr << "--Total Time: " << span/1000 << "ms" << endl;
    return 0;
}


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

#define ED return 0;
#define SORT(vec) sort(vec.begin(),vec.end());
#define DOUBLECHANGE(count) cout << setprecision(count);
#define REV(vec) reverse(vec.begin(),vec.end());
#define ipow(x,y) int(pow(x,y))
const long long mod = 1000000007;

int main() {
    int A, B;
    cin >> A >> B;
    if(A == 1){
        A = 14;
    }
    if(B == 1){
        B = 14;
    }
    if(A > B){
        cout << "Alice" << endl;
        ED
    }
    if(A < B){
        cout << "Bob" << endl;
        ED
    }
    cout << "Draw" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  int n,a,b;
  pii p[100];
  rep(i,INF){  
    scanf("%d,%d",&a,&b);
    if(a==0 && b==0)break;
    p[i].first=b;
    p[i].second=a;
  }
  int m=i;
  sort(p,p+m);
  vi ans(105);
  ans[p[m-1].second]=1;
  for(i=m-2;i>=0;i--){
    if(p[i].first==p[i+1].first)ans[p[i].second]=ans[p[i+1].second];
    else ans[p[i].second]=ans[p[i+1].second]+1;
  }
  while(cin>>n) cout<<ans[n]<<endl;
}

Measured memory_bytes: 3124
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
		execute7_3();
	}
	
	private static void execute7_3() {
		try (Scanner sc = new Scanner(System.in)) {
			String s = sc.next();
			
			String ans = "";
			for(int i=0; i<s.length();i++) ans+="x";
			
			System.out.println(ans);
		}
	}
}

Measured memory_bytes: 21844
abc = list(map(int, input().split()))
s = sorted(abc)

if s[0] % 2 == 0 and s[1] % 2 == 0 :
    if s[2] % 2 == 0 :
        print((s[2] - s[0]) // 2 + (s[2] - s[1]) // 2)
    else :
        print((s[2] - s[0]) // 2 + (s[2] - s[1]) // 2 + 1)
elif s[0] % 2 != 0 and s[1] % 2 != 0 :
    if s[2] % 2 == 0 :
        print((s[2] - s[0]) // 2 + (s[2] - s[1]) // 2 + 1)
    else :
        print((s[2] - s[0]) // 2 + (s[2] - s[1]) // 2)
else :
    print((s[2] - s[0]) // 2 + (s[2] - s[1]) // 2 + 2)

Measured memory_bytes: 3064
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

#define mp make_pair
#define pb push_back
#define ll long long

const int maxN = 311;

int n, k, m, i, j, p, aux;
int dp[maxN][maxN];
int sum[maxN][maxN];
int comb[maxN][maxN];

void add(int& a, int b) {
    a += b;
    if (a >= m) a -= m;
}

int main()
{
   // freopen("test.in","r",stdin);

    cin >> n >> k >> m;
    n++; k++;

    for (i = 0; i <= n; i++) {
        comb[i][0] = 1;
        for (j = 1; j <= i; j++)
            comb[i][j] = (comb[i - 1][j] + comb[i - 1][j - 1]) % m;
    }

    for (i = 1; i <= n; i++) {
        for (j = 1; j <= k; j++) {
            if (i == 1) {
                dp[i][j] = 1;
            } else {
                for (p = 1; p < i; p++) {
                    aux = (1LL * dp[p][j] * sum[i - p][j - 1]) % m;
                    aux = (1LL * aux * comb[i - 2][p - 1]) % m;
                    add(dp[i][j], aux);
                }
            }

            sum[i][j] = (sum[i][j - 1] + dp[i][j]) % m;
        
            //cerr << dp[i][j] << ' ';
        }
        //cerr << '\n';
    }

    cout << dp[n][k];


    return 0;
}


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

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

    vector<int> v;
    rep(i, N){
        int tmp;
        cin >> tmp;
        v.emplace_back(tmp);
    }

    int ans = 0;
    for(int l = 0;l<=K;l++){
        for(int r=0;r<=K-l;r++){
            if(l+r>N) continue;
            int d = K-l-r;
            int now = 0;
            vector<int> s;
            for(int i=0;i<l;i++){
                now += v[i];
                s.push_back(v[i]);
            }
            for(int i=N-r;i<N;i++){
                now += v[i];
                s.push_back(v[i]);
            }

            sort(s.begin(), s.end());
            rep(i, d){
                if(i >= s.size()) break;
                if(s[i] > 0) break;
                now -= s[i];
            }
            ans = max(ans, now);
        }
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a,b;
  cin>>a>>b;
  if((a==1 && b==2)||(b==1 && a==2))
    cout<<3<<"\n";
  else if((a==2 && b==3)||(b==2 && a==3))
    cout<<1<<"\n";
  else
    cout<<2<<"\n";
}

Measured memory_bytes: 256
#include<stdio.h>
#define MAX 100000
#define SENTINEL 2000000000

struct Card{
  char suit;
  int value;
};

struct Card L[MAX/2+2],R[MAX/2+2];
void merge(struct Card A[],int n,int left,int mid,int right){
  int i,j,k;
  int n1=mid-left;
  int n2=right-mid;
  for(i=0 ; i<n1 ; i++) L[i]=A[left+i];
  for(i=0 ; i<n2 ; i++) R[i]=A[mid+i];
  L[n1].value=R[n2].value=SENTINEL;
  i=j=0;
  for(k=left ; k<right ; k++){
    if(L[i].value<=R[j].value){
      A[k]=L[i++];
    }
    else{
      A[k]=R[j++];
    }
  }
}

void mergeSort(struct Card A[],int n,int left,int right){
  int mid;
  if(left+1 < right){
    mid=(left+right)/2;
    mergeSort(A,n,left,mid);
    mergeSort(A,n,mid,right);
    merge(A,n,left,mid,right);
  }
}

int partition(struct Card A[],int n,int p,int r){
  int i,j;
  struct Card t,x;
  x=A[r];
  i=p-1;
  for(j=p ; j<r ; j++){
    if(A[j].value <= x.value){
      i++;
      t=A[i];
      A[i]=A[j];
            A[j]=t;
    }
  }
  t=A[i+1];
  A[i+1]=A[r];
  A[r]=t;
  return i+1;
}

void quickSort(struct Card A[],int n,int p,int r){
  int q;
  if(p<r){
    q=partition(A,n,p,r);
    quickSort(A,n,p,q-1);
    quickSort(A,n,q+1,r);
  }
}

int main(){
  int n,i,v;
  struct Card A[MAX],B[MAX];
  char S[10];
  int stable = 1;
  scanf("%d",&n);
  for(i=0 ; i<n ; i++){
    scanf("%s %d",S,&v);
    A[i].suit=B[i].suit=S[0];
    A[i].value=B[i].value=v;
  }
  mergeSort(A,n,0,n);
  quickSort(B,n,0,n-1);
  for(i=0 ; i<n ; i++){
    if(A[i].suit != B[i].suit) stable=0;
  }
  if(stable==1) printf("Stable\n");
  else printf("Not stable\n");
  for(i=0 ; i<n ; i++){
    printf("%c %d\n",B[i].suit,B[i].value);
  }
  return 0;
}




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

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (m); i < (int)(n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define INF 2000000000

#ifdef LOCAL
  #define eprintf(...) fprintf(stdout, __VA_ARGS__)
#else
  #define eprintf(...) 0
#endif

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned int uint;

int ctoi(char c) {
  return c - '0';
}

template <class C>
void printContainer(C &container, const char *delim=",") {
  for(const auto &e : container) {
    std::cout << e << delim;
  }
  std::cout << "\n";
}

// Greatest common divisor
template<class T>
T gcd(T x, T y) {
  if(x < y) {
    std::swap(x, y);
  }
  T r = x % y;
  while(r != 0) {
    x = y;
    y = r;
    r = x % y;
  }
  return y;
}

// Least common multiple
template<class T>
T lcm(T x, T y) {
  return (x*y)/gcd(x,y);
}

int main() {
  int n, m;
  cin >> n >> m;
  int ans = (n-1) * (m-1);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define int long long
#define endl "\n"
#define pii pair<int,int> 
#define ff first
#define ss second
#define mii map<int,int>
#define si set<int>
#define sti stack<int>
#define qi queue<int>
#define vi vector<int>
#define pq priority_queue<int>
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const int M=1e9+7;

int32_t main(){
	IOS;
	int n,k;
	cin>>n>>k;
	int a[n];
	for(int i=0;i<n;i++) cin>>a[i];
	sort(a,a+n);
	int ans=0;
	for(int i=n-1;i>=max((long long)0,n-k);i--){a[i]=0;}
	for(int i=n-k-1;i>=0;i--){
		ans+=a[i];
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 1792
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
typedef vector<int> vi;
typedef vector<ll> vl;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define IN cin >> 
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (m-1); i >= (int)(n); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////


int main(){

    ll n,k,q;
    cin >> n >> k >> q;
    ll b[n+1] = {};
    rep(i,0,q){
	ll a;
	cin >> a;

	b[0]--;
	b[a]++;
	    
	b[a+1]--;
    }

    ll sum = b[0];
    rep(i,1,n+1){
	sum += b[i];
	//	PS(sum + k);
	if(sum + k <= 0)No;
	else Yes;
    }
    
    
    return  0;
}


Measured memory_bytes: 1408
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Globalization;
using System.Diagnostics;
using static System.Console;
using Pair = System.Collections.Generic.KeyValuePair<int, int>;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().Solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    Random rnd = new Random();
    Stopwatch sw = new Stopwatch();
    readonly int[] dd = { 0, 1, 0, -1, 0 };
    readonly int mod = 1000000007;
    readonly string alfa = "abcdefghijklmnopqrstuvwxyz";

    int N, M, from, to;
    List<int>[] G;
    Stack<int> S;
    Queue<int> Q;

    bool[] B;
    void Solve()
    {
        N = cin.Nextint;
        M = cin.Nextint;
        int s=-1, g=-1;
        G = Enumerable.Range(0, N).Select(i => new List<int>()).ToArray();
        for (int i = 0; i < M; i++)
        {
            int a = cin.Nextint - 1;
            int b = cin.Nextint - 1;
            G[a].Add(b);
            G[b].Add(a);
            s = a;
            g = b;
        }

        B = new bool[N];
        B[s] = true; B[g] = true;
        S = new Stack<int>();
        Q = new Queue<int>();
        S.Push(s);
        Q.Enqueue(g);
        Dfs(s, 0);
        Dfs(g, 1);
        WriteLine(S.Count + Q.Count);
        foreach (var v in S)
        {
            Write((v + 1) + " ");
        }
        foreach (var v in Q)
        {
            Write((v + 1) + " ");
        }
        WriteLine();

    }
    void Dfs(int u, int p)
    {
        foreach (var v in G[u])
        {
            if (B[v]) continue;
            else
            {
                B[v] = true;
                if (p == 0) S.Push(v);
                else Q.Enqueue(v);
                Dfs(v, p);
                break;
            }
        }
    }

}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] Scan { get { return ReadLine().Split(); } }
    public int[] Scanint { get { return Array.ConvertAll(Scan, int.Parse); } }
    public long[] Scanlong { get { return Array.ConvertAll(Scan, long.Parse); } }
    public double[] Scandouble { get { return Array.ConvertAll(Scan, double.Parse); } }
    public string Next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return Next;
        }
    }
    public int Nextint { get { return int.Parse(Next); } }
    public long Nextlong { get { return long.Parse(Next); } }
    public double Nextdouble { get { return double.Parse(Next); } }
}

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

using namespace std;

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
#define Get(t, i) get<(i)>((t))
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, f, n) for(int i = (int)(f); i < (int)(n); i++)
#define each(a, b) for(auto& a : b)

const int inf = 1 << 25;
const ll INF = 1LL << 55;

int main()
{
  int N, M, T;
  cin >> N >> M >> T;
  int ans = 0;
  int a[111];
  a[0] = 0;
  rep(i, N) {
    cin >> a[i+1];
    if(i == 0) ans += a[i+1] - M;
    else if(a[i+1] - a[i] > 2*M) ans += (a[i+1]-a[i]) - 2*M;
  }
  cout << ans + max(0, T-a[N]-M) << endl;
  return 0;
}

Measured memory_bytes: 3128
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define pi 3.141592653589793238
#define int long long
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

long long power(long long a, long long b,long long m) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a %m;
        a = a * a %m;
        b >>= 1;
    }
    return res;
}


signed main()
{

ios_base::sync_with_stdio(false);
cin.tie(NULL);  
cout.tie(0);   

#ifndef ONLINE_JUDGE
    if(fopen("INPUT.txt","r"))
    {
    freopen ("INPUT.txt" , "r" , stdin);
    freopen ("OUTPUT.txt" , "w" , stdout);
    }
#endif  

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


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
typedef long long ll;
#define rep(i,a,n) for(int i=a;i<n;i++)
#define rrep(i,n,a) for(int i=n;i>=a;i--)
#define FOR(i,n) for(int i=0;i<n;i++)
#define all(s) s.begin(),s.end()
#define vi vector<int>
#define vvi vector<vector<int>>
#define pcnt(n) __builtin_popcount(n)
const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const int INF = 1e18;


signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,m;
    cin>>n>>m;
    int a;
    rep(i,0,m){
        cin>>a;
        n-=a;
    }
    cout<<(n>=0?n:-1)<<endl;
}

Measured memory_bytes: 3656
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int a = input.nextInt();
        int b = input.nextInt();
        int remind = 16  - (a + b);
        remind += Math.abs(a - b);
        remind = remind / 2;
        if (Math.abs(a - b) <= remind){
            System.out.println("Yay!");
        }else{
            System.out.println(":(");
        }
    }
}


Measured memory_bytes: 21588
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.container;
import std.datetime;


void main()
{
	int num[4][2];
	foreach (line; stdin.byLine) {
		auto x = line.chomp.split.map!(to!double);
		foreach (i; 0..2) {
			if (x[i] < 0.2) num[3][i]++;
			else if (x[i] < 0.6) num[2][i]++;
			else if (x[i] < 1.1) num[1][i]++;
			else num[0][i]++;
		}
	}
	foreach (i; 0..4) {
		writeln(num[i][0], " ", num[i][1]);
	}
}

Measured memory_bytes: 1184
#include <stdio.h>

using namespace std;


int main(){
	int a,b,count,s;

	while(scanf("%d %d",&a,&b)!=EOF){
		count=0;
		s=a+b;
		while(s!=0){
			s/=10;
			count++;
		}
		printf("%d\n",count);
	}

    return 0;
}


Measured memory_bytes: 2576