akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010

typedef long double ld;

bool solve(){
  int n;
  double px[SIZE], py[SIZE], pz[SIZE], vx[SIZE], vy[SIZE], vz[SIZE], r[SIZE], vr[SIZE];
  double ans[SIZE] = {};
  
  scanf("%d", &n);

  if(n == 0) return false;

  for(int i=0;i<n;i++){
    scanf("%lf%lf%lf%lf%lf%lf%lf%lf", px+i, py+i, pz+i, vx+i, vy+i, vz+i, r+i, vr+i);
    ans[i] = r[i] / vr[i];
  }

  vector<pair<double,pair<int,int> > > vec;
  
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      ld maxT = min(r[i] / vr[i], r[j] / vr[j]);
      
      ld x = px[i] - px[j], y = py[i] - py[j], z = pz[i] - pz[j];
      ld rvx = vx[i] - vx[j], rvy = vy[i] - vy[j], rvz = vz[i] - vz[j];
      ld rr = r[i] + r[j], rvr = vr[i] + vr[j];

      ld X = rvx * rvx + rvy * rvy + rvz * rvz - rvr * rvr;
      ld Y = 2 * (x * rvx + y * rvy + z * rvz + rr * rvr);
      ld Z = x * x + y * y + z * z - rr * rr;

      if(Y * Y - 4 * X * Z < 0) continue;

      ld ans1 = (- Y + sqrt(Y*Y - 4 * X * Z)) / 2 / X;
      ld ans2 = (- Y - sqrt(Y*Y - 4 * X * Z)) / 2 / X;

      if(ans1 > maxT || 0 > ans1) ans1 = INF;
      if(ans2 > maxT || 0 > ans2) ans2 = INF;

      if(min(ans1, ans2) != INF) vec.push_back({(double)min(ans1, ans2),{i,j}});
    }
  }
  
  sort(vec.begin(), vec.end());

  int used[SIZE] = {};
  
  for(int i=0;i<vec.size();i++){
    int a = vec[i].second.first;
    int b = vec[i].second.second;
    
    if(!used[a] && !used[b]){
      ans[a] = min(ans[a], vec[i].first);
      ans[b] = min(ans[b], vec[i].first);
      used[a] = used[b] = true;
    }
  }

  for(int i=0;i<n;i++){
    printf("%.10lf\n", ans[i]);
  }
  
  return true;
}

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



Measured memory_bytes: 4460
#include<bits/stdc++.h>
using std::cout;
using std::cin;
using std::endl;

/* 引数がうまくいかん
std::string shuffle(std::string str, int x)
{
    std::string str__;
    cout << str << endl;
    std::string s = str.substr(0, x); //部分文字列を返す
    str.erase(0, x); //頭からx文字分削除
    cout << str << endl;
    str += s; //末尾にsを追加
    cout << str << endl;

    str__ = str;

     return str__;
}*/

int main()
{
    std::vector<std::string> str(11);
    int i=0;

    while (1)
    {
        std::string s;
        int m=0, x;
        cin >> s;
        if (s == "-")
            break;
        
        str[i] = s;

        cin >> m;
        for (int j = 0; j < m; ++j)
        {
            cin >> x;
            std::string s__ = str[i].substr(0, x); //部分文字列を返す
            str[i].erase(0, x); //頭からx文字分削除
            str[i] += s__; //末尾にsを追加
        }
        i++;
    }

    for (int j = 0; j < i; j++)
        cout << str[j] << endl;
        

    return 0;
}


Measured memory_bytes: 3216
#include<bits/stdc++.h>
using namespace std;
#define REP(i,st,ed) for(register int i=st,i##end=ed;i<=i##end;++i)
#define DREP(i,st,ed) for(register int i=st,i##end=ed;i>=i##end;--i)
typedef long long ll;
template<typename T>inline bool chkmin(T &x,T y){return (y<x)?(x=y,1):0;}
template<typename T>inline bool chkmax(T &x,T y){return (y>x)?(x=y,1):0;}
inline int read(){
	int x;
	char c;
	int f=1;
	while((c=getchar())!='-' && (c>'9' || c<'0'));
	if(c=='-') f=-1,c=getchar();
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1)+(x<<3)+(c^'0');
	return x*f;
}
inline ll readll(){
	ll x;
	char c;
	int f=1;
	while((c=getchar())!='-' && (c>'9' || c<'0'));
	if(c=='-') f=-1,c=getchar();
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1ll)+(x<<3ll)+(c^'0');
	return x*f;
}
const int maxn=3e3+10,mod=1e9+7;
char s[maxn];
int sum[maxn],dp[maxn][maxn],L[maxn],R[maxn],C[maxn][maxn];
int main(){
	int n=read(),m=read();
	scanf("%s",s+1);
	REP(i,1,n) sum[i]=sum[i-1]+(s[i]=='1');
	REP(i,0,n){
		C[i][0]=C[i][i]=1;
		REP(j,1,i-1) C[i][j]=(C[i-1][j]+C[i-1][j-1])%mod;
	}
	int tmp=0,lst=0;
	REP(i,1,m){
		int x=read(),y=read();
		if(y<=lst) continue;
		L[++tmp]=x,R[tmp]=y;
		lst=y;
	}
	dp[0][0]=1;
	L[tmp+1]=n+1;
	REP(i,1,tmp){
		if(L[i+1]>R[i]){
			REP(j,0,max(R[i-1]-L[i]+1,0)) if(dp[i-1][j]){
				int u=j+sum[R[i]]-sum[max(R[i-1],L[i]-1)];
				dp[i][0]=(dp[i][0]+(ll)C[R[i]-L[i]+1][u]*dp[i-1][j])%mod;
			}
			continue;
		}
		REP(j,0,max(R[i-1]-L[i]+1,0)) if(dp[i-1][j]){
			int u=j+sum[R[i]]-sum[max(R[i-1],L[i]-1)];
			REP(k,max(u-R[i]+L[i+1]-1,0),min(u,L[i+1]-L[i]))
				dp[i][u-k]=(dp[i][u-k]+(ll)dp[i-1][j]*C[L[i+1]-L[i]][k])%mod;
		}
	}
	printf("%d\n",dp[tmp][0]);
	return 0;
}


Measured memory_bytes: 52224
#include <set>
#include <map>
#include <queue>
#include <cmath>
#include <vector>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
int Gcd(int a,int b){if (b == 0) return a; return Gcd(b , a%b);}
int Lcm(int a, int b){ return a/Gcd(a,b)*b;}
inline int read(){
    int f = 1, x = 0;char ch = getchar();
    while (ch > '9' || ch < '0'){if (ch == '-')f = -f;ch = getchar();}
    while (ch >= '0' && ch <= '9'){x = x * 10 + ch - '0';ch = getchar();}
    return x * f;
}
const int maxn = 1e5 + 10;
const int mod = 1e9 + 7;
int main(){
    int n = read(),m = read();
    if (abs(n-m) > 1) {
        cout << 0 << endl;
        return 0;
    }
    LL ans1 = 1,ans2 = 1;
    for(int i=1; i<=n; i++){
        ans1 = ans1 * i % mod;
    }   
    for(int i=1; i<=m; i++){
        ans2 = ans2 * i % mod;
    }
    LL ans = (ans1 * ans2) % mod;
    if ((n & 1) == (m & 1))ans = ans * 2 % mod;
    cout << ans << endl;
    return 0;
}

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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;++A)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

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

ll N;
ll i, j, k, ans;
bool mk[1010101];
int main(){
    scanf("%lld", &N);
    fornum(i,2,1000000){
        if(mk[i])
            continue;
        if(i>=N){
            break;
        }
        for (j = i; j < 1000000;j+=i){
            mk[j] = true;
        }
    }
    printf("%lld", i);
    return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  int n;
  cin>>n;
  vi x(n),y(n);
  rep(i,n)cin >> x[i] >> y[i];
  vi root;
  rep(i,n){
    root.push_back(i);
  }
  double ans = 0,cnt = 0;
  do{
    double tmp = 0;
    rep(i,n-1){
      int l = root[i];
      int r = root[i+1];
      tmp+=sqrt((x[r]-x[l])*(x[r]-x[l])+(y[r]-y[l])*(y[r]-y[l]));
    }
    ans+=tmp;
    cnt++;
  }while(next_permutation(rng(root)));
  //show(cnt);
  ans/=cnt;
  printf("%.10f\n",ans);
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define ff first
#define ss second
#define nl '\n'
/* -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- */

#define allOf(x) (x).begin(), (x).end()

template <typename P, typename Q>
ostream&operator<<(ostream&os, const pair<P, Q>&p)
{return os << '(' << p.first << ", " << p.second << ')';}
template <typename K, typename V>
ostream&operator<<(ostream&os, const map<K, V>&v)
{os << '['; for(const auto&it:v) (os << it) << ", "; return os << ']';}
template <typename T> ostream&operator<<(ostream&os, const set<T>&v)
{os << '['; for(const auto&it:v) (os << it) << ", "; return os << ']';}
template <typename T> ostream&operator<<(ostream&os, const vector<T>&v)
{os << '['; for(const auto&it:v) os << it << ", "; return os << ']';}

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

/* -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- */

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

  int n; cin >> n;
  ll k; cin >> k;
  vector<ll> v(n);
  for(auto&x:v) cin >> x;
  sort(allOf(v));
  int ans = 0, idx = 0;
  for(auto&x:v) {
    if( x <= k ) {
      if( idx == n-1 ) {
	if( x == k )
	  ans++;
      } else {
	ans++;
      }
      k-=x;
    } else {
      break;
    }
    idx++;
  }
  cout << ans << endl;

  return 0;
}

/* -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- -*- */


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define vi               vector<int>
#define pb(x)            push_back(x)
#define all(x)           x.begin(), x.end()
#define sortall(x)       sort(all(x))
#define debug(x)         cout << '>' << #x << ':' << x << endl;
#define int              long long
// const int mod = 1000000007;
using namespace std;
// const int N = 1e5 + 5; 
// int n;
// int a[N];

int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int h1,m1,h2,m2,k;
  cin >> h1 >> m1 >> h2 >> m2 >> k;
  // cin >> n;
  int total;
total =  (m2 -m1) + (h2 - h1 )*60;
  // if(k >= 60){
    // h1 = h1 + k/60;
    // k = k -60;
  // }
if(total - k >= 0){
cout << total - k << endl;

}
else{
  cout << 0 << endl;
}


// cout << n;
return 0;
}

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

int main(){
               string S;cin >> S;
               int flag=0;
               for (int i=0;i < 4; i++) {
                              for (int j = 0; j < 4; j++) {
                                             if (S[i] == S[j])flag++;
                              }
               }
               if (flag == 8){
                              cout << "Yes" <<endl;
               }else{
                              cout << "No" <<endl;
               }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
 
static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const ll INF = 1023456789;
 
#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,s,n)	for(int i=s;i<n;++i)
#define FORR(i,s,n)	for(int i=n-1;i>=s;--i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define F			first
#define S			second
 
int main(int argc, char **argv) {
	char a, b, c;
	cin >> a >> b >> c;
	cout << (a - '0' + b - '0' + c - '0') << endl;
	return 0;
}
 

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

string s;
long long int sum;
long long int ma;
long long int lens;
long long int t;
int main()
{
	cin >> s;
	lens = s.length();
	if (lens == 1)sum = 0;
	else
	{
		for (long long int i=0;i<lens;i++)
		{
			if (s[i] == 'B')sum++;
			else ma += sum;
		}
	}
	cout << ma;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T, class U> using Pa = pair<T, U>;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vec<int> A(N),B(N);
    for(int i=0;i<N;i++){
        cin >> A[i] >> B[i];
    }
    int inf = 2e9+1;
    if(N%2==1){
        sort(A.begin(),A.end());
        sort(B.begin(),B.end());
        int a = A[N/2],b = B[N/2];
        cout << b-a+1 << "\n";
    }else{
        sort(A.begin(),A.end());
        sort(B.begin(),B.end());
        int a = A[N/2-1]+A[N/2],b = B[N/2-1]+B[N/2];
        cout << b-a+1 << "\n";
    }
}

Measured memory_bytes: 4756
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define zep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(ll i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

int main(){
	cin.tie(0); ios::sync_with_stdio(false);
	
	ll a, b;
	cin >> a >> b;
	
	rep(i, 1, 2000){
		if(i*8/100 == a && i*10/100 == b){
			print(i)
			return 0;
		}		
	}
	print(-1)
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define pb push_back
#define fs first
#define se second
#define M 1000000007
#define pii pair<long long,long long>
 
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
unordered_map<char,pii>dir;
ll D=1e9;
 
bool check(ll x,ll y,ll n,ll m){
	return (x>=0 && y>=0 && n>x && m>y);
}

int main()
{
	ios_base::sync_with_stdio(false);
	
	ll n,k;
	cin>>n>>k;
	vector<ll>arr(n),ans;
	for(ll i=0;i<n;i++)
		cin>>arr[i];

	for(ll i=k;i<n;i++)
	{
		if(arr[i]>arr[i-k])
			ans.pb(1);
		else
			ans.pb(0);

	}

	for(auto i:ans)
	{	if(i==1)
			cout<<"Yes";
		else
			cout<<"No";

	cout<<endl;}



}



Measured memory_bytes: 6888
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<vector>
#define ll long long
using namespace std;
const int wa=1e9+7;
int N, a[100];
int cnt = 0;
int main(void) {
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	bool flag = 1;
	while (flag) {
		flag = 0;
		for (int i = N - 1; i > 0; i--) {
			if (a[i - 1] > a[i]) {
				int v = a[i];
				a[i] = a[i - 1];
				a[i - 1] = v;
				flag = 1;
				cnt++;
			}
		}
	}
	for (int i = 0; i < N; i++) {
		cout << a[i];
		if (i != N - 1)cout << " ";
	}
	cout << endl;
	cout << cnt << endl;
	return 0;
}




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

int main() {
    int M, N;
    while (cin >> M >> N, N || M) {
        vector<bool> v(7368792);

        int i = M, count = 0;
        while (1) {
            if (!v[i]) {

                if (count == N) {
                    cout << i << endl;
                    break;
                }
                v[i] = true;
                for (int j = 2; j * i < v.size(); j++) {
                    v[i*j] = true;
                }
                count++;
            }
            i++;
        }
    }

    return 0;
}

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

struct UnionFind{
    vector<int> par;
    UnionFind(int n) : par(n){
        rep(i,n) par[i]=i;
    }
    int root(int x){
        if(par[x]==x) return x;
        return par[x]=root(par[x]);
    }
    void unite(int x, int y){
        int rx=root(x);
        int ry=root(y);
        if(rx==ry) return;
        par[rx]=ry;
    }
    bool same(int x, int y){
        int rx=root(x);
        int ry=root(y);
        return rx==ry;
    }
};
int main(){
    int n,m;
    cin>>n>>m;
    UnionFind tree(n);
    int a,b;
    rep(i, m){
        cin>>a>>b;
        a--;b--;
        tree.unite(a,b);
    }
    vector<int> ans(n);
    rep(i,n){
        ans[tree.root(i)]++;
        //cout<<tree.par[i]<<endl;
    }
    sort(ans.begin(),ans.end(), greater<int>());
    cout<<ans[0]<<endl;
}

Measured memory_bytes: 11100
#include<iostream>
#include<algorithm>
#include<string>

using namespace std;

int main() {
	int n, ans=0;
	int d[50];
	cin >> n;
	for (int i = 0; i < n; i++)cin >> d[i];
	for (int i = 0; i < n; i++) {
		for (int j = i+1; j < n; j++) {
			ans += d[i] * d[j];
			
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
/* 	* In the name of GOD 
	* Thanks God */
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
#define F first
#define S second
const int N = 10112;
int a[N], b[N];

void solve() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i] >> b[i];
	for (int i = 0; i < n - 2; i++) {
		if (a[i] == b[i] && a[i + 1] == b[i + 1] && a[i + 2] == b[i + 2]) {
			cout << "Yes";
			return;
		}
	}
	cout << "No";
}

int32_t main() {
	int t = 1;
//	cin >> t;
	while (t--) {
		solve();
	}
}


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

using namespace std;

int main() {
	int antennas[5];
	for (int i = 0; i < 5; i++) cin >> antennas[i];
	int k;
	cin >> k;
	string ans = "Yay!";
	for (int i = 0; i < 4; i++) {
		for (int j = i + 1; j < 5; j++) {
			if (antennas[j] - antennas[i] > k) ans = ":(";
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3620
#C
n, m = map(int, input().split())
a = [1] * (n + 1)
mod=1e9+7
for i in range(m):
    a[int(input())] = 0
b = [1] * (n + 1)
if a[1] == 0:
    b[1] = 0
for i in range(2, n + 1):
    b[i] = int(a[i] * (b[i - 2] + b[i - 1]) % mod)
print(b[n])

Measured memory_bytes: 7768
import java.util.Iterator;
import java.util.PrimitiveIterator;
import java.util.Scanner;
import java.util.function.Supplier;
import java.util.stream.IntStream;
import java.util.stream.Stream;

public class Main{
	static Scanner s=new Scanner(System.in);

	void solve(){
		int n=gInt();
		int r=0;
		for(int i:ints(n)) {
			while(i%2==0) {
				++r;
				i/=2;
			}
		}
		System.out.println(r);
	}
	
	public static void main(String[] A){
		new Main().solve();
	}

	static int gInt(){
		return Integer.parseInt(s.next());
	}
	static long gLong(){
		return Long.parseLong(s.next());
	}
	static double gDouble(){
		return Double.parseDouble(s.next());
	}

	SupplyingIterator<Integer> ints(int n){
		return new SupplyingIterator<>(n,Main::gInt);
	}
	SupplyingIterator<Long> longs(int n){
		return new SupplyingIterator<>(n,Main::gLong);
	}
	SupplyingIterator<Double> doubles(int n){
		return new SupplyingIterator<>(n,Main::gDouble);
	}
	SupplyingIterator<String> strs(int n){
		return new SupplyingIterator<>(n,s::next);
	}

	Range rep(int i){
		return Range.rep(i);
	}
	Range rep(int f,int t,int d){
		return Range.rep(f,t,d);
	}
	Range rep(int f,int t){
		return rep(f,t,1);
	}
	Range rrep(int f,int t){
		return rep(t,f,-1);
	}

	IntStream REP(int v){
		return IntStream.range(0,v);
	}
	IntStream REP(int l,int r){
		return IntStream.rangeClosed(l,r);
	}

	IntStream INTS(int n){
		return IntStream.generate(Main::gInt).limit(n);
	}
	Stream<String> STRS(int n){
		return Stream.generate(s::next).limit(n);
	}

}
class SupplyingIterator<T> implements Iterable<T>,Iterator<T>{
	int			t;
	Supplier<T>	supplier;

	SupplyingIterator(int t,Supplier<T> supplier){
		this.t=t;
		this.supplier=supplier;
	}

	@Override
	public Iterator<T> iterator(){
		return this;
	}

	@Override
	public boolean hasNext(){
		return t>0;
	}

	@Override
	public T next(){
		--t;
		return supplier.get();
	}

}
class Range implements Iterable<Integer>,PrimitiveIterator.OfInt{
	int to,cur,d;

	Range(int from,int to,int d){
		this.cur=from-d;
		this.to=to;
		this.d=d;
	}

	Range(int n){
		this(0,n-1,1);
	}

	@Override
	public Iterator<Integer> iterator(){
		return this;
	}

	@Override
	public boolean hasNext(){
		return cur+d==to||(cur!=to&&(cur<to==cur+d<to));
	}

	@Override
	public int nextInt(){
		return cur+=d;
	}

	static Range rep(int i){
		return new Range(i);
	}
	static Range rep(int f,int t,int d){
		return new Range(f,t,d);
	}
	static Range rep(int f,int t){
		return rep(f,t,1);
	}
	static Range rrep(int f,int t){
		return rep(f,t,-1);
	}

}

Measured memory_bytes: 32904
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
from heapq import heapify, heappop, heappush
import math
import random
import string
from copy import deepcopy
from itertools import combinations, permutations, product
from operator import mul, itemgetter
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

#############
# Main Code #
#############

N = getN()
que = [getList() for i in range(N)]

cnt = 0
ans = 0

for a, b in que:
    if a == b:
        cnt += 1
    else:
        ans = max(ans, cnt)
        cnt = 0

ans = max(ans, cnt)

if ans >= 3:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 83444
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define fi first
#define se second
#define FOR(i,n) for(int i = 0;i<n;i++)
#define rep(i,s,n) for(int i = s;i<n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
const ll MOD=998244353,INF=1ll<<60;
 
int N;
 
signed main() {
    IOS();
    cin>>N;
    vint a;
    rep(i,0,N){
        int t;
        cin>>t;
        t--;
        if(t>i){
            cout<<-1<<endl;
            return 0;
        }
        a.pb(t);
    }
    
    vint ans;
    rep(i,0,N){
        int sz=(int)a.size();
        int ma=-1;
        rep(j,0,sz){
            if(a[j]==j)chmax(ma,j);
        }
        ans.pb(ma);
        a.erase(a.begin()+ma);
    }
    
    
    rrep(i,0,(int)ans.size()){
        cout<<ans[i]+1<<endl;
    }
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    return 0;
}

Measured memory_bytes: 256
import java.util.ArrayDeque

fun main() {
    val (n, m) = readLine()!!.split(" ").map(String::toInt)

    val map = Array(n) { mutableListOf<Int>() }

    repeat(m) {
        val (a, b) = readLine()!!.split(" ").map { it.toInt() - 1 }
        map[a].add(b)
        map[b].add(a)
    }

    val ans = Array(n) { -1 }
    ans[0] = 0

    val que = ArrayDeque<Int>()
    que.addLast(0)

    while (que.isNotEmpty()) {
        val v = que.removeFirst()

        map[v].forEach {
            if (ans[it] != -1) return@forEach

            ans[it] = v + 1
            que.addLast(it)
        }
    }

    println("Yes")
    ans.takeLast(n - 1).forEach {
        println(it)
    }
}

Measured memory_bytes: 86428
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd, ceil
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')


def solve():
    # n, m = [int(x) for x in input().split()]
    n = int(input())
    ans = (n // 11)*2
    n %= 11

    if n > 6:
        ans += 2
    elif n:
        ans += 1
    print(ans)
    
    
t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""

R s
S p
P r

"""


Measured memory_bytes: 9488
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

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

// x ** n % mods を求める
pub fn mod_pow(x: i64, n: i64, mods: i64) -> i64 {
    if n == 0 {
        return 1;
    }
    let mut res = mod_pow(x * x % mods, n / 2, mods);
    if n % 2 == 1 {
        res = res * x % mods;
    }
    return res;
}

// (1/n) % mods を求める
pub fn mod_inv(n: i64, mods: i64) -> i64 {
    return mod_pow(n, mods-2, mods);
}

// nCk % mods を求める
pub fn mod_comb(n: i64, k: i64, mods: i64) -> i64 {
    let sum1 = (n-k+1..n+1).fold(1, |ac, x| ac * x % mods);
    let sum2 = (1..k+1).fold(1, |ac, x| ac * x % mods);
    return sum1 * mod_inv(sum2, mods) % mods;
}


fn main() {
    input!{
        n: i32,
        m: i32,
        a: [i32; m],
    }
    let mut result = n;
    for item in a.iter() {
        result = result - item;
    }
    if result < 0 {
        println!("-1");
    }
    else {
        println!("{}", result);
    }
}


Measured memory_bytes: 2128
let () = Scanf.scanf "%d" @@ fun n ->
  let n = n lor (n lsr 1) in
  let n = n lor (n lsr 2) in
  let n = n lor (n lsr 4) in
  let n = n lor (n lsr 8) in
  let n = n lor (n lsr 16) in
  let n = (n land 0x55555555) + ((n lsr 1) land 0x55555555) in
  let n = (n land 0x33333333) + ((n lsr 2) land 0x33333333) in
  let n = (n land 0x0f0f0f0f) + ((n lsr 4) land 0x0f0f0f0f) in
  let n = (n land 0x00ff00ff) + ((n lsr 8) land 0x00ff00ff) in
  let n = (n land 0x0000ffff) + ((n lsr 16) land 0x0000ffff) in
  Printf.printf "%d\n" @@ 1 lsl (n - 1)


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

using namespace std;
#define DBG(x)                         \
    (void)(cout << "L" << __LINE__     \
                << ": " << #x << " = " \
                << (x) << '\n')
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int maxn = 110000;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setiosflags(ios::fixed) << setprecision(12);
    string s;
    cin >> s;
    if (s[0] == s[1] && s[1] == s[2])
        cout << "No\n";
    else
        cout << "Yes\n";
    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.buffer.readline

H, N = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]
INF = 10 ** 15

dp = [INF] * (H + 1)
dp[0] = 0
for a, b in AB:
  for i in range(H):
    if dp[i] != INF:
      dp[min(i + a, H)] = min(dp[min(i + a, H)], dp[i] + b)

print(dp[-1])

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

int main() {
  int64_t a, sum;
  cin >> a;
 
  sum = 0;
  for(int i = 1; i < a+1; i++){
    for(int j = 1; j < a+1; j++){
      for(int k = 1; k < a+1; k++){
        sum += gcd(i, gcd(j, k));
      }
    }
  }
  cout << sum;
}









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

int A, B, K;

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

    vector<int> ans;
    for (int i = 0; i < K && A+i <= B-i; i++) {
        if (A+i != B-i) {
            ans.push_back(A+i);
            ans.push_back(B-i);
        }
        else {
            ans.push_back(A+i);
        }
    }

    sort(begin(ans), end(ans));

    for (int i = 0; i < ans.size(); i++) {
        cout << ans[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,m,i,s=0,x;
int t[100], p[100][2];
cin>>n;
for(int i=0;i<n;i++)
{
cin>>t[i];
s=s+t[i];
}
cin>>m;
for(i=0;i<m;i++)
{
cin>>p[i][0]>>p[i][1];
}
for(i=0;i<m;i++)
{
x=p[i][0]-1;
cout<<s-t[x]+p[i][1]<<endl;
}
return 0;
}

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

int main(){
int W, H, N;  
  cin >> W >> H >> N;
  int xmin,ymin,xmax,ymax;
  xmin = 0;
  xmax = W;
  ymin = 0;
  ymax = H;
  int x, y, a;
  for(int i = 0;i < N;i++){
  cin >> x >> y >> a;
    if((a == 1) && (xmin <= x)){
    xmin = x;
    }
    else if((a == 2) && (xmax >= x)){
    xmax = x;
      if(xmax < xmin){
      xmax = xmin;
      }
    }
    else if((a == 3) && (ymin <= y)){
    ymin = y;
    }
    else if((a == 4) && (ymax >= y)){
    ymax = y;
      if(ymax < ymin){
      ymax = ymin;
      }
    }
  }
  cout << (xmax - xmin) * (ymax -  ymin) << endl;
}

Measured memory_bytes: 256
#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 inputValue(){
    int a;
    cin >> a;
    return a;
};

void inputArray(int * p, int a){
    REP(i, a){
        cin >> p[i];
    }
};

void inputVector(vector<int> * p, int a){
    REP(i, a){
        int input;
        cin >> input;
        p -> push_back(input);
    }
}

int main()
{
	int K = inputValue();
	int X = inputValue();
	
	int a = K * 2 - 1;
	REP(i, a){
		int v = X - K + i + 1;
		cout << v << " ";
	}
	cout << endl;
}


Measured memory_bytes: 256
let memoize n f =
  let dp = Hashtbl.create n in
  let rec get x =
    try Hashtbl.find dp x with
    | Not_found ->
        let result = f get x in
        Hashtbl.add dp x result;
        result in get

module RegExp : sig
  type t
  val empty_set : t
  val empty_str : t
  val char : Char.t -> t
  val app : t -> t -> t
  val union : t -> t -> t
  val star : t -> t

  val matches : t -> Char.t list -> bool
end = struct
  type t =
    { sort : sort;
      is_nullable : bool;
      derive : char -> t }
  and sort =
    | EmptySet
    | EmptyStr
    | Star
    | Other

  let rec empty_set =
    { sort = EmptySet;
      is_nullable = false;
      derive = fun _ -> empty_set }

  let empty_str =
    { sort = EmptyStr;
      is_nullable = true;
      derive = fun _ -> empty_set }

  let char c =
    { sort = Other;
      is_nullable = false;
      derive = fun c' -> if c = c' then empty_str else empty_set }

  let rec union re1 re2 =
    match re1, re2 with
    | { sort = EmptySet }, _ -> re2
    | _, { sort = EmptySet } -> re1
    | _, _ ->
        { sort = Other;
          is_nullable = re1.is_nullable || re2.is_nullable;
          derive = memoize 64 @@ fun _ c -> union (re1.derive c) (re2.derive c) }

  let rec app re1 re2 =
    match re1, re2 with
    | { sort = EmptySet }, _ -> empty_set
    | _, { sort = EmptySet } -> empty_set
    | { sort = EmptyStr }, _ -> re2
    | _, { sort = EmptyStr } -> re1
    | _, _ ->
        { sort = Other;
          is_nullable = re1.is_nullable && re2.is_nullable;
          derive = memoize 64 @@ fun _ c ->
            union
              (if re1.is_nullable then re2.derive c else empty_set)
              (app (re1.derive c) re2) }

  let star = function
    | { sort = EmptySet }
    | { sort = EmptyStr } -> empty_str
    | { sort = Star } as re -> re
    | re ->
        let memo = Hashtbl.create 64 in
        let rec self =
          { sort = Star;
            is_nullable = true;
            derive = fun c ->
              try Hashtbl.find memo c with
              | Not_found ->
                  let d = app (re.derive c) self in
                  Hashtbl.add memo c d;
                  d } in self

  let matches re s =
    (List.fold_left (fun re -> re.derive) re s).is_nullable
end

let () =
  let s = read_line () in
  print_endline @@
  if
    let open RegExp in
    matches
      (* ((dream(er)?)|(erase(r)?))* *)
      (star @@
        union
          (app (char 'd') @@ app (char 'r') @@ app (char 'e') @@ app (char 'a') @@ app (char 'm') @@
            union empty_str @@ app (char 'e') @@ char 'r')
          (app (char 'e') @@ app (char 'r') @@ app (char 'a') @@ app (char 's') @@ app (char 'e') @@
            (union empty_str @@ char 'r'))) @@
      Array.to_list @@ Array.init (String.length s) (String.get s)
  then "YES"
  else "NO"


Measured memory_bytes: 6400
// AOJ 0015
#include<algorithm>
#include<iostream>
#include<string>
#define rep(i,a) for( int i = 0; i != (a); ++i )

int N;
std::string a, b;

int main()
{
	std::cin >> N;
	while( N-- )
	{
		std::cin >> a >> b;
		int asz = a.size(), bsz = b.size(), sz = std::max( asz, bsz );
		if( asz > 80 || bsz > 80 )
		{
			std::cout << "overflow" << std::endl;
			continue;
		}

		std::reverse( a.begin(), a.end() );
		std::reverse( b.begin(), b.end() );

		
		a.resize( 80 );
		b.resize( 80 );

		std::string ans;
		int c = 0;
		rep( i, sz )
		{
			if( i >= asz )
				a[i] = '0';
			if( i >= bsz )
				b[i] = '0';

			int t = int(a[i])+b[i]+c-2*'0';
			c = 0;
			
			if( t >= 10 )
				c = 1, t %= 10;
			ans += char(t+'0');
		}

		if( c )
			ans += '1';

		if( ans.size() > 80 )
			std::cout << "overflow" << std::endl;
		else
		{
			rep( i, ans.size() )
				std::cout << ans[ans.size()-1-i];
			std::cout << std::endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1212
//! 尺卂乃卂.卂ﾌ乇乇ㄒ
#include<bits/stdc++.h>
//#include <ext/pb_ds/detail/standard_policies.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 ll              long long
#define int             long long
#define ld             long double
#define pb              push_back
#define pii             pair<int,int>
#define vi              vector<int>
#define vii             vector<vi>
#define vip            vector<pii>
#define mii             map<int,int>
#define mip             map<pair<int,int>,int>
#define mic             map<char,int> 
#define all(v)          v.begin(),v.end()  
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define lb(x)           (x&(-x))
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(x)            int x; cin>>x; while(x--)
#define itr(it,v)          for(auto it:v)
#define show(arr,n)     for(int i=0;i<n;i++) cout<<arr[i]<<" "; cout<<"\n";
#define fi(i,n)         for(int i=0;i<n;i++)
#define fir(i,k,n)       for(int i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ff               first 
#define ss               second
#define deb(x) cout << #x << "=" << x << endl
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define check(x) (x && cout<<"Yes\n")||(cout<<"No\n");
#define fin(s)          freopen(s,"r",stdin);  
#define fout(s)         freopen(s,"w",stdout);

const ld pi = 3.141592653589793238462643383279502884;
const int xd[]={-1,0,1,0};
const int yd[]={0,-1,0,1};
int XX[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int YY[] = { -1, 0,  1, -1, 1, -1, 0, 1 };

int expo(int a,int b,int m);
int mmi(int a,int m);
void ipgraph(int m);

const int N=5*(1e5)+10;
vii adj(N);
int a[N];

void  solve(){

}
int32_t main()
{
    FIO
    int x,y; cin>>x>>y;
    int c=4*x-y;
    int p=0;
    if(c>=0 & c%2==0) {
        int a=c/2;
        if(a<=x) p=1;
    }
    check(p);
    return 0;

}

void ipgraph(int m){
    int i, u, v;
    while(m--){
          cin>>u>>v;
         u--, v--;
    adj[u].pb(v);
    adj[v].pb(u);
    }
}
int expo(int a,int b,int m){
    if(b==0) return 1;
    if(b==1) return a;
    int val=(expo(a,b/2,m)*expo(a,b/2,m))%m;
    if(b & 1) return (val*a)%m;
    else return val;
}
int mmi(int a,int m){
    return expo(a,m-2,m);
}

Measured memory_bytes: 15080
long M=1e9+7,f[444][444],u;
i,j,k,a[444],b;
main(N,C){
	**f=1;
	scanf("%d%d",&N,&C);for(;j<N;)scanf("%d",a+j++);
	for(;~scanf("%d",&b);)for(j=a[i++];j<=b;j++)for(u=k=0;k<=C;k++)f[i][k]=(f[i][k]+(u=(f[i-1][k]+u*j)%M))%M;
	printf("%ld",f[N][C]);
}

Measured memory_bytes: 1536
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>

// Acknowledgement: Special thanks to kyomukyomupurin, who developed this
// template.
template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) {
  return os << '(' << p.first << ", " << p.second << ')';
}

template <class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) {
  int n = 0;
  for (auto e : vec) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T>
std::ostream& operator<<(std::ostream& os, const std::set<T>& st) {
  int n = 0;
  for (auto e : st) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) {
  int n = 0;
  for (auto e : mp) os << (n++ ? ", " : "{") << e;
  return os << (n ? "}" : "{}");
}

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

#ifdef LOCAL
#define debug(...) \
  std::cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}
using namespace std;
using int64 = long long;

int64 combination(int64 n, int64 p) {
  int64 bunshi = 1;
  int64 bunbo = 1;
  for (int64 i = n; i > n - p; i--) {
    bunshi *= i;
  }
  for (int64 i = 1; i <= p; i++) {
    bunbo *= i;
  }
  return bunshi / bunbo;
}

int main() {
  int n;
  cin >> n;
  vector<int64> a(n);
  cin >> a;
  sort(a.begin(), a.end());
  if (n == 2) {
    cout << a[1] << ' ' << a[0] << endl;
    return 0;
  }
  int64 biggest = a[a.size() - 1];
  int64 half_biggest = biggest / 2;
  auto lower_itr = lower_bound(a.begin(), a.end(), half_biggest);
  int64 lower = *lower_itr;
  int64 lower_right = *(lower_itr - 1);
  if (abs(lower - half_biggest) > abs(lower_right - half_biggest)) {
    cout << biggest << ' ' << lower_right << endl;
  } else {
    cout << biggest << ' ' << lower << endl;
  }
  return 0;
}

Measured memory_bytes: 4028
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int A = Integer.parseInt(scanner.next());
        int B = Integer.parseInt(scanner.next());
        scanner.close();
        if (A <= B) {
            System.out.println(A);
        } else {
            System.out.println(A - 1);
        }
    }
}


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

class Main{
	public static void main(String[]args){
        Scanner sc = new Scanner(System.in);
for(;;){
	int time =0;
	int time2 =0;
	int t =sc.nextInt();
	int m =sc.nextInt();
	int s =sc.nextInt();
	if(t==-1) break;
	
	time += t*3600; time += m*60; time += s;
	time = 7200-time; 
	time2 =time*3;
	
	t = time/3600;
	m = time%3600/60;
	s = time%3600%60;
	System.out.printf("%02d",t );
	System.out.printf(":%02d",m );
	System.out.printf(":%02d\n",s );
	t = time2/3600;
	m = time2%3600/60;
	s = time2%3600%60;
	System.out.printf("%02d",t );
	System.out.printf(":%02d",m );
	System.out.printf(":%02d\n",s );
}
	}
	}

Measured memory_bytes: 19228
#include<iostream>
#include<algorithm>
#include<string>


using namespace std;


int main()
{
	int size_x, count=0, f, e;
	string s, x;
	x = "x";
	cin >> s;
	string s_x(s);
	string::size_type pos = s_x.find(x);
	while (pos != string::npos) {
		s_x.replace(pos, x.size(), "");
		pos = s_x.find("x", pos);
	}

	size_x = s_x.size();
	f = 0;
	e = s.size() - 1;
	if (s.size() == 1){ cout << 0 << endl; return 0;}
	for (int i = 0; i < (size_x + 1) / 2; i++) {
		if(s_x[i] != s_x[size_x -1-i]) { cout << -1 << endl; return 0; }

		while (s[f] != s_x[i] || s[e] != s_x[i]) {
			if (s[f] == 'x' && s[e] == 'x') { f++; e--; }
			else if (s[f] == 'x') { f++; count++; }
			else if (s[e] == 'x') { e--; count++; }
		}
		f++; e--;

	}

	cout << count << endl;

	return 0;
}




Measured memory_bytes: 512
# D
N, K = map(int, input().split())
A = list(map(int, input().split()))
dct = {i+1:a for i,a in enumerate(A)}
visited = [0] * N
visited[0] = 1
if (K <= 2 * 10**5):
    nex = 1
    for _ in range(K):
        nex = dct[nex]
    print(nex)
else:
    cnt = 0
    nex = 1
    for _ in range(N):
        cnt += 1
        nex = dct[nex]
        visited[nex-1] += 1
        if visited[nex-1] > 1:
            break
    cnt1 = 0
    nex1 = 1
    for _ in range(N):
        cnt1 += 1
        nex1 = dct[nex1]
        if nex1 == nex:
            break
    if (cnt - cnt1) == 0:
        print(1)
    else:
        l = (K - cnt1) % (cnt - cnt1)
        for i in range(l):
            nex = dct[nex]
        print(nex)

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

int main() {
  string A, B;
  cin >> A >> B;
  if (A.size() == B.size()) {
    if (A > B) cout << "GREATER" << endl;
    else if (A < B) cout << "LESS" << endl;
    else cout << "EQUAL" << endl;
  }
  else if (A.size() > B.size()) cout << "GREATER" << endl;
  else cout << "LESS" << endl; 
}


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

struct Card
{
  int n, pos;
  char s;
};

vector<Card>::iterator partition(vector<Card>::iterator p, vector<Card>::iterator r)
{
  vector<Card>::iterator i = p - 1;
  vector<Card>::iterator temp = p;
  for (; p != r; p++) {
      if (p->n > (r - 1)->n) continue;
      ++i;
      iter_swap(i, p);
  }
  return i;
}

void quicksort(vector<Card>::iterator p, vector<Card>::iterator r)
{
  if (p != r) {
    vector<Card>::iterator q = partition(p, r);
    quicksort(p, q);
    quicksort(q + 1, r);
  }
}

void output(vector<Card>::iterator p, vector<Card>::iterator r)
{
  ostringstream oss;
  vector<Card>::iterator b = p;
  oss << p->s << " " << p->n << "\n";
  p++;
  int flg = 0;
  for (; p != r; p++) {
    if ((b->n == p->n) && (b->pos > p-> pos)) flg = 1;
    oss << p->s << " " << p->n << "\n";
    b = p;
  }
  cout << (flg ? "Not stable\n" : "Stable\n") << oss.str();
}

int main()
{
  int n;
  cin >> n;
  vector<Card> A;
  for (int i = 0; i < n; i++) {
    Card c;
    c.pos = i;
    cin >> c.s >> c.n;
    A.push_back(c);
  }
  quicksort(A.begin(), A.end());
  output(A.begin(), A.end());
  return 0;
}

Measured memory_bytes: 5800
from collections import Counter

S = [int(i) for i in input()]
S.reverse()
lst = []
_sum = 0

for i in range(len(S)):
    _sum = (_sum + S[i] * pow(10,i,2019)) % 2019
    lst.append(_sum)
    
C = Counter(lst)    
ans = C[0]

for i in C:
    ans += C[i]*(C[i]-1)//2
print(ans)    


Measured memory_bytes: 86828
#include <iostream>
#include <string>
#include <cmath>
#include <stdio.h>
using namespace std;
 

class Dice{
public:
    int labels[6];

    Dice(int *s){
        for(int i=0;i<6;i++){
            labels[i] = *(s + i);
        }        
    }
    
    void update_state(char c){
        int tmp;
        switch(c){
            case 'N':
                tmp = labels[0];
                labels[0] = labels[1];
                labels[1] = labels[5];
                labels[5] = labels[4];
                labels[4] = tmp;
                break;
            case 'S':
                tmp = labels[0];
                labels[0] = labels[4];
                labels[4] = labels[5];
                labels[5] = labels[1];
                labels[1] = tmp;
                break;
            case 'W':
                tmp = labels[0];
                labels[0] = labels[2];
                labels[2] = labels[5];
                labels[5] = labels[3];
                labels[3] = tmp;
                break;
            case 'E':
                tmp = labels[0];
                labels[0] = labels[3];
                labels[3] = labels[5];
                labels[5] = labels[2];
                labels[2] = tmp;
                break;
        }
    }
};


int main(){
    int labels[6];
    for(int i=0;i<6;i++){
        cin >> labels[i];
    }

    Dice dice(labels);

    string s;
    getchar();
    getline(cin, s);
    for(int i=0;i<s.size();i++){
        dice.update_state(s[i]);
    }
    cout << dice.labels[0] << endl;
}


Measured memory_bytes: 3208
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < (int)b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int n, m, q;
int a[55], b[55], c[55], d[55];
int ans;

int calc(string s) {
    int sum = 0;
    rep(i, 0, q) {
        if (s[b[i]] - s[a[i]] == c[i]) sum += d[i];
    }
    return sum;
}

void dfs(string s) {
    if ((int)s.size() == n + 1) {
        ans = max(ans, calc(s));
        return;
    }
    for (char c = s.back(); c <= m + '0'; c++) {
        dfs(s + c);
    }
}

int main() {
    cin >> n >> m >> q;
    rep(i, 0, q) {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
    }
    dfs("1");
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3640
module Main where
import Control.Monad
import Control.Applicative
import Data.Maybe
import Data.List
import qualified Text.Printf
import qualified Data.ByteString.Char8 as BC
import qualified Data.ByteString as BC

------------------------------------------

main :: IO ()
main = do
  [n, a, b] <- readInts
  x:xs <- readInts
  let diffs = tail $ foldl (\(y:ys) z -> z:(z-y)*a:ys) [x] xs
  print $ sum $ map (min b) diffs

------------------------------------------

{- Int input -}

parseInt :: BC.ByteString -> Int
parseInt = fst . fromJust . BC.readInt

parseInts :: BC.ByteString -> [Int]
parseInts = map parseInt <$> BC.words

readInt :: IO Int
readInt = parseInt <$> BC.getLine

readInts :: IO [Int]
readInts = parseInts <$> BC.getLine

{- Double Formatting -}

doubleFmt :: Double -> String
doubleFmt = Text.Printf.printf "%.12f"


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

int main(void){
    int n;
    cin >> n;
    
    char s[300000];
    cin >> s;
    
    int i, e_cnt = 0, s_cnt = 0, min = 0;
    for(i = 0; i < n; i++){
        if(s[i] == 'E'){
            e_cnt++;
        }
        if(i != 0){
            if(s[i - 1] == 'E' && s[i] == 'E'){
                s_cnt--;
            }else if(s[i - 1] == 'W' && s[i] == 'W'){
                s_cnt++;
            }
            if(s_cnt < min){
                min = s_cnt;
            }
        }else if(s[0] == 'E'){
            e_cnt--;
        }
    }
    
    cout << e_cnt + min << endl;
    
    return 0;
}


Measured memory_bytes: 512