akhauriyash/Code-Regression huggingface dataset:
#!/usr/bin/env python3
import sys
from math import *
from itertools import *
from collections import *
from functools import *
try:
    from math import gcd
except Exception:
    from fractions import gcd


def solve(S: int):
    ret = float('inf')
    for i in range(len(S) - 2):
        ret = min(ret, abs(753 - int(S[i:i+3])))
    return ret


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = (next(tokens))  # type: int
    result = solve(S)
    print(result)

if __name__ == '__main__':
    main()


Measured memory_bytes: 5120
// AtCoder My Practice
// author: Leonardone @ NEETSDKASU

fn main() {
	let mut stdin = String::new();
    std::io::Read::read_to_string(
    	&mut std::io::stdin(),
        &mut stdin).unwrap();
	let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();
    macro_rules! get {
    	($t:ty) => (get().parse::<$t>().unwrap());
        () => (get!(i64));
    }
    
    let a = get!();
    let b = get!();
    
    let mut h = 0;
    for i in 1..b-a {
    	h += i;
    }
    let ans = h - a;
	println!("{}", ans);    
}

Measured memory_bytes: 4352
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

int main() {
    int N;
    cin >> N;
    if(N >= 65 && N <= 90) {
        cout << 1 << endl;
    } else if(N >= 97 && N <= 122) {
        cout << 2 << endl;
    } else {
        cout << 0 << endl;
    }
    return 0;
}


Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

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

const long long INF = 1LL << 60;

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

  ll a = 1;
  if(n%2 == 0) a = 2;
  for(int i=3; i<=sqrt(n); i+=2){
    if(n%i == 0) a = i;
  }

  ll b = n/a;
  cout << to_string(b).size() << endl;

  return 0;
}


Measured memory_bytes: 256
S = input()
isOdd = True
isEasy = True
for char in S:
    if isOdd:
        if (char == 'L'):
            isEasy = False
            break
    else:
        if (char == 'R'):
            isEasy = False
            break
    isOdd = not isOdd
print('Yes' if isEasy else 'No')


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rp(i,s,e) for(int i=(s);i<(e);++i)

int main(){
	int N; cin>>N;
	set<string> s;
	// s.insert("0");
	s.insert("a");
	rp(i,1,N){
		set<string>t; swap(s,t);
		for(auto str:t){
			set<char> cset;
			for(auto c:str) cset.insert(c);
			int n = cset.size();
			rp(j,0,n+1){
				// s.insert(str+to_string(j));
				string c(1,j+'a');
				s.insert(str+c);
			}
		}
	}

	for(auto str:s){
		// cout<<">"<<str<<"<\n";//
		for(auto c:str){
			cout<<c;
		}
		puts("");
	}

}


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

using ll = long long;
using namespace std;

int main() {
    int h, w, k;
    cin >> h >> w >> k;
    vector<vector<int>> ans(h, vector<int>(w));
    int from = -1;
    int cur = 1;
    for (int i = 0; i < h; i++) {
        string s;
        cin >> s;
        vector<int> borders;
        for (int c = 0; c < w; c++) {
            if (s[c] == '#') {
                borders.emplace_back(c);
            }
        }
        if (borders.empty() && from < 0) {
            from = i;
        } else if (borders.size()) {
            if (from < 0) {
                from = i;
            }
            if (borders.size() == 1) {
                for (int k = 0; k < w; k++) {
                    for (int ww = from; ww <= i; ww++) {
                        ans[ww][k] = cur;
                    }
                }
                cur++;
            } else {
                int lb = 0;
                for (int l = 0; l < (int)borders.size(); l++) {
                    int b;
                    if (l == (int)borders.size() - 1) {
                        b = w - 1;
                    } else {
                        b = borders[l];
                    }
                    if (lb >= w) {
                        break;
                    }
                    for (int k = lb; k <= b; k++) {
                        for (int ww = from; ww <= i; ww++) {
                            ans[ww][k] = cur;
                        }
                    }
                    lb = b + 1;
                    cur++;
                }
            }
            from = -1;
        }
    }
    if (from > 0) {
        for (int i = from; i < h; i++) {
            for (int k = 0; k < w; k++) {
                ans[i][k] = ans[from - 1][k];
            }
        }
    }
    for (auto a: ans) {
        for (auto aa: a) {
            cout << aa << " ";
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 1152
#include<stdio.h>
#include<algorithm>
#include<string>
#include<map>
#include<vector>
using namespace std;
char str[50];
string name[50];
int b[50];
int c[50];
string d[50][50];
int g[50][50];
int n;
int deg[50];
int best=0;
int dfs(vector<int>use){
	bool ok=true;
	int ret=0;
	for(int i=0;i<n;i++){
		if(use[i]==1)ret+=b[i];
		if(use[i]==-1)ok=false;
	}
	if(ok){
		best=max(best,ret);
		return ret;
	}
	int tmp=0;
	for(int i=0;i<use.size();i++)if(use[i]!=0)tmp+=b[i];
	if(tmp<=best)return tmp;
	int m=-1;
	int at=0;
	for(int i=0;i<n;i++){
		if(!~use[i]){
			int cnt=0;
			for(int j=0;j<n;j++)if(g[i][j]&&!~use[j])cnt++;
			if(m<cnt){
				m=deg[i];at=i;
			}
		}
	}
	// use
	ret=0;
	vector<int> to=use;
	to[at]=1;
	for(int i=0;i<n;i++){
		if(!~use[i]&&g[at][i]){
			to[i]=0;
		}
	}
	ret=max(ret,dfs(to));
	// non use
	to=use;
	to[at]=0;
	ret=max(ret,dfs(to));
	return ret;
}
int main(){
	int a;
	while(scanf("%d",&a),a){
		n=a;
		map<string,int>m;
		for(int i=0;i<a;i++){
			int p,q;scanf("%s%d%d",str,&p,&q);
			name[i]=str;
			b[i]=p;
			c[i]=q;
			m[name[i]]=i;
			for(int j=0;j<q;j++){
				scanf("%s",str);
				d[i][j]=str;
			}
		}
		for(int i=0;i<a;i++)for(int j=0;j<a;j++)g[i][j]=0;
		for(int i=0;i<a;i++)for(int j=0;j<c[i];j++)
			g[i][m[d[i][j]]]=1;
		for(int i=0;i<a;i++)deg[i]=0;
		for(int i=0;i<a;i++)for(int j=0;j<a;j++)deg[i]+=g[i][j];
		vector<int> s(a,-1);
		s[0]=1;
		for(int i=0;i<a;i++)if(g[0][i])s[i]=0;
		for(int i=0;i<a;i++){
			if(deg[i]==0)s[i]=1;
		}
		best=0;
		for(int i=0;i<a;i++){
			if(deg[i]==1){
				for(int j=0;j<a;j++){
					if(g[i][j]&&deg[j]==1){
						if(i&&j){
							if(b[i]>=b[j]){
								s[i]=1;s[j]=0;
							}
						}
					}
				}
			}
		}
		printf("%d\n",dfs(s));
	}
}

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

int main(){
    int n;
    cin >> n;
    vector<vector<int>> map(2, vector<int>(n));
    for(int i = 0; i < 2; i++){
        for(int j = 0;j < n; j++){
            cin >> map[i][j];
        }
    }

    int max = 0;
    for(int i = 0; i < n; i++){
        max +=  map[0][i];
    }
    max += map[1][n - 1];

    int tmp = n - 2;
    for(int i = 0; i < n - 1; i++){
        bool flag = true;
        int sum = 0;
        for(int j = 0; j < n; j++){
            if(j == tmp){
                sum += map[0][j];
                flag = false;
            }
            if(flag){
                sum += map[0][j];
            }
            else{
                sum += map[1][j];
            }
        }
        if(sum > max){
            max = sum;
        }
        tmp--;
    }

    cout << max << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
int gcd(int n,int m){return m==0?n:gcd(m,n%m);}
int read()
{
	int x=0,f=1;char c=getchar();
	while (c<'0'||c>'9') {if (c=='-') f=-1;c=getchar();}
	while (c>='0'&&c<='9') x=(x<<1)+(x<<3)+(c^48),c=getchar();
	return x*f;
}
#define N 300010
#define ll long long
int n,m,p[N],fa[N],deep[N],degree[N],q[N],t,root;
bool flag[N];
struct data{int to,nxt;
}edge[N];
void addedge(int x,int y){t++;edge[t].to=y,edge[t].nxt=p[x],p[x]=t;}
void topsort()
{
	int head=0,tail=0;
	for (int i=1;i<=n;i++) if (!degree[i]) q[++tail]=i;
	while (tail<n)
	{
		int x=q[++head];
		for (int i=p[x];i;i=edge[i].nxt)
		{
			degree[edge[i].to]--;
			if (deep[x]+1>deep[edge[i].to])
			{
				deep[edge[i].to]=deep[x]+1;
				fa[edge[i].to]=x;
			}
			if (!degree[edge[i].to]) q[++tail]=edge[i].to;
		}
	}
}
int main()
{
	n=read(),m=read();
	for (int i=1;i<n+m;i++)
	{
		int x=read(),y=read();
		addedge(x,y);degree[y]++;
	}
	topsort();
	for (int i=1;i<=n;i++) printf("%d\n",fa[i]);
	return 0;
}

Measured memory_bytes: 6500
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
    cin>>N;
  map<int64_t,int64_t>M;
  for(int i=0;i<N;i++){
  int64_t a; cin>>a;a*=-1;
    if(M.count(a))
      M.at(a)++;
    else
      M[a]=1;
   }int64_t ans=0;
  for(auto p:M){
  auto k=p.first;
    auto v=p.second;
    k*=-1;int64_t a=1;
    for(int i=0; ;i++){
    if(k<a)break;
      else
        a*=2;
    }int64_t b=a-k; b*=-1;
    if(-k==b)
      ans+=v/2;
    else{
    if(M.count(b)){
    int64_t c=min(v,M.at(b)); ans+=c;
      M.at(b)-=c;
    }
    }
   }cout<<ans<<endl;
  return 0;
}

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

using namespace std;

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

const int N = 1e5 + 5;

map <ll,int> mpx;
int n;
ll sum,ans;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  cin >> n;
  mpx[0]++;
  for (int i = 0 ; i < n ; i++) {
    int x;
    cin >> x;
    sum += x;
    ans += mpx[sum];
    mpx[sum]++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 12800
#include<stdio.h>
#include<math.h>

int max(int x,int y)
{
  if(x>y)
  {
    return x;
  }
  else
  {
    return y;
  }
}

int main()
{
  int a,b,c,k;
  int i,j;
  
  scanf("%d%d%d%d",&a,&b,&c,&k);
  
  int sum1=a*pow(2,k)+b+c;
  int sum2=a+b*pow(2,k)+c;
  int sum3=a+b+c*pow(2,k);
  
  
  printf("%d\n",max(max(sum1,sum2),sum3));
  return 0;
}

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

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    H,W=MI()
    S=[]
    S.append(["#"]*(W+2))
    for i in range(H):
        s=["#"]+list(input())+["#"]
        S.append(s)
    S.append(["#"]*(W+2))
    
    L=[[-1]*(W+2) for _ in range(H+2)]
    R=[[-1]*(W+2) for _ in range(H+2)]
    U=[[-1]*(W+2) for _ in range(H+2)]
    D=[[-1]*(W+2) for _ in range(H+2)]
    
    for i in range(1,H+1):
        for j in range(1,W+1):
            if S[i][j]!="#":
                L[i][j]=L[i][j-1]+1
                U[i][j]=U[i-1][j]+1
                
    for i in range(H,0,-1):
        for j in range(W,0,-1):
            if S[i][j]!="#":
                R[i][j]=R[i][j+1]+1
                D[i][j]=D[i+1][j]+1
                
    ans=0
    
    for i in range(H+2):
        for j in range(W+2):
            if S[i][j]!="#":
                temp=L[i][j]+R[i][j]+U[i][j]+D[i][j]+1
                ans=max(ans,temp)
                
    # for i in range(H+2):
    #     print(L[i])
    # for i in range(H+2):
    #     print(R[i])
    # for i in range(H+2):
    #     print(U[i])
    # for i in range(H+2):
    #     print(D[i])
                
    print(ans)

main()


Measured memory_bytes: 363204
#include <bits/stdc++.h>
 
using namespace std;
 
#define pb push_back
#define endl '\n'
#define all(x) (x).begin(),(x).end()
#define ff first
#define ss second
#define sz(x) (int)(x).size()
#define f(n) for(int i=0;i<n;++i)
#define f2(n) for(int j=0;j<n;++j)
#define f3(n) for(int k=0;k<n;++k)
#define F(i,x,n,y) for(int i=x;i<n;i+=y)
#define fa(x,y) for(auto x:y)
 
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long long ll;
typedef vector<ll> vll;
 
//Warsaw debug template
#define LOCAL
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
    enable_if<sizeof dud<c>(0) x 1,debug&>::type operator<<(c i){
sim > struct rge {c b,e;};
sim > rge<c> range(c i, c j) {return rge<c>{i,j};}
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug{
#ifdef LOCAL
~debug() {cerr<<endl; }
eni(!=) cerr<< boolalpha << i; ris;}
eni(==) ris <<range(begin(i),end(i)); }
sim, class b dor(pair<b,c> d){
ris<<"("<<d.first<<","<<d.second<<")";
}
sim dor(rge<c> d){
    *this << "[";
    for(auto it=d.b;it!=d.e;++it)
        *this <<"," +(it==d.b)<< *it;
    ris<<"]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) "["<<#__VA_ARGS__":"<<(__VA_ARGS__)<<"]"
//End of debug template
#define isOn(S, j) (S & (1<<j))
#define setBit(S, j) (S | (1<<j))
#define clearBit(S, j) (S & ~(1<<j))
#define toggleBit(S, j) (S ^ (1<<j))
#define lowBit(S) (S & (-S))
typedef vector<ll> vll;

int main(){
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    ll n;
    cin>>n;
    if(n/100>12||n/100==0){
        if(n%100>12||n%100==0){
            cout<<"NA"<<endl;
            return 0;
        }
        cout<<"YYMM"<<endl;
    }else if(n%100>12||n%100==0)cout<<"MMYY"<<endl;
    else cout<<"AMBIGUOUS"<<endl;
    return 0;
}
    


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

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

  L = a + b;
  R = c + d;

  if (L > R) {
    cout << "Left" << endl;
  }
  else if (L < R) {
    cout << "Right" << endl;
  }
  else {
    cout << "Balanced" << endl;
  }
  return 0;
}




Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);}
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}

int n, m;
vector<int> G[1000];
int nextnext[1000];
int num[1000];
int root, siz;
bitset<1000> check(0), ncheck;
int dfs(int i) {
	for(int ne:G[i]) {
		//cout << i << ' ' << ne << endl;
		if(ncheck.test(ne)) {
			nextnext[i] = ne;
			root = ne;
			siz++;
			num[i] = 0;
			return ne;
		}
		if(!check.test(ne)) {
			check.set(ne);
			ncheck.set(ne);
			int hh = dfs(ne);
			if(hh != -1) {
				nextnext[i] = ne;
				siz++;
				num[i] = num[ne]+1;
				return hh == i?-1:hh;
			}
			ncheck.flip(ne);
		}
	}
	return -1;
}
bool near(int i, int j, int now) {
	if(i < now and j < now or i > now and j > now) return i < j;
	else return i > j;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> m;
	rep(i, m) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		G[a].push_back(b);
	}
	memset(nextnext, -1, sizeof(nextnext));
	memset(num, -1, sizeof(num));
	rep(i, n) {
		if(!check.test(i)) {
			check.set(i);
			ncheck.set(i);
			dfs(i);
			ncheck.flip(i);
			if(siz) break;
		}
		if(i == n-1) {
			cout << -1 << endl;
			return 0;
		}
	}
	vi ans;
	rep(i, siz<<1) {
		ans.emplace_back(root);
		int cnd = nextnext[root];
		for(int ne:G[root]) if(num[ne] != -1) {
			if(near(num[ne], num[cnd], num[root])) cnd = ne;
		}
		root = cnd;
	}
	int j = 0;
	for(int i = siz*2-2; i >= 0; i--) {
		if(ans[i] == ans[siz*2-1]) {
			j = i+1;
			break;
		}
	}
	cout << siz*2-j << endl;
	for(int i = j; i < siz*2; i++) {
		cout << ans[i]+1 << '\n';
	}
}

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

struct rect{
    int h,w;
};

bool operator<(rect r1, rect r2){
    if(r1.w == r2.w){
        return r1.h > r2.h;
    }
    return r1.w > r2.w;
}

int main() {

    rect r[6];

    for(int i=0;i<6;i++) {
        cin >> r[i].h >> r[i].w;
        if (r[i].h > r[i].w) {
            swap(r[i].h, r[i].w);
        }
    }

    sort(r,r+6);

    /*if(r[0].w != r[2].w && r[2].w == r[5].w){
        swap(r[0],r[4]);
        swap(r[1],r[5]);
    }*/

    /*for(int i=0;i<6;i++) {
        cout << r[i].w << " " << r[i].h << endl;
    }*/

    if(r[0].h == r[1].h && r[0].w == r[1].w && r[2].h == r[3].h && r[2].w == r[3].w && r[4].h == r[5].h && r[4].w == r[5].w && r[0].w == r[2].w && r[2].h == r[4].h && r[0].h == r[4].w){
        cout << "yes" << endl;
    }
    else{
        cout <<  "no" << endl;
    }

    // x1=x2,y1=y3,y2=x3;


    return 0;
}

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

#define int long long

void solve(int tt)
{
    string s,t;
    cin>>s>>t;
    for(int i=0;i<26;i++)
    {
        string tmp=s;
        tmp+=(char)(i+'a');
        if(tmp==t)
        {
            cout<<"Yes";
            return;
        }
    }
    cout<<"No";
}

int32_t main()
{
    int t=1;
    //cin>>t;
    for(int i=1;i<=t;i++)
        solve(i);
}

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

int main(){
    int d, n;
    cin >> d >> n;
    int ans;
    if(n < 100){
        ans = (int)pow((double)100, (double)d) * n;
    }else{
        ans = (int)pow((double)100, (double)d) * (n + 1);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stdlib.h>
#include <time.h>
#include <iomanip>
#include <math.h>
#include <bitset>

using namespace std;

#define taskname "A"
#define LL long long 
#define uLL unsigned long long 
#define FOR(i,l,r) for(int i = l; i <= r; ++i)
#define REP(i,l,r) for(int i = l; i < r; ++i)
#define FORD(i,r,l) for(int i = r; i >= l; --i)
#define REPD(i,r,l) for(int i = r; i > l; --i)
#define pi pair<int,int>
#define pii pair<int,pi>
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define _USE_MATH_DEFINES 
/* M_PI */

const int maxN = 2e5 + 11;
const LL oo = 1e17 + 11;

int tcases = 1;

/////////////////////////////////////////////////////////////////////////////////////////////////////////////
char ch;
int readInt(){
    bool fl = 0;
    while(ch = getchar(),ch != '-' && (ch < '0' || ch > '9'));
    if(ch == '-'){
        fl = 1;
        while(ch = getchar(),ch < '0' || ch > '9');
    }
    int r = ch - '0';
    while(ch = getchar(),ch >= '0' && ch <= '9') r = r * 10 + (ch - '0');
    return fl ? -r : r;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////

int M;
string S,T;
int A[maxN][2],B[maxN][2];

void testcase(){
    cin >> S >> T;
    FOR(i,1,S.size()){
        A[i][0] = A[i - 1][0] + (S[i - 1] == 'A');
        B[i][0] = B[i - 1][0] + (S[i - 1] == 'B');
    }
    FOR(i,1,T.size()){
        A[i][1] = A[i - 1][1] + (T[i - 1] == 'A');
        B[i][1] = B[i - 1][1] + (T[i - 1] == 'B');
    }
    cin >> M;
    FOR(i,1,M){
        int l1,r1,l2,r2;
        cin >> l1 >> r1 >> l2 >> r2;
        int c1 = ((A[r1][0] - A[l1 - 1][0]) * 2 + (B[r1][0] - B[l1 - 1][0]));
        int c2 = ((A[r2][1] - A[l2 - 1][1]) * 2 + (B[r2][1] - B[l2 - 1][1]));
        if((c1 - c2) % 3 == 0){
            cout << "YES" << endl;
        }else cout << "NO" << endl;
    }

}

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

    //cin >> tcases;

    FOR(i,1,tcases) testcase();

    return 0;
}

Measured memory_bytes: 2512
#include<stdio.h>
#include<string.h>
int main()
{
    int a, b, c;
    scanf("%d%d", &a, &b);
    if((a!=1)&&(b!=1))
    {
        printf("1\n");
    }
    else if((a!=2)&&(b!=2))
    {
        printf("2\n");
    }
    else if((a!=3)&&(b!=3))
    {
        printf("3\n");
    }
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define inf 0x3f3f3f3f3f3f3f3f
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define inv(x) Power(x, mod - 2)
#define fi first
#define se second
#define N 200005

using namespace std;
typedef pair<int,int> Pair;

const int mod = 1e9 + 7;
inline int add(int x, int y) { return (x += y) - (x >= mod ? mod : 0); }
inline void inc(int &x, int y) { (x += y) -= (x >= mod ? mod : 0); }
inline int mul(int x, int y) { return 1ll * x * y % mod; }
inline int Power(int x, int y) {
	int res = 1;
	while (y) {
		if (y & 1) res = mul(res, x);
		x = mul(x, x), y >>= 1;
	} return res;
}

template <class T> inline T	input() {
	int x; char ch; while (!isdigit(ch = getchar()));
	for (x = ch ^ 48; isdigit(ch = getchar()); x = x * 10 + (ch ^ 48));
	return x;
}

template <class T> inline void chkmin(T &x, T &y) { x = x < y ? x : y; }
template <class T> inline void chkmax(T &x, T &y) { x = x > y ? x : y; }

struct {
	inline operator int () { return input<int>(); }
	inline operator long long () { return input<long long>(); }
	template <class T> inline void operator () (T &x) { x = *this; }
	template<class T, class ...A> inline void operator () (T &x, A &...a)
	{ x = *this; this -> operator ()(a...); }
} read;

int w, h, a, b, ans;
int fac[N], ifac[N];

int C(int x, int y) {
	if (y < 0 || x < y) return 0;
	return mul(fac[x], mul(ifac[y], ifac[x - y]));
}

int Path(int x, int y) { return C(x + y, x); }

void init() {
	fac[0] = ifac[0] = 1;
	for (int i = 1; i < N; ++i) fac[i] = mul(fac[i - 1], i);
	ifac[N - 1] = inv(fac[N - 1]);
	for (int i = N - 2; i; --i) ifac[i] = mul(ifac[i + 1], i + 1);
}

int main() {
	init();
	read(h, w, a, b);
	a = h - a + 1;

	for (int x = a - 1, y = b + 1; x && y <= w; --x, ++y)
		inc(ans, mul(Path(x - 1, y - 1), Path(h - x, w - y)));

	printf("%d\n", ans);
	return 0;
}


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

int main() {
  long long a, b;
  cin >> a >> b;
  
  long long result;
  if (b >= a) {
    result = a;
  } else {
    result = a - 1;
  }

  cout << result << endl;
  
  return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
#include <stdlib.h>

int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}

int main () 
{
int n,i,j;
int a[200010];

scanf("%d",&n);


for(i=0;i<n;i++)
{
    scanf("%d",&a[i]);
}

qsort(a, n, sizeof(int), compare_int);

for(i=0;i<n;i++)
{
    if(a[i]==a[i+1])
    {
        printf("NO");
        return 0;
    }
}

printf("YES");
return 0;
}

Measured memory_bytes: 1788
#include <iostream>
#include <iomanip>
typedef long long ll;
using namespace std;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#define repi(i, n, init) for (ll i = init; i < (n); i++)

int main()
{
    int m, d, ans = 0;
    cin >> m >> d;
    repi(i, m + 1, 1)
    {
        repi(j, d + 1, 22)
        {
            int d1 = to_string(j).at(1) - '0';
            int d10 = to_string(j).at(0) - '0';
            if(d1 < 2 || d10 < 2){
                continue;
            }
            if (d1 * d10 == i)
            {
                ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(1000000) #再帰の深さを十分深く設定


n=int(input())
ab = [sorted([int(i)-1 for i in input().split()]) for j in range(n-1)]
c = [int(i) for i in input().split()]
c.sort(reverse = True)

print(sum(c)-max(c))

ko = [[] for i in [0]*n]

for a,b in ab:
    ko[a].append(b)
    ko[b].append(a)
    
ans = [0]*n
pt=0 
used = [0]*n
#print(c)
#print(ab)
#print(ko)
def dfs(x):
    global pt #numbたちがグローバル変数だと教えてあげる
    used[x]=1
    #(x,y)地点を訪問済みにする
    #(x,y)地点での処理を行う（マスの色をカウントするなど）
#    print(x,pt)
    ans[x] = c[pt]
    pt+=1
    #foreach((nx,ny) \in (x,y)のお隣さん){(nx,ny)に訪問していないとき、dfs(nx,ny)} 
    for i in ko[x]:
        if used[i] == 0:
            dfs(i)
        
dfs(0)

print(*ans)

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

using namespace std;

int main(){
  int n;
  cin>>n;
  while(n--){
    string str;
    cin>>str;
    int sum=0;
    for(int i = 0; i < str.size(); i++)
      sum+=(str[i]-'0');
    int ct=0;
    int s=sum;
    while(s>=10){
      ct+=s/10;
      int left=s%10+s/10;
      s=left;
    }
    int cnt=ct+str.size()-1;
    if(cnt%2==0)
      cout<<"Audrey ";
    else
      cout<<"Fabre ";
    cout<<"wins."<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
using namespace std;
namespace adaptor = boost::adaptors;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
typedef long long ll;


void Main()
{
	int N, A;
  	cin >> N >> A;
  	vector<int> x(N);
  	int Xmax = 0;
  	rep(i,N){
        cin >> x[i];
      	x[i] -= A;
      	Xmax = max(Xmax,abs(x[i]));
      	//cout << x[i] << " ";
    }
  	//cout << endl;

  	if(Xmax==0){
        // 例外処理
      	ll ans = pow(2,N);
      	cout << ans-1 << endl;
      	return;
    }
  
	int T = 2*N*Xmax+1;   
 	vector<vector<ll>> dp(N+1, vector<ll>(T));
	
  	rep(t,T){
  		dp[0][t] = 0;
    }
  	dp[0][N*Xmax] = 1;
  
  	//rep(t,T) cout << 0 << "," << t-N*Xmax << ": " << dp[0][t] << endl;
  
  	rep3(j,1,N){
      rep(t,T){
        if(t-x[j-1] < 0 || t-x[j-1] > T-1){
			dp[j][t] = dp[j-1][t];
        }
        else{
			dp[j][t] = dp[j-1][t] + dp[j-1][t-x[j-1]];            	
        }
        //cout << j << "," << t-N*Xmax << ": " << dp[j][t] << endl;
      }
    }
	cout << dp[N][N*Xmax] - 1 << endl;  
	return;
}

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


Measured memory_bytes: 2304
#ord('A') , ord('Z') (65, 90)
n = int(input())
s = input()
#n = 2
#s = 'ABCXYZ'

ans = ''
for i in s:
  x = ord(i) + n
  if x > 90:
    x = 65 + x % 90 -1
  ans += chr(x)

print(ans)

Measured memory_bytes: 3060
#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 ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ll long long int
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define all(x) x.begin(),x.end()
#define sz(x) (ll)x.size() 

ll power(ll x,ll y,ll p) 
{ 
    ll res = 1;      
    x = x % p;  
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1; 
        x = (x*x) % p;   
    } 
    return res; 
} 
ll a[500005];
int main()
{
    ios_base::sync_with_stdio(false);
	ll n,i,j,k,x,y,t,m;

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

	ll curr=0;
	for(i=1;i<=n;i++)
	{
		if(curr+1==a[i])
			curr++;
	}
	if(curr)
	cout<<n-curr<<endl;

	else
		cout<<-1<<endl;
}

Measured memory_bytes: 1792
use proconio::input;
const MOD: isize = 1_000_000_007;

fn main() {
  input! {
    n: usize
  }
  
  if n == 1 {
    println!("0");
    return
  }
  
  let mut result: isize = 1;
  for i in 0..n {
    result *= 10;
    result %= MOD;
  }
  
  let mut a: isize = 1;
  for i in 0..n {
    a *= 9;
    a %= MOD;
  }
  
  let mut b: isize = 1;
  for i in 0..n {
    b *= 9;
    b %= MOD;
  }
  
  let mut c: isize = 1;
  for i in 0..n {
    c *= 8;
    c %= MOD;
  }
  
  let mut minus = (a + b) % MOD;
  minus = (minus - c) % MOD;
  if minus < 0 {
    minus += MOD;
  }
  
  result = (result - minus) % MOD;
  if result < 0 {
    result += MOD;
  }
  
  println!("{}", result);
}

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

#define rep(i,n) for(ll (i)=0;(i)<(ll)(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007LL
#define INF (1LL<<60LL)
#define int long long
typedef long long ll;

using namespace std;

#define MAX_N 1000000

signed main() {
	while (1) {
		ll n, x; cin >> n >> x;
		if (n == 0 && x == 0) break;
		ll ans = 0;
		for(ll i=1;i<=n;i++)
			for (ll j = i + 1; j <= n; j++) {
				if (j < x - i - j && x - i - j <= n) ans++;
			}
		cout << ans << endl;
	}
}


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

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;

const long long INF = 1LL << 60;

int main()
{
    int H, W;
    cin >> H >> W;

    vector<vector<int>> s(H + 2, vector<int>(W + 2, 0));
    rep(i, H) {
        rep(j, W) {
            char a;
            cin >> a;
            if (a == '.') s[i + 1][j + 1] = 0;
            else s[i][j] = 1;
        }
    }

    bool flag = true;
    repd(i, 1, H + 1) {
        repd(j, 1, W + 1) {
            if (s[i][j] == 1) {
                int judge = s[i - 1][j] + s[i + 1][j] + s[i][j - 1] + s[i][j + 1];
                if (judge == 0) {
                    flag = false;
                    break;
                }
            }
        }
        if (!flag) break;
    }

    if (flag) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cassert>
#include<math.h>
#include<complex>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<functional>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=1e9+7;

ll N,M,K;
ll A[200010],B[200010];
ll bSum[200010];
int main(){
    cin>>N>>M>>K;
    for(ll i=0;i<N;i++){
        cin>>A[i];
    }
    for(ll i=0;i<M;i++) cin>>B[i];
    bSum[0]=B[0];
    for(ll i=1;i<M;i++) bSum[i]=bSum[i-1]+B[i];
    ll aSum=0;
    ll ans=0;
    for(ll i=0;i<=N;i++){
        aSum+=A[i-1];
        if(aSum>K)break;
        ans=max(ans,i+(upper_bound(bSum,bSum+M,K-aSum)-bSum));
    }
    cout<<ans<<endl;

    return 0;
}

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

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

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

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

    int n;
    cin >> n;
    vector<int> a(n + 1);
    for (int i = 1; i <= n; i++)
        cin >> a[i];
    vector<int> ret(n + 1, 0);
    bool f = true;
    for (int i = n; i >= 1; i--)
    {
        int cnt = 0;
        for (int j = i; j <= n; j += i)
        {
            if (ret[j])
                cnt++;
        }
        ret[i] = 1 - (cnt % 2 == a[i]);
    }
    if (!f)
        cout << -1 << endl;
    else
    {
        vector<int> b;
        for (int i = 1; i <= n; i++)
            if (ret[i])
                b.push_back(i);
        cout << b.size() << endl;
        printv(b);
    }
}


Measured memory_bytes: 3192
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>
#include <limits>
#include <cassert>

using namespace std;

/* template */

using ll = long long;

void debug_out() { std::cout << std::endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cout << "debug: "; debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif

#define rep(i, a, n) for (int i = (int)(a); i < (int)(n); i++)
#define rrep(i, a, n) for (int i = ((int)(n-1)); i >= (int)(a); i--)
#define Rep(i, a, n) for (long long i = (long long)(a); i< (long long)(n); i++)
#define RRep(i, a, n) for (long long i = ((long long)(n-1ll)); i>=(long long)(a); i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}

struct Edge{
    int to;
    int weight;
    Edge(int t, int w) : to(t), weight(w){ }
};

struct edge{
    int from;
    int to;
    ll weight;
    edge(int f,int t,ll w) : from(f), to(t), weight(w){ }
};


using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;
using edges = vector<edge>;

template <class T>
inline bool chmin(T &a, T b){
    if (a > b){
        a = b;
        return true;
    }
    return false;
}

template <class T>
inline bool chmax(T &a, T b){
    if (a < b){
        a = b;
        return true;
    }
    return false;
}

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

constexpr ll LNF = 1e15+7;

constexpr int INF = 1e9+7;

vector<int> dx = {-1,0,1,0,-1,1,-1,1};
vector<int> dy = {0,-1,0,1,1,-1,-1,1};

/* template */

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,t; cin >> n >> t;
    vector<vector<int>> a(n,vector<int>(2));
    rep(i,0,n){
        cin >> a[i][0] >> a[i][1];
    }
    vector<vector<int>> dp1(n+1,vector<int>(t,0)),dp2(n+1,vector<int>(t,0));
    rep(i,0,n){
        rep(j,0,t){
            if(j+a[i][0]<t){
                chmax(dp1[i+1][j+a[i][0]],dp1[i][j]+a[i][1]);
            }
            if(j+a[n-i-1][0]<t){
                chmax(dp2[n-i-1][j+a[n-i-1][0]],dp2[n-i][j]+a[n-i-1][1]);
            }
            chmax(dp1[i+1][j],dp1[i][j]);
            chmax(dp2[n-i-1][j],dp2[n-i][j]);
        }
    }
    int ans = 0;
    rep(i,0,n){
        rep(j,0,t){
            chmax(ans,dp1[i][j]+dp2[i+1][t-j-1]+a[i][1]);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 71040
def exhaustive(i,A,m,n):
    if m==0:
        return True
    if i>=n:
        return False
    
    return exhaustive(i+1,A,m,n) or exhaustive(i+1,A,m-A[i],n)
    
    
def inputting():
    n=int(input())
    A=list(map(int,input().split()))
    q=int(input())
    M=list(map(int,input().split()))
    return n,A,q,M

def main():
    A=[]
    M=[]
    n,A,q,M=inputting()
    total = sum(A)
    for m in M:
        if total<m:
            print("no")
            continue
        bool=exhaustive(0,A,m,n)
        if bool==True:
            print("yes")
        else:
            print("no")

if __name__=='__main__':
    main()



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

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "Yes" : "No") << endl;
typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;
const int MAX_N = 1e5 + 1;

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

  CIN(a, b, c);
  OK(a + b == c or a + c == b or b + c == a);

  return 0;
}




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

int main(){
    ll a,b,k;
    cin >> a >> b >> k;
    if(a>=k){
        a -= k;
        k = 0;
        cout << a << " " << b << endl;
        return 0;
    }
    k -= a;
    a = 0;
    if(b>=k){
        b -= k;
        k = 0;
        cout << a << " " << b << endl;
        return 0;
    }
    k -= b;
    b = 0;
    cout << a << " " << b << endl;
    
}

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

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
template<typename T> void view(T cont) {std::cout << cont << std::endl;}
template<typename T> void view(T* cont, ll sz) {rep(i, sz) std::cout << cont[i] << " "; std::cout << std::endl;}
template<typename T> void view(const std::vector<T>& v) {for (const auto& f: v) std::cout << f << " "; std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv) { for (const auto& v: vv) {view(v);}}
const long long INF = 1LL<<60;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

int main(){
    int N, M; cin >> N >> M;
    vector<vector<int> > A(N, vector<int>(N, 0));
    rep(i, M) {
        int temp_a, temp_b; cin >> temp_a >> temp_b;
        A[temp_a - 1][temp_b - 1] = 1;
        A[temp_b - 1][temp_a - 1] = 1;
    }
    // rep(i, N) {
    //     rep(j, N) cout << A[i][j] << " ";
    //     cout << endl;
    // }

    vector<int> order;
    for (int i = 1; i < N; i++) {
        order.push_back(i);
    }
    // view(order);
    int count = 0;
    do {
        bool flag = false;
        
        int len = 0;
        for(int i = 0; i < N - 1; i++) {
            int from, to;
            if (i == 0) {
                from = 0;
            } else {
                from = order[i - 1];
            }
            to = order[i];
            // cout << "from: " << from << "to: " << to << endl;
            if (!A[from][to]) {
                break;
            } else {
                len++;
            }
        }
        // cout << 0 << " ";
        // rep(i, N - 1) {
        //     cout << order[i] << " ";
        // }
        // cout << endl;
        // cout << "length: " << len << endl;
        if (len == N - 1) {
            // cout << "success" << endl;
            count++;
        }
        // if (flag) count++;
    } while (next_permutation(order.begin(), order.end()));
    cout << count << endl;
}

Measured memory_bytes: 256
input1 = list(map(int, (input().split())))
input2 = list(map(int, (input().split())))
input3 = list(map(int, (input().split())))

a = input1 + input2 + input3

n = int(input())

b = []
for i in range(n):
    b.append(int(input()))

# print(b)
for s in b:
    for i in range(9):
        if a[i] == s:
            a[i] = 0

for i in range(3):
    if(a[i] + a[i+3] + a[i+6] == 0):
        print("Yes")
        exit(0)

for i in [0, 3, 6]:
    # print(i)
    if(a[i] + a[i+1] + a[i+2] == 0):
        print("Yes")
        exit(0)

if(a[0] + a[4] + a[8] == 0):
    print("Yes")
    exit(0)

if(a[2] + a[4] + a[6] == 0):
    print("Yes")
    exit(0)

print("No")


Measured memory_bytes: 3064
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    char s[100];
    char t[100];
    scanf("%s %s", s, t);
    printf("%s%s", t, s);
    
    return 0;
}


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

Measured memory_bytes: 3628
#include<stdio.h>
int main()
{
  int f,d;
  scanf("%d %d",&f,&d);
  if(f>d)
    printf("a > b\n");
  else if(f<d)
    printf("a < b\n");
  else
    printf("a == b\n");
  return 0;
}

Measured memory_bytes: 2552
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
#define yes cout<<"YES"<<"\n"
#define no cout<<"NO"<<"\n"

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n;
	cin>>n;
	vector<pair<string,pii> >in(n);
	rep(i,n)cin>>in[i].first>>in[i].second.first,in[i].second.first*=-1,in[i].second.second=i;
	sort(all(in));
	rep(i,n)cout<<in[i].second.second+1<<endl;
	
	
	
}











Measured memory_bytes: 256
import std.stdio, std.string, std.array, std.conv;

long cnt;
int[] y;

void insertionSort(int n, int g, int[] x) {
    foreach (i; g .. n) {
        int v = x[i];
        int j = i - g;
        while (j >= 0 && x[j] > v) {
            x[j+g] = x[j];
            j -= g;
            ++cnt;
        }
        x[j+g] = v;
    }
}

void shellSort(int n, int[] x) {
    int h = 1;
    while (true) {
        if (h > n) break;
        y ~= h;
        h = 3 * h + 1;
    }
    foreach_reverse (z; y) {
        insertionSort(n, z, x);
    }
}

void main() {
    int n = readln.chomp.to!int;
    int[] a = new int[n];
    foreach (i; 0 .. n) {
        a[i] = readln.chomp.to!int;
    }
    cnt = 0;
    shellSort(n, a);
    y.length.writeln;
    foreach_reverse (i, z; y) {
        z.write;
        if (i) " ".write;
        else writeln;
    }
    cnt.writeln;
    foreach (i, x; a) {
        x.writeln;
    }
}


Measured memory_bytes: 7088
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long int
#define ff first
#define ss second
#define S size()
#define mod (ll)(1e9+7)
#define mset(a,k) memset(a,k,sizeof(a))
#define fr(i, x, y) for ( ll i = x; i < y;i++)
#define dr(i, x, y) for ( ll i = x; i >= y; i--)
#define all(v) v.begin(), v.end()
#define pqueue priority_queue<ll>
#define piqueue priority_queue<ll,vll ,greater<ll>>
#define mapcl map<char,ll>
#define mapll map<ll,ll>
#define mapsl map<string,ll>
#define vi vector<ll>
#define vs vector<string>
#define vb vector<bool>
#define psi pair<string,ll>
#define pii pair<ll,ll>
#define piii pair<ll,pii>
#define vii vector<pii>
#define vvi vector<vi>
#define vvii vector<vii>
using namespace std;
void fast() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
}
//----------------------------------------FUNCTIONS-------------------------------------
ll gcd(ll x, ll y )						{if (y == 0) return x; return gcd(y, x % y);}
ll lcm(ll a, ll b)						{return (a * b) / gcd(a, b);}
const ll MAXN = (ll)(1 * 1e6 + 5 );
void solve()
{
	ll n;
	cin>>n;
	ll cnt = 0;
	ll x, y;
	fr(i,0,n)
	{
		
		cin >> x >> y;
		if(x==y)
		{
			cnt++;
			if(cnt>=3)
			{
				cout << "Yes\n";
				return;
			}
		}
		else
		{
			if(cnt>=3)
			{
				cout << "Yes\n";
				return;
			}
			cnt = 0;
		}	
	}
	//if(cnt>=)
	cout << "No\n";
}
int main()
{
	fast();
	ll t = 1;
//	cin >> t;
	fr(i, 0, t)
    	{
		solve();
	}
}

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

using namespace std;
typedef long long int LL;
typedef long long int ll;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SP << " " <<

LL mod = 1000000007;

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  LL L,R;
  cin >> L >> R;
  if(R-L>=10000){
    cout << 0 << endl;
  }else{
    LL mini = 10000;
    FOR(i, L, R + 1)
    {
      FOR(j,i+1,R+1){
        LL a = (i * j) % 2019;
        if(a<mini){
          mini = a;
        }
      }
    }
    cout << mini << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> Pl;
#define all(a) (a).begin(),(a).end()
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=(a);i<(b);i++)
#define rrep(i,n) for(ll (i)=(n)-1;(i)>=0;i--)
#define SHOW(x) cout << #x << ": " << x << endl;
const ll INF=1e18,MOD = 1e9+7;
const int iINF = 1e9;

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(a == b && b !=c || a == c && b !=c || a != b && b ==c)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 256
n=int(input())
#a,b=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]

import math
ans=len(str(n))
for i in range(1,int(math.sqrt(n))+1):
    if n%i==0:
        ans=max(len(str(i)),len(str(n//i)))

print(ans)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; (i) < ((int)(n)); ++(i))
const ll INF = 1e10;
const ll MOD = 1e9 + 7;

int main() {
    ll ans = 0;
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ans = a * c;
    ans = max(ans, a * d);
    ans = max(ans, b * c);
    ans = max(ans, b * d);

    cout << ans << endl;
}

Measured memory_bytes: 3620
#include<stdio.h>
int main(void)
{
	int a,b,x,y,z;
	scanf("%d %d",&a,&b);
	x=(a+b)/2;
	y=(a+b)%2;
	if(y!=0){
		x=x+1;
	}
	printf("%d\n",x);
	return 0;
}

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



int main(){
   int n,k;
   int ans=0;
   cin >> n >> k;
   vector<int>a(n);
   rep(i,n) cin >> a[i];
   sort(a.begin(),a.end());
   reverse(a.begin(),a.end());
   rep(i,k) ans+=a[i];
   cout << ans << endl;
    return 0;
}

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

int main(){
  int N,M; 
  cin >> N;
  vector<string> s(N);
  for(int i = 0; i < N; i++)
    cin >> s.at(i);
  cin >> M;
  vector<string> t(M);
  for(int i = 0; i < M; i++)
    cin >> t.at(i);
  
  vector<int> score(N);
  for(int i = 0; i < N; i++){
    for(int j = 0; j < N; j++){
      if(s.at(j) == s.at(i))
        score.at(i)++;
    }
    for(int j = 0; j < M; j++){
      if(t.at(j) == s.at(i))
        score.at(i)--;
    }
  }
  
  int S = 0;
  for(int i = 0; i < N; i++){
    if(S < score.at(i))
      S = score.at(i);
  }
  
  cout << S << endl;
}

Measured memory_bytes: 256