akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;

int main(){
    int h, w;
    cin >> h >> w;

    char c;
    int cnt[26] = {};

    for(int i = 0; i < h*w; i++){
        cin >> c;
        cnt[c-'a']++;
    }

    if(h == 1 || w == 1){
        if(h == 1)  swap(h, w);
        if(h == 1){
            cout << "Yes" << endl;
        }else{
            int odd = h%2;
            for(int i = 0; i < 26; i++) odd -= (cnt[i]%2);
            if(odd == 0)    cout << "Yes" << endl;
            else            cout << "No" << endl;
        }
        return 0;
    }
    
    bool judge = true;
    if(h%2 + w%2 == 0){
        for(int x : cnt)    judge &= (x%4==0);
    }else if(h%2 + w%2 == 2){
        int want = (h-1)/2*(w-1)/2;
        for(int i = 0; i < 26 && want > 0; i++){
            while(cnt[i] >= 4 && want > 0)  cnt[i] -= 4, want--;
        }
        judge &= (want == 0);
        want = (h-1)/2 + (w-1)/2;
        for(int i = 0; i < 26 && want > 0; i++){
            while(cnt[i] >= 2 && want > 0)  cnt[i] -= 2, want--;
        }
        judge &= (want == 0);
        // 本当は1があるかどうかチェックしなければいけないが、自明なので省略
    }else{
        if(w%2) swap(h,w);
        int want = (h-1)/2*w/2;
        for(int i = 0; i < 26 && want > 0; i++){
            while(cnt[i] >= 4 && want > 0)  cnt[i] -= 4, want--;
        }
        judge &= (want == 0);
        want = w/2;
        for(int i = 0; i < 26 && want > 0; i++){
            while(cnt[i] >= 2 && want > 0)  cnt[i] -= 2, want--;
        }
        judge &= (want == 0);
    }

    cout << (judge ? "Yes" : "No") << endl;

    return 0;
}


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

/////------------------------TYPEDEF--------------------------/////
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<char> vc;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef long double ld;
#define prq priority_queue<ll>;

/////------------------------CONSTANTS--------------------------/////
ll MOD=1000000007;
#define PI 3.1415926535897932384626433832795

/////------------------------GENERAL--------------------------/////
#define forx(i,j,n) for(int i=j;i<n;i++)
#define fory(i,j,n) for(int i=j;i>=n;i--)
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define fastio ios_base::sync_with_stdio(false)
#define testcase int t; cin>>t
#define MEM(xx,yy) memset(xx,yy,sizeof(xx))
#define vbs(xx,x) binary_search(all(xx),x)
#define vlb(xx,x) lower_bound(all(xx),x)
#define vub(xx,x) upper_bound(all(xx),x)

/////------------------------IO--------------------------/////
#define inpi(xx) scanf("%d",&xx)
#define inpl(xx) scanf("%lld",&xx)
#define inpc(xx) scanf("%c",&xx)
#define inps(xx) scanf("%s",&xx)
#define pri(xx) printf("%d",xx)
#define prl(xx) printf("%lld",xx)
#define prls(xx) printf("%lld ",xx)
#define prle(xx) printf("%lld\n",xx)
#define prc(xx) printf("%c",xx)
#define prs printf(" ");
#define pre printf("\n")
ll n;
ll h[100005];
ll ans[100005];

ll fun(ll n){
    if(n==1) return 0;
    if(n==2) return abs(h[2]-h[1]);
    if(ans[n]!=-1) return ans[n];
    ans[n]=min(fun(n-1)+abs(h[n]-h[n-1]),fun(n-2)+abs(h[n]-h[n-2]));
    return ans[n];
}

int main() {
	int t=1;
	while(t--){
	    cin>>n;
	    forx(i,0,n) cin>>h[i+1];
	    MEM(ans,-1);
	    cout<<fun(n);
	}
	return 0;
}

Measured memory_bytes: 3328
import java.io.*;
import java.util.*;



class Main{
    //読み込みのテンプレ(stringオブジェクトまで)
    
    static int N;
    static int[] sequence;
    static int count;
    
    public static void main(String[] args) throws IOException{
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        
        int[] sequence = new int[N];
        
        for(int i=0;i<N;i++){
            sequence[i]=scanner.nextInt();
        }
        
        sequence =  doBubblesort(sequence);
        showResult(sequence);
        System.out.println(count);
    }
    
    
    public static int[] doBubblesort(int[] sequence){
        for(int i=0;i<sequence.length-1;i++){
            for(int j=sequence.length-1;j>i;j--){
                if(sequence[j] < sequence[j-1]){
                    int x = sequence[j];
                    int y = sequence[j-1];
                    sequence[j] = y;
                    sequence[j-1]= x;
                    count++;
                }
            }
        }
        
        return sequence;
    }
    
    
    public static void showResult(int[] sequence){
        for(int i =0;i<sequence.length-1;i++){
            int number = sequence[i];
            System.out.print(number + " ");
        }
        
        System.out.println(sequence[sequence.length-1]);
    }
    
}

Measured memory_bytes: 19092
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;

int n, A, B, mn, M = 2e9, a, b, c, sj, sk, d[405][405];
//int f(int p, int q, int w) {
//
//}
int main()
{
	int i, j, k;
	cin >> n >> A >> B;
	memset(d, -1, sizeof(d));
	d[0][0] = 0;
	for (i = 1; i <= n; i++) {
//		scanf ("%d %d %d", &a[i], &b[i], &c[i]);
		scanf ("%d %d %d", &a, &b, &c);
		mn =M;
		sj += a;
		sk += b;
		for (j = sj; j >=a; j--) {
			for (k = sk; k >= b; k--) {
				if (d[j - a][k - b] != -1)  {
					if (d[j][k] == -1 || d[j - a][k - b] + c < d[j][k]) d[j][k] = d[j - a][k - b] + c;
				}
			}
		}
	}
//	f(1, 0, 0);
	mn = M;
	i = A;
	j = B;
	while (i <= sj && j <= sk) {
		if (d[i][j] != -1)mn = min(mn, d[i][j]);
		i += A;
		j +=B;
	}
	if (mn == M) cout << -1;
	else cout << mn;
    return 0;
}


Measured memory_bytes: 896
#include<cstdio>
#include<algorithm>
#include<iostream>
#define FOR(i,l,r) for(int i = l; i <= r; i++)
#define ROF(i,r,l) for(int i = r; i >= l; i--)
using namespace std;

const int MAXN = 200010;

typedef pair< int, int > item;

item a[MAXN];
item fmax[MAXN],fmin[MAXN],bmax[MAXN],bmin[MAXN];

int max(int x,int y){
  return x>y? x:y;
}

int min(int x,int y){
  return x>y?y:x;
}

item getmax(item x,item y){
  return make_pair(max(x.first,y.first),max(x.second,y.second));
}

item getmin(item x,item y){
  return make_pair(min(x.first,y.first),min(x.second,y.second));
}

long long calc(item u,item d){
  long long x = u.first - d.first;
  long long y = u.second - d.second;
  return x * y;
}

int main(){
  int n,x,y;
  scanf("%d",&n);
  FOR(i,1,n){
    scanf("%d%d",&x,&y);
    a[i] = make_pair(min(x,y),max(x,y));
  }
  sort(a+1, a+n+1);
  fmax[1] = a[1]; fmin[1] = a[1];
  FOR(i,2,n){
    fmax[i] = getmax(fmax[i-1],a[i]);
    fmin[i] = getmin(fmin[i-1],a[i]);
  }
  bmax[n]= a[n]; bmin[n] = a[n];
  ROF(i,n-1,1){
    bmax[i] = getmax(bmax[i+1],a[i]);
    bmin[i] = getmin(bmin[i+1],a[i]);
  }
  long long ans = calc(fmax[n],fmin[n]);
  FOR(i,1,n-1){
    item lu = make_pair(fmax[i].second,fmax[i].first);
    item ld = make_pair(fmin[i].second,fmin[i].first);

    lu = getmax(lu,bmax[i+1]);
    ld = getmin(ld,bmin[i+1]);

    long long k = calc(lu,ld);
    if (k < ans){
      ans = k;
    }
  }
  cout << ans;
  return 0;
}


Measured memory_bytes: 8696
#include<iostream>
using namespace std;
int main(){
  int a,b;
  while(cin>>a>>b){
    if(a==0 && b==0){
      break;
    }
    else{
      for(int i=0;i<a;i++){
        for(int j=0;j<b;j++){
          cout<<"#";
        }
        cout<<endl;
      }
    }
    cout<<endl;
  }
 return 0;
}


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

#define endl '\n'
#define int long long

const int N = 1e5+5;
int cache[N];
vector<int> e[N];
int n, m;

int dfs(int id) {
	int &ans = cache[id];
	if(ans != -1)
		return ans;
	ans = 0;
	for(int i : e[id]) {
		ans = max(ans, 1 + dfs(i));
	}
	return ans;
}

int32_t main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	
	memset(cache, -1, sizeof cache);
	cin >> n >> m;
	for(int i = 0; i < m; i ++) {
		int x, y;
		cin >> x >> y;
		e[x].push_back(y);
	}
	int ans = 0;
	for(int i = 1; i <= n; i ++) {
		ans = max(ans, dfs(i));
	}
	cout << ans << endl;

	return 0;
}


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

#define fr first
#define sc second
#define OK puts("OK");
#define pb push_back
#define mk make_pair

using namespace std;

typedef long long ll;

const ll inf = (ll)1e9 + 7;
const ll N = (ll)5e3 + 7;

ll n,m;
ll a[N],b[N][201];
ll p[N],rs,mx;

ll table[20][N * 4][201],cur;
ll numlog[N];

void build() {
    numlog[1] = 0;
    for (int i = 2; i <= n; i++)
        numlog[i] = numlog[i / 2] + 1;

    for (int i = 0; i <= numlog[n]; i++) {
        int curlen = 1 << i;
        for (int j = 1; j <= n; j++) {
                for (int k = 1; k <= m; k ++) {
            if (i == 0) {
                table[i][j][k] = b[j][k];
                continue;
            }
            table[i][j][k] = max(table[i - 1][j][k], table[i - 1][j + curlen / 2][k]);
                }
        }
    }
}

int get(int l, int r,int k) {
    int curlog = numlog[r - l + 1];
    return max(table[curlog][l][k], table[curlog][r - (1 << curlog) + 1][k]);
}
ll calc (ll l,ll r) {
        ll res = 0;
        for (ll k = 1; k <= m; k ++) {
                res += get(l,r,k);
        }
        return res;
}
void compute(ll l,ll r,ll L,ll R) {
        if (l > r || L == -1 || R == -1)
                return;

        ll md = (l + r) >> 1;

        ll cur = -1;
        ll opt = -1;
        for (ll i = L; i <= min(md,R); i ++) {
                ll now = calc(i,md) - (p[md] - p[i]);
                if (now > cur)
                        cur = now,opt = i;
        }
        mx = max(mx,cur);

        compute(l,md - 1,L,opt);
        compute(md + 1,r,opt,R);
}
main () {
        cin >> n >> m;

        for (ll i = 1; i < n; i ++) {
                scanf("%lld", &a[i]);
                p[i + 1] = p[i] + a[i];
        }

        for (ll i = 1; i <= n; i ++) {
                for (ll j = 1; j <= m; j ++) {
                        scanf("%lld", &b[i][j]);
                }
        }
        build();
        compute(1,n,1,n);
        cout << mx << endl;
}


Measured memory_bytes: 135424
import java.util.Scanner;

public class Main {
	
	void run() {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		
		if(a > b) System.out.println("a > b");
		else if(a < b) System.out.println("a < b");
		else System.out.println("a == b");
	}
	public static void main(String[] args) {
		new Main().run();
	}
}


Measured memory_bytes: 26328
n=int(input())
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]

k=0
for i,j in enumerate(b):
  if a[i]+a[i+1]<=j:
    k+=a[i]+a[i+1]
    a[i],a[i+1]=0,0
  elif a[i]<=j:
    k+=j
    a[i],a[i+1]=0,a[i]+a[i+1]-j
  else:
    k+=j
    a[i]-=j
print(k)

Measured memory_bytes: 18624
N = int(input())
H = list(map(int, input().split()))
L = [0]*N
L[1] = abs(H[1] - H[0])
for i in range (2,N):
  X = L[i-1] + abs(H[i] - H[i-1])
  Y = L[i-2] + abs(H[i] - H[i-2])
  L[i] = min(X,Y)
print(L[N-1])

Measured memory_bytes: 20564
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main() {
	int n;
	while (cin >> n) {
		if (n == 0) {
			break;
		}
		vector<int> a(n);
		for (int i = 0; i < n; i++) {
			cin >> a[i];
		}
		sort(a.begin(), a.end());
		int ans = a[1] - a[0];
		for (int i = 0; i < n - 1; i++) {
			ans = min(ans, a[i + 1] - a[i]);
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3100
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n, i, j, k;
    scanf("%d %d",&n,&k);
    int height[n+5];
    for(i=1;i<=n;i++)
        scanf("%d",&height[i]);
    int dp[n+5];
    for(i=1;i<=n;i++) dp[i] = 1e9;
    dp[1] = 0;
    for(i=2;i<=n;i++)
    {
        for(j=1;j<=k;j++)
        {
            if(i > j) dp[i] = min(dp[i], dp[i-j] + abs(height[i] - height[i-j]));
        }
    }
    printf("%d\n", dp[n]);
    return 0;
}


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

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}

#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i <= (b); i++)
#define FORD(i, a, b) for(int i = (a); i >= (b); i--)
#define A first
#define B second
#define MOD 1000000007

typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef long long ll;

int mulmd(ll a, ll b){
    ll ret = (a * b) % MOD;
    return (int)ret;
}

inline int power(ll x, ll y, int p)
{
    ll res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = mulmd(res, x);
        y = y >> 1;
        x = mulmd(x, x);
    }
    return (int)res;
}

int submd(ll a, ll b){
    ll ret = a - b;
    if(ret < 0){
        ret += MOD;
    }
    return (int)ret;
}

int addmd(ll a, ll b){
    ll ret = (a + b) % MOD;
    return (int)ret;
}

int invPow(ll a){
    return power(a, MOD - 2, MOD);
}

const int N = 1e5 + 5;

int arr[N];

/**
    Check out for boundary cases, (n = 1 or n = 0)
    check for integer overflow

**/

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    string s;
    string t;
    cin >> s >> t;
    int cnt = 0;
    REP(i, s.size()){
        if(s[i] == t[i]) cnt++;
    }
    cout << cnt;

}



Measured memory_bytes: 256
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

s = input()
t = input()
if len(list(Counter(s).values())) != len(list(Counter(t).values())):
    print('No')
    quit()
n = len(s)
S = [-1]*26
for i in range(n):
    sidx = ord(s[i]) - ord("a")
    tidx = ord(t[i]) - ord("a")
    if S[tidx] < 0:
        S[tidx] = sidx
    else:
        if S[tidx] != sidx:
            print('No')
            quit()
print('Yes')

Measured memory_bytes: 41712
#64d
import re

N = int(input()) #N<100
S = str(input()) #|S|=N

inputS = S

#()を打ち消す。
for _ in range(50): #whileは遅いのでforで。
    if "()" in S:
        S = S.replace("()","").strip()
    else:
        break
        
#print(S)
#print(inputS)

#挿入文字列は残ったものを反転したもの
insertS = S.translate(str.maketrans({'(': ')', ')': '('}))
#print(insertS)

ans = inputS.split()

#(は最左端に)は最右端に入れればOK
for insert_bracket in insertS:
    if insert_bracket == "(":
        ans.insert(0,"(")
    else:
        ans.append(")")
        
print(''.join(map(str, ans)))


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

const int maxN = 2e5 + 10;

int n, m;
int a[maxN + 1], b[maxN + 1];

int main()
{
	scanf("%d %d", &n, &m);
	m = min(m, 50);
	for(int i = 1; i <= n; i++) scanf("%d", &a[i]);

	while(m --)
	{
		for(int i = 0; i <= n; i++) b[i] = 0;
		for(int i = 1; i <= n; i++)
			b[ max(1, i - a[i]) ] ++, b[ min(n, i + a[i]) + 1 ] --;
		for(int i = 1; i <= n; i++) a[i] = a[i - 1] + b[i];
	}

	for(int i = 1; i <= n; i++) printf("%d ", a[i]);
	puts("");
	return 0;
}


Measured memory_bytes: 5316
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define f(i,a,b) for(int i=a;i<b;i++)
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
 
const int N = 1e5 + 5;
 
int32_t main()
{
	IOS;
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	std::vector<ll> arr;
	ll n,a,x=0;cin>>n;
	f(i,0,n){
		cin>>a;
		x^=a;
		arr.pb(a);
	}
	f(i,0,n){
		ll z=x;
		ll z1=arr[i];
		ll res=z^z1;
		cout<<res<<" ";
	}
	cout<<endl;

	return 0;
}

Measured memory_bytes: 5300
#include<stdio.h>

#define N 10000
#define Q 500

int LinearSearch(int,int);

int S[N];

int main()
{
  int T[Q],n,q,i,count = 0;

  scanf("%d",&n);

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

  scanf("%d",&q);

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

  printf("%d\n",count);

  return 0;
}

int LinearSearch(int key,int n){

  int i = 0;

  while(S[i] != key){
    i++;
    if(i == n) return 0;
  } 
  return 1;
}

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

int main() {
    long long x = 100, y;    cin >> y;
    for (int i = 1; i <= 4000; i++) {
        x = x + x / 100;
        if (x >= y) {
            cout << i;
            break;
        }
    }
    return 0;
}

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

using namespace std;

const int INF = 1e9;
const int N = 1e5;
const int MOD = 1e9 + 7;

const double PI = acos(-1);


int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int a, b;
    cin >> a >> b;
    set<int> st;
    st.insert(a);
    st.insert(b);
    for (int x = 1; x <= 3; x++)
        if (!st.count(x)) {
            cout << x;
            break;
        }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


int main(){
  int X, Y, Z, K;
  cin >> X >> Y >> Z >> K;
  vector<ll> A, B, C;
  rep(i,X){
    ll a;
    cin >> a;
    A.push_back(a);
  }
  rep(i,Y){
    ll b;
    cin >> b;
    B.push_back(b);
  }
  rep(i,Z){
    ll c;
    cin >> c;
    C.push_back(c);
  }
  
  vector<ll> AB;
  rep(i,X) rep(j,Y){
    AB.push_back(A[i] + B[j]);
  }
  sort(ALLOF(AB));
  reverse(ALLOF(AB));
  sort(ALLOF(C));
  reverse(ALLOF(C));

  vector<ll> ret;
  rep(i,min((int)(AB.size()), K)) rep(j,Z){
    ret.push_back(AB[i] + C[j]);
  }
  sort(ALLOF(ret));
  reverse(ALLOF(ret));
  rep(i,K){
    cout << ret[i] << endl;
  }

  return 0;
}


Measured memory_bytes: 42616
#pragma GCC optimize("Ofast")
#pragma loop_opt(on)
#include <bits/stdc++.h>
using namespace std;
signed main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    int a,b;
    cin >> a >> b;
    cout << max(0, a-b*2) << '\n';
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<cctype>
#include<string>
using namespace std;
int main() {
    int n;
    cin >>n;
   int p[15];
   int memo,max=0;
   for(int i=0;i<n;i++){
       cin >>p[i];
       if(max<p[i]){
           max=p[i];
           memo=i;
       }
    }
    int ans=0;
    for(int i=0;i<n;i++)ans=ans+p[i];
    cout << ans-p[memo]/2<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <cctype>
#include <algorithm>
using namespace std;
int main(void){
    int x ;
    cin >> x ;
    if(x < 1200 ){
        cout << "ABC" << endl;
    }else{
        cout << "ARC" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll unsigned long long
#define mod 1000000007

using namespace std;

int main()
{
    IOS;
    string s,ss;
    int n,m,i,j,k;
    cin>>s>>ss;
    n=s.length();
    m=ss.length();
    int dp[n+1][m+1];
    for(i=0;i<=n;i++)
    {
        for(j=0;j<=m;j++)
         {
         	if(i==0||j==0)
         		dp[i][j]=0;
            else
         	{
         	   if(s[i-1]==ss[j-1])
         			dp[i][j]=dp[i-1][j-1]+1;
         		else
         			dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
         	}
         }
    }
    string ans;
      i=n;j=m;
      while(i>0&&j>0)
      {
         		if(s[i-1]==ss[j-1])
         			{
         				ans.pb(s[i-1]);
         				i--;j--;
         			}
         		else
         		{
                    if(dp[i-1][j]>dp[i][j-1])
                    	i--;
                    else
                    	j--;
         		}
         }
         for(i=ans.length()-1;i>=0;i--)
         	cout<<ans[i];
    return 0;
}


Measured memory_bytes: 35456
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<P,ll> PPI;
typedef pair<ll,P> PIP;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vp;
#define PQ(T) priority_queue<T,vector<T>,greater<T>>
#define PQ2(T) priority_queue<T>
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<59;
const ll mod = 1e9+7;
#define REP(i,a,b) for(ll (i)=a;(i)<(ll)(b);++(i))
#define rep(i,n) REP(i,0,n)
#define rep1(i,n) REP(i,1,n+1)
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(x,y) ((x)=min((x),(y)))
#define chmax(x,y) ((x)=max((x),(y)))
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
#define DEBUG(x) cerr<<"line ("<<__LINE__<<")  "<<#x<<": "<<x<<endl;
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}
#define N 100010
vector<P> g[N];
ll n, m, dist[N];

bool dfs(int u){
	//cerr<<u<<" "<<dist[u]<<endl;
	for(auto &&x: g[u]){
		int v = x.fst;
		ll d = x.snd;
		if(dist[v]==INF){
			dist[v] = dist[u]+d;
			if(!dfs(v)) return false;
		} else if(dist[v]!=dist[u]+d) return false;
	}
	return true;
}

int main(){
	cin>>n>>m;
	rep(i, m){
		ll l, r, d;
		cin>>l>>r>>d; l--; r--;
		g[l].pb(P(r, d));
		g[r].pb(P(l, -d));
	}
	fill(dist, dist+n, INF);
	bool res = true;
	rep(i, n){
		if(dist[i]==INF){
	//	cerr<<i<<endl;
			dist[i] = 0;
			res &= dfs(i);
			if(!res) break;
		}
	}
	cout<<(res?"Yes":"No")<<endl;
	return 0;
}


Measured memory_bytes: 16512
/*
Rathin Bhargava
IIIT Bangalore

*/
#include<bits/stdc++.h>
#define mt make_tuple
#define mp make_pair
#define pu push_back
#define INF 1000000001
#define MOD 1000000007
#define EPS 1e-6
#define ll long long int
#define ld long double
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define pr(v) { for(int i=0;i<v.size();i++) { v[i]==INF? cout<<"INF " : cout<<v[i]<<" "; } cout<<endl;}
#define t1(x)                cerr<<#x<<" : "<<x<<endl
#define t2(x, y)             cerr<<#x<<" : "<<x<<" "<<#y<<" : "<<y<<endl
#define t3(x, y, z)          cerr<<#x<<" : " <<x<<" "<<#y<<" : "<<y<<" "<<#z<<" : "<<z<<endl
#define t4(a,b,c,d)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<endl
#define t5(a,b,c,d,e)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<" "<<#e<<" : "<<e<<endl
#define t6(a,b,c,d,e,f)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<" "<<#e<<" : "<<e<<" "<<#f<<" : "<<f<<endl
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define t(...) GET_MACRO(__VA_ARGS__,t6,t5, t4, t3, t2, t1)(__VA_ARGS__)
#define _ cerr<<"here"<<endl;
#define __ {ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}

using namespace std;
template<class A, class B> ostream& operator<<(ostream& out, const pair<A, B> &a){ return out<<"("<<a.first<<", "<<a.second<<")";}
template <int> ostream& operator<<(ostream& os, const vector<int>& v) { os << "["; for (int i = 0; i < v.size(); ++i) { if(v[i]!=INF) os << v[i]; else os << "INF";if (i != v.size() - 1) os << ", "; } os << "]\n"; return os; } 
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) { os << "["; for (int i = 0; i < v.size(); ++i) { os << v[i]; ;if (i != v.size() - 1) os << ", "; } os << "]\n"; return os; } 

const int N = 1e5+100;
vector<int> adj[N] = {};
vector<int> vis(N);
map< pair<int,int> , int> edges;

int dfs(int u,int root, int root2,int parent)
{
  while(u!= root && u != root2)
  {
    parent = adj[u][0] + adj[u][1] - parent;
    swap(parent,u);
  }
  if(u==root2) return 1;
  return 0;
}

int main()
{
  __;
  int n,m;
  cin >> n >> m;
  for(int i=0;i<m;i++)
  {
    int a,b;
    cin >> a >> b;
    a--; b--;

    adj[a].pu(b);
    adj[b].pu(a);
    edges[{a,b}] = edges[{b,a}] = 0;
  }

  bool boo = false;
  int idx = -1;
  int cnt = 0;
  vector<int> id;
  for(int i=0;i<n;i++) if(adj[i].size()%2==1) {cout << "No" << endl; return 0;}

  for(int i=0;i<n;i++)
  {
    if(adj[i].size() >= 6) {cout << "Yes" << endl; return 0;}
    else if(adj[i].size() == 4) {cnt++;id.pu(i);boo = true;}
  }

  if(cnt>2) {cout << "Yes" << endl; return 0;}
  else if (cnt <=1) {cout << "No" << endl; return 0;}


  int root = id[0], root2 = id[1];

  int paths = 0;
  for(auto v : adj[root])
  {
    paths += dfs(v,root,root2,root);
  }
  
  if(paths == 4) cout << "No" << endl;
  else cout << "Yes" << endl;
  return 0;
}



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

int main(){
  int H,W;
  scanf("%d %d",&H,&W);
  vector<vector<int>> a(H,vector<int>(W));
  for(int i=0;i<H;++i){
    for(int j=0;j<W;++j){
      scanf("%d",&a.at(i).at(j));
    }
  }

  vector<vector<int>> b(H,vector<int>(W));
  b=a;
  int sum=0;

  for(int i=0;i<H;++i){
    for(int j=0;j<W-1;++j){
      if(b.at(i).at(j)%2!=0 && b.at(i).at(j+1)%2!=0){
        --b.at(i).at(j);
        ++b.at(i).at(j+1);
        ++j;
        ++sum;
      }
      else if(b.at(i).at(j)%2!=0 && b.at(i).at(j+1)%2==0){
        --b.at(i).at(j);
        ++b.at(i).at(j+1);
        ++sum;
      }
    }
  }

  for(int i=0;i<H-1;++i){
    if(b.at(i).at(W-1)%2!=0 && b.at(i+1).at(W-1)%2!=0){
      --b.at(i).at(W-1);
      ++b.at(i+1).at(W-1);
      ++i;
      ++sum;
    }
    else if(b.at(i).at(W-1)%2!=0 && b.at(i+1).at(W-1)%2==0){
      --b.at(i).at(W-1);
      ++b.at(i+1).at(W-1);
      ++sum;
    }
  }

  cout<<sum<<endl;


  for(int i=0;i<H;++i){
    for(int j=0;j<W-1;++j){
      if(a.at(i).at(j)%2!=0 && a.at(i).at(j+1)%2!=0){
        --a.at(i).at(j);
        ++a.at(i).at(j+1);
        printf("%d %d %d %d\n",i+1,j+1,i+1,j+2);
        ++j;
      }
      else if(a.at(i).at(j)%2!=0 && a.at(i).at(j+1)%2==0){
        --a.at(i).at(j);
        ++a.at(i).at(j+1);
        printf("%d %d %d %d\n",i+1,j+1,i+1,j+2);
      }
    }
  }

  for(int i=0;i<H-1;++i){
    if(a.at(i).at(W-1)%2!=0 && a.at(i+1).at(W-1)%2!=0){
      --a.at(i).at(W-1);
      ++a.at(i+1).at(W-1);
      printf("%d %d %d %d\n",i+1,W,i+2,W);
      ++i;
    }
    else if(a.at(i).at(W-1)%2!=0 && a.at(i+1).at(W-1)%2==0){
      --a.at(i).at(W-1);
      ++a.at(i+1).at(W-1);
      printf("%d %d %d %d\n",i+1,W,i+2,W);
    }
  }

}

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

int main() {
    int h1, m1, h2, m2, k, ans = 0;
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    h1 = h1*60 + m1;
    h2 = h2*60 + m2 - k;
    ans = max(0, h2 - h1);
    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int N;
LL A[200001];
LL B[200001];
typedef pair<LL,LL>P;
vector<P>v;

int main(){
	cin>>N;
	REP(i,N){
		cin>>A[i]>>B[i];
		v.push_back(P(B[i],A[i]));
	}
	sort(v.begin(),v.end());
	
	LL now=0;
	bool ans=true;
	REP(i,N){
		now+=v[i].second;
		if(now>v[i].first){
			ans=false;
		}
	}
	if(ans){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 8304
N = int(input())
A = list(map(int,input().split()))
B = 0
a = 0
while a < 1:
    for i in range(N):
        if A[i] % 2 == 0:
            A[i] = A[i]//2
        elif A[i] % 2 != 0:
            a += 1
    B += 1
else:
    print(B-1)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0;i<(n);++i)
#define per(i, n) for(int i=(n)-1;i>=0;--i)
#define repa(i, n) for(int i=1;i<(n);++i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
using namespace std;
using ll = long long;
const ll MOD = (ll)1e9+7;
//const ll MOD = 998244353;
//const ll MOD = 924844033;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
const double EPS = 1e-5;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}

#ifdef DEBUG
#define OUTPUT(x) (output(x), outendl())
#else
#define OUTPUT(x) (void)0
#endif

ll modpow(ll x, ll b){
	ll res = 1;
	while(b){
		if(b&1)res = res * x % MOD;
		x = x * x % MOD;
		b>>=1;
	}
	return res;
}

ll modinv(ll x){
	return modpow(x, MOD-2);
}

bool was_output = false;
template<class t>
void output(t a){
	if(was_output)cout << " ";
	cout << a;
	was_output = true;
}
void outendl(){
	was_output = false;
	cout << endl;
}

ll n,m,v,p;
vector<ll> score;

bool func(ll x){
	vector<ll> line = score;
	line[x-1] += m;
	ll used = 0;
	int need_upper = p - 1;
	ll use = 0;
	rep(i,n){
		if(i==x-1)continue;
		if(need_upper){
			--need_upper;
			use += m;
			continue;
		}
		if(line[i]>line[x-1])return false;
		use += min(m,line[x-1]-line[i]);
	}
	return use >= (v-1) * m;
}

int main(){
	cin >> n >> m >> v >> p;
	score.resize(n);
	foreach(i,score){
		cin >> i;
	}
	sort(all(score),greater<ll>());
	ll lp = p;
	ll rp = n + 1;
	while(lp<rp){
		ll mid = (lp+rp) / 2;
		if(func(mid)){
			lp = mid + 1;
		}else{
			rp = mid;
		}
	}

	cout << lp-1 << endl;

	return 0;
}


Measured memory_bytes: 1792
n,*a=map(int,open(0).read().split())
for i in range(n-1):a[i+1]+=a[i]
j,k,m=0,2,1e18
for i in range(1,n-1):
 while abs(a[j]*2-a[i])>abs(a[j+1]*2-a[i]):j+=1
 while abs(a[k]*2-a[i]-a[n-1])>abs(a[k+1]*2-a[i]-a[n-1]):k+=1
 t=a[j],a[i]-a[j],a[k]-a[i],a[n-1]-a[k];m=min(m,max(t)-min(t))
print(m)

Measured memory_bytes: 24992
#include <stdio.h>

#define N 100
#define M 100

int main(void) {

    int A[N][M];
    int b[M];
    int c[N] = {0};
    int i;
    int j;
    int n;
    int m;

    scanf("%d %d", &n, &m);

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

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

    for(i = 0; i < n; i++) {
        for(j = 0; j < m; j++) {
            c[i] += A[i][j] * b[j];
        }
        printf("%d\n", c[i]);
    }

    return 0;
}

Measured memory_bytes: 640
N = int(input())
B = [int(i) for i in input().split()]
A = [0] * N
A[0] = B[0]
next = B[0]
for i in range(1,N-1):
    A[i] += min(next,B[i])
    next = B[i]
A[-1] = next
print(sum(A))

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

#ifdef LOCAL
#include "dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

#define rep(i, n) for (int i = 0; i < (n); i++)
#define mins(x, y) (x = min(x, y))
#define maxs(x, y) (x = max(x, y))
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

void solve() {
  int n;
  cin >> n;
  vi d(n);
  rep(i, n) cin >> d[i];
  ll ans = 0;
  rep(i, n) rep(j, n) {
    if (i < j) {
      ans += (ll)d[i] * d[j];
    }
  }
  cout << ans << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  // freopen("temp.1", "r", stdin);
  solve();
  return 0;
}

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

int f(long A, long B) {
	int digit_a = 0;
	while (A>0) {
		// cout << A << endl;
		digit_a++;
		A /= 10;
	}
	int digit_b = 0;
	while (B>0) {
		// cout << B << endl;
		digit_b++;
		B /= 10;
	}
	return max(digit_b, digit_a);
}

int main() {
	long N;
	scanf("%ld",&N);
	int minimum = 1000000;

	long i = 1;
	long temp = sqrt(N);
	while (i <= temp) {
		if (N%i==0) {
			long A = N/i;
			long B = N/A;
			// cout << A << " " << B <<endl;
			int F = f(A, B);
			if (F < minimum) {
				minimum = F;
			}
		}
		i++;
	}
	printf("%d\n",minimum);
	return 0;
}

Measured memory_bytes: 256
s = list(input())
t = list(input())
s.sort()
t.sort()
s = "".join(s)
t = "".join(t)[::-1]
minLength = min(len(s), len(t))
for i in range(minLength):
  if ord(s[i]) > ord(t[i]):
    print("No")
    exit()
  elif ord(s[i]) < ord(t[i]):
    print("Yes")
    exit()
if minLength == len(s) and len(t) > minLength:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3064
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <unordered_map> 
#include <unordered_set>
#include <functional>
#include <bitset>

using namespace std;

typedef pair<long long int, long long int> P;
typedef tuple<int, int, int> T;

long long int INF = 1e18;
long long int MOD = 1e9 + 7;

string S[22];

int main(){
	int H, W;
	cin >> H >> W;
	for(int i = 0; i < H; i++){
		cin >> S[i];
	}
	int ans = 0;
	for(int sy = 0; sy < H; sy++){
		for(int sx = 0; sx < W; sx++){
			int step[H][W] = {};
			queue<P> que;
			que.push(P(sy, sx));
			for(int loop = 1; loop < 1000; loop++){
				int sz = que.size();
				if(sz == 0){
					break;
				}
				for(int hoge = 0; hoge < sz; hoge++){
					P p = que.front();
					que.pop();
					int y = p.first;
					int x = p.second;
					if(y < 0 || x < 0 || y >= H || x >= W){
						continue;
					}
					if(S[y][x] == '#'){
						continue;
					}
					if(step[y][x] > 0){
						continue;
					}
					step[y][x] = loop;
					que.push(P(y + 1, x));
					que.push(P(y - 1, x));
					que.push(P(y, x + 1));
					que.push(P(y, x - 1));
				}
			}
			for(int y = 0; y < H; y++){
				for(int x = 0; x < W; x++){
					ans = max(ans, step[y][x]);
				}
			}
		}
	}
	cout << ans - 1 << endl;
	return 0;
}

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

int main(){
    bool end = false ;
    while (end == false)
    {
        int n,s ;
        cin >> n >> s ;
        if (n == 0 && s == 0)
        {
            //0 0が来たら終わり
            end = true ;
            break ;
        }
        int ans = 0;
        //明らかに0のパターンはサボる
        if (s < n*(n-1)/2 || s > 9*n - n*(n-1)/2)
        {
            cout << 0 << endl ;
            continue ;
        }
        //ビット操作的な何かで、iの1ビット目を0の有無、2ビット目を1の有無...
        //というように対応させていく

        for (size_t i = 0; i < 1024; i++)
        {
            int num = i ;
            vector<int> a(10,0) ;
            //0~9それぞれについて、選ばれているかを管理する配列
            //a.at(i)→iがあれば1,なければ0
            for (size_t j = 0; j < 10; j++)
            {
                a.at(j) = num % 2 ;
                num = num /2 ;
            }
            //配列内の数の和＝要素数
            int youso = std::accumulate(a.begin(),a.end(),0) ;
            //要素数が一致したら和が一致するか判定する
            if (youso == n)
            {
                int sum = 0 ;
                for (size_t j = 0; j < 10; j++)
                {
                    if (a.at(j)==1)
                    {
                        sum += j ;
                    }
                    
                }
                if (sum == s)
                {
                    ans ++ ;
                }
                
            }
             
        }
        
        cout << ans << endl ;
        
    }
    return 0 ;
}



Measured memory_bytes: 3104
from bisect import bisect_left

n = int(input())
A=  list(map(int,input().split()))
A.sort()
am = A[-1]
amin = 0
ans = 0
for a in A[:-1]:
  if min(a, am-a) > amin:
    amin = min(a,am-a)
    ans = a
    
print(am , ans)

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

public class Main {
	public static void main(String[] args) throws IOException {
		Main mainObj = new Main();
		mainObj.solve();
	}

	public void solve() throws IOException {
		FastScanner fs = new FastScanner();
		
		int n = fs.nextInt();
		int m = fs.nextInt();
		
		int[] gateArr = new int[n+1];
		
		for(int i = 0; i < m; i++) {
			int l = fs.nextInt()-1;
			int r = fs.nextInt()-1;
			
			gateArr[l]++;
			gateArr[r+1]--;
		}
		
		int ans = 0;
		int beforeArr = 0;
		for(int i = 0; i < n;i++) {
			beforeArr = gateArr[i] + beforeArr;
			if(beforeArr == m) {
				ans++;
			}
		}
		
		System.out.println(ans);
	}

	

	public class FastScanner {

		BufferedReader reader;
		private StringTokenizer st;

		public FastScanner() {
			st = null;
			reader = new BufferedReader(new InputStreamReader(System.in));
		}

		public String next() throws IOException {
			if (st == null || !st.hasMoreElements()) {
				st = new StringTokenizer(reader.readLine());
			}
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			st = null;
			String readLine = null;
			readLine = reader.readLine();
			return readLine;
		}

		public int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		public int[] nextIntArr(int n) throws NumberFormatException, IOException {
			int[] retArr = new int[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextInt();
			}
			return retArr;
		}

		public long[] nextLongArr(int n) throws NumberFormatException, IOException {
			long[] retArr = new long[n];
			for (int i = 0; i < n; i++) {
				retArr[i] = nextLong();
			}
			return retArr;
		}

		public void close() throws IOException {
			reader.close();
		}
	}

}


Measured memory_bytes: 38952
using System;
using System.Linq;
class c
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        var ans = new int[10001];
        for (int x = 1; x < 101; x++)
        {
            for (int y = 1; y < 101; y++)
            {
                for (int z = 1; z < 101; z++)
                {
                    if (x * x + y * y + z * z + x * y + y * z + z * x > 10000) continue;
                    ans[x * x + y * y + z * z + x * y + y * z + z * x]++;
                }
            }
        }
        for (int i = 1; i <= n; i++)
        {
            Console.WriteLine(ans[i]);
        }
    }
}

Measured memory_bytes: 27436
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=500000004;
const double EPS=1e-6;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
char in[6];
int main(){
	int A,B,C,D;
	scanf("%s",in);
	A=in[0]-'0';
	B=in[1]-'0';
	C=in[2]-'0';
	D=in[3]-'0';
	
	for(int i=0;i<8;i++){
		int cur=A;
		if(i&1)cur-=B;
		else cur+=B;
		if(i&2)cur-=C;
		else cur+=C;
		if(i&4)cur-=D;
		else cur+=D;
		if(cur==7){
			printf("%d%c%d%c%d%c%d=7\n",A,(i&1)?'-':'+',B,(i&2)?'-':'+',C,(i&4)?'-':'+',D);
			return 0;
		}
	}
}

Measured memory_bytes: 128
p = 10 ** 9 + 7
def f(n):
  F = [1] * (n + 1)
  for i in range(n):
    F[i + 1] = F[i] * (i + 1) % p
  return F
def finv(F):
  n = len(F) - 1
  Finv = list(F)
  Finv[n] = pow(F[n], p - 2, p)
  for i in range(n, 0, -1):
    Finv[i - 1] = Finv[i] * i % p
  return Finv
def P(n, k):
  if n < k:
    return 0
  return F[n] * Finv[n - k] % p
N, K = map(int, input().split())
E = [[] for i in range(N)]
for _ in range(N - 1):
  a, b = map(int, input().split())
  E[a - 1].append(b - 1)
  E[b - 1].append(a - 1)
F = f(K)
Finv = finv(F)
cnt = K
V = [0] * N
Q = [0] * N
pos = 1
for i in range(N):
  q = Q[i]
  V[q] = 1
  children = 0
  parent = 0
  for adj in E[q]:
    if V[adj]:
      parent += 1
    else:
      children += 1
      Q[pos] = adj
      pos += 1
  cnt *= P(K - 1 - parent, children)
  cnt %= p
print(cnt)

Measured memory_bytes: 31408
//Nihal Mittal - nihal_47
//Strike First , Strike Hard , No Mercy !!

/**⠀⠀⠀⠀⠀⠀⣀⣤⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣰⣿⣿⣿⣿⠿⠿⣿⣿⣿⣿⣿⣿⣿⣧⢀⠀⠀⠀⠀
⠀⠀⠀⣿⣿⣿⠋⠀⠀⠀⠀⠀⠙⠀⠙⣿⣿⣿⣷⢳⢀⠀⠀⠀
⠀⠀⣠⣿⣿⣿⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⢀
⠀⠀⣸⣿⣿⣿⠸⠀⠀⠀⠒⠒⠒⠐⠀⠀⢿⣿⣿⣿⣿⣿⠀⠀
⠀⣴⣿⣿⣿⡿⠀⠒⣋⣙⡒⢰⠀⠤⣖⠒⢾⣿⣿⣿⣿⣧⠀⠀
⢺⣿⣿⣿⣿⢀⠀⠀⠉⠉⠉⠸⠀⡇⠉⠉⠀⢿⣿⣿⣿⣄⠀⠀
⠀⠙⣿⣿⣧⢻⠀⠀⠀⠀⠀⠠⠀⠰⠀⠀⠀⣸⠸⣿⣿⠿⠰⠀
⠀⠀⠀⠹⣿⣿⣿⣷⠀⡠⠙⣲⣔⣅⢡⣰⣷⣿⣿⣿⣧⠀⠀⠀
⠀⠀⠀⣼⣿⣿⣿⣿⠀⡿⠭⠭⠭⠭⢿⠀⣿⢻⣿⣿⠃⠀⠀⠀
⠀⠀⠀⠙⠛⣿⢻⠹⣿⠐⠙⠛⠟⠉⢀⣴⡟⢿⣿⡏⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⡟⠀⠀⠻⣦⣤⣶⠾⠋⠀⠀⠁⡦⢄⢀⠀⠀⠀
⠀⠀⠀⠀⡠⠁⡇⠑⢄⠀⠀⠀⠀⠀⠀⠔⠀⠀⠁⠀⠀⠀⠉⠁
⠀⠔⠊⠁⠀⠀⣇⠀⠀⠀⠑⡤⠤⢎⠁⠀⠀⡘⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⢢⠠⠀⡠⢆⠀⠀⡠⠙⢄⠀⡸⠀
**/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define l long
#define mk make_pair
#define pb push_back
#define in insert
#define se second
#define fi first
#define mod 1000000007
#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define all(v) (v).begin(),(v).end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
#define pii pair<ll,ll>
#define maxn 100005
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
using namespace std;
using namespace __gnu_pbds;

signed main()
{
    fast;
    
    ll n,i,cn=0;
    cin>>n;
    vector<pii> v;
    for(i=0;i<n;i++)
    {
    	ll x,ra;
    	cin>>x>>ra;
    	v.pb({x+ra,x-ra});
    }
    sort(all(v));
    ll en = -1000000000000;
    for(i=0;i<n;i++)
    {
    	if(en<=v[i].se)
    	{
    		en = v[i].fi;
    		cn++;
    	}
    }
    cout<<cn;
}

Measured memory_bytes: 2420
//#define _GRIBCXX_DEBUG
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <string>
#include <utility>
#include <vector>
using namespace std;


// ?????¬???????????¬??????
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<double> vd;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<long, long> pil;


// Effective std
template<typename C, typename T>
constexpr int count(C& c, T t) { return count(ALL(c), t); }

template<typename C, typename F>
constexpr int count_if(C& c, F f) { return count_if(ALL(c), f); }

template<typename C, typename T, typename U>
constexpr void replace(C& c, T t, U u) { replace(ALL(c), t, u); }

template<typename C, typename F, typename U>
constexpr void replace_if(C& c, F f, U u) { (ALL(c), f, u); }

template<typename C>
constexpr void sort(C& c) { sort(ALL(c)); }

template<typename C, typename Pred>
constexpr void sort(C& c, Pred p) { sort(ALL(c), p); }


// ??°?????????????????¬??????
typedef int Weight;

struct Edge {
  int src, dst;
  Weight weight;
  Edge(int src, int dst, Weight weight) :
    src(src), dst(dst), weight(weight) {}
};

bool operator < (const Edge &e, const Edge &f) {
  return e.weight != f.weight ? e.weight > f.weight :
    e.src != f.src ? e.src < f.src : e.dst < f.dst;
}

typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
typedef vector<Weight> Array;
typedef vector<Array> Matrix;


int main() {
  int mtrx[100][100] = {{0}};
  int n, m = 0;
  int v[100] = {0};

  cin >> n >> m;
  rep(i, n) {
    rep(j,m) cin >> mtrx[i][j];
  }
  rep(i, m) cin >> v[i];
  rep(i, n) {
    ll ret = 0;
    rep(j, m) ret += mtrx[i][j] * v[j];
    cout << ret << endl;
  }
  return 0;
}

Measured memory_bytes: 3104
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<tuple>
#include<map>
#include<bitset>
#include<queue>
#define rep(i,n) for (int i=0; i<n; i++)
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;

int main(){
  char a;
  cin >> a;

  int b = (int)a;

  cout << (b>=97? 'a' : 'A') << endl;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
 
int main () {
  int a,b,d,r;
  double f;
  cin >> a >> b;
  d = a/b;
  r = a%b;
  f = ((double)a)/((double)b);
  printf("%d %d %f\n",d,r,f);
}


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

int main() {
  int k, x;
  cin >> k >> x;

  for (int i = x - k + 1; i < x + k; i++) cout << i << endl;
}


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

using namespace std;
using ll = long long;
const ll MOD = 1000000007;

int main() {
    int n;
    string s;
    cin >> n >> s;

    vector<ll> X(26, 0);
    for (int i = 0; i < n; ++i) {
        int index = s[i] - 'a';
        X[index] += 1;
    }

    ll ans = 1;
    for (int i = 0; i < 26; ++i) {
        ans *= X[i] + 1;
        ans %= MOD;
    }
    --ans;
    cout << ans << endl;
}


Measured memory_bytes: 512
import java.util.Scanner;

public class Main {
	private void calc(){
		Scanner scanner = new Scanner(System.in);
		
		while(true){
			int a =scanner.nextInt();
			String op =scanner.next();
			int b =scanner.nextInt();
			
			if(op.equals("+")){
				System.out.println(a+b);
			}else if(op.equals("-")){
				System.out.println(a-b);
			}else if(op.equals("*")){
				System.out.println(a*b);
			}else if(op.equals("/")){
				System.out.println(a/b);
			}else if(op.equals("?"))break; 
		}
	}
	
	public static void main(String[] args) {
		Main run =new Main();
		run.calc();

	}
}

Measured memory_bytes: 18032
//https://atcoder.jp/contests/abc128/tasks/abc128_b
// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
// clang-format on
int main()
{
    int N;
    cin >> N;
    vector<tuple<string, int, int>> v;
    for (int i = 0; i < N; ++i)
    {
        string S;
        int P;
        cin >> S >> P;
        v.emplace_back(S, -P, i + 1);
    }
    sort(ALL(v));
    for (auto &x : v)
    {
        cerr << get<0>(x) << " " << get<1>(x) << endl;
        cout << get<2>(x) << endl;
    }
    return 0;
}

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

int main() {
    string s, t;
    cin >> s >> t;
    int n = s.size();

    int ans = 0;
    rep(i, n) if (s[i] != t[i]) ans++;

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


Measured memory_bytes: 3836