akhauriyash/Code-Regression huggingface dataset:
a = []
for i in range(3):
    aa = list(map(int, input().split()))
    a.append(aa)
n = int(input())
b = [0]*n
for i in range(n):
    b[i] = int(input())

for x in b:
    for i in range(3):
        for j in range(3):
            if x == a[i][j]:
                a[i][j] = -1
ans = 'No'
for i in range(3):
    if a[i][0] == a[i][1] and a[i][1] == a[i][2]:
        ans = 'Yes'

for i in range(3):
    if a[0][i] == a[1][i] and a[1][i] == a[2][i]:
        ans = 'Yes'

if a[0][2] == a[1][1] and a[1][1] == a[2][0]:
    ans = 'Yes'

if a[0][0] == a[1][1] and a[1][1] == a[2][2]:
    ans = 'Yes'

print(ans)

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

using namespace std;

int main(){
    int K;
    string S;
    cin>>K;
    cin>>S;

    for(int i= 0; i < S.length(); i++){
        if(i>=K){
            cout<<"...";
            break;
        }else{
            cout<<S[i];
        }

    }
}


Measured memory_bytes: 3572
#include<bits/stdc++.h>
#define ll long long int
#define ve vector<int>
#define vl vector<long long int>
#define vs vector<string>
#define vve vector<vector<int>>
#define all(a) a.begin(),a.end()
using namespace std;

int main(){
  string s;
  cin>>s;
  int a=s.size();
  for(int i=0;i<a;i++){
    cout<<'x';
  }
  cout<<endl;
}

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

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

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

    int d_int = 0;
    double d_double = 0;
    int count = 0;

    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            for (int k = 0; k < d; k++) {
                d_int += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
                d_double += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
            }
            d_int = sqrt(d_int);
            d_double = sqrt(d_double);
            if (d_int == d_double) {
                count++;
            }
            d_int = 0;
            d_double = 0;
        }
    }

    cout << count << endl;
}

Measured memory_bytes: 3704
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 1e9
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353
#define REP(i,n) for(long long i = 0;i < n;++i)    
#define seg_size 524288
long long gcd(long long a, long long b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int main() {
	while (true) {
		int n, m;
		cin >> n >> m;
		if (n == 0) return 0;
		vector<int> a, b;
		int sum = 0;
		REP(i, n) {
			int c;
			cin >> c;
			a.push_back(c);
			sum += c;
		}
		REP(i, m) {
			int a;
			cin >> a;
			b.push_back(a);
			sum -= a;
		}
		pair<int, int> ans = make_pair(10000, 10000);
		REP(i, n) {
			REP(q, m) {
				int diff = -2 * a[i] + 2 * b[q];
				if (diff == -sum) {
					if (ans.first + ans.second > a[i] + b[q]) {
						ans = make_pair(a[i], b[q]);
					}
				}
			}
		}
		if (ans.first == 10000) {
			cout << -1 << endl;
		}
		else {
			cout << ans.first << " " << ans.second << endl;
		}
	}
}


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

long long binary(long long bina,long long k){
    long long ans = 0;
    for (long long i = 0; bina>0 ; i++)
    {
        bina = bina/k;
        ans++;
    }
    return ans;
    //to_string(ans).size();
}

int main() {
    //
    long long num,k;
    string kekka;
    cin >> num >> k;
    long long size = binary(num, k);

    cout << size;

    //
}


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

int main() {
  int k, n;

  vector<int> a;

  cin >> k >> n;

  for (int i = 0; i < n; i++) {
    int tmp;
    cin >> tmp;
    a.push_back(tmp);
  }

  int tmp = abs(a.at(n - 1) - k) + a.at(0);
  int ans = abs(a.at(n - 1) - k) + a.at(0);

  for (int i = 0; i < n - 1; i++) {
    if (tmp < a.at(i + 1) - a.at(i)) {
      tmp = a.at(i + 1) - a.at(i);
    }
    ans += a.at(i + 1) - a.at(i);
  }

  cout << ans - tmp;

  return 0;
}

Measured memory_bytes: 1400
#include<bits/stdc++.h>
using namespace std;
using lint = long long int;

int main(){

    int a,b;
    cin >> a >> b;

    int ma = -100000;

    ma = max(ma, a+b);
    ma = max(ma, a-b);
    ma = max(ma, a*b);

    cout << ma << endl;

}

Measured memory_bytes: 256
N, M = map(int, input().split())
shop = list()
for i in range(N):
    li = list(map(int, input().split()))
    shop.append(li)

shop.sort()

ans = 0
for i in range(N):
    if M - shop[i][1] >= 0:
        ans += shop[i][0] * shop[i][1]
        M -= shop[i][1]
    else:
        ans += M * shop[i][0]
        break

print(ans)


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

#define MOD 1000000007
// #define INF 100000000000

using namespace std;
typedef unsigned long long ull;
typedef long long ll;


template <class T>
ostream &operator<<(ostream &o, const vector<T>&obj) {
    o << "["; for (int i = 0; i < (int)obj.size(); ++i) o << (i > 0 ? ", " : "") << obj[i]; o << "]"; return o;
}
template <class T>
ostream &operator<<(ostream &o, const vector<vector<T>>&obj) {
    o << "[" << endl; for (int i = 0; i < (int)obj.size(); ++i) o << "  " << obj[i] << endl; o << "]"; return o;
}
template <class T, class U>
ostream &operator<<(ostream &o, const pair<T, U>&obj) {
    o << "(" << obj.first << ", " << obj.second << ")"; return o;
}
template <class T, class U>
ostream &operator<<(ostream &o, const map<T, U>&obj) {
    o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;
}
template <class T>
ostream &operator<<(ostream &o, const set<T>&obj) {
    o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;
}
template <class T>
ostream &operator<<(ostream &o, const queue<T>&obj) {
    queue<T> obj_cp = obj;
    bool first = true;
    o << "{";
    while (!obj_cp.empty()) { o << (!first ? ", " : "") << obj_cp.front(); obj_cp.pop(); first = false; }
    o << "}"; return o;
}

void print() {
    cout << "\n";
}
template<class Head, class... Body>
void print(Head head, Body... body) {
    cout << head << " ";
    print(body...);
}


void display_base(int n, int b) {
    vector<int> v;
    int n_ = n;
    while(n_ > 0) {
        v.push_back(n_ % b);
        n_ /= b;
    }
    cout << n << "(" << b << ") = ";
    for (int i = v.size()-1; i >= 0; i--) {
        cout << v[i];
    }
    cout << endl;
}


int main(int argc, char const *argv[]) {
    int D, G;
    cin >> D >> G;
    G /= 100;

    vector<int> p(D);
    vector<ll> c(D);
    for (int i = 0; i < D; ++i) {
        cin >> p[i] >> c[i];
        c[i] /= 100;
    }

    vector<int> dp(1 << D, 0);
    for (int s = 0; s < (1 << D); ++s) {
        for (int i = 0; i < D; ++i) {
            if (!(s & (1 << i))) {
                dp[s | 1 << i] = dp[s] + (i + 1) * p[i] + c[i];
            }
        }
    }

    int ans = 1001;
    for (int s = 0; s < (1 << D); ++s) {
        int base = 0;
        for (int i = 0; i < D; ++i) {
            if (s & (1 << i)) {
                base += p[i];
            }
        }

        if (dp[s] >= G) {
            ans = min(ans, base);
            continue;
        }

        int res = -1;
        for (int i = D-1; i >= 0; --i) {
            if (s & (1 << i)) continue;
            int c = (G - dp[s] + i) / (i+1);
            if (c < p[i]) {
                res = c;
            }
            break;
        }
        if (res == -1) continue;

        // display_base(s, 2);
        // print(base, res);
        ans = min(ans, base + res);
    }
    // print(dp);

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int X;
	long long ans = 0;
	int tmp;
	cin >> X;
    tmp = floor(sqrt((double)X*2));
    if(tmp*(tmp+1)>=X*2) cout << tmp << endl;
    else cout << tmp+1 << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
using namespace std;
#define MOD 1000000007
#define INF (1<<29)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;

#define max(x, y) ((x)>(y)?(x):(y))
#define min(x, y) ((x)<(y)?(x):(y))

class WeightedUnionFind{
public:
  int n;
  vector<int> u;
  vector<Int> weight;
  WeightedUnionFind(int n = 0):n(n){
    u = vector<int>(n);
    weight = vector<Int>(n,0);
    for(int i = 0;i < n;i++)u[i] = i;
  }
  int r(int x){
    if(u[x] == x)return x;
    r(u[x]);
    weight[x] += weight[u[x]];
    return u[x] = r(u[x]);
  }

  Int dif(Int x, Int y){
    if(r(x) != r(y))return INF;
    return weight[x] - weight[y];
  }

  //x - y == w
  bool isOK(int x, int y, Int w){
    if(r(x) != r(y))return false;
    return dif(x,y) == 0;
  }

  int unite(int x, int y, Int w){
    r(x);
    r(y);
    w += weight[y];
    w -= weight[x];
    x = r(x);
    y = r(y);
    u[x] = y;
    weight[x] = w;
  }
};

Int n, q, com, x, y, z;
int main(){
  cin >> n >> q;
  WeightedUnionFind wuf(n);
  while(q--){
    cin >> com;
    if(com == 0){
      cin >> x >> y >> z;
      wuf.unite(y, x, z);
    }
    else{
      cin >> x >> y;
      if(wuf.r(x) != wuf.r(y))cout << "?" << endl;
      else cout << wuf.weight[y] - wuf.weight[x] << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 4716
#include<bits/stdc++.h>
using namespace std;
const int mo=998244353;
map<string,int> dp;
string s;
int calc(string s){
  	if (dp.find(s)!=dp.end()) return dp[s];
   	int n=s.size(),f[105],i,j,k,l;
   	string subs,pres=s; s="0"+s;
   	for (i=f[0]=1;i<=n;i++){
   		f[i]=1ll*f[i-1]*(s[i]-'0'+1)%mo;
   		for (j=1;j*2<=i;j++){
   			subs.clear();
   			for (k=1;k<=j;k++) subs+=s[i-j+k];
   			for (k=2;j*k<=i;k++){
   				for (l=1;l<=j;l++)
   					if (s[i-j*k+l]=='0') subs[l-1]='0';
   					f[i]=(f[i]+1ll*f[i-j*k]*calc(subs))%mo;
   			}
   		}
   	}
   	return dp[pres]=f[n];
}
int main(){
   	cin>>s;
   	dp["0"]=1; dp["1"]=2;
   	printf("%d\n",calc(s));
}

Measured memory_bytes: 1408
#include<stdio.h>
#define INF 10000000

int main(){
    int n,p[101],m[101][101];
    int j,q;

    scanf("%d",&n);
    for(int i=1 ; i<=n ; i++) scanf("%d%d",&p[i-1],&p[i]);

    for(int i=1 ; i<=n ; i++) m[i][i] = 0;
    
    for(int i=2 ; i<=n ; i++){
        for(int l=1 ; l<=n-i+1 ; l++){
            j = l+i-1;
            m[l][j] = INF;
            for(int k=l ; k<j ; k++){
                q = m[l][k]+m[k+1][j]+p[l-1]*p[k]*p[j];
                m[l][j] = (m[l][j]>q) ? q : m[l][j];
            }
        }
    }

    printf("%d\n",m[1][n]);

    return 0;
}




Measured memory_bytes: 2140
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

n,m=map(int,input().split())
ab=[[int(i) for i in input().split()] for j in range(m)]
edge=[[] for i in range(n+1)]
for a,b in ab:
    edge[a].append(b)
    edge[b].append(a)
    
color=[None]*(n+1)
color[1]=0
q=[1]

while q:
    x=q.pop()
    for j in edge[x]:
        if color[j] is None:
            color[j]=1-color[x]
            q.append(j)
bl = all(color[a]!=color[b] for a,b in ab)

if bl:
    x=sum(color[1:])
    y=n-x
    ans=x*y-m
else:
    ans=n*(n-1)//2-m
print(ans)

Measured memory_bytes: 34652
//#define MYDEBUG
#include <bits/stdc++.h>

#ifdef MYDEBUG
#define dbp(x) cout<<#x<<": "<<x<<endl
#define dbp2(x,y) cout<<#x<<","<<#y<<": "<<x<<","<<y<<endl
#define dbp3(x,y,z) cout<<#x<<","<<#y<<","<<#z<<": "<<x<<","<<y<<","<<z<<endl
#define dbp4(w,x,y,z) cout<<#w<<","<<#x<<","<<#y<<","<<#z<<": "<<w<<","<<x<<","<<y<<","<<z<<endl
#define ifcin(x) std::ifstream cin(x)
#else
#define dbp(x)
#define dbp2(x,y)
#define dbp3(x,y,z)
#define dbp4(w,x,y,z)
#define ifcin(x)
#endif
#define ll long long
#define ull unsigned long long
#define all(x) x.begin(), x.end()
#define rep(i, from, to) for(int i=from; i<to; ++i)
#define REP(i, from, to) for(int i=from; i<=to; ++i)
#define EPS = 1e-14;
using std::vector;
using std::cout;
using std::cin;
using std::endl;
using std::max;
using std::min;
using std::swap;
using std::string;
using std::fill;
using std::pair;
using std::sort;
using std::reverse;
using std::pair;
using std::greater;
using std::priority_queue;
using std::ostream;
typedef std::complex<int> P;

template<typename T>
ostream& operator<<(ostream& out, const vector<vector<T> >& v) {
	for (size_t i = 0; i < v.size(); ++i) {
		out << v[i] << endl;
	}
	return out;
}

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
	out << "[";
	size_t last = v.size() - 1;
	for (size_t i = 0; i < v.size(); ++i) {
		out << v[i];
		if (i != last) {
			out << ",";
		}
	}
	out << "]";
	return out;
}

const int MAX_N = 1 << 17;
const int LAZY_INIT = -1;
const int VAL_INIT = INT_MAX;
int N = 1;
int mini[MAX_N*2], lazy[MAX_N*2];

void init(int n_){
	while(N < n_){
		N *= 2;
	}
	for(int i = 0; i < N*2 - 1; ++i){
		lazy[i] = LAZY_INIT;
		mini[i] = VAL_INIT;
	}
}

void setLazy(int k, int v){
	lazy[k] = v;
	mini[k] = v;
}

void push(int k){
	if(lazy[k] == LAZY_INIT){
		return;
	}
	setLazy(k*2+1, lazy[k]);
	setLazy(k*2+2, lazy[k]);
	lazy[k] = LAZY_INIT;
}

void fix(int k){
	mini[k] = min(mini[k*2+1], mini[k*2+2]);
}

void fill(int qL, int qR, int val, int k=0, int nL=0, int nR=N){
	if(nR<=qL || qR<=nL){
		return;
	}
	if(qL<=nL && nR<=qR){
		setLazy(k, val);
		return;
	}
	push(k);
	int nM = (nL+nR)/2;
	fill(qL, qR, val, k*2+1, nL, nM);
	fill(qL, qR, val, k*2+2, nM, nR);
	fix(k);
}

int minimum(int qL, int qR, int k=0, int nL=0, int nR=N){
	if(qR<=nL || nR <=qL){
		return VAL_INIT;
	}
	if(qL<=nL && nR<=qR){
		return mini[k];
	}
	push(k);
	int nM = (nL+nR)/2;
	int vl = minimum(qL, qR, k*2+1, nL, nM);
	int vr = minimum(qL, qR, k*2+2, nM, nR);
	return min(vl, vr);
}

void print(){
	cout << "mini: ";
	rep(i, 0, N-1+N){
		cout << mini[i] << ",";
	}
	cout << endl;
	cout << "lazy: ";
	rep(i, 0, N-1+N){
		cout << lazy[i] << ",";
	}
	cout << endl;
}

int n, q;
void solve() {
	ifcin("/storage/emulated/0/AppProjects/AtCoder/jni/in.txt");
	cin >> n >> q;
	init(n);
	rep(query_index, 0, q){
		int com;
		cin >> com;
		if(com==0){
			int s,t,x;
			cin >> s >> t >> x;
			//print();
			fill(s, t+1, x);
			//dbp4(N, s,t,x);
			//print();
			//cout << endl;
		}else{
			int i;
			cin >> i;
			cout << minimum(i, i+1) << endl;
		}
	}
}

int main() {
	solve();
}

Measured memory_bytes: 5144
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>

int main(void){
	int i , flag , n , d[10] , d_2[10] = {512 , 256 , 128 , 64 , 32 , 16 , 8 , 4 , 2 , 1};
	while(scanf("%d" , &n)!=EOF){
		flag = 0;
		for(i=0;i<10;i++){
			d[i] = 0;
		}
		for(i=9;i>=0;i--){
			if(n >= (int)pow(2 , (double)i)){
				n -= (int)pow(2 , (double)i);
				d[9-i] = 1;
			}
		}
		for(i=9;i>=0;i--){
			if(d[i] == 1){
				if(flag == 0){
					printf("%d" , d_2[i]);
					flag = 1;
				}else{
					printf(" %d" , d_2[i]);
				}
			}
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#include <boost/range/adaptor/reversed.hpp>
#include <boost/range/algorithm/sort.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using boost::irange;
using boost::sort;
using boost::adaptors::reversed;

int main() {
    int n;
    cin >> n;
    vector<long> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    sort(a);
    for (int i = 1; i < n; i++) a[i] += a[i - 1];
    int ans = 0;
    for (int i = 0; i < n - 1; i++) if (a[i + 1] - a[i] > 2 * a[i]) ans = i + 1;
    cout << n - ans << endl;
}


Measured memory_bytes: 1152
#include<iostream>
#include<string>
#include<math.h>
#include<algorithm>
#include<vector>
using namespace std;
int main() {
	int H, W;	cin >> H >> W;
	vector<string> S;
	vector<vector<int>> num(H, vector<int>(W, 0));
	string str;
	for (int i = 0; i < H; ++i) {
		cin >> str;
		S.push_back(str);
	}
	
	for (int i = 0; i < H; ++i) {
		for (int j = 0; j < W; ++j) {
			if (S[i][j] == '#') {
				if (i > 0) {
					++num[i - 1][j];
					if (j > 0) {
						++num[i - 1][j - 1];
					}
					if (j < W - 1) {
						++num[i - 1][j + 1];
					}
				}
				if (i < H - 1) {
					++num[i + 1][j];
					if (j > 0) {
						++num[i + 1][j - 1];
					}
					if (j < W - 1) {
						++num[i + 1][j + 1];
					}
				}
				if (j > 0) {
					++num[i][j - 1];
				}
				if (j < W - 1) {
					++num[i][j + 1];
				}
			}
		}
	}
	for (int i = 0; i < H; ++i) {
		for (int j = 0; j < W; ++j) {
			if (S[i][j] != '#') {
				cout << num[i][j];
			}
			else {
				cout << S[i][j];
			}
		}
		cout << endl;
	}

	cin >> H;
}

Measured memory_bytes: 256
#import sys
#import numpy as np
import math
#import itertools
#from fractions import Fraction
#import itertools
from collections import deque
from collections import Counter
#import heapq
#from fractions  import gcd
#input=sys.stdin.readline
#import bisect
h,w,a,b=map(int,input().split())
ans=[[0]*w for _ in range(h)]
for i in range(h):
    for j in range(w):
        if (i<b and j<a) or (i>=b and j>=a):
            ans[i][j]=1
for i in range(h):
	L=[str(x) for x in ans[i]]
	L="".join(L)
	print(L)

Measured memory_bytes: 82152
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define tll tuple<ll, ll, ll>
#define all(c) c.begin(),c.end()

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
 
const ll inf = 1000000001;
const ll INF = 1e18;
const ll MOD = 1000000007;

char albt[26] = {'a','b','c','d','e','f','g','h','i','j','k','l',
                 'm','n','o','p','q','r','s','t','u','v','w','x',
                 'y','z'};

//vector<ll> g[202020];
//fill(score, score+202020, 0);
//vector<ll> v;

int main(){
  ll n, k;
  cin >> n >> k;
  
  string s;
  cin >> s;
  
  ll change = 0;
  for (int i=1;i<s.length();i++){
    if (s[i-1] == 'R' && s[i] == 'L') change += 1;
  }
  
  ll happy;
  if (s[0] == s[s.length()-1]){
    happy = s.length() - 2*change - 1 + 2*k;
  }
  else if (s[0] == 'R' && s[s.length()-1] == 'L'){
    happy = s.length() - 2*change + 2*k;
  }
  else if (s[0] == 'L' && s[s.length()-1] == 'R'){
    happy = s.length() - 2*change -2 + 2*k;
  }
  
  if (happy > s.length()-1) happy = s.length()-1;
  
  
  cout << happy << endl;
}

Measured memory_bytes: 512
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = br.readLine();
		String[] str = line.split("");
		int n = 0, w = 0, s = 0, e = 0;
		for (int i = 0; i < str.length; i++) {
			if ((str[i]).equals("N")) {
				n++;
			} else if ((str[i]).equals("W")) {
				w++;
			} else if ((str[i]).equals("S")) {
				s++;
			} else if ((str[i]).equals("E")) {
				e++;
			}
		}
		if (((n >= 1) && (s == 0)) || ((n == 0) && (s >= 1)) || ((w >= 1) && (e == 0)) || ((w == 0) && (e >= 1))) {
			System.out.println("No");
		} else {
			System.out.println("Yes");
		}
	}
}


Measured memory_bytes: 22612
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<string>
#include<unordered_map>
using namespace std;

#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j,k
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define sort(a) sort(a.begin(),a.end())
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define sizeoof(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll i,ans=1;rep(i,0,n)ans*=x;return ans;}
/*階乗*/ll fact(ll x){ll i,ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)/fact(r)/fact(n-r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;ll i;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
ll ans=0;llfor;///////////////////////////////////////////////////////////

int main(){
 ll x;
 sc(x);
 ans=0;
 rep(i,1,1000000000){
  ans+=i;
  if(ans>=x){
   pr(i);return 0;
  }
 }
return 0;}

Measured memory_bytes: 3664
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <memory>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(long long int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;

int main(){

    string s;
    cin >> s;
    vector<int> v(s.size() + 1,-1);
    if(s[0]=='<'){
        v[0] = 0;
    }
    if(s[s.size()-1]=='>'){
        v[s.size()] = 0;
    }
    bool count_flag = false;
    int tmp = 0;
    REP(i,(long long int)s.size()-1){
        if(s[i]=='>'&&s[i+1]=='<'){
            v[i+1] = 0;
        }
    }
    REP(i,(long long int)s.size()){
        if(s[i]=='<'){
            v[i + 1] = max(v[i ] + 1,v[i+1]);
        }
    }
    
    DEFOR(i,(long long int)s.size()+1,0){
        if(s[i]=='>'){
            v[i ] = max(v[i+1] + 1,v[i]);
        }
    }
    long long int result = 0;
    REP(i,(long long int)s.size()+1){
      //  cout << v[i] << " ";
        result += v[i];
    }
   // cout << endl;
    cout << result << endl;
    return 0;
}


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

int main() {
    int r;
    cin >> r;
    cout << r * 2 * M_PI << endl;
}

Measured memory_bytes: 3768
#!/usr/bin/env python3
import sys


def solve(S: int, W: int):
    if W >= S:
        print("unsafe")
    else:
        print("safe")
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    solve(S, W)

if __name__ == '__main__':
    main()

Measured memory_bytes: 61712
use proconio::{fastout, input};

fn main() {
    input! {
        (n, m): (usize, usize),
        hs: [usize; n],
        abs: [(usize, usize); m]
    };

    let mut map = vec![Vec::new(); n + 1];

    for (a, b) in abs {
        map[a].push(b);
        map[b].push(a);
    }

    let mut ans = 0;

    'outer: for i in 1..=n {
        if map[i].len() == 0 {
            ans += 1;
        } else {
            for &j in map[i].iter() {
                if hs[i - 1] <= hs[j - 1] {
                    continue 'outer;
                }
            }
            ans += 1;
        }
    }

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


Measured memory_bytes: 12196
#include <stdio.h>
#define MAX 100001
 
 
typedef struct{
  int parent;
  int left;
  int right;
  int id;
}Node;
 
Node T[MAX];
 
int main(){
  int l,k,n,i,j,count=0;
  int flag=0;
  
  int id;
 
 
  for(i=0;i<MAX;i++){
    T[i].parent=-1;
    T[i].left=MAX;
    T[i].right=MAX;
    T[i].id=0;
  }
 
  scanf("%d",&n);
  
 
  for(i=0;i<n;i++){
    scanf("%d",&id);
    scanf("%d",&k);
    T[id].id=id;
    if(k!=0){
      scanf("%d",&T[id].left);
      l=T[id].left;
      T[l].parent=id;
      for(j=0;j<k-1;j++){
    scanf("%d",&T[l].right);
    l=T[l].right;
    T[l].parent=id;
 
      } 
    }
  }
 
 
 
  for(i=0;i<n;i++){
    printf("node %d:",T[i].id);
    printf(" parent = %d,",T[i].parent);
 
    j=i;
    while(T[j].parent!=-1){
      j=T[j].parent;
      count++;
    }
    printf(" depth = %d,",count);
    count=0;
 
    if(T[i].parent==-1)printf(" root,");
    else if(T[i].left!=MAX)printf(" internal node,");
    else printf(" leaf,");
 
 
    j=T[i].left;
    printf(" [");
 
 
    while(j!=MAX){
      if(flag==0)printf("%d",j);
      if(flag==1)printf("% d",j);
      j=T[j].right;
      if(j!=MAX)printf(",");
      flag=1;
    }
    printf("]");
 
 
 
    printf("\n");
      flag=0;
  }
 
 
   
 
 
  return 0;
}

Measured memory_bytes: 4248
#include <bits/stdc++.h>
#define LL long long
using namespace std;

LL N, X, Y, Ans;

int main() {
    scanf( "%lld%lld", &N, &X );
    Ans = N;
    Y = N - X;
    if( X < Y ) swap( X, Y );
    while( X % Y != 0 ) {
        Ans += 2 * Y * ( X / Y );
        X %= Y;
        swap( X, Y );
    }
    Ans += Y * ( 2 * ( X / Y ) - 1 );
    printf( "%lld\n", Ans );
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>

#define REP(i,n) for(i=0;i<n;i++)

//prototype declaration
int iin();
long long llin();
double din();
char cin();
void stin(char *s);
void iout(int i);
void llout(long long i);
void dout(double i);
void cout(char c);
void stout(char *s);
int dfs(int v, int n, int *visited, int table[n][n]);
int gcd(int a, int b);
int lcm(int a, int b);
long long llgcd(long long a, long long b);
long long lllcm(long long a, long long b);

//main function
int main() {
    int a = iin(), b = iin(), t = iin();
    iout(b * (int)(t / a));

    return 0;
}

//body function
int iin() {
    int i;
    scanf("%d", &i);
    return i;
}

long long llin() {
    long long i;
    scanf("%lld", &i);
    return i;
}

double din() {
    double i;
    scanf("%lf", &i);
    return i;
}

char cin() {
    char c;
    scanf("%c", &c);
    return c;
}

void stin(char *s) {
    scanf("%s", s);
}

void iout(int i) {
    printf("%d\n", i);
}

void llout(long long i) {
    printf("%lld\n", i);
}

void dout(double i) {
    printf("%lf\n", i);
}

void cout(char c) {
    printf("%c\n", c);
}

void stout(char *s) {
    printf("%s\n", s);
}

int dfs(int v, int n, int *visited, int table[n][n]) {
    int all_visited = 1, i;

    REP(i,n) {
        if (!visited[i]) {
            all_visited = 0;
            break;
        }
    }

    if (all_visited) {
        return 1;
    }

    int count = 0;

    REP(i,n) {
        if (!table[v][i]) continue;
        if (visited[i]) continue;

        visited[i] = 1;
        count += dfs(i, n, visited, table);
        visited[i] = 0;
    }

    return count;
}

int gcd(int a, int b) {
    int r;

    if (a < b) {
        r = a;
        a = b;
        b = r;
    }

    r = a % b;
    while (r != 0) {
        a = b;
        b = r;
        r = a % b;
    }

    return b;
}

int lcm(int a, int b) {
    int r = llgcd(a, b);
    a /= r;
    return a * b;
}

long long llgcd(long long a, long long b) {
    long long r;

    if (a < b) {
        r = a;
        a = b;
        b = r;
    }

    r = a % b;
    while (r != 0) {
        a = b;
        b = r;
        r = a % b;
    }

    return b;
}

long long lllcm(long long a, long long b) {
    long long r = llgcd(a, b);
    a /= r;
    return a * b;
}


Measured memory_bytes: 128
import itertools
H,W = map(int,input().split())
grid = []
for i in range(H):
    a = input()
    l = []
    for i in a:
        if(i == "."):
            i = 0
        l.append(i)
    grid.append(l)
for i in range(H):
    for j in range(W):
        if(grid[i][j] != "#"):
            continue
        for dx,dy in itertools.product([-1,0,1],repeat=2):
            x = i + dx
            y = j + dy
            if(x<0 or H<=x):
                continue
            if(y<0 or W <= y):
                continue
            if grid[x][y] == "#":
                continue
            grid[x][y] += 1
for Row in grid:
    print(*Row,sep="")

Measured memory_bytes: 45680
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(t,i,c) for(t::iterator i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
const double EPS = 1e-10;
const double PI  = acos(-1.0);


int t(int h,int m,int s){
	return h*60*60+m*60+s;
}
int main(){
	int n;
	while(cin>>n,n){
		vector<pii> times(n);
		REP(i,n){
			int h1,m1,s1,h2,m2,s2;
			scanf("%d:%d:%d %d:%d:%d",&h1,&m1,&s1,&h2,&m2,&s2);
			times[i]=make_pair(t(h1,m1,s1),t(h2,m2,s2));
		}
		sort(ALL(times));
		priority_queue<int,vi,greater<int> > q;
		REP(i,n){
			if(q.empty())
				q.push(times[i].second);
			else
			{
				if(q.top()<=times[i].first){
					q.pop();
					q.push(times[i].second);
				}else{
					q.push(times[i].second);
				}
			}
		}
		cout<<q.size()<<endl;
	}
}

Measured memory_bytes: 1084
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>
#include <set>

using namespace std;
typedef long long ll;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

struct Point {
  int x;
  int y;
  int type;
  Point() {;}
  Point(double x, double y, int type) : x(x), y(y), type(type) {;}
  bool operator<(const Point &rhs) const {
    if (fabs(y - rhs.y) > EPS) { return y < rhs.y; }
    if (fabs(x - rhs.x) > EPS) { return x < rhs.x; }
    return false;
  }
};

struct Event {
  int x;
  Point p;
  int in;
  Event() {;}
  Event(int x, Point p, int in) : x(x), p(p), in(in) {;}
  bool operator<(const Event &rhs) const {
    if (x != rhs.x) { return x < rhs.x; }
    return in > rhs.in;
  }
};

inline int square(int x) { return x * x; }

inline int dist2(const Point &a, const Point &b) {
  return square(a.x - b.x) + square(a.y - b.y);
}

int an, bn, n;
int r;
Event event[500000];

int PlaneSweep() {
  int ans = 0;
  set<Point> open[2];
  REP(iter, n) {
    Event &e = event[iter];
    Point &p = e.p;
    if (e.in) {
      set<Point>::iterator lower = open[p.type ^ 1].lower_bound(Point(0, p.y - 4.0 * r - 1, 0));
      set<Point>::iterator upper = open[p.type ^ 1].upper_bound(Point(0, p.y + 4.0 * r + 1, 0));
      for (set<Point>::iterator it = lower; it != upper; it++) {
        if (dist2(*it, p) <= 16.0 * r * r) { ans++; }
      }
      open[p.type].insert(p);
    } else {
      open[p.type].erase(open[p.type].find(p));
    }
  }
  return ans;
}

int main() {
  while (scanf("%d %d %d", &an, &bn, &r), an|bn) {
    n = (an + bn) * 2;
    REP(i, an) {
      int x, y;
      scanf("%d %d", &x, &y);
      event[2 * i + 0] = Event(x - 2 * r, Point(x, y, 0), 1);
      event[2 * i + 1] = Event(x + 2 * r, Point(x, y, 0), 0);
    }
    REP(i, bn) {
      int x, y;
      scanf("%d %d", &x, &y);
      event[2 * an + 2 * i + 0] = Event(x - 2 * r, Point(x, y, 1), 1);
      event[2 * an + 2 * i + 1] = Event(x + 2 * r, Point(x, y, 1), 0);
    }
    sort(event, event + n);
    int ans = PlaneSweep();
    printf("%d\n", ans);
  }
}

Measured memory_bytes: 8756
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

n,c,k = m()

t = []

for i in range(n):
    t.append(onem())
t.sort()

po = 1

jo = 1

ti = t[0] + k

for i in range(1,n):
    on = t[i]
    if ti < on:
        po += 1
        jo = 1
        ti = on + k
    else:
        if jo + 1 <= c:
            jo += 1
        else:
            po += 1
            jo = 1
            ti = on + k
print(po)





Measured memory_bytes: 7856
#include <bits/stdc++.h>
     
    using namespace std;
     
    #define FOR(i, n) for(int i = 0; i < (int) n; i++)
    #define all(v) v.begin(), v.end()
    #define F first
    #define S second
     
    typedef long long ll;
    typedef vector<int> vi;
    typedef pair<int,int> pii;
     
    const ll MOD = 1e9+7;
     
    int main(){
    	ios::sync_with_stdio(false); cin.tie(0);
     
    	ll a, b, c; cin >> a >> b >> c;
     	
    	if(c-a-b <= 0){
    		cout << "No\n"; return 0;
    	}

    	ll d = (c-a-b)*(c-a-b);
    	if(d > 4*a*b)
    		cout << "Yes\n";
    	else
    		cout << "No\n";
     
    	return 0;
    }

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

using namespace std;

typedef long long ll;
typedef long long unsigned int llui;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector< vector<int> > vvi;
typedef set<int> si;
typedef map<string, int> msi;

#define INF INT_MAX
#define MOD 1000000007
#define EPS 1e-9
#define DEBUG(x) cout<< '>' << #x << ':' << x << "\n";
#define ALL(x) (x).begin(), (x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define UNIQUE(x) (x).erase(unique((x).begin(),(x).end()),(x).end())
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define sz(a) int((a).size())
#define clr(a) memset(a,0,sizeof(a))
#define trace(x) cout << '>' << #x << ':' << x << endl;
#define trace2(x,y) cout<< '>' << #x << ':' << x << " | " << #y << ':' << y << endl;

inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }

#define LSOne(S) (S&(-S))

const double pi = acos(-1);
const int oo = 0x3f3f3f3f;

template<class T> inline T gcd(T a,T b) //NOTE:__gcd(0,0) gives exception
  {if(a<0)return gcd(-a,b);if(b<0)return gcd(a,-b);return (b==0)?a:gcd(b,a%b);}

int cmp(double x, double y = 0, double tol = EPS) {
    return (x <= y + tol) ? (x + tol < y) ? -1 : 0 : 1;
}

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

/*bool sortby(const pair<ll,ll> &a,const pair<ll,ll> &b)
{
    return (a.second < b.second);
}*/

const int MAX_N = 123456;

//int arr[MAX_N];

int main(){
    int N;
    scanf("%d",&N);
    ll X,Y,ans=0;
    scanf("%lld",&X);
    for(int i=0;i<N;i++){
        scanf("%lld",&Y);
        ans=gcd(ans,abs(X-Y));
    }
    printf("%lld",ans);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define vi vector<ll>
#define pi pair<ll,ll>
#define vp vector<pi>
#define mp map<ll,ll>
#define pb push_back
#define endl '\n'
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define test ll T;cin>>T;while(T--) 
#define MAX 100004
#define __sort(v) sort(v.begin(),v.end())
#define rep(i,a,b) for(ll i=a;i<b;i++)
const ll inf=1e+9;
const ll mod=7 + 1e+9;
 
 
 
int32_t main(){
 
     fast;
     
     string s;
     cin>>s;
     
     if(s[0]=='7' || s[1]=='7' || s[2]=='7')
       cout<<"Yes";
       else cout<<"No";
     
         
     
     
     return 0;
 }


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define N 1000099
#define INF 0x3f3f3f3f
#define LLINF 0x3f3f3f3f3f3f3f3f
#define LL long long
// ios::sync_with_stdio(false);
using namespace std;
LL n;
int main()
{
    cin >> n;
    LL s = sqrt(n);
    for (int i = s; i >= 1; i--)
    {
        if (n % i == 0)
        {
            cout << i + n / i - 2 << endl;
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 3624
#include <stdio.h>
#include <string.h>
 
int main(void)
{
    int table[256];
    char roma_num[128];
    int num;
    int len;
    int i;
 
    table['I'] = 1;
    table['V'] = 5;
    table['X'] = 10;
    table['L'] = 50;
    table['C'] = 100;
    table['D'] = 500;
    table['M'] = 1000;
 
    while (~scanf("%s", roma_num)){
        len = strlen(roma_num);
        num = table[roma_num[len - 1]];
        for (i = len - 2; i >= 0; i--){
            num += table[roma_num[i]] * (table[roma_num[i + 1]] > table[roma_num[i]] ? -1 : 1);
        }
        printf("%d\n", num);
    }
 
    return (0);
}

Measured memory_bytes: 540
import sys
from collections import deque

s = deque(input() + 'T')
X, Y = map(int, input().split())

while True:
    if s[0] == 'T':
        break
    s.popleft()
    X -= 1

dirx = True
x_list = []
y_list = []
count = 0
for c in s:
    if c == 'F':
        count += 1
    else:
        if count > 0:
            x_list.append(count) if dirx else y_list.append(count)
            count = 0
        dirx = not(dirx)

if (sum(x_list) + X) % 2 != 0 or (sum(y_list) + Y) % 2 != 0 or sum(x_list) < abs(X) or sum(y_list) < abs(Y):
    print('No')
    sys.exit()

dx = (sum(x_list) - abs(X)) // 2
dp_x = [False for _ in range(dx + 1)]
dp_x[0] = True
for x in x_list:
    for i in range(dx - x, -1, -1):
        if dp_x[i]:
            dp_x[i + x] = True
    if dp_x[dx]:
        break
if not dp_x[dx]:
    print('No')
    sys.exit()

dy = (sum(y_list) - abs(Y)) // 2
dp_y = [False for _ in range(dy + 1)]
dp_y[0] = True
for y in y_list:
    for i in range(dy - y, -1, -1):
        if dp_y[i]:
            dp_y[i + y] = True
    if dp_y[dy]:
        break
if not dp_y[dy]:
    print('No')
    sys.exit()

print('Yes')


Measured memory_bytes: 3444
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")
al = "abcdefghijklmnopqrstuvwxyz"
AL = al.upper()

s = k()
q = s//(mod-7)
r = s%(mod-7)

if s == 10**18:
    print(0,0,10**9,0,0,10**9)
else:
    print(0,0,10**9,1,10**9-r,q+1)

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

#define ll long long
#define str string
#define pii pair<int, int>
#define pll pair<ll, ll>
#define fi first
#define se second

#define vc vector<char>
#define vvc vector<vc>
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vi>
#define vvll vector<vll>
#define vvvll vector<vvll>
#define vs vector<str>
#define vvs vector<vs>
#define vpii vector<pii>
#define vvpii vector<vpii>
#define vpll vector<pll>
#define vvpll vector<vpll>
#define vb vector<bool>
#define vvb vector<vb>
#define rep(i, a, b) for (int i = (a); i < int(b); i++)
#define repi(i, a, b) for (int i = (a); i <= int(b); i++)


using namespace std;
ll INF = LONG_LONG_MAX;
ll mod = 1000000000 + 7;

template <typename T, typename L>
void read(vector<T> & _data, L & _size, bool _shift) {
    _data.resize(_size + (ll)_shift);
    for (ll i = (ll)_shift; i < _size + (ll)_shift; i++)
        cin >> _data[i];
}

template <typename T, typename L>
void read(vector<vector<T>> & _data, L & _rows, L & _cols, bool _shiftRows, bool _shiftCols) {
    _data.resize(_rows + (ll)_shiftRows);
    for (ll i = 0; i < _rows + (ll)_shiftRows; i++)
        _data[i].resize(_cols + (ll)_shiftCols);
    for (ll i = (ll)_shiftRows; i < _rows + (ll)_shiftRows; i++)
        for (ll j = (ll)_shiftCols; j < _cols + (ll)_shiftCols; j++)
            cin >> _data[i][j];
}

template <typename T>
void write(vector<T> & _data, bool _shift) {
    for (ll i = (ll)_shift; i < _data.size(); i++)
        cout << _data[i] << " ";
    cout << endl;
}


//TODO: SOLUTION

ll h, w, m;
vll x, y;
map<ll, ll> incol;
map<ll, ll> inrow;
map<ll, ll> cnt;

void solve() {
    cin >> h >> w >> m;
    x.resize(m); y.resize(m);
    ll maxrow = 0, maxcol = 0;

    rep(i, 0, m) {
        cin >> x[i] >> y[i];
        if (inrow.count(x[i]))
            inrow[x[i]]++;
        else
            inrow[x[i]] = 1;
        if (incol.count(y[i]))
            incol[y[i]]++;
        else
            incol[y[i]] = 1;
    }

    rep(i, 0, m) {
        maxrow = max(maxrow, inrow[x[i]]);
        maxcol = max(maxcol, incol[y[i]]);
    }

    ll num = 0;
    for (auto it = incol.begin(); it != incol.end(); it++) {
        if (it->second == maxcol)
            num++;
    }

    bool suc = 0;
    rep(i, 0, m) {
        if (inrow[x[i]] == maxrow && incol[y[i]] == maxcol) {
            if (cnt.count(x[i]))
                cnt[x[i]]++;
            else
                cnt[x[i]] = 1;
        }
    }

    rep(i, 0, m) {
        if (inrow[x[i]] == maxrow && cnt[x[i]] != num) {
            suc = 1;
            break;
        }
    }

    if (suc)
        cout << maxrow + maxcol;
    else
        cout << maxrow + maxcol - 1;
}


int main() {

    // TODO: Set value of this variable manually
    bool _multipleTestCases = false;

    if (_multipleTestCases) {
        ll t; cin >> t;
        while (t--)
            solve();
    }
    else {
        solve();
    }

    return 0;
}

Measured memory_bytes: 64224
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            int[] t = { sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt() };
            int[] r = { sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt() };
            int hit = 0;
            int blow = 0;
            for (int i = 0; i < 4; i++) {
                for (int j = 0; j < 4; j++) {
                    if (t[i] == r[j]) {
                        if (i == j) {
                            hit++;
                        } else {
                            blow++;
                        }
                    }
                }
            }
            System.out.println(hit + " " + blow);
        }
    }
}


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

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)

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

const int dx[8] = {-1, 1, 0, 0, -1, -1, 1, 1}, dy[8] = {0, 0, -1, 1, -1, 1, -1, 1};

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

    int A, B, H;
    std::cin >> A >> B >> H;

    std::cout << H / 2 * (A + B) << std::endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

long long cub(int x){
  return 1ll * x * x * x;
}
int main(){
  int n,k;
  cin >> n >> k;
  if(k & 1){// k % 2 == 1 の時をビット演算によって高速で分岐
    //a,b,cが全て 0 mod(K)
    cout << cub(n/k) << endl;
  }else{
    k /= 2;
    // a,b,cが全て K/2 mod(K) の時と a,b,c が全て 0 mod(K) の場合
    cout << cub((n+k)/k/2) + cub(n/k/2) << endl;
  }

  return 0;

}


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

struct edge{ int u, v, cost; };
struct DirectedGraph
{
  int vertex_num;
  int edge_num;
  vector<edge> edge_list;
  vector< vector<int> > adj_list;
};

void displayVector(vector<lli> v)
{
	lli n = v.size();
	REP(i,n){
		cout << v[i] << " " ;
	}
	cout << endl;
}


int main(){
	lli n; cin >> n;
	string s = "";
	while(0 < n ){
		int t = n%26;
		if(t==0 && 0<n){ t=26; }
		char add_c = 'a' + t-1 ;
		s = add_c + s;
		n-=t; n/= 26;
	}
	cout << s << endl;

  return 0;
}

Measured memory_bytes: 3628
//保留所有权利。
#include<iostream>
#include<stdio.h>//printするよ
#include<vector>
#include<algorithm>//辞書順はnext_permutationだよ
#include<set>
#include<string>
#include<string.h>
#include<time.h>
#include<random>
#include<cmath>
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<utility>//swapで数値交換するよ
//END OF LIBRARIES.
#define rt "\n"//改行を最速化させるよ
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define vcin(v) for (int i = 0; i < (v).size(); i++) { cin >> (v)[i]; }
#define sort(s) sort(s.begin(),s.end())
#define reve(s) reverse(s.begin(),s.end())
#define asas int ans=0
#define llcncn llint cnt=0
#define llasas llint ans=0
#define cncn int cnt=0
#define smsm int sum=0
#define str srting
#define v vector
#define nn int n=0
#define please return
#define AC 0//おまじないだよ
#define Rapid cin.tie(0);ios::sync_with_stdio(false)
//END OF DEFINE.
using namespace std;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vcha;
typedef vector<double> vdou;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
//printf("%02d:%02d:%02d\n", h, m, s);・・・2文字は埋める・h、m、ｓ
//END OF TYPEDEF.

//最大公約数（GCD）を求めるよ
//最小公倍数（LCM）は＜＜　A × B ÷ GCD　 ＞＞で求まるよ

long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}
long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}
int x = 0, y = 0, z = 0,n = 0;
asas;
cncn;
//BEGIN OF CODE.
int main(void) {
	cin >> n;
	vint v(n), c(n);
	rep(i, n)cin >> v[i];
	rep(i, n)cin >> c[i];
	rep(i, n) {
		if (v[i] > c[i]) {
			x += v[i];
			y += c[i];
		}
	}
	cout << x - y << rt;
	please AC;
}

Measured memory_bytes: 256