akhauriyash/Code-Regression huggingface dataset:
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	sc := NewScanner()
	N, A, B := sc.NextInt(), sc.NextInt(), sc.NextInt()

	a := A + (N-2)*A + B
	b := A + (N-2)*B + B
	fmt.Println(max(0, b-a+1))
}

func max(a int, b int) int {
	if a < b {
		return b
	}
	return a
}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


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

bool visited[100001] = {false};
int h[100001] = {0};
int memo[100001] = {0};
int K;

int mc(int N)
{
    if (N == 1)
    {
        memo[1] = 0;
        visited[1] = true;
        return 0;
    }
    else if (N == 2)
    {
        memo[2] = abs(h[2] - h[1]);
        visited[2] = true;
        return memo[2];
    }
    else
    {
        if (visited[N])
        {
            return memo[N];
        }
        else
        {
            int j, min_val = INT_MAX;
            for(j=1; j<=K; j++)
            {
                if (N-j >= 1)
                {
                    min_val = min(min_val, mc(N-j) + abs(h[N] - h[N-j]));
                }
            }
            visited[N] = true;
            memo[N] = min_val;
            return memo[N];
        }
    }
}

int main()
{
	int n, i;
	cin>>n>>K;
	
	for(i=1; i<=n; i++)
	{
	    cin>>h[i];
	}
	
	cout<<mc(n);
	return 0;
}


Measured memory_bytes: 5760
#include "bits/stdc++.h"
#define ed cout<<"\n";
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define All(obj) (obj).begin(),(obj).end()

using namespace std;


int main() {
	speed;
	int x, y;
	cin >> x >> y;
	int ans = x + y / 2;
	cout << ans;
	ed;
	return 0;
}


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

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





Measured memory_bytes: 256
var input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
var obj = {
  "list" : input, "index" : 0, "max" : input.length,
  "hasNext" : function(){return (this.index < this.max);},
  "next" : function(){
    if(!this.hasNext()){throw "NoSuchElementException:次に要素は無いよ";}
    var returnObj = this.list[this.index];
    this.index++;
    return returnObj;
  }
}
Main();
function next(){return obj.next();}
function nextInt(){return myconv(next(),1);}
function nextStrArray(){return myconv(next(),2);}//半角スペース分割
function nextIntArray(){return myconv(next(),4);}//半角スペース + 数値化
function nextCharArray(){return myconv(next(),6);}//1文字分割
function hasNext(){return obj.hasNext();}
function myout(t){console.log(t);}//標準出力
function myerr(t){console.error(t);}//標準エラー出力
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す　1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
  var one = nextIntArray();
  var N = one[0];
  var K = one[1];
  var list = nextIntArray();
  var output = 0;
  for(var i = 0; i < N; i++){
    if(list[i] >= K){
       output++;
    }
  }
  myout(output);
}

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

const int N = 2e5 + 10;
int n, a[N], b[N], tmp[N];

void merge(int *arr, int mid) {
    int left = 0, right = mid;
    for (int i = 0; i < n; ++i) {
        if (left >= mid) tmp[i] = arr[right++];
        else if (right >= n) tmp[i] = arr[left++];
        else if (arr[left] <= arr[right]) tmp[i] = arr[left++];
        else tmp[i] = arr[right++];
    }
    copy(tmp, tmp + n, arr);
    // printf("%d\n", mid);
    // for (int i = 0; i < n; ++i)
        // printf("%d ", arr[i]);
    // puts("");
    for (int i = 0; i < n - 1; ++i) assert (arr[i] <= arr[i + 1]);
}

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]);
    sort(a, a + n); sort(b, b + n);
    int ans = 0;
    for (int digit = 29; digit >= 0; --digit) {
        int counter = 0;
        // for (int i = 0; i < n; ++i)
        //     printf("%d ", b[i]);
        // puts("");
        for (int i = 0; i < n; ++i) {
            int counts = lower_bound(b, b + n, (1 << (digit + 1)) - a[i])
                       - lower_bound(b, b + n, (1 << digit) - a[i]);
            int countt = 0;
            if (digit < 29)
                countt = lower_bound(b, b + n, (1 << (digit + 2)) - a[i])
                       - lower_bound(b, b + n, (1 << (digit + 1)) + (1 << digit) - a[i]);
            // printf("%d %d %d %d %d\n", (1 << digit) - a[i], (1 << (digit + 1)) - a[i], (1 << (digit + 1)) + (1 << digit) - a[i], counts, countt);
            counter += (counts + countt) % 2;
        }
        // cout << counter << endl;
        if (counter % 2) ans += (1 << digit);

        int idx = lower_bound(a, a + n, 1 << digit) - a;
        for (int i = idx; i < n; ++i)
            a[i] %= (1 << digit);
        merge(a, idx);

        idx = lower_bound(b, b + n, 1 << digit) - b;
        for (int i = idx; i < n; ++i)
            b[i] %= (1 << digit);
        merge(b, idx);
    }
    cout << ans << endl;
}

Measured memory_bytes: 2560
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

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

func gcd3(a, b, c int) int {
	return gcd(gcd(a, b), c)
}

// 文字列を1行取得
func StrStdin() (stringInput string) {
	scanner := bufio.NewScanner(os.Stdin)

	scanner.Scan()
	stringInput = scanner.Text()

	stringInput = strings.TrimSpace(stringInput)
	return
}

// 整数値1つ取得
func IntStdin() (int, error) {
	stringInput := StrStdin()
	return strconv.Atoi(strings.TrimSpace(stringInput))
}

func main() {
	K, _ := IntStdin()

	ans := 0
	// for i := 1; i <= K; i++ {
	// 	for j := i; j <= K; j++ {
	// 		for k := j; k <= K; k++ {
	// 			a := gcd3(i, j, k)
	// 			if i == j && j == k {
	// 				ans += a
	// 			} else if i == j || j == k {
	// 				ans += a * 3
	// 			} else {
	// 				ans += a * 3 * 2
	// 			}
	// 		}
	// 	}
	// }
	// 全探索バージョン
	for i := 1; i <= K; i++ {
		for j := 1; j <= K; j++ {
			for k := 1; k <= K; k++ {
				ans += gcd(gcd(i, j), k)
			}
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 1784
#include<iostream>

using namespace std;

int main(){
   int arr[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
   int k;cin>>k;
   cout<<arr[k-1];

}

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

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


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

const int N = 100 * 1000 + 10;

int n, ans;
int par[N];
bool Simple[N];
vector <int> adj[N];

void input() {
    cin >> n;

    int u, v;
    for (int i = 0; i < n - 1; i++) {
        cin >> u >> v;
        adj[v].push_back(u);
        adj[u].push_back(v);
    }
    return;
}

void PrePros(int &v) {
    bool res = true;
    for (int i = 0; i < adj[v].size(); i++)
        if (adj[v][i] != par[v]) {
            par[adj[v][i]] = v;
            PrePros(adj[v][i]);
            res &= Simple[adj[v][i]];
        }

    if (res && adj[v].size() <= 2)
        Simple[v] = true;
    return;
}

void DFS(int &v) {
    if (adj[v].size() == 1) {
        ans++;
        return;
    }

    bool ignore = true;
    for (int i = 0; i < adj[v].size(); i++)
        if (adj[v][i] != par[v])
            if (ignore && Simple[adj[v][i]] && adj[v].size() > 2)
                ignore = false;
            else
                DFS(adj[v][i]);
    return;
}

void solve() {
    for (int i = 0; i < n; i++)
        if (adj[i].size() > 2) {
            par[i] = -1;

            PrePros(i);
            Simple[i] = false;

            DFS(i);
            return;
        }

    ans = 1;
    return;
}

int main() {
    input();
    solve();
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 7808
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const long long LINF=8931145141919364364,LMOD=998244353;
// const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

long long f(long long b,long long n){
    if(n<b) return n;
    return f(b,n/b)+n%b;
}

int main(){
    long long n,s; cin>>n>>s;
    if(n==s) cout<<n+1<<endl;
    else{
        for(long long b=2;b*b<=n;b++){
            if(f(b,n)==s){
                cout<<b<<endl;
                return 0;
            }
        }
        long long ans=-1;
        for(long long x=1;x*x<n;x++){
            long long b=(n-s)/x+1;
            if(b>=2&&f(b,n)==s){
                ans=b;
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 384
import numpy as	np
N,K=map(int,input().replace('\n','').split())
P=list(map(int,input().replace('\n','').split()))

s=np.sum(P[0:K])
m=s
for i in range(1,N-K+1):
  s=s-P[i-1]+P[i+K-1]
  if s>=m:
    m=s
	
print((m+K)/2)

Measured memory_bytes: 33984
<?php
/**
 * ABC121
 * C - Energy Drink Collector
 */

// $s = trim(fgets(STDIN));
// fscanf(STDIN, "%d %d", $a, $b);
// $n = array_map('intval', explode(' ', trim(fgets(STDIN))));

fscanf(STDIN, "%d %d", $N, $M);
for ($i = 0; $i < $N; $i++) {
    fscanf(STDIN, "%d %d", $stores[$i]['price'], $stores[$i]['number']);
}

array_multisort(array_column($stores, 'price'), SORT_ASC, $stores);

$total_number = 0;
$total_price = 0;
foreach ($stores as $store) {
    if ($store['number'] + $total_number >= $M) {
        $total_price += $store['price'] * ($M - $total_number);
        break;
    }
    $total_number += $store['number'];
    $total_price += $store['price'] * $store['number'];
}

echo $total_price, PHP_EOL;


Measured memory_bytes: 63092
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <bitset>
#include <utility>
#include <ctime>
#include <cassert>
#include <climits>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
typedef vector<pii > vii;
typedef vector<pair<int, pair<int, int> > > viii;
typedef pair<ll,ll> pll;
typedef vector<string> vs;
typedef vector<vii> vvii;

#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define MEM(a,b) memset(a,(b),sizeof(a))
#define tr(c,it) for(typeof((c).begin()) it = (c).begin(); it != (c).end(); it++)
#define all(a) a.begin(),a.end()
#define loop(x,a,b) for(int (x) = (a);(x)<(b);(x)++)
#define rep(x,n)   for(int (x)=0;(x)<(n);(x)++)
#define present(c,x) ((c).find(x) != (c).end()) 
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define ain(a,n) int ((a)[(n)]); for(int i=0; i<(n); i++) cin>>((a)[i])  
#define md 1000000007
#define MAXN 200005

int main()
{   
    ios::sync_with_stdio(false);
    cin.tie(0);
    int x,y;
    cin>>x>>y;
    int ans = 1e9 + 100;
    if(y > x)
    	ans = min(ans,y-x);
    if(1LL * x* y > 0)
    	ans = min(ans,2+abs(x-y));
    if(1LL * x * y <= 0)
    	ans = min(ans,1 + abs(abs(x)-abs(y)));
    cout<<ans<<"\n";

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
inline void chmin (long long& a, long long b) {
  if (a > b) a = b;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<pair<int, int>> dat(2 * n);
  for (int i = 0; i < n; i++) {
    cin >> dat[2 * i].first >> dat[2 * i + 1].first;
    dat[2 * i].second = dat[2 * i + 1].second = i;
  }
  sort(dat.begin(), dat.end());
  int q = 2;
  int a, b;
  while (q--) {
    vector<int> ckd(n, false);
    a = dat[2 * n - 1].first;
    for (int i = 0; i < 2 * n; i++) {
      int ind = dat[i].second;
      if (ckd[ind]) {
        a -= dat[i].first;
        break;
      }
      ckd[ind] = true;
    }
    reverse(dat.begin(), dat.end());
    swap(a, b);
  }
  b = -b;
  long long ret = (long long)a * b;
  if (dat[0].second == dat[2 * n - 1].second) {
    cout << ret << '\n';
    return 0;
  }
  int l(1), r(1);
  vector<int> mlt(n);
  int cnt(0);
  long long c = (long long)dat[2 * n - 1].first - dat[0].first;
  while (r < 2 * n || cnt == n) {
    if (cnt < n) {
      int nxt = dat[r].second;
      if (!mlt[nxt]) cnt++;
      r++;
      mlt[nxt]++;
    } else {
      chmin(ret, c * (dat[r - 1].first - dat[l].first));
      int nxt = dat[l].second;
      l++;
      mlt[nxt]--;
      if (!mlt[nxt]) cnt--;
    }
  }
  cout << ret << '\n';
  return 0;
}

Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

template<class Itr> auto rle(Itr first, Itr last) {
  V< pair<decltype(*first), int> > res;
  for (; first != last; ++first) {
    if (res.empty() or res.back().first != *first) {
      res.emplace_back(*first, 1);
    } else {
      ++res.back().second;
    }
  }
  return res;
}

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int n; cin >> n;
  string s; cin >> s;
  cout << rle(begin(s), end(s)).size() << '\n';
}

Measured memory_bytes: 2500
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
map<ll, ll> prime_factor(ll n) {
	map<ll, ll> ret;
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			ret[i]++;
			n /= i;
		}
	}
	if (n != 1) ret[n] = 1;
	return ret;
}

const long long MOD = 1000000007;
//const long long MOD = 998244353;
const long long INF = 1LL << 60;



const long double PI = 3.14159265359;
const int MAX_N = 100010;



signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	string s; cin >> s;
	int ans = 0;
	rep(i, n - 2) {
		if (s[i] == 'A'&&s[i + 1] == 'B'&&s[i + 2] == 'C')ans++;
	}
	cout << ans << endl;
	return 0;
}

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

int main() {
	int n, l;
	cin >> n >> l;
	string s[n];
	for (int i = 0; i < n; ++i) {
		cin >> s[i];
	}
	sort(s, s + n);
	for (int i = 0; i < n; ++i) {
		cout << s[i];
	}
	return 0;
}

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


/* macro */
#define rep(i,a,b) for(int i=a;i<b;i++)
#define revrep(i,a,b) for(int i = a; i > b; i--)
#define int long long
#define exist(s,e) ((s).find(e)!=(s).end())
#define all(v) (v).begin(), (v).end()
#define each(s,itr) for(auto (itr) = s.begin(); (itr) != s.end(); (itr)++)
#define sum(v) accumulate(all(v), (0LL))
#define sec second
#define fir first
#define pb push_back



/* alias */
template<class T> using vec = vector<T>;
typedef vector<int> vi;
typedef pair<int, int> pi;


/* constant */
//const int inf = pow(2, 62);
//const int mod = 1e9 + 7;
const int mod = 100000;
int dx[8]={1,0,-1,0,-1,1,-1,1};
int dy[8]={0,1,0,-1,-1,-1,1,1};



/* io_method */
int input(){int tmp;cin >> tmp;return tmp;}
string raw_input(){string tmp;cin >> tmp;return tmp;}
string readline(){string s;getline(cin, s);return s;}
template<class T> void printx(T n){cout << n;}
template<class T, class U> void printx(pair<T, U> p){cout << "(" << p.first << "," << p.second << ")";}
template<class T> void printx(vector<T> v){cout << "{";rep(i,0,v.size()){printx(v[i]);if(i != v.size()-1)printx(",");}cout << "}";}
template<class T> void print(T n){printx(n);cout << endl;}
template<class T> void print(set<T> s){cout << "{";each(s, e){if(e != s.begin()) printx(",");printx(*e);}cout << "}" << endl;}
template<class T, class U> void print(map<T, U> mp){cout << "{";each(mp, e){cout << "(" << e -> first << "," << e -> second << ")";}cout << "}" << endl;}


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




/* main */



signed main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    

    rep(i,0,3) printx(raw_input()[0]);

    print("");


    
    



    
    

    







   




    

    

    




    



    



    

 
    
    


    

    
   
    













}






    










    




    










Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int,null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define ordered_set_pair tree<pair<int,int>,null_type,less<pair<int,int>>, rb_tree_tag,tree_order_statistics_node_update> 
#define ordered_set_mutiset tree<int,null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
typedef long long int ll;
typedef long double ld;
typedef unsigned long long int ull;
typedef pair<int,int> pi; 
#define PI 3.1415926535897932384
#define FOR(i,vv,n) for(ll i=vv;i<n;i++)
#define FORR(i,n,vv) for(ll i=n-1;i>=vv;i--)
#define ve vector 
#define maxind(v) (max_element(v.begin(),v.end())-v.begin())
#define minind(v) (min_element(v.begin(),v.end())-v.begin())
#define maxe(v) *max_element(v.begin(),v.end())
#define mine(v) *min_element(v.begin(),v.end())
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define eb emplace_back
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mp make_pair
#define M 1000000007ll
#define INF 1000000000000000000ll
#define PRECISE cout.precision(18);
#define all(v) v.begin(),v.end()
#define BS(v,n) binary_search(all(v),n)
#define srt(v) sort(v.begin(),v.end())
#define rsrt(v) sort(all(v),greater <ll>())
#define uni(v) v.resize(unique(all(v))-v.begin())
#define F first
#define S second
#define GET(i,p) get<p>(i)




int main(){

	#ifndef ONLINE_JUDGE
    // for getting input from input.txt	
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
	 #endif

    FAST
	//PRECISE


ll s;
cin>>s;
ll maxn=s/3+10;
ve <ve <ll> > dp(maxn,ve <ll> (s+1));
ll ans=0;
dp[0][0]=1;
FOR(i,1,maxn){
	FOR(j,0,s+1){
		if(j-1>=0)
		dp[i][j]=dp[i][j-1];
		if(j-3>=0&&i-1>=0)
			dp[i][j]=dp[i][j]+dp[i-1][j-3],dp[i][j]%=M;
	}
	ans+=dp[i][s];
	ans%=M;
}  
cout<<ans;

return 0;
 }



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

int main(){
	int t[10], n[10], c[10];
	for(int i = 0; i < 4; i++){
		cin>>t[i]>>n[i];
		if(t[i] == 1) c[i] = n[i] *6000;
		else if(t[i] == 2)c[i] = n[i] *4000;
		else if(t[i] == 3)c[i] = n[i] *3000;
		else if(t[i] == 4)c[i] = n[i] *2000;
	}

	for(int i = 0; i < 4; i++){
		cout<<c[i]<<endl;
	}
	return 0;
}



Measured memory_bytes: 3108
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <array>
#include <cmath>
#include <iterator>
#include <utility>
#include <set>
#include <random>
#include <map>
#include <stack>
#include <queue>
#include <list>

using namespace std;

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if (a * b > c * d)
    {
        cout << a*b << endl;
    }
    else if (a * b < c * d)
    {
        cout << c*d << endl;
    }
    else
    {
        cout << a*b << endl;
    }
    return 0;
}

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

using namespace std;
typedef long long ll;
//#define int ll
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
#define FOR(i, a, b) for (int i = a; i < b; ++i)

typedef pair<int, int> pii;
typedef pair<double, int> pdi;

const int INF = 1000 * 1000 * 1000 + 10;
const ll INFLL = 1000ll * 1000 * 1000 * 1000 * 1000 * 1000;

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

#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif

    string s;
    cin >> s;

    if (s[0] == s[1] && s[2] == s[3] && s[1] != s[2] ||
        s[0] == s[2] && s[1] == s[3] && s[1] != s[0] ||
        s[1] == s[2] && s[0] == s[3] && s[0] != s[2])
        cout << "Yes\n";
    else
        cout << "No\n";
}

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

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

  vector<ll> p(n);
  rep(i, n) cin >> p[i];

  ll _min = p[0];
  ll ans = 1;
  for (ll i = 1; i < n; i++) {
    _min = min(_min, p[i]);
    if (_min >= p[i]) {
      ans++;
    }
  }

  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<math.h>

using namespace std;

int main(){
  int k, n, flag, answer = 0, dummy;
  cin >> n;
  cin >> k;
  for(int i = 0; i < n; ++i){
    cin.ignore();
  }

  if((n - 1) % (k - 1) != 0){
    ++answer;
  }
  answer += (n -1) / (k - 1);

  cout << answer << endl;

  return 0;
}

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

ll searchx(const vector<ll>& s, const vector<ll>& t, ll x);
ll searchst(const vector<ll>& s, ll x);

int main() {
    ll a, b, q;
    cin >> a >> b >> q;
    vector<ll> s(a);
    vector<ll> t(b);
    for (ll i = 0;i < a;++i)cin >> s[i];
    for (ll i = 0;i < b;++i)cin >> t[i];
    for (ll i = 0;i < q;++i) {
        ll x;
        cin >> x;
        ll ans = searchx(s, t, x);
        ans = min(ans, searchx(t, s, x));
        cout << ans << endl;
    }
}

//xから始めて、先にsを訪れてそのあとtを訪れる時の最小値
ll searchx(const vector<ll>& s, const vector<ll>& t, ll x) {
    auto it = lower_bound(s.begin(), s.end(), x);
    if (it == s.end()) {
        return abs(x - s.back()) + searchst(t, s.back());
    }
    else if (it == s.begin()) {
        return abs(x - s.front()) + searchst(t, s.front());
    }
    else {
        ll ret = abs(x - *it) + searchst(t, *it);
        ret = min(ret, abs(x - *(it - 1)) + searchst(t, *(it - 1)));
        return ret;
    }
}

//xからsを訪れる最小値
ll searchst(const vector<ll>& s, ll x) {
    auto it = lower_bound(s.begin(), s.end(), x);
    if (it == s.end()) {
        return abs(x - s.back());
    }
    else if (it == s.begin()) {
        return abs(x - s.front());
    }
    else {
        return min(abs(x - *it), abs(x - *(it - 1)));
    }
}

Measured memory_bytes: 4844
/* kadai3_3
   Saikyo_Kazune
*/
#include <stdio.h>
int pow(int K,int L){
    if(L==0){
        return 1;
    }
    else if(L%2==1){
        return K*pow(K,L-1);
    }
    else{
        return pow(K,L/2)*pow(K,L/2);
    }
}

int main(void){
   //int型　N,K,桁数ようにLを宣言
   int N,K,L=1;
   scanf("%d %d",&N,&K);
   while(N/pow(K,L)!=0){
       L++;
   }
   printf("%d\n",L);

    return 0;
}

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

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define REPV(iter, v) for(auto (iter)=(v).begin(); (iter)!=(v).end();++(iter))
#define ALL(v) (v).begin(),(v).end()

#define MOD 1000000007

using namespace std;

typedef long long ll;

const int MAX = 1000005;

ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main()
{
    ll X, Y;
    cin >> X >> Y;

    COMinit();
    ll ans = 0;
    for (ll i = 0; i <= X; ++i)
    {
        if (2 * i <= Y)
        {
            ll j = Y - 2 * i;
            if ((i + 2 * j) == X && (2 * i + j) == Y)
            {
                ans = (ans + COM(i + j, j)) % MOD;
            }
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 23680
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    _ = int(input())
    H = list(map(int, input().split()))

    result = postion = 0
    for h in H:
        result += max(h - postion, 0)
        postion = h
    print(result)


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
import sys
from collections import Counter, deque, defaultdict
from math import factorial
import heapq, bisect
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

n, k = MAP()
h = LIST()
count = 0
for i in h:
    if i >= k:
        count += 1
print(count)

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

int main(void){
    int n, m;
    cin >> n >> m;
    int k1;
    cin >> k1;
    vector<int> sai(k1), kazoe(k1);
    for (int i = 0; i < k1; i++) cin >> sai[i];
    for (int i = 0; i < n - 1; i++){
        int a;
        cin >> a;
        for (int j = 0; j < a; j++){
            int b;
            cin >> b;
            for (int k = 0; k < k1; k++){
                if (b == sai[k]) {
                    kazoe[k]++;
                }
            }

        }

    }
    int count = 0;
    for (int i = 0; i < k1; i++){
        if (kazoe[i] == n - 1) count++;
    }
    cout << count << endl;
    return 0;
}

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

int main()
{
  int h, w;
  cin >> h >> w;
  vector<vector<char>> vv(h, vector<char>(w));
  for (int i = 0; i < h; i++)
    for (int j = 0; j < w; j++)
      cin >> vv.at(i).at(j);

  for (int i = 0; i < h; i++)
  {
    bool is_white = true;
    for (int j = 0; j < w; j++)
    {
      if (vv.at(i).at(j) == '#')
      {
        is_white = false;
        break;
      }
    }
    if (is_white)
      for (int j = 0; j < w; j++)
        vv.at(i).at(j) = 'N';
  }

  for (int i = 0; i < w; i++)
  {
    bool is_white = true;
    for (int j = 0; j < h; j++)
    {
      if (vv.at(j).at(i) == '#')
      {
        is_white = false;
        break;
      }
    }
    if (is_white)
      for (int j = 0; j < h; j++)
        vv.at(j).at(i) = 'N';
  }

  for (int i = 0; i < h; i++)
  {
    bool exists = false;
    for (int j = 0; j < w; j++)
    {
      if (vv.at(i).at(j) != 'N')
      {
        cout << vv.at(i).at(j);
        exists = true;
      }
    }
    if (exists)
      cout << endl;
  }
  return 0;
}


Measured memory_bytes: 256
// review
#include <iostream>

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

int N, K;
ll dp[2100];

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

ll mod_inv(ll x) {
  return mod_pow(x, MOD - 2) % MOD;
}

ll nCr(ll n, ll r) {
  if (n < r) {
    return 0;
  }
  return (dp[n] * mod_inv(dp[r]) % MOD) * mod_inv(dp[n-r]) % MOD;
}

void solve() {
  dp[0] = dp[1] = 1;
  for (int i=2;i<2100;i++) {
    dp[i] = i * dp[i-1] % MOD;
  }
  for (int i=1;i<=K;i++) {
    ll sum = nCr(K - 1, i - 1) * nCr(N - K + 1, i) % MOD;
    cout << sum << endl;
  }
}

int main() {
  cin >> N >> K;
  solve();
}


Measured memory_bytes: 256
def main():
    n,m = map(int,input().split())
    d = dict()
    for i in range(m):
        a,b = input().split()
        a = int(a)
        if a not in d:
            d[a] = [0]
        if d[a][-1] != "AC":
            d[a].append(b)
    ac = 0
    pe = 0
    #print(d)
    for i in d.values():
        #print(i)
        if i[-1] == "AC":
            ac += 1
            pe += i.count("WA")
    print(ac,pe)








if __name__ == '__main__':
    main()


Measured memory_bytes: 29380
#include <iostream>
#include <string>
#include <map>
#include <vector>

using namespace std;

string s;
int p;
int T;

int number()
{
	int res = s[p] - '0';
	p++;
	return res;
}

int formula()
{
	int res = number();
	for (;;) {
		if (s[p] == '*') {
			p++;
			res *= number();
		} else {
			break;
		}
	}
	return res;
}

int expr()
{
	int res = formula();
	for (;;) {
		if (s[p] == '+') {
			p++;
			res += formula();
		} else {
			break;
		}
	}
	return res;
}

int expr2()
{
	int res = number();
	for (;;) {
		if (s[p] == '+') {
			p++;
			res += number();
		}
		else if (s[p] == '*') {
			p++;
			res *= number();
		}
		else {
			break;
		}
	}
	return res;
}

int main()
{
	cin >> s >> T;

	bool l1, l2;
	p = 0;
	l1 = expr() == T;
	p = 0;
	l2 = expr2() == T;

	if (l1 && l2) cout << "U" << endl;
	if (l1 && !l2) cout << "M" << endl;
	if (!l1 && l2) cout << "L" << endl;
	if (!l1 && !l2) cout << "I" << endl;
}

Measured memory_bytes: 1200
N = int(input())
A = list(map(int, input().split()))
 
X = dict()
ans = 0
for i in range(N):
    L = i + A[i]
    if L not in X:
        X[L] = 1
    else:
        X[L] += 1

for j in range(N):
    R = j - A[j]
    if R in X:
        ans += X[R]

print(ans)

Measured memory_bytes: 40520
import collections
n=int(input())
A=list(map(int,input().split()))
B=[0]
for i in range(n):
  B.append(B[-1]+A[i])
C=collections.Counter(B)
C=list(C.values())
ans=0
for i in range(len(C)):
  ans=ans+C[i]*(C[i]-1)//2
print(ans)

Measured memory_bytes: 41716
n=int(input())
for i in range(n):
  a,b=map(int,input().split())
  if not i:
    c,d=a,b
  else:
    if c>a or d>b:
      p=c//a
      if c%a:
        p+=1
      q=d//b
      if d%b:
        q+=1
      r=max(p,q)
      c,d=a*r,b*r
    else:
      c,d=a,b
print(c+d)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <cstdlib>
#include <algorithm>
using namespace std;

int main(){
int h;
cin >> h;
int w;
cin >> w;
vector<string> a(h);
for(int i = 0; i < h; i++){
    cin >> a[i];
}
vector<bool> row(h, false);
vector<bool> col(w, false);
for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
        if(a[i][j] == '#'){
            row[i] = true;
            col[j] = true;
        }
    }
}

for(int i = 0; i < h; i++){
    if(row[i]){
        for(int j = 0; j < w; j++){
            if(col[j]){
                cout << a[i][j];
            }
        }
    cout << endl;
    }

}

}


Measured memory_bytes: 256
let a, b, k = Scanf.scanf " %d %d %d" @@ fun a b c -> a, b, c
let rec f i (a, b) = if i >= k then a, b else f (i + 1) @@ if i mod 2 = 0 then a / 2, b + a / 2 else a + b / 2, b / 2
let x, y = f 0 (a, b)
let _ = Printf.printf "%d %d\n" x y

Measured memory_bytes: 384
fun a1(args: Array<String>) {
    var bcnt:Long = 0
    var ans:Long = 0
    args[0].forEach {
        if (it == 'B') {
            bcnt++
        } else {
            ans += bcnt
        }
    }
    println(ans)
}

fun main(args: Array<String>) {
    a1(readLineList())
}

fun readLineList(): Array<String> {
    val lineList = mutableListOf<String>()
    while (true) {
        val line = readLine()
        if (line.isNullOrBlank()) {
            break
        } else {
            lineList.add(line!!)
        }
    }
    return lineList.toTypedArray()
}

Measured memory_bytes: 36376
#include <iostream>
#include <cstdio>

using namespace std;

int sheet[10 + 4][10 + 4];
int sx[] = {1, 0, -1, 0};
int sy[] = {0, -1, 0, 1};
int ssize = 4;
int mx[] = {1, 1, 1, 0, -1, -1, -1, 0};
int my[] = {1, 0, -1, -1, -1, 0, 1, 1};
int msize = 8;
int lx[] = {1, 1, 1, 0, -1, -1, -1, 0, 2, 0, -2, 0};
int ly[] = {1, 0, -1, -1, -1, 0, 1, 1, 0, -2, 0, 2};
int lsize = 12;

int main()
{
  int x, y, size;
  for (int i = 0; i < 15; i++) {
    fill(sheet[i], &sheet[i][15], 0);
  }
  while (scanf("%d,%d,%d ", &x, &y, &size) == 3) {
    //printf("%d,%d,%d\n", x, y, size);
    x += 2, y += 2;
    sheet[x][y]++;
    if (size == 1) {
      for (int i = 0; i < ssize; i++) {
	sheet[x + sx[i]][y + sy[i]]++;
      }
    } else if (size == 2) {
      for (int i = 0; i < msize; i++) {
	sheet[x + mx[i]][y + my[i]]++;
      }
    } else {
      for (int i = 0; i < lsize; i++) {
	sheet[x + lx[i]][y + ly[i]]++;
      }
    }
  }
  
  int max_w = 0, count = 0;;
  for (int i = 2; i <= 11; i++) {
    for (int j = 2; j <= 11; j++) {
      max_w = max(max_w, sheet[i][j]);
      if (sheet[i][j] == 0) {
	count++;
      }
    }
  }
  printf("%d\n%d\n", count, max_w);
}

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

#define MAX 100000

// int pertition(int A[], int r){
//     int x = A[r];
//     int i = -1;
//     for(int j = 0; j < r; j++){
//         if(A[j] <= x){
//             i++;
//             swap(A[i], A[j]);
//         }
//     }
//     swap(A[i+1], A[r]);

//     return i+1;
// }

int pertition(int A[], int p, int r){
    int x = A[r];
    int i = p - 1;
    for(int j = p; j < r; j++){
        if(A[j] <= x){
            i++;
            swap(A[i], A[j]);
        }
    }
    swap(A[i+1], A[r]);

    return i + 1;
}

int main(){
    int n, A[MAX];
    cin >> n;
    rep(i,n) cin >> A[i];
    
    int a = pertition(A, 0, n-1);

    rep(i,n){
        if(i) printf(" ");
        if(i == a){
            printf("[%d]", A[i]);
        }else{
            printf("%d", A[i]);
        }
    }

    printf("\n");

    return 0;
}


Measured memory_bytes: 3408
const input = require('fs').readFileSync('/dev/stdin', 'utf8');

const list = input.trim().split('\n');
const n = Number(list[0]);
const A = list[1].trim().split(' ');
const q = Number(list[2]);
const mi = list[3].trim().split(' ');

// const dp = {};
// const memo = (i, sum) => {
//   dp[sum] = true;
//   if (i === n) {
//     return;
//   }
//   memo(i + 1, sum);
//   memo(i + 1, sum + Number(A[i]));
// }
// memo(0, 0);

// for (let i = 0; i < q; i++) {
//   console.log(dp[mi[i]] ? 'yes' : 'no');
// }

const memo2 = (i, m) => {
  if (i === n) {
    return m === 0;
  }
  return memo2(i + 1, m) || memo2(i + 1, m - Number(A[i]));
}

for (let i = 0; i < q; i++) {
  console.log(memo2(0, Number(mi[i])) ? 'yes' : 'no');
}


Measured memory_bytes: 16812
#include <iostream>
using namespace std;
int main() {
    string s;
    cin>>s;
    for(int i=0; i<s.size(); i++){
        if(!((i%2==0 && s[i]=='R') || (i%2!=0 && s[i]=='L') || (s[i]=='U' || s[i]=='D'))){
            cout << "No\n";
            return 0;
        }
    }
    cout << "Yes\n";
    return 0;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

ll Pow(ll n,ll p){
	ll r=1;
	for(;p>0;p>>=1){
		if(p&1) r=(r*n)%mod;
		n=(n*n)%mod;
	}
	return r;
}

const int M=100005;
ll F[M];

void Init(){
	F[0]=1;
	for(int i=1;i<M;i++) F[i]=F[i-1]*i%mod;
}

ll Div(ll n,ll m){
	return n*Pow(m,mod-2)%mod;
}

ll nCk(ll n,ll k){
	return Div(F[n],F[n-k]*F[k]%mod);
}

ll n,k;
vl a;

ll f(){
	ll res=0;
	sort(a.rbegin(),a.rend());
	for(int i=0;i<n;i++) if(n-i>=k) (res+=(a[i]+mod)%mod*nCk(n-i-1,k-1))%=mod;
	for(int i=0;i<n;i++) a[i]*=-1;
	return res;
}

int main(){
	Init();
	cin>>n>>k;
	a=vl(n);
	for(auto &i:a) cin>>i;
	cout<<(f()+f())%mod<<endl;
}

Measured memory_bytes: 1792
#include<iostream>
using namespace std;
int main(){
    long long x,y,D;
    int i,c=0,N;
    cin >> N >> D;
    for(i=1;i<=N;i++){
        cin >> x >> y;
        if(x*x+y*y<=D*D){
            c+=1;
        }
    }
cout << c << endl;


}

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


void solve() {
    int n;
    cin >> n;
    int a = 0, b = 0, c = 0;
    for (int i = 1; i <= n; i++) {
        int t, x, y;
        cin >> t >> x >> y;
        int tt = t;
        t -= abs(x - a);
        t -= abs(y - b);
        t -= c;
        a = x, b = y, c = tt;
        if(t < 0 || t % 2) {
            cout << "No";
            return;
        }
    }
    cout << "Yes";
}


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


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

#define EACH(i, a) for (auto &&i : a)
#define FOR(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define RFOR(i, a, b) for (int i = (int)b - 1; i >= (int)a; --i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREPS(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(x) (x).begin(), (x).end()
#define MEMSET(v, h) memset((v), h, sizeof(v))
#define debug(x) cout << #x << ": " << x << endl

#define pb push_back
#define mp make_pair
#define F first
#define S second

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define INF (1L << 30)
#define MOD (1000000007)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

template <class T>
void pv(T a, T b) {
  for (T i = a; i != b; ++i) cout << *i << " ";
  cout << endl;
}
template <class T>
void pvp(T a, T b) {
  for (T i = a; i != b; ++i)
    cout << "(" << i->first << ", " << i->second << ") ";
  cout << endl;
}
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
int in() {
  int x;
  scanf("%d", &x);
  return x;
}

using ll = long long;
#define int ll

//**********

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

  string s;
  cin >> s;
  int n = s.length();

  vector<int> plus;
  vector<int> minus;
  int ans = 0;

  if (s[0] == '>') {
    plus.pb(0);
  }

  int cont = 1;

  REP(i, n - 1) {
    if (s[i] == s[i + 1]) {
      cont += 1;
    } else {
      if (s[i] == '>') {
        minus.pb(cont);
      } else {
        plus.pb(cont);
      }
      cont = 1;
    }
  }
  if (s[n - 1] == '<') {
    plus.pb(cont);
    minus.pb(0);
  } else {
    minus.pb(cont);
  }

  REP(i, plus.size()) {
    // cout << plus[i] << "," << minus[i] << "; ";

    if (plus[i] >= minus[i]) {
      ans += (plus[i] * (plus[i] + 1)) / 2;
      if (minus[i] > 0) {
        ans += (minus[i] * (minus[i] - 1)) / 2;
      }
    } else {
      ans += (minus[i] * (minus[i] + 1)) / 2;
      if (plus[i] > 0) {
        ans += (plus[i] * (plus[i] - 1)) / 2;
      }
    }
  }

  cout << ans << endl;

  return 0;
};


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

int main(){
	int a,b,c;
	cin >> a >> b >> c;
	int leave = a-b;

	cout << max(c - leave, 0) << endl;

	return 0;
}

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

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (m); i < (int)(n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define INF 2000000000

#ifdef LOCAL
  #define eprintf(...) fprintf(stdout, __VA_ARGS__)
#else
  #define eprintf(...) 0
#endif

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned int uint;

std::string join(const std::vector<std::string> &v, const std::string delim = "") {
  std::string result;
  for(unsigned int i = 0; i < v.size(); ++i) {
    result += v[i];
    if(i != v.size() - 1) {
      result += delim;
    }
  }
  return result;
}

int main() {
  int n, l;
  cin >> n >> l;
  vector<string> v(n);
  REP(i, n) {
    cin >> v[i];
  }
  sort(ALL(v));
  string ans = join(v);

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

const int MAX = 5e5;
int tree[1 << 20];
string s;


void init(int node, int left, int right) {
    if (left == right) {
        tree[node] = 1 << (s[left - 1] - 'a');
        return;
    }

    int mid = (left + right) >> 1;
    init(node << 1, left, mid);
    init(node << 1 | 1, mid + 1, right);

    tree[node] = tree[node << 1] | tree[node << 1 | 1];
}

void update(int node, int left, int right, int idx, char v) {
    if (idx < left || right < idx) {
        return;
    }

    if (left == right) {
        tree[node] = 1 << (v - 'a');
        return;
    }

    int mid = (left + right) >> 1;
    update(node << 1, left, mid, idx, v);
    update(node << 1 | 1, mid + 1, right, idx, v);
    tree[node] = tree[node << 1] | tree[node << 1 | 1];
}

int query(int node, int left, int right, int l, int r) {
    if (r < left || right < l) {
        return 0;
    }

    if (l <= left && right <= r) {
        return tree[node];
    }

    int mid = (left + right) >> 1;
    return query(node << 1, left, mid, l, r) | query(node << 1 | 1, mid + 1, right, l, r);
}


int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n, q;
    cin >> n;
    cin >> s;

    init(1, 1, n);
    cin >> q;
    for (int i = 0; i < q; ++i) {
        int a, b, c;
        char d;
        cin >> a >> b;
        if (a == 1) {
            cin >> d;
            update(1, 1, n, b, d);
        } else {
            cin >> c;
            cout << __builtin_popcount(query(1, 1, n, b, c)) << "\n";
        }
    }

    return 0;
}

Measured memory_bytes: 5020
#include<iostream>
#include<vector>
#define ll long long
using namespace std;
int b[200001];
int n;
ll po(ll a)
{
	return a * (a - 1) / 2;
}
int main()
{
	
	cin >> n;
	//int c = 0;
	vector<int>mo(n + 1, 0);
	for (int i = 0; i < n; i++)
	{
		cin >> b[i];
		++mo[b[i]];
		//c++;
	}
	ll ans = 0;
	for (int i = 1; i <= n; i++)
	{
		ans += po(mo[i]);
	}
	for (int i = 0; i < n; i++)
	{
		cout << ans - mo[b[i]] + 1 << endl;
	}
}

Measured memory_bytes: 4096
import itertools
import math
import numpy as np

N = int(input())

n_max = int(math.sqrt(N))
l = [i for i in range(1, n_max)]
score = np.zeros([10000]).astype(np.uint8)
for c in itertools.combinations_with_replacement(l, 3):
  sum = c[0]**2 + c[1]**2 + c[2]**2 + c[0]*c[1] + c[0]*c[2] + c[1]*c[2]
  if sum <= 10000:
    if len(set(c)) == 3:
      score[sum-1] += 6
    elif len(set(c)) == 2:
      score[sum-1] += 3
    else:
      score[sum-1] += 1
    
for n in range(1, N+1):
  ans = 0
  print(score[n-1])

Measured memory_bytes: 27448
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const int INF = 1001001001;
const double EPS = 1e-10;

int main(){
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)cin>>a[i];
    int dp[n+1];
    fill(dp,dp+n,INF);
    for(int i=0;i<n;i++){
        if(dp[i]<a[i])dp[i+1]=min(dp[i+1],a[i]);
        else{
            int idx=lower_bound(dp,dp+n,a[i])-dp;
            dp[idx]=min(dp[idx],a[i]);
        }
    }
    int ans=lower_bound(dp,dp+n,INF)-dp;
    cout<<ans<<endl;
}


Measured memory_bytes: 3868
#include <stdio.h>

int main(){
  int N,A,S=0;
  scanf("%d",&N);
  for(int i=1;i<=N;i++){
    scanf("%d",&A);
    if(i%2==1 && A%2==1) S++;
  }
  printf("%d\n",S);
  return 0;
}

Measured memory_bytes: 1700
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define sz(x) ((int)(x).size())
#define fill(v, h) memset((v), h, sizeof(v))
using namespace std;
const int MOD = 1000000007;

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

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

int main(void)
{
    vector<int> card = {1, 0, -1};
    vector<int64_t> v(3);
    int64_t k;
    for (int i = 0; i < 3; i++)
    {
        cin >> v.at(i);
    }
    cin >> k;

    int64_t ans = 0;
    for (int i = 0; i < 3; i++)
    {
        if (v.at(i) >= k)
        {
            cout << ans + card.at(i) * k << endl;
            return 0;
        }
        ans += card.at(i) * v.at(i);
        k -= v.at(i);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3628