akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
template<class T> bool INRANGE(T x,T a,T b) { return a<=x&&x<=b; }
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

#define REP(i,n) for(int i=0;i<(n);++i)
#define RREP(i,n) for(int i=(n);i>=0;--i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i=(a);i>=(b);--i)
#define ALL(v) (v).begin(),(v).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;


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

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


    int H, W, K;
    cin >> H >> W >> K;

    const ll mod = 1000000007;
    ll dp[H+1][W];
    REP(i,H+1) REP(j,W) dp[i][j] = 0;
    dp[0][0] = 1;

    REP(h,H) REP(w,W) {
        REP(bit,1 << (W - 1)) {
            // Check if two horizontal lines are connecting
            // 2 つの横線がつながっていないか調べる
            bool ok = true;
            REP(i,W-2) if (((bit >> i) & 1) and ((bit >> (i + 1)) & 1)) ok = false;

            if (ok) {
                if (w >= 1 and ((bit >> (w - 1)) & 1)) {
                    // The case which goes left
                    // 左方向に横線をたどるケース
                    dp[h + 1][w - 1] += dp[h][w];
                    dp[h + 1][w - 1] %= mod;
                }
                else if (w <= W - 2 and ((bit >> w) & 1)) {
                    // The case which goes right
                    // 右方向に横線をたどるケース
                    dp[h + 1][w + 1] += dp[h][w];
                    dp[h + 1][w + 1] %= mod;
                }
                else {
                    // The case which goes straight
                    // 横線をたどらないケース
                    dp[h + 1][w] += dp[h][w];
                    dp[h + 1][w] %= mod;
                }
            }
        }
    }

    cout << dp[H][K-1] << endl;

    return 0;
}

Measured memory_bytes: 256
/*
sonu_verma1
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb(a) push_back(a)
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)
int main()
{
	int h,n,i;
	cin>>h>>n;
	int a[n],sm=0;
	for(i=0;i<n;i++)
	{
		cin>>a[i];
		sm+=a[i];
	}
	if(h<=sm)
		cout<<"Yes";
	else
		cout<<"No";
 
	return 0;
}

Measured memory_bytes: 640
x, y = map(int, raw_input().split())
#a, b, c = raw_input().split()
a = [1,3,5,7,8,10,12]
b = [4,6,9,11]
c = [2]
if (x in a and y in a) or (x in b and y in b) or (x in c and y in c):
    print "Yes"
else:
    print "No"

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

int a[107];

int main()
{
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) scanf("%d", &a[i]);

    sort(a, a+n);

    ll cur = 0, ans = INT_MAX;
    for (int i = a[0]; i <= a[n-1]; i++) {
        for (int j = 0; j < n; j++) {
            cur += (i-a[j]) * (i-a[j]);
        }
        ans = min(cur, ans);
        cur = 0;
    }

    if (ans == INT_MAX) cout << 0;
    else cout << ans;
}


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

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

    vector<int> ans;
    if(n == 3) ans = {2, 3, 25};
    else{// n >= 4
        ans = {2, 4, 3, 9};
        n -= 4;

        int k = 1;
        while(n >= 2 && 3 + 12 * k < 30000){
            ans.push_back(3 + 12 * k);
            ans.push_back(9 + 12 * k);
            k += 1;
            n -= 2;
        }
        k = 1;
        while(n >= 2 && 2 + 6 * k < 30000){
            ans.push_back(2 + 6 * k);
            ans.push_back(4 + 6 * k);
            k += 1;
            n -= 2;
        }
        k = 1;
        while(n >= 1){
            ans.push_back(6 * k);
            k += 1;
            n -= 1;
        }
    }

    // output
    n = ans.size();
    for(int i=0; i<n; i++){
        cout << ans[i];
        if(i == n-1) break;
        cout << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3724
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        AAC solver = new AAC();
        solver.solve(1, in, out);
        out.close();
    }

    static class AAC {
        public void solve(int testNumber, FastReader s, PrintWriter out) {
            String str = s.nextString();
            if (str.equals("ABC")) {
                out.println("ARC");
            } else {
                out.println("ABC");
            }
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public String nextString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                if (Character.isValidCodePoint(c)) {
                    res.appendCodePoint(c);
                }
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 32348
h, w = map(int, input().split())
s = [['.'] * (w + 2)]
s += [list('.' + input() + '.') for _ in range(h)]
s += [['.'] * (w + 2)]
for i in range(h + 1):
    for j in range(w + 1):
        if s[i][j] != '#':
            count = 0
            if s[i][j + 1] == '#':
                count += 1
            if s[i][j - 1] == '#':
                count += 1
            if s[i - 1][j] == '#':
                count += 1
            if s[i + 1][j] == '#':
                count += 1
            if s[i - 1][j - 1] == '#':
                count += 1
            if s[i + 1][j + 1] == '#':
                count += 1
            if s[i - 1][j + 1] == '#':
                count += 1
            if s[i + 1][j - 1] == '#':
                count += 1
            s[i][j] = count

for i in range(1, h + 1):
    ans = []
    for j in range(1, w + 1):
        ans += str(s[i][j])
    print(''.join(ans))

Measured memory_bytes: 3064
n = int(input())
a = list(map(int,input().split()))
dp = [0] * (n+1)

for i in a:
    dp[i] += 1

ans = 0
for i in dp:
    if i > 1:
        l = list(range(i))
        ans += sum(l)

for i in a:
    if dp[i] > 1:
        print(ans - dp[i] +1)
    else:
        print(ans)

Measured memory_bytes: 32200
#include <iostream>
using namespace std;
 
int main(){  
    int i, n;
    long long a[2000001], min, max, sum;
    cin >>n; 
    for (i = 1; i <= n; i++){
    cin >> a[i];
    }
min = a[1];
max = a[1];
sum = a[1];
 
for (i = 2; i <= n; i++){
    if(a[i] > max) max = a[i];
        if(a[i] < min) min = a[i];
    sum += a[i];
}
cout << min <<" "<< max << " "<< sum << endl;
 
return 0;}


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

int main() {
	while(true){
		int n;
		cin>>n;
		if(n==0) return 0;
		vector<int>v(n);
		for(int i=0;i<n;i++){
			cin>>v[i];
		}
		int sum=0;
		for(int i=0;i<n;i++){
			sum+=v[i];
		}
		sort(v.begin(),v.end());
		cout<<(sum-v[0]-v[n-1])/(n-2)<<endl;
	}
	return 0;
}


Measured memory_bytes: 3140
/**
*    created: 15.05.2020 05:24:47
**/

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
const int inf =1000000000;

int main() {
    int n, k;
    cin >> n >> k;
    int x = 1;
    rep(i,n){
        if(x>k){
            x += k;
        }else{
            x *= 2;
        }
    }
    cout << x << endl;
}

Measured memory_bytes: 256
def main():
    N, M = map(int, input().split())
    if N == 1:
        print(M)
    else:
        ans = 0
        for i in range(1, int(M ** 0.5)):
            if M % i != 0:
                continue
            if M >= i * N:
                ans = max(i, ans)
            if M >= M // i * N:
                ans = max(M // i, ans)

        print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
//inlclude前用define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<type_traits>
#include<numeric>
//#include<deque>
#include<iomanip>
#include<set>
#include<tuple>
#include<map>

using namespace std;

//typedef
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef long long int ll;

//define
#define INF 1e9 
#define NUM 1000000007
#define all(x) begin(x), end(x)
#define rep(i,n) for(int i=0;i<(int)(n);i++)

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

	rep(i, s.size() - 8) {
		cout << s[i];
	}
	cout << "\n";

	return 0;
	
}





Measured memory_bytes: 256
import itertools
n=int(input())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
l=[i for i in range(1,n+1)]
x=list(list(itertools.permutations(l,n)))
#print(x)
a=0
b=0
for i in range(len(x)):
    if p==list(x[i]):
        a=i+1
    if q==list(x[i]):
        b=i+1
print(abs(a-b))


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

#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define lrep(i,n) for(long long  i = 0; i < (long long)(n); i++)
#define lrep2(i,a,n) for(long long i = (long long)(a); i <= (long long)(n); i++)
#define irrep(i,n) for(int i = (int)(n-1); i > -1; i--)
#define irrep2(i,a,n) for(int i = (int)(n); i >= (int)(a); i--)

typedef long long ll;
typedef std::vector<int> v_int;
typedef std::vector<v_int > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<v_ll > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<v_string > v2_string;
typedef std::vector<bool> v_bool;
typedef std::vector<v_bool > v2_bool;
typedef std::pair<ll, ll> pll;
typedef std::pair<int, int> pii;

const double PI = 3.14159265359;
const int INF = (int)1e9;
const ll LINF = 1e18;
const int IMOD = 1000000007;
const int dr[4] = {1, 0, -1, 0};
const int dc[4] = {0, 1, 0, -1};

using namespace std; 

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a; }
ll lcm(ll a, ll b) { return a*(b/gcd(a,b)); }

int main(void)
{
    int n, m;
    cin >> n >> m;
    string s,t;
    cin >> s >> t;
    
    ll l = lcm(n,m); 
    ll g = gcd(n,m);

    ll a = n/g;
    ll b = m/g;
    bool ok = true;
    irep(i, g) {
        if(s[a*i] != t[b*i]) {
            ok = false;
        }
    }
    if(ok) {
        cout << l << endl;
    } else {
        cout << -1 << endl;
    }
    return 0;
}
/** atcoder **/



Measured memory_bytes: 512
import java.util.*;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.math.BigDecimal;
public class Main{
	public static void main(String[] args){
		int N = IO.nextInt();
		int M = IO.nextInt();
		int[][] data = new int[M][4];
		for(int i=0; i<M; i++){
			data[i][0] = i;
			data[i][1] = IO.nextInt();
			data[i][2] = IO.nextInt();
			data[i][3] = 0;
		}
		Arrays.sort(data, (x, y) -> x[1]==y[1] ? x[2]-y[2] : x[1]-y[1]);
		int a = 0;
		int b = 0;
		for(int i=0; i<M; i++){
			if(data[i][1] != a){
				a = data[i][1];
				b = 0;
			}
			data[i][3] = ++b;
		}
		Arrays.sort(data, (x, y) -> x[0]-y[0]);
		StringBuilder string = new StringBuilder();
		for(int i=0; i<M; i++){
			string.append(String.format("%06d%06d\n", data[i][1], data[i][3]));
		}
		IO.out(string.toString());
		IO.flush();
		return;
	}
}


final class IO {
	private static final InputStream in = System.in;
	private static final PrintWriter out = new PrintWriter(System.out, false);
	private static final byte[] buffer = new byte[1024];
	private static int ptr = 0;
	private static int len = 0;
 
	private static boolean hasNextByte() {
		if (ptr < len)
			return true;
		ptr = 0;
		try {
			len = in.read(buffer);
		} catch (IOException e) {
			e.printStackTrace();
		}
		return len > 0;
	}
 
	private static int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}
 
	static boolean hasNext() {
		byte c;
		while (hasNextByte() && ((c = buffer[ptr]) < '!' || c > '~'))
			ptr++;
		return hasNextByte();
	}
 
	static String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (b >= '!' && b <= '~') {
			sb.append((char) b);
			b = readByte();
		}
		return sb.toString();
	}
 
	static char nextChar() {
		if (!hasNext())
			throw new NoSuchElementException();
		return (char) readByte();
	}
 
	static long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		int sign = 1;
		int b = readByte();
		if (b == '-') {
			sign = -1;
			b = readByte();
		}
		if (b < '0' || '9' < b)
			throw new NumberFormatException();
		while (true) {
			if ('0' <= b && b <= '9')
				n = n * 10 + b - '0';
			else if (b == -1 || b < '!' || b > '~')
				return n * sign;
			else
				throw new NumberFormatException();
			b = readByte();
		}
	}
 
	static int nextInt() {
		if (!hasNext())
			throw new NoSuchElementException();
		int n = 0;
		int sign = 1;
		int b = readByte();
		if (b == '-') {
			sign = -1;
			b = readByte();
		}
		if (b < '0' || '9' < b)
			throw new NumberFormatException();
		while (true) {
			if ('0' <= b && b <= '9')
				n = n * 10 + b - '0';
			else if (b == -1 || b < '!' || b > '~')
				return n * sign;
			else
				throw new NumberFormatException();
			b = readByte();
		}
	}
 
	static double nextDouble() {
		return Double.parseDouble(next());
	}
 
	static void out(String val) {
		out.println(val);
	}
 
	static void flush() {
		out.flush();
	}
}

Measured memory_bytes: 116452
#include <cstdio>
#include <cstring>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR (i, 0, n)
#define _ << " _ " <<
#define TRACE(x) cerr << #x << " = " << x << endl
#define debug(...) fprintf(stderr, __VA_ARGS__)
//#define debug
//#define TRACE(x)

using namespace std;

typedef long long llint;

const int MAXN = 200010;

int n, a[MAXN];
vector<int> v;
set<int> s;
llint res;

bool cmp(int i, int j) { return a[i] < a[j]; }

int main(void) {
  scanf("%d",&n);
  REP(i, n) {
    scanf("%d",&a[i]);
    v.push_back(i);
  }
  sort(v.begin(), v.end(), cmp);

  s.insert(-1);
  s.insert(n);
  for (int i : v) {
    s.insert(i);
    auto lo = s.lower_bound(i); --lo;
    auto hi = s.upper_bound(i);
    res += (llint)(i - *lo) * (*hi - i) * a[i];
  }

  printf("%lld\n",res);
  
  return 0;
}


Measured memory_bytes: 11124
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define N 10000
int main()
{
    int a,b,c;
    while(~scanf("%d%d%d",&a,&b,&c))
    {
        a=a-b;
        c=a%c;
        printf("%d\n",c);
    }
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
const int inf=1e8;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
int main(){
	int n,W,H;
	cin>>n>>W>>H;
	vi w(200100);
	vi h(200100);
	while(n--){
		int a,b,c;
		cin>>a>>b>>c;
		w[max(0,a-c)]++;
		w[a+c]--;
		h[max(0,b-c)]++;
		h[b+c]--;
	}
	bool out=true;
	int co=0;
	rep(i,W){
		co+=w[i];
		if(!co)out=false;
		if(!out)break;
	}
	if(out){
		cout<<"Yes"<<endl;
		return 0;
	}
	co=0;
	out=true;
	rep(i,H){
		co+=h[i];
		if(!co)out=false;
		if(!out)break;
	}
	cout<<(out?"Yes":"No")<<endl;
}

Measured memory_bytes: 2592
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
using namespace std;
template<class T, class Compare = less<T> >
using MaxHeap = priority_queue<T, vector<T>, Compare>;
template<class T, class Compare = greater<T> >
using MinHeap = priority_queue<T, vector<T>, Compare>;
using llong = long long;

llong n, m;
string s, t;

int main() {
    cin >> n;
    cout << n * n << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5;
const int P = 998244353;
const int Q = 716070898;
const int limit = 1000;
typedef long long ll;
template <typename T> void chkmax(T &x, T y) {x = max(x, y); }
template <typename T> void chkmin(T &x, T y) {x = min(x, y); } 
template <typename T> void read(T &x) {
	x = 0; int f = 1;
	char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
	x *= f;
}
int n, m, x[MAXN], y[MAXN], z[MAXN];
int bit[MAXN], f[MAXN], g[MAXN], res[MAXN];
vector <int> a[MAXN], b[MAXN], c[MAXN];
void update(int &x, int y) {
	x += y;
	if (x >= P) x -= P;
}
void work(vector <int> *a, int *res) {
	static int vis[MAXN];
	for (int i = n; i >= 1; i--) {
		for (auto x : a[i]) if (x > i) vis[res[x]] = true;
		while (vis[res[i]]) res[i]++;
		for (auto x : a[i]) if (x > i) vis[res[x]] = false;
	}
}
int main() {
	read(n);
	read(m);
	for (int i = 1; i <= m; i++) {
		int x, y; read(x), read(y);
		a[x].push_back(y);
		a[y].push_back(x);
	}
	read(m);
	for (int i = 1; i <= m; i++) {
		int x, y; read(x), read(y);
		b[x].push_back(y);
		b[y].push_back(x);
	}
	read(m);
	for (int i = 1; i <= m; i++) {
		int x, y; read(x), read(y);
		c[x].push_back(y);
		c[y].push_back(x);
	}
	work(a, x);
	work(b, y);
	work(c, z);
	bit[0] = 1;
	for (int i = 1; i <= n; i++)
		bit[i] = 1ll * Q * bit[i - 1] % P;
	for (int i = 1; i <= n; i++) {
		update(f[y[i]], bit[i]);
		update(g[z[i]], bit[i]);
	}
	for (int i = 0; i <= limit; i++) {
		for (int j = 0; j <= limit; j++) {
			int k = i ^ j;
			update(res[i], 1ll * f[j] * g[k] % P);
		}
	}
	int ans = 0;
	for (int i = 1; i <= n; i++)
		update(ans, 1ll * res[x[i]] * bit[i] % P);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 18304
#include <bits/stdc++.h>
using namespace std;
#define mem(a, b) memset(a, (b), sizeof(a))
#define fore(i,a) for(int i=0;i<a;i++)
#define fore1(i,j,a) for(int i=j;i<a;i++)
#define print(ar) for(int i=0;i<ar.size();i++)cout<<ar[i]<<" ";
#define END cout<<'\n'
const double pi=acos(-1.0);
 
typedef pair<int, int> PII;
 
typedef vector<long long> VI;
 
typedef vector<string> VS;
 
typedef vector<PII> VII;
 
typedef vector<VI> VVI;
 
typedef map<int,int> MPII;
 
typedef set<int> SETI;
 
typedef multiset<int> MSETI;
 
typedef long int li;
 
typedef unsigned long int uli;
 
typedef long long int ll;
 
typedef unsigned long long int  ull;
ll fastexp (ll a, ll b, ll n) {
  ll res = 1;
  while (b) {
      if (b & 1) res = res*a%n;
      a = a*a%n;
      b >>= 1;
  }
  return res;
}
void fast(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
ll nop(ll m, ll n) 
{ 
   
    ll path = 1; 
    for (ll i = n; i < (m + n - 1); i++) { 
        path *= i; 
        path /= (i - n + 1); 
    } 
    return path; 
} 
  
int main()
 {  fast();
	ll t;
    ll n;
    cin>>n;
    ll sum=0;
    VI arr(n);
   fore(i,n){
     cin>>arr[i];
     sum+=arr[i];
   }
   
   ll  m;
    cin>>m;
  while(m--){
    ll p,x;
    cin>>p>>x;
    p--;
    cout<<sum-arr[p]+x<<endl;
	    
	}}

Measured memory_bytes: 256
<?php

fscanf(STDIN, '%d %d %d %d %d', $W, $H, $x, $y, $r);

echo (($x + $r <= $W && $y + $r <= $H) && ($x - $r >= 0 && $y - $r >= 0)) ? ('Yes') : ('No');
echo PHP_EOL;

Measured memory_bytes: 6524
/*2019/10/19 */
/*template*/
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#define MOD 1000000007
#define MIN 999999999
#define MAX -999999999
typedef long long int ll;
typedef unsigned long long int ull;
void llswap(ll *x,ll *y){ll tmp;tmp=*x;*x=*y;*y=tmp;}
void swap(int *x,int *y){int tmp;tmp=*x;*x=*y;*y=tmp;}
int rmax(int x,int y){return x>y?x:y;}
int rmin(int x,int y){return x>y?y:x;}
ll llrmax(ll x,ll y){return x>y?x:y;}
ll llrmin(ll x,ll y){return x>y?y:x;}
int asc(const void *a,const void *b){if(*(int*)a < *(int*)b)return -1;else if(*(int*)a == *(int*)b)return 0;else return 1;}
int desc(const void *a,const void *b){if(*(int*)a < *(int*)b)return 1;else if(*(int*)a == *(int*)b)return 0;else return -1;}
int llasc(const void *a,const void *b){if(*(ll*)a < *(ll*)b)return -1;else if(*(ll*)a == *(ll*)b)return 0;else return 1;}
int lldesc(const void *a,const void *b){if(*(ll*)a < *(ll*)b)return 1;else if(*(ll*)a == *(ll*)b)return 0;else return -1;}
int gcd(int x,int y){if(y==0)return x;return gcd(y,x%y);}
 
//int asc_t(const void *a,const void *b){if(((pair_t*)a)->d < ((pair_t*)b)->d)return -1;else if(((pair_t*)a)->d == ((pair_t*)b)->d)return 0;else return 1;}
//int asc_t(const void *a,const void *b){if(((pair_t*)a)->d < ((pair_t*)b)->d)return 1;else if(((pair_t*)a)->d == ((pair_t*)b)->d)return 0;else return -1;}
double to_deg(double r) {return r * 180.0 / (atan(1.0) * 4.0);}
int main(){
    double n;
    scanf("%lf",&n);
    for(double i=1.0;i<=50000.0;i+=1.0){
        if((int)(i*1.08)==n){
            printf("%.0lf\n",i);
            return 0;
        }
    }
    printf(":(\n");
return 0;
}


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

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

int main(){
	long long N,M,s=0,ans=0;
	scanf("%lld %lld",&N,&M);
	
	long long A[N];
	long long sum[N+1];
	sum[0]=0;
	for(long long i=0;i<N;i++){
		scanf("%lld",&A[i]);
		s=(s+A[i])%M;
		sum[i+1]=s;
	}
	
	qsort(sum,N+1,sizeof(long long int),compare);
	
	long long c=1;
	for(long long int i=0;i<N;i++){
		if(sum[i]==sum[i+1])c++;
		else{
			if(c>1)ans+=c*(c-1)/2;
			c=1;
		}
	}
	ans+=c*(c-1)/2;
	
	printf("%lld\n",ans);
	
	return 0;
}

Measured memory_bytes: 2556
#include<stdio.h>
#define MAX 100000

int parent(int i) { return i/2; }
int left(int i) { return 2*i; }
int right(int i) { return 2*i+1; }

int main() {
  int H, i, A[MAX+1];

  scanf("%d",&H);
  for(i = 1;i <= H;i++) scanf("%d",&A[i]);

  for(i = 1;i <= H;i++){
    printf("node %d",i);
    printf(": key = %d, ",A[i]);
    if(parent(i) >= 1) printf("parent key = %d, ",A[parent(i)]);
    if(left(i) <= H) printf("left key = %d, ",A[left(i)]);
    if(right(i) <= H) printf("right key = %d, ",A[right(i)]);
    printf("\n");
  }
  return 0;
}



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

int main(){
  int n;cin>>n;
  vector<int> a(n);for(int i=0;i<n;i++){cin>>a.at(i);}
  vector<int> b(n);for(int i=0;i<n;i++){cin>>b.at(i);}
  vector<int> c(n-1);for(int i=0;i<n-1;i++){cin>>c.at(i);}
  int ans=0;
  
  for(int i=0;i<n;i++){
    ans+=b.at(i);
  }
  for(int i=0;i<n-1;i++){
    if(a.at(i)+1==a.at(i+1)){
      ans+=c.at(a.at(i)-1);
    }
  }
  
  cout<<ans<<endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>
#include <cassert>
#include<string>
using namespace std;
int main(){
	int a = 0, b = 0, c=0, d[100000], e[100000],f=0, count = 0;
	char uc[100000];
	cin >> a>>b>>c;
	if (std::abs(a - b) < std::abs(a - c)) {
		cout << 'A' << endl;
	}
	else { cout << 'B' << endl; }
	
	
		return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#define N 100

int sum(int top, int under, int left, int right, int a[N][N], int temp);
//int search(int top, int under, int left, int right, int max, int a[N][N], int n);

int main(int argc, const char * argv[])
{
    int n=0;
    scanf("%d",&n);
    int a[N][N]={0};
    
    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            scanf("%d",&a[i][j]);
        }
    }
    /*---------------*/
    
    
    int max = a[0][0];
    
    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            for(int k=i; k<n; k++){
                int l=j;
                int temp=0;
                while(l<n){
                    temp=sum(i, k, j, l, a, temp);
                    if(temp>max){
                        max=temp;
                    }else if(temp<0){
                        l=n;
                    }
                    l++;
                }
            }
        }
    }
    
    /*---------------*/
    printf("%d\n",max);
}


int sum(int top, int under, int left, int right, int a[N][N], int temp){
    //int temp=0;
    for(int i=top; i<=under; i++){
        //for(int j=left; j<=right; j++){
            temp += a[i][right];
        //}
    }
    //printf("%d,top:%d,under:%d,left:%d,right:%d\n",temp,top,under,left,right);
    return temp;
}

Measured memory_bytes: 1236
#include<stdio.h>

#define MAX 100000

int parent(int i){
  return i/2;
}

int left(int i){
  return 2*i;
}

int right(int i){
  return 2*i+1;
}

int main(){

  int H,i,A[MAX+1];

  scanf("%d",&H);
  for(i=1;i<=H;i++){
    scanf("%d",&A[i]);
  }

  for(i=1;i<=H;i++){
    printf("node %d: key = %d, ",i,A[i]);
    if(parent(i)>=1)printf("parent key = %d, ",A[parent(i)]);
    if(left(i)<=H)printf("left key = %d, ",A[left(i)]);
    if(right(i)<=H)printf("right key = %d, ",A[right(i)]);
    printf("\n");
  }

  return 0;
}



Measured memory_bytes: 2048
#include <stdio.h>

int n,A[50];




int solve(int i,int m){
  if(m==0){
    return 1;
  }
  if(i>=n){
    return 0;
  }
  int r=solve(i+1,m) || solve(i+1,m-A[i]);
  return r;
}

int main(){
  int i,a,m;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  scanf("%d",&a);
  for(i=0;i<a;i++){
    scanf("%d",&m);
    if(solve(0,m)==1){
      printf("yes\n");
    }
    else{
      printf("no\n");
    }
  }

  return 0;
}


  
  
  
    
  



Measured memory_bytes: 2104
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int n,m,k;
int main(){
	scanf("%d%d%d",&n,&m,&k);
	for(int i=0;i<=m;i++){
		if(!(m-2*i))continue;
		if((k-n*i)%(m-2*i)!=0)continue;
		int j=(k-n*i)/(m-2*i);
		if(0<=j&&j<=n){
			printf("Yes\n");
			return 0;
		}
		
	}
	printf("No\n");
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<numeric>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

using ll = long long;

class Stream{
public:
    Stream(){

    }
    //配列以外の入力を受け取る
    void read(){

    }
    template<typename First, typename... Rest>
    void read(First& first, Rest&... rest){
        cin >> first;
        read(rest...);
    }
    //配列を区切って出力する
    template<typename T>
    void write_vec(vector<T>& v, char divider){
        for(size_t i = 0; i < v.size(); i++){
            cout << v[i] << divider;
        }
    }
};

int main(){
    Stream io;
    
    int R;
    io.read(R);
    if(R < 1200){
        cout << "ABC";
    }
    else if(R < 2800){
        cout << "ARC";
    }
    else {
        cout << "AGC";
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
    #define sqr(n) (n)*(n)
    #define min(a,b) a<b?a:b
    using namespace std;
    int main(void){
      int n,a[100],w;
      long long s,ans=10000000000;
      cin>>n;
      for(int i=0;i<n;i++)
        cin>>a[i];
      for(w=-100;w<=100;w++){
        s=0;
        for(int j=0;j<n;j++)
          s+=sqr(a[j]-w);
        ans=min(ans,s);
      }
      cout<<ans<<endl;
      return 0;
    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, N) for (int i = 0; i < (int)N; ++i)
#define all(a) (a).begin(), (a).end()

int A, B;

int main() {
  cin >> A >> B;

  cout << ((A <= 9 && B <= 9) ? A * B : -1) << endl;
  return 0;
}


Measured memory_bytes: 768
using System;
namespace q1
{
  class q2
  {
    static void Main()
    {
      string[] x = Console.ReadLine().Split();
      int[] kazu = new int[5];
      for (int gokai = 0;gokai < 5;gokai++)
      {
        kazu[gokai] = int.Parse(x[gokai]);
      }
      for (int y = 0;y < 5;y++)
      {
        if (kazu[y] == 0)
        {
          Console.WriteLine(y + 1);
        }
        else
        {
        }
      }
    }
  }
}


Measured memory_bytes: 27388
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    string s;
    cin>>s;
    sort(s.begin(),s.end());
    if(s[0]==s[1]&&s[1]!=s[2]&&s[2]==s[3]){
        cout<<"Yes"<<endl;
    }
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int PREP = (cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(9), 0);
//int SEGV = getenv("D") || (exit(system("D= SEGFAULT_SIGNALS=all catchsegv ./prog.exe") >> 8), 0);
int main() {
    string S, T; cin >> S >> T;
    if (S == T.substr(0, T.size() - 1)) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }
    return 0;
}


Measured memory_bytes: 3652
n,k = gets.split.map(&:to_i)
as = gets.split.map(&:to_i)
x = 0
40.downto(0) do |i|
  bin = 2 ** i
  next if x + bin > k
  bit_count = as.select{|a| a&bin>0 }.size
  x += bin if bit_count <= as.size/2
end
puts as.map{|a| a^x }.inject(:+)


Measured memory_bytes: 17084
//
// Created by Takaaki Hirano on 2018/09/03.
//
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>

using namespace std;
typedef long long ll;
#define INF int(1e9)
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define REPONE(i, n) for(int i = 1; i <= (int)(n); i++)
#define EACH(i, mp) for(auto i:mp)
#define FOR(i, m, n) for(int i = m;i < n;i++)

int D, G;
const int MAX_D = 100;
int p[MAX_D], c[MAX_D];


void solve() {
    int ans = INF;
    REP(i, pow(2, D)) {
        int count = 0, score = 0;
        REP(j, D) {
            if ((1 & i >> j) == 1) {
                score += p[j] * 100 * (j + 1) + c[j];
                count += p[j];
            }
        }
        REPR(j, D) {
            if ((1 & i >> j) == 1)continue;
            REP(k, p[j]) {
                if (score >= G)break;
                score += 100 * (j + 1);
                count++;
            }
        }
        ans = min(ans, count);
    }
    cout << ans << endl;
}

int main() {
    cin >> D >> G;
    REP(i, D)cin >> p[i] >> c[i];
    solve();
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
        #define vll vector<ll>
        #define vi vector<int>
        #define vvi vector<vector<int>>
        #define vpll vector<pair<ll,ll>>
        #define pii pair<int,int>
        #define REP(i,a) for(int (i)=0; (i)<(a); (i)++)
        #define RREP(i,a) for(int (i)=a-1; (i)>=(0); (i)--)
        #define REP2(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
        #define MOD 1000000007
        #define INF 0x7FFFFFFF
        #define ALL(v) v.begin(), v.end()  
        #define m0(x) memset(x,0,sizeof(x))
        typedef long long ll;
         
        using namespace std;
         
        int main(){
            string S, T;
            cin >> S >> T;
            int ans = 0;
            REP(i,3){
              if(S[i] == T[i]) ans++;
            }
            cout << ans << endl;
            return 0;
        }

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

Measured memory_bytes: 2600
h, w = map(int, input().split())
s = []
for _ in range(h):
    s.append(input())

def search(arr, x, y):
    dif = ((-1, 0), (0, -1), (0, 1), (1, 0))
    flag = 1

    for dx, dy in dif:
        try:    
            if (x+dx) >= 0 and (y+dy) >= 0 and arr[x + dx][y + dy] == '#':
                flag = 0
                break
        except:
            pass
    return flag

for i in range(h):
    for j in range(w):
        if s[i][j] == '#':
            if search(s, i, j):
                print("No")
                exit(0)
print("Yes")

Measured memory_bytes: 3064
#include<stdio.h>

int num[40000];

int main(void) {
	int i,j,k,A,B,C,X;
	scanf("%d%d%d%d",&A,&B,&C,&X);
	for(i=0;i<=A;i++) {
		for(j=0;j<=B;j++) {
			for(k=0;k<=C;k++) {
				num[(i*500)+(j*100)+(k*50)]++;
			}
		}
	}
	//printf("%d %d %d %d\n",A,B,C,X);
	printf("%d",num[X]);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll n,a[55],l,r;
ll c[55][55];

bool cmp(ll a,ll b){
	return a>b;
}
void init(){
	c[0][0]=1;
	for(ll i=1;i<=55;i++){
		c[i][0]=1;
		for(ll j=1;j<=i;j++)
	    c[i][j]=c[i-1][j-1]+c[i-1][j];
	}
}


int main()
{ 
  init();
  scanf("%lld%lld%lld",&n,&l,&r);
  ll sum1=0,sum2=0;
  ll cnt1=0,cnt2=0;
  for(ll i=1;i<=n;i++)
    scanf("%lld",&a[i]);
  sort(a+1,a+n+1,cmp);
   for(ll i=1;i<=l;i++)
    sum1+=a[i];
   for(ll i=1;i<=n;i++)
     if(a[i]==a[l])
       cnt1++;
   for(ll i=1;i<=l;i++)
      if(a[i]==a[l])
        cnt2++;
   if(a[1]==a[l])
     for(ll i=l;i<=r;i++)
	    sum2+=c[cnt1][i];
	else
	    sum2=c[cnt1][cnt2];
	printf("%lf\n%ld",(double)sum1/l,sum2);
  return 0; 
} 

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

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            // 解答はココに書く
            var i_0 = cin.ReadInt;
            var i_1 = cin.ReadInt;
            var i_2 = cin.ReadInt;
            WriteLine(i_2 / i_0 * i_1);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}

Measured memory_bytes: 11220
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
int main(){   
    string s;
    cin>>s;
    for ( int i = 0; i < s.size(); i++)
    {
        if(i%2==0) 
        {
            if(s[i]=='L')
            { cout<<"No"<<endl;
            return 0;
            }  
        }
        else{
            if(s[i]=='R')
            {cout<<"No"<<endl;
            return 0;
            }
        }
        
    }
cout<<"Yes"<<endl;
return 0;
}


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

const int N = 100005;
int n;
char a[N];
vector<int> v;

int main()
{
	scanf("%s",a+1);
	n = strlen(a+1);
	if(a[1] == '0' || a[n] == '1') {
		puts("-1");
		return 0;
	}
	for(int i=1;i<=n-1;i++) {
		if(a[i] != a[n-i]) {
			puts("-1");
			return 0;
		}
	}
	for(int i=1;i<=n-1;i++) {
		if(a[i] == '1') v.push_back(i);
	}
	v.push_back(n);
	for(int i=1;i<(int)v.size();i++) {
		printf("%d %d\n",v[i-1],v[i]);
		for(int j=v[i-1]+1;j<v[i];j++) {
			printf("%d %d\n",j,v[i]);
		}
	}
}


Measured memory_bytes: 2040
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using ll = unsigned long long;
using namespace std;

int main(void) {
    int N;
    vector<int> h;
    cin >> N;
    h.resize(N);
    for(int i = 0; i < N; ++i) {
        cin >> h[i];
    }

    int height = 0;
    while(true) {

        if (*max_element(h.begin(), h.end()) == 0 ){
            break;
        }

        int i = 0;
        while(i < N) {
            if(h[i] == 0) {
                ++i;
            } else {

                // 区間数
                ++height;

                while(i < N && h[i] > 0) {
                    // -1して減らす
                    --h[i];
                    // 連続しているなら++
                    ++i;
                }
            }
        }
    }

    cout << height << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <queue>
#include <iomanip>
using namespace std;
typedef long long ll;

int main() {
    ll n, k, a[2020], ans = 0, inf = 1e9 + 7;
    cin >> n >> k;
    for (int i = 0; i < n; i++) cin >> a[i];

    for (int i = 0; i < n; i++) {
        ll tmp = 0, tmp2 = 0;
        for (int j = 0; j < n; j++) {
            if (a[i] > a[j]) {
                if (j < i) {
                    tmp++;
                    tmp2++;
                }
                else {
                    tmp2++;
                }
            }
        }
        ans += tmp * (k * (k - 1) / 2 % inf);
        ans %= inf;
        ans += (tmp2 - tmp) * (k * (k + 1) / 2 % inf);
        ans %= inf;
    }
    cout << ans << endl;
}

/* 
g++ -std=c++14 _main.cpp
*/

Measured memory_bytes: 256
import sys
from collections import defaultdict, deque
import bisect
from heapq import *
from math import factorial, ceil, floor
from collections import defaultdict
import itertools
sys.setrecursionlimit(200000)
input = sys.stdin.readline

# N, M, = map(int, input().split())
# N = int(input())
# L = [int(v) for v in input().split()]
# L = [[int(v) for v in input().split()] for _ in range(N)]
# L = [int(input()) for _ in range(N)]
# L = [list(input().strip())  for _ in range(N)]
# S = input().strip()

N, = map(int, input().split())
L = [int(input()) for _ in range(N)]

ans = 0
for i in range(N):
    ans += L[i] //2
    L[i] = L[i] % 2

    if i < N - 1:
        if L[i] == 1 and L[i + 1] >= 1:
            L[i] = 0
            L[i + 1] -= 1
            ans += 1

print(ans)


Measured memory_bytes: 7420
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main(){
  
  ll D,T,S;
  cin >> D >> T >> S;
  
  if(D > T*S) cout << "No" << endl;
  else cout << "Yes" << endl;
  
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(),(x).end()
#define pb(x)  push_back(x);
#define INF12 1000000000000 //10^12
#define INF9 1000000000 //10^9
#define MOD 1000000007 //10^9+7
using ll=long long;
using pii=pair<ll,ll>;
using vi=vector<int>;

int main() {
    int P,Q,R;
    cin >> P >> Q >> R;
    cout << (P+Q+R-max(P,max(Q,R))) << endl;
    return 0;
}


Measured memory_bytes: 256
fn main() {
    let v = read_vec::<usize>();
    let n = v[0];
    let m = v[1];

    let mut im = vec![vec![false; n]; n];
    for i in 0..n {
        let line = read::<String>().chars().collect::<Vec<_>>();
        for j in 0..n {
            if line[j] == '#' {
                im[i][j] = true;
            }
        }
    }

    let mut tmp = vec![vec![false; m]; m];
    for i in 0..m {
        let line = read::<String>().chars().collect::<Vec<_>>();
        for j in 0..m {
            if line[j] == '#' {
                tmp[i][j] = true;
            }
        }
    }

    fn check(im: &Vec<Vec<bool>>, t: &Vec<Vec<bool>>, i: usize, j: usize, m: usize) -> bool {
        for x in 0..m {
            for y in 0..m {
                if t[x][y] != im[i + x][j + y] {
                    return false;
                }
            }
        }
        true
    }

    for i in 0..n - m + 1 {
        for j in 0..n - m + 1 {
            if check(&im, &tmp, i, j, m) {
                println!("Yes");
                return;
            }
        }
    }
    println!("No");
}

#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
using ll = long long;
using P = std::pair<int, int>;


template<typename T>
struct BIT {
  int n;
  std::vector<T> d;
  BIT(int n=0):n(n),d(n+1) {}
  void add(int i, T x=1) {
    for (i++; i <= n; i += i&-i) {
      d[i] += x;
    }
  }
  T sum(int i) {
    T x = 0;
    for (i++; i; i -= i&-i) {
      x += d[i];
    }
    return x;
  }
};

int main(){
    int n, d, a;
    std::cin >> n >> d >> a;
    std::vector<P> p(n);
    for(int i = 0; i < n; i++) std::cin >> p[i].first >> p[i].second;
    std::sort(p.begin(), p.end());

    ll ans = 0;
    BIT<ll> bit(n + 1); // これまでのダメージを補正する
    for(int i = 0; i < n; i++){
        ll x = p[i].first;
        ll h = p[i].second;
        h -= bit.sum(i);
        
        if(h <= 0) continue;
        ll num = (h + a - 1) / a;
        ans += num;
        ll damage = num * a;
        bit.add(i, damage); // これで今いるところ含め右端にダメージを与える
        int rx = std::min(x + 2 * d, 1001001001ll); // ダメージをくらう右端
        int j = std::upper_bound(p.begin(), p.end(), P(rx + 1, -1)) - p.begin(); // 今回のダメージを食らわない左端
        bit.add(j, -damage); // 食らっていないぶん補正する
    }

    std::cout << ans << std::endl;

    return 0;
}

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

using namespace std;

#define INF 100000000
#define YJ 1145141919
#define INF_INT_MAX 2147483647
#define INF_LL 9223372036854775
#define INF_LL_MAX 9223372036854775807
#define EPS 1e-10
#define MOD 1000000007
#define MOD9 998244353
#define Pi acos(-1)
#define LL long long
#define ULL unsigned long long
#define LD long double

#define int long long

using II = pair<int, int>;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(a)  begin((a)), end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())

int A, B, C, D;

int gcd(int a, int b) {
  return b != 0 ? gcd(b, a % b) : a;
}
int lcm(int a, int b) {
  return a * b / gcd(a, b);
}
// a x + b y = gcd(a, b)
int extgcd(int a, int b, int &x, int &y) {
  int g = a; x = 1; y = 0;
  if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x;
  return g;
}

signed main()
{
  cin >> A >> B >> C >> D;

  int ac = (A-1)/C;
  int bc = B/C;

  int ad = (A-1)/D;
  int bd = B/D;

  int cdlcm = lcm(C,D);

  int acd = (A-1)/cdlcm;
  int bcd = B/cdlcm;

  cout << (B-A+1) - ((bc-ac) + (bd-ad) - (bcd-acd)) << endl;

  return 0;
}

Measured memory_bytes: 256
n, k, s = map(int, input().split())
s_len = n - k + 1
result = []

if k == 0:
    if not s == pow(10, 9):
        for _ in range(n):
            result.append(s+1)
    else:
        for _ in range(n):
            result.append(1)

elif (n-k+1) <= s:
    shou, amari = divmod(s, n-k+1)
    for i in range(s_len):
        if i < amari:
            result.append(shou+1)
        else:
            result.append(shou)
    for i in range(s_len, n):
        result.append(result[i-s_len])
else:
    for _ in range(s):
        result.append(1)
    count = 1
    for i in range(s, n):
        if count < k:
            result.append(result[i-s])
            count += 1
        else:
            result.append(pow(10, 9))

print(' '.join(map(str, result)))

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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
//#define int long long int
const int MOD = 1000000007;
const ll LINF = (ll)1e18 - 1;
const int INF = 1e9 - 1;
const double EPS = 0.000000001;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

void print(const vector<int> &v) {
  for(auto x : v) {
    cout << x << " ";
  }
  cout << endl;
}

signed main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, C;
  cin >> n >> C;
  VVI d(C, VI(C));
  VVI c(n, VI(n));
  VVI a(3, VI(C, 0));
  rep(i, C) rep(j, C) cin >> d[i][j];
  rep(i, n) rep(j, n) cin >> c[i][j];
  rep(i, n) rep(j, n) a[(i+j)%3][c[i][j]-1]++;
  ll ans = LINF;
  rep(i, C) rep(j, C) rep(k, C) {
    ll sum = 0;
    if(i == j || j == k || i == k) continue;
    rep(p, C) {
      sum += d[p][i] * a[0][p];
      sum += d[p][j] * a[1][p];
      sum += d[p][k] * a[2][p];
    }
    ans = min(ans, sum);
  }

  out(ans);

  return 0;
}


Measured memory_bytes: 1280