akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<algorithm> // sort
#include<map> // pair
#include<cmath>
#include<cstring>
#include<set>
using namespace std;
using ll = long long;
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; }
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
const ll mod = 1e9+7;
const int INF = 1e9;
const ll INFLONG = 1e18;
int main(){
  ll n;
  cin >> n;
  if(n == 1){
    cout << "Hello World";
  }else{
    ll a,b;
    cin >> a >> b;
    cout << a+b;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define vv(type, c, m, n, i) vector<vector<type>> c(m, vector<type>(n, i));
#define rep(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
#define rrep(i,a,n) for(int i=(a), i##_len=(n); i>i##_len; --i)
#define len(x) ((int)(x).size())
#define mp make_pair
#define eb emplace_back
typedef long long ll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
struct Node {
	int key;
	Node *r, *l, *p;
};
Node *root, *NIL;
inline void insert(int k) {
	Node *y = NIL;
	Node *x = root;
	Node *z;
	z = (Node *)malloc(sizeof(Node));
	z->key = k;
	z->l = z->r = NIL;
	while(x != NIL) {
		y = x;
		x = (z->key < x->key ? x->l : x->r);
	}
	z->p = y;
	if(y == NIL) root = z;
	else (z->key < y->key ? y->l : y->r) = z;
}
inline void inorder(Node *u) {
	if(u == NIL) return;
	inorder(u->l);
	cout << " " << u->key;
	inorder(u->r);
}
inline void preorder(Node *u) {
	if(u == NIL) return;
	cout << " " << u->key;
	preorder(u->l);
	preorder(u->r);
}
int main() {
	int n; cin >> n;
	string com;
	int x;
	rep(i, 0, n) {
		cin >> com;
		if(com == "insert") {
			cin >> x;
			insert(x);
		} else if(com == "print") {
			inorder(root);
			P("");
			preorder(root);
			P("");
		}
	}
	return 0;
}

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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFやMODの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const ll MOD = 1000000007;

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

  ll tmp = c - a - b;
  bool f = 4 * a * b < tmp * tmp;
  if (tmp < 0) f = false;

  cout << (f ? "Yes" : "No") << endl;
}


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

int main() {
  int D;
  cin >> D;
  
  if (D == 22) {
    cout << "Christmas Eve Eve Eve" << endl;
  } else if (D == 23) {
    cout << "Christmas Eve Eve" << endl;
  } else if (D == 24) {
    cout << "Christmas Eve" << endl;
  } else if (D == 25) {
    cout << "Christmas" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>

#define _GLIBCXX_DEBUG
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
using namespace std;
using vi = vector<int64_t>;
using vvi = vector<vi>;

int main(int argc, const char * argv[]) {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    int64_t x,y,z;
    cin >> x >> y >> z;
    cout << (x-z)/(y+z) << endl;
}


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 LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;

Int res = 1;
Int n;
string s;
int main(){
    cin >> n;
    cin >> s;
    for(int i = 1;i <= n;i++)res = res * i % MOD;
    int open = 0;
    for(int i = 0;i < n*2;i++){
//        cout << i << " " << open << endl;
        int need;
        if(s[i] == 'W')need = 0;
        else need = 1;
        if(open % 2 == need){                
            res *= open;
            res %= MOD;
            open--;
        }else{
            open++;
        }
    }
    if(open != 0)res = 0;
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 640
import math
n, a, b = map(int, input().split())
v = list(map(int, input().split()))
v.sort(reverse=True)
c = 0
def comb(N, R):
	if N < R:
		return 0
	return math.factorial(N) // (math.factorial(N - R) * math.factorial(R))
if len(set(v[:a])) == 1:
	x = v[:a][0]
	d = 0
	for i in v:
		if i == x:
			d += 1
	for i in range(a,min(d+1,b+1)):
		c += comb(d,i)
	print (x)
	print (c)
else:
	x = v[:a][0]
	y = sorted(v[:a])
	av = sum(v[:a])/a
	z = y[0]
	d = 0
	for i in v:
		if i == z:
			d += 1
	e = 0
	for i in y:
		if i == z:
			e += 1
	c = comb(d,e)
	print (av)
	print (c)

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <stack>
#include <assert.h>
#include <bitset>
#define Endl endl
#define mp make_pair
#define ll long long 
#define pii pair<int,int>
#define pll pair<ll,ll>
#define over(A) {cout<<A<<endl;exit(0);}
#define all(A) A.begin(),A.end()
#define ceil(a,b) ((a-1)/b+1)
#define srand() mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define rand(l,r) uniform_int_distribution<int>(l,r)(rng)
typedef unsigned long long ull;
const int inf=1039074182;
using namespace std;
int dp[305][305];
int f[305][305];//×îºóÒ»Î¬Îª×·¼ÓµÄj 
int fac[305];
int C[305][305];
int n,k,mod;
int sum[305][305];

int main()
{
//	freopen("input.txt","r",stdin);
	cin>>n>>k>>mod;
	fac[0]=1;
	for(int i=1;i<=302;i++)
	{
		fac[i]=(1LL*fac[i-1]*i)%mod;
	}
	for(int i=0;i<=302;i++)
	{
		C[i][i]=C[i][0]=1;
	}
	for(int i=2;i<=302;i++)
	{
		for(int j=1;j<i;j++)
		{
			C[i][j]=(C[i-1][j-1]+C[i-1][j])%mod;
		}
	}
	for(int i=1;i<=k;i++)
	{
		dp[1][i]=1;
	}
	for(int rt=1;rt<=k;rt++)
	{
		f[0][rt]=1;
	}
	for(int i=2;i<=n+1;i++)
	{
		memset(sum,0,sizeof(sum));
		for(int size=1;size<=i-1;size++)
		{
			for(int rt=k;rt>=1;rt--)
			{
				sum[size][rt]=(rt==k?0:sum[size][rt+1])+f[size][rt];
				if(sum[size][rt]>=mod) sum[size][rt]-=mod;
			}
		}
		for(int rt=1;rt<=k;rt++)
		{
			for(int size=1;size<=(i-1);size++)
			{
				if(size==i-1)
				{
					f[i-1][rt]+=1LL*dp[size][rt]*C[i-1][size]%mod;
					if(f[i-1][rt]>=mod) f[i-1][rt]-=mod;
				}
				else
				{
					f[i-1][rt]+=(1LL*sum[i-1-size][rt+1]*dp[size][rt]%mod*C[i-1][size]%mod);
					if(f[i-1][rt]>=mod) f[i-1][rt]-=mod;
//					for(int last=rt+1;last<=k;last++)
//					{
//						f[i-1][rt]+=f[i-1-size][last]*dp[size][rt]*C[i-1][size];
//					}
				}
			}
		}
		for(int rt=1;rt<=k;rt++)
		{
			for(int j=rt;j<=k;j++)
			{
				dp[i][rt]+=f[i-1][j];
				if(dp[i][rt]>=mod) dp[i][rt]-=mod;
			}
		}
	}
	cout<<dp[n+1][1]<<endl;
	return 0;
}

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

template<class T> struct CumSum {
    using bifunc = function<T(T, T)>;
    using unfunc = function<T(T)>;
    bifunc f;
    unfunc inv;
    vector<T> acc;

    CumSum(vector<T> data, bifunc f=plus<T>(), unfunc inv=negate<T>())
        : f(f), inv(inv) { build(data); }

    // O(n)
    void build(vector<T> data) {
        acc.push_back(T{});
        for(T val : data)  acc.push_back(f(acc.back(), val));
    }

    // O(1)
    T query(int right) {
        right = min(right, (int)acc.size()-1);
        return acc[right];
    }

    // O(1) : inv is required
    T query(int left, int right) {
        return f(query(right), inv(query(left)));
    }
};

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

    vector<lint> as(n);
    for(lint i=0; i<n; i++)  cin >> as[i];

    CumSum<lint> sum(as);

    lint ans = 1e18;
    for(lint i=0; i<n; i++) {
        ans = min(ans, abs(sum.query(0, i) - sum.query(i, n)));
    }

    cout << ans << endl;
}

Measured memory_bytes: 7156
/*
　　　∫ ∫ ∫
　　　ノヽ
　　（＿　 ）
　（＿　　　 ）
（＿＿＿＿＿＿ ）
　ヽ(´･ω･)ﾉ　
　　 |　 /
　　 UU
*/
#pragma region macro
#include <bits/stdc++.h>
typedef long long int64;
using namespace std;
using P = pair<int64, int64>;
typedef vector<int> vi;
const int MOD = (int)1e9 + 7;
const int64 INF = 1LL << 62;
const int inf = 1<<30;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i,s,n) for (int i = s; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end() //コンテナじゃないと使えない!!
#define debug(x) cerr << #x << ": " << x << "\n";
#define mp make_pair
#define bn '\n'
template <typename T>
ostream& operator<<(ostream& os, vector<T> &V){
    int N = V.size();
    REP(i,N){
        os << V[i];
        if (i!=N-1) os << " ";
    }
    os << "\n";
    return os;
}
template <typename T,typename S>
ostream& operator<<(ostream& os, pair<T,S> const&P){
    os << "(";
    os << P.first;
    os << " , ";
    os << P.second;
    os << ")";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, set<T> &S){
    auto it=S.begin();
    while(it!=S.end()){
        os << *it;
        os << " ";
        it++;
    }
    os << "\n";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, deque<T> &q){
    for(auto it=q.begin();it<q.end();it++){
        os<<*it;
        os<<" ";
    }
     os<<endl;
    return os;
}
vector<pair<int,int>> dxdy = {mp(0,1),mp(1,0),mp(-1,0),mp(0,-1)};
#pragma endregion
//fixed<<setprecision(10)<<ans<<endl;

bool is_perfect_matching_graph(vector<vector<int>>& edge){
    int N = edge.size();
    vector<int> degree(N,0);
    vector<bool> visited(N,false);
    queue<int> q;
    REP(i,N){
        degree[i] = edge[i].size();
        if(degree[i] == 1) q.push(i);
    }
    while(not q.empty()){
        int v = q.front(); q.pop();
        if(visited[v]) continue;
        visited[v] = true;
        int pair_of_v = -1;
        for(auto to:edge[v]){
            if(visited[to]) continue;
            pair_of_v = to;
        }
        if(pair_of_v==-1) return false;
        visited[pair_of_v] = true;
        for(auto to:edge[pair_of_v]){
            if(visited[to]) continue;
            degree[to]--;
            if(degree[to] == 1){
                q.push(to);
            }
        }
    }
    return true;
}


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    int a,b;
    vector<vector<int>> edge(N);
    REP(i,N-1){
        cin >> a >> b;
        edge[--a].emplace_back(--b);
        edge[b].emplace_back(a);
    }
    if(is_perfect_matching_graph(edge)) cout << "Second" << bn;
    else cout << "First" << bn;
}

Measured memory_bytes: 6400
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <queue>
using namespace std;
typedef long long LL;

LL n,u,w[500005],sum = 0;
priority_queue <LL> q;
bool cmp(LL x,LL y){
	return x > y;
}

int main(){
	cin >> n;
	for(LL i = 1;i <= n;i ++) cin >> w[i];
	sort(w + 1,w + 1 + n,cmp);
	for(LL i = 1;i <= n;i ++){
		if(!q.empty()){
			u = q.top(); q.pop();
			sum += u; q.push(w[i]);
		}
		q.push(w[i]);
	}
	cout << sum << '\n';
	return 0;
}

Measured memory_bytes: 6900
#!/usr/bin/env python3
import sys, math, fractions, itertools


def solve(N: int, K: int, S: int):
    A = []
    c = ''
    for i, s in enumerate(S):
        if s != c:
            A.append(i)
        c  = s
    m = []
    for k, ik in enumerate(A):
        if S[ik] == '0':
            if k+2*K >= len(A):
                h = N
            else:
                h = A[k+2*K]
            m.append(h-ik)
        else:
            if k+2*K+1 >= len(A):
                h = N
            else:
                h = A[k+2*K+1]
            m.append(h-ik)
    print(max(m))
    return


# Generated by 1.1.4 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()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    S = next(tokens)  # type: int
    solve(N, K, S)

if __name__ == '__main__':
    main()


Measured memory_bytes: 13360
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int main() {
	int n, m;
	cin >> n >> m;
	int a[50], b[50];
	int c[50], d[50];
	for (int i = 0; i < n; i++) {
		cin >> a[i] >> b[i];
	}
	for (int i = 0; i < m; i++) {
		cin >> c[i] >> d[i];
	}
	for (int i = 0; i < n; i++) {
		int min = 1000000007, ma1 = 0;
		for (int j = 0; j < m; j++) {
			int k = abs(a[i] - c[j]) + abs(b[i] - d[j]);
			if (min > k) {
				min = k;
				ma1 = j;
			}
		}
		cout << ma1 + 1 << endl;
	}
}

Measured memory_bytes: 256
import java.util.Scanner;


class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int[] x = new int[n];
		int l, r;
		int min = Integer.MAX_VALUE;
		for(int i = 0;i < n;i++){
			x[i] = sc.nextInt();
		}


		for(int i = 0;i < n - k + 1;i++){
			l = Math.abs(x[i]) + Math.abs(x[i + k - 1]-x[i]);
			r = Math.abs(x[i + k - 1]) + Math.abs(x[i]-x[i + k - 1]);
			if(min > l) min = l;
			if(min > r) min = r;
		}

		System.out.println(min);
	}
}

Measured memory_bytes: 50140
package main

import "fmt"

func main() {
	var n, k int
	fmt.Scan(&n, &k)

	ans := 0.0
	for i := 1; i <= n; i++ {
		p := 1.0 / float64(n)
		for score := i; score < k; score *= 2 {
			p /= 2
		}
		ans += p
	}

	fmt.Println(ans)
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
long powmod(long a,long b,long m)
{
  if(b==0)return 1;
  if(b%2==0)return powmod(a*a%m,b/2,m);
  else return a*powmod(a,b-1,m)%m;
}
int main()
{
	long n,a[114514]={0},d,m=998244353;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>d;
		a[d]++;
		if((i==0&&d>0)||(i>0&&d==0))
		{
			cout<<0<<endl;
			return 0;
		}
	}
	long ans=1;
	for(int i=0;i<n;i++)
	{
		if(a[i]==0&&a[i+1]>0)
		{
			cout<<0<<endl;
			return 0;
		}
		ans=ans*powmod(a[i],a[i+1],m)%m;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1152
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    int N;
    cin >> N;
    int cnt = 0;
    rep(i, N) {
        int a;
        cin >> a;
        if (i % 2 == 0 && a % 2 == 1) cnt++;
    }
    output(cnt);
    
    return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


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

  string s;
  cin >> s;
  int n=s.size();
  if(n%2!=0){
    cout << "No" << endl;
    return 0;
  }
  rep(i,s.size()){
    if(s[i]=='h' && s[i+1]=='i'){
      i++;      
    }
    else{
      cout << "No" << endl;
    return 0;
    }

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

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pair<int, int>> vpii;
typedef pair<int, int> pii;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

char s[100];

int main(){
	scanf("%s", s);
	if(s[0] == 'S'){
		printf("Cloudy\n");
	}else if(s[0] == 'C'){
		printf("Rainy\n");
	}else{
		printf("Sunny\n");
	}
}


Measured memory_bytes: 256
/*----- || Hare Krishna || -----*/

/*  "WHY DO WE FALL, BRUCE?"  */

//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")

#include<bits/stdc++.h>
#define ll long long
#define endl '\n'
#define elif else if
#define pb push_back
#define pf push_front
#define PI 3.1415926535897932384
#define MOD 1000000007
using namespace std;

char alpha[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'};

string s;
int t;

bool comp(pair<ll,ll> p1, pair<ll,ll> p2){
	return p1.first<p2.first;
}

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    ll n;
    cin >> n;
    vector<pair<ll,ll>> vec;
    for(int i=0; i<n; i++){
    	ll a,b;
    	cin >> a >> b;
    	vec.pb({a,b});
	}
	
	sort(vec.begin(),vec.end(),comp);
	
	ll ans=-1;
	
	ll maxA=LLONG_MIN, minA=LLONG_MAX, maxB=LLONG_MIN, minB=LLONG_MAX;
	
	for(int i=0; i<n; i++){
		
		ll A,B;
		ll x,y;
		x = vec[i].first;
		y = vec[i].second;
		
		A = x+y;
		B = x-y;
		
		maxA = max(maxA, A);
		minA = min(minA, A);
		maxB = max(maxB, B);
		minB = min(minB, B);
		
//		cout << maxA << ' ' << minA <<' ' << maxB << ' ' <<minB<<endl; 
		
		if(i!=0)
		ans = max(ans, max( maxA-minA, maxB-minB ));
		
	}
	cout << ans << endl;
}


Measured memory_bytes: 7440
# Python3 (3.4.3)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


# -------------------------------------------------------------
# main
# -------------------------------------------------------------
C = [list(map(int,input().split())) for _ in range(3)]

dx1 = C[1][0] - C[0][0]
dx2 = C[2][0] - C[1][0]
dy1 = C[0][1] - C[0][0]
dy2 = C[0][2] - C[0][1]

ans = "Yes"
for i in range(3):
    if C[1][i]-C[0][i] != dx1 or C[2][i]-C[1][i] != dx2:
        ans = "No"
        break
    if C[i][1]-C[i][0] != dy1 or C[i][2]-C[i][1] != dy2:
        ans = "No"
        break

print(ans)

Measured memory_bytes: 3064
#include<stdio.h>
#include<iostream>
#include<stdlib.h>
#include<string.h>
#include<string>
#define ios ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
int main()
{
	int a[4][4];
	memset(a,-1,sizeof(a));
	for(int i=1;i<=3;i++){
		for(int j=1;j<=3;j++){
			cin>>a[i][j];
		}
	}
	int n; cin>>n;
	for(int i=1;i<=n;i++){
		int t; cin>>t;
		for(int i=1;i<=3;i++){
			for(int j=1;j<=3;j++){
				if(a[i][j]==t) a[i][j]=1;
			}
		}
	}
	for(int i=1;i<=3;i++){
		if(a[i][1]==a[i][2]&&a[i][2]==a[i][3]&&a[i][1]==1){
			cout<<"Yes"<<endl;
			return 0;
		}
		if(a[1][i]==a[2][i]&&a[2][i]==a[3][i]&&a[2][i]==1){
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	if(a[1][1]==a[2][2]&&a[2][2]==a[3][3]){
		cout<<"Yes"<<endl;
		return 0;
	}
	if(a[1][3]==a[2][2]&&a[2][2]==a[3][1]&&a[1][3]==1){
		cout<<"Yes"<<endl;
		return 0;
	}
	cout<<"No"<<endl;
    return 0;
 } 

Measured memory_bytes: 256
#include <iostream>
using namespace std;
char a[105][105],b[105][105];
int main (){
  int n,m;
  cin >> n >> m;
  
    for (int i = 0; i < n; i++)
      for (int j = 0; j < n; j++)
        cin >> a[i][j];
  
    for (int i = 0; i < m; i++)
      for (int j = 0; j < m; j++)
      cin >> b[i][j];
      
      for (int i = 0; i < n - m + 1; i++){
            for (int j = 0; j < n - m + 1; j++){
                  bool ans = true;
                  for (int k = 0; k < m; k++){
                      for (int y = 0; y < m; y++)
                         if (b[k][y] != a[k + i][y + j]) {ans = false; break;}
                  }
                if (ans == true) {cout<<"Yes"<<endl; return 0;}
            }
      }
    cout<<"No"<<endl;;
}


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

typedef long long ll;
const int MOD = 1e9 + 7;

int main() {
  int N, M;
  cin >> N >> M;

  ll ans;
  if (abs(N - M) >= 2) {
    ans = 0;
  } else {
    ans = 1;
    for (int i = 2; i <= N; i++) {
      ans *= i;
      ans %= MOD;
    }
    for (int i = 2; i <= M; i++) {
      ans *= i;
      ans %= MOD;
    }
    
    if (N == M) {
      ans *= 2;
      ans %= MOD;
    }
  }

  // 解答
  cout << ans << endl;

  return 0;
}

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

#define ll long long

// ll fact(int n){
// 	ll f=1;
// 	for (int i = 2; i <= n; ++i)
// 	{
// 		/* code */
// 		f*=i;
// 	}
// 	return f;
// }

int main(){
	ll n;
	cin>>n;
	cout<<(n*(n-1)/2)<<endl;
	return 0;
}

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

int main(){
    int n,k;
    cin >> n >> k;
    int count = 1;
    for(int i = 0; i < n; i++){
        count = min(count * 2, count + k);
    }
    cout << count << endl;
    return 0;
}



Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;

namespace ABC138
{
    class D
    {

        static long[] Ans;
        static List<long>[] List;

        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split();
            long N = long.Parse(input[0]);
            long Q = long.Parse(input[1]);

            List = new List<long>[N];
            for (long i = 0; i < N - 1; i++)
            {
                input = Console.ReadLine().Split();
                long a = long.Parse(input[0]) - 1;
                long b = long.Parse(input[1]) - 1;

                if (List[a] == null) List[a] = new List<long>();
                if (List[b] == null) List[b] = new List<long>();

                List[a].Add(b);
                List[b].Add(a);
            }

            Ans = new long[N];
            for (long i = 0; i < Q; i++)
            {
                input = Console.ReadLine().Split();
                long p = long.Parse(input[0]) - 1;
                long x = long.Parse(input[1]);
                Ans[p] += x;
            }

            Dfs(0, 0, 0);

            Console.WriteLine(string.Join(" ", Ans));

        }

        static void Dfs(long now, long parent, long sum)
        {
            Ans[now] += sum;
            foreach (var next in List[now])
            {
                if (next == parent) continue;
                Dfs(next, now, Ans[now]);
            }
        }
    }
}


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

using namespace std;

int d[51][51];

void warshallFloyd(int n) {
  for (int k = 0; k < n; k++) {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
      }
    }
  }
}

int main(void) {
  int n, m;
  cin >> n >> m;

  vector<int> a(m), b(m);
  for (int i = 0; i < m; i++) {
    cin >> a[i] >> b[i];
    a[i]--, b[i]--;
  }

  const int INF = 1e9;
  int ans = 0;
  for (int i = 0; i < m; i++) {
    fill(d[0], d[51], INF);
    for (int j = 0; j < n; j++) {
      d[j][j] = 0;
    }
    for (int j = 0; j < m; j++) {
      if (j == i) continue;
      d[a[j]][b[j]] = d[b[j]][a[j]] = 0;
    }
    warshallFloyd(n);


    bool yes = false;
    for (int j = 0; j < n; j++) {
      for (int k = 0; k < n; k++) {
        yes |= d[j][k] == INF;
      }
    }

    ans += yes;
  }

  cout << ans << endl;

  return 0;
}

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



int main(){
    ll n, m;
    cin >> n >> m;
    if (n >= 2 && m >= 2) cout << (n - 2) * (m - 2) << endl;
    else if (n == 1 && m == 1) cout << 1 << endl;
    else if (n == 1) cout << m - 2 << endl;
    else cout << n - 2 << endl;
    
    return 0;
}

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

#define ll long long
#define ld long double

#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>=b;i--)
#define repA(i,A)   for(auto i:A)

#define err() cout<<"=================================="<<endl;
#define errA(A) for(auto i:A)   cout<<i<<" ";cout<<endl;
#define err1(a) cout<<#a<<" "<<a<<endl
#define err2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define err3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl
#define err4(a,b,c,d) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl

#define mp make_pair
#define pb push_back
#define all(A)  A.begin(),A.end()
#define allr(A)	A.rbegin(),A.rend()
#define ft first
#define sd second

#define pll pair<ll,ll>
#define V vector<ll>
#define S set<ll>
#define VV vector<V> 
#define Vpll vector<pll>

#define endl "\n"

const ll logN = 20;
const ll N = 100005;
const ll M = 1000000007;
const ll INF = 1e12;
#define PI 3.14159265

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

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll a,b,c;
    cin>>a>>b>>c;
    ll ans = c - min(c,a-b);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#define INF (1<<30)
using namespace std;

int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	int n; cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n;i++) {
		cin >> a[i];
	}
	int ans = 0;
	vector<int> dp(n + 1, 0);
	/*
	//	O(n^2) TLE
	//	dp[i] = a[i]???????????????????´???¨????????¨???????¢??????¨??????????????§???
	for (int i = 0; i < n; i++) {
		dp[i] = 1;
		for (int j = 0; j < i;j++) {
			if (a[j] < a[i])
				dp[i] = max(dp[i], dp[j] + 1);
		}
		ans = max(ans, dp[i]);
	}
	*/
	//	O(nlogn)
	fill(dp.begin(), dp.end(), INF);
	for (int i = 0; i < n;i++) {
		*lower_bound(dp.begin(), dp.end(), a[i]) = a[i];
	}
	ans = distance(dp.begin(), lower_bound(dp.begin(), dp.end(), INF));
	cout << ans << endl;
}

Measured memory_bytes: 3616
n=int(input())
a=list(map(int,input().split()))
cnt = [0] * (n+1)

for i in range(n):
    cnt[a[i]]+=1

Ans = 0
for i in range(1,n+1):
    Ans += cnt[i] * (cnt[i]-1) // 2

for i in range(n):
    ans = Ans - cnt[a[i]]
    print(ans+1)

Measured memory_bytes: 32296
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = new Integer(sc.next());
        int b = sc.nextInt();
        int menseki = a * b;
        int syuu = 2 * (a + b);
        System.out.print(menseki + " ");
        System.out.println(syuu);
    }
}

Measured memory_bytes: 26252
import java.io.*;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    int n = Integer.parseInt(br.readLine());
    String s = br.readLine();
    char[] c = s.toCharArray();
    int length = c.length;
    long result = 0;
    int[][] array = new int[3][n+1];

    for (int i=0; i<n; i++) {
      if (c[i] == 'R') {
        array[0][i+1] = array[0][i] + 1;
        array[1][i+1] = array[1][i];
        array[2][i+1] = array[2][i];
      } else if (c[i] == 'G') {
        array[0][i+1] = array[0][i];
        array[1][i+1] = array[1][i] + 1;
        array[2][i+1] = array[2][i];
      } else {
        array[0][i+1] = array[0][i];
        array[1][i+1] = array[1][i];
        array[2][i+1] = array[2][i] + 1;
      }
    }
    for (int i=0; i<n; i++){
      char c1 = c[i];
      for (int j=i; j<n; j++){
        if (c[j] != c1) {
          if (c1 != 'R' && c[j] != 'R') {
            result += array[0][n] - array[0][j+1];
          } else if (c1 != 'G' && c[j] != 'G') {
            result += array[1][n] - array[1][j+1];
          } else {
            result += array[2][n] - array[2][j+1];
          }
          if ( 2*j - i < n && c[j + j - i] != c1 && c[j+j-i] != c[j]) {
            result--;
          }
        }
      }
    }
    System.out.println(result);
  }
}


Measured memory_bytes: 33400
#include <cstdio>
#include <cmath>
#include <algorithm>

using namespace std;

int N,x[301],y[301];

double get_r(double X, double Y){
    double ret = 0;

    for(int i = 0;i < N;++i)
        ret = max(ret,(X - x[i]) * (X - x[i]) + (Y - y[i]) * (Y - y[i]));

    return ret;
}

double searchY(double X){
    double lo = 0,hi = 1000;

    for(int it = 0;it < 1000;++it){
        double a = (2 * lo + hi) / 3;
        double b = (lo + 2 * hi) / 3;

        double ra = get_r(X,a);
        double rb = get_r(X,b);

        if(ra < rb) hi = b;
        else lo = a;
    }

    return get_r(X,lo);
}

double searchX(){
    double lo = 0,hi = 1000;

    for(int it = 0;it < 1000;++it){
        double a = (2 * lo + hi) / 3;
        double b = (lo + 2 * hi) / 3;

        double ra = searchY(a);
        double rb = searchY(b);

        if(ra < rb) hi = b;
        else lo = a;
    }

    return searchY(lo);
}

int main(){
    scanf("%d",&N);

    for(int i = 0;i < N;++i)
        scanf("%d %d",&x[i],&y[i]);

    printf("%.7f\n",sqrt(searchX()));

    return 0;
}


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

using namespace std;
typedef long long LL;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    s = s[s.size()-1] == 's'? s + "es" : s + 's';
    cout << s;
    return 0;
}

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

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

    int ans;

    vector<int> B(n,0);

    for(int i=0; i<k; i++){
        int d;
        cin >> d;
        for(int j=0; j<d; j++){
            int a;
            cin >> a;
            B.at(a-1)++;
        }
    }

    for(int i=0; i<n; i++){
        if(B.at(i) == 0) ans++;
    }

    cout << ans << "\n";
}

Measured memory_bytes: 3632
#include <iostream>

int main() {
  char a, b;
  std::cin >> a >> b;

  if ( a == 'H' ) {
    std::cout << b << std::endl;
  } else {
    if ( b == 'H' ) {
      std::cout << 'D' << std::endl;
    } else {
      std::cout << 'H' << std::endl;
    }
  }

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ll          long long
#define pb          push_back
#define INF         9223372036854775807
#define    endl        '\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)    for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define lower(u)    transform(u.begin(), u.end(), u.begin(), ::tolower);//convert string u to lowercase;
#define upper(u)    transform(u.begin(), u.end(), u.begin(), ::toupper);
using namespace std;

using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define N  100005

void solve()
{
    ll n,d,x,y;
    cin>>n>>d;
    ll ans=0;
    rep(i,0,n)
    {
        cin>>x>>y;
        if(d*d>=x*x+y*y)
            ans++;
    }
    cout<<ans<<endl;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int TESTS=1;
//    cin>>TESTS;
    while(TESTS--)
    {
        solve();
    }
    return 0;
}

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

long long a,b,n;
string ss;
int main(){
    /*
    cin>>n;
    while(n--){
        cin>>a;
        if (a==2){
            cout<<1<<endl;
        }
        else{
            if (a%2==0){
                for (int i=0; i<a/2; i++){
                    cout<<1;
                }
                cout<<endl;
            }
            else{
                cout<<7;
                for (int i=0; i<(a-3)/2; i++){
                    cout<<1;
                }
                cout<<endl;
            }
        }
    }
    */
    int n,m;
    cin >> n>> m;
    int cnt=0;
    while (n > 0){
        n-=m;
        cnt++;
    }
    cout << cnt;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define Rint register int
using namespace std;
typedef long long LL;
const int N = 200003;
char str[N];
int n, cnt[26];
LL ans;
int main(){
	scanf("%s", str + 1); n = strlen(str + 1); ans = ((LL) n * (n - 1) >> 1) + 1;
	for(Rint i = 1;i <= n;i ++) ++ cnt[str[i] - 'a'];
	for(Rint i = 0;i < 26;i ++) ans -= ((LL) cnt[i] * (cnt[i] - 1) >> 1);
	printf("%lld", ans);
}

Measured memory_bytes: 384
//Author ::  ABHINAV3010 ::

#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define endl "\n"
#define all(x) (x).begin(), (x).end()
#define fast ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>
typedef long long ll;
typedef pair<ll,ll> p;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag,
             tree_order_statistics_node_update>
    new_data_set;
ll mod=1000000007;
ll gcd(ll a,ll b)
{
    return (b==0)?a:gcd(b,a%b);
}
ll power(ll x, ll y, ll p=mod)
{ll res = 1;x = x % p;while (y > 0){if (y & 1){res = (res*x) % p;}y = y>>1;x = (x*x) % p;}return res;}
int main()
{
fast;
ll n,m;
cin>>n>>m;
vector<ll>hh(n+1,0);
for(ll i=1;i<=n;i++)
{
    cin>>hh[i];
}
vector< vector<ll> >adj(n+1);
for(ll i=0;i<m;i++)
{
    ll a,b;
    cin>>a>>b;
    adj[a].pb(b);
    adj[b].pb(a);
}
ll ans=0;
for(ll i=1;i<=n;i++)
{
    bool flag=true;
    for(auto x:adj[i])
    {
        if(hh[x]>=hh[i])
        {
            flag=false;
            break;
        }
    }
    if(flag)
    {
        ans++;
    }
}
cout<<ans<<endl;
return 0;
}


Measured memory_bytes: 9796
# AOJ 1001: Binary Tree Intersection And Union
# Python3 2018.7.5 bal4u

def parse(p, i):
	global sz
	node[i][2] += 1
	del p[0]
	if p[0] != ',':
		if node[i][0] == 0:
			node[i][0] = sz
			sz += 1
		parse(p, node[i][0])
	del p[0]
	if p[0] != ')':
		if node[i][1] == 0:
			node[i][1] = sz
			sz += 1
		parse(p, node[i][1])
	del p[0]

def act(i, k):
	global ans
	if node[i][2] < k: return
	ans += '('
	if node[i][0] > 0: act(node[i][0], k)
	ans += ','
	if node[i][1] > 0: act(node[i][1], k)
	ans += ')'

while True:
	try: op, a, b = input().split()
	except: break
	sz = 1
	node = [[0 for j in range(3)] for i in range(210)]
	parse(list(a), 0)
	parse(list(b), 0)
	ans = ''
	act(0, 2 if op== 'i' else 1)
	print(ans)


Measured memory_bytes: 5588
n = int(input())
a = list(map(int,input().split()))
flag = 1
     
for i in a:
  if i % 2 == 0:
    if i % 3 == 0 or i % 5 == 0:
      flag = 1
    else:
      flag = 0
      break
      
if flag == 1:
  print('APPROVED')
else:
  print('DENIED')

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

int main(){
    int A, B, K;
    bool flag = false;
    cin >> K;
    cin >> A >> B;
    if(K == 0){
        cout << "NG" << endl;
    }
    else {
        for (int i = A; i <= B; i++) {
            if (i%K == 0) {
                flag = true;
                break;
            }
        }
        if(flag) cout << "OK" << endl;
        else cout << "NG" << endl;
    }
    return 0;
}


Measured memory_bytes: 3636
#include "bits/stdc++.h"
using namespace std;

int main() {
	string S;
	cin >> S;
	if (S[0] == S[S.size() - 1]) {
		if (S.size() % 2 == 0) cout << "First";
		else cout << "Second";
	}
	else {
		if (S.size() % 2 == 1) cout << "First";
		else cout << "Second";
	}
}

Measured memory_bytes: 512
n = int(input())
prev = None
s = set()
flag = True
for i in range(n):
    w = input()
    if prev is None:
        prev = w[0]
    if w in s or w[0] != prev:
        flag = False
    s.add(w)
    prev = w[-1]
if flag:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 38256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Yes                \
    cout << "Yes" << endl; \
    return 0;
#define No                \
    cout << "No" << endl; \
    return 0;
using namespace std;
using ll = long long;
const int INF = 1001001001;
const int MOD = 1000000007;
typedef long long ll;

template <typename T>
void print(const T &v);

int main()
{
    int N;
    cin >> N;
    vector<int> a(N);
    rep(i, N)
    {
        cin >> a[i];
        a[i]--;
    }
    int cnt = 0;
    rep(i, N)
    {
        if (a[a[i]] == i)
        {
            cnt++;
        }
    }
    cout << cnt / 2 << endl;
    return 0;
}

// Use For Debug
template <typename T>
void print(T const &v)
{
    for (int i = 0; i < v.size(); i++)
    {
        if (i)
            cout << " ";
        cout << v[i];
    }
    cout << endl;
}


Measured memory_bytes: 640
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    d,n = LI()
    if n == 100:
        print((n+1)*100**d)
    else:
        print(n*100**d)
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 38256
s=gets.chomp
t=gets.chomp
tp=nil
(s.length-t.length+1).times do |i|
    flag=true
    i.upto(i+t.length-1) do |j|
        flag=false if s[j]!='?' and s[j]!=t[j-i]
    end
    tp=i if flag
end


if tp.nil?
    puts 'UNRESTORABLE'
else
    s.length.times do |i|
        s[i]='a' if s[i]=='?'
        s[i]=t[i-tp] if i>=tp and i<tp+t.length
    end
    puts s
end

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

int main(){
    string s;
    cin >> s;
    long long ans = 0;
    long long temp;
    for(int bit = 0; bit < 1 << s.size() - 1; bit++){
        temp = s[0] - '0';
        for(int j = 0; j < s.size()-1; j++){
            if(bit & 1 << j){
                ans += temp;
                temp = 0;
            }
            temp = temp * 10 + (s[j+1] - '0'); 
        }
        ans += temp;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
using namespace std;

int main(int argc, char const *argv[]) {
  char s[100], p[101], ss[201];
  scanf("%s %s",s, p);
  strcpy(ss, s);
  strcat(ss, s);

  if (strstr(ss, p) == NULL) printf("No\n");
  else printf("Yes\n");
  
  return 0;
}

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

int abs(int x){
	return (x > 0) ? x:-x;
}

int main(){
	int a,b,c,d;
	cin >> a >> b >> c >> d;
	string msg;
	if((abs(a-b) <= d && abs(b-c) <= d) || abs(a-c) <=d)
		msg = "Yes";
	else
		msg = "No";

	cout << msg << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
   int k;cin>>k;
   string s;cin>>s;
   if(s.length()>k)
   {
       for(int i=0;i<k;i++)
        cout<<s[i];
       cout<<"...";
   }
   else
    cout<<s<<endl;
}


Measured memory_bytes: 3624
def main():
    N, K = map(int, input().split())
    V = list(map(int, input().split()))
    M = min(N, K)
    ans = 0
    for a in range(M+1):
        for b in range(M - a+1):
            tmp = []
            tmp.extend(V[:a])
            tmp.extend(V[::-1][:b])
            tmp.sort()
            for i in range(K - (a + b)):
                if len(tmp) > 0 and tmp[0] < 0:
                    tmp.pop(0)
            ans = max(ans, sum(tmp))
    print(ans)


if __name__ == "__main__":
    main()


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

using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;

#define INF (1<<(4*4-1))
#define MOD 1000000007

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

   int N,H,W;
   cin>>N>>H>>W;
   int yoko = N-W+1;
   int tate = N-H+1;
   cout<<yoko*tate<<endl;
   return 0;
}


Measured memory_bytes: 256
h, w = map(int, input().split())
table = [list(input()) for _ in range(h)]

dp = {}

# 最短で通ってるやつのうちの連続してる箇所


# Y, X, ひとつ前が#かどうか
def rec(y, x, f):
    if (y, x, f) in dp:
        return dp[(y, x, f)]
    if y == h - 1 and x == w - 1:
        # dp[(y, x)] = c
        return 0
    if y < 0 or h <= y or x < 0 or w <= x:
        print(10.0 / 0)
    ret = 10**8
    steps = [0, 1, 0]
    for i in range(2):
        next_x, next_y = x + steps[i], y + steps[i + 1]
        if 0 <= next_y < h and 0 <= next_x < w:
            if table[next_y][next_x] == "#":
                # ret = min(rec(next_y, next_x, c) + 1, ret)
                if f == True:
                    ret = min(rec(next_y, next_x, True), ret)
                else:
                    ret = min(rec(next_y, next_x, True) + 1, ret)
            else:
                # ret = min(rec(next_y, neaxt_x, c), ret)
                ret = min(rec(next_y, next_x, False), ret)
        else:
            continue
    # dp[(y, x, c)] = ret
    dp[(y, x, f)] = ret
    return ret


ans = rec(0, 0, True) + 1 if table[0][0] == "#" else rec(0, 0, False)
print(ans)
"""
問題文読み違えてた？
3 3
.##
#.#
#..
だと
2
じゃなくて
1
が正解？
"""

Measured memory_bytes: 4464
#include <bits/stdc++.h>
using namespace std;
#define INF 1e18
typedef long long ll;
typedef pair<int, int> P;

int main(){
  int a,v,b,w,t;
  cin>>a>>v>>b>>w>>t;
  int d=abs(a-b);
  if(v<=w){
    cout<<"NO"<<endl;
    return 0;
  }
  int s=v-w;
  if(d<=(ll)s*t){
    cout<<"YES"<<endl;
  }
  else {
    cout<<"NO"<<endl;
  }
  return 0;
}
  

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

ll n, m, q;
vector<ll> v;

bool inc(ll i = n - 1) {
	bool flag = true;
	if (v[i] == m) {
		if (i == 0)return false;
		flag = inc(i - 1);
		v[i] = v[i - 1];
	}
	else {
		++v[i];
	}
	return flag;
}

int main() {
	cin >> n >> m >> q;
	v.resize(n, 1);
	v.back() = 0;
	vector<ll> a(q);
	vector<ll> b(q);
	vector<ll> c(q);
	vector<ll> d(q);
	for (ll i = 0; i < q; ++i) cin >> a[i] >> b[i] >> c[i] >> d[i];
	for (ll i = 0; i < q; ++i) {
		--a[i];
		--b[i];
	}
	ll ans = 0;
	while (inc()) {
		ll preans = 0;
		for (ll i = 0; i < q; ++i) {
			if (v[b[i]] - v[a[i]] == c[i])preans += d[i];
		}
		ans = max(ans, preans);
	}
	cout << ans << endl;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h> 
using namespace std; 
int main(){
    long long int n,c;
cin>>n>>c;
long long int vals[n][2];
for (int i=0;i<n;i++)
{
    cin>>vals[i][0]>>vals[i][1];
}
long long int dp[n+1][c+1];
for (int i=0;i<=n;i++){
	for(int j=0;j<=c;j++){
		
		dp[i][j]=0;
	}
}
for (int i=1;i<n+1;i++){
	
	for(int j=1;j<c+1;j++){
		if (vals[i-1][0]>j){
			dp[i][j]=dp[i-1][j];
		}
		else{
			dp[i][j]=max(dp[i-1][j],dp[i-1][j-vals[i-1][0]]+vals[i-1][1]);
		}
		
	}
	
}
cout<<dp[n][c];
}

Measured memory_bytes: 82452
#include<stdio.h>
int main() {
	int a, b,i,j;
	while (scanf("%d %d", &a, &b) && a&&b) {
		for (i = 1; i <= a; ++i) {
			for (j = 1; j <= b; ++j) {
				if ((i+j) % 2==0) printf("#");
				else printf(".");
			}
			printf("\n");
		}
		printf("\n");
	}
	return 0;
}


Measured memory_bytes: 2592
#include <bits/stdc++.h>
using namespace std;
 
int main()
{
	int a;
  	cin >> a;
  
  int count = 0;
  if( a / 100 == 1)
  {
    count++;
  }
  if (a % 100 / 10 == 1)
  {
    count++;
  }
  if (a % 10 == 1)
  {
    count++;
  }
  
  cout << count << endl;
}

Measured memory_bytes: 3576
import java.util.*;

public class Main{
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        String text = "";
        if(C >= A && C <=B){
            text = "Yes";
        }else{
            text = "No";
        }
        System.out.println(text);
	}
}

Measured memory_bytes: 21844
#include<iostream>
#include<cstring>
#include<cstdio>
#include<vector>
#include<algorithm>

using namespace std;

#define LL long long
#define fgx cerr<<"--------------"<<endl;
#define dgx cerr<<"=============="<<endl;

inline int read(){
	int x=0,f=1;char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	for(;isdigit(c);c=getchar()) x=x*10+c-'0';
	return x*f;
}
const int MAXN = 200010;
const int INF = 2147483600;

#define mp make_pair
int sta[MAXN+1],top; bool inq[MAXN+1];
int N,M; int ans; int nowt; int cir[MAXN+1]; bool Go[MAXN+1];
int bel[MAXN+1],sz[MAXN+1]; int col,ed[MAXN+1]; int vis[MAXN+1]; bool flag=0;
vector<pair<int,int> > vec[MAXN+1]; int a[MAXN+1],b[MAXN+1],c[MAXN+1],X; int type[MAXN+1]; 
inline void dfs(int k){
	sz[col]++; vis[k]=++nowt; sta[++top]=k; inq[k]=1;
	for(int i=0,sz=vec[k].size();i<sz;i++){
		int v=vec[k][i].first; if(Go[vec[k][i].second]) continue;
		bel[vec[k][i].second]=col; ed[col]++; Go[vec[k][i].second]=1;
		if(!vis[v]) dfs(v);
		else {
			if(inq[v]) {
				cir[col]=vis[k]-vis[v]+1;
			}
		}
	} inq[k]=0; --nowt;
}
#define pb push_back
vector<int> F[9];

int main(){
	N=read(),M=read();
	for(int i=1;i<=M;i++) {
		a[i]=read(),b[i]=read(),c[i]=read();
		vec[a[i]].pb(mp(b[i],i)); vec[b[i]].pb(mp(a[i],i));
		if(a[i]!=b[i]) ++ans;
		if(a[i]!=b[i]&&!c[i]){
			puts("-1"); return 0;
		}
	}
	for(int i=1;i<=N;i++){
		if(!vis[i]) {
			flag=0; top=0;
			nowt=0; ++col,dfs(i);
			if(cir[col]==sz[col]&&sz[col]==ed[col]&&sz[col]>1){
				 ++ans,++X,type[col]=2;
			}
			else if(sz[col]==1&&ed[col]==1) type[col]=1;
			else type[col]=3;
		}
	}
	for(int i=1;i<=M;i++){
		int tp=type[bel[i]];
		if(tp==1){
			if(c[i]>2) F[1].pb(c[i]-2);//2
		} else if(tp==2){
			if(c[i]>1) F[2].pb(c[i]-1);//0
		} else{
			if(c[i]<=1) continue; 
			if(a[i]==b[i]) F[3].pb(c[i]-1);//1
			else F[4].pb(c[i]-1); //0
		}
	} if(!(F[3].size()+F[4].size())&&X){
		puts("-1"); return 0;
	} if(!X){
		printf("%d\n",ans); return 0;
	}
	//for(int i=1;i<=col;i++) cout<<sz[i]<<" "<<ed[i]<<":"<<type[i]<<endl;
	sort(F[1].begin(),F[1].end());
	reverse(F[1].begin(),F[1].end());
	sort(F[3].begin(),F[3].end());
	reverse(F[3].begin(),F[3].end());
	for(int i=0,sz=F[4].size();i<sz;i++) X-=F[4][i];
	if(!F[4].size()) { ans++,X-=F[3][0],swap(F[3][0],F[3][F[3].size()-1]),F[3].pop_back(); }
	sort(F[3].begin(),F[3].end());
	reverse(F[3].begin(),F[3].end());
	for(int i=0,sz=F[2].size();i<sz;i++) X-=F[2][i];
	int nw1=0,sz1=F[1].size(),sz3=F[3].size(),nowsum=0; LL ret=0,retf=INF;
	while(nw1<sz1&&nowsum<X){
		nowsum+=F[1][nw1]; ret+=2; ++nw1;
	} if(nowsum>=X)
		retf=min(retf,ret);
	for(int i=0;i<sz3;i++){
		nowsum+=F[3][i]; ret++;
		while(nw1-1>=0&&nowsum-F[1][nw1-1]>=X){
			 --nw1; nowsum-=F[1][nw1]; ret-=2;
		} if(nowsum>=X) retf=min(retf,ret);
	} if(retf==INF){ puts("-1"); return 0; }
	printf("%lld\n",retf+ans);
	return 0;
}

Measured memory_bytes: 15840