akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n;
  cin >> n;
  vl a(n);
  ll m = 0;
  rep(i, n) {
    cin >> a[i];
    if(a[i] < 0) {
      m++;
      a[i] *= -1;
    }
  }
  sort(all(a));
  ll ans = 0;
  if(m % 2) a[0] *= -1;
  ans = accumulate(all(a), 0LL);
  cout << ans << endl;
}

Measured memory_bytes: 3920
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i,n)  for(ll i=0;i<n;i++)
#define fb(i,n) for(ll i=n-1;i>=0;i--)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef pair<int,int> pii;
int main()
{
	IOS;
	//int t; cin>>t;
	//ll M=pow(10,9)+7;
	int t=1;
	while(t)
	{
		int n; cin>>n;
		int a[n]; f(i,n) cin>>a[i];
		int count=0;
		for(int i=0;i<n;i++)
		{
			if(i%2==0&&a[i]%2!=0)
			{
				count++;
			}
		}
		cout<<count;
		t--;
	}
	return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <algorithm>
#define N 601000
typedef long long ll; 
template<typename T> inline void read(T &x) { 
  x = 0; char  c = getchar();
  while (!isdigit(c)) c = getchar();
  while (isdigit(c)) { x = (x << 1) + (x << 3) + (c ^ 48); c = getchar(); }
}
using namespace std;
const int P = 924844033;
const int G = 5;
int Gi; 
inline ll quickpow(ll x, int k) {
  ll res = 1;
  while (k) {
    if (k & 1)  res = res * x % P;  
    x = x *x  % P;
    k >>= 1;
  }
  return res;
}
int n;
struct edge{
  int nxt, to; 
}e[N << 1]; 
int head[N], ecnt;
inline void addedge(int from, int to) {
  e[++ecnt] = (edge){head[from], to};
  head[from] = ecnt;
}

int siz[N], dep[N], fa[N];
void dfs_son(int cur, int faa) {
  siz[cur] = 1, fa[cur] = faa;
  for (int i = head[cur]; i; i = e[i].nxt) {
    int to = e[i].to; if (to == faa)  continue;
    dfs_son(to, cur);
    siz[cur] += siz[to];
  }
}

int cnt[N];
ll f[N], g[N], A[N], ans[N];
int limi, L, r[N];
inline void ntt(ll *a, int type) {
  for (int i = 1; i < limi; ++i)
    if (i < r[i]) swap(a[i], a[r[i]]);
  for (int i = 1; i < limi; i <<= 1) {
    ll T = quickpow(type == 1 ? G : Gi, (P - 1) / (i << 1));
    for (int j = 0; j < limi; j += (i << 1)) {
      ll t = 1;
      for (int k = 0; k < i; ++k, t = t * T % P) {
        ll nx = a[j + k], ny = t * a[j + k + i] % P;
        a[j + k] = (nx + ny) % P;
        a[j + k + i] = (nx - ny + P) % P;
      }   
    }   
  }
  if (type == -1) {
    ll inv = quickpow(limi, P - 2); 
    for (int i = 0; i < limi; ++i)  a[i] = a[i] * inv % P;
  }
}

ll jie[N], jieni[N];
inline ll get_c(int n, int m) {
  if (n < 0 || m < 0 || n - m < 0)  return 0;
  return jie[n] * jieni[m] % P * jieni[n - m] % P;
}
inline void work() {
  limi = 1;
  while (limi <= n + n + 2) limi <<= 1, ++L;
  for (int i = 0; i <= limi; ++i)
    r[i] = (r[i >> 1] >> 1) | ((i & 1) << (L - 1));
  ntt(f, 1), ntt(g, 1); 
  for (int i = 0; i < limi; ++i)  A[i] = f[i] * g[i] % P;
  ntt(A, -1);
//  for (int i= 0; i <= n; ++i)	printf("A(yuan)[%d] = %lld\n", i, A[n - i]);
  for (int k = 1; k <= n; ++k) {
    ll ans = (1ll * n * get_c(n, k) % P - jieni[k] * A[n - k] % P) % P;
//    printf("%d * %lld - %lld * %lld = \n", n, get_c(n, k), jie[k], A[n - k]);
    printf("%lld\n", (ans % P + P) % P); 
  }
}

inline void init() {
  jie[0] = jieni[0] = 1;
  int up = n + 10; 
  for (int i = 1; i <= up; ++i) jie[i] = jie[i - 1] * i % P;
  jieni[up] = quickpow(jie[up], P - 2); 
  for (int i = up - 1; i; --i)  jieni[i] = jieni[i + 1] * (i + 1) % P;
  Gi = quickpow(G, P - 2); 
}

int main() {
  read(n); init();
  for (int i = 1; i < n; ++i) {
    int u, v; read(u), read(v); addedge(u, v), addedge(v, u); 
  }
  dfs_son(1, 0); 
  for (int i = 2; i <= n; ++i) {
    ++cnt[siz[i]], ++cnt[n - siz[i]];
  }
  for (int i = 0; i <= n; ++i)  f[i] = 1ll * cnt[n - i] * jie[n - i] % P;
  for (int i = 0; i <= n; ++i)  g[i] = jieni[i];
//  for (int i = 0; i <= n; ++i)	printf("f[%d] = %lld, g = %lld\n", i, f[i], g[i]);
  work();
  return 0;
}

/*
3
1 2
2 3
//3 7 3
*/

Measured memory_bytes: 34772
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <deque>
#include <queue>
#include <functional>
//#include <boost/multiprecision/cpp_int.hpp>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define REP(i, m, n) for(int i = m; i < n; ++i)
#define rrep(i,n) for(int i = n; i >= 0; --i)
#define RREP(i, m, n) for(int i = n; i >= m; --i)
#define llrep(i, n) for(ll i = 0; i < n; ++i)
#define llREP(i, m, n) for(ll i = m; i < n; ++i)
#define llrrep(i,n) for(ll i = n; i >= 0; --i)
#define llRREP(i, m, n) for(ll i = n; i >= m; --i)

using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int, int>;
using pll = std::pair<long long, long long>;
using pil = std::pair<int, long long>;
using pli = std::pair<long long, int>;
using plpii = std::pair<long long, std::pair<int, int>>;
using pdd = std::pair<double, double>;

const long long INF = 1000000000000000001;
const long long _MOD = 1000000007;
const long long MOD = 998244353;
const int ALPHABET = 27;
const double pi = 3.14159265358979;

using namespace std;
//namespace mp = boost::multiprecision;

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

	int h1, m1, h2, m2, k;
	cin >> h1 >> m1 >> h2 >> m2 >> k;

	cout << (h2 * 60 + m2) - (h1 * 60 + m1) - k << "\n";

	return 0;
}



Measured memory_bytes: 3640
# from collections import defaultdict
N = int(input())
A = []
for i in range(N):
    first, second = list(map(int, input().split()))
    A.append((first, second))

count = 0
for first, second in A:
    if first == second:
        count += 1
        if count >= 3:
            print("Yes")
            exit(0)
    else:
        count = 0
print("No")


Measured memory_bytes: 62572
#include <bits/stdc++.h>
using namespace std;
 
const long long mod = 1e9 + 7 ;
const int N = 3e5+122; 

int n, m, k, t;
int a[N];
long long ans = 0;
vector<int> v[N];

int main ( ) {
	cin >>ans;
	if(ans>1e4) ans %= 10000;
	for(int i = 0; i <= 100; i++)
	for(int j = 0; j <= 100; j++)
	if(i+j>100)break;
	else
	for(int k = 0; k <= 100; k++) 
	if(i+k+j>100)break;
	else
	for(int l = 0; l <= 100; l++)
	if(i+j+k+l>100)break;
	else
	for(int m = 0; m <= 100; m++)
	if(i+j+k+l+m>100)break;
	else
	for(int n = 0; n <= 100; n++){
		if(i + j + k + l + m + n > 100) break;
		long long tot = 100 * i + 101 * j + 102 * k + 103 * l + 104 * m + 105 * n;
		//cout<<tot<<' ';
		if(tot == ans) return cout << 1, 0;
		if(tot > ans) break;
	}
	cout<<0;
	return 0;

}

Measured memory_bytes: 8448
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}
int nxt[65][200010] = {};
void solve(){
    ll N,K;
    cin >> N >> K;
    ll A[200010];
    rep(i,0,N){
        cin >> A[i];
        A[i]--;
    }
    rep(i,0,N){
        nxt[0][i] = A[i];
    }

    rep(k,0,62){
        rep(i,0,N){
            if(nxt[k][i] == -1){
                nxt[k+1][i] = -1;
            }else{
                nxt[k+1][i] = nxt[k][nxt[k][i]];
            }
        }
    }
    ll pos = 0;
    
    rrep(b,62,0){
        if((K>>b) & 1){
            pos = nxt[b][pos];
        }
    }
    print(pos+1);
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
}


Measured memory_bytes: 54436
import math

n, max_dist = input().split()

points = 0

for _ in range(int(n)):
    x, y = input().split()
    x = int(x)
    y = int(y)

    dist = math.sqrt(x * x + y * y)

    if dist <= float(max_dist):
        points += 1

print(points)
    

Measured memory_bytes: 9180
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
#define x first
#define y second
#define pb push_back
#define mp make_pair
template <typename T> void chkmin(T &x,T y){y<x?x=y:T();}
template <typename T> void chkmax(T &x,T y){x<y?x=y:T();}
template <typename T> void readint(T &x)
{
	int f=1;char c;x=0;
	for(c=getchar();!isdigit(c);c=getchar())if(c=='-')f=-1;
	for(;isdigit(c);c=getchar())x=x*10+(c-'0');
	x*=f;
}
const int MOD=1000000007;
inline int dmy(int x){return x>=MOD?x-MOD:x;}
inline void inc(int &x,int y){x=dmy(x+y);}
int qmi(int x,int y)
{
	int ans=1;
	for(;y;y>>=1,x=1ll*x*x%MOD)
		if(y&1)ans=1ll*ans*x%MOD;
	return ans;
}
const int MAXN=605;

int n,m,fac[MAXN],u[MAXN],v[MAXN],f[MAXN][MAXN],g[MAXN][MAXN],cnt[MAXN][MAXN];
bool inside(int x,int l,int r){return x>=l && x<=r;}

int main()
{
	#ifdef LOCAL
	freopen("code.in","r",stdin);
//	freopen("code.out","w",stdout);
	#endif
	readint(n),readint(m);
	fac[0]=1;
	for(int i=1;i<=n;++i)fac[i]=1ll*fac[i-1]*(2*i-1)%MOD;
	n<<=1;
	for(int i=1;i<=m;++i)readint(u[i]),readint(v[i]);
	for(int l=1;l<=n;++l)
		for(int r=l+1;r<=n;r+=2)
		{
			bool flag=1;
			cnt[l][r]=0;
			for(int i=1;i<=m;++i)
			{
				if(inside(u[i],l,r)!=inside(v[i],l,r)){flag=0;break;}
				if(inside(u[i],l,r))++cnt[l][r];
			}
			if(!flag)continue;
			f[l][r]=fac[(r-l+1)/2-cnt[l][r]];
		}
	int ans=0;
	for(int l=n;l;--l)
		for(int r=l+1;r<=n;r+=2)
		{
			g[l][r]=f[l][r];
			for(int i=l+1;i<r;i+=2)
				inc(g[l][r],MOD-1ll*f[l][i]*g[i+1][r]%MOD);
			inc(ans,1ll*g[l][r]*fac[(n-(r-l+1))/2-(m-cnt[l][r])]%MOD);
		}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 7884
#pragma GCC target ("avx2")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("O3")
#include "bits/stdc++.h"
#include <unordered_set>
#include <unordered_map>
#include <random>
using namespace std;
typedef long long ll;
const ll MOD = 1'000'000'007LL; /*998'244'353LL;*/
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
const int dx[4]={ 1,0,-1,0 };
const int dy[4]={ 0,1,0,-1 };

struct UnionFind{
private:
    vector<int> par;
    vector<int> siz;
public:
    void init(int N){
        par.resize(N);
        siz.resize(N);
        for(int i=0; i<N; i++) par[i] = i;
        for(int i=0; i<N; i++) siz[i] = 1;
    }
    void unite(int a, int b){
        int rootA = root(a);
        int rootB = root(b);
        if(rootA == rootB) return;
        if(siz[rootA] < siz[rootB]) swap(rootA, rootB);
        par[rootB] = rootA;
        siz[rootA] += siz[rootB];
    }
    int root(int a){
        if(par[a] == a) return a;
        return par[a] = root(par[a]);
    }
    bool same(int a, int b){
        return root(a) == root(b);
    }
    int size(int a){
        return siz[root(a)];
    }
};

int N, K, L;
UnionFind uf1, uf2;
map<pair<int, int>, int> t;

signed main(){
    cin >> N >> K >> L;
    uf1.init(N);
    rep(i, K){
        int a, b;
        cin >> a >> b;
        uf1.unite(a-1, b-1);
    }
    uf2.init(N);
    rep(i, L){
        int a, b;
        cin >> a >> b;
        uf2.unite(a-1, b-1);
    }
    rep(i, N){
        t[mp(uf1.root(i), uf2.root(i))]++;
    }
    rep(i, N){
        cout << t[mp(uf1.root(i), uf2.root(i))] << endl;
    }
}

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

using namespace std;


int main(){
    
    int N;
    cin >> N;
    int B[N-1];
    int A[N];
    A[N-1] = 100000;
    
    for (int i = 0; i < N-1; i++) {
        cin >> B[i];
    }
    
    for (int i = N-2; i >= 0; i--) {
        A[i+1] = min(B[i], A[i+1]);
        A[i] = B[i];
    }
    int ans = 0;
    for (int i = 0; i < N; i++) {
        ans += A[i];
    }
    cout << ans << endl;
    
}


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

using namespace std;

int main()
{
    float n,a,r=0.0,sum=0.0;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>a;
        r=r+1/a;
    }
    sum=1/r;
    cout<<sum;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long x,y;
  long long a,b,c,d;
  cin >> a >> b >> c >> d;
  
  //cout << max(a,b) << " " << max(c,d) << endl;
  x = max( max(a,b)*max(c,d), min(a,b)*min(c,d) );
  y = max( max(a,b)*min(c,d), min(a,b)*max(c,d) );
  //x = min(a,b)*min(c,d);
  cout << max(x,y) << endl;
  
  //cout << min(a,b)*min(c,d) << endl;

}

Measured memory_bytes: 3632
/*****************************************************
 *     created by: nayakashutosh9
 * "Winners Never Quit and Quitters Never Win".
*****************************************************/
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("Ofast")
using namespace __gnu_pbds;
using namespace std;
#define int long long int
// #define endl '\n'
#define mod 1000000007
#define inf 1e18
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
const int N = 300005;
/**********************************************************************************************/


void solve() {
	int k, a, b; cin >> k >> a >> b;
	if (((b / k) - (a / k)) > 0 || (a % k == 0 || b % k == 0)) cout << "OK\n";
	else cout << "NG\n";
}

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	int t = 1, z = 1;
	// cin >> t; cin.ignore();
	while (t--) {
		// cout << "Case #" << (z++) << ": ";
		// clock_t start = clock();
		solve();
		// clock_t end = clock();
		// cout << (end-start) << endl;
		//print execution time in ms
	}

	return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
int main(){
  while(1){
    int n,x;
    cin>>n>>x;
    if(n==0 && x==0) break;
    int ans=0;
    for(int a=1;a<=n;a++){
      for(int b=a+1;b<=n;b++){
        for(int c=b+1;c<=n;c++){
          if(a+b+c!=x) continue;
          ans++;
          }
        }
      }
      cout<<ans<<endl;
     }
  return 0;
}


Measured memory_bytes: 3096
#n, m, q = map(int, input().split())
#List = list(map(int, input().split()))
#req = [list(map(int, input().split())) for _ in range(q)]
#t = t[:-1]
#print(ans[j], end = "") 改行無しで出力
#[0]*n
x, y = map(int, input().split())
min = 2*x
max = 4*x

if y%2 == 0 and min <= y and max >= y:
    print("Yes")
else:
    print("No")


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

#define rep(i,s,n) for(ll i = (s); i < (n); i++)
#define rep0(i,n) rep(i,0,n)
#define BR "\n"
#define SP " "
#define fcout cout << fixed << setprecision(18)

int main() {
  double x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;

  int q; cin >> q;
  rep0(i, q) {
    double x, y;
    cin >> x >> y;

    double ansx, ansy;
    if (x1 == x2) {
      ansx = x1;
      ansy = y;
    } else if (y1 == y2) { 
      ansx = x;
      ansy = y1;
    } else {
      double a1 = (y2 - y1) / (x2 - x1);
      double b1 = y1 - a1 * x1;
      double a2 = -1 / a1;
      double b2 = y - a2 * x;

      ansx = -(b1 - b2) / (a1 - a2);
      ansy = ansx * a1 + b1;
    }
    fcout << ansx << SP << ansy << BR;
  }

  return 0;
}


Measured memory_bytes: 3268
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
#define rg register
#define ll long long 
#define inf 0x3f3f3f3f
inline ll read()
{
    ll x=0,f=1;char c=getchar();
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();
    return x*f;
}
ll a[100005];
ll n,k,cnt[2],ans,res;
int main(){

    n=read();k=read();
    for(int i=1;i<=n;i++) a[i]=read();
    for(int i=41;i>=0;i--)
    {
        cnt[0]=cnt[1]=0;
        for(int j=1;j<=n;j++)
        {
            cnt[(a[j]>>i)&1]++;
        }
        if(cnt[0]>cnt[1]&&ans+(1LL<<i)<=k) ans+=(1LL<<i);
    }
    for(int i=1;i<=n;i++)
        res+=ans^a[i];
    printf("%lld\n",res);
    return 0;
}

Measured memory_bytes: 1024
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
using namespace std;
ll n, ans, x;
vector<ll>a, b, c;
ll between(ll s, ll e, vector<ll> &v){
    auto l = lower_bound(v.begin(),v.end(),s) - v.begin();
    auto r = upper_bound(v.begin(),v.end(),e) - v.begin();
    if(v[0] > e || v.back() < s)
        return 0ll;
    return max((ll)r - l, 0ll);
}
int main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> n;
    for(int i = 0; i < n; i++)
        cin >> x, a.push_back(x);
    for(int i = 0; i < n; i++)
        cin >> x, b.push_back(x);
    for(int i = 0; i < n; i++)
        cin >> x, c.push_back(x);
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    sort(c.begin(), c.end());
    for(int i = 0; i < n; i++){
        ans += between(0, b[i] - 1, a) * between(b[i] + 1, 1e9 + 5, c);
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;

#define ll long long
#define ldb long double
#define db double
#define str string

#define fr first
#define se second
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define mp make_pair

#define pi pair<int,int>
#define pll pair<ll,ll>
#define pdb pair<db,db>
#define pldb pair<ldb,ldb>

#define vi vector<int>
#define vll vector<ll>
#define vdb vector<db>
#define vldb vector<ldb>
#define vpi vector< pi >
#define vpll vector< pll >

#define mi map<int,int>
#define mll map<ll,ll>
#define mdb map<db,db>
#define mldb map<ldb,ldb>


#define forr(i,a,b) for (int i = (a); i < (b); ++i)
#define rrof(i,a,b) for (int i = (b)-1; i >= (a); --i)


const int MOD = 1e9+7;
const ldb PI = 4*atan((ldb)1);

ll power(ll a,ll n){
	ll res=1;

	while(n){
		if(n%2)
		res*=a;
		a*=a;
		n/=2;
	}
	
	return res;
}

int main(){
	fast;
	
	int n,m;
	cin>>n>>m;

	if(n<m){
		for(int i=0;i<m;i++)
		cout<<n;
	}
	
	else {
		for(int i=0;i<n;i++)
		cout<<m;
	}
	return 0;
}


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

using namespace std;

int main()
{
    int a, b, c;
    cin >> a >> b >> c;

    vector<int> l;
    l.push_back(a);
    l.push_back(b);
    l.push_back(c);

    sort(l.begin(), l.end());

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

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
int N, M, a[301][301], use[301], O, del[301], count[301];
int main()
{
	scanf("%d%d", &N, &M);
	for (int i = 1; i <= N; i++)
		for (int j = 1; j <= M; j++)
			scanf("%d", a[i] + j);
	std::fill(use + 1, use + N + 1, 1);
	O = N;
	for (int _ = M; _--; )
	{
		std::fill(count + 1, count + M + 1, 0);
		for (int i = 1; i <= N; i++)
		{
			while (del[a[i][use[i]]])
				use[i]++;
			count[a[i][use[i]]]++;
		}
		int D = std::max_element(count + 1, count + M + 1) - count;
		O = std::min(O, count[D]);
		del[D] = 1;
	}
	printf("%d\n", O);
	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll X,A;
    cin >>X>>A;
    
    if(X<A){
        cout<<0<<endl;
    }else{
        cout<<10<<endl;
    }



    return 0;
    

}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)

vector<pair<ll,ll>> prime_factorize(ll N){
    vector<pair<ll,ll>> ret;
    for(ll a = 2; a * a <= N; a++){
        if(N % a != 0) continue;
        ll ex = 0;
        while(N % a == 0){
            ex++;
            N /= a;
        }
        ret.push_back({a, ex});
    }
    if(N != 1) ret.push_back({N, 1});
    return ret;
}

ll mod = 1e9+7;
#define NMAX 200010
ll fac[NMAX];
ll inv[NMAX];

ll mod_pow(ll a, ll n, ll mod){
    ll ret = 1;
    while(n > 0){
        if(n & 1) ret = (ret*(a % mod))%mod;
        a = ((a%mod)*(a%mod)) % mod;
        n = n >> 1;
    }
    return ret;
}

ll mod_inv(ll a, ll mod){
    return mod_pow(a, mod-2, mod);
}

void mae_nck(){
    fac[1] = 1;
    inv[1] = 1;
    for(ll i = 2; i < NMAX; i++){
        fac[i] = (fac[i-1] * i)%mod;
        inv[i] = (inv[i-1] * mod_inv(i, mod))%mod;
    }
}

ll mod_nck(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    if(k == 0 || k == n) return 1;
    ll ret = ((fac[n] * inv[k])%mod * inv[n-k])%mod;
    return ret;
}

int main(){
    ll N;
    cin >> N;
    vector<ll> A(N);
    rep(i, 0, N) cin >> A[i];
    map<ll,ll> mp;
    rep(i, 0, N){
        auto vec = prime_factorize(A[i]);
        for(auto v : vec){
            if(mp.count(v.first) == 0){
                mp[v.first] = v.second;
            }else{
                mp[v.first] = max(mp[v.first], v.second);
            }
        }
    }
    ll prod = 1;
    for(auto p : mp){
        prod *= mod_pow(p.first, p.second, mod);
        prod %= mod;
    }
    ll ans = 0;
    rep(i, 0, N){
        ans += prod * mod_inv(A[i], mod);
        ans %= mod;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 896
#include <stdio.h>
#include <limits.h>
#include <math.h>

#define N (1 << 20)

int seg[N << 1];
void init(void)
{
	int i;
	for (i = 0; i < (N << 1); i++){
		seg[i] = 0;
	}
}
int find(int a, int b, int x, int l, int r)
{
	if (a >= r || l >= b) return (0);
	if (a <= l && r <= b) return (seg[x]);
	return (find(a, b, x + x + 1, l, l + r >> 1) + find(a, b, x + x + 2, l + r >> 1, r));
}
void update(int x, int v)
{
	seg[x += N - 1] += v;
	while (x){
		x = x - 1 >> 1;
		seg[x] = seg[x + x + 1] + seg[x + x + 2];
	}
}

int main(void)
{
	int n, q;

	init();
	scanf("%d %d", &n, &q);
	while (q--){
		int qid, pos, val;
		scanf("%d %d %d", &qid, &pos, &val);
		if (qid) printf("%d\n", find(pos, val + 1, 0, 0, N));
		else update(pos, val);
	}
	return (0);
}

Measured memory_bytes: 8792
from bisect import bisect_right
n = int(input())
d = {}
for a in map(int, input().split()):
  if a in d:
    d[a] += 1
  else:
    d[a] = 1
alist = list(sorted(d.keys(), reverse = True))
amax = alist[0]
t = 1
power_of_two = []
while t < 2 * amax:
  t *= 2
  power_of_two.append(t)
result = 0
for a in alist:
  if a not in d:
    continue
  t = power_of_two[bisect_right(power_of_two, a)] - a
  if t not in d:
    continue
  if a != t:
    i = min(d[a], d[t])
  else:
    if d[a] == 1:
      continue
    i = d[a] // 2
  result += i  
  if d[a] == i:
    del d[a]
  else:
    d[a] -= i
  if d[t] == i:
    del d[t]
  else:
    d[t] -= i
print(result)


Measured memory_bytes: 44592
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char c;
  cin >> c;
  
  if (c == 'a') {
    cout << "vowel" << endl;
  }
  else if (c == 'i') {
    cout << "vowel" << endl;
  }
  else if (c == 'u') {
    cout << "vowel" << endl;
  }
  else if (c == 'o') {
    cout << "vowel" << endl;
  }
  else if (c == 'e') {
    cout << "vowel" << endl;
  }
  else {
    cout << "consonant" << endl;
  }
  
}



Measured memory_bytes: 256
def solve(N, A1s, A2s):
    m = 0
    for k in range(0, N):
        m = max(m, sum(A1s[:k + 1]) + sum(A2s[k:]))
    return m


if __name__ == "__main__":
    N = int(input())
    A1s = list(map(int, input().split(" ")))
    A2s = list(map(int, input().split(" ")))
    print(solve(N, A1s, A2s))


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

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

Measured memory_bytes: 3576
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<class T>inline bool chmax(T& a,T b) { if(a < b) { a = b; return true;
  }return false;}
template<class T>inline bool chmin(T& a,T b) { if(a > b) { a = b; return true;
  }return false;}

const ll INF = 1e18;
const int MX = 2005;

const int MOD = 1000000007;

int h,w;
vector<string>a;

int dp[1100][1100] = {0};

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

int main() {
  cin >> h >> w;
  a.resize(h);
  rep(i,h) cin >> a[i];
  
  dp[0][0] = 1;
  
  rep(i,h){
    rep(j,w){
      if(i+1 < h && a[i+1][j] == '.')add(dp[i+1][j],dp[i][j]);
      if(j+1 < w && a[i][j+1] == '.')add(dp[i][j+1],dp[i][j]);
    }
  }
  cout << dp[h-1][w-1] << endl;
}

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

using namespace std;

int main(){
	int N = 0, X = 0, D = 0;
	
	cin >> N >> X;
	
	vector<int> L(N);
	
	for(int i = 0; i < N; i++){
		cin >> L.at(i);
	}
	
	for(int i = 1; i < N + 1; i++){
		D = D + L.at(i - 1);
		if(D > X){
			cout << i << endl;
			return 0;
		}
	}
	cout << N + 1 << endl;
	
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    int ans=0;
    if(n>=105)ans++;
    if(n>=135)ans++;
    if(n>=165)ans++;
    if(n>=189)ans++;
    if(n>=195)ans++;
    System.out.println(ans);
  }
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
const int MAX_N=2e4+10,MAX_M=20,MAX=256,INF=1e9;

int N,M,nxt,ans;
int C[MAX_M],x[MAX_N];
int dp[MAX_N][MAX];

void solve(){
    for (int i=0;i<MAX_N;++i)
        for (int j=0;j<MAX;++j)
            dp[i][j]=INF;
    dp[0][128]=0;
    for (int i=0;i<N;++i){
        for (int j=0;j<MAX;++j){
            for (int k=0;k<M;++k){
                nxt=max(0,min(MAX-1,j+C[k]));
                dp[i+1][nxt]=min(dp[i+1][nxt],dp[i][j]+(x[i]-nxt)*(x[i]-nxt));
            }
        }
    }
    ans=INF;
    for (int j=0;j<MAX;++j) ans=min(ans,dp[N][j]);
    cout << ans << '\n';
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(cin >> N >> M,N){
        for (int i=0;i<M;++i) cin >> C[i];
        for (int i=0;i<N;++i) cin >> x[i];
        solve();
    }
}


Measured memory_bytes: 23132
from heapq import heappop, heappush 
from collections import deque
def dijkstra(xs, ys, xg, yg,h,w,k,field):
    # que->(cost, x, y, direction)
    inf = 1e18
    dist = [[inf]*w for _ in range(h)]
    dist[xs][ys] = 0
    que = deque([(0, xs, ys)])
    dx = [-1, 0, 1, 0]
    dy = [0, 1, 0, -1]
    while que:
        cost, x, y = que.popleft()
        if cost > dist[x][y]:
            continue
        for v in range(4):
            nx, ny = x, y
            for _ in range(k):
                nx += dx[v]
                ny += dy[v]
                if not field[nx][ny]:
                    break
                if dist[nx][ny]<=dist[x][y]:
                    break
                if dist[nx][ny] > dist[x][y]+1:
                    dist[nx][ny] = dist[x][y]+1
                    que.append((dist[nx][ny], nx, ny))

    if dist[xg][yg] == inf:
        print(-1)
    else:
        print(dist[xg][yg])

        

def main():
    import sys
    def input(): return sys.stdin.readline().rstrip()
    h, w, k = map(int, input().split())
    xs, ys, xg, yg = map(int, input().split())
    field = [[False]*(w+2) for _ in range(h+2)]
    for i in range(h):
        # False で覆うことでx,yの制限をなくす。
        s = [True if _ == '.' else False for _ in input()]
        field[i+1] = [False]+s+[False]
    h += 2
    w += 2
    dijkstra(xs, ys, xg, yg, h, w, k, field)

if __name__ == '__main__':
    main()

Measured memory_bytes: 82624
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << (x) << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
int main(){
	int N,M;
	cin>>N>>M;
	M += N-1;
	VV<int> G(N);
	V<int> outdeg(N);
	rep(i,M){
		int x,y;
		cin>>x>>y;
		x--,y--;
		G[y].push_back(x);
		outdeg[x]++;
	}
	using P = pair<int,int>;
	set<P> st;
	rep(i,N) st.insert(P(outdeg[i],i));
	V<int> par(N,-1);
	V<int> ord(N);
	rep(t,N){
		P p = *st.begin();
		st.erase(p);
		assert(p.fs == 0);
		int v = p.sc;
		ord[v] = t;
		for(int u:G[v]){
			st.erase(P(outdeg[u],u));
			outdeg[u]--;
			st.insert(P(outdeg[u],u));
		}
	}
	rep(v,N) if(!G[v].empty()){
		for(int u:G[v]){
			if(par[v]==-1 || ord[par[v]] > ord[u]) par[v] = u;
		}
	}
	rep(i,N) cout<<par[i]+1<<endl;
}

Measured memory_bytes: 12160
#[allow(unused_imports)]
use proconio::{fastout, input};

use std::cmp::Reverse;

#[fastout]
fn main() {
    input!(n: usize, mut l: [isize; n]);
    let mut count = 0;
    l.sort_unstable_by_key(|&x| Reverse(x));

    for i in 0..n {
        for j in i + 1..n {
            let a1 = l[i] - l[j];
            let a2 = l[j] - l[i];
            let a3 = l[i] + l[j];
            for k in j + 1..n {
                if a1 < l[k] && a2 < l[k] && l[k] < a3 {
                    count += 1;
                }
            }
        }
    }

    println!("{}", count);
}


Measured memory_bytes: 2228
MOD = 10**9+7
import fractions

def extgcd(a,b): #互いに素なa,bについて、a*x+b*y=1の一つの解
    r = [1,0,a]
    w = [0,1,b]
    while w[2]!=1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    #[x,y]
    return [w[0],w[1]]

def mod_inv(a,mod): # (x/a)%MODをしたい時は x%MOD * mod_inv(a,MOD)%MOD
    x = extgcd(a,mod)[0]
    return (mod+x%mod)%mod


# def gcd(a, b):
#     if b == 0:
#         return a
#     return gcd(b, a%b)

# def lcm(a, b):
#     return a*b//gcd(a,b)

n = int(input())
a = list(map(int, input().split()))

lcm_ = a[0]
for i in range(1, n):
    lcm_ = lcm_ * a[i] // fractions.gcd(lcm_, a[i])

# lcm_ = a[0]
ans = 0
for i in range(0,n):
    # if lcm_ % a[i] != 0:
    #     lcm_new = lcm(lcm_, a[i])
    #     ans = ans*(lcm_new%MOD *mod_inv(lcm_,MOD)%MOD)
    #     lcm_ = lcm_new

    ans += lcm_%MOD * mod_inv(a[i], MOD)%MOD

print(ans%MOD)






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

#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define pb push_back

using namespace std;

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

const int amax = 256;
const ll mod = 1e9 + 7;

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

void mul(ll& a, ll b)
{
    a *= b;
    if (a >= mod) {
        a %= mod;
    }
}

void sub(ll& a, ll b)
{
    a -= b;
    if (a < 0) {
        a += mod;
    }
}

int main()
{

    //freopen("input.txt", "r", stdin);

    //ios_base::sync_with_stdio(false);
    //cin.tie(0);

    int n, k;
    cin >> n >> k;

    vector<vector<ll> > dp(n + 1, vector<ll>(amax));
    dp[0][0] = 1;

    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        for (int len = n - 1; len >= 0; --len) {
            for (int y = 0; y < amax; ++y) {
                add(dp[len + 1][x ^ y], dp[len][y]);
            }
        }
    }

    ll ans = 0;
    ll f = 1;
    for (int len = 0; len <= n; ++len) {
        ll val = dp[len][k];
        if (len) {
            mul(f, len);
        }
        mul(val, f);
        add(ans, val);
    }

    cout << ans << "\n";

}


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

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

    long long int ans = 0;
    long long int L0 = 2, L1 = 1, Li = 1;
    for( int i = 2; i <= N; ++i ){
        Li = L1 + L0;
        L0 = L1;
        L1 = Li;
    }

    cout << Li << endl;

    return 0;
}


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

int f(int x) {
  return (x * x);
}

int main(void) {
  int d, sum;
  
  while(cin >> d) {
    sum = 0;
    for(int i = 1 ; (i * d) <= (600 - d) ; i++) {
      sum += f(i*d) * d; // f(i*d) ツ縦 ツ　ツ　ツ　d ツ可。
    }
    cout << sum << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ff(i,n) for(i=0;i<n;i++)
ll bg=1000000007;
ll gcd(ll a,ll b)
{
if(b==0)
   return a;
else
   return gcd(b,a%b);   
}
ll power(ll x,ll y)
{
	if(y==0)
		return 1;
	ll h=power(x,y/2);	
	h=(h*h)%bg;
	if(y%2==1)
	  return (x*h)%bg;
	else
	  return h%bg;  
}
ll isp(string str) 
{ 
    // Start from leftmost and rightmost corners of str 
    int l = 0; 
    int h = str.length() - 1;
    // Keep comparing characters while they are same 
    while (h > l) 
    { 
        if (str[l++] != str[h--]) 
        {  
            return -1; 
        } 
    } 
    return 1; 
} 
vector<vector<ll> >adj(300000);
void bfs(ll s,ll n,ll d[])
{
	queue<ll> q;
    ll used[n+1]={0};
    vector<ll> p(n+1);
    q.push(s);
    used[s] = 1;
    p[s] = -1;
    d[s]=0;
    while (!q.empty()) {
    ll v = q.front();
    q.pop();
    ll j;
    for (j=0;j<adj[v].size();j++) {
    	ll u=adj[v][j];
        if (used[u]==0) {
            used[u] = 1;
            q.push(u);
            d[u] = d[v] + 1;
            p[u] = v;
        }
    }
   }
}
int main()
{
	ll t;
	t=1;
	while(t--)
	{	
	   ll a,b,c;
	   cin>>a>>b>>c;
	   if(a+b-c>=0)
	   {
	   	   cout<<"No";
	   }
	   else
	   {
	   	   ll g=a+b-c;
	   	   ll f=g*g,h=4*a*b;
	   	   if(f>h)
			  cout<<"Yes";
	   	   else
			  cout<<"No";   
	   }
	}
return 0;
}

Measured memory_bytes: 7296
#include<bits/stdc++.h>
#define Fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;

int main()
{
    Fast;
    long long t,n,m,i,j,k,x=0,y=0,z;
    cin>>n;
    vector<pair<int,string> >v;
    map<string,int>mp;
    string ss[n+5];
    for(int i=0; i<n; i++)
    {
        cin>>ss[i];
        mp[ss[i]]++;
    }
    for(int i=0; i<n; i++)
    {
        if(mp[ss[i]]>0)
        {
            v.push_back({mp[ss[i]],ss[i]});
            mp[ss[i]]=-1;
        }
    }
    sort(v.begin(),v.end());
    reverse(v.begin(),v.end());
    vector<string>s;
    j=0;
    for(int i=0; i<n; i++)
    {
        if(v[i].first==v[0].first)
        {
            s.push_back(v[i].second);
        }
        else
        {
            break;
        }
    }
    sort(s.begin(),s.end());
    for(int i=0;i<s.size();i++){
        cout<<s[i]<<endl;
    }

}


Measured memory_bytes: 33644
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <stack>
using namespace std;

int main(){

    while(1){
        stack<char> s;
        bool isBalance = true;
        string input;

        getline(cin, input);

        if(input[0] == '.' && input[1] == '\0') break;

        for(int i=0;i < input.length() ;i++){
            if(input[i] == '.') break;
            switch(input[i]){
                case '[': s.push(input[i]);
                          break;
                case '(': s.push(input[i]);
                          break;
                case ']':
                          if(s.empty()){ isBalance = false; break;}
                          else if(s.top() != '['){isBalance = false; break;}
                          else s.pop();
                          break;
                case ')':
                          if(s.empty()){ isBalance = false; break;}
                          else if(s.top() != '('){isBalance = false; break;}
                          else s.pop();
                          break;
            }
            if(!isBalance) break;
        }
        if(!isBalance || !s.empty()) cout << "no" << endl;
        else cout << "yes" << endl;

    }
    return 0;
}

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

#define mod      1e9+7;
#define INF      1e9+9;
#define ps(x,y)  fixed<<setprecision(y)<<x
typedef long long ll;
typedef unsigned long long ull;
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
#ifndef ONLINE_JUDGE
//	freopen("input.txt","r",stdin);
//	freopen("output.txt","w",stdout);
#endif
	ll a,b,c,k;
	cin>>a>>b>>c>>k;
	if(k<=a)  cout<<k<<endl;
	else if(k<=a+b)  cout<<a<<endl;
	else if(k<=a+b+c)  cout<<a+a+b-k<<endl;
	else cout<<"nothing\n";

	return 0;
}

Measured memory_bytes: 3640
#include<iostream>
#include<complex>
#include<cmath>
#include<set>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)
const double eps = 1e-10;
typedef complex<double> P;

class Point{
public:
  double x,y;
  Point();
  Point(P a){
    x=a.real();y=a.imag();
  }
  bool operator<(const Point& a)const{
    if ( abs(x-a.x)>=eps)return x<a.x;
    else if ( abs(y-a.y)>=eps)return y < a.y;
    return false;
  }
};

double cross(P a,P b){
  return a.real()*b.imag()-a.imag()*b.real();
}

bool is_intersected_ls(P a1,P a2,P b1,P b2){
  
  if (  cross(a2-a1,b1-a1)*cross(a2-a1,b2-a1)<0 && 
	cross(b2-b1,a1-b1)*cross(b2-b1,a2-b1)<0)return true;
  return false;
}

P intersection_ls(P a1,P a2,P b1,P b2){
  P b=b2-b1;
  double d1=abs(cross(b,a1-b1));
  double d2=abs(cross(b,a2-b1));
  double t = d1/(d1+d2);
  return a1+(a2-a1)*t;
}

int solve(P *a,P *b,int n){
  int cnt=2;
  REP(i,1,n){
    set<Point> S;
    rep(j,i){
      if ( is_intersected_ls(a[i],b[i],a[j],b[j]))
	S.insert(Point(intersection_ls(a[i],b[i],a[j],b[j])));
    }
    cnt+=S.size()+1;
  }
  

  return cnt;
}


main(){
  int n;
  while(cin>>n && n){
    P a[n],b[n];
    rep(i,n)cin>>a[i].real()>>a[i].imag()>>b[i].real()>>b[i].imag();
    cout << solve(a,b,n)<<endl;
  }
}
  

Measured memory_bytes: 972
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def main():
    x1, y1, x2, y2 = in_nn()

    ans = 'R' * (x2 - x1) + 'U' * (y2 - y1)
    ans += 'L' * (x2 - x1) + 'D' * (y2 - y1)
    ans += 'L'
    ans += 'U' * (y2 - y1 + 1) + 'R' * (x2 - x1 + 1)
    ans += 'D'
    ans += 'R'
    ans += 'D' * (y2 - y1 + 1) + 'L' * (x2 - x1 + 1)
    ans += 'U'

    print(ans)


if __name__ == '__main__':
    main()


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

#define M 1000000007
#define MM 998244353 
#define ll long long 
#define pb push_back
#define mem0(a) memset(a,0,sizeof(a))
#define mem1(a) memset(a,-1,sizeof(a))
#define memf(a) memset(a,false,sizeof(a))
#define all(v) v.begin(),v.end()
#define sz(a) (ll)a.size()
#define F first
#define S second
#define PI 3.1415926536
#define INF 2000000000000000000
#define endl "\n"
#define _time_ 1.0 * clock() / CLOCKS_PER_SEC
#define popcount(x) __builtin_popcountll(x)
//RNG based on mersenne_twister 
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
ll power(ll b,ll e,ll m)
{
	if(e==0) return 1;
	if(e&1) return b*power(b*b%m,e/2,m)%m;
	return power(b*b%m,e/2,m);
}
ll power( ll b, ll e)
{
	if(e==0) return 1;
	if(e&1) return b*power(b*b,e/2);
	return power(b*b,e/2);
}
template<typename T, typename U> static inline void amin(T &x, U y){ if(y<x) x=y; }
template<typename T, typename U> static inline void amax(T &x, U y){ if(x<y) x=y; }


int _runtimeTerror_()
{
	ll n;
	cin>>n;
	set<string> ss;
	string s;
	while(n--)
	{
		cin>>s;
		ss.insert(s);
	}
	cout<<sz(ss)<<endl;
	return 0;
}

int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	#ifdef runSieve
		sieve();
	#endif
	#ifdef NCR
		initialize();
	#endif
	int TESTS=1;
	//cin>>TESTS;
	while(TESTS--)
		_runtimeTerror_();
	cerr<<"\n"<<_time_;
	return 0;
}


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

int main() {
  int a,c;
  cin >> a;
  int b = 1;
  bool exist = false;
  for(int i = 0;i<a;i++){
    cin >> c;
    if(c==b){
      b++;
      exist = true;
    }
  }
  if(exist)cout << a - b + 1 << endl;
  else cout << -1 << endl;
}

Measured memory_bytes: 3672
#include <iostream>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <string>
#include <set>
#include <iomanip>
#include <map>
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
using ll = long long;

int main(){
    string s;
    cin >> s;
    if(s == "SUN") cout << 7 << endl;
    if(s == "MON") cout << 6 << endl;
    if(s == "TUE") cout << 5 << endl;
    if(s == "WED") cout << 4 << endl;
    if(s == "THU") cout << 3 << endl;
    if(s == "FRI") cout << 2 << endl;
    if(s == "SAT") cout << 1 << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
  int a=0,w,h,x,y,r;
  scanf("%d %d %d %d %d",&w,&h,&x,&y,&r);
  if(x-r>=0 && x+r<=w){
    if(y-r>=0 && y+r<=h){
      printf("Yes\n");
      a=1;
    }
  }
  if(a==0)printf("No\n");
  return 0;
}

Measured memory_bytes: 584
#include <iostream>
#include <algorithm>
#include <limits>
#include <vector>
#include <map>
#include <cmath>
#include <limits>
#define ll long long int
#define rep(i,n) for(int i = 0;i < n;i++)
#define pb push_back
#define mp make_pair

using namespace std;

int main(){

    int n;
    cin >> n;
    int max = n * 1.08 + 100000;
    int tmp;
    rep(i,max){
        tmp = (int)i*1.08;
        if(tmp == n){
            cout << i << endl;
            return 0;
        }
    }
    cout << ":(" << endl;

    return 0;
}

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

signed main(void)
{
	string s;
	cin >> s;
	if (s[s.size() - 1] != 's')
		cout << s << 's' << endl;
	else
		cout << s << "es" << endl;
	return 0;
}


Measured memory_bytes: 3596
#include <cstdio>
#include <iostream>
#include <array>
#include <vector>
#include <deque>
#include <string>
#include <algorithm>
#include <functional>
#include <tuple>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <utility>
#include <memory>
#include <valarray>
#include <climits>

using namespace std;

using ll = long long int;

#define loop(i, N) for (int i = 0; i < N; ++i)
#define scanInt(x) int x; scanf("%d", &x); getchar();
#define scanLLInt(x) ll x; scanf("%lld", &x); getchar();
#define scanVecInt(A, N) vector<int> A(N); loop(i, N){scanf("%d", &(A[i])); getchar();}
#define scanVecLLInt(A, N) vector<ll> A(N); loop(i, N){scanf("%lld", &(A[i])); getchar();}

int main()
{
    scanLLInt(N);
    if (N % 2 == 0){
        printf("%lld %lld %lld\n", N / 2, N, N);
        return 0;
    }
    if (N % 3 == 0){
        printf("%lld %lld %lld\n", N / 3, N * 2, N * 2);
        return 0;
    }
    for (ll h = 1; h <= 3500; ++h){
        if (4 * h <= N) continue;
        for (ll n = h; n <= 3500; ++n){
            if (4 * h * n <= N * (h + n)) continue;
            for (ll w = n; w <= 3500 && 4 * h * n * w <= N * (n * w + w * h + h * n); ++w){
                if (4 * h * n * w == N * (n * w + w * h + h * n)){
                    printf("%lld %lld %lld\n", h, n, w);
                    return 0;
                }
            }
        }
    }
    // for (ll h = 3500; 1 <= h && 4 * h >= N; --h){
    //     for (ll n = h; 1 <= n && 4 * h * n >= N * (h + n); --n){
    //         for (ll w = n; 1 <= w && 4 * h * n * w >= N * (n * w + w * h + h * n); --w){
    //             if (4 * h * n * w == N * (n * w + w * h + h * n)){
    //                 printf("%lld %lld %lld\n", h, n, w);
    //                 return 0;
    //             }
    //         }
    //     }
    // }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> ordered_set;

#define scan(x) do{while((x=getchar())<'0'); for(x-='0'; '0'<=(_=getchar()); x=(x<<3)+(x<<1)+_-'0');}while(0)
char _;
#define complete_unique(a) a.erase(unique(a.begin(),a.end()),a.end())
#define all(a) a.begin(),a.end()
#define println printf("\n");
#define readln(x) getline(cin,x);
#define pb push_back
#define endl "\n"
#define INT_INF 0x3f3f3f3f
#define LL_INF 0x3f3f3f3f3f3f3f3f
#define MOD 1000000007
#define MOD2 1494318097
#define SEED 131
#define mp make_pair
#define fastio cin.tie(0); cin.sync_with_stdio(0);

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef unordered_map<int,int> umii;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef pair<int,pii> triple;
typedef int8_t byte;

mt19937 g1(time(0));

int randint(int a, int b){return uniform_int_distribution<int>(a, b)(g1);}
ll randlong(ll a,ll b){return uniform_int_distribution<ll>(a, b)(g1);}

ll gcd(ll a, ll b){return b == 0 ? a : gcd(b, a % b);}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
//ll fpow(ll  b, ll exp, ll mod){if(exp == 0) return 1;ll t = fpow(b,exp/2,mod);if(exp&1) return t*t%mod*b%mod;return t*t%mod;}
//ll divmod(ll i, ll j, ll mod){i%=mod,j%=mod;return i*fpow(j,mod-2,mod)%mod;}

//ll fmul(ll a, ll b, ll mod){ll res=0;while(a){if(a&1)res=(res+b)%mod;a>>=1;b=(b<<1)%mod;}return res;}
//ll fpowfast(ll b, ll exp, ll mod){ll res=1;while(exp){if(exp&1)res=fmul(res,b,mod);b=fmul(b,b,mod);exp>>=1;}return res;}
//inline bool rabbin_miller(ll x){if(x%2==0) return false;for(int i=0;i<5;i++){ll rd=randlong(2,x-2);if(fpowfast(rd,x-1,x)!=1)return false;}return true;}

ll A,B,res=1;

ull fmul(ull a, ull b, ull mod){
	ull res = 0;
	while(a){
		if(a&1) res = (res+b)%mod;
		a>>=1;
		b = (b<<1)%mod;
	}
	return res;
}

ull fpow(ull b, ull exp, ull mod){
	ull res = 1;
	while(exp){
		if(exp&1) res = fmul(res,b,mod);
		b = fmul(b,b,mod);
		exp>>=1;
	}
	return res;
}

inline bool prim(ll x){
	if(x == 2 || x == 3) return true;
//	if(x%2 == 0) return false;
	for(int i=0; i<30; i++){
		ll rd = randlong(2,x-2);
		if(fpow(rd,x-1,x) != 1)
			return false;
	}
	return true;
}

//inline bool prim(ull x){
//	if(x == 2) return true;
//	ull lim = sqrt(x);
//	while(lim*lim < x) lim++;
//	while(lim*lim > x) lim--;
//	for(ull k=2; k<=lim; k++){
//		if(x%k == 0) return false;
//	}
//	return true;
//}

int main(){
	scanf("%lld %lld",&A,&B);
	ll gg = __gcd(A,B);
	ll lim = sqrt(gg);
	while(lim*lim < gg) lim++;
	while(lim*lim > gg) lim--;
	for(ll i=2; i<=lim; i++){
		if(gg%i == 0){
			if(prim(i))
				res++;
			if(i*i != gg && prim(gg/i))
				res++;
		}
	}
	if(prim(gg) && gg != 1) res++;
	printf("%lld\n",res);
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<list>
#include<algorithm>
#include<cstring>
#include<string>
#include<queue>
#include<cmath>
using namespace std;
int main(void)
{
	int n;
	int a;
	int flag=0;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		scanf("%d",&a);
		if(a%2==0)
			if(a%3!=0&&a%5!=0)
				flag=1;
	}
	if(flag==0)
		cout<<"APPROVED"<<endl;
	else
		cout<<"DENIED"<<endl;
	return 0;

}

Measured memory_bytes: 256
from operator import itemgetter
n = int(input())
data = []
for _ in range(n):
    x,y,h = map(int,input().split())
    data.append((x,y,h))
data.sort(key=itemgetter(2),reverse=True)
for x in range(101):
    for y in range(101):
        c = -1
        for a,b,h in data:
            if c == -1:
                c = h+abs(a-x)+abs(b-y)
            else:
                if h != max(c-abs(a-x)-abs(y-b),0):
                    break
        else:
            print(x,y,c)
            exit()

Measured memory_bytes: 3064