akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  int n=s.size();
  vector<int> a(n);
  int cntr=0,cntl=0;
  bool c=false;
  for(int i=0;i<n;i++){
    int ans;
    if(c==false&&s[i]=='R'){
      cntr++;
    }
    if(c==true&&s[i]=='L'){
      cntl++;
    }
    if((c==true&&s[i]=='R')||(i==n-1)){
      c=false;
      if(cntr>=cntl){
        if((cntr-cntl)%2==1){
          if(cntr%2==1){
            a[ans]=(cntr+cntl+1)/2;
            a[ans+1]=(cntr+cntl)/2;
          }
          else{
            a[ans]=(cntr+cntl)/2;
            a[ans+1]=(cntr+cntl+1)/2;
          }
        }
        else{
          a[ans]=(cntr+cntl)/2;
          a[ans+1]=(cntr+cntl)/2;
        }
      }
      else{
        if((cntl-cntr)%2==1){
          if(cntl%2==0){
            a[ans]=(cntr+cntl+1)/2;
            a[ans+1]=(cntr+cntl)/2;
          }
          else{
            a[ans]=(cntr+cntl)/2;
            a[ans+1]=(cntr+cntl+1)/2;
          }
        }
        else{
          a[ans]=(cntr+cntl)/2;
          a[ans+1]=(cntr+cntl)/2;
        }
      }
      cntr=1;
      cntl=0;
    }
    if(s[i]=='R'&&s[i+1]=='L'){
      c=true;
      ans=i;
    }
  }
  for(int i=0;i<n;i++){
    cout << a[i] << " ";
  }
  cout << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main() {
  string str;
  cin >> str;
  int s_size;
  s_size = str.size();
  char first = str.at(0);
  char last = str.at(s_size - 1);
  
  cout << first << s_size - 2 << last << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define INF 2 << 29
#define MOD 1000000007
#define Yes(f) puts((f)? "Yes" : "No")
#define YES(f) puts((f)? "YES" : "NO")
int gcd(int a, int b) {
	if (b != 0)return gcd(b, a % b);
	return a;
}
int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}
using Graph = vector<vector<int>>;

int main(){
	string s; cin >> s;
	if(s == "SUN") cout << 7 << endl;
	if(s == "MON") cout << 6 << endl;
	if(s == "TUE") cout << 5 << endl;
	if(s == "WED") cout << 4 << endl;
	if(s == "THU") cout << 3 << endl;
	if(s == "FRI") cout << 2 << endl;
	if(s == "SAT") cout << 1 << endl;
}

Measured memory_bytes: 256
# mod. m での a の逆元 a^{-1} を計算する
# b * a^{-1} (mod m)を計算したい場合はb * modinv(a, m) % m
def modinv(a, m):
    b = m
    u = 1
    v = 0
    while b:
        t = int(a / b)
        a -= t * b
        a, b = b, a
        u -= t * v
        u, v = v, u
    u %= m
    if u < 0:
        u += m
    return u


# 高速な累乗計算
def pow_k(x, n):
    """
    O(log n)
    """
    if n == 0:
        return 1

    K = 1
    while n > 1:
        if n % 2 != 0:
            K *= x
        x *= x
        n //= 2

    return K * x
    
    
# 途中計算でmodを計算する高速な累乗計算
def pow_k_mod(x, n, m):
    """
    O(log n)
    """
    if n == 0:
        return 1

    K = 1
    while n > 1:
        if n % 2 != 0:
            K *= x
            K %= m
        x *= x
        x %= m
        n //= 2

    return (K * x) % m
    
n, a, b = map(int, input().rstrip().split())

max_num = pow_k_mod(2, n, int(1e9+7)) - 1
a = max(a, n - a)
b = max(b, n - b)

num_a = 1
for i in range(a+1, n+1):
    num_a *= i
    num_a %= int(1e9+7)
for i in range(1, n - a + 1):
    num_a = (num_a * modinv(i, int(1e9+7))) % int(1e9+7)
    
num_b = 1
for i in range(b+1, n+1):
    num_b *= i
    num_b %= int(1e9+7)
for i in range(1, n - b + 1):
    num_b = (num_b * modinv(i, int(1e9+7))) % int(1e9+7)
    
print((max_num - num_a - num_b) % int(1e9+7))

Measured memory_bytes: 43100
use proconio::{input, fastout};

fn cmp(ff: &(usize, usize), ll: &(usize, usize)) -> std::cmp::Ordering {
    use std::cmp::Ordering::*;
    if ff.0 < ll.0 { Less }
    else if ff.0 == ll.0 { Equal }
    else { Greater }
}

#[fastout]
fn main() {
    input! {
        n: usize, m: usize,
        ab: [(usize, usize); n],
    }

    let mut arr = ab.clone();
    arr.sort_by(cmp);
    let mut res = m;
    let mut ans = 0;
    for (a, b) in arr {
        if res <= b {
            ans += a*res;
            break;
        } else {
            ans += a*b;
            res -= b;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 7360
from heapq import heappush, heappop 
def main():
  INF = 10 ** 20
  n, m, s, t = map(int, input().split())
  s -= 1
  t -= 1
  init = 10 ** 15
  edges1 = [[] for _ in range(n)]
  edges2 = [[] for _ in range(n)]
  for _ in range(m):
    u, v, a, b = map(int, input().split())
    u -= 1
    v -= 1
    edges1[u].append((v, a))
    edges1[v].append((u, a))
    edges2[u].append((v, b))
    edges2[v].append((u, b))
  
  from_s = [INF] * n
  from_s[s] = 0
  que = []
  heappush(que, (0, s))
  while que:
    total, node = heappop(que)
    for to, dist in edges1[node]:
      if from_s[to] > total + dist:
        from_s[to] = total + dist
        heappush(que, (total + dist, to))
  
  from_t = [INF] * n
  from_t[t] = 0
  que = []
  heappush(que, (0, t))
  while que:
    total, node = heappop(que)
    for to, dist in edges2[node]:
      if from_t[to] > total + dist:
        from_t[to] = total + dist
        heappush(que, (total + dist, to))

  save = []
  for i in range(n):
    save.append(init - from_s[i] - from_t[i])
  save.reverse()
  acc = 0
  ans = []
  for s in save:
    acc = max(acc, s)
    ans.append(acc)
  ans.reverse() 
  for i in range(n):
    print(ans[i])

main()

Measured memory_bytes: 118816
import static java.util.Arrays.deepToString;
import static java.util.Arrays.fill;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		new Main().run();
	}
	void tr(Object... os) {
		System.err.println(deepToString(os));
	}

	Scanner sc = new Scanner(System.in);
	public void run() {
		for (;sc.hasNext();) {
			String s = sc.next();
			String ans;
			try {
				ans = decode(s.toCharArray());
			} catch (Exception e) {
				ans = "NA";
			}
			System.out.println(ans);
		}
	}

	char[][] tbl = {
		"afkpuz".toCharArray(),
		"bglqv.".toCharArray(),
		"chmrw?".toCharArray(),
		"dinsx!".toCharArray(),
		"ejoty ".toCharArray(),
	};
	String decode(char[] s) {
		if (s.length % 2 == 1) throw new IllegalArgumentException();
		char[] buf = new char[s.length / 2];
		for (int i = 0; i < s.length; i += 2) {
			int i1 = s[i] - '1';
			int i2 = s[i+1] - '1';
			buf[i/2] = tbl[i2][i1];
		}
		return new String(buf);
	}
}

Measured memory_bytes: 17168
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define ub upper_bound
#define lb lower_bound
#define all(v) ((v).begin()),((v).end())
#define allr(v) ((v).rbegin()),((v).rend())
#define ff first
#define ss second
#define mp make_pair
#define pll pair<ll,ll> 
#define fo(i,n) for(ll i=0;i<n;i++)
#define foa(i,s,e) for(ll i=(s);i<e;i++)
#define fod(i,s,e) for(ll i= (s);i>=(e);i--)
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define deb(x) cerr<<#x<<' '<<'='<<' '<<x<<'\n'
#define sz(x) (ll)(x.size())
#define ANS cout<<ans<<'\n'
#define YES cout<<"YES\n"
#define NO cout<<"NO\n"
#define Yes cout<<"Yes\n"
#define No cout<<"No\n"
const ld pi = 3.14159265358979323846;
ll MOD = 1e9 + 7;
//ll MOD = 998244353;
const char nl = '\n';
const ll inf = 1e15;
#define fill(a,b) memset(a, b, sizeof(a))
#define setbits(x) __builtin_popcountll(x)
#define print2d(dp,n,m) fo(i, n){fo(j, m)cout<<dp[i][j]<<" ";cout<<"\n";}
ll nxt(){ll x; cin >> x; return x;}
ll mul(ll x,ll y){
    return (1ll* (x%MOD)*(y%MOD));
}
ll modpow(ll x,ll y){ll z=1;while(y>0){if(y%2)z=mul(z,x);x =mul(x,x) ;y/=2;}return z;}
ll power(ll x,ll y){ll z=1;while(y>0){if(y%2)z=z*x;x =x*x ;y/=2;}return z;}
ll gcd(ll a,ll b){if(a<b) return gcd(b,a);if(b==0) return a;return gcd(b,a%b);} 
ll min(ll a,ll b){if(a<b)return a;return b;}
ll max(ll a,ll b){if(a>b)return a;return b;}
ll sq(ll a){
    ll ans = (1ll*a*a);
    return ans;
}

void solve(){
    string s;
    cin >> s;
    ll n = sz(s);
    ll sum = 0;
    fo(i, n){
        sum = sum + (ll)(s[i]-'0');
        sum %= 9;
    }
    if(!sum)Yes;
    else No;
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("inputf.txt" , "r" , stdin) ;
    freopen("outputf.txt" , "w" , stdout) ;
    freopen("error.txt" , "w" , stderr) ;
    #endif
    ll TC = 1;
    //cin>>TC;
    while(TC--){
        solve();
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}


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

using namespace std;

#define rep(i, x)   for (__typeof(x) i = 0; i < x; i++)
#define mp             make_pair
#define pb             push_back
#define fi             first
#define se             second
#define sz(x)          (int)((x).size())
#define all(x)         (x).begin(), (x).end()
#define sci(x)         int x;       scanf("%d", &x);
#define scii(x, y)     int x, y;    scanf("%d %d", &x, &y);
#define sciii(x, y, z) int x, y, z; scanf("%d %d %d", &x, &y, &z);
#define TC(x)          sci(x); while(x --)
#define eprintf(...)   fprintf(stderr, __VA_ARGS__)
#define debug(x)       { cerr << #x << " = " << x << endl; }
#define repi(i, x)  for (__typeof(x) i = x-1; i >= 0; i --)
#define fore(itr, x)   for (__typeof(x.begin()) itr = x.begin(); itr != x.end(); itr ++)
#define forei(itr, x)  for (__typeof(x.end()) itr = x.end() - 1; itr != x.begin() - 1; itr --)
typedef long long      ll;
typedef pair<int, int> ii;
typedef pair<ii, int>  iii;
typedef vector<int>    vi;
typedef vector<ii>     vii;
typedef vector<iii>    viii;
typedef vector<vector<int> > vvi;
const   int            infi = numeric_limits<int>::max();
const   double         eps = 0;
const   int            ms  = 0;



const int MAX = 510000;
const int MOD = 1000000007;

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

// 二項係数計算
long long 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;
}


vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

int main()
{
    ios::sync_with_stdio(false);//endl->"\n"
    cin.tie(0);
    int N, M;
    cin >> N >> M;
    if(N==1){
        cout << 1 << "\n";
        return 0;
    } 
    
    auto a = prime_factorize(M);

   
    COMinit();
    ll ans=1;
    
    for(auto n:a){
        ans = (ans * COM(n.second+N-1, N-1))%MOD;
    }

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

Measured memory_bytes: 12160
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <limits.h>
#include <string>
#include <vector>
#include <algorithm>
#include <map>

#ifndef ULLONG
typedef unsigned long long ULLONG;
#endif
#ifndef LLONG
typedef long long LLONG;
#endif
template <class _Ty> static _Ty tp_abs(const _Ty& a) {
	return ((a < 0) ? (a * -1) : a);
}
template <class _Ty> static _Ty tp_min(_Ty a, _Ty b) {
	return a < b ? a : b;
}
template <class _Ty> static _Ty tp_max(_Ty a, _Ty b) {
	return a > b ? a : b;
}
template<class T> static void getint(T& a) {
	const char* fmt = " %d";
	if (sizeof(T) == sizeof(long long)) {
		fmt = " %lld";
	}

	if (scanf(fmt, &a) < 0) {
		printf("g1int Error\n");
	}
}
template<class T> static void getint(T& a, T& b) {
	const char* fmt = " %d %d";
	if (sizeof(T) == sizeof(long long)) {
		fmt = " %lld %lld";
	}

	if (scanf(fmt, &a, &b) < 0) {
		printf("g2int Error\n");
	}
}
template<class T> static void getint(T& a, T& b, T& c) {
	const char* fmt = " %d %d %d";
	if (sizeof(T) == sizeof(long long)) {
		fmt = " %lld %lld %lld";
	}

	if (scanf(fmt, &a, &b, &c) < 0) {
		printf("g3int Error\n");
	}
}

static const int EduDp_INF = 1100000000;
static const int MOD_NUM = 1000000007;
static void C_task();

#if 1
int main()
{
	C_task();
	fflush(stdout);
	return 0;
}
#endif

static void C_task()
{
	int N;
	getint(N);

	std::vector<int> an(N + 1, 0), bn(N + 1, 0), cn(N + 1, 0);
	for (int i = 1; i <= N; i++) {
		int a, b, c;
		getint(a, b, c);
		an[i] = a;
		bn[i] = b;
		cn[i] = c;
	}

	std::vector<int> dp[3];
	for (int i = 0; i < 3; i++) {
		dp[i].resize(N + 1, 0);
		dp[i][0] = 0;
	}
	
	dp[0][1] = an[1];
	dp[1][1] = bn[1];
	dp[2][1] = cn[1];

	for (int i = 1; i <= N; i++) {

		dp[0][i] = tp_max(dp[1][i - 1] + an[i], dp[2][i - 1] + an[i]);
		dp[1][i] = tp_max(dp[0][i - 1] + bn[i], dp[2][i - 1] + bn[i]);
		dp[2][i] = tp_max(dp[0][i - 1] + cn[i], dp[1][i - 1] + cn[i]);
	}

	printf("%d\n", tp_max(dp[0][N], tp_max(dp[1][N], dp[2][N])));
}


Measured memory_bytes: 2560
#include <stdio.h>
#include <iostream>
#include <queue>
#include <string>
#include <algorithm>
#include <cstdio>
#include <stack>
#include <vector>
using namespace std;
long long a,b,m,c,d[5],o[101];
string s;
vector<int> v[101000],p[100010];



int main()
{
    scanf("%lld %lld %lld",&o[1],&o[2],&o[0]);
    long long k=1000000000000000000;
    for(int t=0;t<=2;t++)
    {
        d[t]=(o[t]%2)*o[(t+1)%3]*o[(t+2)%3];
        k=k<d[t] ? k:d[t];
    }
   // for(int t=0;t<=2;t++)
    //{
   //     printf("%d",d[t]);
   // }
    printf("%lld",k);
    return 0;
}

Measured memory_bytes: 4992
MOD = 10**9+7
n, m = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

if len(set(a)) < n or len(set(b)) < m:
    print(0)
    exit()
if max(a) != n*m or max(b) != n*m:
    print(0)
    exit()

a = sorted(a, reverse = True)
b = sorted(b, reverse = True)
i, j = 0, 0
ans = 1
for num in range(n*m, 0, -1):
    while i < n-1 and a[i+1] >= num:
        i += 1
    while j < m-1 and b[j+1] >= num:
        j += 1
        
    if a[i] == num and b[j] == num:
        pass
    elif a[i] == num:
        ans = (ans*(j+1))%MOD
    elif b[j] == num:
        ans = (ans*(i+1))%MOD
    else:
        cand = max((i+1)*(j+1) - (n*m - num), 0)
        ans = (ans*cand)%MOD
print(ans)


Measured memory_bytes: 3188
# include <bits/stdc++.h>
# define rep(i, n) for(ll i = 0; i < (n); ++i)
# define reps(i, n) for(ll i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(ll i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(ll i=((int)(n)); i>0; --i)
# define ll long long
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
# define P pair<int, int>
# define mp make_pair
# define x first
# define y second
using namespace std;
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() {
  int n, k; cin >> n >> k;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];

  rep(i, n-k){
    if(a[i] < a[i + k]) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}


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

using namespace std;
 
int main()
{
    string str;
   
    for (;;) {
	int cntA = 0, cntB = 0;
   
	cin >> str;
	if (str == "0") break;
     
	for (int i = 1; i < (int)str.size(); i++) {
	    if (str[i] == 'A') cntA++;
	    else cntB++;    
	}
     
	if (cntA > cntB) cntA++;
	else cntB++;
     
	cout << cntA << ' ' << cntB << endl;
    }
    return 0;
}

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

int selectionSort(vector<int> &v){
    int cnt = 0, size = v.size(), i, j, min;
    for(i = 0; i < size; i++){
        min = i;
        for(j = i; j < size; j++){
            min = v[j] < v[min] ? j : min;
        }
        if(i != min){
            int tmp = v[i];
            v[i] = v[min];
            v[min] = tmp;
            cnt++;
        }
    }
    return cnt;
}
void print(vector<int> &v){
    vector<int>::iterator ite = v.begin();
    while(ite != v.end()){
        if(ite != v.begin())
            cout << " ";
        cout << *ite;
        ite++;
    }
    cout << endl;
}
int main(){
    int n, x, i, cnt;
    vector<int> v;
    cin >> n;
    for(i = 0; i < n; i++){
        cin >> x;
        v.push_back(x);
    }
    cnt = selectionSort(v);
    print(v);
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 1220
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

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

ll mod(ll a){
  return (a % 1000000007);
}

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


int main(){
  ll a,b,h,m; cin >> a >> b >> h >> m;
  
  long double x = abs(5.5*m - 30*h)*acos(-1)/180.0;
  
  dec(15);
  
  cout << pow(a*a + b*b -2*a*b*cos(x),0.5) << endl;
  
}

Measured memory_bytes: 4128
import collections

N = int(input())

A = [x for x in input().split()]

c = collections.Counter(A)

ans = 0
for v in c.values():
  if v > 1:
    ans += (v*(v-1))//2

for i in range(N):
  z = c[A[i]] - 1   
  print(ans-z, sep="\n")

Measured memory_bytes: 26752
import math
n=int(input())
ans=10**10
for i in range(1,int(math.sqrt(n))+1):
    if n%i==0:
        tmp=0
        A=len(str(i))
        B=len(str(n//i))
        tmp=max(A,B)
        ans=min(ans,tmp)
print(ans)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define deb(x) cout<<x<<"\n";
#define deB(x,y) cout<<x<<" "<<y<<"\n";
#define Deb(x,y,z) cout<<x<<" "<<y<<" "<<z<<"\n";
#define YES cout<<"YES\n";
#define Yes cout<<"Yes\n";
#define NO cout<<"NO\n";
#define No cout<<"No\n";
#define clt(x) 63-__builtin_clzll(x)
#define bct(x) __builtin_popcountll(x)
#define all(v) (v).begin(),(v).end()
#define pi pair<ll,ll>
#define vi vector<ll>
#define vpi vector<pair<ll,ll>>
#define maxq priority_queue<ll>
#define minq priority_queue<ll,vector<ll>, greater<ll>>
#define cont continue;
#define reto return 0;
#define sz size()
#define spmod 1116295198451
#define mod 1000000007
#define md 998244353 
#define N 2e5+10
//typedef tree<int,null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update> //pbds;

bool cmp(pi a,pi q)
{
  return a.ff+a.ss<q.ff+q.ss;
}
bool qwe(pi a,pi q)
{
  return a.ff-a.ss<q.ff-q.ss;
}
bool wer(pi a,pi q)
{
  return a.ss-a.ff<q.ss-q.ff;
}
int main()
{
  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);
  ll n;
  cin>>n;
  vpi a(n);
  for(auto &x:a)
    cin>>x.ff>>x.ss;
  sort(all(a),cmp);
  ll ans=a[n-1].ff+a[n-1].ss-a[0].ff-a[0].ss;
  sort(all(a),qwe);
  ans=max(ans,a[n-1].ff-a[n-1].ss-a[0].ff+a[0].ss);
  sort(all(a),wer);
  ans=max(ans,-a[n-1].ff+a[n-1].ss+a[0].ff-a[0].ss);
  deb(ans)
}

Measured memory_bytes: 6300
package main

import (
	"fmt"
	"math"
)

func main() {
	var n int
	fmt.Scan(&n)
	x, y := make([]float64, n), make([]float64, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&x[i], &y[i])
	}
	var sum float64
	for i := 0; i < n; i++ {
		for j := 0; j < n; j++ {
			sum += math.Sqrt(math.Pow(x[i]-x[j], 2) + math.Pow(y[i]-y[j], 2))
		}
	}
	fmt.Println(sum / float64(n))
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define pb push_back
#define pf push_front
#define mod 1000000007
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK puts("OK")
#define OK1 puts("OK1")
#define OK2 puts("OK2")
#define SIZE(s) (int)s.size()
#define Cout(n) cout<<(n)<<endl
#define INF 1000000000000000000LL

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;
typedef vector<string> vs;
const double pi = acos(-1.0);

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

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

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

ll gcd(ll x, ll y) { return (y == 0) ? x : gcd(y, x % y); }
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }

bool IsPrime(int num){
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2){
        if (num % i == 0){
            return false;
        }
    }
    return true;
}

int main()
{
	ll x;
	cin >> x;
	while(1){
		if(IsPrime(x)) break;
		else x++;
	}
	cout << x << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int a,b;
  int aketa;
  int lim=100*100;
  int frag=0;
  scanf("%d %d",&a,&b);
  if(b<10){
    aketa=10;
  }else if(b<100){
    aketa=100;
  }else if(b>=100){
    aketa=1000;
  }
  for(int i=4;i<=lim;i++){
    if(i*i==a*aketa+b){
      frag=1;
    }
  }
  if(frag==1){
    printf("Yes");
  }else{
    printf("No");
  }
  return 0;
}

Measured memory_bytes: 128
import java.util.*;

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

	while(sc.hasNext()){

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

	    String sum = Integer.toString(a+b);

	    System.out.println(sum.length());
	}
    }
}

Measured memory_bytes: 12000
package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)

	n, _ := strconv.Atoi(scanLine(scanner));
	hotels := strToIntSlice(scanLine(scanner));

	maxHeight := 0
	count := 0
	for i := 0; i < n; i++ {
		if maxHeight <= hotels[i] {
			maxHeight = hotels[i]
			count++
		}
	}

	fmt.Print(count);
}

func scanLine(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func strToIntSlice(line string) []int {
	strSlice := strings.Split(line, " ")

	var intSlice []int
	for _, str := range strSlice {
		intValue, _ := strconv.Atoi(str)
		intSlice = append(intSlice, intValue)
	}

	return intSlice
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
    int l;
    cin >> l;
    long dp[l+1][5];
    fill(dp[0], dp[l+1], 0);
    for (int i=0; i<l; i++) {
        long a; cin >> a;
        long best = 1e18;
        for (int j=0; j<5; j++) {
            dp[i+1][j] = best = min(best, dp[i][j]);
            if (j == 0 || j == 4) dp[i+1][j] += a;
            else if (j == 2) dp[i+1][j] += (a+1) % 2;
            else dp[i+1][j] += a % 2 + (a == 0 ? 2 : 0);
        }
    }
    cout << min({dp[l][0], dp[l][1], dp[l][2], dp[l][3], dp[l][4]}) << '\n';
    return 0;
}

Measured memory_bytes: 8192
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 
	cin.tie(NULL);
	ios_base::sync_with_stdio(false);
 
	string s;
	cin >> s;
	if(s.back() != 's') cout << s << 's' << '\n';
	else cout << s << "es\n";
	
	return 0;
}



Measured memory_bytes: 3600
#include <stdio.h>

int main()
{
    int n = 0, i = 0, k = 0;
    int *p = NULL;
    scanf("%d", &n);
    p = (int *)calloc(n, sizeof(int));
    for (i = 0; i < n; i++)
    {
        scanf("%d", &k);
        p[k-1] = i+1;
    }
    for (i = 0; i < n; i++)
    {
        printf("%d ", p[i]);
    }
    return 0;
}


Measured memory_bytes: 1152
#include <iostream>
#include <map>
using namespace std;
int main()
{
  int N;
  cin >> N;
  map<int, int> mp;
  for (int i = 0; i < N; i++)
  {
    int A;
    cin >> A;
    mp[A]++;
  }
  int ans = 0;
  for (auto a : mp)
    ans += a.second % 2;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
int main() {
  string s;
  cin>>s;
  if(s=="SUN"){cout<<7<<endl;}
  if(s=="MON"){cout<<6<<endl;}
  if(s=="TUE"){cout<<5<<endl;}
  if(s=="WED"){cout<<4<<endl;}
  if(s=="THU"){cout<<3<<endl;}
  if(s=="FRI"){cout<<2<<endl;}
  if(s=="SAT"){cout<<1<<endl;}
  return 0;}

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

const int M_MAX=20;

int main(){

  int N;
  cin>>N;
  vector<int64_t> A(N);
  vector<bitset<20>> s(N);
  for(int i=0;i<N;++i){
    cin>>A.at(i);
    s.at(i)=A.at(i);
  }


  vector<vector<int>>  sum(M_MAX,vector<int>(N));
  
  for(int i=0;i<M_MAX;++i){
    for(int j=0;j<N;++j){
      
      if(j==0){
        sum.at(i).at(j)=s.at(j).test(i);
      }
      else{
        sum.at(i).at(j)=sum.at(i).at(j-1)+s.at(j).test(i);
      }
    }
  }

  int r=0;
  int64_t ans=0;
  
  for(int l=0;l<N;++l){
    bool frag=true;
    while(r<N && frag){
    if(l==0){
      for(int i=0;i<M_MAX;++i){
        if(sum.at(i).at(r)>1){
          frag=false;
        }
      }
    }
    else{
    for(int i=0;i<M_MAX;++i){
      if(sum.at(i).at(r)-sum.at(i).at(l-1)>1){
        frag=false;
      }
    }
  }
  if(frag){++r;}
}
    ans=ans+(r-l);

   --r;
  }

  cout<<ans<<endl;
}

Measured memory_bytes: 19840
#include<bits/stdc++.h>
using namespace std;
long long ans=1,mod=1000000007;
int main()
{
	int n;
	scanf("%d",&n);
	for (int i=1;i<=n;i++)
	{
		ans*=i;
		ans%=mod;
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!

# ITP1_6_B

def make(list1,trump_mark):
    list1=list()
    for i in range(1, 14):
        list1.append(trump_mark+" "+str(i))
    return list1


all=list()
all+=make(all,"S")
all+=make(all,"H")
all+=make(all,"C")
all+=make(all,"D")

N=int(input())

for _ in range(N):
    x=input()
    all.remove(x)

for s in all:
    print(s)



Measured memory_bytes: 5600
import java.io.*;
 
class Main{
    public static void main (String[ ] args) throws Exception{
        BufferedReader br = new BufferedReader (new InputStreamReader (System.in));
        String str = br.readLine();
        String[] strarr = str.split(" ");
        int a[] = new int[2];

        a[0] = Integer.parseInt(strarr[0]);
        a[1] = Integer.parseInt(strarr[1]);
        
        int ans[] = new int[2];
        ans[0] = a[0]*a[1];
        ans[1] = a[0]+a[1]+a[0]+a[1];
        
        System.out.println(ans[0] + " " + ans[1]);
    }
}

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

int main(){
    int n;
    cin >> n;
    int a[200010];
    for(int i=1; i<=n; i++){
        cin >> a[i];
    }
    int b[200010];
    if(n%2==0){
        for(int i=n; i>=1; i-=2){
            cout << a[i] << " ";
        }
        for(int i=1; i<=n; i+=2){
            cout << a[i] << " ";
        }
    }else{
        for(int i=n; i>=1; i-=2){
            cout << a[i] << " ";
        }
        for(int i=2; i<=n; i+=2){
            cout << a[i] << " ";
        }
    }
    return 0;
}

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

int main()
{
    int a;
    string str;
    // cin >> a;
    string str1;
    cin >> str;
    cin >> str1;
    int count = 0;
    for (int i = 0; i < str.length(); i++)
    {
        if (str[i] != str1[i])
            count++;
    }
    cout << count << "\n";

    return 0;
}

Measured memory_bytes: 3916
n,m = list(map(int, input().split()))
s = input()
t = input()
import math

# 良い文字列が作れるなら、答えはLCM(n, m)となる
lcm = n * m // math.gcd(n, m)

x = {}
for i,c in enumerate(s):
    # (pos, char)
    x[lcm//n*i] = c

for i,c in enumerate(t):
    # (pos, char)
    pos, char = lcm//m*i, c
    if pos in x and x[pos] != char:
        print(-1)
        exit()

print(lcm)

Measured memory_bytes: 19360
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int a,b,c;
  cin>>a>>b>>c;
  if(a==b && b!=c)
  {
    cout<<"Yes"<<endl;
  }
  else if(a==c && c!=b)
  {
    cout<<"Yes"<<endl;
  }
  else if(b==c && c!=a)
  {
    cout<<"Yes"<<endl;
  }
  else
  {
    cout<<"No"<<endl;
  }
  return 0;
}

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

bool check(string s){
    int n=s.size();
    for(int i=0;i<n;i++){
        if(s.at(i)!=s.at(n-1-i)) return false;
    }
    return true;
}
int main(){
    string s;
    cin>>s;
    if(!check(s)){
        cout<<"No";
        return 0;
    }
    int n=s.size();
    string t="";
    for(int i=0;i<(n-1)/2;i++){
        t+=s.at(i);
    }
    if(!check(t)) cout<<"No";
    else cout<<"Yes";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
  int H, W, K; cin >> H >> W >> K;
  vector<vector<int>> v(H, vector<int>(W));
  for (int i = 0; i < H; i++) for (int j = 0; j < W; j++) {
    char c; cin >> c;
    v[i][j] = c == '#';
  }
  auto f = [&](int hmask, int wmask) -> int {
    int cnt = 0;
    for (int i = 0; i < H; i++) {
      if ((hmask >> i) & 1) continue;
      for (int j = 0; j < W; j++) {
        if ((wmask >> j) & 1) continue;
        cnt += v[i][j];
      }
    }
    return cnt == K;
  };
  int res = 0;
  for (int h; h < (1 << H); h++) {
    for (int w = 0; w < (1 << W); w++) {
      res += f(h, w);
    }
  }
  cout << res << endl;
}


Measured memory_bytes: 3604
#include "bits/stdc++.h"
#define REP(i, a, n) for(int i=a; i<n; i++)
using namespace std;

int n;
int a[10001];
int main() {
    cin>>n;
    REP(i, 0, n) cin>>a[i];

    int cnt=0;
    REP(i, 0, n){
        while(a[i]%2==0){
            a[i]/=2;
            cnt++;
        }
    }
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MAXN = (1<<21)+1;
const int mod = 1000000007;
int dp[MAXN];
int adj[33],n ;
int main() {
    int  m, k;
    scanf("%d", &n);
    for (int i = 0; i<n; ++i) {
        for (int j = 0, x; j<n; ++j) {
            scanf("%d", &x);
            adj[i] = adj[i]<<1|x;
        }
    }
    dp[(1<<n)-1] = 1;
    for (int i = n-1; i>=0;--i) {
        for (int mask = 0, g, x; mask<1<<n; ++mask) {
            g = ~mask&adj[i]; 
            while (g) {
                x = g&-g;
                dp[mask] += dp[mask|x];
                if (dp[mask] >= mod) dp[mask] -= mod;
                g -= x;
            }
        }
    }
    printf("%d\n", dp[0]); 
}


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

ll dp[2005];
ll MOD = 1e9 + 7;
int main(void) {
	dp[3] = 1;
	dp[4] = 1;
	dp[5] = 1;
	ll sum = 1;
	for(int i=6;i<=2000;i++) {
		dp[i] = 1;
		dp[i] += sum;
		dp[i] %= MOD;
		sum += dp[i-2];
		sum %= MOD;
	}
	int n; cin >> n;
	cout << dp[n] << endl;
	return 0;
}



Measured memory_bytes: 3580
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long r,g,b,n,i,j,ans = 0;scanf("%lld%lld%lld%lld",&r,&g,&b,&n);
  for(i=0;r*i<=n;i++){
    for(j=0;r*i+g*j<=n;j++){
      if((n-r*i-g*j)%b==0) ans++;
    }
  }
  printf("%lld\n",ans);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end() 
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000
using namespace std;
typedef long long ll;

int main() {
    int N, A, B;

    cin >> N >> A >> B;

    int mid = abs(A - B) - 1;

    if (mid%2 != 0){
        cout << "Alice" << endl;
    }
    else{
        cout << "Borys" << endl;
    }

}


Measured memory_bytes: 256
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 n = 0;
    
    for (int i = 0; i < (b - a + 1); i++) {
      String s[] = String.valueOf(a + i).split("");
      String t = s[4] + s[3] + s[2] + s[1] + s[0];
      
      if (String.valueOf(a + i).equals(t)) n++;
    }
    
    System.out.println(n);
  }
}

Measured memory_bytes: 64424
N = list(input())
honlist = ["2","4","5","7","9"]
ponlist = ["0","1","6","8"]
bonlist = ["3"]

if   N[-1] in str(honlist) :
  msg = "hon"
elif N[-1] in str(ponlist) :
  msg = "pon"
else :
  msg = "bon"
  
print(msg)

Measured memory_bytes: 9012
#include <iostream>
#include <string>
#include <cstring>
using namespace std;

int main(){
char moji[5][7] = {{'a','f','k','p','u','z'},{'b','g','l','q','v','.'},{'c','h','m','r','w','?'},{'d','i','n','s','x','!'},{'e','j','o','t','y',' '}};
    string s;
    char ans[1000];
    bool judge;
    while(cin >> s){
        memset(ans,0,sizeof(ans));
        judge = false;
        for(int i=0,j=0;i<s.size();i+=2,j++){
            if(s.size() % 2 != 0) {
                cout << "NA" << endl;
                judge = true;
                break;
            }
            if(!(s[i] >= '1' && s[i] <= '6' && s[i+1] >= '1' && s[i+1] <= '5')){
                cout << "NA" << endl;
                judge = true;
                break;
            }
            ans[j] =  moji[(s[i+1]%'0')-1][(s[i]%'0')-1];
        }
        if(!judge) cout << ans << endl;
    }
}

Measured memory_bytes: 1184
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using p = pair<int,int>;
const long long INF = 1ll << 60;



int main() {
  int X,Y,Z; cin >> X >> Y >> Z;
  cout << Z << " " << X << " " << Y << endl;


	return 0;
}



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

using namespace std;

#define fin cin
#define fout cout
//ifstream fin("x.in"); ofstream fout("x.out");

typedef long long i64;
const int nmax = 1e6;
const int mod = 1e9 + 7;

int n;
i64 fact[nmax + 1], inv[nmax + 1];

i64 lgput (i64 b, int p) {
    i64 ans = 1;
    while (p > 0) {
        if (p & 1)
            ans = ans * b % mod;
        b = b * b % mod;
        p >>= 1;
    }
    return ans;
}

i64 C (int x, int y) {
    if (x < y) return 0;
    if (x < 0) return 0;
    return fact[x] * inv[y] % mod * inv[x - y] % mod;
}

i64 min_p (int k) {
    i64 aux = C(k - 1, n - k - 1);
    return fact[k] * aux % mod * fact[n - k - 1] % mod;
}

int main() {
    fin.sync_with_stdio(false); fin.tie(); fout.tie();

    fact[0] = 1;
    for (int i = 1; i <= nmax; ++ i)
        fact[i] = fact[i - 1] * i % mod;

    inv[nmax] = lgput(fact[nmax], mod - 2);
    for (int i = nmax - 1; i >= 0; -- i)
        inv[i] = inv[i + 1] * (i + 1) % mod;

    i64 ans = 0;
    fin >> n;

    for (int i = 1; i < n; ++ i) {
        i64 aux = min_p(i) - min_p(i - 1);
        if (aux < 0)
            aux += mod;

        ans = (ans + 1LL * i * aux) % mod;
    }
    fout << ans << "\n";

    return 0;
}


Measured memory_bytes: 15872
#include<iostream>
#include<bits/stdc++.h>
#include<string>
#include<time.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define fi first    
#define se second
void solve()
{
    ll n,i,j,k;
    cin>>n;
    vector<ll> a(n);
    for(i=0;i<n;i++)
        cin>>a[i];
    ll dp[n];
    dp[0]=0;
    dp[1]=abs(a[0]-a[1]);
    for(i=2;i<n;i++)
        dp[i]=min(abs(a[i]-a[i-1])+dp[i-1],abs(a[i]-a[i-2])+dp[i-2]);
    cout<<dp[n-1];
    // for(i=0;i<n;i++)
    //     cout<<dp[i]<<" ";
}
int main(){ 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    // #endif  
    clock_t tStart = clock();
    ll t,k;
    // cin>>t;
    // while(t--)
        solve();
    // printf("\nTime taken: %.2fs\n", (double)(clock() - tStart)/CLOCKS_PER_SEC);
    return 0;
}       

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int i, p=0;
  long N;
  cin >> N;
  for(i=0;i<8;i++)
    p += (N/(long)powl(10,i))%10;
  
  cout << ((N%p)?"No":"Yes") << endl;
 
  // ここにプログラムを追記
}

Measured memory_bytes: 256
package main

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

//scanで一行づつ読み込む
var sc = bufio.NewScanner(os.Stdin)
var wtr = bufio.NewWriter(os.Stdout)

//sort
// array := []int{5, 1, 4, 2, 3}
// sort.Sort(sort.IntSlice(array))

func main() {
	// a := make([]int, n)
	// A := strings.Split(nextLine(), " ")

	N := strings.Split(nextLine(), " ")
	// n, _ := strconv.Atoi(input[0])

	// memo = make([]bool, n+1, n+2)

	t, _ := strconv.Atoi(N[0])
	x, _ := strconv.Atoi(N[1])

	tl := float64(t)
	xl := float64(x)

	// ans := 0

	fmt.Fprintln(wtr, tl/xl)

	_ = wtr.Flush()
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

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

	if a > b {
		return 0
	}
	return abs(a - b)
}

func abs(a int) int {
	if a < 0 {
		return a * -1
	}
	return a
}

type dishh struct {
	first  int
	second int
}

// 構造体のスライス
type dish []dishh

// 以下インタフェースを満たす

func (p dish) Len() int {
	return len(p)
}

func (p dish) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p dish) Less(i, j int) bool {

	return p[i].first+p[i].second > p[j].first+p[j].second
}


Measured memory_bytes: 640
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.*;

public class Main implements Runnable {
    // 定数

    public static void main(String[] args) throws Exception {
        Thread.setDefaultUncaughtExceptionHandler((t, e)->System.exit(1));
        new Thread(null, new Main(), "", 16 * 1024 * 1024).start();
    }

    public void run() {
        int N = 0;
        int H = 0;
        int W = 0;
        int A = 0;
        int B = 0;

        int result = 0;

        // 入力
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in));) {
            String[] line = br.readLine().split(" ");
            N = Integer.parseInt(line[0]);
            H = Integer.parseInt(line[1]);
            W = Integer.parseInt(line[2]);

            for (int i = 0; i < N; i++) {
                line = br.readLine().split(" ");
                A = Integer.parseInt(line[0]);
                B = Integer.parseInt(line[1]);

                if (A >= H && B >= W) {
                    result++;
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

        // 出力
        System.out.println(result);
    }
}


Measured memory_bytes: 29524
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>
#include <ios>
#include <cctype>
#include <cstdio>
#include <functional>
#include <cassert>

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define FORR(i,a,b) for(int i = (a) - 1;i >=(b);--i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).sizeT()
#define YESNO(cond,yes,no){cout <<((cond)?(yes):(no))<<endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(),(list).rend())
#define ASSERT(cond,mes) assert(cond && mes)

using namespace std;
using ll = long long;

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'050'000'000;

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    REP(i, (int)v.size())is >> v[i];
    return is;
}

template <typename T>
ostream& operator<<(ostream& os, vector<T>& v) {
    REP(i, (int)v.size())os << v[i] << endl;
    return os;
}

template <typename T>
T clamp(T& n, T a, T b) {
    if (n < a)n = a;
    if (n > b)n = b;
    return n;
}

template <typename T>
static T GCD(T u, T v) {
    T r;
    while (v != 0) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}

template <typename T>
static T LCM(T u, T v) {
    return u / GCD(u, v) * v;
}

std::vector<int> enum_div(int n) {
    std::vector<int> ret;
    for (int i = 1; i*i <= n; ++i) {
        if (n%i == 0) {
            ret.push_back(i);
            if (i != 1 && i*i != n) {
                ret.push_back(n / i);
            }
        }
    }
    return ret;
}

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

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



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

    int N;
    cin >> N;
    vector<int> H(N);
    cin >> H;

    vector<int> dp(N, INF);
    dp[0] = 0;
    REP(i, N - 1) {
        chmin(dp[i + 1], dp[i] + abs(H[i + 1] - H[i]));
        if (i < N - 2)chmin(dp[i + 2], dp[i] + abs(H[i + 2] - H[i]));
    }

    cout << dp[N - 1] << endl;
    return 0;
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
using ll = long long; using ull = unsigned long long;
//#define int ll
using vb = vector<bool>; using vvb = vector<vb>;
using vi = vector<int>; using vvi = vector<vi>;
using vl = vector<ll>; using vvl = vector<vl>;
using pii = pair<int,int>; using pll = pair<ll,ll>;
#define FOR(i,a,b) for(ll i = (a); i < (ll)(b); ++i)
#define REP(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(ll i = (ll)(b)-1;i >= a;--i)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define eb(val) emplace_back(val)
const double PI = acos(-1);
const double EPS = 1e-10;
const ll MOD = 1e9+7;
void cioacc(){//accelerate cin/cout
  cin.tie(0);
  ios::sync_with_stdio(false);
}
signed main(){
  int n,m,c;
  cin >> n >> m >> c;
  vi b(m);
  REP(i,m) cin >> b.at(i);
  vvi a(n,vi(m));
  REP(i,n)REP(j,m){
    int tmp;
    cin >> tmp;
    a.at(i).at(j) = tmp*b.at(j);
  }
  int ans = 0;
  REP(i,n){
    if(accumulate(ALL(a.at(i)),c)>0) ++ans;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <algorithm>
#include <cstring>
#include <utility>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <queue>
#include <bitset>
#include <stack>
#include <deque>
using namespace std;
typedef pair<int, int> pii;
typedef long long LL;

int main() {
    int N, H, W;
    scanf("%d %d %d", &N, &H, &W);
    printf("%d\n", (N - H + 1) * (N - W + 1));
    return 0;
}


Measured memory_bytes: 256
K,*A=map(int, open(0).read().split())
m=2
M=2
for a in A[::-1]:
    if (m+a-1)//a*a>M//a*a:
        print(-1)
        break
    m=(m+a-1)//a*a
    M=M//a*a+a-1
else:
    print(m,M)

Measured memory_bytes: 14092
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define M (1000000007)
#define N (100010)
int n,m,f[N*10][3],dp[N][3];
vector<int>G[N];

int main(){
	scanf("%d%d",&n,&m);
	int x,y;
	for (int i=1;i<=m;i++){
		scanf("%d%d",&x,&y);
		G[x].push_back(y);
	}
	scanf("%d%d",&x,&y);
	f[1][0]=x; f[1][1]=0; f[1][2]=0;
	int l=0,r=1; memset(dp,0x7f7f,sizeof(dp));
	while (l<r){
		l++;
		if (f[l][0]==y&&f[l][1]==0){
			printf("%d",f[l][2]);
			return 0;
		}
		int now=f[l][0],cnt=f[l][2]+(f[l][1]+1)/3,t=(f[l][1]+1)%3;
		for (int i=0;i<G[now].size();i++){
			int nx=G[now][i];
			if (dp[nx][t]<=cnt) continue;
			dp[nx][t]=cnt;
			f[++r][0]=nx; f[r][1]=t; f[r][2]=cnt;
		}
	}
	printf("-1");
}


Measured memory_bytes: 11520
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		// 入力値
		int n = sc.nextInt();
		sc.close();

		int[][] p = new int[10][10];
		for(int i=1;i<=n;i++){
			int a = Integer.parseInt(String.valueOf(i).substring(0, 1));
			int b = i % 10;
			p[a][b]++;
		}
		long ans = 0;
		for(int i=1;i<=n;i++){
			int a = Integer.parseInt(String.valueOf(i).substring(0, 1));
			int b = i % 10;
			ans += p[b][a];
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 42344
N = int(input())
data = [list(map(int,input().split())) for l in range(N)] 
data = [[0,0,0]] + data

for i in range(1,N+1):
    t_a,t_b = data[i][0],data[i-1][0]
    x_a,x_b = data[i][1],data[i-1][1]
    y_a,y_b = data[i][2],data[i-1][2]

    x_d = x_a - x_b
    y_d = y_a - y_b

    check = t_a - t_b - abs(x_d) - abs(y_d)
    if (check >= 0) and (check%2 == 0):
        continue
    else:
        print('No')
        exit()
else:
    print('Yes')
    
            

Measured memory_bytes: 28092
N,K = map(int, input().split())
A = list(map(int, input().split()))
Ans = 0
 
count1 = (K * (K+1) // 2) % 1000000007
count2 = ((K-1) * K // 2) % 1000000007

#print(count1)
#print(count2)
 
for i in range(N):
 
  for j in range(N):
 
    if A[i] > A[j]:
      if i < j:
        Ans = Ans + count1
      else:
        Ans = Ans + count2
      
      if Ans > 1000000007:
        Ans = Ans % 1000000007  
 
 
print(int(Ans))


Measured memory_bytes: 3188
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include<set>
#include<tuple>

#define DIV 1000000007
using namespace std;
using ll = long long;
using ldb = long double;

typedef struct {
	vector<int> edge;
	ll a = 0, lc = 0, q = 0;
	bool vi = false;
}node_t;
vector<node_t> node;

void dfs(int p) {
	int N = node.size();
	vector<ll> dp(N + 1, 1e10);
	stack<int> st;
	st.push(p);
	dp[0] = node[p].a, node[p].vi = true;
	stack<pair<int, ll>> re;
	re.push(make_pair(p, 1e10));
	while (!st.empty()) {
		int x = st.top();
		node[x].vi = true;
		st.pop();
		int left = 0, right = N;
		while (left < right) {
			int mid = (left + right) / 2;
			if (node[x].a <= dp[mid]) right = mid;
			else left = mid + 1;
			//printf("left=%d right=%d mid=%d\n", left, right, mid);
		}
		re.push(make_pair(x, dp[left]));
		dp[left] = node[x].a;
		node[x].lc = left;
		node[x].q = lower_bound(dp.begin(), dp.end(), 1e10) - dp.begin();
		//cout << "to=" << to << " ";
		/*
		for (int h = 0; h < dp.size(); h++) {
			cout << dp[h] << " ";
		}	
		cout << endl;
		*/
		bool con = false;
		//cout << "x=" << x << endl;
		for (auto to : node[x].edge) {
			if (node[to].vi)continue;
			//node[to].vi = true;
			con = true;
			st.push(to);	
		}

		if (!con) {
			bool T = true;
			while (!re.empty() && T) {
				int po = re.top().first;
				ll A = re.top().second;
				for (auto to : node[po].edge) {
					if (!node[to].vi) {
						T = false;
						break;
					}
				}
				if (T) {
					dp[node[po].lc] = A;
					re.pop();
				}
			}
		}

	}
}

/*
7
1 5 5 6 7 8 8
1 2
2 3
2 4
4 5
1 6
6 7
*/
int main() {
	int N; cin >> N;
	node = vector<node_t>(N + 1);
	for (int i = 1; i <= N; i++) {
		cin >> node[i].a;
	}

	for (int i = 0; i < N - 1; i++) {
		int u, v; cin >> u >> v;
		node[u].edge.push_back(v);
		node[v].edge.push_back(u);
	}

	dfs(1);
	/*
	for (int i = 1; i <= N; i++) {
		cout << node[i].lc+1 << endl;
	}
	*/
	for (int i = 1; i <= N; i++) {
		cout << node[i].q << endl;
	}
}



Measured memory_bytes: 24708