akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {

		int n = sc.nextInt();
		int m = sc.nextInt();
		int l = sc.nextInt();
		int[][] A = new int[n][m];
		int[][] b = new int[m][l];
		long[][] c = new long[n][l];

		A = inputMat(A);
		b = inputMat(b);

		vec_multi(A, b, c);
		sc.close();


	}

	public static int[][] inputMat(int[][] a) {
		int[][] mat = new int[a.length][a[0].length];

		for (int i = 0; i < a.length; i++) {
			for (int j = 0; j < a[0].length; j++) {
				mat[i][j] = sc.nextInt();
			}
		}

		return mat;
	}

	public static void vec_multi(int[][] a, int[][] b, long[][] c) {

		for (int i = 0; i < c.length; i++) {
			for (int j = 0; j < c[0].length; j++) {
				for (int k = 0; k < b.length; k++) {
					c[i][j] += a[i][k] * b[k][j];
				}
			}
		}

		for (int i = 0; i < c.length; i++) {
			for (int j = 0; j < c[0].length; j++) {
				System.out.print(c[i][j]);

					if (j < c[0].length - 1) {
						System.out.print(" ");
					}
			}
			System.out.println();
		}



	}


}



Measured memory_bytes: 54036
import java.util.Scanner;

class Main {
	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);
		
		double r = 6378.1;
		
		double a, b, c, d, x;
		
		while(true) {
			a = scan.nextDouble();
			b = scan.nextDouble();
			c = scan.nextDouble();
			d = scan.nextDouble();
			
			if(a == -1 && b == -1 && c == -1 && d == -1) break;

			a = a * Math.PI / 180;
			b = b * Math.PI / 180;
			c = c * Math.PI / 180;
			d = d * Math.PI / 180;
			
			double[] p1 =  {r * Math.sqrt((1 - Math.sin(a) * Math.sin(a))) * Math.sin(b),
							-r * Math.sqrt((1 - Math.sin(a) * Math.sin(a))) * Math.cos(b),
							r * Math.sin(a)};
			
			double[] p2 =  {r * Math.sqrt((1 - Math.sin(c) * Math.sin(c))) * Math.sin(d),
							-r * Math.sqrt((1 - Math.sin(c) * Math.sin(c))) * Math.cos(d),
							r * Math.sin(c)};
			
			x = Math.acos((p1[0] * p2[0] + p1[1] * p2[1] + p1[2] * p2[2]) / 
							(Math.sqrt(p1[0] *p1[0] + p1[1] * p1[1] + p1[2] * p1[2]) *
							Math.sqrt(p2[0] *p2[0] + p2[1] * p2[1] + p2[2] * p2[2])));

			System.out.println(Math.round(r * x));
		}
		scan.close();
	}
}

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

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

	return 0;
}

Measured memory_bytes: 256
from itertools import permutations
import math

N = int(input())
XY = [list(map(int, input().split())) for _ in range(N)]

sum_roots = 0
for points in permutations(XY):
    for point_idx in range(1, N):
        before_x = points[point_idx-1][0]
        before_y = points[point_idx-1][1]
        x = points[point_idx][0]
        y = points[point_idx][1]
        sum_roots += math.sqrt((x-before_x) ** 2 + (y-before_y)**2)

print(sum_roots/math.factorial(N))


Measured memory_bytes: 9064
// È¥°É£¡Æ¤¿¨Çð! °ÑAC´ø»ØÀ´£¡
//      ¤Ø¡¡¡¡¡¡¡¡¡¡£¯|
// ¡¡¡¡/£Ü7¡¡¡¡¡¡ ¡Ï£ß/
// ¡¡ /¡¡©¦¡¡¡¡ £¯¡¡£¯								AC		AC		AC		AC
//    ©¦¡¡Z £ß,£¼¡¡£¯¡¡¡¡ /`©c						AC		AC		AC		AC
//    ©¦¡¡¡¡¡¡¡¡¡¡©c¡¡¡¡ /¡¡¡¡¡µ					AC		AC		AC		AC
// ¡¡Y¡¡¡¡¡¡¡¡¡¡`¡¡ /¡¡¡¡/  /						AC		AC		AC		AC
// ¡¡Øé¡ñ¡¡.¡¡¡ñ¡¡¡¡¡´¡¡/¡¡/						AC		AC		AC		AC
// ¡¡()¡¡ ¤Ø¡¡¡¡¡¡¡¡|¡¡£Ü¡´							AC		AC		AC		AC
// ¡¡¡¡>- ._¡¡ ¥£¡¡ ©¦ £¯£¯							AC		AC		AC		AC
// ¡¡ / ¤Ø¡¡¡¡ /¡¡/£¼| £Ü£Ü							AC		AC		AC		AC
// ¡¡ ©c_/¡¡¡¡(_£¯¡¡ ©¦£¯£¯							AC		AC		AC		AC
// ¡¡¡¡ 7¡¡¡¡¡¡¡¡¡¡¡¡¡¡|£¯							AC		AC		AC		AC
// ¡¡¡¡ £¾¨Dr£þ£þ`-¨D£ß/							AC		AC		AC		AC
//**************************************Accepted*****************************************//

#include<bits/stdc++.h>

#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define Unique(x) x.erase(unique(all(x)),x.end());

#define CIN_FILE "input.txt"
#define COUT_FILE "output.txt"

#define Pig (OO)

using namespace std;

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

const int Days[]={-1,31,28,31,30,31,30,31,31,30,31,30,31};

inline int read()
{
	#define gc getchar
	int ans=0;
	bool f=1;
	char ch=gc();
	
	while(!isdigit(ch))f^=ch=='-',ch=gc();
	
	while(isdigit(ch))ans=((ans<<2)+ans<<1)+(ch^48),ch=gc();
	
	return f?ans:-ans;
	
	#undef gc
}

typedef long long ll;

int main(int argc, char const *argv[])
{
	ios::sync_with_stdio(false);
	
	int t;
	
	int a,b,c;cin>>a>>b>>c;cout<<c<<' '<<a<<' '<<b;
	
	//printf("Time used = %.12f",(double)(clock())/CLOCKS_PER_SEC);
	return 0;
}

/*  GOD BLESS  */


Measured memory_bytes: 256
#create date: 2020-04-12 21:15

import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    n = ni()
    s = ns()
    r = s.count("R")
    g = s.count("G")
    b = s.count("B")
    ans = r*g*b
    for i in range(0, n-2):
        for j in range(1, (n-1)//+1):
            if i + 2*j < n:
                if len(set([s[i], s[i+j], s[i+2*j]]))==3:
                    ans -= 1
    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 68372
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int p = 924844033;
int pow(int a, int n)
{
	int res = 1;
	for (; n; n >>= 1, a = (ll)a * a % p) {
		if (n & 1) {
			res = (ll)res * a % p;
		}
	}
	return res;
}
void ntt(vector<int> &a, bool x = false)
{
	int n = a.size();
	vector<int> w(n), rev(n);
	w[0] = 1;
	w[1] = pow(5, (p - 1) / n);
	if (x) {
		w[1] = pow(w[1], p - 2);
	}
	for (int i = 2; i < n; i++) {
		w[i] = (ll)w[i - 1] * w[1] % p;
	}
	for (int i = 1, j = n / 2; i + 1 < n; i++) {
		if (i < j) {
			swap(a[i], a[j]);
		}
		int k = n / 2;
		while (j >= k) {
			j -= k;
			k /= 2;
		}
		j += k;
	}
	for (int l = 1; l < n; l <<= 1) {
		for (int i = 0; i < n; i += l << 1) {
			int t = 0;
			for (int j = i; j < i + l; j++) {
				int u = a[j], v = (ll)a[j + l] * w[t] % p;
				a[j] = (u + v) % p;
				a[j + l] = (u - v + p) % p;
				t += n / l / 2;
			}
		}
	}
	if (x) {
		int t = pow(n, p - 2);
		for (int i = 0; i < n; i++) {
			a[i] = (ll)a[i] * t % p;
		}
	}
}
void mul(vector<int> &a, vector<int> b)
{
	int n = a.size(), m = 1;
	while (m >> 1 < n) {
		m <<= 1;
	}
	vector<int> A(m, 0), B(m, 0);
	copy(a.begin(), a.end(), A.begin());
	copy(b.begin(), b.end(), B.begin());
	ntt(A);
	ntt(B);
	for (int i = 0; i < m; i++) {
		A[i] = (ll)A[i] * B[i] % p;
	}
	ntt(A, true);
	a = A;
}
vector<int> adj[200005];
int sz[200005];
void init(int u, int fa = -1)
{
	sz[u] = 1;
	for (int v : adj[u]) {
		if (v == fa) {
			continue;
		}
		init(v, u);
		sz[u] += sz[v];
	}
}
int main()
{
	int n;
	cin >> n;
	for (int i = 1; i < n; i++) {
		int u, v;
		cin >> u >> v;
		adj[--u].push_back(--v);
		adj[v].push_back(u);
	}
	init(0);
	vector<int> val(n + 1, 0), fact(n + 1), inv(n + 1), rev(n + 1), ans(n + 1);
	val[n] = n;
	for (int i = 1; i < n; i++) {
		val[sz[i]]--;
		val[n - sz[i]]--;
	}
	fact[0] = inv[0] = 1;
	for (int i = 1; i <= n; i++) {
		fact[i] = (ll)fact[i - 1] * i % p;
		inv[i] = pow(fact[i], p - 2);
	}
	for (int i = 0; i <= n; i++) {
		val[i] = (ll)(val[i] + p) * fact[i] % p;
		rev[i] = inv[n - i];
	}
	mul(val, rev);
	for (int i = 1; i <= n; i++) {
		ans[i] = (ll)val[i + n] * inv[i] % p;
	}
	copy(ans.begin() + 1, ans.end(), ostream_iterator<int>(cout, "\n"));
	return 0;
}


Measured memory_bytes: 35456
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;
    
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 
#define U_MAP unordered_map<ll,ll>
#define pq priority_queue<ll>
#define rpq priority_queue<ll,vector<ll>,greater<ll>>
#define p_b push_back
    
ll n,cnt,ans,a[ohara],b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};
ll inde[ohara];
    
//-------------------------↓↓↓↓↓↓------------------------
    
//------ 自分を天才だと信じる ------
    
int main(void){
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    
    cin>>n;
    rep(i,n){
        cin>>a[i];
        inde[a[i]-1]=i;
    }
    multiset<ll> st;
    st.insert(LINF);
    st.insert(n);
    st.insert(-LINF);
    st.insert(-1);
    st.insert(inde[n-1]);
    rrrep(ii,n-2,0){
        ll i,j,k,l;
        int jok=1,iok=1,kok=1,lok=1;
        auto it=st.upper_bound(inde[ii]);
        j=*it;
        it++;
        l=*it;
        it=st.lower_bound(inde[ii]);
        it--;
        k=*it;
        it--;
        i=*it;
        //cout<<i<<" "<<j<<" "<<k<<" "<<l<<"\n";

        if(j==LINF){
            j=0;l=0;
            jok=0;lok=0;
        }
        if(k==-LINF){
            k=0;i=0;
            kok=0;iok=0;
        }
        if(l==LINF){
            l=0;
            lok=0;
        }
        if(i==-LINF){
            i=0;
            iok=0;
        }
        if(iok)i=k-i;
        if(kok==1)k=inde[ii]-k;
        if(lok)l=l-j;
        if(jok)j=j-inde[ii];
        //cout<<ii<<" "<<i<<" "<<j<<" "<<k<<" "<<l<<"\n";
        ans+=(i*j+k*l)*(ii+1);
        st.insert(inde[ii]);
    }
    Cout(ans);
    return 0;
}

Measured memory_bytes: 9856
// CODE © by 𝕌𝕥𝕜𝕒𝕣𝕤𝕙 𝔾𝕒𝕣𝕘
// Copying or sharing of this code without permission of the Author is strictly prohibited!!!
#include <bits/stdc++.h>
using namespace std;
#define Speed ios::sync_with_stdio(0); cin.tie(0);
#define pb push_back
#define endl "\n"
int arr[1001][1001], dp[1001][1001];
const int mod = 1e9 + 7;
int f(int i, int j, int n, int m) {
	if (i == n - 1 && j == m - 1) {return 1;}
	if (i == n || i < 0 || j == m || j < 0 || arr[i][j] == -1)return 0;
	int ans = 0;
	if (i < n - 1 && dp[i + 1][j] != -1)ans = (ans + dp[i + 1][j]) % mod;
	else if (i < n - 1) {dp[i + 1][j] = f(i + 1, j, n, m); ans = (ans + dp[i + 1][j]) % mod;}
	if (j < m - 1 && dp[i][j + 1] != -1)ans = (ans + dp[i][j + 1]) % mod;
	else if (j < m - 1) {dp[i][j + 1] = f(i, j + 1, n, m); ans = (ans + dp[i][j + 1]) % mod;}
	return ans;
}
int main() {
	Speed
	int n,m;
	cin >> n >> m;
	memset(dp, -1, sizeof(dp));
	for (int i = 0; i < n; i++) {
		string s;
		cin >> s;
		for (int j = 0; j < m; j++)arr[i][j] = (s[j] == '.' ? 0 : -1);
	}
	cout << f(0, 0, n, m);
}

Measured memory_bytes: 11624
#include<bits/stdc++.h>
using namespace std;
int main()
{
		int i,j,k,l,p;
		char s[105];
		gets(s);
		j=0;
		l=strlen(s);
		for(i=0;i<=l-1;i++)if(s[i]=='C')
		{
		j=1;
		p=i;
		break;
		}
		if(j==1)for(k=p;k<=l-1;k++)if(s[k]=='F'){printf("Yes");return 0;
		}
		printf("No");
}

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

bool judge(int ai) {
  bool div3 = (ai % 3) == 0;
  bool div5 = (ai % 5) == 0;

  if (div3 || div5) {
    return true;
  }
  return false;
}

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

  long result = 0;
  for (int i = 1; i <= N; i++) {
    if (!judge(i)) {
      result += i;
    }
  }
  cout << result << endl;
}


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

using namespace std;
using ll = long long;

const int MAX = 2e3;
const int MOD = 1e9 + 7;

ll t[MAX];

void update(int pos, int x = 1) {
    for (; pos < MAX; pos |= pos+1)
        t[pos] += x;
}

int get(int r) {
    ll sum = 0;
    for (; r >= 0; r &= r+1, --r)
        sum += t[r];
    return sum;        
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    vector<int> a(n);
    for (int& x : a)
        cin >> x, update(x);
    ll ans = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = 1+i; j < n; ++j) {
            int A = a[i], B = a[j];
            update(A, -1), update(B, -1);
            ans += get(A+B-1) - get(abs(A-B));
            update(A), update(B);   
        }
    }
    cout << ans/3;
    return 0;
}                                                               
    
                

Measured memory_bytes: 384
N,C=map(int,input().split())
X=[0]*N
V=[0]*N
for i in range(N):
  X[i],V[i]=map(int,input().split())
  
# 右にいくつ、左にいくつ、を探索する方法はO(N**10)でNG
# 片方の寿司さけを固定することを考える。
# 残りの寿司を左回りにどこまで取るかは
# 「X個まで選べるとき価値が最大になるのはどの寿司か」をあらかじめ線形で計算しておく
# 引き返す場合の引き返さない場合の両パターン
# 逆回りでこれをやっておいたほうがあとあと楽っぽい。

best_sushi_noturn=[0]*(N+1) # 寿司を取らない場合もあるのでN+1
best_sushi_turn=[0]*(N+1) # 同上
bestval_noturn=0 # 引き返さない場合の最大価値
bestval_turn=0 # 引き返す場合の最大価値
valsum=0 # そこまでの累計価値
for i in range(1,N+1):
  # i個寿司を取るのときの最適な選択を返す
  # i=0のときは寿司を取らないとき
  # i=1個目の寿司にはX[N-1]を入れたい
  dist=C-X[N-i]
  valsum+=V[N-i]
  if valsum-dist>bestval_noturn:
    bestval_noturn=valsum-dist
    best_sushi_noturn[i]=bestval_noturn
  else:
    best_sushi_noturn[i]=best_sushi_noturn[i-1] # 改善しない場合はその前の値を返す
  if valsum-dist*2>bestval_turn:
    bestval_turn=valsum-dist*2
    best_sushi_turn[i]=bestval_turn
  else:
    best_sushi_turn[i]=best_sushi_turn[i-1] # 改善しない場合はその前の値を返す

# 逆回りの場合の最大価値を表す配列ができたので、正順で取る個数を決め打ちして最大価値を算出
valsum=0
# 正順で一つも取らない場合の最大価値を算出しておく
ans=best_sushi_noturn[N]
for i in range(N):
  valsum+=V[i]
  cost=X[i]
  # 正順で引き返す場合
  if valsum-cost*2+best_sushi_noturn[N-(i+1)]>ans:
    ans=valsum-cost*2+best_sushi_noturn[N-(i+1)]
  # 逆順で引き返す場合
  if valsum-cost+best_sushi_turn[N-(i+1)]>ans:
    ans=valsum-cost+best_sushi_turn[N-(i+1)]

print(ans)

Measured memory_bytes: 18836
function Main(input) {
	var str = input;
	var sum = 0;
	var c = 0;
	var poll = [];
	str = str.split("\n");
	var n = Number(str[0].split(" ")[1]);
	str = str[1].split(" ");
	for (var k= 0; k < str.length; k++){
 		poll[k] = Number(str[k]);
 	}
//  	console.log(poll);
 	for (var i = 0; i < poll.length; i++){
 		sum = sum+ poll[i];
 	}
 	var m = Math.ceil(sum/(4*n));
 	for (var j = 0; j < poll.length; j++){
 		if(poll[j] >= m){
 			c++;
 		}
 	}
 	if(c>=n){
	 console.log("Yes");
	 }else{
	 console.log("No");
	 }
}
 //*おまじない
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 21064
class Integer
  def combination(k)
    return 1 if k.zero?

    (self - k + 1..self).inject(:*) / k.factorial
  end

  def permutation(k)
    return 1 if k.zero?

    (self - k + 1..self).inject(:*)
  end

  def factorial
    return 1 if self.zero?

    (1..self).inject(:*)
  end
end

n = gets.to_i
count = Hash.new(0)
n.times.each do
  s = gets.chomp.chars.sort
  count[s] += 1
end
puts count.values.map{ |n| n.combination(2) }.inject(:+)

Measured memory_bytes: 92796
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define pb push_back
#define fi first
#define se second
#define rep(i,a,b) for(int i=int(a);i<=(int)(b);i++)
#define per(i,a,b) for(int i=int(a);i>=(int)(b);i--)
const int mod = 1e9+7;
const int maxn = 2e3+10;
const int inf = 0x3f3f3f3f;
int main() {
    ios::sync_with_stdio(false);cin.tie(nullptr);
    int n;
    cin>>n;
    vector<ll> x,y;
    rep(i,1,n) {
        ll a,b;
        cin>>a>>b;
        x.pb(a+b);
        y.pb(a-b);
    }
    sort(x.begin(),x.end());
    sort(y.begin(),y.end());
    ll Max=-x.front()+x.back();
    Max=max(Max,y.back()-y.front());
    cout<<Max<<'\n';
    return 0;
}


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

using namespace std;

int calcpos(char c) {
  switch (c) {
    case 'M':
      return 0;
    case 'A':
      return 1;
    case 'R':
      return 2;
    case 'C':
      return 3;
    case 'H':
      return 4;
  }

  return -1;
}

char S[15];

int main()
{
  long long counts[5] = {0,0,0,0,0};
  int pos;

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

  for (int i = 1; i <= N && !feof(stdin); ++i) {
    scanf("%s", S);

    pos = calcpos(S[0]);
    if (pos != -1) ++counts[pos];
  }

  long long res = 0;
  for (int i = 0; i <= 2; ++i) {
    for (int j = i + 1; j <= 3; ++j) {
      for (int x = j + 1; x <= 4; ++x) {
        res += counts[i] * counts[j] * counts[x];
      }
    }
  }

  printf("%lld", res);

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define N 500000
#define INF 1<<30
#define ll long long
using namespace std;

char c[N];
int pd=0,k;
int main()
{
    gets(c);
    int len=strlen(c);
    for(register int i=0;i<len;i++)
    {
    	if(c[i]=='C')
    		{
    			k=i;
		    	for(register int j=k+1;j<len;j++)
		    		if(c[j]=='F')
		    		{	
						cout<<"Yes"<<endl;
						return 0;
					}	
			}
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse4")
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll
#define all(x) x.begin(), x.end()
#define trav(i,a) for(auto &i:a) 
inline int in(){int x;scanf("%lld",&x);return x;}
int32_t main()
{
	
	int n=in();
	vector<int> a(n+1),ans(n+1);
	for(int i=1;i<=n;i++)
	{
		a[i]=in();
	}
	
	int c=0;
	for(int i=n;i>=1;i--)
	{
		int ct=0;
		for(int j=i+i;j<=n;j+=i)
		if(ans[j])ct++;
		
		if(ct%2!=a[i]%2){ans[i]=1;c++;}
	}
	cout<<c<<"\n";
	for(int i=1;i<=n;i++)
	{
		if(ans[i]==1)cout<<i<<" ";
	}
}

Measured memory_bytes: 6412
#include <stdio.h>

int main(void)
{
    int time;
    int i;
    int total = 0;

    for (i = 0; i < 4; i++){
        scanf("%d", &time);
        total += time;
    }

    printf("%d\n%d\n", total / 60, total % 60);

    return 0;
}

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

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

    vector<int> v(q);
    for (int i = 0; i < q; i++){
        cin >> v[i];
    }
    sort(v.begin(), v.end());

    int p = k - q;
    vector<int> r(n, p);
    for (int i = 0; i < q; i++) {
        r[v[i]-1]++;
    }

    for (int i = 0; i < n; i++){
        if(r[i]>0){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}

Measured memory_bytes: 1408
#include<vector>
#include<iostream>
#include<algorithm>

using namespace std;

vector<int> in;
vector<int> pre;
vector<int> post;

int p = 0;
void reconstruction(int l, int r)
{

	if (l >= r)
		return;
	int a, m;
	 a = pre[p++];
	 m = distance(in.begin(), find(in.begin(), in.end(), a));
	 reconstruction(l,m);
	 reconstruction(m+1, r);

	 post.push_back(a);

}
int main()
{
	int n,k;

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

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

	reconstruction(0, n);

	cout << post[0];
	for (int i = 1; i < n; i++)
	{
		cout << ' '<<post[i];
	}
	cout << endl;

	return 0;
}


Measured memory_bytes: 3160
#include<cstdio>
#include<vector>
#include<algorithm>
#include<utility>

#define min(a,b) (a)>(b)?(b):(a)
#define max(a,b) (a)>(b)?(a):(b)

using namespace std;

int main()
{
	vector<pair<int,int>> a;

	while (true)
	{
		int x,y;
		scanf("%d %d", &x, &y);
		if (x == 0 && y == 0)
		{
			break;
		}
		else
		{
			a.push_back(pair<int, int>(min(x, y), max(x, y)));
		}
	}
	for (int i = 0; i != a.size(); i++)
	{
		printf("%d %d\n", a[i].first, a[i].second);
	}
	return 0;
}

Measured memory_bytes: 2608
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
int main(){
    int n;
    string s, t;
    cin >> n >> s;
    for(int i=0; i<n/2; i++){
        t += s.at(i);
    }
    if(s == t + t) cout << "Yes";
    else cout << "No";
}

Measured memory_bytes: 256
import numpy
H,W = map(int,input().split())
a_list = []
INF = 10**10
for i in range(H):
    str = input()
    a_list.append([0 if i == "#" else INF for i in list(str)])

a_list = numpy.array(a_list)
for x in range(W-1):
    a_list[:,x+1] = numpy.minimum(a_list[:,x]+1,a_list[:,x+1])
    a_list[:,-x-2] = numpy.minimum(a_list[:,-x-1]+1,a_list[:,-x-2])

for y in range(H-1):
    a_list[y+1,:] = numpy.minimum(a_list[y,:]+1,a_list[y+1,:])
    a_list[-y-2,:] = numpy.minimum(a_list[-y-1,:]+1,a_list[-y-2,:])

print(a_list.max())

Measured memory_bytes: 28996
// 大整数整除 abc176-B 
// a%b?=0
// 每a一位数%b相加最后加和判断取模
// 如18%9
// 1%9=1,(1+8)%9==0 故成立18%9==0
  
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;
typedef long long ll;
string a;

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin>>a;
	ll ans=0;
	for (ll i=0;i<a.size();i++)
	{
//		if ((a[i]-'0')%9!=0)
		ans+=a[i]-'0';
	}
	if (ans%9==0)
	cout<<"Yes"<<endl;
	else
	cout<<"No"<<endl;
	return 0;
 } 

Measured memory_bytes: 3764
#include<stdio.h>
int main(){
	int a,b[9],c,i;
	while(1){
		c=0;
		scanf("%d",&a);
		if(a==0)break;
		for(i=0;i<9;i++){
			scanf("%d",&b[i]);
			c=c+b[i];
		}
		printf("%d\n",a-c);
	}
	return 0;
}


Measured memory_bytes: 2044
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace AtCoder
{
	class Program
	{
		static void Main(string[] args)
		{
			Question.Exec();
		}
	}

	public static class Question
	{
		public static void Exec()
		{
			int n = int.Parse(Console.ReadLine());
			n -= 22;
			string str = "";
			switch (n) {
				case 0:
					str = "Christmas Eve Eve Eve";
					break;
				case 1:
					str = "Christmas Eve Eve";
					break;
				case 2:
					str = "Christmas Eve";
					break;
				case 3:
					str = "Christmas";
					break;
				default:
					break;
			}

			Console.WriteLine($"{str}");

			Console.ReadKey();
		}
	}
}

Measured memory_bytes: 11220
#include <stdio.h>
#include <ctype.h>
 
int main(void)
{
	char ch[1200];
	int i,n;
	n=0;
	char a[1200];
	
	while(1) {
	scanf("%c",&a[n]);
	if(a[n] == '\n') {
	break;
	}

	ch[n] = a[n];
	if('A' <= a[n] && a[n] <= 'Z')
	{
	ch[n] = a[n] + 32;
	}

	else if(a[n] >= 'a' && a[n] <= 'z')
	{
	ch[n] = a[n] - 32;
	}

	n = n +1;
	}

	for(i=0; i<n ; i++)
	{
	printf("%c" ,ch[i]);
	}
	printf("\n"); 

return 0;   
}


Measured memory_bytes: 2048
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

#define rep(i, n) for(ll i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;

const ll INF = 1e9;
const ll MOD = 1000000007;  // 1e9 + 7

const ll V = 100010;

ll cnt[2]; // cnt[0]: x, cnt[1]: y
vector<bool> visited(V*2);
vector< vector<ll> > to(V*2);

void dfs(ll v) {
  if (visited[v]) { return; }
  visited[v] = true;
  ++cnt[v/V];
  for (ll u : to[v]) { dfs(u); }
}

int main(int argc, char** argv) {
  ll N;
  cin >> N;
  vector<P> vertices(N);
  map<ll, vector<ll> > X; // stores the group of vertices with same x
  map<ll, vector<ll> > Y; // stores the group of vertices with same y
  rep(i, N) {
    ll x, y;
    cin >> x >> y;
    y += V;
    to[x].push_back(y);
    to[y].push_back(x);
  }
  ll ans = 0;
  rep(i, V*2) {
    if (visited[i]) { continue; }
    cnt[0]=0; cnt[1]=0;
    dfs(i);
    ans += (ll)cnt[0] * cnt[1];
  }
  ans -= N;
  cout << ans << endl;
}


Measured memory_bytes: 11648
import java.util.Scanner;

public class Main {

    public static void main(String[] args){

        Scanner input = new Scanner(System.in);
        String[] yoko = new String[5];
        String[] tate = new String[4];

        for(int i = 0 ; i < 5 ; i++){
        	if(i != 4){
        		yoko[i] = input.nextLine();
        		tate[i] = input.nextLine();
        	}else{
        		yoko[i] = input.nextLine();
        	}
        }
        int stx = 0;
        int sty = 0;
        char direction = 'R';
        StringBuilder sb = new StringBuilder();
        while(true){

        	if(direction == 'R'){
        		if(sty != 0 && tate[sty-1].charAt(stx) == '1'){
        			sty--;
        			direction = 'U';
        		}else if(stx != 4 && yoko[sty].charAt(stx) == '1'){
        			stx++;
        		}else if(tate[sty].charAt(stx) == '1'){
        			sty++;
        			direction = 'D';
        		}else{
        			stx--;
        			direction = 'L';
        		}
        	}else if(direction == 'L'){
        		if(sty != 4 && tate[sty].charAt(stx) == '1'){
        			sty++;
        			direction = 'D';
        		}else if(sty != 0 && tate[sty-1].charAt(stx) == '1'){
        			sty--;
        			direction = 'U';
        		}else if(stx != 0 && yoko[sty].charAt(stx-1) == '1'){
        			stx--;
        		}else{
        			stx++;
        			direction = 'R';
        		}
        	}else if(direction == 'U'){
        		if(stx != 0 && yoko[sty].charAt(stx-1) == '1'){
            			stx--;
            			direction = 'L';
        		}else if(sty != 0 && tate[sty-1].charAt(stx) == '1'){
        			sty--;
        		}else if(yoko[sty].charAt(stx) == '1'){
        			stx++;
        			direction = 'R';
        		}else{
        			sty++;
        			direction = 'D';
        		}
        	}else if(direction == 'D'){
        		if(stx != 4 && yoko[sty].charAt(stx) == '1'){
         			stx++;
         			direction = 'R';
        		}else if(sty != 4 && tate[sty].charAt(stx) == '1'){
        			sty++;
        		}else if(stx != 0 && yoko[sty].charAt(stx-1) == '1'){
        			stx--;
        			direction = 'L';
        		}else{
        			sty--;
        			direction = 'U';
        		}
        	}
        	sb.append(direction);
        	//if(sb.length() < 20)System.out.println(sb+","+stx+","+sty);
        	if(stx == 0 && sty == 0)break;
        }
        System.out.println(sb.toString());
    }
}

Measured memory_bytes: 17268
// not my code is from Geothermal....
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

const int N = 1001000;
const int MOD = 1e9+7;

ll fact[N];
ll ans[N], pref[N];

int main() {
    ios_base::sync_with_stdio(0); 
    cin.tie(0);
    
    int n;
    cin >> n;
    int h, d;
    cin >> h >> d;

    fact[0] = 1;
    ll factSum = 0;
   	for (int i = 1; i <= n; ++i) {
    	fact[i] = fact[i-1] * i;
    	fact[i] = fact[i] % MOD;
    	factSum += fact[i];
    	factSum = factSum % MOD;
    }
 
    pref[0] = 0; pref[1] = fact[n];
    // start with n factorial
    ans[0] = fact[n];
    for (int i = 1; i < h; ++i) {
    	ans[i] = pref[i] - pref[max(0, i-d)];
    	ans[i] += MOD; ans[i] = ans[i] % MOD;

    	/* for factSum, you can choose the k "lowest" buildings from 1 to n and get then to height i, 
    	 and after that assign an order for them for future use*/

    	ans[i] = ans[i] * factSum; ans[i] = ans[i] % MOD;
    	pref[i+1] = pref[i] + ans[i];
    	pref[i+1] = pref[i+1] % MOD;
    	//cout << ans[i] << " " << endl;
    }
 	/* as here we don't have future use we don't multiply by factSum */
    ans[h] = pref[h] - pref[max(0, h-d)];
    ans[h] += MOD; ans[h] = ans[h] % MOD;
    cout << ans[h] << endl;
    
    return 0;
}

Measured memory_bytes: 23680
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        FastReader sc=new FastReader();
        int x=sc.nextInt();
        if(x==0) System.out.println(1);
        if(x==1) System.out.println(0);

    }
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}


Measured memory_bytes: 32688
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int n, k;
vector<vector<int>> e(100010);
ll ans;

void dfs(int now, int parent) {
    int color_num;
    if (now == 0) color_num = max(0, k - 1);
    else color_num = max(0, k - 2);
    for (auto i : e[now]) {
        if (i == parent) continue;
        dfs(i, now);
        ans *= color_num;
        ans %= MOD;
        color_num--;
    }
}

int main() {
    cin >> n >> k;
    rep(i, 0, n - 1) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        e[a].push_back(b);
        e[b].push_back(a);
    }

    ans = k;
    dfs(0, -1);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 10368
// Created by code_sm
//
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp> 
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> pseudo_set;
#define ll long long
#define vi vector<int>
#define si set<int> 
#define mii map<int,int>
#define pb push_back
#define pf push_front
#define pii pair<int,int>
#define extract_word(s)  stringstream str(s); while(str>>word)
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define SET(s) cout<<fixed<<setprecision(s)
#define chotu 1000000007
#define set0(a) memset(a,0,sizeof(a))
#define endl "\n"
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define lower_string(s) transform(all(s),s.begin(),::tolower())
#define upper_string(s) transform(all(s),s.begin(),::toupper())
#define size(s) s.size()
template<class T> bool umin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool umax(T &a, T b) { return a < b ? (a = b, true) : false; }
template<typename T,typename U>
bool compare(T x,U y){return(abs(x-y)<=1e-9);}
void solve()
{
fastio
	int a,b;
	cin>>a>>b;
	if(a==b)
	{
		for(int i=1;i<=b;i++)
			cout<<a;
	}
	else if(a>b)
	{
		for(int i=1;i<=a;i++)
			cout<<b;
	}
	else
	{
	for(int i=1;i<=b;i++)
		cout<<a;	
	}
}
int main()
{
//code
	int t=1;

while(t--)
{
	solve();
	cout<<endl;
}
}


Measured memory_bytes: 3588
from collections import Counter
def solve(n, s):
    D = Counter(s)
    best = max(D.values())
    S = filter(lambda k: D[k] == best, D.keys())
    return "\n".join(sorted(list(S)))

n = int(input())
s = [input() for i in range(n)]
print(solve(n, s))

Measured memory_bytes: 35564
#include <bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i, n) for (i = 0; i < n; i++)
#define Fo(i, k, n) for (i = k; k < n ? i < n : i > n; k < n ? i += 1 : i -= 1)
#define ll long long
#define si(x) scanf("%d", &x)
#define sl(x) scanf("%lld", &x)
#define ss(s) scanf("%s", s)
#define pi(x) printf("%d\n", x)
#define pl(x) printf("%lld\n", x)
#define ps(s) printf("%s\n", s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for (auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int> pii;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<char> vc;
typedef vector<vc> vcc;
typedef vector<pii> vpii;
typedef vector<pl> vpl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim)
{
    uniform_int_distribution<int> uid(0, lim - 1);
    return uid(rang);
}

int mpow(int base, int exp);
void ipgraph(int n, int m);
void dfs(int u, int par);

const int mod = 1'000'000'007;
const int N = 3e5, M = N;
//=======================

vi g[N];
int a[N];

void solve()
{
    ll i, j, n, m;
    cin >> n >> m;
    vi a(10);
    fo(i, m)
    {
        cin >> j;
        a[j] = 1;
    }
    for (i = n; i <= 100000; i++)
    {
        string s = to_string(i);
        bool k = true;
        fo(j, s.size())
        {
            if (a[s[j] - '0'])
            {
                k = false;
                break;
            }
            else
            {
                continue;
            }
        }
        if (k)
        {
            cout << i << endl;
            return;
        }
        else
        {
            continue;
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());

    int t = 1;
    //cin >> t;
    while (t--)
    {
        solve();
    }

    return 0;
}

int mpow(int base, int exp)
{
    base %= mod;
    int result = 1;
    while (exp > 0)
    {
        if (exp & 1)
            result = ((ll)result * base) % mod;
        base = ((ll)base * base) % mod;
        exp >>= 1;
    }
    return result;
}

void ipgraph(int n, int m)
{
    int i, u, v;
    while (m--)
    {
        cin >> u >> v;
        u--, v--;
        g[u].pb(v);
        g[v].pb(u);
    }
}

void dfs(int u, int par)
{
    for (int v : g[u])
    {
        if (v == par)
            continue;
        dfs(v, u);
    }
}


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

int main() {
    double a, b, x;
    cin >> a >> b >> x;
    x /= a;

    double ans;
    if (a * b / 2 >= x) {
        a = x * 2 / b;
        ans = atan(b / a) / 3.14159265358 * 180;
    } else {
        x = a * b - x;
        b = x * 2 / a;
        ans = atan(b / a) / 3.14159265358 * 180;
    }

    cout << fixed << setprecision(10) << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

ll x[100010],y[100010];
int main() {
	ll a,b,m;
	cin>>a>>b>>m;
	ll mi1=INF;
	for(ll i=0;i<a;i++){
		cin>>x[i];
		mi1=min(mi1,x[i]);
	}
	ll mi2=INF;
	for(ll j=0;j<b;j++){
		cin>>y[j];
		mi2=min(mi2,y[j]);
	}
	ll ans=mi1+mi2;
	for(ll i=0;i<m;i++){
		ll X,Y,c;
		cin>>X>>Y>>c;
		X--;Y--;
		if(ans>x[X]+y[Y]-c){
			ans=x[X]+y[Y]-c;
		}
	}
	cout <<ans;
	// your code goes here
	return 0;
}

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

using namespace std;
typedef long long ll;
typedef long double ld;

#define in(s) cin >> s
#define out(s) cout << s << endl
#define rep(i,n) for(int i=0; i<n; i++)
#define rept(i,a,b) for(int i=a; i<b; i++)
#define pcnt __builtin_popcount
#define pcntll(x) __builtin_popcountll(x)
#define DMAX DBL_MAX;
#define IMIN INT_MIN;
#define IMAX INT_MAX;

//const ll MOD = 1e9+7;
//const ll MOD = 998244353;
//const ll MAX = 3e5+1;
//const ll INF = 1e18;
//const ld PI = acos(-1L);
//
vector<ll> divisors(ll n) {
    vector<ll> ans;
    for (ll i=1; i<=sqrt(n); i++) {
        if (n % i == 0) {
            if (n / i == i) {
                ans.push_back(i);
                break;
            }
            ans.push_back(i);
            ans.push_back(n / i);
        }
    }
    return ans;
}

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);

    int N;
    in(N);
    unordered_set<int> total, duplicates;
    vector<int> A(N);
    int tmp;
    rep(i, N) {
        in(tmp);
        A[i] = tmp;
        if (total.find(tmp) != total.end()) duplicates.insert(tmp);
        total.insert(tmp);
    }
    for (int d: duplicates) {
        total.erase(d);
    }
    int n = total.size();
    A.clear();
    for (int i: total) A.push_back(i);


    sort(A.begin(), A.end());
    int cnt = 0;
    rep(i, n) {
        bool flag = true;
        vector<ll> div = divisors((ll) A[i]);
        for (ll j: div) {
            if (duplicates.find((int) j) != duplicates.end()) {
                flag = false;
                break;
            }
        }
        if (flag) cnt++;
        duplicates.insert(A[i]);
    }
    out(cnt);

    return 0;
}


Measured memory_bytes: 20568
#include<bits/stdc++.h>
using namespace std;
int main() {
	int n,d;
	scanf("%d",&n);
	while(n) {
		d = n%10;
		if(d==7) {
			printf("Yes");
			return 0;
		}
		n/=10;
	}
	printf("No");
}

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

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

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

template <typename T>
ll lower_count(std::vector<T> v, T key) {
  return (ll) (std::lower_bound(v.begin(), v.end(), key) - v.begin());
}
template <typename T>
ll upper_count(std::vector<T> v, T key) {
  return (ll) (v.end() - std::upper_bound(v.begin(), v.end(), key));
}

int main() {
  int N;
  std::cin >> N;
  std::vector<int> v(N);
  rep(i, N) {
    std::cin >> v[i];
  }
  std::sort(v.begin(), v.end());

  ll ans = 0;

  for(int i = 0; i < N; ++i) {
    int a = v[i];
    for(int j = i + 1; j < N; ++j) {
      int b = v[j];
      int lower = std::max(a - b, b - a);
      int upper = a + b;

      ans += (ll) (std::lower_bound(v.begin() + j + 1, v.end(), upper) - (v.begin() + j + 1)) - (ll) (std::lower_bound(v.begin() + j + 1, v.end(), lower + 1) - (v.begin() + j + 1));
    }
  }

  std::cout << ans << '\n';
}


Measured memory_bytes: 256
n, y = map(int, input().split())
f = True
for i in range(n+1):
    for j in range(n-i+1):
        if 10000 * i + 5000 * j + 1000 * (n - i -j) == y:
            print(i, j, n - i -j)
            f = False
            break
    if f == False:
        break
if f:
    print('-1 -1 -1')

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a[3];
    for (int i = 0; i < 3; ++i)
        cin >> a[i];
    sort(a, a + 3);
    cout << a[0] + a[1];
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define mod 1000000007
using ll = long long;
using namespace std;

int main(){
  int N;
  cin >> N;
  vector<int> t(N+1);
  vector<int> x(N+1);
  vector<int> y(N+1);
  t[0] = x[0] = y[0] = 0;
  rep(i,N) cin >> t[i+1] >> x[i+1] >> y[i+1];
  for(int i=1;i<=N;i++){
    int d = abs(x[i]-x[i-1])+abs(y[i]-y[i-1]);
    int dt = t[i] - t[i-1];
    if(!(dt>=d && d%2 == dt%2)){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 1408
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)
typedef long long ll;

using namespace std;

template <typename T> void output(T, int);
int gcd(int a, int b);

int main() {
    // source
    int n, ma, mb;
    cin >> n >> ma >> mb;
    int a[n], b[n], c[n];
    rep(i, n) { cin >> a[i] >> b[i] >> c[i]; }

    map<pair<int, int>, int> dp[n + 1];
    dp[0][make_pair(0, 0)] = 0;

    vector<int> ans;

    rep(i, n) {
        pair<int, int> p = make_pair(a[i], b[i]);

        for (auto iter = dp[i].begin(); iter != dp[i].end(); iter++) {
            pair<int, int> temp = iter->first;
            if (dp[i + 1][temp] == 0) {
                dp[i + 1][temp] = dp[i][temp];
            } else {
                dp[i + 1][temp] = min(dp[i][temp], dp[i + 1][temp]);
            }

            pair<int, int> new_pair =
                make_pair(temp.first + p.first, temp.second + p.second);

            if (dp[i + 1][new_pair] == 0) {
                dp[i + 1][new_pair] = dp[i][temp] + c[i];
            } else {
                dp[i + 1][new_pair] =
                    min(dp[i + 1][new_pair], dp[i][temp] + c[i]);
            }
        }
    }

    for (auto iter = dp[n].begin(); iter != dp[n].end(); iter++) {
        int a_weight = iter->first.first;
        int b_weight = iter->first.second;

        if (a_weight % ma == 0 && b_weight % mb == 0 &&
            a_weight / ma == b_weight / mb && a_weight != 0) {
            ans.push_back(iter->second);
        }
    }

    int result = pow(10, 9);
    rep(i, ans.size()) { result = min(result, ans[i]); }

    if (result == pow(10, 9)) {
        result = -1;
    }
    cout << result << endl;
    return 0;
}

template <typename T> void output(T a, int precision) {
    if (precision > 0) {
        cout << setprecision(precision) << a << "\n";
    } else {
        cout << a << "\n";
    }
}

template <typename T> T min(T a, T b) {

    if (a < b) {
        return a;
    } else {
        return b;
    }
}

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


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

using namespace std;

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

#define INF 1<<30
#define F first
#define S second

int main(){
  int n,k;
  int ans=0,wrong=0;
  string s;
  vector<char>cmp;
  
  cin>>n>>k;
  cin>>s;
  
  for(int i=0;i<n-1;i++){
    if(s[i]!=s[i+1]) wrong++;
    else ans++;
  }
  
  while(k>0&&wrong>0){
    if(wrong==1){
      wrong--;
      ans++;
    }else{
      wrong-=2;
      ans+=2;
    }
    k--;
  }
 
  printf("%d\n",ans);
  
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define looplt(i,x) for(i=0; i<x; ++i)
#define bsrch(v,x) binary_search(v.begin(), v.end(), x)
#define vecl vector <long long int>
#define pb(x) push_back(x)
#define MAX_INT 10e+10
typedef long long int ll;

int main()
{
    ll n, x, count=0;
    cin >> n;
    vecl inp;

    for(ll i=0; i<n ; ++i){
        cin >> x;
        inp.pb(x);
    }

    for(ll i=0; i<n-2; ++i){
        for(ll k=i+1; k<n-1; ++k){
            for(ll j=k+1; j<n; ++j){
                ll a1 = inp[i], a2 = inp[k], a3 = inp[j];

                if(a1 != a2 && a1 != a3 && a2 != a3){
                    if(a1 < a3 + a2 && a2 < a1 + a3 && a3 < a2 + a1) count++;
                }
            }
        }
    }

    cout << count << endl;
}

Measured memory_bytes: 3628
#include<stdio.h>
#define MAX 45

int F[MAX];

int Fibonacci(int);

int main(){
  int n;

  scanf("%d",&n);
  F[n]=Fibonacci(n);
  printf("%d\n",F[n]);

  return 0;
}
 
int Fibonacci(int n){
  int i;
  F[0]=1;
  F[1]=1;
  
  for(i=2;i<=n;i++){
    F[i] = F[i-2]+F[i-1];
  }
  return F[n];
}

Measured memory_bytes: 596
#include<stdio.h>
#include<math.h>
 
int main() {
    double x1, y1, x2, y2;//入力
    double i; 
    double a;
  
    scanf("%lf %lf %lf %lf ", &x1, &y1, &x2, &y2);
     
    i = ((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1));
    a = sqrt(i);
     
    printf("%f\n", a);
     
    return 0;
}


Measured memory_bytes: 2108
#include<bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(ll i = 0; i < n; i++)
const ll INF = 1LL << 60;

int main(){
    bool ans = false;
    string s; cin >> s;
    vector<string> check;
    for(int tmp = 0; tmp < (1 << 4); tmp++){
        bitset<4> s(tmp);
        string str = "";
        if(s.test(0))str.push_back('A');
        str.push_back('K');
        str.push_back('I');
        str.push_back('H');
        if(s.test(1))str.push_back('A');
        str.push_back('B');
        if(s.test(2))str.push_back('A');
        str.push_back('R');
        if(s.test(3))str.push_back('A');
        check.push_back(str);
    }

    rep(i, check.size()){
        if(s == check[i])ans = true;
    }

    if(ans == false)cout << "NO" << endl;
    else cout << "YES" << endl;
}

Measured memory_bytes: 3636
#include<cstdio>
#include<cstdlib>
#include<string>
#include<cmath>
#include<cstdlib>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
#include<functional>
#include<ios>
#include<iomanip>

using namespace std;
typedef long long ll;
typedef pair<int,int>P;

vector<vector<int>>tree;
vector<ll>cnt;
stack<int>ST;
vector<bool> flg;

int main()
{
	int N,Q;
	cin>>N>>Q;
	cnt=vector<ll>(N,0);
	flg=vector<bool>(N,false);
	for(int i=0;i<N;i++)
	{
		vector<int>a;
		tree.push_back(a);
	}

	for(int i=0;i<N-1;i++)
	{
		int a,b;
		cin>>a>>b;
		tree[--a].push_back(--b);
		tree[b].push_back(a);
	}
	for(int i=0;i<Q;i++)
	{
		int p;
		ll x;
		cin>>p>>x;
		cnt[--p]+=x;
	}
	ST.push(0);
	while(!ST.empty())
	{
		int n=ST.top();ST.pop();
		flg[n]=true;
		ll nc=cnt[n];
		for(int i=0;i<tree[n].size();i++)
		{
			int nn=tree[n][i];
			if(flg[nn])continue;
			cnt[nn]+=nc;
			ST.push(nn);
		}
	}
	for(int i=0;i<cnt.size();i++)
	{
		cout<<cnt[i]<<(i==cnt.size()-1?'\n':' ');
	}
}

Measured memory_bytes: 16364
#include<bits/stdc++.h>
using namespace std;
int a,n,i;
string b[105];
int main()
{
    cin>>a>>n;
    for(i=0;i<a;i++)
    {
        cin>>b[i];
    }
    sort(b,b+a);
    for(i=0;i<a;i++)
    cout<<b[i];
    cout<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
double n[10000];
double cnt[10000];
int main(){
	int x;
	cin>>x;
	for(int i=0;i<x;i++)cin>>n[i];
	double res=0; 
	for(int i=0;i<x;i++){
		res+=n[i];
	}
	res/=x;
	double ans=1e10;
	for(int i=0;i<x;i++){
		cnt[i]=max(n[i],res)-min(n[i],res);
		ans=min(ans,cnt[i]);
	}
	for(int i=0;i<x;i++){
		if(cnt[i]==ans){
			cout<<i<<endl;
			return 0;
		}
	}
	return 0;
}

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

int main() {
	int a, b,c;
	cin >> a >> b;
	c = b;
	for (int i = 0; i < a - 1; i++) {
		c *= (b - 1);
	}
	cout << c << endl;
	return 0;
}

Measured memory_bytes: 256
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<string>
using namespace std;
string st;
int main()
{
	cin>>st;
	int len=st.length(),k=0,ans=0;
	for (int i=0;i<len;i++)
	  {
	  if (st[i]=='C') k=1;
      if (st[i]=='F'&&k==1) k=2;
      if (k==2) ans=1;
      }
    if (ans==1) printf("Yes"); else printf("No");
}

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

using namespace std;

int main() {
  vector<int> L(3);
  for (int i = 0; i < 3; i++) cin >> L[i];
  sort(L.begin(), L.end());
  cout << L[0] * L[1] / 2 << endl;;
  return 0;
}


Measured memory_bytes: 256