akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;
public class Main {
	static int x, y; //x...0 y...1
	static int ans, width, height;
	static int memory[] = new int[2]; //一時的に訪れる都市を格納
	static int diff_x = 0, diff_y = 0;
	
	//斜め上に進む必要性があるか
	static boolean UpTiltDirectionExists(int tox, int toy) {
		return(((x != width && y != height)) && (tox >= (x + 1) && toy >= (y + 1)));
	}
	
	//斜め下に進む必要性があるか
	static boolean DownTiltDirectionExists(int tox, int toy) {
		return(((x != 1 && y != 1)) && (tox <= (x - 1) && toy <= (y - 1)));
	}
	
	static void PlusTiltDirectionMove() {
		x++;
		y++;
		ans++;
	}
	
	static void MinusTiltDirectionMove() {
		x--;
		y--;
		ans++;
	}
	
	static void GoToNorthWest() {
		x--;
		y++;
		ans += 2;
	}
	
	static void GoToSouthEast() {
		x++;
		y--;
		ans += 2;
	}
	
	static void LengthOrBreathMove() {
		 if(x == memory[0]) {
			y = (diff_y > 0) ? (y + 1) : (y - 1);
			ans++;
		} else if(y == memory[1]) {
			x = (diff_x > 0) ? (x + 1) : (x - 1);
			ans++;
		}
	}
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner stdIn = new Scanner(System.in);
		
		width = stdIn.nextInt(); //都市の幅
		height = stdIn.nextInt(); //都市の高さ
		int visit_num = stdIn.nextInt(); //訪れる都市の数
		for(int r = 0; r < visit_num; r++) {
			if(r == 0) {
				x = stdIn.nextInt(); //初期x座標
				y = stdIn.nextInt(); //初期y座標
			} else {
				for(int c = 0; c < 2; c++)
					memory[c] = stdIn.nextInt();
				diff_x = memory[0] - x; //x座標の差を求める
				diff_y = memory[1] - y; //y座標の差を求める
				if(diff_x == 0 && diff_y == 0) continue; //既に到達しているなら処理しなくてよい
				
				while(x != memory[0] || y != memory[1]) {
					diff_x = memory[0] - x; //x座標の差を更新
					diff_y = memory[1] - y; //y座標の差を更新
					if(memory[0] >= x && memory[1] >= y) {
						if(UpTiltDirectionExists(memory[0], memory[1])) {
							PlusTiltDirectionMove(); //右上へ移動
						} else {
							LengthOrBreathMove();
						}
					} else if(memory[0] >= x) {
						LengthOrBreathMove();
						if(x != memory[0] && y != memory[1])
							GoToSouthEast(); //南東へ移動
					} else if(memory[1] >= y) {
						LengthOrBreathMove();
						if(x != memory[0] && y != memory[1])
							GoToNorthWest(); //北西へ移動
					} else if(DownTiltDirectionExists(memory[0], memory[1])) {
						MinusTiltDirectionMove(); //左下へ移動
					}
					
				}
			}
		}
		System.out.println(ans);
	}
}
		

Measured memory_bytes: 25428
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<ll> vll;
#define rep(i, a, n) for (int i = a; i < n; i++)
#define per(i, a, n) for (int i = n - 1; i >= a; i--)
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define sz(x) ((int)(x).size())
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define INF 1000000000
#define MOD 1000000007

void solve() {
    int n;
    cin >> n;
    vi a(n);
    rep(i,1,n) {
        int tmp;
        cin >> tmp;
        a[tmp-1]++;
    }
    rep(i,0,n) cout << a[i] << "\n";
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    int t = 1;
    // cin >> t;
    while (t--)
        solve();
    return 0;
}


Measured memory_bytes: 3944
using System;


    class MainClass
    {
    public static void Main(string[] args)
    {
        string[] input = Console.ReadLine().Split(' ');

        int S = int.Parse(input[0]);

        int W = int.Parse(input[1]);

        string result;

        if (S <= W)
        {
            Console.WriteLine("unsafe");

        }
        else
        {
            Console.WriteLine("safe");
        }      
       
    }
}


Measured memory_bytes: 17828
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,pprint,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

h,w,k = inpl()
s = [input() for i in range(h)]
res = [[0]*w for i in range(h)]
cnt = 0
bb = set()
for y in range(h):
    if s[y].count('#') == 0: 
        bb.add(y); continue
    fg = False
    for x in range(w):
        if s[y][x] == '.':
            if fg:
                res[y][x] = cnt
        else:
            fg = True
            cnt += 1
            res[y][x] = cnt
for y in range(h):
    if y in bb: continue
    for x in range(w)[::-1]:
        if res[y][x]: continue
        res[y][x] = res[y][x+1]

for x in range(w):
    for y in range(h-1):
        if not y+1 in bb: continue
        res[y+1][x] = res[y][x]

for x in range(w):
    for y in range(h-1)[::-1]:
        if not y in bb: continue
        res[y][x] = res[y+1][x]

for i in res:
    print(*i)

Measured memory_bytes: 72536
// Copyright lzt
#include<stdio.h>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#include<iostream>
#include<queue>
#include<string>
#include<ctime>
using namespace std;
typedef long long ll;
typedef std::pair<int, int> pii;
typedef long double ld;
typedef unsigned long long ull;
typedef std::pair<long long, long long> pll;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i, j, k)  for (register int i = (int)(j); i <= (int)(k); i++)
#define rrep(i, j, k) for (register int i = (int)(j); i >= (int)(k); i--)
#define Debug(...) fprintf(stderr, __VA_ARGS__)

inline ll read() {
  ll x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch <= '9' && ch >= '0') {
    x = 10 * x + ch - '0';
    ch = getchar();
  }
  return x * f;
}

const int maxn = 110;
const int maxw = 100100;
int n, w;
int W[maxn], V[maxn];
ll f[2][maxw];

void work() {
  n = read(), w = read();
  rep(i, 1, n) W[i] = read(), V[i] = read();
  int o = 1;
  rep(i, 1, n) {
    rep(j, 1, w) {
      if (j < W[i]) f[o][j] = f[o ^ 1][j];
      else f[o][j] = max(f[o ^ 1][j], f[o ^ 1][j - W[i]] + V[i]);
    }
    o ^= 1;
    memset(f[o], 0, sizeof(f[o]));
  }
  o ^= 1;
  ll ans = 0;
  rep(i, 1, w) ans = max(ans, f[o][i]);
  printf("%lld\n", ans);
}

int main() {
  #ifdef LZT
    freopen("in", "r", stdin);
  #endif

  work();

  #ifdef LZT
    Debug("My Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
  #endif
}


Measured memory_bytes: 1792
#include <iostream>
#include <queue>
#include <utility>
#include <vector>

using namespace std;
struct Edge {
    int to;
    long long cost;
};

using Graph = vector<vector<Edge>>;
using Pli = pair<long long, int>;

vector<long long> dijkstra(const Graph &G, int s) {
    int N = G.size();
    vector<long long> dist(N, 1LL << 60);
    priority_queue<Pli, vector<Pli>, greater<Pli>> q;
    dist[s] = 0;
    q.emplace(dist[s], s);
    while (!q.empty()) {
        auto p = q.top();
        q.pop();
        int v = p.second;
        if (dist[v] < p.first) continue;
        for (auto &e : G[v]) {
            if (dist[e.to] <= dist[v] + e.cost) continue;
            dist[e.to] = dist[v] + e.cost;
            q.emplace(dist[e.to], e.to);
        }
    }
    return dist;
}

int main() {
    int V, E, r;
    cin >> V >> E >> r;
    Graph g = Graph(V, vector<Edge>());
    for (int i = 0; i < E; i++) {
        int s, t, d;
        cin >> s >> t >> d;
        g[s].emplace_back(Edge{t, d});
    }

    auto res = dijkstra(g, r);

    for (auto x : res) {
        cout << (x == (1LL << 60) ? "INF" : to_string(x)) << endl;
    }
}


Measured memory_bytes: 19360
N = int(input())
A = list(map(int, input().split()))
A = sorted([(a, p) for p, a in enumerate(A)], reverse=True)
dp = [[0]*(i+1) for i in range(N+1)]
for z in range(N):
    for y in range(z+1):
        dp[z+1][y] = max(A[z][0]*(A[z][1]-(z-y))+dp[z][y],dp[z+1][y])
        dp[z+1][y+1]= A[z][0]*((N-y-1)-A[z][1])+dp[z][y]
print(max(dp[-1]))

Measured memory_bytes: 79072
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())
    AB = [list(map(int, input().split())) for _ in range(n)]
    for i in range(n):
        a, b = AB[i]
        AB[i] = [a + b, a, b]
    AB.sort(key=lambda x: x[0], reverse=True)

    score_t = sum(AB[i][1] for i in range(n) if i % 2 == 0)
    score_a = sum(AB[i][2] for i in range(n) if i % 2 != 0)

    print(score_t - score_a)


if __name__ == '__main__':
    resolve()


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

using namespace std;

using i64 = int_fast64_t;

template <class T>
using akari = vector<T>;
template <class T>
using yukari = vector<akari<T>>;
using seika = string;

void solve()
{
    int n;
    cin >> n;
    yukari<int> g(n);
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++)
        {
            char x;
            cin >> x;
            if (x == '1')
            {
                g[i].push_back(j);
            }
        }
    auto dfs = [&](auto dfs, akari<int> &dis, int v, int p = -1) -> void {
        for (int nv : g[v])
        {
            if (nv != p)
            {
                //cout << v << ' ' << nv << ' ' << dis[nv] << endl;
                if (dis[nv] != -1)
                {
                    if (dis[nv] % 2 == dis[v] % 2)
                    {
                        cout << -1 << endl;
                        exit(0);
                    }
                    else
                    {
                        continue;
                    }
                }
                dis[nv] = dis[v] + 1;
                dfs(dfs, dis, nv, v);
            }
        }
    };
    akari<int> dis(n, -1);
    dis[0] = 0;
    dfs(dfs, dis, 0);
    int ans = 0;
    for (int s = 0; s < n; s++)
    {
        queue<int> q;
        q.push(s);
        fill(dis.begin(), dis.end(), -1);
        dis[s] = 1;
        while (!q.empty())
        {
            int v = q.front();
            q.pop();
            for (int nv : g[v])
            {
                if (dis[nv] == -1)
                {
                    dis[nv] = dis[v] + 1;
                    q.push(nv);
                }
            }
        }
        ans = max(ans, *max_element(dis.begin(), dis.end()));
    }
    cout << ans << endl;
}

int main()
{
    solve();
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <future>
const long long MOD = 1000000007;
const int INF = INT_MAX / 2;
const long double PI = 3.1415926;
using namespace std;
#define FOR(i, r, n) for(int i=(ll)(r); i<(ll)(n); i++) 
#define REP(i, n) FOR(i, (0), n)
#define ALL(r) r.begin(), r.end()
#define ll long long int
typedef vector<ll> vi;
typedef vector<string> vs;
typedef vector<pair<ll, ll>> vp;
typedef vector<tuple<ll, ll, ll>> vt;
//vector<vector<ll>> vv(n, vector<ll>(n));

int main()
{
	ll n, a;
	cin >> n >> a;
	cout << n*n - a << endl;
}

Measured memory_bytes: 768
#include <stdio.h>
#include <set>
#include <queue>
#include <iostream>
#include <algorithm>
#include <map>
#include <vector> 

#define LL long long
using namespace std;


int main()
{
    LL int x,y;
    cin>>x>>y;
    if (y>=x)
    cout<<0<<endl;
    else
    cout<<x-y<<endl;
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define LB(a,x) lb(all(a),x)-a.begin()
#define UB(a,x) ub(all(a),x)-a.begin()
#define mod 1000000007
//#define mod 998244353
#define FS fixed<<setprecision(15)
using namespace std;
typedef long long ll;
const double pi=3.141592653589793;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
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; }
template<class T> inline void out(T a){ cout << a << '\n'; }
void YN(bool ok){if(ok) cout << "Yes" << endl; else cout << "No" << endl;}
//void YN(bool ok){if(ok) cout << "YES" << endl; else cout << "NO" << endl;}


const ll INF=1e18;
const int mx=200005;

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    ll n;
    cin>>n;
    V<V<ll>> G(n);
    ll edge[55][55];
    rep(i,n-1){
        ll a,b;
        cin>>a>>b;
        a--;
        b--;
        edge[a][b]=i;
        edge[b][a]=i;
        G[a].pb(b);
        G[b].pb(a);
    }
    ll m;
    cin>>m;
    V<V<ll>> con(m);
    rep(i,m){
        ll u,v;
        cin>>u>>v;
        u--;v--;
        V<ll> d(n,-1);
        queue<ll> que;
        d[u]=0;
        que.push(u);
        V<ll> pr(n,-1);
        while(que.size()){
            ll cur=que.front();
            que.pop();
            for(ll nv:G[cur]){
                if(d[nv]!=-1) continue;
                d[nv]=d[cur]+1;
                que.push(nv);
                pr[nv]=cur;
            }
        }
        for(;pr[v]!=-1;v=pr[v]){
            con[i].pb(edge[v][pr[v]]);
        }
    }
    ll ans=0;
    ll c[55];
    c[0]=1;
    for(int i=1;i<=50;i++) c[i]=c[i-1]*2;
    for(int i=1;i<(1<<m);i++){
        ll cnt=0;
        V<ll> ok(n-1,0);
        for(int j=0;j<m;j++){
            if(i>>j&1){
                cnt++;
                for(ll k:con[j]) ok[k]++;
            }
        }
        ll tmp=0;
        rep(j,n-1){
            if(ok[j]>0) tmp++;
        }
        if(cnt%2==1){
            ans+=c[n-1-tmp];
        }else{
            ans-=c[n-1-tmp];
        }
    }
    ans=c[n-1]-ans;
    out(ans);
}

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

using namespace std; 

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

  long long int L[n];
  
  long long int cnt=0;
  for(int i=0; i<n; i++) cin>>L[i];

  for(int i=2; i<n; i++){
    for(int j=1; j<i; j++){
      for(int r=0; r<j; r++){
        if(L[i]!=L[j] and L[i]!=L[r] and L[r]!=L[j]){
          if(L[i]<L[j]+L[r] and L[j]<L[i]+L[r] and L[r]<L[i]+L[j]){
            cnt++;
          }
        }
      }
    }
  }

  cout<<cnt<<endl;
}


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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;

#define INF INT_MAX/3

#define MAX_N 1000

int n;
int a[111];
int b[111];

int main(){
	cin.sync_with_stdio(false);
	cin>>n;
	int D=0;
	rep(i,n){
		cin>>a[i];
		maxch(D,a[i]);
	}
	int R;
	if(D%2==0)R=D/2;
	else R=(D+1)/2;
	rep(i,n)b[a[i]]++;
	bool ok=true;
	repl(i,1,D+1){
		if(i<R&&b[i]>0){
			ok=false;
		}else if(i==R){
			if(D%2==0)b[R]--;
			else b[R]-=2;
			if(b[R]<0)ok=false;
		}else if(i>R){
			b[i]-=2;
			if(b[i]<0)ok=false;
		}
	}
	if(b[R]!=0)ok=false;
	if(!ok)cout<<"Impossible"<<endl;
	else cout<<"Possible"<<endl;
	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <functional>
#include <algorithm>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <typeinfo>
#include <functional>
#include <iomanip>
#include <string.h>
#define _USE_MATH_DEFINES
#include <math.h>
using namespace std;
typedef long long ll;

ll A[200000];

int main()
{
	ll N;
	cin >> N;
	ll last = 0;
	for (int i = 0; i < N; i++)
	{
		cin >> A[i];
		last += A[i];
	}

	//sort(A, A + N);
	ll mid = last / 2;
	ll sum = 0;
	ll kai = 0;

	ll mae1 = 0;
	ll mae2 = 0;
	ll usiro1 = 0;
	ll usiro2 = 0;
	for (int i = 0; i < N; i++)
	{
		//越えた.
		if (0 > mid - (sum + A[i]))
		{

			//先かあとかどっちが近いか.
			//if (llabs(mid - sum) > llabs(mid - (sum + A[i])))
			{
				mae1 = sum + A[i];
				usiro1 = last - mae1;
			}
			//else
			{
				mae2 = sum;
				usiro2 = last - mae2;
			}

			if (llabs(usiro1 - mae1) > llabs(usiro2 - mae2))
			{
				kai = llabs(usiro2 - mae2);
			}
			else
			{
				kai = llabs(usiro1 - mae1);
			}

			break;
		}
		sum += A[i];
	}

	//if ((last - kai) % 2 == 1)
	//{
	//	kai += 1;
	//}

	cout << kai << endl;


	return 0;
}

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


/* エイリアス */
#define ll long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define endl '\n'

#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define em emplace


/* 関数マクロ */
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep2(i, n, m) for (ll i = n; i <= m; ++i)
#define rep3(i, n, m) for (ll i = n; i >= m; --i)
#define all(v) v.begin(), v.end()
#define si(v) int(v.size())
#define UNIQUE(v) sort(all(v)), v.erase(unique(all(v)),v.end())


/* 定数 */
const ll mod = 1e9 + 7;
const ll infll = (1LL << 62) - 1;
const ll inf = (1LL << 30) - 1;


/* その他 */
template<class S, class T> inline bool chmax(S &a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class S, class T> inline bool chmin(S &a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> using pq = priority_queue<T>;
template<class T> using pqg = priority_queue<T, vector<T>, greater<T>>;


signed main()
{
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);
  
  int a, b; cin >> a >> b;
  if (a + b == 15) cout << "+" << endl;
  else if (a * b == 15) cout << "*" << endl;
  else cout << "x" << endl;
}

Measured memory_bytes: 3592
#include <cstdio>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <vector>
 
using namespace std;
#define PB push_back
#define MP make_pair
#define REP(i,n) for(int i=0;i<(n);i++)
int main(){
    int n,a;
    int mi=1e9;
    int cnt=0;
    cin>>n;
    REP(i,n){
        cin>>a;
        if(a<=mi){
            cnt++;
            mi=a;
        }
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;

import static java.lang.System.in;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        if(!isPalindrome(s.replace("x",""))){
            System.out.println(-1);
            System.exit(0);
        }
        ArrayList<Integer> rec = new ArrayList<>();
        int n = s.length();
        for(int i=0;i<n;i++){
            if(s.charAt(i)!='x') rec.add(i);
        }

        long ans = 0;
        if(rec.size()!=0){
            ans += Math.abs(n-1-rec.get(rec.size()-1)-rec.get(0));
            int flag = 1-rec.size()%2;
            for(int i=0;i<rec.size()/2-flag;i++){
                int left = rec.get(i+1)-rec.get(i);
                int right = rec.get(rec.size()-1-i)-rec.get(rec.size()-2-i);
                ans += Math.abs(left-right);
            }
        }
        System.out.println(ans);
    }
    static boolean isPalindrome(String s){
        if(s.length()==0) return true;
        int n = s.length();
        for(int i=0;i<n;i++){
            if(s.charAt(i)!=s.charAt(n-1-i)) return false;
        }
        return true;
    }
}


Measured memory_bytes: 34844
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <cmath>
#include <iomanip>
#include <climits>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>
#include <new>
#include <typeinfo>
#include <iterator>
#include <cassert>

using ll = long long;
using ull = unsigned long long;
constexpr ll mop = 1000000007;
constexpr ll mop2 = 998244353;

using namespace std;

constexpr ll NOT_SPECIFIED_VALUE_MIN = INT64_MIN;
constexpr ll NOT_SPECIFIED_VALUE_MAX = INT64_MAX;


int main()
{

	ll d, t, s;
	cin >> d >> t >> s;
	if( d > t * s )
	{
		cout << "No" << endl;
	}
	else
	{
		cout << "Yes" << endl;
	}


}


Measured memory_bytes: 3640
// 20200118

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

int main() {
    ll n;
    ll ans = 1;
    ll pos = 0;
    cin >> n;
    vector <pair<ll, ll>> xl(n);
    for(ll i = 0; i < n; ++i) {
        ll x, l;
        cin >> x >> l;
        xl[i].first = x + l;
        xl[i].second = x - l;
    }
    sort(xl.begin(), xl.end());
    pos = xl[0].first;
    for (ll i = 1; i < n; ++i) {
        if (pos <= xl[i].second) {
            ans++;
            pos = xl[i].first;
        }        
    }
    cout << ans << endl;
    return 0;
}


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

// template {{{  0 
// using {{{ 1
using ll = long long int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
// }}} 1
// definition {{{ 1
// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%lld", &x)
#define Scll2(x,y) scanf("%lld%lld", &x, &y)
#define Scll3(x,y,z) scanf("%lld%lld%lld", &x, &y, &z)
#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2
// constants {{{ 2
#define EPS (1e-7)
#define INF (2e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Repe(x,y,z) for(ll x = z; x < y; x++)
#define Rep(x,y) Repe(x,y,0)
#define RRepe(x,y,z) for(ll x = y-z-1; x >= 0; x--)
#define RRep(x,y) RRepe(x,y,0)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n")
#define YESNO(a) (a)?printf("YES\n"):printf("NO\n")
// }}} 2
// }}} 1
// input {{{ 1
// }}} 1
// }}} 0

int main() {

    int N;
    Scd(N);

    vii a(N*2);
    vector<vi> loc(2,vi(N+1,-1));
    vector<vector<vi>> sum(2,vector<vi>(N+1,vi(N*2+1,0)));
    char s[12];
    int x;
    Rep(i,N*2){
        Scs(s);
        Scd(x);
        a[i] = { s[0]=='B', x };
        loc[s[0]=='B'][x] = i;
        sum[s[0]=='B'][x][i+1] = 1;
    }

    Rep(xi,N+1) Rep(ni,N*2){
        sum[0][xi][ni+1] += sum[0][xi][ni];
        sum[1][xi][ni+1] += sum[1][xi][ni];
    }
    Rep(xi,N) Rep(ni,N*2+1){
        sum[0][xi+1][ni] += sum[0][xi][ni];
        sum[1][xi+1][ni] += sum[1][xi][ni];
    }


    vector<vi> dp(N+1,vi(N+1,INF));
    dp[0][0] = 0;

    auto cost = [&]( int bi, int wi, int bl ){
        int ni = loc[bl][(bl?bi:wi)+1];
        int del = sum[0][wi][ni] + sum[1][bi][ni];
        return ni - del;
    };

    Rep(ni,N*2){
        Rep(bi,N+1){
            int wi = ni-bi;
            if( wi > N ) continue;
            if( wi < 0 ) break;
            if( bi != N ){
                dp[bi+1][wi] = min( dp[bi+1][wi],
                        dp[bi][wi] + cost(bi,wi,1) );
            }
            if( wi != N ){
                dp[bi][wi+1] = min( dp[bi][wi+1],
                        dp[bi][wi] + cost(bi,wi,0) );
            }
        }
    }

    printf ("%d\n", dp[N][N] );

    return 0;
}



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

int main() {
  ll N;
  cin >> N;
  ll result = 0;
  for (ll i = 1; i <= N; ++i) {
    if (i % 3 != 0 && i % 5 != 0) {
      result += i;
    }
  }
  cout << result << endl;
}

Measured memory_bytes: 3636
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<utility>
#define neko 200010
#define f(i,a,b) for(register int i=(a);i<=(b);i=-(~(i)))
#define rf(i,a,b) for(register int i=(a);i>=(b);i=~(-(i)))
int n,a[neko],stk[neko],pre[neko],tp;
typedef long long ll;
ll ans;
int main()
{
	scanf("%d",&n);
	f(i,1,n)scanf("%d",&a[i]);
	f(i,1,n)
	{
		while(tp&&a[stk[tp]]>a[i])--tp;
		pre[i]=stk[tp];
		stk[++tp]=i;
	}tp=0;
	rf(i,n,1)
	{
		while(tp&&a[stk[tp]]>a[i])--tp;
		ans+=(ll)(i-pre[i])*((tp?stk[tp]:n+1)-i)*a[i];
		stk[++tp]=i;
	}
	return printf("%lld\n",ans),0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int N, K;
    cin >> N >> K;
    
    vector<int> x(N);
    for(int i = 0; i < N; ++i){
        cin >> x[i];
    }
    
    
    int max_num;
    int min_num;
    int time;
    int ans = 2 * (x[N-1] - x[0]);
    
    for(int i = 0; i <= N - K; ++i){
        
        max_num = i + K - 1;
        min_num = i;
        
        if(x[max_num] <= 0){
            time = - x[min_num];
        } else if(x[min_num] >= 0){
            time = x[max_num];
        } else {
            time = - x[min_num] + x[max_num] + min( - x[min_num], x[max_num]);
        }
        
        if(time < ans){
            ans = time;
        }
    }
    
    cout << ans << endl;
    
}

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

int main(){
	string s;
	cin >> s;
	int n = s.length();
	int ans1=0, ans2=2;
	for(int i=0; i<n; i++){
		int j = s[i] - '0';
		int tmp1 = min(ans1+j, ans2+j);
		int tmp2 = min(ans1+11-j, ans2+9-j);
		ans1 = tmp1;
		ans2 = tmp2;
	}
	cout << min(ans1, ans2) << endl;
	return 0;
}

Measured memory_bytes: 1412
#include<iostream>
#include<vector>
#define int_INF 2147483647
using namespace std;

int main() {
	int N, K;
	cin >> N >> K;
	vector<int> Hs(N);
	for (int i = 0; i < N; i++) {
		cin >> Hs[i];
	}
	vector<int> dp(N); //1 origin
	dp[1] = 0;
	for (int i = 1; i < N; i++) {
		int min = int_INF;
		for (int j = 1; j <= K and i - j >= 0; j++) {
			int temp = dp[i - j] + abs(Hs[i] - Hs[i-j]);
			temp < min ? min = temp : 1;
		}
		dp[i] = min;

	}

	cout << dp[N - 1] << endl;
}


Measured memory_bytes: 1024
def main():
  M=10**9+7
  r1,c1,r2,c2=map(int,input().split())
  n=r2+c2+2
  fac=[0]*(n+1)
  fac[0]=before=1
  for i in range(1,n+1):fac[i]=before=before*i%M
  f=lambda r,c:fac[r+c+2]*pow(fac[c+1],M-2,M)*pow(fac[r+1],M-2,M)-c-r-2
  print((f(r2,c2)-f(r2,c1-1)-f(r1-1,c2)+f(r1-1,c1-1))%M)
main()

Measured memory_bytes: 82164
import sys

# sys.stdin = open("d1.in")

n = int(input())
s = input()

c = 0
m = 0
M = 0

for l in s:
    if l == '(':
        c += 1
    if l == ')':
        c -= 1
    if m > c:
        m = c
    if M < c:
        M = c

left = '(' * (-m)
c += -m
right = ')' * c
res = left + s + right
print(res)


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

#define debug(x) cout <<"DEBUG"<<" "<< #x << ":" << x << '\n'

// n回繰り返し
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順
#define rep1(i,n) for(int i = 1; i <= ((int)(n)); i++) // 1-indexed昇順
#define rrep(i,n) for(int i = ((int)(n)-1); i >= 0; i--)  // 0-indexed降順
#define rrep1(i,n) for(int i = ((int)(n)); i >= 1; i--)   // 1-indexed降順
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii;  // 2次元配列
typedef vector<ll> vll;
typedef vector<double> vd;
typedef pair<int, int> PII;

template<typename T>
using vec = vector<T>;
template<class T>
using maxheap = std::priority_queue<T>;
template<class T>
using minheap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

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

const ld Pi = std::acos(-1.0L);
const ll infll = (1LL<<62)-1;
const int inf = (1<<30)-1;
const int mod = 1000000007;
// const int mod = 998244353;


/*FUNCs=================================================*/


/*MAIN==================================================*/
signed main(){
    int _StartTime_ = clock();
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化
    // cout << fixed << setprecision(15);

    string s; cin >> s;
    int cnt = 0, ans = 0;
    for(int i = 0; i < s.size(); ++i) {
        if(!(s[i] == 'A' || s[i]=='T'||s[i]=='C'||s[i]=='G')) {
            chmax(ans, cnt);
            cnt = 0;
            continue;
        }
        cnt++;
    }
    chmax(ans,cnt);
    cout << ans << '\n';

    // printf("ExcutionTime: %d /ms\n",1000*(int)((clock()-_StartTime_)/CLOCKS_PER_SEC));
}

Measured memory_bytes: 256
fun main(args: Array<String>) = println(run {
    val n = readLine()!!.toInt()
    val p = readLine()!!.split(" ").map { it.toInt() }

    var min = n+1
    var count = 0
    p.forEach {
        if (it < min) {
            count++
            min = it
        }
    }
    count
})

Measured memory_bytes: 82852
#include <stdio.h>

int main(){
  int x, y, z;
  int min, max, mid;
  scanf("%d%d%d", &x, &y, &z);
  if(x < y && x < z){
    min = x;
    if(y < z){
      mid = y;
      max = z;
    }
    else{
      mid = z;
      max = y;
    }
  }
  else if(y < x && y < z){
    min = y;
    if(x < z){
      mid = x;
      max = z;
    }
    else{
      mid = z;
      max = x;
    }
  }
  else{
    min = z;
    if(x < y){
      mid = x;
      max = y;
    }
    else{
      mid = y;
      max = x;
    }
  }
  printf("%d %d %d\n", min, mid, max);
}



Measured memory_bytes: 2708
int main(void)
{
 int a = 0;
 int b = 0;
   
 scanf("%d %d",&a,&b);
 if(a<b){
 printf("a < b\n");
 }else if(b<a){
 printf("a > b\n");
 }else if(a==b){
 printf("a == b\n");
 }
 return 0;
}

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

using namespace std;
int N;
int a_count[100001];
int ans;
int main() {
  cin >> N;

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

  for(int i = 0; i < 100001; i++) {
    if(a_count[i] > 0) {
      if(a_count[i] % 2 == 0) a_count[i] = 2;
      else a_count[i] = 1;
    }
  }
  int tmp = 0;
  for(int i = 0; i < 100001; i++) if(a_count[i] == 2) tmp++;

  for(int i = 0; i < 100001; i++) if(a_count[i] > 0) ans++;

  if(tmp % 2 == 1) ans--;

  cout << ans << endl;
}
  
  


Measured memory_bytes: 640
import sys
from collections import deque

input = sys.stdin.readline
n, m = map(int, input().split())

E = [[] for i in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    E[a-1].append(b-1)
    E[b-1].append(a-1)

def bfs(cur, pre, d):
    stack = deque([[cur, pre, d]])
    while stack:
        cur, pre, d = stack.popleft()
        if cur == n-1:
            return True
        for e in E[cur]:
            if e != pre and d < 2:
                stack.append([e, cur, d+1])
    return False

if bfs(0, -1, 0):
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')


Measured memory_bytes: 48308
c = []
for i in range(3):
    c.append(list(map(int, input().split())))
a = [0,0,0]
b = [0,0,0]
for i in range(3):
    b[i] = c[i][0] - 0
for i in range(3):
    a[i] = c[0][i] - b[0]
for i in range(3):
    for j in range(3):
        if a[j] + b[i] != c[i][j]:
            print("No")
            exit()
print("Yes")

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

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

    if (A<B) {
        if (A < C && C < B) {
            cout << "Yes" << endl;
        }

        else {
            cout << "No" << endl;
        }
    }

    if (A>B) {
        if (B < C && C < A) {
            cout << "Yes" << endl;
        }
        else {
            cout << "No" << endl;
        }
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
 
struct point{
  ll x,y;
};
 
ll w,h,v,t,x,y,p,q;
ll R,H,W;
point o,O;
 
point calc(ll X,ll Y){
  ll dx=abs(X-O.x),dy=abs(Y-O.y);
  point res;
 
  if(dx%2==0)res.x=p;
  else res.x=w-p;
 
  if(dy%2==0)res.y=q;
  else res.y=h-q;
 
  res.x+=X*w;
  res.y+=Y*h;
  return res;
}
 
ll search(ll Y){
  ll l=0,r=W,m;
  while(l<r){
    m=(l+r)/2;
    point d=calc(m,Y);
    ll dist= (d.x-o.x)*(d.x-o.x) + (d.y-o.y)*(d.y-o.y);
    if( dist <= v*t*v*t  || o.x< d.x ){
      r=m;
    }else{
      l=m+1;
    }
  }
  return l;
}
 
ll search2(ll Y){
  ll l=0,r=W,m;
  while(l<r){
    m=(l+r)/2;
    point d=calc(m,Y);
    ll dist= (d.x-o.x)*(d.x-o.x) + (d.y-o.y)*(d.y-o.y);
    if( dist <= v*t*v*t || d.x < o.x ){
      l=m+1;
    }else{
      r=m;
    }
  }
  return l;
}
 
int main(){
  cin>>w>>h>>v>>t>>x>>y>>p>>q;
  R=v*t;
  W=(v*t/w+1LL)*4;
  H=(v*t/h+1LL)*4;
  O.x=W/2;
  O.y=H/2;
  o.x=O.x*w+x;
  o.y=O.y*h+y;
 
 
 
  ll ans=0;
  for(ll i=0;i<=H;i++){
    ll a=search(i);
    ll b=search2(i);
    point d=calc(a,i);
    ll dist= (d.x-o.x)*(d.x-o.x) + (d.y-o.y)*(d.y-o.y);
    d=calc(b,i);
    ll dist2= (d.x-o.x)*(d.x-o.x) + (d.y-o.y)*(d.y-o.y);
    d=calc(b-1,i);
    ll dist3= (d.x-o.x)*(d.x-o.x) + (d.y-o.y)*(d.y-o.y);
    d=calc(a-1,i);
    ll dist4= (d.x-o.x)*(d.x-o.x) + (d.y-o.y)*(d.y-o.y);
 
    if(dist <= v*t*v*t && v*t*v*t<dist2)
      if(dist3 <= v*t*v*t &&v*t*v*t<dist4)
    ans+=(b-a);
     
  }
  cout<<ans<<endl;
  return 0;
}

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

int main() {
  int N, M; cin >> N >> M;
  vector<int> vec(N, 0);
  for(int i = 0; i < M; i++) {
    int a, b; cin >> a >> b; a--, b--;
    vec[a]++, vec[b]++;
  }
  for(int i = 0; i < N; i++) {
    if(vec[i]%2==1) {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  return 0;
}


Measured memory_bytes: 768
#include <iostream>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <bitset>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <iomanip>
#include <stdio.h>
#include <string.h>
#include <random>
#include <functional>

using std::cin;
using std::cout;
using std::cerr;
using std::endl;

using std::map;
using std::set;
using std::bitset;
using std::vector;
using std::string;
using std::multimap;
using std::multiset;
using std::deque;
using std::queue;
using std::stack;
using std::pair;
using std::iterator;

using std::sort;
using std::stable_sort;
using std::reverse;
using std::max_element;
using std::min_element;
using std::unique;
using std::ios_base;
using std::swap;
using std::fill;

using std::setprecision;
using std::fixed;

long long min(long long a, long long b) {return a < b ? a : b;}
long long min(int a, long long b) {return a < b ? a : b;}
long long min(long long a, int b) {return a < b ? a : b;}
long long min(int a, int b) {return a < b ? a : b;}

long long max(long long a, long long b) {return a > b ? a : b;}
long long max(int a, long long b) {return a > b ? a : b;}
long long max(long long a, int b) {return a > b ? a : b;}
long long max(int a, int b) {return a > b ? a : b;}

#define int long long

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef string S;

#define F(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define fi first
#define se second
#define re return
#define all(x) (x).begin(), (x).end()

const long long INF = 1e18;
const int N = 2101;
const int MOD = 998244353;
const double eps = 1e-8;

ll n, k;
ll a[N][N];

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    k = 42;
    n = k * (k - 1) + 1;
    int c = 1;
    for (int i = 0; i < k; i++)
    {
        a[i][0] = 1;
        for (int j = c; j < c + k - 1; j++)
        {
            a[i][j] = 1;
        }
        c = c + k - 1;
    }
    int r = k;
    for (int j = 1; j < k; j++)
    {
        int d = j - 1;
        for (int e = k; e < 2 * k - 1; e++)
        {
            a[r][j] = 1;
            int sigmum = e - k;
            for (int L = k, R = k + k - 1; R <= n; L += k - 1, R += k - 1)
            {
                a[r][L + sigmum] = 1;
                sigmum = (sigmum + d) % (k - 1);
            }
            r++;
        }
    }
    /*for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            cout << a[i][j] << " ";
        }
        cout << endl;
    }*/
    cout << n << " " << k << "\n";
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n; j++)
        {
            if (a[i][j] == 1)
            {
                cout << j + 1 << " ";
            }
        }
        cout << "\n";
    }
}


Measured memory_bytes: 28928
#include<bits/stdc++.h>
using namespace std;
struct edge{
	int to,cap;
	long long cst;
	int rev;
};
vector<edge>G[330];
void addedge(int frm,int to,int cap,long long cst)
{
	G[frm].push_back((edge){to,cap,cst,(int)G[to].size()});
	G[to].push_back((edge){frm,0,-cst,(int)G[frm].size()-1});
}
bool inq[330];
long long dis[330];
int prv[330],pre[330];
int T; 
bool maxspfa()
{
	for(int i=0;i<=T;i++)dis[i]=-1e18;
	queue<int>q;
	q.push(0);
	dis[0]=0;
	inq[0]=true;
	while(!q.empty())
	{
		int x=q.front();
		q.pop();
		inq[x]=false;
		for(int i=0;i<(int)G[x].size();i++)
		{
			edge &e=G[x][i];
			if(e.cap && dis[x]+e.cst>dis[e.to])
			{
				dis[e.to]=dis[x]+e.cst;
				prv[e.to]=x;
				pre[e.to]=i;
				if(!inq[e.to])
				{
					inq[e.to]=true;
					q.push(e.to);
				}
			}
		}
	}
	return (dis[T]!=-1e18);
}
long long maxcstmaxflow()
{
	int cur=T;
	while(cur)
	{
		edge &e=G[prv[cur]][pre[cur]];
		e.cap--;
		G[e.to][e.rev].cap++;
		cur=prv[cur];
	}
	return dis[T];
}
int n;
int lx[90],rx[90],ly[90],ry[90];
int x[90],y[90];
long long v[90];
int m;
char ty[10];
long long ans;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d%d%lld",x+i,y+i,v+i),rx[i]=ry[i]=101;
	scanf("%d",&m);
	for(int i=1;i<=m;i++)
	{
		int a,b;
		scanf("%s%d%d",ty,&a,&b);
		if(ty[0]=='L')lx[b+1]=max(lx[b+1],a);
		else if(ty[0]=='R')rx[b+1]=min(rx[b+1],a);
		else if(ty[0]=='D')ly[b+1]=max(ly[b+1],a);
		else ry[b+1]=min(ry[b+1],a);
	}
	for(int i=2;i<=n;i++)lx[i]=max(lx[i],lx[i-1]),rx[i]=min(rx[i],rx[i-1]),ly[i]=max(ly[i],ly[i-1]),ry[i]=min(ry[i],ry[i-1]);
	for(int i=1;i<=n;i++)
	{
		T=n+n+i+i+1;
		for(int j=0;j<=T;j++)G[j].clear();
		for(int j=1;j<=i;j++)addedge(0,n+n+j,1,0),addedge(n+n+i+j,T,1,0);
		for(int j=1;j<=i;j++)
		{
			for(int k=1;k<=n;k++)
			{
				if(lx[j]<x[k] && x[k]<rx[i+1-j])addedge(n+n+j,k,1,0);
				if(ly[j]<y[k] && y[k]<ry[i+1-j])addedge(n+k,n+n+i+j,1,0);
			}
		}
		for(int j=1;j<=n;j++)addedge(j,n+j,1,v[j]);
		long long res=0;
		int cnt=0;
		while(maxspfa())res+=maxcstmaxflow(),cnt++;
		if(cnt<i)continue;
		long long sum=0;
		ans=max(ans,res);
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 1152
import Control.Applicative

main :: IO ()
main = do
    ns <- map read . lines <$> getContents
    print $ solve ns

solve :: [Int] -> Int
solve [] = 0
solve (x:xs) =
    if isPrime x
        then solve xs + 1
        else solve xs
    where
        primes = 2:3:[x|i<-[1..], j<-[-1,1], let x = 6*i+j, isPrime x]
        isPrime n = null [i|i<-takeWhile (\x -> x*x <= n) primes, rem n i == 0]

Measured memory_bytes: 5404
W,H,N = [int(i) for i in input().split()]
rect = [[0]*W for _ in range(H)]
for _ in range(N):
  x,y,a = [int(i) for i in input().split()]
  if a==1:
    for w in range(x):
      for h in range(H):
        rect[h][w]=1
  elif a==2:
    for w in range(x,W):
      for h in range(H):
        rect[h][w]=1
  elif a==3:
    for w in range(W):
      for h in range(y):
        rect[h][w]=1    
  elif a==4:
    for w in range(W):
      for h in range(y,H):
        rect[h][w]=1
ans = 0
for w in range(W):
  for h in range(H):
    if rect[h][w]==0:
      ans+=1
print(ans)

Measured memory_bytes: 3064
from collections import defaultdict

N = int(input())
S = input()
counter = defaultdict(int)
for s in S:
    counter[s] += 1
total = counter["R"] * counter["G"] * counter["B"]
for i in range(N):
    for j in range(i, N):
        k = j + (j - i)
        if k >= N:
            break
        if S[i] != S[j] and S[j] != S[k] and S[i] != S[k]:
            total -= 1
print(total)

Measured memory_bytes: 68844
program range_set
  implicit none
  integer(8), parameter :: modu = 1000000007
  integer :: n, a, b, i, j
  integer(8) :: x = 1, f(0:5000, 2) = 0, g(0:5000, 2) = 0
  read(*,*) n, a, b
  if (a > b) then
    i = a
    a = b
    b = i
  end if
  g(1, 2) = 1
  do i = 2, b - 1
    g(i, 2) = mod(g(i - 1, 1) + g(i - 1, 2), modu)
    g(i, 1) = mod(sum(g(1:i - a, 2)), modu)
  end do
  f(0, :) = 1
  do i = 1, n - 1
    x = x + x
    if (x > modu) x = x - modu
    f(i, 1) = mod(sum(f(max(i - a + 1, 0):i - 1, 2)), modu)
    if (i < b) then
      do j = 1, i - 1
        f(i, 2) = f(i, 2) + mod(f(i - j, 1) * g(j, 2), modu)
      end do
      f(i, 2) = mod(f(i, 2) + g(j, 1) + g(j, 2), modu)
    else
      do j = 1, b - 1
        if (i == n) f(i, 1) = mod(f(i, 1) + f(i - j, 1) * g(j, 1), modu)
        f(i, 2) = f(i, 2) + mod(f(i - j, 1) * g(j, 2), modu)
      end do
      f(i, 2) = mod(f(i, 2), modu)
    end if
  end do
  f(n, 1) = mod(sum(f(n - a + 1:n - 1, 2)), modu)
  do j = 1, b - 1
    f(n, 1) = f(n, 1) + mod(f(n - j, 1) * g(j, 1), modu)
    f(n, 2) = f(n, 2) + mod(f(n - j, 1) * g(j, 2), modu)
  end do
  write(*,'(i0)') modulo(x + x - f(n, 1) - f(n, 2), modu)
end program range_set

Measured memory_bytes: 3028
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll MOD = (1e+9) + 7;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
int dp[500001][4];
int main() {
	string s, t; cin >> s >> t;
	int l = s.length(); int m = t.length();
	if (l > m)cout << "GREATER" << endl;
	else if (l < m)cout << "LESS" << endl;
	else {
		bool f = true;
		rep(i, l) {
			if (s[i] > t[i]) {
				cout << "GREATER" << endl;
				f = false; break;
			}
			else if (s[i] < t[i]) {
				cout << "LESS" << endl;
				f = false; break;
			}
		}
		if (f)cout << "EQUAL" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
int main(){
    int k,ans=0;
    cin>>k;
    for(int i=1;i<=k;i++){
        for(int j=1;j<=k;j++){
            for(int t=1;t<=k;t++){
                int x=__gcd(i,j);
                int y=__gcd(x,t);
                ans+=y;
            }
        }
    }
    cout<<ans<<endl;
}

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 FOR(i,n) for(int i=0;i<n;i++)
const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const int INF = 1e18;


signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    double l;
    cin>>l;
    cout<<setprecision(20)<<pow(l/3.0,3)<<endl;
}

Measured memory_bytes: 256
import java.util.*;

import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {
	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);

		String[] tokens = in.readLine().split(" ");
		int A = Integer.parseInt(tokens[0]);
		int B = Integer.parseInt(tokens[1]);

		int result = Math.max(A - B * 2, 0);
		System.out.println(result);

	}
}


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

using namespace std;

int main() {
	char arr[2][3];
	cin >> arr[0][0] >> arr[0][1] >> arr[0][2];
	cin >> arr[1][0] >> arr[1][1] >> arr[1][2];

	if (arr[0][0] == arr[1][2] && arr[0][1] == arr[1][1] && arr[0][2] == arr[1][0])
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int N;
    char s[101];
    char k;
    int b=0,r=0;
    cin>>N;
    for(int i = 0;i<N;i++){
        cin>>k;
        if(k=='R')r++;
        else b++;
    }
    if(r>b)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(ll i=0;i<n;i++)
const ll INF=1e18;
const int inf=2e9;
const ll MOD=1000000007;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};

int main(){
    int a,b;cin>>a>>b;
    if(a==b)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
N, A, B = map(int, input().split())
S = input()

clears = 0
clears_foreigner = 0

for s in S:
    if s == "a" and clears < A + B:
        print("Yes")
        clears += 1
    elif s == "b" and clears < A + B and clears_foreigner < B:
        print("Yes")
        clears += 1
        clears_foreigner += 1
    else:
        print("No")


Measured memory_bytes: 4016
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>		//UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>		//do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;


const int MR = 5e3 + 10;

int ile[MR];

bool dp[MR];

int main()
{
	int N, K;
	scanf("%d%d", &N, &K);
	LL s = 0;
	int res = 0;

	REP(i, N)
	{
		int a;
		scanf("%d", &a);
		if (a < K)
			ile[a]++;
		else
			res++;
		s += a;
	}

	if (s < K)
	{
		printf("%d\n", N);
		return 0;
	}

	int p = 0, k = K;
	while (p + 1 < k)
	{
		int m = (p + k) / 2;

		// zobacz, czy m jest niezbedne - mozliwe, ze musisz troche poprawic
		// bo szukasz granicy, a nie wiesz, ktora wartosc wystepuje
		int wsk = m;
		FOR(i, m, K)
			if (ile[i])
			{
				wsk = i;
				break;
			}

		// wyrzuc ta wartosc
		ile[wsk]--;

		memset(dp, 0, K);

		dp[0] = 1;

		int mx = 0;
		FOR(j, 1, K)REP(k, ile[j])
		{
			FORD(v, mx + 1, 0)
				if (dp[v] && v + j < K)
					dp[v + j] = 1;

			mx = min(K, mx + j);
		}

		// dodaj z powrotem
		ile[wsk]++;

		bool ok = 0;
		FOR(v, K - wsk, K)
			if (dp[v])
			{
				ok = 1;
				break;
			}

		if (!ok)	//m nie jest niezbedne
			p = m;
		else
			k = m;
	}

	// policz wszystkie niezbedne wartosci
	FOR(i, k, K)
		res += ile[i];

	printf("%d\n", N - res);
	return 0;
}

Measured memory_bytes: 384