akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define maxn 100100
using namespace std;
struct edge{
	int u,v,w;
	void scan(){scanf("%d%d%d",&u,&v,&w);}
	int operator<(const edge& e)const{return w<e.w;}
}d[maxn];
int n,m,k,c[maxn],f[maxn],g[maxn],l,r;
long long ans;
int find(int f[],int x){
	return x==f[x]?x:f[x]=find(f,f[x]);
}
int main(){
	scanf("%d%d%d",&n,&m,&k);
	for(int i=1;i<=n;++i)scanf("%d",&c[i]);
	for(int i=1;i<=m;++i)d[i].scan();
	for(int i=1;i<=n;++i)f[i]=i,g[i]=i;
	sort(d+1,d+m+1);
	for(int i=1;i<=m&&k>1;++i){
		int u=find(f,d[i].u),v=find(f,d[i].v),cu=c[u],cv=c[v];
		if(u==v)continue;
		f[u]=v,c[v]=cv?cv:cu;
		if(cu&&cv){
			int gc=find(g,cu),gv=find(g,cv);
			if(gc==gv)continue;
			g[gc]=gv,ans+=d[i].w,k--;
		} else k--,ans+=d[i].w;
	}
	if(k>1)return puts("-1"),0;
	printf("%lld",ans);
}

Measured memory_bytes: 2560
N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

def check():
    for i in range(N-M+1):
        for j in range(N-M+1):
            if B[0] == A[i][j:j+M]:
                for k in range(1,M):
                    if B[k] != A[i+k][j:j+M]:
                        break
                else:
                    return True
    return False

if check():
    print('Yes')
else:
    print('No')



Measured memory_bytes: 3064
#include <cstdio>
#include <algorithm>

using namespace std;
typedef long long llong;

#define MAX
const llong mod = 1000000000 + 7;

int main()
{
  double L;
  double ans = 0;
  double I, J, K;
  scanf("%lf", &L);
  L = L / 3.0;
  printf("%.7lf", L * L * L);

  return 0;
}

Measured memory_bytes: 1736
import sys
input = sys.stdin.readline
N,W = map(int,input().split())
wv = [list(map(int,input().split())) for i in range(N)]
DP = [[10**18 for i in range(10**5+1)] for j in range(N+1)]
for i in range(N+1):
  DP[i][0] = 0
for i in range(1,N+1):
  for j in range(1,10**5+1):
    DP[i][j] = min(DP[i][j],DP[i-1][j])
    if j-wv[i-1][1] >= 0:
      DP[i][j] = min(DP[i][j],DP[i-1][j-wv[i-1][1]]+wv[i-1][0])
for i in range(10**5+1):
  if DP[N][i] <= W:
    ans = i
print(ans)

Measured memory_bytes: 171784
#include<stdio.h>

int main(){

int n[11]={};
int m[11]={},p[11]={};
int N;
int P=0,M=0;
bool f=true;


scanf("%d",&N);
for(int j=0;j<N;j++)
{
for(int i=0;i<10;i++)
scanf("%d",&n[i]);

for(int i=0;i<10;i++){

	if(M==0){m[M]=n[i];M++;}
	else if(m[M-1]<n[i]&&M>0){M++;m[M]=n[i];}

	else if(P==0){p[P]=n[i];P++;}
	else if(p[P-1]<n[i]&&P>0){P++;p[P]=n[i];}
	
	
else f=false;
}


if(f==true)printf("YES\n");
else if(f==false)printf("NO\n");
//for(int i=0;i<10;i++)
//	printf("%d %d\n",m[i],p[i]);

for(int i=0;i<10;i++)
{p[i]=0;m[i]=0;}

bool f=true;
P=0,M=0;


}
return 0;
}

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

int main(void){
    long long int n,a,b;
    cin >> n >> a >> b;
    if(a == b)cout << 1;
    else if(a > b || n == 1)cout << 0;
    else {
        long int min = (n-1)*a+b,max = (n-1)*b+a;
        cout << max-min+1;
    }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int n = sc.nextInt();
        int[] a = new int[n];
        int[] b = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
            b[i] = sc.nextInt();
        }
        int[] dp = new int[h + 1];
        dp[0] = 0;
        for (int i = 1; i <= h; i++) {
            dp[i] = Integer.MAX_VALUE;
            for (int j = 0; j < n; j++) {
                dp[i] = Math.min(dp[i], dp[Math.max(0, i - a[j])] + b[j]);
            }
        }
        System.out.println(dp[h]);
    }

}


Measured memory_bytes: 28156
N = int(input())
L = [[1]* 201 for _ in range(201)] 

def gcd (a,b):
  if a < b:
    a, b = b, a
  A, B = a, b
  if L[a][b] != 1:
    return L[a][b]
  while b:
    a,b = b, a % b
  L[A][B] = a
  return a

ans = 0
for x in range(1,N+1):
  for y in range(x,N+1):
    for z in range(y,N+1):
      t = gcd(x,y)
      u = gcd(t,z)
      if x==y==z:
        ans += u
      elif x!=y and y!= z:
        ans += u * 6
      else:
        ans += u * 3
      
print (ans)

Measured memory_bytes: 74820
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <cmath>
#include <vector>
#include <numeric>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <tuple>

using ll = long long int;
using ul = unsigned long long int;
const ll LL_MAX (1LL<<60);
const ll MOD (1000000007);

#define rep(i,s,e) for(ll i=(s); i<(e); i++) 

using namespace std;

using T = tuple<ll,ll>;
using Graph = vector<vector<T>>;

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

    ll n, m;
    cin >> n >> m;
    vector<ll> a(m);
    rep(i,0,m) cin >> a[i];
  
    ll work = 0; 
    rep(i,0,m)     
        work += a[i];

    ll res = n - work;
    if (res < 0)
        cout << -1 << endl;
    else
        cout << res << endl;

    return 0;
}


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

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

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)


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


long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a * g / b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}




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


signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	VE a(n); rep(i, n)cin >> a[i];
	VE l(n + 1), r(n + 1);
	rep(i, n)l[i + 1] = gcd(l[i], a[i]);
	for (int i = n - 1; i >= 0; i--) {
		r[i] = gcd(r[i+1], a[i]);
	}
	int ans = 0;
	rep(i, n) {
		//cout << l[i] << " " << r[i + 1] << endl;
		chmax(ans, gcd(l[i], r[i+1]));
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define N 41
using namespace std;
typedef long long ll;
ll n,m,a,b,p,q,d[N];
vector<ll> v[2],x[2];

int main(){
  cin>>n>>m>>a>>b>>p>>q;
  ll ans=m;
  if(a==1&&b==1){
    ll ti=min(n,m/(p+q));
    ans=min(ans,min(m-ti*(p+q),abs(min(ti+1,n)*(p+q)-m)));
  }
  ll A=1,B=1;
  for(int i=0;i<min((ll)N,n);i++){
    d[i]=p*A+q*B;
    if(i<min((ll)N,n)/2)v[0].push_back(d[i]);
    else v[1].push_back(d[i]);
    if(d[i]>m)break;
    A*=a,B*=b;
  }
  int len[2]={v[0].size(),v[1].size()};
  for(int i=0;i<2;i++){
    v[i].push_back(0);
    for(int j=0;j<(1<<len[i]);j++){
      ll sum=0;
      for(int k=0;k<len[i];k++){
	if(!(j&(1<<k)))continue;
	sum+=v[i][k];
      }
      x[i].push_back(sum);
    }
    sort(x[i].begin(),x[i].end());
  }
  for(int i=0;i<x[0].size();i++){
    ll search=m-x[0][i];
    vector<ll>::iterator r=lower_bound(x[1].begin(),x[1].end(),search);
    if(r!=x[1].end())ans=min(ans,(*r)-search);
    if(r!=x[1].begin())ans=min(ans,search-(*(r-1)));
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 27632
#include<bits/stdc++.h>
#pragma GCC optimize("O2")
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define endl            "\n"
#define forn(i,x,n)     for(int i=x; i<n; i++)
#define forit(it, m)    for(decltype(m)::iterator it = m.begin(); it!=m.end(); ++it)
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;


void zeus()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

int fast_pow(long long base, long long n, long long M)
{
    if (n == 0)
        return 1;
    if (n == 1)
        return base;
    long long halfn = fast_pow(base, n / 2, M);
    if (n % 2 == 0)
        return ( halfn * halfn ) % M;
    else
        return ( ( ( halfn * halfn ) % M ) * base ) % M;
}

int findMMI_fermat(int n, int M)
{
    return fast_pow(n, M - 2, M);
}

int32_t main() {

    zeus();

    int x, n; cin >> x >> n;
    int p[n];
    set<int> s;

    forn(i, 0, n) {
        cin >> p[i];
        s.insert(p[i]);
    }
    int ans = 0;
    int flag = 1;
    int coun = 0;
    while (flag == 1) {
        if (s.count(x - coun) == false) {
            ans = x - coun;
            flag = 0;
        }
        if (flag == 0) {
            break;
        }
        if (s.count(x + coun) == false) {
            ans = x + coun;
            flag = 0;
        }
        coun++;
    }

    cout << ans << endl;


}




Measured memory_bytes: 3664
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;

int main()
{
    int N;
    cin>>N;
    vector<int> a(N);
    for (int &t: a)
        cin>>t;
    vector<vector<int>> E(N);
    for (int i=0; i<N-1; i++)
    {
        int u, v;
        cin>>u>>v;
        E[u-1].push_back(v-1);
        E[v-1].push_back(u-1);
    }

    int oo = 1111111111;
    vector<int> T(N, oo);
    vector<int> ans(N);
    function<void(int, int)> f = [&](int c, int p)
    {
        int x = int(lower_bound(T.begin(), T.end(), a[c])-T.begin());
        int old = T[x];
        T[x] = a[c];
        ans[c] = int(lower_bound(T.begin(), T.end(), oo)-T.begin());
        for (int e: E[c])
            if (e!=p)
                f(e, c);
        T[x] = old;
    };
    f(0, -1);
    for (int x: ans)
        cout<<x<<endl;
}


Measured memory_bytes: 30608
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010

/* SimpleSegTree(0-index) */

struct SimpleSegTree{
  typedef int Type;
  int segn2;
  Type initVal;
  vector<Type> data;
  function<Type(Type, Type)> merge;
  
  SimpleSegTree(function<Type(Type, Type)> merge, int n, int initVal):
    initVal(initVal), merge(merge)
  {
    for(segn2=1; segn2<n; segn2*=2);
    data.assign(segn2*2, initVal);
  }
  
  //get minimum value [a,b)
  Type query(int a, int b, int l = 0, int r = -1, int k = 0){
    if(r == -1) r = segn2;
    if(a <= l && r <= b) return data[k];
    if(r <= a || b <= l) return initVal;
    return merge(query(a,b,l,(l+r)/2,k*2+1),query(a,b,(l+r)/2,r,k*2+2));
  }
  
  //set kth number x
  void set(int k, Type x){
    k += segn2-1;
    data[k] = x;
    while(k > 0){
      k = (k-1)/2;
      data[k] = merge(data[k*2+1], data[k*2+2]);
    }
  }
};

#define RMinQ(n) SimpleSegTree([](SimpleSegTree::Type a, SimpleSegTree::Type b){ return min(a, b); }, n, INF);
#define RMaxQ(n) SimpleSegTree([](SimpleSegTree::Type a, SimpleSegTree::Type b){ return max(a, b); }, n, -INF);
#define RSumQ(n) SimpleSegTree([](SimpleSegTree::Type a, SimpleSegTree::Type b){ return a + b; }, n, 0);
  
int main(){
  int n,q,a,b,c;
  
  scanf("%d%d", &n, &q);

  SimpleSegTree rmq([](SimpleSegTree::Type a, SimpleSegTree::Type b){ return min(a, b); }, n, (1LL << 31)-1);

  for(int i=0;i<q;i++){
    scanf("%d%d%d",&a,&b,&c);
    
    if(a==0){
      rmq.set(b, c);
    }else{
      printf("%d\n",rmq.query(b, c+1));
    }
  }
  
  return 0;
}



Measured memory_bytes: 3904
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <list>

using ll = long long;
using ld = long double;
using namespace std;
const int INF = 1e9+100;
const ll INF64 = 7e18l;
const int mod = 1000000007;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(), (a).end()
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);


int main(){
    FIN;
    ld x;
    string u;
    int n; cin >> n;

    ld ans = 0.0;
    for(int i=0;i<n;i++){
        cin >> x;
        cin >> u;
        if(u == "JPY") ans += x;
        else ans += 380000.0 * x;
    }

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



Measured memory_bytes: 256
a, b, c, d = map(int, input().split())

ans = 'Yes'

end = False
while not end:
  c -= b
  if c <= 0:
    end = True
  if end != True:
    a -= d
    if a <= 0:
      ans = 'No'
      end = True
  # print(a, c)

print(ans)

Measured memory_bytes: 9176
#ifdef ONLINE_JUDGE

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

#define ui unsigned int
#define ll long long
#define ull unsigned long long
#define ld long double

#define all(v) v.begin(), v.end()

#define speed ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

const ld PI = 3.1415926535897932384626;
ll MOD = 1000000007;
const ld EPS = 1e-9;
const int N = 3e5 + 7;

inline ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
inline ui setBits(ui v) { ui c; for(c = 0 ; v; ++c) v &= (v - 1); return c; }
inline bool isPowerOfTwo(ui v) { return (v && !(v & (v - 1))); }
ll power(ll base, ull exp, ll mod = MOD) { 
	ll res = 1; base %= mod; 
	while(exp) { 
		if(exp & 1) res = (res * base)%mod; 
		exp >>= 1; base = (base * base)%mod; 
	} 
	return res; 
}
ll modInv(ll a, ll mod = MOD) { 
	if(mod == 1) return 0; 
	ll x = 1, y = 0, m = mod; 
	while(a > 1) { 
		ll q = a/m, t = m; m = a%m; a = t; t = y; y = x - q * y; x = t; 
	} 
	if(x < 0) x += mod; 
	return x; 
}
inline ui iabs(int x) { ui y = x; return (y > 0) ? y : -y; }
inline ll add(ll a, ll b, ll mod = MOD) { ll res = (a%mod + b%mod)%mod; return res; }
inline ll sub(ll a, ll b, ll mod = MOD) { ll res = (a%mod - b%mod + mod)%mod; return res; }
inline ll mult(ll a, ll b, ll mod = MOD) { ll res = (a%mod * b%mod)%mod; return res; }
inline ll div(ll a, ll b, ll mod = MOD) { ll res = (a%mod * modInv(b, mod))%mod; return res; }

#else

#include "custom.h"
using namespace std;

#endif

void openf() {
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif	
}

int main() {
	speed;
	openf();
	int N;
	cin >> N;
	string s;
	unordered_map<string, int> umap; 
	while(N--) {
		cin >> s;
		++umap[s];
	}
	cout << "AC x " << umap["AC"] << endl;
	cout << "WA x " << umap["WA"] << endl;
	cout << "TLE x " << umap["TLE"] << endl;
	cout << "RE x " << umap["RE"] << endl;
	return 0;
}  
  


Measured memory_bytes: 3668
k,s = map(int, input().split())

x = 0
y = 0
z = 0
ans = 0
for x in range(0,k+1):
  for y in range(0,k+1):
    z = s-(x+y)
    if z >= 0 and k >= z:
      ans += 1
print(ans)

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

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

	string mat[6];
	for(int i = 0; i < h; ++i)
		cin >> mat[i];
	int ans = 0;
	for(int i = 0; i < (1<<h); ++i)
	{
		for(int j = 0; j < (1<<w); ++j)
		{
			int count = 0;
			for(int row = 0; row < h; ++row)
			{
				for(int col = 0; col < w; ++col)
				{
					if((i&(1<<row)) or (j&(1<<col)))
						continue;
					else
						count += (mat[row][col] == '#');
				}
			}
			ans += (count == k);
		}
	}
	cout << ans;

	return 0;
}

Measured memory_bytes: 3572
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl
#define trace2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define sa(a,n) for(int i =0 ; i<n ; i++) cin>>a[i]
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define scan() int n; cin>>n ; int a[n]; for(int i = 0 ; i<n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) cout<<a[i]<<' '
using namespace std;
template <typename T, typename U>
T max(T x, U y)
{
    return x>y ? x : y;
}
template <typename T, typename U>
T min(T x, U y)
{
    return x<y ? x : y;
}
ll dp[1000000];
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n;cin >> n;
    ll a[n];
    for (int i = 0; i < n; ++i)
    {
    	cin >> a[i];
    }
    for (int i = 0; i < n; ++i)
    {
    	dp[i]=1e18;
    }
    dp[0]=0;
    dp[1]=abs(a[1]-a[0]);
    for (int i = 2; i < n; ++i)
    {
    	dp[i]=min(dp[i-1]+abs(a[i]-a[i-1]),dp[i-2]+abs(a[i]-a[i-2]));
    }
    /*for (int i = 0; i < n; ++i)
    {
    	trace(dp[i]);
    }*/
    cout << dp[n-1];
    }

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

int main(){
  int M, D;cin >> M >> D;
  int count = 0;
  for(int i = 4;i <= M;++i) {
    for(int j = 22;j <= D;++j) {
      if((j % 10) * ((j - j % 10) / 10) == i&&j/10 >= 2 && (j % 10) >= 2)count++;
    }
  }
  cout << count;
}


Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<set>
#include<algorithm>
#include<vector>
#include<iomanip>
using namespace std;

static long parseans(long j, long l)
{
    string k = "";
    long cur = 0;
    for (long long i = (long long) j; i <= l; ++i)
    {
        cur *= 10;
        cur += k[i] - '0';
    }
    return cur;
}

static long gcd(long a, long b)
{
    if (b == 0)
    {
        return a;
    } else
    {
        return gcd(b, a % b);
    }
}

static bool pri(long long k)
{
    if (k == 1) return false;
    for (long long i = 2; i * i <= k; i++)
    {
        
        if (k % i == 0) return false;
    }
    return true;
}



int main()
{
    double h , w;
    cin >> h >> w;
    long long ans = 10000000005;
    for(long long i = 1; i < h; i++)
    {
        long long  A = w * i;
        long long  B = w * floor(((h - i)/2));
        long long  C = w * ceil(((h - i) /2 ));
        if(A && B && C)
            ans = min(ans , max(abs(B - C), max(abs(C - A) , abs(A - B))));
        //  cout << A << " " << B << " " << C << "\n";
        //  cout << ans << "\n";
    }
    // return 0;
    for(long long i = 1; i < h; i++)
    {
        long long  A = w * i;
        long long  B = (h - i) * floor((w)/2);
        long long  C = (h - i) * ceil((w)/2);
        if(A && B && C)
            ans = min(ans , max(abs(B - C), max(abs(C - A) , abs(A - B))));
    }
    // cout << ans << "\n";
    for(long long i = 1; i < w; i++)
    {
        long long  A =  h * i;
        long long  B =  h * floor((w-i)/2);
        long long  C =  h * ceil((w-i)/2);
        if(A && B && C)
            ans = min(ans , max(abs(B - C), max(abs(C - A) , abs(A - B))));
    }
    // cout << ans << "\n";
    for(long long i = 1; i < w; i++)
    {
        long long  A = h * i;
        long long  B = (w - i) * floor((h)/2);
        long long  C = (w - i) * ceil((h)/2);
        if(A && B && C)
            ans = min(ans , max(abs(B - C), max(abs(C - A) , abs(A - B))));
    }
    cout << ans << "\n";
    return 0;
}

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

const int N = 2e5;

typedef pair<int,int> pii;

int n,m;
int li[N+5];

vector<pii> com;

int main(){
	scanf("%d",&n);
	int maksi,mini;
	maksi = mini = 1;
	for(int i=1;i<=n;i++){
		scanf("%d",&li[i]);
		if(li[i] > li[maksi]) maksi = i;
		if(li[i] < li[mini]) mini = i;
	}
	if(-li[mini] > li[maksi]){
		for(int i=1;i<=n;i++){
			if(li[i] > 0){
				com.push_back(make_pair(mini,i));
				li[i] += li[mini];
			}
		}
		
		for(int i=n-1;i>=1;i--){
			com.push_back(make_pair(i+1,i));
		}
	} else {
		for(int i=1;i<=n;i++){
			if(li[i] < 0){
				com.push_back(make_pair(maksi,i));
				li[i] += li[mini];
			}
		}
		
		for(int i=2;i<=n;i++){
			com.push_back(make_pair(i-1,i));
		}
	}
	printf("%d\n",com.size());
	for(int i=0;i<com.size();i++){
		printf("%d %d\n",com[i].first,com[i].second);
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define ss second
#define ff first
#define all(v) v.begin(),v.end()
#define sort(v) sort(all(v))
using namespace std;
int main()
{
    string s;
    cin>>s;
    if(s=="SUN") cout<<7;
    else if(s=="SAT") cout<<1;
    else if(s=="FRI") cout<<2;
    else if(s=="THU") cout<<3;
    else if(s=="WED") cout<<4;
    else if(s=="TUE") cout<<5;
    else cout<<6;
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define each(i,a) for (auto&& i : a)
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)

const ll linf = 1e18;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    each(x,vec) is >> x;
    return is;
}
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    rep(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, const vector< vector<T> >& vec) {
    rep(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}
bool solve() {
    ll x = 0, y = 0, t = 0;
    ll n; cin >> n;
    rep(i, n) {
        ll nt, nx, ny; cin >> nt >> nx >> ny;
        ll dx = abs(nx - x);
        ll dy = abs(ny - y);
        ll dt = nt - t;
        if ( (dx + dy) % 2 != dt % 2 || dx + dy > dt ) {
            return false;
        }
        x = nx, y = ny, t = nt;
    }
    return true;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    if (solve()) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] lines = br.readLine().split(" ");
        int[] list = new int[3];
        for (int i = 0; i < 3; i++) {
            list[i] = Integer.parseInt(lines[i]);
        }
        for (int i = 0; i < 2; i++) {
            for (int j = i + 1; j < 3; j++) {
                if (list[i] > list[j]) {
                    int temp = list[i];
                    list[i] = list[j];
                    list[j] = temp;
                }
            }
        }
        for(int i=0;i<3;i++){
            System.out.print(list[i]);
            if(i!=2){
                System.out.print(" ");
            }
        }
        System.out.println();
    }
}

Measured memory_bytes: 24328
/**
 *    author:  [itmo] enot.1.10
 *    created: 23.10.2016 15:13:32       
**/
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

#define F first
#define S second
#define pb push_back
#define mp make_pair
#define forn(i, n) for(int i = 0 ; (i) < (n) ; ++i)
#define eprintf(...) fprintf(stderr, __VA_ARGS__),fflush(stderr)
#define sz(a) ((int)(a).size())
#define all(a) (a).begin(),a.end()
#define pw(x) (1LL<<(x))

using namespace std;

typedef long long ll;
typedef double dbl;
typedef vector<int> vi;
typedef pair<int, int> pi;

const int inf = 1.01e9;
const dbl eps = 1e-9;

/* --- main part --- */

const int N = 310;

char s[N][N];
int d[N][N];
int mem[N][N];

char s1[N], s2[N];
int n;

int cost(int x, int y)
{
    if (x == n || y == n) return 0;
    if (mem[x][y] != -1) return mem[x][y];
    return mem[x][y] = (s1[x] == s2[y]) + cost(x + 1, y + 1);
}

int calc()
{
    memset(mem, -1, sizeof mem);
    memset(d, 0, sizeof d);
    forn(i, n + 1) forn(j, n + 1) d[i][j] = inf;
    d[0][0] = 0;
    forn(i, n + 1) forn(j, n + 1)
    {
        d[i][j] += cost(i, j);
        if (i < n) d[i + 1][j] = min(d[i + 1][j], d[i][j]);
        if (j < n) d[i][j + 1] = min(d[i][j + 1], d[i][j]);
    }
    return d[n][n];
}



int main()
{
    #ifdef home
        assert(freopen("1.in", "r", stdin));
        assert(freopen("1.out", "w", stdout));
    #endif
    int m;
    scanf("%d%d", &n, &m);
    forn(i, n) scanf("%s", s[i]);
    ll res = 0;
    forn(i, m - 1)
    {
        forn(j, n) s1[n - 1 - j] = s[j][i];
        forn(j, n) s2[n - 1 - j] = s[j][i + 1];
        res += calc();
    }
    printf("%lld\n", res);
    #ifdef home
        eprintf("time = %d ms\n", (int)(clock() * 1000. / CLOCKS_PER_SEC));
    #endif
    return 0;
}


Measured memory_bytes: 1152
def II(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

ans=0
N,D=MI()
D2=D*D
for i in range(N):
  x,y=MI()
  if x*x+y*y<=D2:
    ans+=1
print(ans)

Measured memory_bytes: 9200
#include<iostream>
using namespace std;
int main()
{
	int i;
	string a,b;
	cin>>a>>b;
	for(i=0;i<b.size();i++)
		cout<<a[i]<<b[i];
	if(a.size()!=b.size())
		cout<<a[a.size()-1];
	return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

func checkDigit(num int) bool{
	for i:=0; i<3; i++{
		if num % 10 == 7{
			return true
		}
		num = num / 10
	}
	return false
}

func main() {
	var n int
	fmt.Scan(&n)

	if checkDigit(n) {
		fmt.Println("Yes")
	}else{
		fmt.Println("No")
	}

}

Measured memory_bytes: 1748
#include<bits/stdc++.h>
#define sz(x) x.size()
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair



using namespace std;
typedef unsigned long long ull;
typedef vector<int>vi;
typedef pair<int,int> pii;
typedef map<int,int> mii;
typedef set<int> si;

const int N = 1e5+5;
vector< pii > v;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	int n,t;
	cin >> n >> t;
	for(int i=0;i<n;i++){
		int a,b;cin >> a >> b;
		v.pb(mp(a,b));
	}
	
	sort(all(v));
	
	for(auto i : v){
		if(i.second <= t){
			cout << i.first << endl;
			return 0;
		}
	}
	cout << "TLE" << endl;
	return 0;
}


Measured memory_bytes: 256
import numpy as np
N, K = list(map(int,input().split()))
a = [int(input()) for i in range(N)]
a = sorted(a, reverse = True)
ans = np.zeros(len(a)-K+1)
for i in range(len(a)-K+1):
    ans[i] = a[i]-a[i+K-1]
print(int(ans.min()))

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

int main(){
	int n,K;cin>>n>>K;
	ll ans=0;
	for(int b=K+1;b<=n;b++){
		int cnt=(b-1-K+1)*(n/b);
		cnt+=max(0,(n%b)-K+1);
		if(K==0)cnt--;
		ans+=cnt;
	}
	cout<<ans<<endl;
}

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

int main(void){
  int a,b;
  cin >> a >> b;
  if(a + b == 15){
    cout << "+" << endl;
  } else if (a * b == 15){
    cout << "*" << endl;
  }else{
    cout << "x" << endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <utility>
#include <vector>
#include <map>
#include <unordered_map>
#include <cstdlib>
#include <stack>
#include <queue>
//#include <bits/stdc++.h>
#define mod 1000000007
const long long INF = 1LL << 60;
using namespace std;
typedef long long ll;
typedef long double ld;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main(void)
{
    ll K;

    cin >> K;

    for(ll i=1; i<=K; i++){
        cout << "ACL";
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 3508
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

int main() {
	int s, w;
	cin >> s >> w;
	if (s <= w)cout << "unsafe" << endl;
	else cout << "safe" << endl;
	return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
const int MAXN=1e5+100;
typedef long long LL;
char s[MAXN*2];
int main()
{
    int a,b;
    cin>>a>>b;
    cout<<(a*b%2?"Odd":"Even")<<endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))

def common_divisor(n):
    cd = []
    for i in range(1,int(n**0.5)+2):
        if n%i==0:
            cd.append(i)
            if i != n//i:
                cd.append(n//i)
    return set(cd)

#print(cd_dic)
cds = common_divisor(A[0]).union(common_divisor(A[1]))
ans = 1
for k in cds:
    #print(cd_dic)
    cnt = 0
    for a in A:
        if a%k!=0:
            cnt += 1
            if cnt == 2:
                break
    else:
        ans = max(ans,k)

print(ans)

Measured memory_bytes: 14076
#include<iostream>
#include<cmath>
#include<vector>

using namespace std;

int main(void) {
  int n, a, b, c;
  cin >> n >> a >> b >> c;
  int l[n];
  for (int i = 0; i < n; i++) {
    cin >> l[i];
  }
  int min_mp = 1000000000;
  for (int i = 0; i < pow(2, n); i++) {
    int ii = pow(2, n) - 1 - i;
    vector<int> digit;
    for (int z = 0; z < n; z++) {
      if (((1 << z) & ii) > 0) {
        digit.push_back(z);
      }
    }
    for (int jj = 0; jj < pow(2, digit.size()); jj++) {
      int j = 0;
      for (vector<int>::iterator z = digit.begin(); z < digit.end(); z++) {
        if (((1 << (z-digit.begin())) & jj) > 0) {
          j += pow(2, *z);
        }
      }
      int kk = pow(2, n) - 1 - i - j;
      vector<int> dd;
      for (int z = 0; z < n; z++) {
        if (((1 << z) & kk) > 0) {
          dd.push_back(z);
        }
      }
      for (int kkk = 0; kkk < pow(2, dd.size()); kkk++) {
        int k = 0;
        for (vector<int>::iterator z = dd.begin(); z < dd.end(); z++) {
          if (((1 << (z-dd.begin())) & kkk) > 0) {
            k += pow(2, *z);
          }
        }
        //k = kk;
        /*
        if (j == 14 && kk == 16) {
          cout << i << endl;
          cout << j << endl;
          cout << k << endl;
          cout << kk << endl;
          cout << kkk << endl;
        }
        */

        int l_a = 0;
        int l_b = 0;
        int l_c = 0;
        int mp = 0;
        for (int q = 0; q < n; q++) {
          if (((1 << q) & i) > 0) {
            l_a += l[q];
            mp += 10;
          } else if (((1 << q) & j) > 0) {
            l_b += l[q];
            mp += 10;
          } else if (((1 << q) & k) > 0) {
            l_c += l[q];
            mp += 10;
          }
        }
        if (l_a == 0 || l_b == 0 || l_c == 0) {
          continue;
        }
        mp -= 30;
        mp += (abs(a - l_a) + abs(b - l_b) + abs(c - l_c));
        if (mp < min_mp)  min_mp = mp;
      }
    }
  }
  cout << min_mp << endl;
  return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define all(v) v.begin(), v.end()
const ll INF = 999999999999999;
const ll MOD = 1000000007;
const ll MAX_N = 500010;
ll a, b, c, d, e, f, p, t, x, y, z, q, m, n, r, h, k, w, l, ans;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> x;
    a = x / 5;
    b = x / 3;
    c = x / 15;
    cout << x * (x + 1) / 2 - 5 * a * (a + 1) / 2 - 3 * b * (b + 1) / 2 +
                15 * c * (c + 1) / 2
         << endl;
}

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

/*素因数分解のプログラム*/
map< ll, ll > prime_factor(ll n) {
  map< ll, ll > ret;
  for(ll i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

 
int main(void){
    ll n, p;
    cin>>n>>p;
    map<ll, ll> mp = prime_factor(p);
    ll ans = 1;
    for(auto p : mp){
        if(p.second>=n){
            ll c = p.second/n;
            ans *= pow(p.first, c);
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
local h, w, m = io.read("*n", "*n", "*n")
local hlist = {}
local hcnt = {}
for i = 1, h do
  hlist[i] = {}
  hcnt[i] = 0
end
local wcnt = {}
for i = 1, w do
  wcnt[i] = 0
end
for i = 1, m do
  local hi, wi = io.read("*n", "*n")
  hlist[hi][wi] = true
  hcnt[hi] = hcnt[hi] + 1
  wcnt[wi] = wcnt[wi] + 1
end
local hmax, hmaxcnt = {}, 1
for i = 1, h do
  if hcnt[i] == hmaxcnt then
    table.insert(hmax, i)
  elseif hmaxcnt < hcnt[i] then
    for j = #hmax, 2, -1 do
      hmax[j] = nil
    end
    hmax[1] = i
    hmaxcnt = hcnt[i]
  end
end
local wmax, wmaxcnt = {}, 1
for i = 1, w do
  if wcnt[i] == wmaxcnt then
    table.insert(wmax, i)
  elseif wmaxcnt < wcnt[i] then
    for j = #wmax, 2, -1 do
      wmax[j] = nil
    end
    wmax[1] = i
    wmaxcnt = wcnt[i]
  end
end
local ret = hmaxcnt + wmaxcnt
for i = 1, #hmax do
  for j = 1, #wmax do
    if not hlist[hmax[i]][wmax[j]] then
      print(ret) os.exit()
    end
  end
end
print(ret - 1)


Measured memory_bytes: 51424
#include <cstdio>
#include <cmath>
#include <iostream>
#include <cstring>
#include <iostream>
using namespace std;
#define LL long long
const int maxN=1e5+7;
LL a[maxN],b[maxN],x[maxN],v[maxN];
int main()
{
    LL n,c;
    scanf("%lld %lld",&n,&c);
    for(int i=1;i<=n;i++)
        scanf("%lld %lld",&x[i],&v[i]);
    for(LL i=1;i<=n;i++)
        a[i]=a[i-1]+v[i]-(x[i]-x[i-1]);
    x[n+1]=c;
    for(LL i=n;i>=1;i--)
        b[i]=b[i+1]+v[i]-(x[i+1]-x[i]);
    for(LL i=2;i<=n;i++)
    {
        a[i]=max(a[i-1],a[i]);
    }
    for(LL i=n-1;i>=1;i--)
    {
        b[i]=max(b[i],b[i+1]);
    }
    LL ans=0;
    for(LL i=1;i<=n;i++)
    {
        ans=max(ans,a[i]-x[i]+b[i+1]);
        ans=max(ans,b[i]-(c-x[i])+a[i-1]);
        ans=max(ans,a[i]);
        ans=max(ans,b[i]);
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 3328
#include <iostream>
#include <cstdio>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <stdlib.h>
#include <functional>
#include <string>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#include <nmmintrin.h>
#include <chrono>
const double EPS = 1e-8;
#define Scan(a) int a;scanf("%d", &a);
#define ScanS(a) char a[500];scanf("%s", a);
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1LL)
#define bitset(a,b)      ( a |= (1LL << b))
#define bitunset(a,b)    (a &= ~(1LL << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#ifdef _MSC_VER
#define __builtin_popcount _mm_popcnt_u32
#define __builtin_popcountll _mm_popcnt_u64
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}

int gcd(int a, int b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
pii Dir[8] = {
	{ 0 ,1 },{ -1 ,0 },{ 1 ,0 },{ 0 ,-1 },
	{ 1 ,1 },{ 1 ,-1 },{ -1 ,1 },{ -1 ,-1 }
};


pii operator+(pii obj, pii obj2) {
	return MP(obj.first + obj2.first, obj.second + obj2.second);
}
pii operator-(pii obj, pii obj2) {
	return MP(obj.first - obj2.first, obj.second - obj2.second);
}

int main() {
	int n;
	cin >> n;
	vector<int> num(n);
	REP(i, n) {
		scanf("%d", &num[i]);
	}

	int dp[101][101][11] = {};
	REP(i, n) {
		dp[i][i][num[i]] = 1;
	}
	rep(i, 1, n) {
		REP(j, n - i) {
			rep(k, 0, i) {
				dp[j][j + i][10] |= dp[j][j + k][10] & dp[j + k + 1][j + i][10];
				REP(l, 10) {
					dp[j][j + i][10] |= dp[j][j + k][l] & dp[j + k + 1][j + i][l];
					dp[j][j + i][l] |= (dp[j][j + k][l] & dp[j + k + 1][j + i][l]) | (dp[j][j + k][l] & dp[j + k + 1][j + i][10]) | (dp[j][j + k][10] & dp[j + k + 1][j + i][l]);
				}
			}
		}
	}
	cout << (dp[0][n-1][10] ? "yes" : "no") << endl;
	return 0;
}

Measured memory_bytes: 3680
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        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");
    }
}



Measured memory_bytes: 26236
// ALDS1_01 Insertion Sort
import java.io.*;

class Main {
   public static void main(String[] args) {
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

      try { 
         int N = Integer.parseInt(br.readLine());
         int[] A = new int[N];
         String[] input = br.readLine().split(" ");
         for (int i = 0; i < N; i++) {
            A[i] = Integer.parseInt(input[i]);
         }
         insertionSort(A, N);
      }
      catch (Exception e) {
         e.printStackTrace();
      }
   }
   public static void insertionSort(int[] A, int N) {
      for (int i = 1; i <= A.length - 1; i++) {
         for (int k = 0; k < N; k++) {
            System.out.print((k == N - 1) ? A[k] + "\n" : A[k] + " ");
         }
         int key = A[i];
         int j = i - 1;
         while (j >= 0 && A[j] > key) {
            A[j + 1] = A[j];
            j--;
         }
         A[j + 1] = key;
      }
      for (int k = 0; k < N; k++) {
         System.out.print((k == N - 1) ? A[k] + "\n" : A[k] + " ");
      }
   }
}

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

int main() {
  int N, M;
  cin >> N >> M;
  int a[2 * M];
  int ans[N + 1] = {0};
  for (int i = 0; i < 2 * M; i++) {
    cin >> a[i];
    ans[a[i]]++;
  }
  for (int i = 1; i <= N; i++) {
    cout << ans[i] << endl;
  }

return 0;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, usize);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
pub fn gcd(x: i64, y: i64) -> i64 {
    if y == 0 {
        x.abs()
    } else {
        gcd(y, x % y)
    }
}

fn solve() {
    input! {
        s: String,
    }
    let ans = match &*s {
        "A" => "T",
        "T" => "A",
        "C" => "G",
        "G" => "C",
        _ => unreachable!(),
    };
    println!("{}", ans);
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


Measured memory_bytes: 8572
#include <cstdio>
#include <cstring>
static const int MAXN = 100005;

char s[MAXN];

int main()
{
    scanf("%s", s);
    int ans = 0, len = strlen(s);
    for (int i = 1; i < len; ++i) ans += (s[i] != s[i - 1]);
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define pie 3.141592653589793238462643383279
#define INF 1000000007
#define ggr getchar(); getchar();return 0;
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}

int n, k, h[100010], dp[100110];

signed main() {
	cin >> n >> k;
	rep(i, n) {
		cin >> h[i];
		dp[i] = INF;
	}
	dp[0] = 0;
	rep(i, n) {
		for (int j = 1; j <= k; j++) {
			dp[i + j] = min(dp[i + j], dp[i] + abs(h[i + j] - h[i]));
		}
	}
	cout << dp[n - 1] << endl;
	ggr
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace __gnu_pbds;
using namespace std;
 
typedef   long long int ll;
typedef unsigned long long int sll;
typedef  double ld;
#define A 1000000007ll
#define B 998244353ll
#define C 1000000000000000000ll
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define oset tree<pair<ll,ll>, null_type,less<pair<ll,ll>>, rb_tree_tag,tree_order_statistics_node_update> 
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define ve vector
#define br break
#define PI 3.14159265358979323

int main() 
{
    FAST;
    ll a,b,c,k;
    cin>>a>>b>>c>>k;
    ll ans=0;
    ans=min(a,k);
    k=k-ans;
    k=k-min(b,k);
    ans=ans-k;
    cout<<ans;
    //cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
    return 0;
}

Measured memory_bytes: 3628
## main

while true
  m, n = gets.strip.split(' ').map{|s| s.to_i}
  break if m == 0 && n == 0

  players = (1..m).to_a
  cur_p = 0

  for num in (1..n)
    s = gets.strip
    next if players.length == 1

    div3 = (num % 3 == 0)
    div5 = (num % 5 == 0)
    expected =
      (div3 && div5) ? 'FizzBuzz' :
      div3 ? 'Fizz' :
      div5 ? 'Buzz' :
      num.to_s
    #p [pn, s, expected]

    if s != expected
      players.delete_at(cur_p)
      cur_p %= players.length
    else
      cur_p = (cur_p + 1) % players.length
    end
  end

  puts players.join(' ')
end

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

int main() {
	int n,x,sum=0,min=2000;
	cin >> n >> x;
	int a[n];
	
	for(int i=0;i<n;i++){
		cin >> a[i];
		sum=sum+a[i];
		if (min>a[i])
			min =a[i];
	}
	cout << (x-sum)/min+n << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <utility>
#include <map>
#include <list>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>

// #define cerr if(false)cerr
#define watch(x) cerr << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {
	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";
    return out;
}
template <typename T, typename N>
std::ostream &operator <<(std::ostream &out, vector<pair<T, N> > &v) {
	for (size_t i = 0; i < v.size(); ++i)
		out << "(" << v[i].first << ", " << v[i].second << ") ";
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<vector<T> > &v) {
	for (size_t i = 0; i < v.size(); ++i) {
		for (size_t j = 0; j < v[i].size(); ++j) {
			out << v[i][j] << " ";
		}
		out << "\n";
	}
   	return out;
}

int main() {

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

	int n, x;
	cin >> n >> x;

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

	sort(candies.begin(), candies.end());

	int max_children = 0;
	for (int i = 0; i < n; ++i) {
		if (x >= candies[i]) {
			++max_children;
			x -= candies[i];
		} else {
			cout << max_children << "\n";
			return 0;
		}
	}

	if (!x) {
		cout << max_children << "\n";
	} else {
		cout << max(0, max_children - 1) << "\n";
	}

	return 0;

}

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

int main(){
    int N,K;
    long long ans = 0;
    cin>>N>>K;
    vector<long long> p(N);
    vector<long long> sum(N+1);
    sum[0] = p[0];

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

    for(int i=0; i<N; i++){
        sum[i+1] += sum[i]+p[i];
    }

    for(int i=0; i<=N-K; i++){
        if(i != 0) ans = max(ans,sum[i+K]-sum[i]);
        else if(i == 0){
            ans = sum[i+K];
        }
    }

    cout<<setprecision(6)<<fixed;

    cout<<(long double)(ans)/2<<endl;

    return 0;

}

Measured memory_bytes: 3328