akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
	String a = sc.next();
    int count=0;
    for (int i = 0 ; i<3 ; i++) {
      if (a.substring(i,i+1).equals("o")) {
        count++;
      }
    }
    System.out.println(700+count*100);
  }
}


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

int main() {
 int N;
 cin >> N;
 vector<double> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  for (int i; i < N; i++) {
    A.at(i) = 1.0 / A.at(i);
  }

   double sum = 0;
  for (int i = 0; i < N; i++) {
    sum += A.at(i);
  }
  
  cout << 1.0 / sum <<endl;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
f = 1

for i in range(n):
    if a[i]%2 == 1:
        pass
    elif a[i]%3!=0 and a[i]%5!=0:
        f = 0
        break

if f:
    print("APPROVED")
else:
    print("DENIED")

Measured memory_bytes: 3060
N,K=list(map(int,input().strip().split(" ")))
A=list(map(int,input().strip().split(" ")))
dp=[0]*(K+1)
dp[0]=0
for i in range(1,len(dp)):
    
    for j in range(len(A)):
        if i<A[j]:
            break
        
        if dp[i-A[j]]==0:
            dp[i]=1
if dp[-1]==1:
    print("First")
else:
    print("Second")



Measured memory_bytes: 44268
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int A = scan.nextInt();
        int B = scan.nextInt();
        int C = scan.nextInt();
        int D = scan.nextInt();
        int answer = Math.min(A, B) + Math.min(C, D);
        System.out.println(answer);
    }
}

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

typedef pair<int,int> pii;
const int N = 200005;

int n, a[N], b[N];
long long ans;
priority_queue<pii> pq;

int main()
{
	scanf("%d",&n);
	for(int i=0;i<n;i++) {
		scanf("%d",&a[i]);
	}
	for(int i=0;i<n;i++) {
		scanf("%d",&b[i]);
		pq.push({b[i], i});
	}
	while(!pq.empty()) {
		int A, B;
		tie(A, B) = pq.top();
		pq.pop();
		if(b[B] == a[B]) continue;
		if(b[B] < a[B]) {
			puts("-1");
			return 0;
		}
		int x = b[(B+1)%n] + b[(B+n-1)%n];
		int k = (b[B] - a[B]) / x;
		if(k == 0) {
			puts("-1");
			return 0;
		}
		ans += k;
		b[B] -= x * k;
		pq.push({b[B], B});
	}
	printf("%lld\n", ans);
}


Measured memory_bytes: 3700
def main():
    S = input()
    a = S.count('a')
    b = S.count('b')
    c = S.count('c')
    if max(a,b,c) <= min(a,b,c) + 1:
        print('YES')
    else:
        print('NO')

if __name__ == "__main__":
    main()

Measured memory_bytes: 39024
#include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;

const int MAX_R=15;
const int MAX_C=10005;
bool pan[MAX_R][MAX_C]={0};

int r,c;

void reverse(int row){
    for(int i=0; i<c; i++){
        if(pan[row][i]==0) pan[row][i]=1;
        else pan[row][i]=0;
    }
}

int dfs(int row){
    if(row==r){
        int cnt=0;
        int a,ano;
        for(int j=0; j<c; j++){
            a=0;
            for(int i=0; i<r; i++){
                if(pan[i][j]==1) a++;
            }
            ano=r-a;
            //a>r-a?(cnt+=a):(cnt+=(r-a));
            ano>a?(cnt+=ano):(cnt+=a);
        }
        return cnt;
    }
    int a=dfs(row+1);
    reverse(row);
    int b=dfs(row+1);
    return a>b?a:b;
}

int main(){
    while((scanf("%d%d", &r, &c)!=EOF)){
        if(r==0&&c==0) break;
        for(int i=0; i<r; i++){
            for(int j=0; j<c; j++){
                cin>>pan[i][j];
            }
        }
        cout<<dfs(0)<<endl;
    }
}


Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
static const int INF (1<<30);

int main() {
  int N;
  cin >> N;
  vector<int> h(N);
  rep(i, N) cin >> h[i];

  int height = 0, ans = 0;
  while (true) {
    height++;
    bool flag_low = false;
    rep(i, N) {
      if (!flag_low && height > h[i]) {
        continue;
      }
      else if (height > h[i]) {
        flag_low = false;
        ans++;
      }
      else if (flag_low) {
        continue;
      }
      else {
        flag_low = true;
      }
    }

    if (flag_low) ans++;

    if (height > 105) break;
  }

  cout << ans << endl;


  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
using namespace std;
int main(){
	int a,b,c,i,j,n;
	scanf("%d%d%d",&a,&b,&c);
	int times=0,t1,t2,t3,flag=1;
	
	while(a%2==0&&b%2==0&&c%2==0){
		t1=(b+c)/2;
		t2=(a+c)/2;
		t3=(a+b)/2;
		a=t1;b=t2;c=t3;
		if(a==b&&b==c){
			printf("-1\n");
			flag=0;
			break;
		}
		times++;
	}
	if(flag==1){
		printf("%d\n",times);
	}		
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt(), B = sc.nextInt(), K = sc.nextInt();
		sc.close();
		for (int i = A; i <= B; i++) {
			if (i < A + K || B - K < i) {
				System.out.println(i);
			}
		}
	}
}


Measured memory_bytes: 21716
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
static const int INF = 0x3f3f3f3f; static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
template<typename T, typename U> static void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> static void amax(T &x, U y) { if(x < y) x = y; }


vector<int> t_parent;
vi t_ord;

void tree_getorder(const vector<vi> &g, int root) {
	int n = g.size();
	t_parent.assign(n, -1);
	t_ord.clear();

	vector<int> stk; stk.push_back(root);
	while(!stk.empty()) {
		int i = stk.back(); stk.pop_back();
		t_ord.push_back(i);
		for(int j = (int)g[i].size() - 1; j >= 0; j --) {
			int c = g[i][j];
			if(t_parent[c] == -1 && c != root)
				stk.push_back(c);
			else
				t_parent[i] = c;
		}
	}
}

struct Eccentricity {
	int dist, i;
	Eccentricity() : dist(-INF), i(-1) {}
	Eccentricity(int dist, int i) : dist(dist), i(i) {}
	bool operator<(const Eccentricity &that) {
		return dist != that.dist ? dist < that.dist : i < that.i;
	}
	Eccentricity operator+(int c) const {
		return Eccentricity(dist + c, i);
	}
};

void treeEccentricities(const vector<vi> &g, vector<Eccentricity> &res) {
	int n = g.size();

	vector<pair<Eccentricity, Eccentricity> > dp(n);
	for(int ix = n - 1; ix >= 0; -- ix) {
		int i = t_ord[ix], p = t_parent[i];
		dp[i].first = dp[i].second = Eccentricity(0, i);
		for(int j : g[i]) if(j != p) {
			Eccentricity v = dp[j].first + 1;
			if(dp[i].first < v) {
				dp[i].second = dp[i].first;
				dp[i].first = v;
			} else if(dp[i].second < v) {
				dp[i].second = v;
			}
		}
	}
	res.assign(n, Eccentricity());
	res[0] = Eccentricity(0, 0);
	reu(ix, 1, n) {
		int i = t_ord[ix], p = t_parent[i];
		int pw = 1;
		res[i] = res[p] + pw;
		if(dp[p].first.i == dp[i].first.i)
			amax(res[i], dp[p].second + pw);
		else
			amax(res[i], dp[p].first + pw);
	}
	rep(i, n)
		amax(res[i], dp[i].first);
}

int main() {
	int N;
	while(~scanf("%d", &N)) {
		vector<vector<int> > g(N);
		for(int i = 0; i < N - 1; ++ i) {
			int u, v;
			scanf("%d%d", &u, &v), -- u, -- v;
			g[u].push_back(v);
			g[v].push_back(u);
		}
		tree_getorder(g, 0);
		vector<Eccentricity> ecc;
		treeEccentricities(g, ecc);
		rep(i, N) {
			int ans = (N - 1) * 2 - ecc[i].dist;
			printf("%d\n", ans);
		}
	}
	return 0;
}

Measured memory_bytes: 11840
#include<iostream>
#include<stdio.h>
#include<algorithm>
using namespace std;

int main() {
    int n;
    cin >> n;
    int a[n];
    for(int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    for(int i = n-1; i >= 0; --i) {
        cout << a[i];
        if(i != 0) {
            cout << " ";
        }
    }
    cout << endl;
    return 0;

}


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

#define ll long long 

using namespace std;

ll n,r,r1;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    cin>>n;
    if (n%2==1) return cout<<0,0;
    else{
        ll k=5;
        while (k<=n){
            r+=(n/k)/2;
            k*=5;
        }
        cout<<r;
    }
}

Measured memory_bytes: 256
function Main(input){

  input = input.split('\n');
  for(var i=0;i<input.length;i++){
    input[i] = parseInt(input[i],10);
}
  var max;
  var sum;
  max = 0;
  sum = 0;
  
  for(var i=1;i<input.length -1;i++){
    if(input[i]>max){
      max = input[i];
    }
    sum = sum + input[i];
                      }
                      
                      
                      sum = sum - max/2;
                      console.log(sum);
                      }
                      
                      

  
 
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  if (a+b > c+d) cout << "Left" << endl;
  else if (a+b < c+d) cout << "Right" << endl;
  else cout << "Balanced" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pl;
#define all(a) (a).begin(),(a).end()
#define overload4(_1, _2, _3, _4, name, ...) name
#define rep1(n) for(ll i = 0;i < (n);i++)
#define rep2(i,n) for(ll i = 0;i < (n);i++)
#define rep3(i,a,b) for(ll i = (a);i < (b);i++)
#define rep4(i,a,b,c) for(ll i = (a);i < (b);i += (c))
#define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep1(n) for(ll i = (n)-1;i >= 0;i--)
#define rrep2(i,n) for(ll i = (n)-1;i >= 0;i--)
#define rrep3(i,a,b) for(ll i = (a)-1;i >= (b);i--)
#define rrep4(i,a,b,c) for(ll i = (a)-1;i >= (b);i -= (c))
#define rrep(...) overload4(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
#define SHOW(x) cout << #x << ": " << x << endl;
template<class T> ll sumArr(const T& a){ return accumulate(all(a), 0LL);}
template<class T> auto minArr(const T& a){ return *min_element(all(a));}
template<class T> auto maxArr(const T& a){ return *max_element(all(a));}
template<class T> void DEBUG_PRINT(T tmp){cout<<tmp<<endl;}
template<class T1,class... T2> void DEBUG_PRINT(T1 tmp,T2... tmp2){cout<<tmp<<" ";DEBUG_PRINT(tmp2...);}
ll gcd(ll a, ll b){ while(b){ ll c = b; b = a % b; a = c; } return a; }
ll lcm(ll a, ll b){ if(!a || !b) return 0; return a / gcd(a, b) * b; }
const ll INF=1e18,MOD = 1e9+7;
const int iINF = 1e9;


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

    ll k,now = 1;
    cin>>k;
    queue<ll>que;
    rep(i,1,10)que.push(i);
    while(!que.empty()){
        ll tp = que.front(),md;
        que.pop();
        md = tp%10;
        if(k == now){
            cout<<tp<<endl;
            break;
        }
        else{
            if(md > 0)que.push(tp * 10 + md - 1);
            que.push(tp * 10 + md);
            if(md < 9)que.push(tp * 10 + md + 1);
        }
        now++;
    }
    return 0;
}

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

int D[32][32];

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

    rep(i, C) rep(j, C) cin >> D[i+1][j+1];

    int ci, cnt_gr0[C+1], cnt_gr1[C+1], cnt_gr2[C+1];
    rep(i, C+1) cnt_gr0[i] = 0, cnt_gr1[i] = 0, cnt_gr2[i] = 0;

    rep(y, N) rep(x, N) {
        cin >> ci;
        if ((x+1 + y+1)%3 == 0) cnt_gr0[ci]++;
        if ((x+1 + y+1)%3 == 1) cnt_gr1[ci]++;
        if ((x+1 + y+1)%3 == 2) cnt_gr2[ci]++;
    }

    int cost_gr0[C+1], cost_gr1[C+1], cost_gr2[C+1];
    rep(i, C+1) cost_gr0[i] = 0, cost_gr1[i] = 0, cost_gr2[i] = 0;

    rep(x, C) rep(y, C) {
        cost_gr0[y+1] += cnt_gr0[x+1] * D[x+1][y+1];
        cost_gr1[y+1] += cnt_gr1[x+1] * D[x+1][y+1];
        cost_gr2[y+1] += cnt_gr2[x+1] * D[x+1][y+1];
    }

    int ans = 500 * 500 * 1000;
    rep(x, C) rep(y, C) rep(z, C) {
        if ((x==y) || (y==z) || (z==x)) continue;
        ans = min(ans, cost_gr0[x+1] + cost_gr1[y+1] + cost_gr2[z+1]);
    }

    cout << ans << endl;

    return 0;
}

 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0; i<n; i++)
#define eb(t) emplace_back(t)
typedef long long ll;
typedef long long unsigned int llu;
ll INF = 1000000009;
ll MOD = 1000000007;


void solve(){

    ll n;
    cin >> n;
    set<string> st;
    rep(i,n){
        string s;
        cin >> s;
        st.insert(s);
    }
    cout << st.size() << endl;

}

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


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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<=(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define rev(v) reverse(all(v))
#define minvec(v) *min_element(all(v))
#define maxvec(v) *max_element(all(v))
#define sumvec(v) accumulate(all(v),0LL)
#define mapmin(v) v.rbegin()->first
#define mapmax(v) v.begin()->first
#define pb push_back
#define pf push_front
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK cerr<<"OK\n"
#define OK1 cerr<<"OK1\n"
#define OK2 cerr<<"OK2\n"
#define SIZE(s) (int)s.size()
#define INF ((1LL<<62)-(1LL<<31))
#define zero(x,n) setw(x) << setfill('0') << n
#define endl '\n'

typedef long long ll;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<string> vs;

typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;

const double pi = acos(-1.0);
const ll mod=1000000007;
const ll mod2=998244353;

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << " ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

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

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

void YES(bool b) {cout << ((b)?"YES\n":"NO\n");}
void Yes(bool b) {cout << ((b)?"Yes\n":"No\n");}
void yes(bool b) {cout << ((b)?"yes\n":"no\n");}
void Yay(bool b) {cout << ((b)?"Yay!\n":":(\n");}

ll powmod(ll a,ll b){ll c=1; while(b>0){ if(b&1){ c=a*c%mod; } a=a*a%mod; b>>=1; } return c;}
ll gcd(ll x, ll y) {return __gcd(x,y);}
ll lcm(ll x, ll y) {return x/__gcd(x,y)*y;}

vector<long long> divisor(long long n){
    vector<long long> ret;
    for(int64_t i=1;i*i<=n;i++){
        if(n%i==0){
            ret.push_back(i);
            if(i*i!=n) ret.push_back(n/i);
        }
    }
    sort(ret.begin(),ret.end());
    return ret;
}

int main()
{
	ll n,ans=0;
	cin >> n;
	vll v=divisor(n);
	for(auto&& e:v){
		if(e==1) continue;
		if(n/(e-1)==n%(e-1)) ans+=e-1;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 384
using System;
using System.Linq;
using System.Collections.Generic;

static class NagataKanaIsAGenius {
    public static void Main() {
        long n=long.Parse(Console.ReadLine());
        Tuple<long,long,long>[]data=new Tuple<long,long,long>[n];
        for(long i=0;i<n;i++){
            long[]ab=Console.ReadLine().Split().Select(long.Parse).ToArray();
            data[i]=new Tuple<long,long,long>(-ab[0]-ab[1],ab[0],ab[1]);
        }
        Array.Sort(data);
        long ans=0;
        for(long i=0;i<n;i++){
            if(i%2==0)ans+=data[i].Item2;
            if(i%2==1)ans-=data[i].Item3;
        }
        Console.WriteLine(ans);
    }
    static long Query(long x){
        Console.WriteLine(x);
        char c = Console.ReadLine()[0];
        if(c=='V')Environment.Exit(0);
        if(c=='M')return 0;
        if(c=='F')return 1;
        throw new NotImplementedException();
    }
}


Measured memory_bytes: 24060
#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define llint long long
#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))

using namespace std;
typedef pair<llint, llint> P;

int n, m, s, t;
int a[55], b[55];
bool used[55];
int beki2[20], beki3[20];
llint dp[55][55];
short cnt[400000000];
bitset<400000000> bs;

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n >> m >> s >> t;
	for(int i = 1; i <= n; i++){
		cin >> a[i];
		if((a[i] & s) != s || (a[i] & (~t))) used[i] = true;
	}
	
	if(s & (~t)){
		cout << 0 << endl;
		return 0;
	}
	
	dp[0][0] = 1;
	for(int i = 0; i < 50; i++){
		for(int j = 0; j <= m; j++){
			if(j+1 <= m) dp[i+1][j+1] += dp[i][j];
			dp[i+1][j] += dp[i][j];
		}
	}
	for(int i = 0; i <= 50; i++){
		for(int j = 1; j <= m; j++){
			dp[i][j] += dp[i][j-1];
		}
	}
	
	int p = 0;
	for(int i = 0; i < 18; i++){
		if(s & (1<<i)) continue;
		if(!(t & (1<<i))) continue;
		for(int j = 1; j <= n; j++){
			llint x = (a[j] >> i) & 1;
			b[j] |= x<<p;
		}
		p++;
	}
	for(int i = 1; i <= n; i++) a[i] = b[i];
	
	beki2[0] = beki3[0] = 1;
	for(int i = 1; i < 20; i++) beki2[i] = beki2[i-1] * 2;
	for(int i = 1; i < 20; i++) beki3[i] = beki3[i-1] * 3;
	
	if(t == 0){
		int cnt = 0;
		for(int i = 1; i <= n; i++){
			if(a[i] == 0) cnt++;
		}
		cout << dp[cnt][m] << endl;
		return 0;
	}
	
	for(int i = 1; i <= n; i++){
		if(used[i]) continue;
		int B = 1<<p;
		for(int j = 0; j < B; j++){
			llint sum = 0;
			for(int k = 0; k < p; k++){
				if(j & (1<<k)){
					if(a[i] & (1<<k)) sum += 1 * beki3[k];
					else sum += 2 * beki3[k];
				}
			}
			cnt[sum]++;
		}
	}
	
	bs[0] = false; int r = 1;
	for(int i = 1; i < beki3[p]; i++){
		if(r == 0) bs[i] = bs[i/3];
		else if(r == 1) bs[i] = !bs[i-1];
		else if(r == 2) bs[i] = bs[i-1];
		r++;
		if(r >= 3) r = 0;
	}
	//for(int i = 0; i < 15; i++) cout << cnt[i] << " "; cout<< endl;
	
	llint ans = 0;
	for(int i = 0; i < beki3[p]; i++){
		llint tmp = dp[cnt[i]][m]-1;
		if(bs[i]) ans -= tmp;
		//cout << i << " " << tmp << endl;
		else ans += tmp;
	}
	cout << ans << endl;
	
	//for(int i = 1; i <= n; i++) cout << a[i] << " "; cout << endl;
	
	return 0;
}

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

int main() {
    string s,t; cin >> s >> t;
    int ans = 0;
    rep(i,s.size()){
        ans += (s[i] != t[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3860
#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
  int n,m,a[1000001],p=0;
  cin>>n>>m;
  r(i,n)cin>>a[i];
  set<int>s;
  r(i,m){
    if(p==n||i>=n)break;
    if(!s.count(a[n-i-1])){
      cout<<a[n-1-i]<<endl;
      s.insert(a[n-i-1]);
    }
  }
}

Measured memory_bytes: 5972
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(auto i=0;i<n;++i)
#define REPR(i,n) for(auto i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(auto i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define ll long long
#define INF 999999999
#define MOD 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(n,v) {int tmp;for(int i=0;i<n;++i){scanf("%d",&tmp);v.push_back(tmp);}}

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

using namespace std;

typedef pair<int,int> pii;

int main(){

  llong a, b, c, d;
  scanf("%lld %lld %lld %lld", &a, &b, &c, &d);

  //llong dif = max({a,b,c}) - min({a,b,c});
  if(llabs(a-b) > 1e18){
    printf("Unfair\n");
  }else{
    llong ans = a - b;
    if(d % 2 != 0){
      ans *= -1;
    } 
    printf("%lld\n", ans);
  }
  return 0;
}



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

const ll LINF = 1e18;
const int INF = 1e9;
const ll MOD = 1000000007;

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

int main(){

    int n;
    cin >> n;
    vector<int> v(100010);
    for(int i = 0; i < n; i++){
        int a;
        cin >> a;
        if(a-1 >= 0) v[a-1]++;
        v[a]++;
        v[a+1]++;
    }
    sort(v.rbegin(), v.rend());
    cout << v[0] << endl;

    return 0;
}


Measured memory_bytes: 3740
<?php

function gcd($a, $b) {
    if ($b === 0) {
        return $a;
    }

    return gcd($b, $a % $b);
}

fscanf(STDIN, "%d", $n);
$A = array_map('intval', explode(' ', trim(fgets(STDIN))));

$L = [];
$L[0] = $A[0];
for ($i = 1; $i < $n; ++$i) {
    $L[$i] = gcd($L[$i - 1], $A[$i]);
}

$R = [];
$R[$n - 1] = $A[$n - 1];
for ($i = $n - 2; $i >= 0; --$i) {
    $R[$i] = gcd($R[$i + 1], $A[$i]);
}

$max = 0;
for ($i = 0; $i < $n; ++$i) {
    switch ($i) {
    case 0:
        $max = max($max, $R[1]);
        break;
    case $n - 1:
        $max = max($max, $L[$n - 2]);
        break;
    default:
        $max = max($max, gcd($L[$i - 1], $R[$i + 1]));
    }
}
echo $max;


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

typedef long long int lli;
using namespace std;

int modPow(lli m,lli n,lli p){
    if(n==1)return m%p;
    if(n%2==1)return (m*modPow(m,n-1,p))%p;
    lli t=modPow(m,n/2,p);
    return (t*t)%p;
}

int main(int argc,char *argv[]){
    lli m,n,p=1e9+7;

    cin>>m>>n;
    cout<<modPow(m,n,p)<<endl;
    return 0;
}


Measured memory_bytes: 3104
local N = io.read("n")
local b = {}
for i=1,N do
    b[i] = io.read("n")
end
local ans = {}

for i=N,1,-1 do
    for jj=i,1,-1 do
        if b[jj] == jj then
            table.remove(b, jj)
            ans[i] = jj
            break
        end
    end
    if ans[i] == nil then
        print(-1)
        return
    end
end

for i=1,N do
    print(ans[i])
end


Measured memory_bytes: 888
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef long double ld;
#define MOD 1000000007
#define INF (1<<30)

int main(void){
	int i,j,q,cnt[100500],l,r;
	bool prm[100500];
	fill(prm,prm+100500,true);
	fill(cnt,cnt+100500,0);
	prm[0] = false;
	prm[1] = false;
	for(i=2; i<500; i++){
		if(prm[i]){
			j = i*2;
			while(j<=100000){
				prm[j] = false;
				j += i;
			}
		}
	}
	for(i=1; i<=100000; i+=2){
		if(prm[i] && prm[(i+1)/2]){
			cnt[i]++;
		}
	}
	for(i=3; i<=100000; i+=2){
		cnt[i]+=cnt[i-2];
	}
	cin >> q;
	for(i=0; i<q; i++){
		cin >> l >> r;
		cout << ((l==1)?cnt[r]:(cnt[r] - cnt[l-2])) << endl;
	}
	return 0;
}


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

int main() {

  int N;
  int K;
  cin >> N >>K;
  
  vector<int> vec(N);
  for(int i=0; i<N; i++){
    cin >> vec.at(i);
  }
  
  sort(vec.begin(), vec.end());
  
  int sum=0;
  for(int j=0; j<N; j++){
    if(j<K){  
    sum += vec.at(j);
    }
    else{
      break;
    }
  }
  
    
  
  cout<< sum <<endl;
    
}
 


Measured memory_bytes: 3592
#![allow(unused_imports)]

use std::{i32, i64, u32, u64, usize, f64};
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::io::{stdout, Write, BufWriter};
use std::mem::{swap};
use maplit::*;
use proconio::{input, marker::{Isize1, Usize1, Bytes, Chars}};

//#[proconio::fastout]
fn main() {
    input!(
        n: usize,
        arr: [i32; n],
    );
    println!("{}", (-100..=100).map(|x| arr.iter().copied().map(|a| (x - a).pow(2)).sum::<i32>()).min().unwrap());
}


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

#input
N = int(input())
x = []
y = []
for i in range(N):
    p, q = map(int, input().split())
    x.append(p)
    y.append(q)

#output
import math

sum = 0
for i in range(N):
    for j in range(N):
        sum += math.sqrt((x[i]-x[j])**2 + (y[i]-y[j])**2)
M = math.factorial(N)

print(sum/N)

Measured memory_bytes: 38256
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <functional>

#define sz(v) v.size()
#define pb(e) push_back(e)
#define mp(x, y) make_pair(x, y)
#define fst first
#define scd second
#define X first
#define Y second

using namespace std;

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

const int MAX = 1000;
const int INF = MAX * MAX + MAX;

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

int hyo[MAX][MAX];
pii pt[10];

bool bfs(int h, int w, int s, int e, int low)
{
	queue<pii> Q;
	pii end = pt[e];
	
	Q.push(pt[s]);
	
	while (!Q.empty())
	{
		pii t = Q.front(); Q.pop();
		for (int d = 0; d < 4; ++d)
		{
			int mx = t.X + dx[d];
			int my = t.Y + dy[d];
			if (0 > mx || mx >= w || 0 > my || my >= h || hyo[my][mx] == -1) continue;
			if (hyo[my][mx] <= low || hyo[my][mx] > hyo[t.Y][t.X] + 1)
			{
				hyo[my][mx] = hyo[t.Y][t.X] + 1;
				Q.push(mp(mx, my));
				if (end.X == mx && end.Y == my) return true;
			}
		}
	}
	return false;
}

int main ( void )
{
	int h, w, n;
	
	while (cin >> h >> w >> n)
	{
		for (int y = 0; y < h; ++y)
		{
			for (int x = 0; x < w; ++x)
			{
				char c;
				
				cin >> c;
				
				switch (c)
				{
					case '.':
						hyo[y][x] = INF;
						break;
					case 'X':
						hyo[y][x] = -1;
						break;
					case 'S':
						hyo[y][x] = 0;
						pt[0] = mp(x, y);
						break;
					default: // 1 ~ 9
						hyo[y][x] = INF;
						pt[c-'0'] = mp(x, y);
						break;
				}
			}
		}
		
		for (int i = 0; i < n; ++i)
		{
			pii t = pt[i];
			bfs(h, w, i, i+1, hyo[t.Y][t.X]);
		}
		
		pii t = pt[n];
		cout << hyo[t.Y][t.X] << endl;
	}
	return 0;
}

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

//C++14 (GCC 5.4.1)

#define LLINF (1LL<<60)
typedef long long ll;
#define mod 1000000007

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define rrepd(i,a,b) for(int i=(a);i>=(b);i--)

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

template<typename T> inline T divrup(T a, T b) { if (a % b) return a/b+1; else return a/b;}

#define dbg_v1(i,V) do{cout<<"-v1----\n";rep(i,V.size())cout<<" "<<i<<"\t:"<<V[i]<<endl;cout<<endl;}while(0)
#define dbg_v2(i,k,V) do{cout<<"-v2----\n";rep(i,V.size()){rep(k,V[0].size())cout<<" "<<V[i][k];cout<<endl;}}while(0)

int main() {
    int X,Y,Z,K;
    cin >>X>>Y>>Z>>K;

    vector<ll> A(X);
    vector<ll> B(Y);
    vector<ll> C(Z);
    vector<ll> sum,sumb;
    rep(i,X) cin >> A[i];
    rep(i,Y) cin >> B[i];
    rep(i,Z) cin >> C[i];
    
    rep(x,X){
        rep(y,Y){
            sum.push_back(A[x]+B[y]);
        }
    }
    sort(sum.begin(),sum.end(),greater<>());
    rep(t,min(K,X*Y)){
        rep(z,Z){
            sumb.push_back(sum[t]+C[z]);
        }
    }


    sort(sumb.begin(),sumb.end(),greater<>());
    //-----------------------------------
    rep(i,K) cout << sumb[i] <<endl;
    return (0);
}

Measured memory_bytes: 43112
s=int(input())

ans_list=[0 for _ in range(6)]
num=s
count=0

while(num>1000000000):
  num//=2
  count+=1
ans_list[0]=num
ans_list[3]=2**count

while(s>=ans_list[0]*ans_list[3] and ans_list[3]<1000000000):
  ans_list[3]+=1

if ans_list[3]>1000000000:
  ans_list[3]=1000000000
  ans_list[0]=s//1000000000+1
if ans_list[0]>1000000000:
  ans_list[0]=1000000000

ans_list[1]=1

sum_=ans_list[0]*ans_list[3]
ans_list[2]=sum_-s

print('{} {} {} {} {} {}'.format(ans_list[0],ans_list[1],ans_list[2],ans_list[3],ans_list[4],ans_list[5]))

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

int main()
{
  ios_base::sync_with_stdio(0);
	cin.tie(0);
	string s;
	cin >> s;
	int a = (s[0] - '0') * 10 + (s[1] - '0');
	int b = (s[2] - '0') * 10 + (s[3] - '0');
	bool aa = 0 < a && a <= 12;
	bool bb = 0 < b && b <= 12;
	if (aa && bb) cout << "AMBIGUOUS\n";
	else if (aa) cout << "MMYY\n";
	else if (bb) cout << "YYMM\n";
	else cout << "NA\n";
	return 0;
  
}

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

// chmin, chmax関数
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}
template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}

// Yes-Noを出力する問題で楽をする
void Ans(bool f){
    if(f) cout << "Yes" << endl;
    else cout << "No" << endl;
}

//---------------------------

int main(){
    ll n; cin >> n;
    ll sum = 0;

    rep2(i,1,n+1){
        if((i%3)*(i%5)) sum += i;
    }

    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 3632
#include <cstdio>
#include <iostream>
#include <string>

int main() {
    int h, w;
    scanf("%d%d", &h, &w);
    for (int i = 0; i < w + 2; i++) {
        putchar('#');
    }
    puts("");
    for (int i = 0; i < h; i++) {
        putchar('#');
        std::string s;
        std::cin >> s;
        std::cout << s;
        putchar('#');
        puts("");
    }
    for (int i = 0; i < w + 2; i++) {
        putchar('#');
    }
    puts("");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
Int N, mod,root = 0;
vector<vector<Int>>edge;
vector<Int>ans,dis;
Int dfs(Int v, Int prev){
    if(edge[v].size() == 1 and v != root)
        return dis[v] = 1;
    dis[v] = 1;
    for(auto nv : edge[v]){
        if(nv == prev) continue;
        dis[v] *= (dfs(nv,v) + 1);
        dis[v] %= mod;
    }
    return dis[v];
}
auto build(const Int v){
    const Int deg = edge[v].size();
    vector<Int>r(deg),l(deg);
    for(Int i = 0; i < deg; ++i){
        r[i] = l[i] = (dis[edge[v][i]] + 1);
    }
    for(Int i = 0; i + 1 < deg; ++i)  l[i+1] *= l[i], l[i+1] %= mod;
    for(Int i = deg - 2; i >= 0 ; --i)  r[i] *= r[i + 1], r[i] %= mod;
    return make_pair(r,l);
}
void solve(Int v, Int dis_prev, Int prev){
    
    for(auto nv :edge[v]){
        ans[v] *= (nv == prev ?  dis_prev + 1 : dis[nv] + 1);
        ans[v] %= mod;
    }
    vector<Int>r,l;
    tie(r,l) = build(v);
    
    for(Int i = 0; i < edge[v].size(); ++i){
        Int nv = edge[v][i];
        if(nv == prev) continue;
        Int d_par = (i > 0 ? l[i-1] : 1) * ( i + 1 < edge[v].size() ? r[i+1] : 1);
        d_par %= mod;
        dis[v] = d_par;
        solve(nv,d_par,v);
    }
    return;
}
int main(){
    cin >> N >> mod;
    edge = vector<vector<Int>>(N);
    for(Int i = 0; i < N - 1; ++i){
        Int u,v; cin >> u >> v;
        --u;--v;
        edge[u].emplace_back(v);
        edge[v].emplace_back(u);
    }
    dis = vector<Int>(N,0LL);
    ans = vector<Int>(N,1LL);
    dfs(root,-1LL);
    solve(root,0LL,-1LL);
    for(auto e : ans){
        cout << e << endl;
    }
}




Measured memory_bytes: 21888
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <cfloat>

using std::cerr;
using std::cin;
using std::cout;
using std::endl;

using namespace std;
typedef long long int64;

int main(){
  cout << std::fixed << std::setprecision(16);
  cin.tie(nullptr);
  std::ios::sync_with_stdio(false);

  int n;
  cin>>n;
  vector<int> a(n);
  bool found_one=false;
  for(int i=0;i<n;i++){
    cin>>a[i];
    if(a[i]==1){
      found_one=true;
    }
  }
  if(!found_one){
    cout<<-1<<endl;
    return 0;
  }

  int count=0;
  int tgt=1;
  for(auto v:a){
    if(v==tgt){
      tgt++;
    }else{
      count++;
    }
  }

  cout<<count<<endl;



  return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
#include<iostream>
#include<string>
#include<algorithm>
#include <vector>

using namespace std;

int P[10011];

void init(int N){
	for(int i=0;i<N;i++)P[i]=i;
}
int root(int a){
	if(P[a]==a)return a;
	
	else return (P[a]=root(P[a]));
}

bool check(int a,int b){
	return root(a)==root(b);
}
void unite(int a,int b){
	P[root(a)]=root(b);
}

int main(){
	init(10001);
	int n,q;
	cin>>n>>q;
	for(int i=0;i<q;i++){
		int c,a,b;
		cin>>c>>a>>b;
		if(c==0)
			unite(a,b);
		else{ cout<<check(a,b) <<endl;

		}
	}
 return 0;
 }

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

struct Unionfind {
  // tree number
  vector<int> par;
  // tree rank
  vector<int> treerank;
  // constructor
  Unionfind(int n = 1) { stree(n + 1); }
  // make and initialization
  void stree(int n = 1) {
    par.resize(n);
    treerank.resize(n);
    for(int i = 0; i < n; ++i) {
      par[i] = i;
      treerank[i] = 0;
    }
  }
  // search root
  int root(int x) {
    if(par[x] == x) return x;
    return par[x] = root(par[x]);
  }
  // is same?
  bool issame(int x, int y) { return root(x) == root(y); }

  // add
  // already added, return 0
  bool uni(int x, int y) {
    x = root(x);
    y = root(y);
    if(x == y) return 0;
    if(treerank[x] < treerank[y])
      par[x] = y;
    else if(treerank[y] < treerank[x])
      par[y] = x;
    else {
      par[y] = x;
      ++treerank[x];
    }
    return 1;
  }
};
int n, l, k;
Unionfind uf[2];
map<pair<int, int>, int> mp;

void solve();

int main() {
  cin >> n >> k >> l;
  uf[0] = uf[1] = Unionfind(n + 1);
  for(int i = 0; i < k; ++i) {
    int x, y;
    cin >> x >> y;
    --x;
    --y;
    uf[0].uni(x, y);
  }
  for(int i = 0; i < l; ++i) {
    int x, y;
    cin >> x >> y;
    --x;
    --y;
    uf[1].uni(x, y);
  }
  for(int i = 0; i < n; ++i)
    ++mp[make_pair(uf[0].root(i), uf[1].root(i))];
  for(int i = 0; i < n; ++i) {
    cout << mp[make_pair(uf[0].root(i), uf[1].root(i))];
    if(i != n - 1) cout << " ";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 15104
#include <stdio.h>
 
int main(void)
{
  int n,m,judge=0,wa=0;
  double k;
  scanf("%d %d",&n,&m);
  int a[n];
  
  for(int i=0;i<n;i++){
    scanf("%d",&a[i]);
    wa+=a[i];
  }
  for(int i=0;i<n;i++){
    k=a[i]*4*m;
    if(k>=wa)
      judge++;
  }
  if(judge>=m)
    printf("Yes");
  else
    printf("No");
  return 0;
}

Measured memory_bytes: 1736
#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

int main(){
  char s[100 + 10];
  cin >> s;
  int len = strlen(s);
  for(int i = 0; i < len; i++){
    printf("x");
  }
  printf("\n");
  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 int long long
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;


signed main()
{
     ios_base::sync_with_stdio(false);
     cin.tie(NULL);  
//  #ifndef ONLINE_JUDGE
//     freopen ("INPUT.txt" , "r" , stdin);
//     freopen ("OUTPUT.txt" , "w" , stdout);
//  #endif
 
// -------------------------------------Code starts here---------------------------------------------------------------------     

   int n,k;
   cin>>n>>k;
   long double pp[n+1]={0};
   long double pre[n+1]={0};
   int x;
   for(int i=1;i<=n;i++)
   {
      cin>>x;
      pp[i]=(x);
      pp[i]=(pp[i]+1)/2;
      pre[i]=pre[i-1]+pp[i];
   }
   long double mx=0;
   for(int i=k;i<=n;i++)
   {
      mx=max(mx,pre[i]-pre[i-k]);
   }
   cout<<fixed<<setprecision(10)<<mx;

// -------------------------------------Code ends here------------------------------------------------------------------
     clock_t clk;
 	clk = clock();
 
    clk = clock() - clk;
 	cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << "\n";
 	return 0;
 }


Measured memory_bytes: 6528
//
//  main.cpp

#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;


int main(){
	while(1){
		char input[100001];
		int JOI=0,IOI=0;
		
		if(scanf("%s",input) == EOF){
			break;
		}
		
		for(int i=0;i<strlen(input)-2;i++){
			if(input[i] == 'J' && input[i+1] == 'O' && input[i+2] == 'I'){
				JOI ++;
			}
			if(input[i] == 'I' && input[i+1] == 'O' && input[i+2] == 'I'){
				IOI ++;
			}
		}
		
		cout << JOI << endl << IOI << endl;
	}
	return 0;
}

Measured memory_bytes: 3136
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=100003,INF=1<<30;

int main(){

    int X,A,B,N;cin>>X>>A>>B>>N;
    bool ok=true;
    for(int i=0;i<N;i++){
        string S;cin>>S;
        if(S[0]=='n') X+=A;
        else if(S[0]=='t') X+=B;
        else X=0;
        if(X<=0) X=0;
    }
    cout<<X<<endl;
}




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

int main(){
    int n;
    cin >> n;
    int tc, xc, yc, tn, xn, yn;
    tc = 0; xc =0; yc = 0;
    bool f = true;
    for(int i=0; i<n; i++){
        cin >> tn >> xn >> yn;
        int dis = abs(yn - yc) + abs(xn - xc);
        if(dis > (tn - tc) || (dis - (tn - tc))%2 != 0){
            f = false;
            for(int j=i+1; j<n; j++){
                cin >> tn >> xn >> yn;
            }
            break;
        }
    }
    if(f){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
  
    return 0;
}


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

using namespace std;

#define DUMP(x) std::cout << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++ i)
#define ALL(r) r.begin(), r.end()
#define DUP(x, y) (((x) + (y) - 1) / (y))

using ll = std::int64_t;
using vint = std::vector<int>;
using vll = std::vector<ll>;
using pint = std::pair<int, int>;

constexpr std::int32_t INF = 1001001001;

void Main() {
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    vint v;

    /*
    n = 100000;
    k = 100000;
    s = "";
    s.reserve(n);
    rep(i, 10002) {
        s += "LRLRLRLRLR";
    }
    */
    v.reserve(n);
    char cur_char = s[0];
    v.push_back(1);
    REP(i, 1, n) {
        if (s[i] == cur_char) {
            ++v.back();
        }
        else {
            v.push_back(1);
        }
        cur_char = s[i];
    }

    if (v.size() == 1) {
        cout << v[0] - 1 << endl;
        return;
    }

    auto itr = max_element(v.begin(), v.end());
    rep(i, k) {
        if (v.size() == 1) {
            break;
        }
        if (v.size() == 2) {
            v[0] += v[1];
            v.erase(v.end() - 1);
            break;
        }
        if (itr == v.begin())++itr;
        if (itr == v.end() - 1) --itr;

        *itr += ((*(itr - 1)) + (*(itr + 1)));
        itr = v.erase(itr - 1);
        itr = v.erase(itr + 1);
        if (itr == v.end()) --itr;
    }

    int ans = 0;
    rep(i, v.size()) {
        --v[i];
        ans += v[i];
    }
    cout << ans << endl;
}

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



Measured memory_bytes: 848
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  vector<string> s(3);
  REP(i, 3) {
    cin >> s[i];
    cout << s[i][i];
  }
  return 0;
}


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

int main() {
  int n;
  cin >> n;
  
  set<string> st;
  for (int i = 0; i < n; ++i) {
    string s;
    cin >> s;
    st.insert(s);
  }
  cout << st.size() << endl;
}

Measured memory_bytes: 19228
#include <bits/stdc++.h>
#define ll long long int
#define mk make_pair
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define mod 1000000007
using namespace std;

void fast(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
}

int main(){
    fast();
    ll t=1;
//    cin>>t;
    while(t--){
    	ll d,t,s;
    	cin>>d>>t>>s;
    	if((d+s-1)/s<=t)
    	cout<<"Yes";
    	else
    	cout<<"No";
	}
}

Measured memory_bytes: 3652
import sys
sys.setrecursionlimit(10**6)

n = int(input())
#b = list(map(int, input().split()))
#n, m = map(int, input().split())
#s = input()
#s,t = input().split()
#
#readline = sys.stdin.readline
#n,m = [int(i) for i in readline().split()]
#ab = [[int(i) for i in readline().split()] for _ in range(n)]

pf = {}

for i in range(2,int(n**0.5)+1):
    while n % i == 0:
        pf[i] = pf.get(i,0) + 1
        n //= i
if n > 1: pf[n] = 1

ans = 0

for v in pf.values():
    
    l = 1; r = v # 二分探索時は探索範囲は取り得る値+-1しておく

    while l+1 < r:
        c = (l+r)//2
        if c*(c+1)/2 <= v:
            l = c
        else:
            r = c
    ans += l

print(ans)

Measured memory_bytes: 9468
import java.text.ParseException;
import java.util.Scanner;

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

		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		int d = b / a;

		if (d < c) {
			System.out.println(d);
		} else {
			System.out.println(c);
		}

		sc.close();
	}

}


Measured memory_bytes: 22228
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define CLR(a) memset(a, 0, sizeof(a))
#define DBG(x) cout<<(#x)<<"="<<x<<endl
#define FOR(i, a, b)  for(int i=(a); i<(b); i++)
#define REP(i, a, b)  for(int i=(a); i<=(b); i++)
#define DOWN(i, a, b) for(int i=(a); i>=(b); i--)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const double eps = 1e-8;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const ll p = 998244353;
const int N= 300000 +10;

ll n, k, a, b, t, j;
ll ans;
ll f[N], inv[N];

ll Pow(ll a, ll b) {
	ll ret=1;
	while(b) {
		if (b&1) ret=ret*a%p;
		a=a*a%p;
		b>>=1;
	}
	return ret;
}

void init() {
	f[0]=1;
	for(ll i=1; i<=300000; i++) {
		f[i]=f[i-1]*i%p;
	}
	for(ll i=0; i<=300000; i++) {
		inv[i]=Pow(f[i], p-2);
	}
}

ll C(ll n, ll m) {
	ll ret=f[n]*inv[m] %p *inv[n-m] %p;
	return ret;
}


int main() {
	init();
	cin>>n>>a>>b>>k;
	for(ll i=0; i<=n; i++) {
		if (1ll*i*a>k) break;
		t=k-1ll*i*a;
		if (t%b!=0) continue;
		j=t/b;
		if (j>n) continue;
		ans=(ans+C(n, i)*C(n, j)%p)%p;		
	}
	cout<<ans<<endl;
	//cout<<1.*clock()/CLOCKS_PER_SEC<<"ms"<<"\n";
	return 0;
}

Measured memory_bytes: 4992
#include <iostream>

using namespace std;

int n;
int a[200001];
int ans[200001];

int main(int argc, char const *argv[]) {
    cin >> n;
    ans[1] = 0;
    for (int i = 2; i <= n; i++) {
        cin >> a[i];
        ans[i] = 0;
    }

    for (int i = 1; i <= n; i++) {
        ans[a[i]]++;
    }

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

    return 0;
}


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


int main() {
    int n,m;
    cin >> n >> m;
    vector<pair<ll,ll>> student(n,pair<ll,ll>());
    rep(i,n)cin >> student.at(i).first >> student.at(i).second;
    vector<pair<ll,ll>> checkpoint(m,pair<ll,ll>());
    rep(i,m)cin >> checkpoint.at(i).first >> checkpoint.at(i).second;
    rep(i,n){
        ll min_dis = LONG_LONG_MAX;
        ll memo = 0;
        rep(j,m){
            ll dist = abs(student.at(i).first - checkpoint.at(j).first) + abs(student.at(i).second - checkpoint.at(j).second);
            if(dist < min_dis){
                min_dis = dist;
                memo = j;
            }    
        }
        cout << memo+1 << endl;
    }
    return 0;
}
/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define pii pair <ll,ll>
#define vl vector <ll>
#define vp vector <pair<ll,ll>>
//#define sort(x) sort(x.begin(), x.end())
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,i,c = 0,e;
    cin>>n;
    pii a[n];
    set <ll> st;
    for(i=0;i<n;i++)
        cin>>a[i].ff>>a[i].ss;
    c = 1;
    sort(a,a+n);
    e = a[0].ff+a[0].ss;
    for(i=1;i<n;i++)
    {
        if(e <= a[i].ff-a[i].ss)
        {
            c++;
            e = a[i].ff+a[i].ss;
        }
        else
        {
            e = min(e,a[i].ff+a[i].ss);
        }
    }
    cout<<c;
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll LINF = (1LL << 60) - 1LL;
constexpr ll MOD = 1e9 + 7;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s, t;
    cin >> s >> t;
    cout << t << s << endl;
}

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

int main() {
  int a,b;
  cin>>a>>b;
  if(a==b) cout<<"Draw"<<endl;
  else if(a==1) cout<<"Alice"<<endl;
  else if(b==1) cout<<"Bob"<<endl;
  else if(a>b) cout<<"Alice"<<endl;
  else cout<<"Bob"<<endl;
}


Measured memory_bytes: 256