akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <cstdio>
#define rep(i,n) for(int i = 0; i < n; ++i)
#define rep1(i,n) for(int i = 1; i <= n; ++i)
#define rep2(i,s,t) for(int i = s; i <= t; ++i)
#define rev(i,n) for(int i = n-1; i >= 0; --i)
#define rev1(i,n) for(int i = n; i > 0; --i)
#define rev2(i,s,t) for(int i = s; i >= t; --i)
#define F first
#define S second
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if(a < b){ a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if(a > b){ a = b; return 1; } return 0; }
using ll = long long;
using pi = pair<int,int>;
using vi = vector<int>;
using vii = vector<vi>;
typedef long long ll;
const ll MOD = 998244353;
struct mint{
  ll x;
  mint(ll x=0):x(x%MOD){}
  mint& operator+=(const mint a){
    if((x+=a.x)>=MOD) x-=MOD;
    return *this;
  }
  mint& operator-=(const mint a){
    if((x += MOD-a.x)>=MOD) x-=MOD;
    return *this;
  }
  mint& operator*=(const mint a){
    (x*=a.x)%=MOD;
    return *this;
  }
  mint operator+(const mint a) const{
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const{
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const{
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const{
    if(!t) return 1;
    mint a = pow(t>>1);
    a*=a;
    if(t&1) a*=*this;
    return a;
  }
  
  //for prime mod
  mint inv() const{
    return pow(MOD-2);
  }
  mint& operator/=(const mint a){
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const{
    mint res(*this);
    return res/=a;
  }
};


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

  vector<vector<mint>> dp(c+1, vector<mint>(d+1));
  dp[a][b].x = 1;
  rep2(i,a,c) {
    rep2(j,b,d) {
      if(i - 1 >= a && j -1 >= b) {
	dp[i][j] = dp[i-1][j] * (mint)j + dp[i][j-1] * (mint)i - (mint)(i-1)*(j-1) * dp[i-1][j-1];
      }
      else if(i - 1 >= a) {
	dp[i][j] = dp[i-1][j] * (mint)j;
      }
      else if(j - 1 >= b) {
	dp[i][j] = dp[i][j-1] * (mint)i;
      }      
    }
  }
  cout << dp[c][d].x << "\n";
  return 0;
}


Measured memory_bytes: 73724
N = int(input())
arr = sorted([int(i) for i in input().split()])
def calc(x,arr):
    cnt = 0
    for i in arr:
        cnt += (i-x)**2
    return cnt
numlist = [-100 + i for i in range(201)]
mincost = calc(100,arr)
numcost = 100
for i in numlist:
    tmp = calc(i,arr)
    if mincost > tmp:
        mincost = tmp
        numcost = i
print(mincost)

Measured memory_bytes: 3316
#include<cstdio>
#include<cstring>
#include<algorithm>
const int N=1000010;
int a[N],val[N][2],ret[N];
int n;
inline void Modify(int u,int v) {
  if(a[val[u][0]]<a[v]) {
    val[u][1]=val[u][0];
    val[u][0]=v;
  } else if(a[val[u][1]]<a[v] && v!=val[u][0]) {
    val[u][1]=v;
  }
}
signed main() {
  scanf("%d",&n); int u=1<<n;
  for(int i=1;i<=u;i++) {
    scanf("%d",&a[i]);
  }
  val[0][0]=1;
  for(int sta=1;sta<u;sta++) {
    val[sta][0]=sta+1;
    for(int i=0;i<n;i++)
      if((1<<i)&sta) {
        Modify(sta,val[sta^(1<<i)][0]);
	Modify(sta,val[sta^(1<<i)][1]);
      }
  }
  for(int i=1;i<u;i++) ret[i]=std::max(a[val[i][0]]+a[val[i][1]],ret[i-1]);
  for(int i=1;i<u;i++) printf("%d\n",ret[i]);
  return 0;
}


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

void solve(long long N, long long A, long long B) {
    if (!(A < B)) {
        swap(A, B);
    }
    if (B % 2 == A % 2) {
        cout << (B - A) / 2LL << endl;
        return;
    }

    long long ans = numeric_limits<long long>::max();

    auto a = A, b = B;
    // left
    auto l = (a - 1LL);
    b -= l;
    a -= l;
    b--;
    ans = min(ans, l + 1LL + (b - a) / 2LL);

    // right
    a = N - A + 1;
    b = N - B + 1;
    l = (a - 1LL);
    b -= l;
    a -= l;
    b--;
    ans = min(ans, l + 1LL + (b - a) / 2LL);

    cout << ans << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main() {
    long long N;
    scanf("%lld", &N);
    long long A;
    scanf("%lld", &A);
    long long B;
    scanf("%lld", &B);
    solve(N, A, B);
    return 0;
}


Measured memory_bytes: 3712
#include <iostream>

using namespace std;

int main(){
	int N, A, B, C, X;
	while(cin >> N >> A >> B >> C >> X, N+A+B+C+X){
		int Y[N], time = -1, ran = X;
		for(int i = 0; i < N; ++i){
			cin >> Y[i];	
		}
		int j = 0;
		while(time <= 10000 && j != N){
			++time;
			if(ran == Y[j]) ++j;
			ran = (A * ran + B) % C;
		}
		if(time > 10000) time = -1;
		
		cout << time << endl;
	}	
}

Measured memory_bytes: 2980
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;

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

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

const int N = 2e5 + 5;
int n, k;
lli a[N];

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

	cin >> n >> k;
	for(int i = 0; i < n; i++) cin >> a[i];

	//0 normalization
	for(int i = 0; i < n; i++) a[i] -= k;
	k = 0;

	ordered_set t;

	lli thres = 0;
	lli ans = 0;
	for(int i = n-1; i >= 0; i--) {
		//Modify thres and insert new element aptly translated
		t.insert({thres, i});
		thres -= a[i];
		ans += (n - i - t.order_of_key({thres, (lli)-1}));
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 14464
#include<stdio.h>

int main(){

  int a=1, b=1;
  int i;

  for(i = 0 ; i < 9 ; i++){
    printf("%dx%d=%d\n",a,b,a*b);
    b++;
  }

  a = 2;
  b = 1;

  for(i = 0 ; i < 9 ; i++){
    printf("%dx%d=%d\n",a,b,a*b);
    b++;
  }

  a = 3;
  b = 1;

  for(i = 0 ; i < 9 ; i++){
    printf("%dx%d=%d\n",a,b,a*b);
    b++;
  }

  a = 4;
  b = 1;

  for(i = 0 ; i < 9 ; i++){
    printf("%dx%d=%d\n",a,b,a*b);
    b++;
  }

  a = 5;
  b = 1;

  for(i = 0 ; i < 9 ; i++){
    printf("%dx%d=%d\n",a,b,a*b);
    b++;
  }

  a = 6;
  b = 1;

  for(i = 0 ; i < 9 ; i++){
    printf("%dx%d=%d\n",a,b,a*b);
    b++;
  }

  a = 7;
  b = 1;

  for(i = 0 ; i < 9 ; i++){
    printf("%dx%d=%d\n",a,b,a*b);
    b++;
  }

  a = 8;
  b = 1;

  for(i = 0 ; i < 9 ; i++){
    printf("%dx%d=%d\n",a,b,a*b);
    b++;
  }

  a = 9;
  b = 1;

  for(i = 0 ; i < 9 ; i++){
    printf("%dx%d=%d\n",a,b,a*b);
    b++;
  }

  return 0;
}

Measured memory_bytes: 524
#include <bits/stdc++.h>
#define PREP(i, s, x) for(ll i = (s); i < (x); i++)
#define MREP(i, s, x) for(ll i = (s); i >= (x); i--)
#define REP(i, x) PREP(i, 0, x)
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
template<typename T> inline bool chmax(T &a, T b) { return ((a < b) ? (a = b, true) : (false)); }
template<typename T> inline bool chmin(T &a, T b) { return ((a > b) ? (a = b, true) : (false)); }

// variable -------------------------------------------

constexpr ll INF = (1ll << 59);
constexpr ll MOD = 1000000007ll;

// structure ------------------------------------------

// function -------------------------------------------

// main -----------------------------------------------

int main() {
    ll n = 5;
    vector<ll> x(n);
    REP(i, n){
        cin >> x[i];
        if(x[i] == 0){
            cout << i + 1 << endl;
        }
    }
    
    return 0;
}


Measured memory_bytes: 3592
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.next();
		int[] e=new int[n+1];
		for(int i = 0; i<4; i++){
			int k = i;
			int a = ((k&1)==0)?1:-1;
			k>>=1;
			int b = ((k&1)==0)?1:-1;
			e[0]=a;
			e[1]=b;
			boolean judge=false;
			for(int j = 2; j<=n; j++){
				if(e[j-1]==1){
					e[j]=(s.charAt(j-1)=='o')?e[j-2]:-e[j-2];
				}else{
					e[j]=(s.charAt(j-1)=='o')?-e[j-2]:e[j-2];
				}
			}
			if(e[0]==1){
				if(s.charAt(0)=='o'){
					judge=e[n-1]==e[1];
				}else{
					judge=e[n-1]==-e[1];
				}
			}else{
				if(s.charAt(0)=='o'){
					judge=e[n-1]==-e[1];
				}else{
					judge=e[n-1]==e[1];
				}
			}
			if(judge && e[0]==e[n]){
				StringBuffer ans=new StringBuffer();
				for(int q = 0; q<n; q++){
					ans.append((e[q]==1)?"S":"W");
				}
				System.out.println(ans);
				return;
			}
		}
		System.out.println(-1);
	}
}


Measured memory_bytes: 28148
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 1000000000;
const long long int llINF = 1000000000000000000;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define SP(a) setprecision(a)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string S;
  cin >> S;
  ll N = S.size();
  ll ans = llINF;
  FOR(i, 1, N) {
    if (S[i] != S[i - 1]) {
      ans = min(ans, max(i, N - i));
    }
  }
  if (ans == llINF)
    ans = N;
  cout << ans << endl;
  return 0;
}


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

int main() {
  int n;
  cin >> n;
  long a[3*n];
  for(int i=0;i<3*n;i++) cin >> a[i];
  sort(a,a+3*n,greater<int>());
  long ans =0;
  for(int i=1;i<2*n;i+=2){
    ans += a[i];
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 2560
(* unihernandez22
 * https://atcoder.jp/contests/abc054/tasks/abc054_a
 * implementation
 * *)

Printf.printf "%s\n" @@
Scanf.scanf "%d %d\n" @@ fun a b ->
    if a == b then "Draw"
    else if a == 1 then "Alice"
    else if b == 1 then "Bob"
    else if a > b then "Alice"
    else "Bob"


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

using namespace std;

#define FOR(i,s, t) for(int i = s; i < t; i++)
#define ALL(a)  a.begin(), a.end()
#define SZ(x) (int)x.size()
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define SORT(a) sort(ALL(a))
using VI = vector<int>;


int main() {

	int N, K; cin >> N >> K;
	VI a(N);
	VI cnt(N + 1, 0);
	int typeall = 0;
	FOR(i, 0, N) {
		cin >> a[i];
		if (cnt[a[i]] == 0)typeall++;
		cnt[a[i]]++;
	}

	SORT(cnt);
	K = typeall - K;
	int ans = 0;
	FOR(i, 0, N + 1) {
		if (cnt[i] == 0||K<=0) {
			continue;
		}
		ans += cnt[i];
		K--;

	}
	cout << ans << endl;


	return 0;
}


Measured memory_bytes: 1792
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Kein Yukiyoshi
 */

#include "bits/stdc++.h"
#define int long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(obj) begin(obj), end(obj)
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define LOWER_BOUND(A, key) distance(A.begin(), lower_bound(ALL(A), key))
#define UPPER_BOUND(A, key) distance(A.begin(), upper_bound(ALL(A), key))
#define Endl endl

using namespace std;
using ll      = long long;
const int MOD = (int)(1e9 + 7);
const int INF = (int)(1e13 + 7);

int ceil_(int a, int b) { return (a + (b - 1)) / b; }
int positive_surplus(int &a) { return (a + MOD) % MOD; }
int bpm(int x, unsigned int y) {
  if (x == 0) return 0;
  if (y == 0) return 1;
  int ans   = 1;
  int digit = (int)((log((double)y) / log((double)2) / 1 + 1));
  for (unsigned int i = 0; i < digit; i++) {
    if (((y >> i) & 1u) == 1) ans = ans * x ;
    x = x * x ;
  }
  return ans;
}
template <class T>
void cumulative_sum(T &container) {
  for (int i = 0; i < container.size() - 1; i++) container[i + 1] += container[i];
}

class DIHateFactorization {
public:
  static void solve(std::istream &cin, std::ostream &cout) {
    int X;
    cin >> X;
    vector<int> list(3000);
    rep(i, 3000) {
      list[i] = bpm(i, 5);
      rep(j, i) {
        if (list[i] - list[j] == X) {
          cout << i << " " << j << endl;
          return;
        } else if (list[i] + list[j] == X) {
          cout << i << " " << -(j) << endl;
          return;
        }
      }
    }
  }
};


signed main() {
  DIHateFactorization solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}


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

#define _USE_MATH_DEFINES
#define reb(i,b,n)         for(int i=(int)(b); i<(int)(n); i++)
#define rep(i,n)           reb(i,0,n)
#define each(it,v)         for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define reach(it,v)        for(__typeof((v).rbegin()) it=(v).rbegin();it!=(v).rend();it++)
#define vsort(v)           sort((x).begin(), (x).end()
#define rvsort(v)          sort((x).rbegin(), (x).rend()
#define mp(a, b)           make_pair(a, b)
#define fi                 first
#define se                 second
#define pb                 push_back
#define dbg(x)             cerr<<__LINE__<<": "<<#x<<" = ["<<(x)<<"]"<<endl;
#define dbgArr(table, n)   rep(i,n){cout<<table[i]<<' ';}cout<<'\n';
#define dbg2Arr(table,W,H) rep(y,H){rep(x,W)cout<<table[y][x]<<' ';cout<<'\n';}

using namespace std; using std::stringstream;

typedef long long       ll; typedef unsigned long long ull; typedef long double     ld;
typedef pair <int, int> P;  typedef pair <int, P>      PP;
typedef vector<int>     vi; typedef vector<vi>         vvi; typedef vector<ll>      vl;
typedef vector<P >      vP; typedef vector<char>       vc;  typedef vector<string>  vs;

static const int    INF  = 0x3f3f3f3f;
static const ll     INFL = 0x3f3f3f3f3f3f3f3fLL;
static const double EPS  = 1e-9;
static const ll     MOD  = 1000000007LL;

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

int main(int argc, char *argv[])
{
    ll N;
    cin >> N;

    string ans;
    while (N > 0) {
        N--;
        ans += 'a' + N%26;
        N /= 26;
    }

    reverse(ans.begin(), ans.end());

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3632
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int i,j,ppp,line[9];
char row[9];

int main(){
	while(1){
		for(i=0;i<3;i++){
			scanf("%s",row);
			if(row[0]=='0')return 0;
			for(j=0;j<3;j++){
				if(row[j]=='w')ppp=1;
				else if(row[j]=='b')ppp=-1;
				else continue;
				line[j]+=ppp;
				line[3+i]+=ppp;
				if(i==j)line[6]+=ppp;
				if(i==2-j)line[7]+=ppp;
			}
		}
		ppp=0;
		for(i=0;i<8;i++){
			if(line[i]==3){if(ppp==0)printf("w\n");ppp++;}
			if(line[i]==-3){if(ppp==0)printf("b\n");ppp++;}
			line[i]=0;
		}
		if(ppp==0)printf("NA\n");
	}
	return 0;
}

Measured memory_bytes: 524
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include "bits/stdc++.h"

using namespace std;

typedef unsigned long long ll;
typedef int                     integer;
#define int                     long long
#define ii                      pair<int,int>
#define vii                     vector<pair<int,int>>
#define vi                      vector<int>
#define vvi                     vector<vector<int>>
#define f(a,b,c)                for(int a=b;a<c;a++)
#define s(x)                    in>>x
#define s2(x,y)                 in>>x>>y
#define s3(x,y,z)               in>>x>>y>>z
#define s4(x,y,z,w)             in>>x>>y>>z>>w
#define p(x)                    out<<x<<endl
#define p2(x,y)                 out<<x<<" "<<y<<endl
#define pl(x)                   out<<x
#define p2l(x,y)                out<<x<<" "<<y
#define p1d(a,n)                for(int ix=0;ix<n;ix++) out<<a[ix]<<" "; out<<endl
#define p2d(a,n,m)              for(int ix=0;ix<n;ix++){ for(int jx=0;jx<m;jx++) out<<a[ix][jx]<<" "; out<<endl;}
#define range(v)                v.begin(),v.end()
#define w(x)                    while(x--)
#define rst(x)                  memset(x, -1, sizeof(x))
#define UNVISITED               -1
#define VISITED                 0
#define EXPLORED                2

class BComparingStrings {
public:
	void solve(std::istream& in, std::ostream& out) {
        int a,b;
        s2(a,b);
        if(a>b) swap(a,b);
        f(i,0,b) out<<a;
        out<<endl;
	}
};


integer main() {
	BComparingStrings solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <set>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

#define INF 100000000
#define MOD 100000007

#define writeln(n) cout<<n<<endl

using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
//vector<tuple<long long, long long, long long>>vec;

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

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

llong pownew(llong m, llong n) {
    if (n == 0) { return 1; }
    if (n % 2 == 0) { return pow(m*m, n/2); }
    return pow(m, n-1) * m;
}

bool isprime(int p) {
    if (p == 1) return false;
    for (int i = 2; i < p; i++) {
        if (p%i == 0) return false;
    }
    return true;
}

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

const int inf=100000000;

long long modpow(long long a, long long n, long long mod) //a^n
{
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

llong gcd(llong a, llong b) {
    return b != 0 ? gcd(b, a % b) : a;
}
//setprecision(10);


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string S;
    cin >> S;
    string cnt = {'N', 'W', 'S', 'E'};
    string ans = "No";
    int n = 0, w = 0, s = 0, e = 0;
    for (int i = 0; i < S.size(); i++) {
        if (S[i] == 'N') ++n;
        else if (S[i] == 'W') ++w;
        else if (S[i] == 'S') ++s;
        else ++e;
    }
    if (n == 0) {
        if (s == 0) {
            if ((w == 0 && e == 0) || (w != 0 && e != 0)) ans = "Yes";
        }
    } else if (n != 0) {
        if (s != 0) {
            if ((w == 0 && e == 0) || (w != 0 && e != 0)) ans = "Yes";
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std ;
int main()
{
	int a,b;
	cin >> a >> b ;
	int t ; 
	if(a>b) {
		t=a;a=b;b=t;
	}
	int f=1;
	for(int i=a;i<=b;i++){
		if(a*b*i%2==1) {
			cout << "Yes"  ;
			f=0;
			break;
		}
	}
	if(f==1) cout << "No" ;
	return 0;	
}

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

using namespace std;

int main()
{
	string S, T;

	cin >> S >> T;

	bool ans = false;
	for (int i = 0; i < S.size(); i++)
	{
		if (S == T)
		{
			ans = true;
		}

		S.push_back(S[0]);
		S.erase(S.begin());
	}

	if (ans)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
// In the name of Allah the Lord of the Worlds.

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;

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

    int n;
    long double sum = 0;
    cin >> n;
    for(int i=0;i<n;i++){
        long double in;
        cin >> in;
        sum+=(long double)1/in;
    }
    cout << setprecision(14) << fixed << (long double)1/sum << endl;

    return 0;
}


Measured memory_bytes: 256
N,K = map(int,input().split())
dic = {str(i):0 for i in range(10**5 + 5)}
for _ in range(N):
    a,b = map(int,input().split())
    dic[str(a)] += b
z = 0
for i in range(10**5 + 5):
    z += dic[str(i)]
    if z >= K:
        ans = i
        break
print(ans)

Measured memory_bytes: 17132
#include<bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define dbg(x...) do { cout << "\033[32;1m " << #x << " -> "; err(x); } while (0)
void err() { cout << "\033[39;0m" << endl; }
template<template<typename...> class T, typename t, typename... A>
void err(T<t> a, A... x) { for (auto v: a) cout << v << ' '; err(x...); }
template<typename T, typename... A>
void err(T a, A... x) { cout << a << ' '; err(x...); }
#else
#define dbg(...)
#endif
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;
template<class T> void mkuni(vector<T>&v)
{
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
}
template<class T>
void print(T x,int suc=1)
{
    cout<<x;
    if(suc==1) cout<<'\n';
    else cout<<' ';
}
template<class T>
void print(const vector<T>&v,int suc=1)
{
    for(int i=0;i<v.size();i++)
    print(v[i],i==(int)(v.size())-1?suc:2);
}
struct D{
    int a,b;
    bool operator<(const D& x)const{
        return b>x.b;
    }
};
int main()
{
    vc<D> all;
    int n;
    cin>>n;
    ll ans=0;
    ll cc=0;
    bool sa=1;
    for(int i=0;i<n;i++)
    {
        int a,b;
        cin>>a>>b;
        if(a-b<0) cc+=b-a,ans+=b;
        else{
            if(a!=b) sa=0;
            all.push_back({a,b});
        }
    }
    if(!sa)
    {
        vc<D> res;
        for(auto u:all)
        {
            if(u.a==u.b) ans+=u.b;
            else res.push_back(u);
        }
        sort(res.begin(),res.end());
        for(int i=0;i<res.size()-1;i++) ans+=res[i].b;
    }
    print(ans);

}

Measured memory_bytes: 640
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            // 解答はココに書く
            var N = cin.ReadInt;
            var M = cin.ReadInt;
            if (N == M) WriteLine("Yes");
            else WriteLine("No");
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}

Measured memory_bytes: 11220
#ifdef DEBUG
//#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

typedef long double ld;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const long long infll = (long long) 1.01e18;
const ld eps = 1e-9;
const ld pi = acos((ld) -1);

mt19937 mrand(random_device{} ()); 

int rnd(int x) {
  return mrand() % x;
}

void precalc() {
}

const int mod = (int) 1e9 + 7;

int mul(int a, int b) {
  return (long long) a * b % mod;
}

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

int a, b, c, d;

int read() {
  if (scanf("%d%d%d%d", &a, &b, &c, &d) < 4) {
    return false;
  }
  return true;
}

vector< pair<int, pair<int, int> > > evs;

void solve() {
  int res = mul(mul(min(a, d + 1), min(b, d + 1)), min(c, d + 1));
  for (int it = 0; it < 3; it++) {
    //eprintf("it = %d\n", it);
    evs.clear();
    for (int iter = 0; iter < 2; iter++) {
      int x = (!iter ? b : c);
      for (int i = 0; i < min(d + 5, x); i++) {
        int y = ((long long) a * i) / x;
        evs.push_back(make_pair(y, make_pair(iter, i)));
      }
      for (int i = max(0, x - d - 5); i <= x; i++) {
        int y = ((long long) a * i) / x;
        evs.push_back(make_pair(y, make_pair(iter, i)));
      }
    }
    sort(evs.begin(), evs.end());
    int x = 0, y = 0;
    for (int i = 0; i + 1 < sz(evs); i++) {
      //eprintf("%d %d %d\n", evs[i].first, evs[i].second.first, evs[i].second.second);
      //eprintf("x = %d, y = %d\n", x, y);
      int len = min(a - d - 1, evs[i + 1].first) - evs[i].first;
      if (len < 0) {
        break;
      }
      if (!evs[i].second.first) {
        x = evs[i].second.second;
      } else {
        y = evs[i].second.second;
      }
      add(res, mul(len, mul(min(b, x + d + 1) - max(0, x - d), min(c, y + d + 1) - max(0, y - d))));
      //eprintf("res = %d\n", res);
    }
    {
      int tmp = a;
      a = b;
      b = c;
      c = tmp;
    }
  }
  printf("%d\n", res);
}

int main() {
  precalc();
#ifdef DEBUG
  assert(freopen(TASK ".in", "r", stdin));
  assert(freopen(TASK ".out", "w", stdout));
#endif
  while (read()) {
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


Measured memory_bytes: 4852
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // setprecision
#include <complex> // complex
#include <math.h> 
#define enld '\n'
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[8] = {1, 0, -1, 0,1,1,-1,-1};
const int dy[8] = {0, 1, 0, -1,1,-1,1,-1};
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; }
// ---------------------------------------------------------------------------



int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N,M;
    cin >> N >> M;
    map<int,int> mp;
    for(int i=0; i<N; i++){
        int a;
        cin >> a;
        mp[a]++;
    }
    map<int,int> p;
    map<int,int> rem;
    for(auto m: mp){
        p[m.first%M] += m.second/2;
        rem[m.first%M] += m.second;
    }
    int ans = 0;
    for(auto m: rem){
        // cout << m.first << " " << m.second << "\n";
        int mn;
        if(m.first == M-m.first || m.first == 0){
            mn = m.second/2;
            ans += mn;
            rem[m.first] -= mn*2;
            continue;
        }
        mn = min(m.second,rem[M-m.first]);
        ans += mn;
        rem[m.first] -= mn;
        rem[M-m.first] -= mn;
    }
    for(auto m: rem){
        int mn = min(m.second/2,p[m.first]);
        ans += mn;
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 14336
n = int(input())
t = list(map(int, input().split()))
m = int(input())
for _ in range(m):
    p,x = map(int,input().split())
    p = p-1
    total = 0
    for i in range(len(t)):
        if i == p:
            total += x
        else:
            total += t[i]
    print (total)

Measured memory_bytes: 3060
#include <cstdio>           // printf(), scanf()
#include <set>

using namespace std;

const int MAX_N = 10000;
const int MAX_R = 5000;

void
solve(int n)
{
	int bins[MAX_N / 2];
	set<int> remains;
	int re[MAX_R];

	int ix = 0;
	for (int i = 1; i < n; ++i)
	{
		int r = (i * i) % n;

		if (remains.find(r) == remains.end())
		{
			remains.insert(r);
			re[ix++] = r;
		}
	}

	int m = (n - 1) / 2;
	for (int i = 1; i <= m; ++i)
		bins[i] = 0;

	for (int i = 0; i < ix; ++i)
	{
		for (int j = i + 1; j < ix; ++j)
		{
			if (i != j)
			{
				int d = re[i] - re[j];
				if (d < 0)
					d += n;

				if (d > m)
					d = n - d;

				bins[d]++;
			}
		}
	}

	for (int i = 1; i <= m; ++i)
		printf("%d\n", 2 * bins[i]);
}

int
main(int argc, char **argv)
{
	while (true)
	{
		int n;
		scanf("%d", &n);
		if (n == 0)
			break;

		solve(n);
	}

	return 0;
}

Measured memory_bytes: 3036
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <climits>
#include <numeric>
#include <cmath>
#include <queue>
#include <sstream>
#include <string.h>

using namespace std;
typedef long long ll;

int main() {
  int H, W, h, w;
  cin >> H >> W >> h >> w;
  cout << (H - h) * (W - w) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 5e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//

int main() {
    init();
    ll N;
    string S;
    cin >> N >> S;

    string H;
    ll d = 0;
    rep(i,N){
        d += (S[i] == '(' ? 1 : -1);
        if (d < 0) H += '(', d++;
    }
    H += S;
    H += string(d, ')');

    cout << H << endl;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    }

    static class B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 整数の入力
            int n = Integer.parseInt(in.next());
            String s = in.next();
            String t = in.next();
            String ans = "";

            for (int i = 0; i < n; i++) {
                ans = ans + s.charAt(i) + t.charAt(i);
            }
            // 出力
            out.println(ans);

        }

    }
}



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

int main() {
    int n, m, x;
    cin >> n >> m >> x;
    int a = 0, b = 0;
    for (int i = 0; i < m; ++i) {
        int p;
        cin >> p;
        if (p < x) a++;
        else b++;
    }
    cout << min(a, b) << endl;
}


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

// Function Macros:
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define setpre(n) cout << fixed << setprecision(n)

// Type / Class / Struct Definitions:
using namespace std;

using ll = long long;
using ull = unsigned long long;

// Constants:
const int INF = (1ll << 30) - 1;  // approx 1.07e9
const ll INFLL = 1ll << 60;       // approx 1.15e18
const int MOD = 1e9 + 7;          // 998244353
const long double EPS = 1.0e-14;

// Global Variables:

// Prototype Declarations:
int gcd(int, int);
template <class T>
inline bool chmin(T&, T);
template <class T>
inline bool chmax(T&, T);

// ================ Main Loop ================
int main() {
    int a;
    cin >> a;
    cout << a + a * a + a * a * a << endl;
    return 0;
}
// ===========================================

// Functions:
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}

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


Measured memory_bytes: 3636
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long length[] = {sc.nextLong(), sc.nextLong(), sc.nextLong()};
		System.out.println(length[0] == length[1] && length[1] == length[2] ? "Yes" : "No");
	}
}

Measured memory_bytes: 21204
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <vector>
#include <iostream>
#include <sstream>
#include <string>
#include <iomanip>
#include <set>
#include <map>

using namespace std;

#define EPS 1e-14
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) FOR(i, 0, n)
#define PI 2*acos(0.0)
#define ALL(a) (a).begin(),(a).end()
#define DEBUG(x) cout<<#x <<": "<< x << "\n"
#define DEBUG_ARR(a) REP(i, size(a)){ cout << #a << "[" << i << "]: " << a[i] << "\n"; }
const int VX[] = { 0, 1, 0, -1 };
const int VY[] = { 1, 0, -1, 0 };
const long MOD = 1000000007;

int main() {
	//	--- I/O 高速化 ---
	cin.tie(0);
	ios::sync_with_stdio(false);
	// --- ここまで ---

	int A, B, C;
	cin >> A >> B >> C;
	if (A == B)
	{
		cout << C << "\n";
	} else if (B == C){
		cout << A << "\n";
	} else {
		cout << B << "\n";
	}

	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll n,a,b;cin>>n>>a>>b;
  ll v[n];for(ll i=0;i<n;i++)cin>>v[i];
  pair<ll,ll>dp[n+1][n+1];
  for(ll i=0;i<=n;i++)for(ll j=0;j<=n;j++)dp[i][j]=make_pair(-1,0);
  for(ll i=0;i<=n;i++)dp[i][0]=make_pair(0,0);
  for(ll i=0;i<n;i++){
    for(ll j=0;j<n;j++){
      ll f=dp[i][j].first;
      ll s=dp[i][j].second;
      if(f>=0){
        if(dp[i+1][j].first<f)dp[i+1][j]=dp[i][j];
        else if(dp[i+1][j].first==f)dp[i+1][j].second+=s;
        if(dp[i+1][j+1].first<f+v[i])dp[i+1][j+1]=make_pair(f+v[i],max((ll)1,s));
        else if(dp[i+1][j+1].first==f+v[i]){
          dp[i+1][j+1].second+=s;
          if(j==0)dp[i+1][j+1].second+=1;
        }
      }
    }
  }
  ll summ=dp[n][a].first;
  ll nuu=a;
  for(ll i=a+1;i<=b;i++){
    if(summ*i<nuu*dp[n][i].first){
      summ=dp[n][i].first;
      nuu=i;
    }
  }
  ll ans=0;
  for(ll i=a;i<=b;i++){
    if(i*summ==nuu*dp[n][i].first)ans+=dp[n][i].second;
  }
  
  cout<<to_string((double)summ/(double)nuu)<<endl;
  cout<<ans<<endl;
  //for(ll i=0;i<=n;i++)cout<<dp[i][1].second<<endl;
}



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

// int/long:		-2,147,483,648 - 2,147,483,648 (-2^31 <= int < 2^31)
// long/long long:	-9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

#define	INF (1<<29)
//536,870,912

// lower_bound(A.begin(), A.end(), N)
// upper_bound(...

// A.erase(unique(A.begin(), A.end()), A.end())

// bit: &/and, |/or, ^/xor, ~/not

// getline(cin, String)

// Graph
// Warshall-Floyd: Distance between each node, N^3
// Dijkstra: Distance from the start node, N^2
// DFS(Depth-First Search)

#define	MOD 1000000007

int	main() {
	int N;
	cin >>N;
	vector<int> p(N+1, 0);
	for (int i=1; i<=N; i++) {
		int P;
		cin >>P;
		p.at(P)=i;
	}
	vector<int> a(N+1, 0);
	vector<int> b(N+1, 0);
	for (int i=1; i<=N; i++) {
		a.at(i)=i;
		b.at(N+1-i)=i;
	}
	int S=0;
	for (int i=1; i<=N; i++) {
		S +=p.at(i);
		a.at(i) +=S;
	}
	S=0;
	for (int i=N; i>0; i--) {
		S +=p.at(i);
		b.at(i) +=S;
	}
	for (int i=1; i<=N; i++)
		cout <<a.at(i) <<' ';
	cout <<endl;
	for (int i=1; i<=N; i++)
		cout <<b.at(i) <<' ';
	cout <<endl;
	/*
	for (int i=1; i<=N; i++)
		cout <<a.at(i)+b.at(i) <<' ';
	cout <<endl;
	*/
	return 0;
}



Measured memory_bytes: 896
#include<stdio.h>
#include<algorithm>
#include<string.h>

char n[1000000001] = { 0 };

int main() {
	
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	scanf("%s", n);
	int sum = 0;
	int num = 0;
	for (int i = 0; i < strlen(n); i++) {
		sum += n[i]-'0';
		num *= 10;
		num += n[i] - '0';
	}
	if (num%sum == 0) {
		printf("Yes");
	}
	else {
		printf("No");
	}
}

Measured memory_bytes: 128
import sys
from collections import defaultdict
sys.setrecursionlimit(200000)
input = sys.stdin.readline

# N, = map(int, input().split())
S = list(input().strip())

s = 0
t = 0
for i in range(len(S)):
    if S[i] == "S":
        s += 1
    else:
        if s > 0:
            s -= 1
        else:
            t += 1

print(s + t)

Measured memory_bytes: 5220
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
#define LL long long
LL  gcd(LL a,LL b)
{
	return b? gcd(b,a%b):a;
 } 
int main()
{
	LL a,b;
	cin>>a>>b;
	LL tmp=gcd(a,b);
	LL ans=1;
	//cout<<tmp<<endl;
	
	for(LL i=2;i<=(sqrt(tmp));i++)
	{
		if(tmp%i==0)
		{
			//cout<<i<<endl;
			ans++;
			while(tmp%i==0)
			tmp/=i;
		}
	}
	if(tmp!=1)
	ans++;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <algorithm>
#include <cmath>
#include <locale>
#include <random>
#include <cassert>
#include <sstream>
using namespace std;
#define F first
#define S second
#define pb push_back
#define MP make_pair
#define ALL(x) begin(x), end(x)
#define SZ(x) (int)(x).size()
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ln(i, n) " \n"[i == n]
typedef long long LL;
typedef long double LDB;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
//////////////////////
const long double eps = 1e-13;
const long double PI = acos(-1);
const int INF = (int)1e9;
const LL  INFF = (LL)1e15;
const int mod = 998244353;
const int MXN = (int)1e6 + 7;
int ok[5][5];
int per[5];
int main(){
	for (int i = 1; i <= 3; i++) {
		int u, v; cin >> u >> v;
		ok[u][v] = ok[v][u] = 1;
	}
	for (int i = 1; i <= 4; i++)
		per[i] = i;
	do{
		bool gd = 1;
		for (int i = 1; i < 4; i++) {
			if (!ok[ per[i] ][ per[i+1] ]) gd = 0;
		}
		if (gd) { puts("YES"); return 0; }
	} while(next_permutation(per + 1, per + 5));
	puts("NO");
	return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <cstdio>
int main(){
	int N,M,R=0,r,c,i=-1,j;
	scanf("%d%d",&N,&M);getchar();
	std::vector<int>E(N+2),W(N+2);
	for(r=N*M;++i<M;getchar())for(j=0;++j<=N;)if((c=getchar())=='E')E[j]++;else W[j]++;
	for(j=N;--j;)E[N-j+1]+=E[N-j],W[j]+=W[j+1];
	for(j=-1;++j<=N;)if(r>E[j]+W[j+1])r=E[j]+W[j+1],R=j;
	printf("%d %d\n",R,R+1);
}

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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

int main(){
  char c;cin>>c;
  if('A'<=c && c<='Z')cout<<'A';
  else cout<<'a';

  return 0;
}

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

using namespace std;
using ll = long long;

int main() {
	const ll MOD = 1e9 + 7;
	int N, X;
	cin >> N >> X;
	vector<int> S(N + 1);
	for (int i = 1; i <= N; ++i) { cin >> S[i]; }
	S[0] = (int)MOD;
	sort(S.rbegin(), S.rend());

	const int sz = max(X, S[1]);
	vector<vector<ll>> dp(N + 1, vector<ll>(sz + 1, 0));
	dp[0][X] = 1;
	for (int i = 1; i <= N; ++i) {
		for (int j = 0; j <= sz; ++j) {
			(dp[i][j % S[i]] += dp[i - 1][j]) %= MOD;
			(dp[i][j] += (dp[i - 1][j] * (N - i))) %= MOD;
		}
	}

	ll res = 0;
	for (int i = 0; i <= sz; ++i) {
		(res += (dp[N][i] * i)) %= MOD;
	}

	cout << res % MOD << endl;

	return 0;
}


Measured memory_bytes: 158720
#include <iostream>

using namespace std;

int main() {
    int n;
    while (cin >> n) {
        int ret = 0;
        for (int a = 0; a < 10; a++)
            for (int b = 0; b < 10; b++)
                for (int c = 0; c < 10; c++)
                    for (int d = 0; d < 10; d++)
                        if ((a + b + c + d) == n) 
                            ret++;
        cout << ret << endl;
    }

    return 0;
}

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

int main(void){
    string s;
    cin >> s;
    int n = s.size();
    int l = 0, res = 0;
    map<char,bool> mp;
    mp['A'] = mp['T'] = mp['C'] = mp['G'] = true; 
    rep(i,n){
        if (mp[s[i]]) {
            res = max(res, i-l+1);
        } else l = i+1;
    }
    cout << res << endl;
    return 0;
}


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

int main() {
    string s;
    cin >> s;
    for (int i = 1; i < s.size(); i++) {
        if (s[i] == s[i-1]) {
            cout << "Bad" << endl;
            return 0;
        }
    }
    cout << "Good" << endl;
    return 0;
}

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

namespace ABC045_A
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = scan[0];
            var b = scan[0];
            var h = scan[0] / 2;
            Console.WriteLine((a+b)*h);
           
        }

        static int[] scan { get { return Array.ConvertAll(Console.ReadLine().Split(), int.Parse); } }
    }
}


Measured memory_bytes: 2648
// #pragma GCC optimize(2)
// #pragma G++ optimize(2)
// #pragma comment(linker,"/STACK:102400000,102400000")

#include <bits/stdc++.h>
using namespace std;

typedef long long int64;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef float fl;
typedef double dl;
typedef pair<int,int> pii;
#if (WIN32) || (WIN64) || (__WIN32) || (__WIN64) || (_WIN32) || (_WIN64) || (WINDOWS)
#define lld "%I64d"
#define llu "%I64u"
#else
#define lld "%lld"
#define llu "%llu"
#endif
#define uint(n) ((unsigned int)(n))
#define int64(n) ((long long)(n))
#define ull(n) ((unsigned long long)(n))
#define fl(n) ((float)(n))
#define dl(n) ((double)(n))
#define char(n) ((char)(n))
#define Bool(n) ((bool)(n))
#define fixpoint(n) fixed<<setprecision(n)

const int INF=1061109567;
const int NINF=-1044266559;
const int64 LINF=4557430888798830399;
const dl eps=1e-15;
#define MOD (1000000007)
#define PI (3.1415926535897932384626433832795028841971)

#define MP make_pair
#define MT make_tuple
#define All(a) (a).begin(),(a).end()
#define pall(a) (a).rbegin(),(a).rend()
#define Log(x,y) log(x)/log(y)
#define SZ(a) ((int)(a).size())
#define rep(i,n) for(int i=0;i<((int)(n));i++)
#define rep1(i,n) for(int i=1;i<=((int)(n));i++)
#define repd(i,n) for(int i=((int)(n))-1;i>=0;i--)
#define repd1(i,n) for(int i=((int)(n));i>=1;i--)
#define repv(itr,v) for(__typeof((v).begin()) itr=(v).begin();itr!=(v).end();itr++)
#define repV(i,v) for(auto i:v)
#define repE(i,v) for(auto &i:v)
#define MS(x,y) memset(x,y,sizeof(x))
#define MC(x) MS(x,0)
#define MINF(x) MS(x,63)
#define MCP(x,y) memcpy(x,y,sizeof(y))
#define UN(v) sort(All(v)),v.erase(unique(All(v)),v.end())
#define filein(x) freopen(x,"r",stdin)
#define fileout(x) freopen(x,"w",stdout)
#define fileio(x)\
	freopen(x".in","r",stdin);\
	freopen(x".out","w",stdout)
#define filein2(filename,name) ifstream name(filename,ios::in)
#define fileout2(filename,name) ofstream name(filename,ios::out)
#define fileio2(filename,name) fstream name(filename,ios::in|ios::out)
#define sqr(x) ((x)*(x))
#define Pause system("pause")
#define Cls system("cls")
#define fs first
#define sc second
#define SF scanf
#define PF printf

const int maxn=200010;

int n;
int64 mx[4],mn[4],ans;

int main()
{
	for(int i=0;i<4;i++)
	{
		mx[i]=-LINF;
		mn[i]=INF;
	}

	SF("%d",&n);
	for(int i=0;i<n;i++)
	{
		int64 x,y;SF("%lld%lld",&x,&y);
		
		mx[0]=max(mx[0], x+y);
		mx[1]=max(mx[1],-x+y);
		mx[2]=max(mx[2], x-y);
		mx[3]=max(mx[3],-x-y);
		mn[0]=min(mn[0], x+y);
		mn[1]=min(mn[1],-x+y);
		mn[2]=min(mn[2], x-y);
		mn[3]=min(mn[3],-x-y);
	}

	for(int i=0;i<4;i++) ans=max(ans,mx[i]-mn[i]);

	PF("%lld",ans);

	return 0;
}

Measured memory_bytes: 3776