akhauriyash/Code-Regression huggingface dataset:
# import numpy as np
# import scipy as sp
# print(a,b,c,sep="") # 半角スペースなしで出力(abc)
# n=int(input())  #数値入力 「N」だけの入力のとき
# a,b=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
# c=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき
# s=[list(map(str,list(input()))) for i in range(h)]  # 文字列の二次元配列入力
# s = [list(map(int, input().split())) for i in range(n)] # 数値の二次元配列入力
# a = b[:], a = [x[:] for x in b] # deepcopy
# chr(ord('a') + 1) # chrのインクリメント
# s.sort(key=lambda x: x[1], reverse=False) # 2番目の要素で昇順にソート（Trueなら降順）
#

a, b, c = map(int, input().split())
if a+b >= c:
    print('Yes')
else:
    print('No')


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

using namespace std;

int main(){

	string cadena;
	cin>>cadena;
	if(cadena.size()<4){
		cout<<0<<endl;
		return 0;
	}
	long long res = 0;
	long long num_a = 0;
	for(int i = 0; i<cadena.size()-1; i++){
		
		if(cadena[i]=='A'){
			num_a++;

		}
		else{
			if(cadena[i]=='B' && cadena[i+1]=='C'){
				res+=num_a;
				i++;
			}
			else{
				num_a = 0;

			}
		}

	}
	cout<<res<<endl;

	return 0;
}

Measured memory_bytes: 640
//g++ -std=gnu++14 a.cpp
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
#include <random>
#include <math.h>

using namespace std;

#define ll long long
#define rep(i, n) for(ll i = 0; i < (n); i++)
ll MOD = 1e9 + 7;
int INF = 1 << 30;
ll INFL = 1LL << 60;

ll gen(ll x, ll y){
  if(y == 1)return x;
  ll res;
  if(y%2)res = x*gen(x,y-1);
  else res = gen(x,y/2)*gen(x,y/2);
  return res%MOD;
}

ll nijou(ll x){
  if(x==1)return 2;
  ll res;
  if(x%2){
    res = 2*nijou(x-1);
  }else{
    res = nijou(x/2)*nijou(x/2);
  }
  return res%MOD;
}

ll kaijou(ll x){
  ll res = 1;
  while(x>0){
    res *= x;
    x--;
    res %= MOD;
  }
  return res%MOD;
}

int main() {
  int n,a,b;
  cin >> n >> a >> b;

  ll resa,resb;
  resa = 1;
  resb = 1;
  ll nn;
  nn = n;
  while(nn>=n-a+1){
    resa = (resa*nn)%MOD;
    nn--;
  }
  resa *= gen(kaijou(a),MOD-2);
  resa %= MOD;
  nn = n;
  while(nn>=n-b+1){
    resb = (resb*nn)%MOD;
    nn--;
  }
  resb *= gen(kaijou(b),MOD-2);
  resb %= MOD;

  ll all = nijou(n);
  //cout << all << endl;
  ll ans = all-resa-resb-1;
  ans %= MOD;
  if(ans < 0)ans += MOD;
  //if(ans < 0) ans += MOD;
  //cout <<  resa << " " << resb << endl;
  //cout  << nijou << endl;
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>

using namespace std;

int main(){
	int r;cin>>r;
	if(r<1200){cout<<"ABC"<<endl;return 0;}
	if(r<2800){cout<<"ARC"<<endl;return 0;}
	cout<<"AGC"<<endl;
	return 0;
}

Measured memory_bytes: 256
use std::cmp::max;

fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let n: usize = sc.read();
    let a: Vec<usize> = sc.vec(n);
    let mut count = vec![0; n + 1];
    for a in a.into_iter() {
        count[a] += 1;
    }

    let mut max_turns = vec![0; n + 1];

    let mut columns = 0;
    count.sort();
    let mut sum = count.iter().sum::<usize>();
    for turn in (1..(n + 1)).rev() {
        while let Some(c) = count.last().cloned() {
            if c >= turn {
                columns += 1;
                sum -= c;
                count.pop().unwrap();
            } else {
                break;
            }
        }
        let k = columns + sum / turn;
        max_turns[k] = max(turn, max_turns[k]);
    }

    for k in (0..n).rev() {
        max_turns[k] = max(max_turns[k], max_turns[k + 1]);
    }

    for i in 1..(n + 1) {
        println!("{}", max_turns[i]);
    }
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> Self {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: ToString>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.to_string().as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 13084
#include<iostream>
#include<string>

using namespace std;

string a[21];
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
int cnt, X, Y;

void dfs(int y, int x){
  if( y < 0 || Y <= y || x < 0 || X <= x || a[y][x] == '#') return;
  a[y][x] = '#';
  cnt++;
  for(int i = 0; i < 4; i++)
    dfs(y + dy[i], x + dx[i]);
}

int main(){
  while(cin >> X >> Y, X != 0 || Y != 0) {
    int sx = 21, sy;
    for(int i = 0; i < Y; i++){
      cin >> a[i];
      if(sx == 21)
	for(int j = 0; j < X; j++)
	  if(a[i][j] == '@') sy = i, sx = j;
    }
    cnt = 0;
    dfs(sy, sx);
    
    cout << cnt << endl;
  }
}

Measured memory_bytes: 1220
#include<bits/stdc++.h>
#define ALL(c) (c).begin(),(c).end()
#define EACH(i,c) for(auto i=(c).begin();i!=(c).end();++i)
using namespace std;
#define int long long


void solve(long long N, long long A, long long B){
    cout << min(N * A, B) << endl;
}

signed main(){
    long long N;
    scanf("%lld",&N);
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    solve(N, A, B);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)

struct Node {
	int a, b, ma, mb;
	
	Node() {}
	Node(int a, int b, int ma, int mb) : a(a), b(b), ma(ma), mb(mb) {}
};

int n;
Node node[100];
bool istop[100];

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

int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}

int dfs(int pos) {
	Node &now = node[pos];
	
	int a = now.a, b = now.b, ma = now.ma, mb = now.mb;
	
	ma = ma ? dfs(ma - 1) : 1;
	mb = mb ? dfs(mb - 1) : 1;
	
	int l = lcm(a * ma, b * mb);
	return l / a + l / b;
}

int main() {
	while (cin >> n, n) {
		fill(istop, istop + n, false);
		
		REP(i, n) {
			int a, b, ma, mb;
			scanf("%d %d %d %d", &a, &b, &ma, &mb);
			int g = gcd(a, b);
			a /= g; b /= g;
			node[i] = Node(a, b, ma, mb);
			
			if (ma != 0) istop[ma - 1] = true;
			if (mb != 0) istop[mb - 1] = true;
		}
		
		int st = 0;
		while (istop[st]) st++;
		cout << dfs(st) << endl;
	}
	return 0;
}

// 2:00

Measured memory_bytes: 3132
#include <iostream>
using namespace std;
int main(){
  int N;int i=0;
  cin >> N;
  int arr[3];
  for(int j=0;j<3;j++){
    arr[j]=-1;
  }
  while(N!=0){
    int k=N%10;
    arr[i]=k;
    N=N/10;
    i++;
  }
  switch(arr[0]){
    case 2:case 4:case 5:case 7:case 9:
      cout << "hon";
      break;
    case 0:case 1:case 6:case 8:
      cout << "pon";
      break;
    case 3:
      cout << "bon";
  }
  return 0;
}

Measured memory_bytes: 3624
N = int(input())
S = input()

sm_w = [0]*(N+1)
sm_b = [0]*(N+1)

for i in range(N):
    s = S[i]
    sm_w[i+1] = sm_w[i]
    sm_b[i+1] = sm_b[i]
    if s == '.':
        sm_w[i+1] += 1
    else:
        sm_b[i+1] += 1

ans = 2**60
for i in range(N+1):
    left_b = sm_b[i] - sm_b[0]
    right_w = sm_w[N] - sm_w[i]
    ret = left_b + right_w
    ans = min(ans, ret)
print(ans)
    


Measured memory_bytes: 14824
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <math.h>
#include <utility>
#include <algorithm>
#include <functional>
#include <vector>
#include <numeric>
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using vi = vector <int>;

#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define REP(i,n) for(int i=0;i<n;i++)

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

    int n; cin >> n;

    int fib[n+1];
    fib[0] = 1;
    fib[1] = 1;
    FOR(i, 2, n+1) {
        fib[i] = fib[i-1] + fib[i-2];
    }
    cout << fib[n] << "\n";
}


Measured memory_bytes: 3228
#include <stdio.h>
#include <string.h>
 
int main(){
	char A[11] ,B[11], C[11];
	scanf("%s %s %s", &A, &B, &C);
 
	int x = strlen(A), y = strlen(B);
	if(A[x-1] == B[0] && B[y-1] == C[0]){
		printf("YES \n");
	}else {
		printf("NO \n");
	}
	return 0;
}

Measured memory_bytes: 1588
import java.util.*;

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

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

        int max = Math.max(a+b, Math.max(a-b, a*b));
        System.out.println(max);
    }
}

Measured memory_bytes: 22228
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;

using int64 = long long;

const int64 mod = 1e9 + 7;

vector<int> sequence[1 << 16];
bool can[1 << 16][11];

int N, XYZ[3];

bool is_XYZ(vector<int>& seq) {
    reverse(seq.begin(), seq.end());
    int XYZ_i = 0,
        sum = 0;
    for (int i = 0; i < seq.size(); i++) {
        sum += seq[i];
        if (XYZ_i < 3 and (sum == XYZ[XYZ_i])) {
            sum = 0;
            XYZ_i++;
        }
    }
    return XYZ_i == 3;
}

int main() {
    cin >> N;
    int sum = -1;
    for (int i = 0; i < 3; i++) {
        cin >> XYZ[i];
        sum += XYZ[i];
    }
    map<int, int> mp;
    for (int i = 0; i < sum; i++) mp[1 << i] = i + 1;

    for (int mask = 0; mask < (1 << sum); mask++) {
        int m = mask;
        while (m > 0) {
            sequence[mask].push_back(mp[m & -m]);
            m = m / (2 * (m & -m));
        }
        reverse(sequence[mask].begin(), sequence[mask].end());

        for (int num = 1; num <= 10; num++) {
            auto seq = sequence[mask];
            seq.push_back(num);
            can[mask][num] = is_XYZ(seq);
        }
    }

    static int64 dp[50][1 << 16];
    dp[0][0] = 1;
    for (int i = 0; i < N; i++) {
        for (int mask = 0; mask < (1 << sum); mask++) {
            if (dp[i][mask] == 0) continue;

            for (int num = 1; num <= 10; num++) {
                // numを突っ込んだ時XYZができるならcontinue
                if (can[mask][num]) continue;

                int nmask = ((mask << num) + (1 << (num - 1))) & ((1 << sum) - 1);

                (dp[i + 1][nmask] += dp[i][mask]) %= mod;
            }
        }
    }

    int64 ans = 1;
    for (int i = 0; i < N; i++) (ans *= 10) %= mod;
    for (int mask = 0; mask < (1 << sum); mask++) (ans = ans + mod - dp[N][mask]) %= mod;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 28672
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
using namespace std;
#define MAXN 100100
long long ans, cnt;
long long n;
int main()
{
	scanf("%lld",&ans);
	n = 100;
	long long m;
	while(1)
	{
		if(n >= ans)
		{
			printf("%d\n",cnt);
			return 0;
		}
		n = n*1.01;
		cnt++;
	}
	
	return 0;
}

Measured memory_bytes: 3864
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
long long kansu(long long x){
    if (x<2){
        return 1;
    }else{
        return x * kansu(x - 2);
    }
}
int main()
{
    long long n;
    long long n1;
    long long n2;
    cin >> n;
    n1 = n/10;
    n2 = n / 10;
    if(n%2==1){
        cout << 0 << endl;
        return 0;
    }
    long long ans2 = 0;
    long long ans = 0;
    long long ans1 = 0;
    rep(i,40){
        n1 /= 5;
        n /= 10;
        n2 /= 10;
        ans2 += n2;
        ans1 += n1;
        ans += n;
    }
    cout << ans-ans2+ans1<< endl;
}

Measured memory_bytes: 256
#ifdef _DEBUG
#define _CRT_SECURE_NO_WARNINGS
#include "MyLib.h"
#else
#define main_C main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define MGN 8
#define LINF (LONG_MAX/2)
using namespace std;
typedef long long ll; typedef unsigned long long ull;
typedef vector<int> vi; typedef vector<vi> vvi;
typedef vector<ll> vl; typedef vector<vl> vvl;
typedef vector<double> vd; typedef vector<string> vs;
typedef pair<int, int> pii; typedef pair<ll, ll> pll;
typedef vector<bool> vb; typedef vector<vb> vvb;
template <typename T>
using keyVal = pair<string, T>;
template<typename T>
bool val_greater(const keyVal<T>& left, const keyVal<T>& right) {
    return left.second > right.second;
}
vs split(string str, char sep) {
    vs v; stringstream ss(str); string t;
    while (getline(ss, t, sep)) v.push_back(t);
    return v;}
vs re_search_g(string s, regex re) {
    vs ret; smatch mc; auto it = s.cbegin();
    while (regex_search(it, s.cend(), mc, re)) {
        ret.push_back(mc[0]);
        it += mc.position(0) + mc.length();}
    return ret;}
#endif

void init_global_C() {}

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

    int N, M; cin >> N >> M;
    vi a(M), b(M); 
    REP(i, M) {
        cin >> a[i] >> b[i];
        a[i]--; b[i]--;
    }

    vvi e(N);

    REP(i,M) {
        e[a[i]].push_back(b[i]);
        e[b[i]].push_back(a[i]);
    }

    // BFS
    queue<int> que;
    vb visited(N, false);
    vi dist(N, INF);
    que.push(0);
    visited[0] = true;
    dist[0] = 0;

    while(!que.empty()) {
        int x = que.front(); que.pop();
        visited[x] = true;

        for (int nx : e[x]){
            if (visited[nx]) continue;
            dist[nx] = min(dist[nx], dist[x] + 1);
            que.push(nx);
        }
    }

    string ans = dist[N - 1] <= 2 ? "POSSIBLE" : "IMPOSSIBLE";
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 14832
s = input()

if len(s) % 2 == 0:
    list = [""] * (len(s) // 2)
else:
    list = [""] * (len(s) // 2 + 1)

for i in range(len(s)):
    if i % 2 == 0:
        list[i // 2] = s[i]

print("".join(list))

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

int main(){
	int n;scanf("%d",&n);
	vector<int>v;
	int x=0;
	rep(i,n){
		int a;scanf("%d",&a);
		v.push_back(a^(a-1));
		x^=a;
	}
	sort(v.begin(),v.end(),greater<>());
	int cnt=0;
	for(int i:v){
		if(x>(x^i)){
			cnt++;
			x^=i;
		}
	}
	if(x)puts("-1");
	else cout<<cnt<<endl;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,m,x=1,h;cin>>N;
  cin>>m;
  for(int i=1;i<N;i++){
    cin>>h;
    if(h>=m){
      x++;m=h;
    }
  }
  cout<<x<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#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++)

int main(void) {
  string s;
  cin >> s;
  int s_len = s.size();
  int bit_len = s_len-1;
  ll sum = 0;

  for(int bit = 0; bit < (1<<bit_len); bit++) {
    string ss = s; int cnt = 0;
    for(int i = 0; i < bit_len; i++) {
      if(bit & (1 << i)) {
        ss.insert(i+cnt+1,"+"); cnt++;
      }
    }
    //cout << ss << endl;
    ll tmp = 0;
    for(int i = 0; i < ss.size(); i++) {
      if (i+1 == ss.size() || ss[i+1] == '+') {
        tmp = tmp * 10 + (ss[i]-'0'); sum += tmp; 
      } else if (ss[i] == '+') {
        tmp = 0;
      }
      else {
        tmp = tmp * 10 + (ss[i]-'0');
      }
    }
    //cout << sum << endl;
  }
  cout << sum << endl;

}

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

using namespace std;
int n,m;
const int MAXN=3000+5;
string s,t,ans; 
int dp[MAXN][MAXN];
int main()
{
	cin>>s>>t;
	n=s.size();m=t.size();
	if(s[0]==t[0]) dp[0][0]=1;
	
	for(int i=1;i<=n;++i)
		for(int j=1;j<=m;++j)
		{
			if(s[i-1]==t[j-1])
			{
				dp[i][j]=dp[i-1][j-1]+1;
			}
			else dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
		}
	
	int i=n,j=m;	
	while(i&&j)
	{
		if(s[i-1]==t[j-1])
		{
			ans+=s[i-1];
			--i;--j;
		}
		else if(dp[i-1][j]>dp[i][j-1])
			--i;
		else --j;
	}
	reverse(ans.begin(),ans.end());
	cout<<ans<<endl;
	return 0;
}


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

int main() {
	int n;
	int h[20];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> h[i];
	}
	int ans=1;
	for (int i = 1; i < n; i++) {
		int count = 0;
		for (int j = i-1; j >= 0; j--) {
			if (h[i] - h[j] >= 0)count++;
          else{
            count=0;
            break;
          }
		}
		if (count >0 )ans++;
	}
		cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define f(i,l,r) for(int i=l;i<r;i++)
using namespace std;
ll dp[100001],n,h[100001],k;

ll solve(int i)
{
    if(dp[i]!=-1)
    return dp[i];
    if(i==n-1)
        return 0;
    dp[i]=abs(h[i]-h[i+1])+solve(i+1);
    for(int t=2;t<=k;t++)
    {
        if(i+t>n-1)
            break;
        dp[i]=min(dp[i],abs(h[i]-h[i+t])+solve(i+t));
    }
    return dp[i];
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n>>k;
    f(i,0,n){
        cin>>h[i];
    }
    f(i,0,n+k+1) dp[i]=-1;
    dp[n]=-1;
    ll ans=solve(0);
    cout<<ans;
    return 0;
}

Measured memory_bytes: 6528
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,size;
  cin>>a>>b;
  if(b<10)size=10;
  else if(b<100)size=100;
  else size=1000;
  c=b+size*a;
  for(int i=0;i<1000;i++){
    if(i*i==c){
      cout<<"Yes"<<endl;
      exit(0);
  }
  }
    cout<<"No"<<endl;
  }

Measured memory_bytes: 256
N = int(input())
F = [[int(i) for i in input().split()] for j in range(N)]
P = [[int(i) for i in input().split()] for j in range(N)]
ans = -10 ** 10

for i in range(1, 2 ** 10):
  T = [0] * 10
  for j in range(10):
    if ((i >> j) & 1):
      T[j] = 1
      
  pro = 0
  for i in range(N):
    c = 0
    for j in range(10):
      if F[i][j] == 1 and T[j] == 1:
        c += 1
    pro += P[i][c]
  ans = max(pro, ans)

print(ans)

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

using namespace std;

int white[200005], black[200005];

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

    int A, B, C; cin >> A >> B >> C;

    if(min(A, B) <= C and C <= max(A, B)) return cout << "Yes", 0;
    cout << "No";

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using pll = pair<ll,ll>;
using vb = vector<bool>;
const ll oo = 0x3f3f3f3f3f3f3f3fLL;
const double eps = 1e-9;
#define	sz(c) ll((c).size())
#define	all(c) begin(c),end(c)
#define	mp make_pair
#define mt make_tuple
#define	pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define	has(c,i) ((c).find(i) != end(c))
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define	FORD(i,a,b) for (ll i = (b)-1; i >= (a); i--)

int main(){
	ios::sync_with_stdio(false);
  ll n;
  cin >> n;
  vl occ(1000000, 0);
  ll maxCount = 0;
  FOR(i,0,n){
    ll a;
    cin >> a;
    occ[a]++;
    occ[a+1]++;
    occ[a+2]++;
    maxCount = max(maxCount, occ[a]);
    maxCount = max(maxCount, occ[a+1]);
    maxCount = max(maxCount, occ[a+2]);
  }
  cout << maxCount << endl;
}

Measured memory_bytes: 8064
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

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

	int a, b, ans, i, j, k;
	cin >> a >> b;

	for (i = 1; i <= 1000000; i++) {
		if ((i * 8 / 100 == a) && (i * 10 / 100 == b)) {
			cout << i << "\n";
			return 0;
		}
	}

	cout << "-1\n";

	return 0;
}


Measured memory_bytes: 888
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4.1,sse4.2,avx,avx2,popcnt,tune=native")
//
//#include <immintrin.h>
//#include <emmintrin.h>

#include <bits/stdc++.h>
//#pragma GCC optimize("O2")
#define vi vector<int>
#define pii pair<int, int >
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define LL long long
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define per(i,a,n) for (int i=n;i>=a;i--)
#define all(x) (x).begin(), (x).end()
#define all2(x,n) (x+1), (x+1+n)
#define sz(x) ((int)(x).size())
#define mod(x) ((x)%MOD)
#define debug(x) cerr<<#x<<" : "<<x<<endl
#define mt make_tuple
#define eb emplace_back
#define o(X) (1<<(X))
#define oL(X) (1LL<<(X))
#define contain(S,X) (((S)&o(X))!=0)
#define containL(S,X) (((S)&oL(X))!=0)
using namespace std;
const int INF=0x3f3f3f3f,N=1e6+5,MOD=998244353;
const LL INF_LL=0x3f3f3f3f3f3f3f3fLL;
inline int getplc(int x,int y) { return (x>>y)&1; }
template<typename T>
T square(T x) {return x*x;}
LL qpow(LL a,LL b=MOD-2,LL _MOD=MOD){
	LL res=1;
	for(;b;b>>=1,a=a*a%_MOD){
		if(b&1)res=res*a%_MOD;
	}
	return res;
}
// Smax
//int Smax() { return -INF; }
template <typename T>
T Smax(T x) { return x; }
template<typename T, typename... Args>
T Smax(T a, Args... args) { return max(a, Smax(args...)); }
// Smin
template <typename T>
T Smin(T x) { return x; }
template<typename T, typename... Args>
T Smin(T a, Args... args) { return min(a, Smin(args...)); }
template <typename T>
// erro
#define errorl(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); errl(_it, args); }

void errl(istream_iterator<string> it) {}
template<typename T, typename... Args>
void errl(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	errl(++it, args...);
}

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); cerr<<endl;}
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << "=" << a << " # ";
	err(++it, args...);
}
void Solve();
int main() {
#ifndef ONLINE_JUDGE
//	freopen("in.txt","r",stdin);
//    freopen("o1.txt","w",stdout);
#endif
	ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);
	Solve();
	return 0;
}

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


void Solve(){
  int K,x=0;
  cin>>K;
  rep(i,1,1e6){
    x=(x*10+7)%K;
    if(!x){
      cout<<i<<endl;
      return;
    }
  }
  cout<<-1<<endl;
}

Measured memory_bytes: 3640
x, y, z, k = gets.chomp.split.map(&:to_i)
a_arr = gets.chomp.split.map(&:to_i).sort.reverse
b_arr = gets.chomp.split.map(&:to_i).sort.reverse
c_arr = gets.chomp.split.map(&:to_i).sort.reverse

ab_arr = a_arr.product(b_arr).map{ |a,b| a+b }
ab_arr = ab_arr.sort.last(k)

abc_arr = ab_arr.product(c_arr).map{ |ab,c| ab+c }
abc_arr = abc_arr.sort.last(k).reverse

puts(abc_arr.join("\n"))

Measured memory_bytes: 294684
def bb
    x1,y1,x2,y2 = gets.chomp.split(/\s/).map{|x| x.to_i}
    x4 = -(y2 - y1) + x1
    y4 = (x2 - x1) + y1

    x3 = -(y1 - y4) + x4
    y3 = (x1 - x4) + y4

    puts sprintf("%d %d %d %d", x3, y3, x4, y4)
end

bb


Measured memory_bytes: 1916
#include <set>
#include <array>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <vector>
#include <tuple>
#include <string>
#include <math.h>
#include <time.h>
#include <bitset>
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <limits>
#include <climits>
#include <numeric>
#include <functional>

#define lnd '\n'
// #define reverse(i, n) for(ll i = n-1; i >= 0; --i)
#define from(i, n) for (ll i = 0; i < n; ++i)
#define loop(i, n) for(ll i = 0; i < n; i++)
#define REPN(i, n) for (ll i = 1; i <= n; ++i)
#define ALL(s) (s).begin(), (s).end()
#define rALL(s) (s).rbegin(), (s).rend()
#define sz(s) (int)(s).size()
#define mk make_pair
#define pb push_back
#define sqr(s) ((s) * (s))

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef unsigned int ui;

template <class T>
T GCD (T a, T b) {
  if(a == 0) return b;
  return GCD(b%a, a);
}

template <class T>
T LCM(T a, T b){
  return a*b/GCM(a,b);
}

template <class T>
T modpow(T x, T p){
    T res = 1;
    while(p > 0){
        if(p&1) res *= x;
        x *= x;
        p /= 2;
    }
    return res;
}

template <class T>
T modpow(T x, T p, ll mod){
    T res = 1;
    while(p > 0){
        if(p&1) res = (res*x)%mod;
        x = (x*x)%mod;
        p /= 2;
    }
    return res%mod;
}

template <class T>
void print(T a[], ll n){
    for (ll i = 0; i < n; i++) std::cout << a[i] << ' ';
    cout << endl;
}

template<class T>
void printc(T c){
    for(auto const& v: c) std::cout << v << ' ';
    cout << endl;
}

struct HASH{
  size_t operator()(const pair<long,long>&x)const{
    return hash<long long>()(((long long)x.first)^(((long long)x.second)<<32));
  }
};

bool pair_sort(const pair<int, int> &p1, const pair<int,int> &p2){
    if(p1.first != p2.first) return p1.first < p2.first;
    else return p1.second < p2.second;
}

const int INF = std::numeric_limits<int>::max();
const ll M_INF = std::numeric_limits<ll>::min();
const ll LL_INF = std::numeric_limits<ll>::max();

void solution();
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    solution();
    return 0;
}

void solution(){
  int n, m;
  cin >> n >> m;
  ll ans = 0;
  ans = n*(n-1)/2;
  ans += m*(m-1)/2;
  cout << ans << endl;
}     

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <functional>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#define nmax_def 110000
#define Cmax_def 2200
#define mod 1000000007
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;

int main() {
	string S;
	ll N;
	ll K;
	cin >> S;
	cin >> K;
	N = S.length();
	char cbegin = S[0];
	char cend = S[N-1];
	char c = S[0];
	ll begin_num = 1;
	bool beginmode = 1;
	ll end_num = 1;
	ll count = 0;
	rep(i, N - 1) {
		if (S[i] == S[i + 1])
			end_num++;
		else {
			count += (end_num / 2);
			end_num = 1;
			beginmode = 0;
		}
		if (beginmode)
			begin_num++;
	}
	count += (end_num / 2);
	ll ans = K * count;
	if (cbegin == cend) {
		ans -= (K - 1) * (begin_num / 2 + end_num / 2);
		ans += (K - 1) * ((begin_num + end_num) / 2);
	}
	if (N == begin_num)
		ans = N * K / 2;
	cout << ans << endl;
	


	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_map>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>
#include<iomanip>
#include<bitset>
#include<list>

using namespace std;

#define ll long long int

ll const MOD = 1000000007;
ll const INF = (long long int)1 << 61;

ll mypow(ll x,ll n,ll mod = MOD){
    ll ret = 1;
    while(n > 0){
        if(n&1){
            ret = (ret*x)%mod;
        }
        x = (x*x)%mod;
        n >>= 1;
    }
    return ret;
}

ll mygcd(ll a,ll b){
    if(b == 0)return a;
    return mygcd(b,a%b);
}

ll twoPow(ll shiftNum){
    return (1LL << (shiftNum - 1));
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
 
    ll h,w;
    cin >> h >> w;

    vector<string> grid;
    for(int i = 0; i < h; i++){
        string str;
        cin >> str;
        grid.push_back(str);
    }

    int ans = 0;

    vector<int> distx = {-1,0,1,0};
    vector<int> disty = {0,1,0,-1};

    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            if(grid[i][j] == '.'){
                queue<pair<int,int>> q;
                q.push({i,j});
                vector<vector<int>> dist(h,vector<int>(w,-1));
                dist[i][j] = 0;
                while(!q.empty()){
                    auto t = q.front();
                    auto y = t.first;
                    auto x = t.second;
                    q.pop();
                    for(int k = 0; k < 4; k++){
                        if(y + disty[k] >= 0 && y + disty[k] < h && x + distx[k] >= 0 && x + distx[k] < w){
                            if(grid[y + disty[k]][x + distx[k]] != '#' && dist[y + disty[k]][x + distx[k]] == -1){
                                dist[y + disty[k]][x + distx[k]] = dist[y][x] + 1;
                                q.push({y + disty[k],x + distx[k]});
                            }
                        }
                    }
                }
                for(const auto row : dist){
                    for(const auto cell : row){
                        ans = max(ans,cell);
                    }
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <queue>
#include <string>
#include <vector>
#include <math.h>
#include <utility>
#include <map>
#include <queue>
#include <stack>

using namespace std;

#define INF 210000000
#define int long long

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

int lcm(int a, int b) { return a * b / gcd(a, b); }

signed main() {
		int s;
		cin >> s;
		map<int,int> cnt;
		cnt[s]++;
		int ans = 1;
		while(true){
				ans++;
				if(s % 2 == 0){
						s /= 2;
				}else{
						s = 3 * s + 1;
				}
				cnt[s]++;
				if(cnt[s] == 2){
						break;
				}
		}
		cout << ans;
}



Measured memory_bytes: 256
object Main extends App {
  var N = readInt - 1
  var get = readLine.split(" ")
  var sum =1
  var flag = get(0).toInt
  for(i <- 1 to N)
  {
    if(flag <= get(i).toInt) {
       sum = sum + 1
      flag = get(i).toInt
    }
  }
    println(sum)
}

Measured memory_bytes: 27340
A = int(input())
B = int(input())
C = int(input())
X = int(input())

sum = 0
count = 0
for a in range(A+1):
    sum = 0
    sum = sum + a * 500
# if X >500, then no need to check 500*2
    if sum > X:
        break
    for b in range(B+1):
        sum2 = sum
        sum2 = sum2 + b * 100
        if sum2 > X:
            break
# number of C is dtermined by a and b
        if (X - sum2) / 50  <= C:
            count = count +1

print(count)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s, t;
  cin >> s >> t;
  sort(s.begin(), s.end());
  sort(t.begin(), t.end(), greater<char>());
  int ls = s.size();
  int lt = t.size();
  bool ok = ls < lt;
  if(lt > ls) t.erase(ls);
  for(int i=0; i<ls; ++i){
    if(s[i] < t[i]){
      cout << "Yes" << endl;
      return 0;
    }else if(s[i] > t[i]){
      ok = false;
    }
  }
  cout << (ok ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3640
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long int ll;
typedef vector<pair<ll,ll> > Q;
typedef pair<int,int> P;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
const ll inf=1e9+7;
ll gcd(ll a, ll b) { return (b ? gcd(b, a % b) : a); }
ll lcm(ll a, ll b) { return a / (gcd(a, b)) * b; }

int main(){
    ll n,a,b,c;
    cin>>n>>a>>b>>c;
    ll tmp=a+b+c;
    string ans[100000],s[100000];
    rep(i,0,n) cin>>s[i];

    bool judge=true;
    if(tmp<=0) judge=false;
    else{
      rep(i,0,n){
        if(s[i]=="AB"){
          if(!a && !b) judge=false;
          else if(!a) b--,a++,ans[i]='A';
          else if(!b) a--,b++,ans[i]='B';
          else if(i==n-1) a++,b--,ans[i]='A';
          else if(s[i+1]=="BC") b++,a--,ans[i]='B';
          else a++,b--,ans[i]='A';
        }
        else if(s[i]=="AC"){
          if(!a && !c) judge=false;
          else if(!a) c--,a++,ans[i]='A';
          else if(!c) a--,c++,ans[i]='C';
          else if(i==n-1) a++,c--,ans[i]='A';
          else if(s[i+1]=="BC") c++,a--,ans[i]='C';
          else a++,c--,ans[i]='A';
        }
        else if(s[i]=="BC"){
          if(!c && !b) judge=false;
          else if(!c) b--,c++,ans[i]='C';
          else if(!b) c--,b++,ans[i]='B';
          else if(i==n-1) b++,c--,ans[i]='B';
          else if(s[i+1]=="AC") c++,b--,ans[i]='C';
          else b++,c--,ans[i]='B';
        }
      }
    }

    if(!judge) cout<<"No";
    else{
      cout<<"Yes"<<endl;
      rep(i,0,n) cout<<ans[i]<<endl;
    }
}

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

using namespace std;
//#pragma GCC optimize(2)
#define IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ull unsigned long long
#define ll long long
#define rep(i, x, y) for(int i=x;i<=y;i++)
#define mms(x, n) memset(x, n, sizeof(x))
#define mmc(A, tree) memcpy(A, tree, sizeof(tree))
#define eps (1e-8)
#define PI (acos(-1.0))
#define INF (0x3f3f3f3f)
#define mod (ull)(1e9+7)
typedef pair<int, int> P;
const int N = 2e5 + 10;
struct Node {
    ll x, y;
} e[N];
ll ans1[N], ans2[N];

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
#endif
    int n;
    scanf("%d", &n);
    ll ans = 0;
    ll x, y;
    for (int i = 1; i <= n; i++) {
        scanf("%lld%lld", &x, &y);
        ans1[i] = (x + y);
        ans2[i] = (x-y);
    }
    sort(ans1 + 1, ans1 + 1 + n);
    sort(ans2 + 1, ans2 + 1 + n);
    ans = max((ll)abs(ans1[1] - ans1[n]), (ll)abs(ans2[1] - ans2[n]));
    printf("%lld", ans);
    return 0;
}

Measured memory_bytes: 6872
///******* In the name of Allah *******///

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

//long int ar[10013];
//long int gcd(long int a, long int b)
//{
//    if(b==0)
//        return a;
//    return gcd(b,a%b);
//}
//long int sieve(long long int a)
//{
//    long long int i,j,k = 0;
//    memset(ar,0,sizeof(ar));
//    ar[1] = 1;
//    for(i=2; i<=713; i++)
//    {
//        if(ar[i]==0)
//        {
//            for(j=i+i; j<=713; j+=i)
//            {
//                ar[j] = 1;
//            }
//        }
//    }
//    return ar[a];
//}

void Ok()
{
    long long int a,b,c,d,e,f,g,h,t,i,j,k,l,m,n;
    long long int ans_1,ans_2,ans_3,ans_4,cnt_1 = 0,cnt_2 = 0,cnt_3 = 0,Max,Min,flag,temp,sum;
    double aa,bb,cc,dd,ee,ff,gg;
    char aaa,bbb,ccc,ddd;
    string spc,in,store[13];

    cin>>a>>b;
    ans_1 = a * b;
    cout<<ans_1<<endl;

    return;
}

int main()
{
    Ok();

    return 0;
}


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

using namespace std;

#define MAX 1000
#define MAX_D 10001

int main(){
  int N, arr[MAX], _arr[MAX], dest[MAX_D];
  bool used[MAX];

  cin >> N;
  for(int i = 0 ; i < N ; i++){
    cin >> arr[i];
    used[i] = false;
    _arr[i] = arr[i];
  }
  sort(_arr, _arr+N);

  for(int i = 0 ; i < N ; i++){
    dest[_arr[i]] = i;
  }

  int ans = 0;
  for(int i = 0 ; i < N ; i++){
    if(dest[arr[i]] == i || used[i]){
      used[i] = true;
      continue;
    }

    int cnt = -1, sum = 0, min = arr[i], next = i;
    for( ; !used[next] ; ){
      sum += arr[next]; cnt++;
      min = std::min(min, arr[next]);
      used[next] = true;
      next = dest[arr[next]];
    }
    sum -= min;
    ans += sum + min*cnt;

    if(2*(min+_arr[0]) < (min-_arr[0])*cnt){
      ans -= (min-_arr[0])*cnt - 2*(min+_arr[0]);
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1196
#include<stdio.h>
#define N 500000
#define se 1000000000

int Merge(int A[],int left, int mid, int right);
int MergeSort(int A[],int left, int right);

//int A[N];
int c;

int main(){
  int A[N];
  int n;
  int i;
  c=0;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }

  MergeSort(A,0,n);

  for(i=0;i<n;i++){
    printf("%d",A[i]);
    if(i<n-1)printf(" ");
  }
  printf("\n");
  printf("%d\n",c);
  return 0;
}

int Merge(int A[],int left,int mid,int right){
  int n1,n2;
  int i,j,k;

  n1=mid-left;
  n2=right-mid;
  int L[n1],R[n2];

  for(i=0;i<n1;i++){
    L[i]=A[left+i];
  }
  for(i=0;i<n2;i++){
    R[i]=A[mid+i];
  }

  L[n1]=se;
  R[n2]=se;
  
  i=0;
  j=0;
  for(k=left;k<right;k++){
    c++;
    if(L[i]<=R[j]){
      A[k]=L[i];
      i=i+1;
    }
    else{
      A[k]=R[j];
      j=j+1;
    }
  }
}

int MergeSort(int A[],int left,int right){
  int mid;
  if(left+1<right){
    mid=(left+right)/2;
    MergeSort(A,left,mid);
    MergeSort(A,mid,right);
    Merge(A,left,mid,right);
  }
}

Measured memory_bytes: 4508
#include <cmath>
#include <cstdio>
#include <vector>
#include <list>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <stack>
#include <fstream>
#include <queue>
#include <iomanip>
#include <iterator>
#include <map>
#include <unordered_map>
#include <set>
#define fast ios_base::sync_with_stdio(false)
#define mxn (ll)1e5
#define mod (ll)(1e9+7)
#define mod1 (ll)(998244353)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vvi vector<vi >
#define pi pair<ll,ll>
#define vvpi vector<vector<pi > >
#define vpi vector<pi >
#define vppi vector<pair<ll,pi > >
#define vs vector<string>
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define fs first
#define se second
#define crz(v,n) v.clear(),v.resize(n+1,0)
#define print(v) for(ll it=0;it<v.size();it++) cout<<v[it]<<" ";cout<<endl
#define printp(v) for(ll it=0;it<v.size();it++) cout<<v[it].first<<" "<<v[it].second<<endl
using namespace std;
vpi d(mxn+5);vvi g(mxn+5);
pi dfs(int i,int p){
	d[i].fs=d[i].se=1;
	for(auto j:g[i]) if(j-p){
		pi a=dfs(j,i);
		d[i].fs=(d[i].fs*(a.fs+a.se))%mod;
		d[i].se=(d[i].se*a.fs)%mod;
	}return mkp(d[i].fs,d[i].se);
}
int main(){
	int n,i,u,v;cin>>n;
	for(i=1;i<n;i++) cin>>u>>v,g[u].pb(v),g[v].pb(u);
	dfs(1,0);
	cout<<(d[1].fs+d[1].se)%mod;
}



Measured memory_bytes: 12800
#include <iostream>
#include <vector>

using namespace std;

inline bool inRange(int a, int x, int b) {
    return a <= x && x < b;
}

void fill(vector<vector<int> > &v, int r, int c) {
    v[r][c] = 0;
    for(int dr = -1; dr <= 1; ++dr) {
        for(int dc = -1; dc <= 1; ++dc) {
            int nr = r + dr;
            int nc = c + dc;
            if(inRange(0, nr, v.size()) && inRange(0, nc, v[0].size()) && v[nr][nc]) {
                fill(v, nr, nc);
            }
        }
    }
}

int main() {
    ios::sync_with_stdio(0);

    while(true) {
        int C, R;
        cin >> C >> R;
        if(!C && !R) break;

        vector<vector<int> > v(R, vector<int>(C));
        for(int i = 0; i < R; ++i) 
            for(int j = 0; j < C; ++j)
                cin >> v[i][j];

        int cnt = 0;
        for(int r = 0; r < R; ++r) {
            for(int c = 0; c < C; ++c) {
                if(v[r][c]) {
                    ++cnt;
                    fill(v, r, c);
                }
            }
        }

        cout << cnt << endl;
    }

    return 0;
}

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

int main(void) {
  int n;
  scanf("%d", &n);
  int t0 = 0, x0 = 0, y0 = 0;
  for (int i = 0; i < n; ++i) {
    int t, x, y;
    scanf("%d%d%d", &t, &x, &y);
    if (abs(x - x0) + abs(y - y0) > t - t0 ||
        ((t - t0) - (x - x0 + y - y0) & 1)) {
      puts("No");
      return 0;
    } else {
      t0 = t;
      x0 = x;
      y0 = y;
    }
  }
  puts("Yes");
  return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<cmath>
#include <algorithm>
using namespace std;

long long enum_divisors(long long N) {
    long long ans = 0;
    for (long long i = 1; i * i <= N; ++i) {
        if (N % i == 0) {
            ans++;
            // 重複しないならば i の相方である N/i も push
            if (N / i != i) ans++;
        }
    }
    return ans;
}

vector<long long int> e(1000000, 0);

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

    for (long long int i = 1; i < 1000001; i++) {
        for (long long int j = 1; j < 1000001; j++) {
            if (i * j > 1000000)break;
            e[i * j - 1]++;
        }
    }

    long long int ans = 0;

    for (long long int i = 0; i < n-1; i++) {
        ans += e[i];
    }

    cout << ans;

    

    return 0;
}

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


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

  ll n,k;
  cin >> n >> k;
  ll ans=0;
  for(ll i=k+1; i<=n; i++){
    ll l=i-k;
    ans += n;
    ans -= max(k-1, 0LL)*(n/(k+l));
    if(k!=0) ans-=n/(k+l);
    ans -= (n%(k+l) -max(n%(k+l) -max(k-1, 0LL),0LL));
    //    cout << n%(k+l) << "-" << max(k-1-1+1, 0) << endl;
    /*    ans+=l*n/(k+l);
    ans+=max(n%(k+l)-(k-1),0);
    if(k==0) ans-=1;*/
    //        cout << ans << endl;
  }
  cout << ans << endl;
  
  return 0;
    

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char s[3][200007];
int main(){
    int n;
    scanf("%d",&n);
    for(int i=1;i<=3;i++){
        scanf("%s",s[i]);
    }
    int ans=0;
    for(int i=0;i<=n;i++){
        if(s[1][i]==s[2][i]&&s[2][i]==s[3][i])
            continue;
        else if(s[1][i]==s[2][i]||s[1][i]==s[3][i]||s[2][i]==s[3][i]){
            ans++;
        }
        else
            ans+=2;
    }
    printf("%d",ans);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

const int MAX_N = 100;

int main () {
    int n;
    int A[MAX_N];

    cin >> n;

    for (int i = 0; i < n; i++) {
        cin >> A[i];
    }

    double sum = 0.0;

    for (int i = 0; i < n; i++) {
        sum += 1.0 / A[i];
    }

    printf("%.10f\n", 1 / sum);
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
using ll = long long;
int main(){
    ll N,M;
    cin >> N >> M;
    ll L[M+10],R[M+10],l,r;
    for(int k=1;k <=M ;k++)cin >> L[k] >> R[k];
    l = L[1];
    for(int i=1;i <=M;i++){
        if(L[i] >= l)l = L[i];
        }
    r = R[1];
    for(int i=1;i <=M;i++){
        if(R[i] <= r)r = R[i];
    }
    if(0 <= r-l)cout << r-l+1 << endl;
    else cout << 0 << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
double dist(double x, double y) {
  return sqrt(x * x + y * y);
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  while(1) {
    int d; double e; cin >> d >> e;
    if(d == 0) break;
    double mi = 1000000;
    for(int i=0;i<=d;++i) {
      mi = min(mi, abs(dist(i, d-i) - e));
    }
    cout << mi << endl;
  }
}



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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s; cin>>s;
    rep(i,7) s+='$';
    int n=s.size();
    int i=0;
    while(i<n && s[i]!='$'){
        if (s.substr(i,6)=="eraser"){
            i+=6;
        }else if(s.substr(i,5)=="erase"){
            i+=5;
        }else if(s.substr(i,7)=="dreamer"){
            if (s[i+7]=='a') i+=5;
            else i+=7;
        }else if(s.substr(i,5)=="dream"){
            i+=5;
        }else{
            cout<<"NO\n";
            return 0;
        }
    }
    cout<<"YES\n";
    return 0;
}


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

typedef long long ll;
typedef unsigned long long int ull;
#define endl "\n"
#define pb push_back
#define sq(a) (a)*(a)
#define all(x) (x).begin(), (x).end()
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugv(v) cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;
#define MOD 1000000007
#define PI 3.141592653589793238
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);

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

ll exp(ll x,ll n,ll mod)
{
    ll result=1;
    while(n)
    {
        if(n & 1)
            result=(result * x)%mod;
        x=(x*x)%mod;
        n=n>>1;
    }
    return result;
}



int32_t main()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    IOS

    ll x,y;
    cin>>x>>y;
    if(y%2)
    	cout<<"No"<<endl;
    else
    {
 		ll l=2*x,r=4*x;
 		if(y>=l&&y<=r)
 			cout<<"Yes"<<endl;
 		else
 			cout<<"No"<<endl;
    }
    
    return 0;
}

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

int a[100]{};

void trace(int a[], int n) {
    for(int i = 0; i < n; i++) {
        if(i > 0)
            cout << " ";
        cout << a[i];
    }
    cout << endl;
}

void insertionSort(int a[], int n) {
    for(int i = 1; i < n; i++) {
        int v = a[i];
        int j = i - 1;
        while(j >= 0 && a[j] > v) {
            a[j + 1] = a[j];
            j--;
        }
        a[j + 1] = v;
        trace(a, n);
    }
}

int main() {
    int n;
    
    cin >> n;
    
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    
    trace(a, n);
    insertionSort(a, n);
    
    return 0;
}


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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //[summary]B - Roller Coaster
            var line = ReadLine();
            int N = line[0];
            int K = line[1];

            var h = ReadLine();

            Console.WriteLine(h.Count(x => x >= K));
        }

        static List<int> ReadLine()
        {
            var line = Console.ReadLine();
            var arr = line.Split(' ');

            return arr.Select(x => int.Parse(x)).ToList();
        }
    }
}

Measured memory_bytes: 18912
# li = list(map(int, input().split()))
s = input()
n = len(s)
a = n; b = -1;
for i in range(n):
	if s[i] == 'C':
		a = i
		break
for i in range(n-1, -1, -1):
	if s[i] == 'F':
		b = i
		break
if b < a:
	print('No')
else:
	print("Yes")

Measured memory_bytes: 61480
#include<iostream>
using namespace std;
int main()
{
	int W,H,x,y,r;
	cin >> W >> H >> x >> y >> r;
	if(x-r<0 || x+r>W || y-r<0 || y+r>H){
		cout << "No\n";
	}
	else{
		cout << "Yes\n";
	}
	return 0;
}

Measured memory_bytes: 1124
#include <stdio.h>
     
int main(void)
{
int H,W,A,B;
(void)scanf("%d %d %d %d",&H,&W,&A,&B);
	for (int i=0; i<H; i++) {
		for (int j=0; j<W; j++) {
			putchar('0'+((i<B)^(j<A)));
		}
		putchar('\n');
	}
return 0;
}



Measured memory_bytes: 1152
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define RREP(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()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;

const ll MOD = 1000000007;

int main(void){
    int n;
    cin >> n;
    vector <ll> a(n);
    REP(i,n) cin >> a[i];
    ll ans=0;
    ll x=0;
    REP(i,n){
        ans=(ans+a[i]*x)%MOD;
        x=(x+a[i])%MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4780