akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)

const ll MOD = (ll)1e9 + 7;
const ll HIGHINF = (ll)1e18;

struct Node {
  ll key;
  Node *parent, *left, *right;
};
Node *root, *NIL;

void insert(ll k) {
  Node *y = NIL;
  Node *x = root;
  Node *z;

  z = (Node *)malloc(sizeof(Node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while (x!=NIL) {
    y = x;
    if (z->key < x->key) {
      x = x->left;
    } else {
      x = x->right;
    }
  }
  z->parent = y;
  if (y == NIL) {
    root = z;
  } else {
    if (z->key < y->key) {
      y->left = z;
    } else {
      y->right = z;
    }
  }
}

Node *find(Node *u, ll k) {
  while (u!=NIL && k!=u->key) {
    if (k < u->key) u = u->left;
    else u = u->right;
  }
  return u;
}

Node * treeMinimum(Node *x) {
  while (x->left != NIL) x = x->left;
  return x;
}

Node * treeSuccessor(Node *x) {
  if (x->left != NIL) return treeMinimum(x->right);
  Node *y = x->parent;
  while (y != NIL && x == y->right) {
    x = y; y = y->parent;
  }
  return y;
}

void treeDelete(Node *z) {
  Node *y;
  Node *x;
  if (z->left == NIL || z->right == NIL) y = z;
  else y = treeSuccessor(z);
  // yの子xを決める
  if (y->left != NIL) x = y->left;
  else x = y->right;

  if (x != NIL) x->parent = y->parent;

  if (y->parent == NIL) root = x;
  else {
    if (y == y->parent->left) y->parent->left = x;
    else y->parent->right = x;
  }

  if (y != z) z->key = y->key;

  free(y);
}

void inorder(Node *u) {
  if (u == NIL) return;
  inorder(u->left);
  printf(" %d", u->key);
  inorder(u->right);
}

void preorder(Node *u) {
  if (u == NIL) return;
  printf(" %d", u->key);
  preorder(u->left);
  preorder(u->right);
}

int main() {
  ll n; cin >> n;
  string com;
  REP(i, n) {
    cin >> com;
    if (com == "insert") {
      ll x; cin >> x;
      insert(x);
    } else if (com == "find") {
      ll x; cin >> x;
      Node *t = find(root, x);
      if (t != NIL) cout << "yes" << endl;
      else cout << "no" << endl;
    } else if (com == "delete") {
      ll x; cin >> x;
      treeDelete(find(root, x));
    } else if (com == "print") {
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }
  return 0;
}



Measured memory_bytes: 21936
using DataStructures
const double = Float64
const int = Int64

parseint(x) = parse(int, x)
readint() = map(parseint, split(readline()))

 
function main()
  N, K = readint()
  
  s = 0.0
  for i in 1:N
    k = 1/N
    a = i
    while a<K
      k /= 2
      a *=2
    end 
    s += k
  end
  println(s)

end



main()

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

struct Benri { Benri() { std::cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(12);}} benri;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vll = vector<long long>;
using pll = pair<ll, ll>;
using ull = unsigned long long;

template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define F first
#define S second

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; }

constexpr long long MOD = 1000000007;
//constexpr long long MOD = 998244353;
constexpr double EPS = 1e-10;
//constexpr int INF = 1001001001;
constexpr ll INF = 1001001001001001001ll;


int N, M;
vvi G;
vector<bool> seen;

bool rec(int v, int p, int s, int t) {
    if (v == s && p != -1) return true; // 一周回ってきて s に戻って来たら OK
    if (v != s) seen[v] = true;
    for (auto nv :  G[v]) {
        if (nv == p || nv == t || seen[nv]) continue;
        if (rec(nv, v, s, t)) return true;
    }
    return false;
}
        
bool solve() {
    cin >> N >> M;
    G.assign(N, vi());
    for (int i = 0; i < M; ++i) {
        int a, b; cin >> a >> b; --a, --b;
        G[a].pb(b);
        G[b].pb(a);
    }
    map<int,int> degs;
    for (int v = 0; v < N; ++v) degs[(int)G[v].size()]++;

    for (auto it : degs) if (it.first % 2 != 0) return false;
    if (degs[6] > 0) return true;
    if (degs[4] > 2) return true;
    if (degs[4] <= 1) return false;

    vi four;
    for (int v = 0; v < N; ++v) if (G[v].size() == 4) four.pb(v);
    int s = four[0], t = four[1];
    seen.assign(N, false);
    return rec(s, -1, s, t);
}

int main() {
    if (solve()) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 7680
#include <bits/stdc++.h>
#define ll long long
#define ulli unsigned long long int
#define ld long double  
#define endl "\n"
using namespace std; 


void solve() {
    int a, b, m;
    cin >> a >> b >> m;

    vector<int> price_a(a);
    vector<int> price_b(b);

    int min_a = INT_MAX;
    for (int& x: price_a) {
        cin >> x;
        min_a = min(min_a, x);
    } 
    int min_b = INT_MAX;
    for (int& x: price_b) {
        cin >> x;
        min_b = min(min_b, x);
    }

    int ans = min_a + min_b;

    int x, y ,z;
    for (int i = 0; i < m; i++) {
        cin >> x >> y >> z;
        ans = min((price_a[x-1] + price_b[y-1] - z), ans);
    }

    cout << ans << endl;

    
}

int main() 
{ 
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
  
    int t = 1; 
    //cin >> t; 
    while (t--) { 
        solve(); 
    } 
  
    cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl; 
    return 0; 
} 


Measured memory_bytes: 3848
#169A https://atcoder.jp/contests/abc169/tasks/abc169_a
# 1. 入力を受け取ること
# スペース区切りの入力を整数として受け取れる「2 5」　→　「a=2, b=5」となる
a, b = map(int, input().split())

# 2. 受け取った結果を使って目的の計算をすること
answer = a * b

# 3. 出力すること
print(answer)


Measured memory_bytes: 9020
#include <cstring>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <numeric>
#include <stack>

using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);
typedef unordered_map<ll, ll> mpll;
typedef unordered_map<char, ll> mpcl;
typedef unordered_map<string, ll> mpsl;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
template<typename T> using PQ = priority_queue<T>;
template<typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

ll inl() {
    ll x;
    cin >> x;
    return (x);
}

string ins() {
    string x;
    cin >> x;
    return (x);
}

int main() {
#ifdef MY_DEBUG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-noreturn"
    while (true) {
#pragma clang diagnostic pop
#endif
        ll h, w;
        cin >> h >> w;
        char a[h][w];
        queue<P> q;
        ll d[h][w];
        rep(i, h) rep(j, w) {
                cin >> a[i][j];
                if (a[i][j] == '#') {
                    q.push(P(i, j));
                    d[i][j] = 0;
                } else {
                    d[i][j] = ll_inf;
                }
            }

        while (!q.empty()) {
            P now = q.front();
            q.pop();
            rep(i, 4) {
                ll nx = now.F + dx[i], ny = now.S + dy[i];
                if (nx >= 0 && nx <= h - 1 && ny >= 0 && ny <= w - 1) {
                    if (d[nx][ny] == ll_inf) {
                        d[nx][ny] = min(d[nx][ny], d[now.F][now.S] + 1);
                        q.push(P(nx, ny));
                    }
                }
            }
        }
        ll ans = 0;
        rep(i, h) {
            rep(j, w) {
                ans = max(ans, d[i][j]);
            }
        }
        cout << ans << endl;

#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 25396
#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;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

const int MOD = 1e9 + 7;

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

int mult(int a, int b)
{
	return (a*1LL*b)%MOD;
}

vector<vector<int> > S;
bool su[150001];
int adj[150001][11];
map<vector<int>, int> ma;

void dfs(int sum, vector<int> V)
{
	S.pb(V);
	ma[V] = int(S.size()) - 1;
	for(int i=1;i<=7;i++)
	{
		if(sum+i<=17)
		{
			vi tmp=V;
			tmp.pb(i);
			dfs(sum+i,tmp);
		}
	}
}

int dp[41][150001][2];

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	dfs(0,{});
	for(int i=0;i<S.size();i++)
	{
		vi cur = S[i];
		int sum=0;
		for(int j=0;j<cur.size();j++) sum+=cur[j];
		for(int j=1;j<=10;j++)
		{
			if(j>=8)
			{
				adj[i][j]=0;
				continue;
			}
			vi tmp = cur;
			tmp.pb(j);
			int s = sum+j;
			reverse(tmp.begin(),tmp.end());
			while(!tmp.empty()&&s>17)
			{
				s-=tmp.back();
				tmp.pop_back();
			}
			reverse(tmp.begin(),tmp.end());
			adj[i][j] = ma[tmp];
		}
	}
	int n; int X[3];
	cin>>n>>X[0]>>X[1]>>X[2];
	for(int i=0;i<S.size();i++)
	{
		vi cur=S[i];
		bool pos=1;
		int s=0;
		while(s<X[2])
		{
			if(!cur.empty())
			{
				s+=cur.back();
				cur.pop_back();
			}
			else 
			{
				pos=0;
				break;
			}
		}
		if(s!=X[2])
		{
			pos=0;
			continue;
		}
		s=0;
		while(s<X[1])
		{
			if(!cur.empty())
			{
				s+=cur.back();
				cur.pop_back();
			}
			else 
			{
				pos=0;
				break;
			}
		}
		if(s!=X[1])
		{
			pos=0;
			continue;
		}
		s=0;
		while(s<X[0])
		{
			if(!cur.empty())
			{
				s+=cur.back();
				cur.pop_back();
			}
			else 
			{
				pos=0;
				break;
			}
		}
		if(s!=X[0])
		{
			pos=0;
			continue;
		}
		if(pos)
		{
			su[i]=1;
		}
	}
	dp[0][0][0] = 1;
	
	for(int i=1;i<=n;i++)
	{
		for(int j=0;j<S.size();j++)
		{
			for(int k=1;k<=10;k++)
			{
				int u = j; int v = adj[j][k];
				{
					int newl=0;
					int curv=v;
					if(su[v])
					{
						newl=1;
						curv=0;
					}
					add(dp[i][curv][newl],dp[i-1][u][0]);
				}
			}
		}
	}
	
	int sum=0;
	int cur=1;
	for(int j=n;j>=1;j--)
	{
		add(sum,mult(dp[j][0][1],cur));
		cur=mult(cur,10);
	}
	cout<<sum<<'\n';
}


Measured memory_bytes: 77360
#include <bits/stdc++.h>//Carefully Crafted by hetp111
using namespace std;
#define int long long
#define double long double
#define all(v) (v).begin(),(v).end()
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vii vector<pii>
#define MOD 1000000007
#define MOD2 998244353
#define MOD3 1000000009
#define PI acos(-1)
#define eps (1e-8)
#define INF (1e18)
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0)
template<class A,class B>ostream&operator<<(ostream&out,const pair<A,B>&a){return out<<"("<<a.first<<","<<a.second<<")";}
template<class A>ostream&operator<<(ostream&out,const vector<A>&a){for(const A &it:a)out<<it<<" ";return out;}
template<class A,class B>istream&operator>>(istream&in,pair<A,B>&a){return in>>a.first>>a.second;}
template<class A>istream&operator>>(istream&in,vector<A>&a){for(A &i:a)in>>i;return in;}
ifstream cinn("ride.in");ofstream coutt("ride.out");
int poww(const int &a,int b,const int &m=MOD){if(b==0)return 1;int x=poww(a,b/2,m);x=x*x%m;if(b&1)x=x*a%m;return x;}
int ceil(const int &a,const int &b){return (a+b-1)/b;}
////Read:
//Check corner cases, n==1;
//
////Some function:
//__builtin_popcountll(), 


signed main(){
    FASTER;
    int n,m,kk;cin>>n>>m>>kk;
    vector<string> v(n);cin>>v;
    
    int cnt=0;
    for(int i=0;i<(1LL<<n);i++){
        
        for(int j=0;j<(1LL<<m);j++){
            
            
            vector<string> tmp=v;
            
            
            vi row,col;
            
            int k,tmpp;
            k=0;
            tmpp=i;
            while(tmpp){
                if(tmpp%2)row.push_back(k);
                tmpp/=2;
                k++;
            }
            
            k=0;
            tmpp=j;
            while(tmpp){
                if(tmpp%2)col.push_back(k);
                tmpp/=2;
                k++;
            }
            
            for(int r:row){
                
                for(int j=0;j<m;j++)tmp[r][j]='R';
                
            }
            
            for(int c:col){
                
                for(int i=0;i<n;i++)tmp[i][c]='R';
                
            }
            
            int ans=0;
            for(int i=0;i<n;i++){
                for(int j=0;j<m;j++){
                    ans+=(tmp[i][j]=='#');
                }
            }
            cnt+=(ans==kk);
            
        }
        
    }
    cout<<cnt;
}

Measured memory_bytes: 3648
//
//  main.cpp
//  C
//
//  Created by 黄宇凡 on 2017/3/12.
//  Copyright © 2017年 黄宇凡. All rights reserved.
//

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>

using namespace std;

const int maxn = 200005;

int n,m;

vector<int> G[maxn];
int deg[maxn];

int col[maxn];
bool vis[maxn];

bool dfs(int u){
    bool flag = true;
    for(auto v : G[u]){
        if(col[v] == col[u]) return false;
        if(col[v] == -1){
            col[v] = 1 ^ col[u];
            flag &= dfs(v);
        }
    }
    return flag;
}

void Dfs(int u){
    vis[u] = true;
    for(auto v : G[u]){
        if(!vis[v])
            Dfs(v);
    }
}


int main(int argc, const char * argv[]) {
    cin >> n >> m;
    memset(deg,0,sizeof(deg));
    memset(vis,false,sizeof(vis));
    memset(col,-1,sizeof(col));
    
    for(int i = 1;i <= m;i++){
        int u,v;
        scanf("%d%d",&u,&v);
        G[u].push_back(v);
        G[v].push_back(u);
        deg[u]++;
        deg[v]++;
    }
    
    int q = 0,p = 0;
    int iso = 0;
    
    for(int i = 1;i <= n;i++){
        if(deg[i] == 0) iso++;
        else{
            if(!vis[i]){
                Dfs(i);
                col[i] = 1;
                if(dfs(i)){
                    q++;
                }else p++;
            }
        }
    }
    long long ans = 1LL * iso * iso + iso * 2LL * (n - iso) + 1LL * p * p + 2LL * p * q +  2LL * q * q;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 13056
#include <bits/stdc++.h>
#define INFLL (0x3f3f3f3f3f3f3f3fll)
using namespace std;
typedef long long ll;

ll dp[100055];

int N, W;

int main() {
	ios::sync_with_stdio(false);

	cin >> N >> W;
	fill(dp+1, dp+W+1, -INFLL);
	for(int ni = 0, a, b; ni < N; ni++) {
		cin >> a >> b;
		for(int i = W; a <= i; i--) {
			ll t = dp[i-a] + b;
			if(dp[i] < t) dp[i] = t;
		}
	}

	cout << *max_element(dp, dp+W+1) << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int N,M;
  cin >> N >> M;
  bool A[N] = {false};
  int W[N] = {0};
  int AC = 0;
  int WA = 0;
  int p[M];
  string S[M];
  for (int i = 0; i < M; i++) {
    cin >> p[i] >> S[i];
    p[i]--;
  }
  for (int i = 0; i < M; i++) {
    if (S[i] == "AC") {
      if (A[p[i]] == false) {
        A[p[i]] = true;
        AC++;
        WA += W[p[i]];
      }
    }
    else {
      if (A[p[i]] == false) {
        W[p[i]]++;
      }
    }
  }
  cout << AC << " " << WA << endl;
  return 0;
}

Measured memory_bytes: 6528
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <climits>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <string>
#include <list>
#include <ctime>

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

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

    int n,k;
    cin>>n>>k;
    vector<int> v(n);
    for(int i=0; i<n; i++) cin>>v[i];
    int answer=0;
    for(int i=0; i<=n; i++){
        for(int j=0; j<=n; j++){
            if(i+j>k || i+j>n) break;
            priority_queue<int,vector<int>,greater<int>> pq;
            int nowanswer=0;
            for(int k1=0; k1<i; k1++){
                nowanswer+=v[k1];
                pq.push(v[k1]);
            }
            for(int k1=0; k1<j; k1++){
                nowanswer+=v[n-1-k1];
                pq.push(v[n-1-k1]);
            }
            int tmp=i+j;
            while(tmp<k && !pq.empty()){
                int top=pq.top();
                pq.pop();
                if(top>=0) break;
                nowanswer-=top;
                tmp+=1;
            }
            answer=max(answer,nowanswer);
        }
    }
    cout<<answer;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
    string s,t;
    cin >> s >> t;
    sort(s.begin(), s.end());
    sort(t.rbegin(), t.rend());
    if(s < t) puts("Yes");
    else puts("No");
    return 0;
}

Measured memory_bytes: 256
arr = raw_input().split(' ')
a = int(arr[0])
b = int(arr[1])
ab = a+b

if a%3 == 0:
	print "Possible"
elif b%3 == 0:
	print "Possible"
elif ab%3 ==0:
	print "Possible"
else:
	print "Impossible"


Measured memory_bytes: 2568
s = input()
i = 0

ans = ['0']*(len(s))

for c in s:
	if c == '0':
		ans[i] = '0'
		i += 1
	elif c == '1':
		ans[i] = '1'
		i += 1
	elif c == 'B':
		if i > 0:
			i -= 1

for i in range(i):
	print(ans[i], end='')
print()


Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    static void divmod (int[] vi, int a, int b) {
        int q;
        int r;
        if (b < 0) {
            b = -b;
            a = -a;
        }
        q = 0;
        r = a;
        if (r > 0) {
            // long start = System.currentTimeMillis();
            while (r - b >= 0) {
                // long start1 = System.currentTimeMillis();
                q += 1;
                r -= b;
                // long end1 = System.currentTimeMillis();
                // System.out.println ("2-0:" + (end1 - start1) + "ms");
            }
            // long end = System.currentTimeMillis();
            // System.out.println ("2:" + (end - start) + "ms");
        } else if (r < 0) {
            // long start = System.currentTimeMillis();
            do {
                q -= 1;
                r += b;
            } while (r < 0);
            // long end = System.currentTimeMillis();
            // System.out.println ("3:" + (end - start) + "ms");
        }
        vi[0] = q;
        vi[1] = r;
    }
    public static void main (String[] args) throws IOException {
        final String s;
        try (BufferedReader reader =
                 new BufferedReader (new InputStreamReader (System.in))) {
            s = reader.readLine();
        }
        int[] vi           = new int[2];
        int           N    = Integer.parseInt (s);
        StringBuilder sb   = new StringBuilder();
        int           base = 2;
        while (0 != N) {
            // base = 3 でうまくいかない
            // 例えば 7
            // base = 2 は OK
            // sb.insert (0, String.valueOf (Math.abs (N % base)));
            // N -= Math.abs (N % base);
            // N /= -base;

            // base = 3 でもうまくいく
            // long start = System.currentTimeMillis();
            divmod (vi, N, base);
            // long end = System.currentTimeMillis();
            // System.out.println ("1:" + (end - start) + "ms");
            sb.insert (0, String.valueOf (vi[1]));
            N -= vi[1];
            // start = System.currentTimeMillis();
            divmod (vi, N, base);
            // end = System.currentTimeMillis();
            // System.out.println ("4:" + (end - start) + "ms");
            N = -vi[0];
        }
        if (sb.length() == 0) sb.append ("0");
        System.out.println (sb);
    }
}


Measured memory_bytes: 21204
#include <bits/stdc++.h>
using namespace std;  
#define rep(i, a, b) for(ll i = a; i < b; i++)
#define Rep(i, a, b) for(ll i = a; i <= b; i++)
#define repr(i, a, b) for(ll i = b-1; i >= a; i--)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
using ll = long long;
#define ALL(v) (v).begin(),(v).end()
#define endl "\n"
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define co(x) cout << x << endl
#define coel cout << endl
#define pb push_back
#define sz(v) ((ll)(v).size())
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
// const ll INF = 1LL << 60;
const ll INF = 100000000000;
#define pp pair<ll, pair<ll, ll>> 
// #define fi first
// #define se second
 
/*--------------------------------------------------------------------------------
例
1  2  10  12

-5  -2  -1  10  12  
-> -5  13  12
-> -18  12
-> 30

-4  -3  -1  10  12

0  0  0  0

-12  -10  -3  -1
--------------------------------------------------------------------------------*/


int main(){
    ll n; cin >> n;
    Vl a(n);
    bool f1 = false, f2 = false;
    rep(i, 0, n){
        cin >> a[i];
        if(a[i] > 0) f1 = true;
        else if(a[i] < 0) f2 = true;
    }
    sort(ALL(a));
    if(f1 && !f2){
        ll ans = 0;
        ans -= a[0];
        rep(i, 1, n) ans += a[i];
        co(ans);
        ll lf = a[0];
        rep(i, 0, n-2){
            co(lf << " " << a[i+1]);
            lf -= a[i+1];
        }
        co(a[n-1] << " " << lf);
    }
    if(!f1 && f2){
        reverse(ALL(a));
        ll ans = a[0];
        rep(i, 1, n) ans -= a[i];
        co(ans);
        ll lf = a[0];
        rep(i, 0, n-1){
            co(lf << " " << a[i+1]);
            lf -= a[i+1];
        }
    }
    if(f1 && f2){
        ll ans = 0;
        rep(i, 0, n) ans += abs(a[i]);
        co(ans);
        Vl a1, a2;
        rep(i, 0, n){
            if(a[i] <= 0) a1.push_back(a[i]);
            else a2.push_back(a[i]);
        }
        rep(i, 0, sz(a2)-1){
            co(a1[0] << " " << a2[i]);
            a1[0] -= a2[i];
        }
        rep(i, 0, sz(a1)){
            co(a2[sz(a2)-1] << " " << a1[i]);
            a2[sz(a2)-1] -= a1[i];
        }
    }
    if(!f1 && !f2){
        co(0);
        rep(i, 0, n-1) co(0 << " " << 0);
    }


    return 0;
}


Measured memory_bytes: 5220
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int e=max(a,c);
    int f=min(b,d);
    if(e<f){
		cout<<f-e<<endl;
	}
	else{
		cout<<0<<endl;
	}
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String[] firstLine = input.readLine().split(" ");
        int N = Integer.parseInt(firstLine[0]);
        int M = Integer.parseInt(firstLine[1]);

        String[][] imageA = new String[N][N];
        for (int i = 0; i < N; i++) {
            imageA[i] = input.readLine().split("");
        }
        String[][] imageB = new String[M][M];
        for (int i = 0; i < M; i++) {
            imageB[i] = input.readLine().split("");
        }

        boolean result = false;
        for (int i = 0; i <= N-M; i++) {
            for (int j = 0; j <= N-M; j++) {


                boolean isSame = true;
                for (int k = 0; k < M; k++) {
                    for (int r = 0; r < M; r++) {

                        if (imageA[i + k][j + r].equals(imageB[k][r])) {

                        } else {
                            isSame = false;
                        }
                    }
                }
                result = result || isSame;

            }
        }

        if(result) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 23764
import sys
read = sys.stdin.buffer.read
#input = sys.stdin.readline
#input = sys.stdin.buffer.readline

#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode('utf-8')
from math import *


def main():
	r=II()
	print(2*r*pi)
	
	
	


	
if __name__ == "__main__":
	main()


Measured memory_bytes: 9128
import java.util.Scanner;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import java.util.HashSet;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String  S=sc.next();
    String  T=sc.next();
    String []Ss = S.split("");
    String []Ts = T.split("");


    int Sum=0;
    int Ans=1001;
for (int i=0;i<Ss.length-Ts.length+1 ;i++){
  for (int j=0;j<Ts.length ;j++) {
     if(!(Ss[i+j].equals(Ts[j]))){
       Sum++;
     }
  }
  if(Ans>Sum){
    Ans=Sum;
  }
  Sum=0;

}
System.out.println(Ans);
}
}


Measured memory_bytes: 35688
package main

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

func solve() {
	a, b := getInt(), getInt()
	d := gcd(a, b)
	primes := factorize(d)

	ans := len(primes) + 1
	fmt.Fprintln(wr, ans)
}

func gcd(a, b int) int {
	if a%b == 0 {
		return b
	}
	return gcd(b, a%b)
}

func factorize(n int) map[int]int {
	m := make(map[int]int)
	for n%2 == 0 {
		n /= 2
		m[2]++
	}

	for i := 3; i*i <= n; i += 2 {
		if n%i != 0 {
			continue
		}
		for n%i == 0 {
			n /= i
			m[i]++
		}
	}

	if n != 1 {
		m[n]++
	}
	return m
}

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

const (
	inf = 1 << 60
	// mod = 1000000007
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func main() {
	maxBufSize := int(1e8)
	sc.Buffer(make([]byte, 4096), maxBufSize)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}

func getInt() (ret int) {
	sc.Scan()
	ret, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return
}

func getIntSlice(n int) (ret []int) {
	ret = make([]int, n)
	for i := range ret {
		ret[i] = getInt()
	}
	return
}

func getString() (ret string) {
	sc.Scan()
	ret = sc.Text()
	return
}

func getRunes() (ret []rune) {
	ret = []rune(getString())
	return
}


Measured memory_bytes: 640
// No sorceries shall prevail. //           
import java.util.*;
import java.io.*;
public class Main {
	
	static long gcd(long a, long b) { 
	      if (b == 0) 
	        return a; 
	      return gcd(b, a % b);  
	    }
	static int gcd(int a, int b) { 
	      if (b == 0) 
	        return a; 
	      return gcd(b, a % b);  
	    }
	
	static long mod = 1000000007;
	public static void main(String args[]) {
		Scanner inp=new Scanner(System.in);
		PrintWriter out=new PrintWriter(System.out);
		
		long a=inp.nextLong();
		long b=inp.nextLong();
		for(int i=1;i<=2000;i++) {
			double gg1=i*0.08;
			double gg2= i*0.1;
			if((int)gg1==a && (int)gg2==b) {
				System.out.println(i);
				return;
			}
		}
		out.println(-1);
		out.close();
		inp.close();
	}
}

Measured memory_bytes: 23892
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <cmath>

int main(){
    long long n;
    std::cin >> n;
    
    long long ans = 0;
    for(long long i = 1; i <= std::sqrt(n); ++i){
        if(0 == n % i){
            long long divisor = n / i - 1;
            if(0 != divisor && n / divisor == n % divisor){
                ans += divisor;
            }
        }
    }
    
    std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 888
<?php
// ?¨??????\???
// f(0) = 1, f(1) = 1
$stdin = trim(fgets(STDIN));
$array = array(
    0 => 1,
    1 => 1,
);
for ($i=1; $i<44; $i++)
{
    $array[$i+1] = $array[$i-1] + $array[$i];
}

print("{$array[$stdin]}\n");

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

int main()
{
    string s;
    cin>>s;
    int l = s.length();
    for(int i = 0 ;i<l;i++) 
    {
        if(i%2==0)
        {
            if(s[i]=='L')
            {
                cout<<"No";
                return 0;
            }
            
        }
        else
        {
            if(s[i]=='R')
            {
                cout<<"No";
                return 0;
            }
        }
    }
    cout<<"Yes";
    return 0;
}

Measured memory_bytes: 384
program hrn;
 var
  a:array[1..50]of longint;
  i,j,n,m,x:longint;
  procedure qsort(l,h:longint);
   var
    i,j,t,m:longint;
   begin
    i:=l; j:=h;
    m:=a[(i+j) div 2];
    repeat
     while a[i]<m do inc(i);
     while m<a[j] do dec(j);
     if i<=j then
      begin
       t:=a[i]; a[i]:=a[j]; a[j]:=t;
       inc(i); dec(j);
      end;
    until i>j;
    if i<h then qsort(i,h);
    if j>l then qsort(l,j);
   end;
 begin
  read(n,m);
  for i:=1 to n do read(a[i]);
  qsort(1,n);
  for i:=n downto n-m+1 do inc(x,a[i]);
  writeln(x);
 end.

Measured memory_bytes: 128
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>
#include <sstream>
#include <stack>
#include <time.h>
#include <vector>
#include <complex>
#include <map>
#include <set>
#include <iomanip>
#include <math.h>
#include <stdlib.h>
#include <list>
#include <utility>
#include <memory>
#include <cstring>
#include <fstream>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <ios> 
#include <bits/stdc++.h>
using namespace std;
int n;
long long a[300004],sum=0,ans[300004];
int main(){
	cin>>n;
	for (int i=1;i<=n;i++){
		cin>>a[i];sum+=a[i];
	}
	long long o=a[n];
	long long att=-1;
	for (int i=1,j=n-1;i<j;i++,j--){
		o+=att*(a[i]+a[j]);
		att=(-1ll)*att;
	}
	if (o<0) o*=-1;
	ans[(1+n)/2]=o/2;
	for (int i=(1+n)/2;i>=2;i--){
		ans[i-1]=a[i-1]-ans[i];
	}
	for (int i=(1+n)/2;i<=n;i++){
		if (i<n) ans[i+1]=a[i]-ans[i]; 
		else ans[1]=a[n]-ans[i];
	}
	for (int i=1;i<=n;i++)
		cout<<ans[i]*2<<" ";
}

Measured memory_bytes: 4096
n = int(input())

now_time = 0
now_x = 0
now_y = 0

for _ in range(n):
    t, x, y = map(int, input().split())
    xy_diff = abs(x - now_x) + abs(y - now_y)

    if t - now_time < xy_diff:
        print("No")
        exit()
    if (t - now_time) % 2 == 0:
        if xy_diff % 2 != 0:
            print("No")
            exit()
        else:
            now_time = t
            now_x = x
            now_y = y
    else:
        if xy_diff % 2 != 1:
            print("No")
            exit()
        else:
            now_time = t
            now_x = x
            now_y = y

print("Yes")


Measured memory_bytes: 74072
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Is_it_a_Right_Triangle
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());

            for (int i = 0; i < n; ++i)
            {
                string[] input = Console.ReadLine().Split(' ');
                List<int> nums = new List<int>();
                for (int j = 0; j < 3; ++j)
                {
                    nums.Add(int.Parse(input[j]));
                }
                nums.Sort();
                if (Math.Pow(nums[0], 2) + Math.Pow(nums[1], 2) == Math.Pow(nums[2], 2))
                {
                    Console.WriteLine("YES");
                }
                else
                {
                    Console.WriteLine("NO");
                }
            }
        }
    }
}



Measured memory_bytes: 15892
def fac(n):
    con = int(1e+9 + 7)
    lp = []
    ln = [1]
    for i in range(1, n + 1):
        lp = ln.copy()
        ln = [1]
        ln += [int((lp[j - 1] + lp[j]) % con) for j in range(1, i)]
        ln += [1]
    return ln

[n, k] = [int(i) for i in input().split()]

nr = fac(n - k + 1)
nb = fac(k - 1)
for i in range(1, k + 1):
    if (i < n - k + 2):
        r = int((nr[i] * nb[i - 1]) % (int(1e+9 + 7)))
        print(r)
    else:
        print(0)


Measured memory_bytes: 3444
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
int main()
{
	long long n, l, r,sum=0;
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		sum += i * (n - i + 1);
	}
	for (int i = 1; i < n; i++)
	{
		cin >> l >> r;
		if (l > r)
			swap(l, r);
		sum -= l * (n - r + 1);
	}
	cout << sum << endl;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
#define MAX_INT 2100000000
#define ex5 (100000+10)
using namespace std;
typedef long long int ll;
#ifdef COMPILE_IN_VCPP
#include <windows.h>
HWND GetConsoleHwnd(void)
{
#define MY_BUFSIZE 1024 // Buffer size for console window titles.
	HWND hwndFound;         // This is what is returned to the caller.
	char pszNewWindowTitle[MY_BUFSIZE]; // Contains fabricated// WindowTitle.
	char pszOldWindowTitle[MY_BUFSIZE]; // Contains original// WindowTitle.
	ULARGE_INTEGER nt;
	nt.QuadPart = GetTickCount64();
	GetConsoleTitle(pszOldWindowTitle, MY_BUFSIZE);
	wsprintf(pszNewWindowTitle, "%d%d/%d", nt.HighPart, nt.LowPart, GetCurrentProcessId());
	SetConsoleTitle(pszNewWindowTitle);
	Sleep(40);
	hwndFound = FindWindow(NULL, pszNewWindowTitle);
	SetConsoleTitle(pszOldWindowTitle);
	return(hwndFound);
}
#endif
int main()
{
#ifdef COMPILE_IN_VCPP
	SetWindowPos(GetConsoleHwnd(), HWND_TOPMOST, 0, 0, 0, 0,
		(SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW));
#endif
	int n, d;
	cin >> n >> d;
	if (n % (2 * d + 1)) cout << n / (2 * d + 1) + 1 << endl;
	else cout << n / (2 * d + 1) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <assert.h>
#include <vector>
#include <unordered_map>
#include <queue>
#include <climits>
#include <algorithm>
using namespace std;
constexpr int64_t MOD = 1000000007;


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

  int32_t N, M;
  cin >> N >> M;
  int32_t num_acc = 0;
  int32_t num_penalty = 0;
  vector<int> submit(N+1, 0);
  //unordered_map<int, int> submit;
  for (int i = 0; i < M; i++) {
    int32_t pid;
    string res;
    cin >> pid;
    cin >> res;
    if (res == "WA" && submit[pid] != -1) {
      submit[pid]++;
    } else if (res == "AC" && submit[pid] != -1) {
      num_acc++;
      num_penalty += submit[pid];
      submit[pid] = -1;
    }
  }
  cout << num_acc << " "  << num_penalty  << endl;
  return 0;
}


Measured memory_bytes: 640
#include <bit>
#include <bitset>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <iomanip>

typedef long double ld;
typedef long long ll;

using namespace std;


/* TEMPLATE ENDS HERE */

int main() {
	cout << fixed << setprecision(12);	
	ll n, a, b;
	cin >> n >> a >> b;
	if ((a * b < n) || (a + b - 1 > n)) {
		cout << -1 << endl;
		return 0;
	}
	for (int i = n - a + 1; i <= n; i++) {
		cout << i << " ";
	}
	int left = n - a;
	for (int i = b - 1; i >= 1; i--) {
		if (i == 1) {
			for (int j = 1; j <= left; j++) {
				cout << j << " ";
			}
			break;		
		}
		int pos = left - a + 1;
		if (pos - 1 >= i - 1) {
			for (int j = pos; j <= left; j++) {
				cout << j << " ";
			}
			left -= a;
		} else {
			cout << left << " ";
			left--;
		}
	}
	return 0;
}


ll MOD = ((ll)1e9 + 7);

struct mod {
	ll x;

	mod(ll tx = 0) {
		x = tx;
		x %= MOD;
	}
	
	mod& operator=(const ll & tx) {
		x = tx % MOD;
		return *this;
	}
	
	mod& operator=(const mod & m2) {
		x = m2.x;
		return *this;
	}

	mod operator+(const mod& m2) const {
		return mod((x + m2.x) % MOD);
	}

	mod& operator+=(const mod& m2) {
		x += m2.x;
		x %= MOD;
		return *this;
	}

	mod operator-(const mod & m2) const {
		return mod((x - m2.x + MOD) % MOD);
	}

	mod& operator-=(const mod & m2) {
		x -= m2.x;
		x = (x + MOD) % MOD;
		return *this;
	}

	mod operator*(const mod & m2) const {
		return mod((x * m2.x) % MOD);
	}

	mod& operator*=(const mod & m2) {
		x *= m2.x;
		x %= MOD;
		return *this;
	}

	mod mypow(ll k) const {
		mod ret = 1;
		mod cur = x;
		while (k) {
			if (k & 1) {
				ret *= cur;
			}
			cur *= cur;
			k >>= 1;
		}
		return ret;
	}

	mod inv() const {
		return mypow(MOD - 2);
	}

	mod operator/(const mod & m2) const {
		return (*this) * m2.inv();
	}

	mod& operator/=(const mod & m2) {
		x *= m2.inv().x;
		x %= MOD;
		return *this;
	}

	bool operator<(const mod & m2) const {
		return x < m2.x;
	}
};

ostream &operator<<(ostream & os, const mod & m) {
	return os << m.x;
}



Measured memory_bytes: 3552
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 100000000
#define INF 300000000000000000
#define MOD 1000000007
#define mod 1000000007
#define INT_MAX_ 2147483647
#define REP(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define REPE(i, a, n) for (ll i = a; i <= (ll)(n); i++)
#define rep(i,n)for (ll i = 0; i < (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
#define me memset
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<int,int>Pin;
typedef pair<ll,ll>Pll;
template<class T> using V=vector<T>;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
long long GCD(long long a, long long b) {return b?GCD(b,a%b):a;}
long long LCM(long long a, long long b) {return a/GCD(a,b)*b;}
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
int ddx[8]={-1,0,1,0,1,1,-1,-1};
int ddy[8]={0,-1,0,1,1,-1,1,-1};
ll cmp1(pair<ll,ll>a,pair<ll,ll> b){
        if(a.se!=b.se)
        return a.se<b.se;
        else
        return a.fi<b.fi;
}
//----------------------------------------------------------------------

//----------------------------------------------------------------------
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------  
    //ll begin_time=clock();
    //-------------------------------
    ll n;cin>>n;
    V<ll>a(n);
    for(ll i=0;i<n;i++)cin>>a[i];
    set<ll>s;
    for(ll i=0;i<n;i++)s.insert(a[i]);
    int ans=s.size();
    if(ans%2==0)ans--;
    cout<<ans<<endl;
    //-------------------------------  
    //ll end_time=clock();cout<<"time="<<end_time-begin_time<<"ms"<<endl;
    //-------------------------------
    return 0;
}
//----------------------------------------------------------------------





































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

#define int long long
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
template<class T,class U>void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>void chmax(T &t,U f){if(t<f)t=f;}

struct UnionFindTree{
    vector<int>par,sz;
    UnionFindTree(int n){
        par.resize(n);
        sz.resize(n);
        for(int i=0;i<n;i++){
            par[i]=i;
            sz[i]=1;
        }
    }
    int find(int x){
        return x==par[x]?x:par[x]=find(par[x]);
    }
    void unite(int x,int y){
        x=find(x);y=find(y);
        if(x==y)return;
        if(sz[x]<sz[y])swap(x,y);
        sz[x]+=sz[y];
        par[y]=x;
    }
    bool areSame(int x,int y){
        return find(x)==find(y);
    }
    int size(int x){
        return sz[find(x)];
    }
};

signed main(){
	int n,q;cin>>n>>q;
	UnionFindTree uf(n);
	while(q--){
		int t,x,y;cin>>t>>x>>y;
		if(t==0){
			uf.unite(x,y);
		}
		else{
			cout<<uf.areSame(x,y)<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3208
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <array>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <cstdint>
#include <unordered_set>
#include <ctime>
typedef long long int llint;

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

  std::map<std::array<int, 2>, int> ht;
  

  std::vector<int> head(10, 0);
  std::vector<int> tail(10, 0);

  for(int i=1; i<=n; i++){
    int tmp = i;
    int tail = tmp%10;
    while(tmp>=10) tmp/=10;
    int head = tmp;

    if(ht.find({head, tail}) == ht.end()) ht[{head, tail}] = 0;
    ht[{head, tail}]++;
  }

  int count =0;
  for(const auto& elem: ht){
    auto key = elem.first;
    if(ht.find({key[1], key[0]}) == ht.end()) continue;
    count += ht[{key[1], key[0]}] * ht[key];
  }

  std::cout << count << std::endl;
  
  return 0;
}


Measured memory_bytes: 256
n = int(input())

ans = 0
zoro = 0

for i in range(n):
    x,y = map(int,input().split())
    if x == y:
        zoro = zoro + 1
        if ans < zoro:
            ans = zoro
    else:
        if ans < zoro:
            ans = zoro
            zoro = 0
        else:
            zoro = 0

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


Measured memory_bytes: 9180
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();

        int s = (A >= B) ? A : B;
        int f = (A >= B) ? B : A;
        long ans = s;
        for (int i = 1; i <= f; i++) {
            ans *= i;
            if(ans%f == 0){
//                System.out.println(i);
                System.out.println(ans);
                return;
            }
            ans /= i;
        }
    }

}

Measured memory_bytes: 22228
#include<iostream>
#include<algorithm>
#include<vector>
#include<cassert>
#include<sstream>

using namespace std;

typedef long long ll;

ll P;
bool divZero;

ll add(ll a, ll b, ll p){return (a+b)%p;}

ll sub(ll a, ll b, ll p){return (a-b+p)%p;}

ll mul(ll a, ll b, ll p){return (a*b)%p;}

ll extgcd(ll a, ll b, ll& x, ll& y){
  ll d = a;
  if(b != 0){
    d = extgcd(b, a%b, y, x);
    y -= (a/b)*x;
  }else{
    x = 1; y = 0;
  }
  return d;
}

ll mod_inverse(ll a, ll m){
  ll x,y;
  extgcd(a,m,x,y);
  return (m+x%m)%m;
}

ll div(ll a, ll b, ll p){
  assert(0 <= a && a < p);
  assert(0 <= b && b < p);

  if(b == 0){
    divZero = true;
    return 1LL;
  }

  return (a*mod_inverse(b, p))%p;
}

bool isPara(const string& s){
  if(s[0] != '(') return false;
  int p = 0;
  for(int i = 0; i < (int)s.length()-1; i++){
    if(s[i] == '(') p++;
    if(s[i] == ')') p--;
    if(p == 0) return false;
  }
  return p == 1 && s[s.length()-1] == ')';
}

ll getPos(const string& s, const string& ope){
  int p = 0;
  for(int i = (ll)s.length()-1; i >= 0; i--){
    if(s[i] == '(') p++;
    if(s[i] == ')') p--;
    
    if(p != 0) continue;
    for(int j = 0; j < (ll)ope.length(); j++)
      if(s[i] == ope[j]) return i;
  }
  return -1;
}

bool isNum(const string& s){
  for(int i = 0; i < (int)s.length(); i++)
    if('0' > s[i] || s[i] > '9') return false;
  return true;
}

ll toInt(const string& s){
  stringstream ss(s);
  ll a; ss >> a;
  return a;
}

ll parse(const string& s){

  if(isPara(s)) return parse(s.substr(1,s.length()-2));
  if(isNum(s)) return toInt(s);

  int pos = getPos(s,"+-");
  if(pos != -1){
    if(s[pos] == '+') return add(parse(s.substr(0,pos)), parse(s.substr(pos+1)),P);
    if(s[pos] == '-') return sub(parse(s.substr(0,pos)), parse(s.substr(pos+1)),P);
  }
  pos = getPos(s, "*/");
  if(pos != -1){
    if(s[pos] == '*') return mul(parse(s.substr(0,pos)), parse(s.substr(pos+1)),P);
    if(s[pos] == '/') return div(parse(s.substr(0,pos)), parse(s.substr(pos+1)),P);
  }
}


string input(){
  string s;
  getline(cin,s);

  string res = "";
  for(int i = 0; i < (int)s.length(); i++){
    if(s[i] != ' ') res += s[i];
  }
  return res;
}

int main(){

  char c;
  while(cin >> P >> c && P){
    divZero = false;
    string s = input();
    ll ans = parse(s);
    if(divZero) cout << "NG" << endl;
    else cout << s << " = " << ans << " (mod " << P << ")" << endl;
  }
  return 0;
}

Measured memory_bytes: 29392
#include <iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
#define pb              push_back
#define pi              acos(-1.0)
#define loop(i,a,n)     for(int i=a;i<n;i++)
#define rloop(i,n,a)    for(int i=n;i>=a;i--)
#define ll              long long int
#define ff              first
#define ss              second
#define pii             pair<ll,ll>
#define sc1(a)          scanf("%d",&a)
#define sc2(a,b)        scanf("%d %d",&a,&b)
#define sc3(a,b,c)      scanf("%d %d %d",&a,&b,&c)
#define all(v)          v.begin(),v.end()
#define ms(a,b)         memset(a,b,sizeof a)
#define FastIO          ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define fileout         freopen("output.txt","w",stdout)
#define filein          freopen("input.txt","r",stdin)
#define inf             2e9+5
#define Q               int q;cin>>q;while(q--)
#define check           cout<<"HI"<<endl;

//int x[]= {-1,0,0,1};
//int y[]= {0,-1,1,0};

using namespace std;

int main()
{
    int a;
    cin >> a;
    cout<<a+a*a+a*a*a<<endl;
}













Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
#define Mod 1000000007
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
#define INF 1ll<<59

int main(){
  ll i,j;
  ll h,w,n;
  cin>>h>>w>>n;
  ll x,y;
  cin>>x>>y;
  string s,t;
  cin>>s>>t;

  ll f=0;
  ll x1=x;
  ll x2=x;
  ll y1=y;
  ll y2=y;

  ll lx=1;
  ll rx=h;
  ll ly=1;
  ll ry=w;

  for(i=n-1;i>0;i--){
    if(s[i]=='D') rx--;
    if(s[i]=='U') lx++;
    if(s[i]=='R') ry--;
    if(s[i]=='L') ly++;

    if(rx<lx||ry<ly) {
      cout<<"NO"<<endl;
      return 0;
    }

    if(t[i-1]=='U') rx++;
    if(t[i-1]=='D') lx--;
    if(t[i-1]=='L') ry++;
    if(t[i-1]=='R') ly--;

    rx=min(rx,h);
    lx=max(lx,(ll)1);
    ry=min(ry,w);
    ly=max(ly,(ll)1);
 }

    if(s[0]=='D') rx--;
    if(s[0]=='U') lx++;
    if(s[0]=='R') ry--;
    if(s[0]=='L') ly++;

    if(rx<lx||ry<ly) {
      cout<<"NO"<<endl;
      return 0;
    }

    else if(x>=lx&&x<=rx&&y>=ly&&y<=ry) {
      cout<<"YES"<<endl;
      return 0;
    }

   cout<<"NO"<<endl;
  return 0;
}

Measured memory_bytes: 776