akhauriyash/Code-Regression huggingface dataset:
def time_limit_exceeded(N: int, T: int, CT: list) -> int:
    min_cost = float('inf')
    for c, t in CT:
        if t > T:
            continue
        if min_cost > c:
            min_cost = c
    return min_cost


if __name__ == "__main__":
    N, T = map(int, input().split())
    CT = [tuple(int(s) for s in input().split()) for _ in range(N)]
    ans = time_limit_exceeded(N, T, CT)
    print(ans if ans != float('inf') else 'TLE')


Measured memory_bytes: 3060
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF (1e9+1)
//#define INF (1LL<<59)


int f(vector<int> v,int st,int num){
	string s="";
	for(int i=st;i<min(st+num,(int)v.size());i++){
		s+=string(1,'0'+v[i]);
	}
	return stoi(s);
}

int main(){
	int n;
	cin>>n;
	vector<int> v(n);
	rep(i,n)cin>>v[i];
	
	set<int> st;
	rep(i,n){
		for(int j=1;j<=5;j++){
			st.insert(f(v,i,j));
		}
	}
	int bef = -1;
	for(auto &elm:st){
		if(bef+1!=elm){
			cout<<bef+1<<endl;
			return 0;
		}
		bef++;
	}
}

Measured memory_bytes: 3316
url = "https://atcoder.jp/contests/abc161/tasks/abc161_a"

def main():

    a,b,c = list(map(int, input().split()))
    t = a
    a = b
    b = t
    t = c
    c = a
    a = t
    print(a,b,c)



if __name__ == '__main__':
    main()




Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define ll long long
#define lf long double
#define INF 10000000000000000
#define MAX 300001
#define M 998244353
using namespace std;

int main() {
  ll n;
  cin >> n;
  cout << (n*(n-1))/2;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long n=5,i,p=0;
long long a[5];
for(i=0;i<5;i++){
    cin>>a[i];
    if(a[i]==0)
    p=i+1;
}cout<<p;
    return 0;
}


Measured memory_bytes: 3588
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

using System.IO;

class _Class
{
	
	void _Do()
  { 
    //
    var N = _int()[0];
    var a = _int();
    Array.Sort(a);

    long b = 0;
    long p = 0;
    for (int i=0;i<a.Length;i++)
    {
      if ((long)a[i] <= p*2)
      {
        b++;
      }
      else
      {
        b = 1;
      }
      p=(long)a[i] + p;
    }
    Console.WriteLine(b);
	}



	static void Main(string[] args)
  {
    new _Class()._Do();
  }

#region

  string _string()
  {
    return Console.ReadLine();
  }

	//
	string[] _strings()
  {
    return Console.ReadLine().Split();
  }

  int[] _int(int n)
  {
    var x = new int[n];
    for (var i = 0; i < n; i++)
    {
      x[i] = int.Parse(Console.ReadLine());
    }
    return x;
  }

	//
	int[] _int()
  {
    var ss = Console.ReadLine().Split();

    var x = new int[ss.Length];
    for (var i = 0; i < ss.Length; i++)
      x[i] = int.Parse(ss[i]);

    return x;
  }

	long[] _long()
	{
		var ss = Console.ReadLine().Split();

		var x = new long[ss.Length];
		for (var i = 0; i < ss.Length; i++)
			x[i] = long.Parse(ss[i]);

		return x;
	}
#endregion

}


Measured memory_bytes: 26972
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E17;

#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
///////////////////////////////////////

bool comp(l_l a,l_l b){
    if(a.second<b.second)return true;
    return false;
}

int main(){fastio
    ll n,m;cin>>n>>m;
    vector<l_l>v;
    rep(i,0,n-1){
        ll c;cin>>c;v.pb(l_l(1,c));
    }
    rep(i,0,m-1){
        ll b,c;cin>>b>>c;v.pb(l_l(b,c));
    }
    sort(v.begin(),v.end(),comp);
    ll ans=0,c=0;
    ll vs=v.size();
    /*rep(i,0,vs-1){
        cout<<v[i].first<<" "<<v[i].second<<endl;
    }*/
    for(ll i=vs-1;i>=0;i--){
        if(c==n){
            break;
        }
        if(c+v[i].first<=n){
            ans+=v[i].first*v[i].second;
            c+=v[i].first;
        }else{
            ans+=v[i].second*(n-c);
            c=n;
        }
        //cout<<ans<<endl;
    }
    cout<<ans<<endl;
    return 0;
}




Measured memory_bytes: 6128
#include <cstdio>
int par[1400010];
int b[1400010];
int find(int x) {
	return par[x] == x ? x : (par[x] = find(par[x]));
}
void unite(int x, int y) {
	par[find(x)] = find(y);
}
int ban[100010];
int main() {
	long long n;
	int m, q;
	scanf("%lld%d%d", &n, &m, &q);
	for (int i = 0; i < q; i++) {
		int x;
		scanf("%d", &x);
		ban[x] = 1;
	}
	if (m == 1) {
		printf("0\n");
		return 0;
	}
	for (int i = 0; i < 1400010; i++) {
		par[i] = i;
	}
	int k = 0;
	long long c[2] = {};
	c[0] = -1;
	for (long long i = 0; i < n; i++) {
		for (int j = 0; j < 7; j++) {
			b[k+j] = ban[(k + j) %  m];
		}
		for (int j = 0; j < 6; j++) {
			if (!b[k+j] && !b[k+j+1]) {
				unite(k + j, k + j + 1);
			}
		}
		for (int j = 0; j < 7; j++) {
			if (k && !b[k+j] && !b[k+j-7]) {
				unite(k + j, k + j - 7);
			}
		}
		if (i % m == m - 1) {
			c[i/m] = 0;
			for (int j = 0; j < i * 7 + 7; j++) {
				if (!b[j] && find(j) == j) {
					c[i/m]++;
				}
			}
			if (i == 2 * m - 1) {
				break;
			}
		}
		k += 7;
	}
	long long p = n / m, qu = n % m;
	long long ans = 0;
	if (p == 0 || c[0] == -1) {
		for (int j = 0; j < n * 7; j++) {
			if (!b[j] && find(j) == j) {
				ans++;
			}
		}
	} else {
		ans = c[0];
		ans += (c[1] - c[0]) * (p - 1);
		for (int j = m * 7; j < (m + qu) * 7; j++) {
			if (!b[j] && find(j) == j) {
				ans++;
			}
		}
	}
	printf("%lld\n", ans);
	return 0;
}


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

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  while ((a > 0) && (c > 0)) {
    c -= b;
    a -= d;
  }
  if (c <= 0)
    cout << "Yes" << endl;
  else if (a <= 0)
    cout << "No" << endl;
}

Measured memory_bytes: 3636
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
#include<set>
#include<queue>

using namespace std;

#define INF 10000000000000007

int main()
{
	long long n,m,s,t;
	cin >> n >> m >> s >> t;
	s--;t--;
	vector<vector<pair<long long,long long>>> to1(n);
	vector<vector<pair<long long,long long>>> to2(n);
	for(long long i=0;i<m;i++)
	{
		long long u,v,a,b;
		cin >> u >> v >> a >> b;
		u--;v--;
		to1[u].push_back(make_pair(v,a));
		to1[v].push_back(make_pair(u,a));
		to2[u].push_back(make_pair(v,b));
		to2[v].push_back(make_pair(u,b));
	}
	vector<long long> dist1(n,INF);
	vector<long long> dist2(n,INF);
	vector<bool> done(n,false);
	dist1[s]=0;
	priority_queue<pair<long long,long long>> que;
	que.push(make_pair(-1*0,s));
	int cnt=0;
	while(!que.empty())
	{
		auto now=que.top();
		que.pop();
		long long nowid=now.second;
		long long nowdis=now.first*(-1);
		if(done[nowid])continue;
		dist1[nowid]=min(dist1[nowid],nowdis);
		done[nowid]=true;
		cnt++;
		if(cnt>=n)break;
		for(long long i=0;i<to1[nowid].size();i++)
		{
			auto nx=to1[nowid][i];
			long long nxid=nx.first;
			long long nxdis=nx.second;
			if(done[nxid]==true)continue;
			que.push(make_pair(-1*(nxdis+nowdis),nxid));
		}
	}
	
	while(!que.empty())
		que.pop();

	done=vector<bool>(n,false);
	dist2[t]=0;
	que.push(make_pair(-1*0,t));
	cnt=0;
	while(!que.empty())
	{
		auto now=que.top();
		que.pop();
		long long nowid=now.second;
		long long nowdis=now.first*(-1);
		if(done[nowid])continue;
		dist2[nowid]=min(dist2[nowid],nowdis);
		done[nowid]=true;
		cnt++;
		if(cnt>=n)break;
		for(long long i=0;i<to2[nowid].size();i++)
		{
			auto nx=to2[nowid][i];
			long long nxid=nx.first;
			long long nxdis=nx.second;
			if(done[nxid]==true)continue;
			que.push(make_pair(-1*(nxdis+nowdis),nxid));
		}
	}
	
	for(long long i=0;i<n;i++)
		cerr << dist1[i] << (i==n-1 ? "\n":" ");
	
	for(long long i=0;i<n;i++)
		cerr << dist2[i] << (i==n-1 ? "\n":" ");
	
	vector<long long> ans(n);
	for(long long i=0;i<n;i++)
	{
		ans[i]=dist1[i]+dist2[i];
	}
	long long mn=INF;
	for(long long i=n-1;i>=0;i--)
	{
		if(ans[i]>mn)
			ans[i]=mn;
		else
			mn=ans[i];
	}
	for(long long i=0;i<n;i++)
		cout << 1000000000000000-ans[i] << endl;

}

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

using namespace std;

#define PB push_back
#define MP make_pair
#define f first
#define s second
#define FOR(i,a,b) for (int i = a; i < b; ++i)
#define RFOR(i, b, a) for (int i = b-1; i>=a; --i)
#define FILL(a, b) memset(a, b, sizeof a)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)a.size()

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef pair<LL, LL> PLL;

const int INF = 1000 * 1000 * 1000;
const LL LINF = 1LL * INF*INF;
const int MAX = 100010;
const long double PI = acos(-1.);
const double EPS = 1e-6;
LL mod = 1000LL*1000*1000 + 7;

VI g[200005];
PII dfs(int v, int p=-1, int d=0)
{
	PII res = MP(v,d);
	FOR(i,0,SZ(g[v]))
	{
		int to = g[v][i];
		if(to==p)
			continue;
		PII x = dfs(to,v,d+1);
		if(x.s>res.s)
			res = x;
	}
	return res;
}

string solve(int x)
{
	if(x%3==1)
		return "Second";
	else
		return "First";
}

int main()
{
	ios_base::sync_with_stdio(0); double startClock = clock();
	int n;
	cin >> n;
	FOR(i,0,n-1)
	{
		int a,b;
		cin >> a >> b;
		a--;b--;
		g[a].PB(b);
		g[b].PB(a);
	}
	PII x = dfs(0);
	x = dfs(x.f);
//	cout << x.s;
	cout << solve(x.s);
	cerr << endl << (clock() - startClock)/CLOCKS_PER_SEC << endl;return 0;
}


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

int main()
{
  int num[11][11];
  string number;

  while (cin >> number){
    for (int i = 0; i < number.size(); i++){
      num[0][i] = number[i] - '0';
    }

    for (int i = 1; i < 10; i++){
      for (int j = 1; j < 10; j++){
        num[i][j] = (num[i - 1][j - 1] + num[i - 1][j]) % 10;
      }
    }
    cout << num[9][9] << endl;
  }
}

Measured memory_bytes: 1180
// 2019年08月28日 (水曜日) 14:39:33
#include <bits/stdc++.h>
using namespace std;

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

using ll  = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

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

    int n;
    cin >> n;
    int a[n], s[n];

    rep(i, n) {
        cin >> a[i];
        s[i] = a[i];
    }

    sort(s, s + n, greater<int>());
    rep(i, n) { cout << (s[0] == a[i] ? s[1] : s[0]) << endl; }

    return 0;
}


Measured memory_bytes: 3200
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h> // uint64_t

#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) > (b) ? (b) : (a))

int get_int2(int *a1, int64_t *a2) {
  scanf("%d %lld", a1, a2);
  return 0;
}

// <arr[0]> <arr[1]> .. <arr[size-1]>
int fget_array(int64_t *arr, int size) {
    int i;
    for(i = 0; i < size; i++) {
        scanf("%lld", &arr[i]);
    }
    return 0;
}

#define NUM_MAX 100000
// 2**10 = 10**3
// 10**12 => 2**(10*4)
#define BIT_MAX 40

#define power2(bit) (1LL<<bit)

int main(void) {
    int num;
    int64_t ulimit;
    static int64_t arr[NUM_MAX];
    get_int2(&num, &ulimit);
    fget_array(arr, num);

    int i, bit;
    static int cnt[BIT_MAX+1];
    for(i = 0; i < num; i++) {
        for(bit = 0; bit <= BIT_MAX; bit++) {
            cnt[bit] += !!(arr[i] & (1LL<<bit));
        }
    }

    static int64_t max_ans[BIT_MAX+1];
    for(bit = 0; bit <= BIT_MAX; bit++) {
        int c = max(num-cnt[bit], cnt[bit]);
        max_ans[bit] += power2(bit)*c;
        if(bit>=1) max_ans[bit] += max_ans[bit-1];
    }
    int64_t cur = 0;
    int64_t ans = 0;
    for(bit = BIT_MAX; bit>= 0; bit--) {
        if(!(ulimit & power2(bit))) {
            // select 0 and continue
            cur += power2(bit)*cnt[bit];
        } else {
            // select 0 and break;
            if(bit>=1) ans = max(ans, cur + power2(bit)*cnt[bit] + max_ans[bit-1]);
            // select 1 and continue
            cur += power2(bit)*(num-cnt[bit]);
        }
#ifdef DEBUG
        printf("%d -> %lld vs ans: %lld\n", bit, cur, ans);
#endif
        ans = max(ans, cur);
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 896
N = int(input())
s = [[0,0,0]]*(N+1)
t = [0]*(N+1)
x = [0]*(N+1)
y = [0]*(N+1)
for i in range(1,N+1):
  s[i] = input().split()
  t[i] = int(s[i][0])
  x[i] = int(s[i][1])
  y[i] = int(s[i][2])
k = 0
for i in range(N):
  dt = t[i+1]-t[i]
  d = abs(x[i]-x[i+1]) + abs(y[i]-y[i+1])
  if d <= dt and d%2 == dt%2:
    k = k + 1
  else:
    print('No')
    break
if k == N:
  print('Yes')

Measured memory_bytes: 40860
function Main(input){
	var X = parseInt(input,10);
  	var d = Math.floor(X/5);
  	var fhc = Math.floor(d/100);
  	var fc = d%100;
  	var res = (fhc * 1000) + (fc * 5);
	console.log(res);
}
Main(require("fs").readFileSync("/dev/stdin","utf8"));

Measured memory_bytes: 7500
// https://atcoder.jp/contests/abc143/tasks/abc143_c
#include <iostream>

int main()
{
	std::cin.sync_with_stdio(false);
	std::cout.sync_with_stdio(false);

	int count_input = 0;
	char cur_ch = 0;
	char prev_ch = 0;
	int count = 0;
	std::cin >> count_input;
	for (int i = 0; i < count_input; ++i)
	{
		std::cin >> cur_ch;
		if (prev_ch != cur_ch)
			++count;
		prev_ch = cur_ch;
	}
	std::cout << count;
}

Measured memory_bytes: 256
s = list(input())
x = len(s)
a = []

for i in range(x):
  if s[i] == '0':
    a.append('0')
  elif s[i] == '1':
    a.append('1')
  elif s[i] == 'B':
    if a == []:
      continue
    else:
      a.pop(-1)
b = ''.join(a)
print(b)

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

int main() {
	int n, a = 0, b = 100000000, count = 0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a;
		if (b > a) {
			b = a;
			count++;
		}
	}
	cout << count << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define PII pair<int, int>
#define VI vector<int>
#define VPII vector<PII>
#define LL long long
#define LD long double
#define f first
#define s second
#define MP make_pair
#define PB push_back
#define endl '\n'
#define ALL(c) (c).begin(), (c).end()
#define SIZ(c) (int)(c).size()
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, b, e) for(int i = (b); i <= (int)(e); ++i)
#define FORD(i, b, e) for(int i = (b); i >= (int)(e); --i)

#define sim template<class n
sim, class s> ostream & operator << (ostream &p, pair<n, s> x)
{return p << "<" << x.f << ", " << x.s << ">";}
sim> auto operator << (ostream &p, n y) ->
typename enable_if<!is_same<n, string>::value, decltype(y.begin(), p)>::type 
{int o = 0; p << "{"; for(auto c: y) {if(o++) p << ", "; p << c;} return p << "}";}
void dor() {cerr << endl;}
sim, class...s> void dor(n p, s...y) {cerr << p << " "; dor(y...);}
sim, class s> void mini(n &p, s y) {if(p>y) p = y;}
sim, class s> void maxi(n &p, s y) {if(p<y) p = y;}
#ifdef DEB
#define debug(...) dor(__FUNCTION__, ":", __LINE__, ": ", __VA_ARGS__)
#else
#define debug(...)
#endif 

#define I(x) #x " =", (x), " "
#define A(a, i) #a "[" #i " =", i, "] =", a[i], " "
const int MXN = 104;

int main()
{
  int n, m;
  cin >> n >> m;
  cout << n * (n-1) /2 + m * (m-1)/2 << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

template <typename T>
void printv(const vector<T> &v) {
  int sz = v.size();
  for (int i = 0; i < sz; i++) {
    cout << v[i] << " \n"[i == sz - 1];
  }
}

const ll mod = 1e9 + 7;
const ll inf = 1e18;

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

    vll a(3);
    REP(i, 3) {
        cin >> a[i];
    }
    VSORT(a);
    printv(a);
    return 0;
}


Measured memory_bytes: 3144
#include<stdio.h>
#include<string.h>
#define M 1046527
#define L 14
char H[M][L];

//?°?????¬??????¬??¢?????°???
int getChar(char c) {
  switch (c) {
    case 'A': return 1;
    case 'C': return 2;
    case 'G': return 3;
    case 'T': return 4;
    default: return 0;
  }
}
//?°?????¬??????¬??¢?????°?????¶??????key
long long getKey(char str[]) {
  long long ret = 0, p = 1;
  int i;
  for(i = 0; str[i] != '\0'; i++) {
    ret += p * getChar(str[i]);
    p *= 5;
  }
  return ret;
}
int h1(int key){return key%M;}
int h2(int key){return 1+(key%(M-1));}
int find(char str[]) {
  long long key, h, i;
  key = getKey(str);
  for(i = 0; ; i++) {
    h = (h1(key) + i * h2(key)) % M;
    if(strcmp(H[h], str) == 0) {
      return 1;
    } else if(strlen(H[h]) == 0) {
      return 0;
    }
  }
  return 0;
}
int Insert(char str[]) {
  long long key, h, i;
  key = getKey(str);
  for(i = 0; ; i++) {
    h = (h1(key) + i * h2(key)) % M;
    if(strcmp(H[h], str) == 0) {
      return 1;
    } else if(strlen(H[h]) == 0) {
      strcpy(H[h], str);
      return 0;
    }
  }
  return 0;
}


int main() {
  int i, n,h;
  char str[L], cmd[9];
  for(i = 0; i < M; i++) {
    /* initialize hash */
    H[i][0] = '\0';
  }
 
  scanf("%d", &n);
  for(i = 0; i < n; i++) {
    scanf("%s %s", cmd, str);
 
    if(cmd[0] == 'i') {
      Insert(str);
    } else {
      if(find(str)) {
        printf("yes\n");
      } else {
        printf("no\n");
      }
    }
  }
  return 0;
}

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

int main(){
	int h, w;
	cin >> h >> w;
	string board[50];
	rep(i, h) cin >> board[i];

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

	rep(i, h){
		rep(j, w){
			if(board[i][j] == '.') continue;
			else{
				int cnt = 0;
				rep(k, 4){
					int nx = i + dy[k];
					int ny = j + dx[k];

					if(nx < 0 || h <= nx) continue;
					if(ny < 0 || w <= ny) continue;
					if(board[nx][ny] == '.') cnt++;
				}
				if(cnt == 4) flag = true;
			}
		}
	}
	if(flag) cout << "No" << endl;
	else cout << "Yes" << endl;
}


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

class Dice{
private:
  int right,wrong;
  int N,E,W,S;
  int tmp1,tmp2;
public:
  Dice(int ri,int wr,int n,int e,int w,int s):right(ri),wrong(wr),N(n),E(e),W(w),S(s){};
  int ShowRight(){return right;}
  void goN();
  void goE();
  void goW();
  void goS();
};

void Dice::goN(){
  tmp1=N; tmp2=S;
  N=wrong; S=right;
  right=tmp1; wrong=tmp2;
}
void Dice::goE(){
  tmp1=E; tmp2=W;
  E=wrong; W=right;
  right=tmp1; wrong=tmp2;
}
void Dice::goW(){
  tmp1=W; tmp2=E;
  W=wrong; E=right;
  right=tmp1; wrong=tmp2;
}
void Dice::goS(){
  tmp1=S; tmp2=N;
  S=wrong; N=right;
  right=tmp1; wrong=tmp2;
}

int main()
{
 
  int label[6];
  string str;

  for(int i=0;i<6;i++)
    cin >> label[i];
  cin >> str;

  Dice dice(label[0],label[5],label[1],label[3],label[2],label[4]);

  for(int i=0;str[i]!='\0';i++)
    {
      switch(str[i]){
      case 'N':dice.goN();break;
      case 'E':dice.goE();break;
      case 'W':dice.goW();break;
      case 'S':dice.goS();break;
      }
    }

    cout << dice.ShowRight() << endl;


  return 0;
}

Measured memory_bytes: 3176
//inlclude before define 
#define _USE_MATH_DEFINES

//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<type_traits>
#include<numeric>
#include<assert.h>
//#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 pair<int, int> P1;
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++)
#define REP(i,a,b) for(int i=int(a);i<int(b);i++)
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))


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

	if(n==7 || n==5||n==3){
		cout<<"YES"<<endl;
	}else{
		cout<<"NO"<<endl;
	}
}





Measured memory_bytes: 384
//
//  main.cpp
//  A
//
//  Created by Hashizo on 2020/03/28.
//  Copyright © 2020 Hashizo. All rights reserved.
//

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <regex>
#include <cmath>

using namespace std;
 
#undef LONG_MAX
#undef LONG_MIN
 
#define LONG_MAX    9223372036854775807
#define LONG_MIN    (-LONG_MAX  -1)
 
#define ll long long
 
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
 
#define SORT(c) sort((c).begin(), (c).end())
#define REVERSE(v) reverse((v).begin(), (v).end())

int main(int argc, const char * argv[]) {

	char s[10];
	cin >> s;

	if(s[2] == s[3] && s[4] == s[5] ) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	
	return 0;
}


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

int n,m,a[100010];

void work()
{
	scanf("%d",&n);
	for (int i=1,x; i<=n; i++)
		scanf("%d",&x),m=max(m,x),a[x]++;
	for (int i=m/2+1; i<=m; i++)
		if (a[i]<2)  puts("Impossible"),exit(0);
		else  a[i]-=2;
	if (!(m&1))
		{
			if (a[m/2]!=1)  puts("Impossible"),exit(0);
			a[m/2]=0;
		}
	for (int i=1; i<=(m+1)/2; i++)  if (a[i])  puts("Impossible"),exit(0);
	puts("Possible");
}

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


Measured memory_bytes: 256
#include <iostream>

int main()
{
	int a, b;

	std::cin >> a >> b;

	bool a_nine = 1 <= a && a <= 9;
	bool b_nine = 1 <= b && b <= 9;

	if (a_nine && b_nine) {
		std::cout << a * b << std::endl;
	}
	else {
		std::cout << -1 << std::endl;
	}
}

Measured memory_bytes: 256
import math

N, M = map(int, input().split())
     
summa=0
if N>1:
   summa+=math.factorial(N)/(math.factorial(2)*math.factorial(N-2))
if M>1:
   summa+=math.factorial(M)/(math.factorial(2)*math.factorial(M-2))
      
print(int(summa))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
    ll X,x=100;
    cin >>X;
    REP(i,100000000000){
        x = x*1.01;
        if(x>=X){
            cout<<i+1<<endl;
            return 0;
        }
    }
    cout << "NG" << endl;
    return 0;    
}


Measured memory_bytes: 3632
n, m = list(map(int, input().rstrip().split()))
al = list(map(int, input().rstrip().split()))
al.sort(reverse=True)
total = sum(al)
least = total * (1 / (4 * m))
result = 'Yes'
for i in range(m):
    if al[i] < least:
        result = 'No'
        break

print(result)

Measured memory_bytes: 3060
n, x, y = map(int, input().split())
D = [0] * (n - 1)
x -= 1
y -= 1
for i in range(n - 1):
  for j in range(i + 1, n):
    D[min(j - i - 1, abs(x - i) + abs(y - j))] += 1
for d in D: print(d)


Measured memory_bytes: 3444
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if (a < b) {
            System.out.println("a < b");
        } else if (a > b) {
            System.out.println("a > b");
        } else if (a == b) {
            System.out.println("a == b");
        }
    }
}


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

int main(){
  int N ,M;
  int total=0;
  cin >> N >> M;
  vector<int> A(N);
  for(int i =0;i < N;++i){
    cin >> A[i];
  total +=A[i];
  }
sort(A.begin(),A.end());
reverse(A.begin(),A.end());
if(A[M-1]*(4 * M) < total)
  cout << "No" << endl;
  else
    cout << "Yes" << endl;
}

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

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

  int s = 0;
  for (int i = 1; i <= N; i++) {
    if (i % 2 == 1) s++;
  }

  double ans = (double)s/N;
  cout << fixed << setprecision(7);
  cout << ans << endl;
  return 0;
}


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

using namespace std;
using ll = long long;
using pii = pair<int, int>;

int N;
int a[110];

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  sort(a, a + N);
  reverse(a, a + N);
  int A = 0, B = 0;
  for (int i = 0; i < N; i++) {
    if (i & 1) B += a[i];
    else A += a[i];
  }
  cout << A - B << endl;

  return 0;
}

Measured memory_bytes: 256
n = int(input())
h = list(map(int,input().split()))

a = h[0]
for i in range(1,n):
    if a == h[i]:
        pass
    elif a < h[i]:
        h[i] -= 1
        a = h[i]
    else:
        print("No")
        exit()
print("Yes")

Measured memory_bytes: 20608
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
using namespace std;
typedef long long unsigned int ll;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD 1000000007

#define REP(i,n) for(int i=0;i<n;i++)
#define REPS(i,f,n) for(int i=(f);i<(n);i++)
#define EACH(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)

#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy4[]={0, 0, 1, -1};
int dx4[]={1, -1, 0, 0};
int dx8[]={0, 0, 1, -1, 1, 1, -1, -1};
int dy8[]={1, -1, 0, 0, 1, -1, -1, 1};

// https://beta.atcoder.jp/contests/abc097/tasks/abc097_b

int expo[1000];

int main() {
    int X; cin >> X;
    expo[1] = true;

    for (int b = 2; b <= X; b++) {
        int v = b * b;
        while(v <= X) {
            expo[v] = true;
            v *= b;
        }
    }

    for (int i = X; i >= 0; i--) if (expo[i]){
            cout << i << "\n";
            return 0;
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
typedef long long LL;
typedef unsigned long long ULL;
 
template<class T>
inline bool read(T &num) {
    char in;
    bool IsN;
    while(in = getchar(), in != '-' && (in < '0' || in > '9'))if(in == EOF)return false;
    in == '-' ? (IsN = true, num = 0) : num = in - '0';
    while(in = getchar(), in >= '0' && in <= '9')num = num * 10 + in - '0';
    return IsN ? num = -num : num, true;
}
 
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define debug(m) cout<<"nico "<<m<<endl
#define __m  int mid=l+(r-l)/2
 
const int maxn   = 1e7 + 7;
const int inf    = 2e9 + 7;
const int mod    = 1e9 + 7;

int main() {
#ifdef LOCAL
    freopen("sample.in", "r", stdin);
#endif
    //ios::sync_with_stdio(false);
    int a,b,c;
    while(cin>>a>>b>>c)
    cout<<(a^b^c)<<endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
a = list(map(int, input().split()))

M = 10 ** 15
DP = [[0] * N for _ in range(N)]

if N % 2 == 0:
  t = -1
else:
  t = 1
for i in range(N):
  DP[0][i] = a[i] * t
t *= -1

for i in range(1, N):
  for j in range(N - i):
    if t > 0:
      DP[i][j] = max(DP[i - 1][j] + a[i + j], DP[i - 1][j + 1] + a[j])
    else:
      DP[i][j] = min(DP[i - 1][j] - a[i + j], DP[i - 1][j + 1] - a[j])
  t *= -1

print(DP[-1][0])

Measured memory_bytes: 112988
#include <iostream>
#include <vector>
#include <set>

using namespace std;

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

    int N, Q;
    string S;
    cin >> N >> S >> Q;

    vector<set<int>> A(26);
    for (int i = 0; i < N; i++) {
        A[S[i] - 'a'].insert(i);
    }

    while (Q--) {
        int op;
        cin >> op;

        if (op == 1) {
            int i;
            char c;
            cin >> i >> c;
            i--;

            for (auto&& a : A) {
                a.erase(i);
            }
            A[c - 'a'].insert(i);

        } else {
            int l, r;
            cin >> l >> r;
            l--, r--;

            int res = 0;
            for (auto&& a : A) {
                if (a.lower_bound(l) != a.upper_bound(r)) {
                    res++;
                }
            }

            cout << res << '\n';
        }
    }
}


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



int main()
{
    int x[] = {0, 1, 2};
    int val[3];
    cin >> val[0] >> val[1] >> val[2];
    int res = INT_MAX;
    do{
        res = min(res, abs(val[x[1]] - val[x[0]]) + abs(val[x[2]] - val[x[1]]));
    }while(next_permutation(x, x + 3));

    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Collections;
static class Extensions
{
    public static int ToInt(this string s) => int.Parse(s);
    public static long ToLong(this string s) => long.Parse(s);
    public static char ToChar(this string s) => char.Parse(s);
    public static double ToDouble(this string s) => double.Parse(s);
    public static int[] ToIntArray(this string s) => s.Replace(',', ' ').Split(' ').Select(x => x.ToInt()).ToArray();
    public static long[] ToLongArray(this string s) => s.Replace(',', ' ').Split(' ').Select(x => x.ToLong()).ToArray();
    public static double[] ToDoubleArray(this string s) => s.Replace(',', ' ').Split(' ').Select(x => x.ToDouble()).ToArray();
    public static Queue<T> ToQueue<T>(this IEnumerable<T> seq) => new Queue<T>(seq);
    public static Stack<T> ToStack<T>(this IEnumerable<T> seq) => new Stack<T>(seq);
    public static HashSet<T> ToHashSet<T>(this IEnumerable<T> seq) => new HashSet<T>(seq);
}
static class MyMath
{
    static private long gcdInner(long a, long b) => (a % b == 0) ? b : gcdInner(b, a % b);
    static public long GCD(long a, long b) => (a > b) ? gcdInner(a, b) : gcdInner(b, a);
    static public long LCM(long a, long b) => (a > b) ? (a / GCD(a, b) * b) : (b / GCD(a, b) * a);
}

class Program
{
    static string[] ReadLines(int n) => Enumerable.Range(0, n).Select(s => Console.ReadLine()).ToArray();
    
    static void Main()
    {
        string s = Console.ReadLine();

        var chars = s.Distinct();

        bool a = s.Distinct().Count() == 2;

        bool b = chars.All(c => s.Count(cc => cc == c) == 2);

        Console.WriteLine(a && b ? "Yes" : "No");
    }
}

Measured memory_bytes: 13268
#include<cstring>
#include<iostream>
#include<vector>
#include<map>
using namespace std;
int main()
{
    int n;
    cin>>n;
    vector<string> s(n+1);
    map<string,int> ans;
    for(int i=1;i<=n;i++)
    {
        string s;
        cin>>s;
        ans[s]=1;
    }
    cout<<ans.size();
    return 0;

}

Measured memory_bytes: 25052
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7;
const ld PI=abs(acos(-1));
int n,m,a,b;
vector<pair<int,int>> vec1,vec2;

int main(){
	cin >> n >> m;
	REP(i,0,n) cin >> a >> b,vec1.push_back(make_pair(a,b));
	REP(i,0,m) cin >> a >> b,vec2.push_back(make_pair(a,b));
	
	REP(i,0,n){
		int mi=INF,pos=-1;
		RREP(j,m-1,0){
			if(mi>=abs(vec1[i].first-vec2[j].first)+abs(vec1[i].second-vec2[j].second)){
				mi=abs(vec1[i].first-vec2[j].first)+abs(vec1[i].second-vec2[j].second);
				pos=j;
			}
		}
		cout << pos+1 << endl;
	}
	
	return 0;
}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void solve() {
    ll N;
    cin >> N;
    vector<ll> L(N);
    rep(i, N) cin >> L[i];
    sort(L.begin(), L.end());
    ll ans = 0;
    rep(i, N) {
        rep2(j, i + 1, N) {
            ll c = L[i] + L[j];
            ll cnt = lower_bound(L.begin(), L.end(), c) - L.begin() - (j + 1);
            ans += cnt;
        }
    }
    cout << ans << '\n';
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    return 0;
}


Measured memory_bytes: 256
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;

void main()
{
    auto N = readln.chomp.to!int;

    int ans = 0;
    foreach(_; 0..N){
        auto l = readln.chomp.split.map!(to!int);
        ans += l[1] - l[0] + 1;
    }
    writeln(ans);
}

Measured memory_bytes: 380
def solve():
    L,R = map(int, input().split())
    diff = R-L
    L %= 2019
    diff = min(diff, 2019)

    ans = 2019
    for i in range(L, L+diff):
        for j in range(i+1, L+diff+1):
            mod_temp = (i*j)%2019
            ans = min(ans, mod_temp)
    
    print(ans)

solve()

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

#define mod 1e9+7

typedef long long ll;


bool isPrime(ll n){

    if(n<=3)
        return true;


    if(n%2==0 || n%3==0)
        return false;
    
    for(ll i=5;i*i<=n;i+=6)
        if (n%i == 0 || n%(i+2) == 0)  
           return false;  

    return true;

}

ll findPrime(ll n){

    if(n<=1)
        return 2;

    ll prime=n;

    while(!isPrime(prime++));

    return prime-1;
}




int main()
{
    //freopen("in.txt", "r", stdin);
    ios_base::sync_with_stdio(false);	
    cin.tie(NULL);

    ll n;
    cin>>n;

    cout<<findPrime(n);

    return 0;
}

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

using namespace std;

typedef long long int li;
typedef long double ld;
typedef vector<li> vi;
typedef pair<li,li> pi;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define B begin()
#define E end()
#define f(i,l,r) for(li i=l;i<=r;++i)
#define fr(i,l,r) for(li i=l;i>=r;--i)
#define u_map unordered_map
#define endl "\n"

li fastpow(li base,li exp,li M) 
{
    li res=1;
    while(exp>0) {
        if(exp&1)
            res=(res*base)%M;

        base=(base*base)%M;
        exp>>=1;
    }
    return res;
}

int main()
{    
    

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

    li n;

    cin>>n;

    li a[n+1];
    a[0]=1e18;

    for(li i=1;i<=n;i++)
        cin>>a[i];

    li dp[n+1];

    dp[0]=0;
    dp[1]=0;

    f(i,2,n)
    {
        // if(i>)
        dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
    }

    cout<<dp[n];

    return 0;
}

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

vector<pair<long long int, long long int>> prime_factorize(long long int n){// (prime, power)'s vector
    
    vector<pair<long long int, long long int>> prime_power;
    for (long long int p=2; p*p<=n; p++) {
        if(n % p != 0) continue;// break and proceed to p+1

        int power = 0;
        while(n % p == 0){
            power += 1;
            n /= p;
        }
        prime_power.push_back(make_pair(p, power));
    }

    // n has been divided by all primes (with power) smaller than sqrt(n)
    if(n != 1){
        prime_power.push_back(make_pair(n, 1));
    }

    return prime_power;
}

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

    /*
    for(auto prime : prime_factorize(n)){
        cout << prime.first << " " << prime.second << endl;
    }
    */

    vector<long long int> d(n+1,0);
    for(int i=2; i<=n; i++){
        for(auto div : prime_factorize(i)){
            d[div.first] += div.second;
        }
    }

    int count74 = 0, count24 = 0, count14 = 0, count4 = 0, count2 = 0;
    for(int i=2; i<=n; i++){
        if(d[i] >= 74) count74 += 1;
        if(d[i] >= 24) count24 += 1;
        if(d[i] >= 14) count14 += 1;
        if(d[i] >= 4) count4 += 1;
        if(d[i] >= 2) count2 += 1;
    }
    
    cout << 
    count74 +
    count24 * (count2 - 1) +
    count14 * (count4 - 1) +
    count4 * (count4 - 1) / 2 * (count2 - 2) 
    << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
input=sys.stdin.readline
n=int(input())
num=[[0]*23 for _ in range(40)]
for i in range(n):
	s=int(float(input())*(10**9)+0.5)
	two=-9;five=-9
	while s%2==0:
		s//=2
		two+=1
	while s%5==0:
		s//=5
		five+=1
	num[two+9][five+9]+=1
ans=0
for i in range(40):
	for j in range(23):
		for k in range(18-i,40):
			for l in range(18-j,23):
				if (i,j)==(k,l):
					ans+=num[i][j]*(num[i][j]-1)
				else:
					ans+=num[i][j]*num[k][l]
print(ans//2)


Measured memory_bytes: 9192
package main
import (
	"fmt"
)
func main() {
    var N int
    fmt.Scan(&N)
    
    var ac, wa, tle, re int
    for i := 0; i < N; i++ {
        var s string
        fmt.Scan(&s)
        switch s {
        case "AC":
            ac++
        case "WA":
            wa++
        case "TLE":
            tle++
        case "RE":
            re++
        }
    }
    
    fmt.Printf("AC x %d\n", ac)
    fmt.Printf("WA x %d\n", wa)
    fmt.Printf("TLE x %d\n", tle)
    fmt.Printf("RE x %d\n", re)
}

Measured memory_bytes: 6332
#include <iostream>

using namespace std;
int main(void){
    // Your code here!
    std::string week[8]={"FUCK","SAT","FRI","THU","WED","TUE","MON","SUN"};
    
    std::string s;
    cin >> s;
    
    for (int i = 0; i<8; i++){
        if (week[i] == s){
            cout << i << endl;
        }
    }
    
}


Measured memory_bytes: 888
#include<stdio.h>
int main()
{
	double xa1,xa2,ya1,ya2,xb1,xb2,yb1,yb2;
	while(scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&xa1,&ya1,&xa2,&ya2,&xb1,&yb1,&xb2,&yb2)!=EOF){
		if(xa1>xb2||ya1>yb2||xb1>xa2||yb1>ya2){
			printf("NO\n");
		}else{
			printf("YES\n");
		}
	}
	return 0;
}

Measured memory_bytes: 2532
#include <iostream>
#include <vector>
using namespace std;
#define N 300000
 
int n,m,x,y,xb,p[N],q[N],dep[N];
bool vis[N];
vector<int> g[N];
 
bool dfs(int u, int fa) {
	int s = 0;
    vis[u] = 1;
    dep[u] = dep[fa] + 1;
	for ( auto v:g[u] ) {
		if ( !vis[v] ) {
			s ^= dfs(v, u);
		} else {
			if ( dep[v] > dep[u] ) {
				p[++xb] = u;
                q[xb] = v;
				s ^= 1;
			}
        }
    }
	if (s) {
        p[++xb] = u;
        q[xb] = fa;
    } else {
        p[++xb] = fa;
        q[xb] = u;
    }
	return s^1;
}

int main() {
	//scanf("%d%d", &n, &m);
    cin >> n >> m;
	for (int i=1; i<=m; ++i) {
		//scanf("%d%d", &x, &y);
        cin >> x >> y;
		g[x].push_back(y);
        g[y].push_back(x);
	}
	if ( !dfs(1,0) ) {
        //puts("-1");
        cout << "-1" << endl;
        return 0;
    }
	for (int i=1; i<=m; ++i) {
        //printf("%d %d\n", p[i], q[i]);
        cout << p[i] << ' ' << q[i] << endl;
    }

	return 0;
}


Measured memory_bytes: 20992
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

func main() {
	b := readBytes()
	m := map[byte]bool{
		'A': true,
		'T': true,
		'C': true,
		'G': true,
	}

	ans, cnt := 0, 0
	for i := range b {
		if _, ok := m[b[i]]; ok {
			cnt++
			ans = max(ans, cnt)
		} else {
			cnt = 0
		}
	}

	fmt.Println(ans)
}

// sort ------------------------------------------------------------

type xxx struct {
	x int
}

type sortArray []xxx

func (s sortArray) Len() int           { return len(s) }
func (s sortArray) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s sortArray) Less(i, j int) bool { return s[i].x < s[j].x }

// -----------------------------------------------------------------

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	readString, readBytes = newReadString(os.Stdin)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func sum(a []int) int {
	var ret int
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumFloat64(a []float64) float64 {
	var ret float64
	for i := range a {
		ret += a[i]
	}
	return ret
}

func gcd(m, n int) int {
	for m%n != 0 {
		m, n = n, m%n
	}
	return n
}

func lcm(m, n int) int {
	return m / gcd(m, n) * n
}


Measured memory_bytes: 640
n = int(input())
a = list(map(int,input().split()))
money = 1000
kabu = 0
if a[0] < a[1]:
    flg = 'kau'
elif a[0] > a[1]:
    flg = 'uru'
else:
    flg = 'f'
for i in range(1,n):
    if a[i-1] < a[i]:
        if flg != 'uru':
            kabu = money // a[i-1]
            money -= kabu * a[i-1]
            flg = 'uru'
    elif a[i-1] > a[i]:
        if flg != 'kau':
            money += kabu * a[i-1]
            kabu = 0
            flg = 'kau'
    else:
        pass
if kabu > 0:
    money += kabu * a[-1]
print(money)

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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

int N, K, h;

int main(){
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);
  
  std::cin >> N >> K;

  int res = 0;

  for(int i=0;i<N;++i){
      std::cin >> h;

      if(h >= K){
          res += 1;
      }
  }

  std::cout << res << std::endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define rep(i, s, n) for (i64 i = (s), i##_limit = (n); i < i##_limit; ++i)
#define repr(i, s, t) for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define var(type, ...) \
    type __VA_ARGS__;  \
    read(__VA_ARGS__);
#ifndef DBG
#define dump(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U>
inline bool chmax(T &a, const U &b) {
    return b > a && (a = b, true);
}
template <class T, class U>
inline bool chmin(T &a, const U &b) {
    return b < a && (a = b, true);
}
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> makeV(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeV(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeV<T>(initValue, args...))>(
        sz, makeV<T>(initValue, args...));
}

template <class T>
inline istream &operator>>(istream &is, vector<T> &vec) {
    for (auto &e : vec) is >> e;
    return is;
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail &... tail) {
    cin >> head;
    read(tail...);
}

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail &&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream &operator<<(ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = {" ", ""};
    for (const auto &e : vec) os << e << delim[&e == &vec.back()];
    return os;
}

template <class Container>
struct Rev {
    Container &x_;
    inline Rev(Container &x) : x_(x) {}
    inline auto begin() { return rbegin(x_); }
    inline auto end() { return rend(x_); }
};
// }}} End Header

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    var(string, s);
    reverse(all(s));
    const int N = s.length();
    vector<i64> cum(N + 1);

    constexpr int MOD = 2019;

    map<i64, i64> freq;
    i64 p10 = 1;
    rep(i, 0, N) {
        cum[i + 1] = cum[i] + p10 * (s[i] - '0');
        cum[i + 1] %= MOD;
        p10 *= 10;
        p10 %= MOD;
        freq[cum[i]] += 1;
    }
    freq[cum[N]] += 1;
    dump(cum);

    i64 ans = 0;
    for (const auto &e : freq) {
        const auto [value, cnt] = e;
        dump(e);
        ans += cnt * (cnt - 1) / 2;
    }

    print(ans);

    return 0;
}


Measured memory_bytes: 5116
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() (int, []int) {
	n := readInt()
	return n, readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int

// -----------------------------------------------------------------------------

func main() {
	defer stdout.Flush()
	s := readString()
	t := readString()
	ms := make([]map[byte]bool, 26)
	mt := make([]map[byte]bool, 26)
	for i := range ms {
		ms[i] = make(map[byte]bool)
		mt[i] = make(map[byte]bool)
	}
	for i := range s {
		r := s[i]
		q := t[i]
		ms[r-'a'][q] = true
		mt[q-'a'][r] = true
	}

	for i := range ms {
		if len(ms[i]) > 1 {
			println("No")
			return
		}
		if len(mt[i]) > 1 {
			println("No")
			return
		}
	}
	println("Yes")
}

// -----------------------------------------------------------------------------


Measured memory_bytes: 1536
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int bit = 0;
    for(int i=0; i<n; i++){
      bit |= sc.nextInt();
      // bit = bit | sc.nextInt();
    }
    System.out.println(Integer.numberOfTrailingZeros(bit));
  }
}


Measured memory_bytes: 21972