akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<math.h>

int main(void){
int i,n,x[105],y[105];
double P1,P2,P3,P8,S;

scanf("%d",&n);
for(i=0;i<n;i++){scanf("%d",&x[i]);}
for(i=0;i<n;i++){scanf("%d",&y[i]);}
S=0;
for(i=0;i<n;i++){
	S=S+(double)abs(x[i]-y[i]);
}
P1=S;
S=0;
for(i=0;i<n;i++){
	S=S+(double)((abs(x[i]-y[i]))*(abs(x[i]-y[i])));
}
P2=sqrt(S);
S=0;
for(i=0;i<n;i++){
	S=S+(double)((abs(x[i]-y[i]))*(abs(x[i]-y[i]))*(abs(x[i]-y[i])));
}
P3=pow(S,(double)1/3);
S=abs(x[0]-y[0]);
for(i=1;i<n;i++){
if(S<abs(x[i]-y[i])){S=abs(x[i]-y[i]);}
}
P8=S;

printf("%lf\n",P1);
printf("%lf\n",P2);
printf("%lf\n",P3);
printf("%lf\n",P8);
	return 0;
}

Measured memory_bytes: 672
import math

i = int(input())

print(i,end="")
print(":",end="")

while i>1:
    d=2
    while i%d != 0:
        if d>=math.sqrt(i):
            d=i
            break
        d += 1
    
    print(" ",end="")
    print(d, end="")
    i = i // d
print()


Measured memory_bytes: 5660
#include <stdio.h>

const int inf = -1;
int leaf[200001];

typedef struct {
	int left, right, max;
} seg_node;

void init_node(seg_node v[], int k, int l, int r)
{
	v[k].left = l;
	v[k].right = r;
	v[k].max = inf;
	if (l < r) {
		init_node(v, k << 1, l, (l + r) / 2);
		init_node(v, (k << 1) ^ 1, (l + r) / 2 + 1, r);
	} else leaf[l] = k;
}

void update_node(seg_node v[], int k, int x)
{
	int i, j = leaf[k];
	v[j].max = x;
	for (i = j >> 1; i > 0; j = i, i >>= 1) v[i].max = (v[j].max > v[j^1].max)? v[j].max: v[j^1].max;
}
 
int get_max(seg_node v[], int k, int l, int r)
{
	int tmp[2];
	if (v[k].right < l || v[k].left > r) return inf;
	else if (v[k].left >= l && v[k].right <= r) return v[k].max;
	else {
		tmp[0] = get_max(v, k << 1, l, r);
		tmp[1] = get_max(v, (k << 1) ^ 1, l, r);
		return (tmp[0] < tmp[1])? tmp[1]: tmp[0];
	}
}

int BS_left(seg_node v[], int k, int l, int r, int x)
{
	int tmp;
	if (v[k].max < x || v[k].right < l || v[k].left > r) return r + 1;
	else if (v[k].left == v[k].right) return v[k].left;
	else {
		tmp = BS_left(v, k << 1, l, r, x);
		if (tmp <= r) return tmp;
		else return BS_left(v, (k << 1) ^ 1, l, r, x);
	}
}

int BS_right(seg_node v[], int k, int l, int r, int x)
{
	int tmp;
	if (v[k].max < x || v[k].right < l || v[k].left > r) return r + 1;
	else if (v[k].left == v[k].right) return v[k].left;
	else {
		tmp = BS_right(v, (k << 1) ^ 1, l, r, x);
		if (tmp <= r) return tmp;
		else return BS_right(v, k << 1, l, r, x);
	}
}

int main()
{
	int i, N, Q, A;
	seg_node v[600001];
	scanf("%d %d", &N, &Q);
	init_node(v, 1, 1, N);
	for (i = 1; i <= N; i++) {
		scanf("%d", &A);
		update_node(v, i, A);
	}
	
	int t, x, y;
	for (i = 1; i <= Q; i++) {
		scanf("%d %d %d", &t, &x, &y);
		if (t == 1) update_node(v, x, y);
		else if (t == 2) printf("%d\n", get_max(v, 1, x, y));
		else printf("%d\n", BS_left(v, 1, x, N, y));
	}
	fflush(stdout);
	return 0;
}

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

const int INF = 1 << 28;

int main ()
{
    int n, m;
    while (cin >> n >> m, n || m) {
        vector<vector<int> > dp(n + 1, vector<int>(256, INF));

        vector<int> c(m);
        vector<int> x(n);

        for (auto &i : c) cin >> i;
        for (auto &i : x) cin >> i;

        dp[0][128] = 0;

        for (int i = 1; i <= n; i++) {
            for (int j = 0; j < 256; j++) {
                for (int k = 0; k < m; k++) {
                    int pre = j + c[k];
                    if (pre > 255) pre = 255;
                    if (pre < 0) pre = 0;

                    dp[i][pre] = min(dp[i][pre], dp[i-1][j] + (pre - x[i-1]) * (pre - x[i-1]));
                }
            }
        }

        int res = INF;
        for (int i = 0; i < 256; i++) {
            res = min(res, dp[n][i]);
        }

        cout << res << endl;
    }

    return 0;
}

Measured memory_bytes: 22068
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG 
#define rep(i, n) for (int i = 0; i < n; i++)
#define reps(i, s, n) for (int i = s; i < n; i++)
#define all(v) v.begin(), v.end() // sort(all(array))
#define INF 1000000000
#define mod 1000000007
using namespace std;
using ll = long long;
using vi = vector<int>; //vi array(要素数, 初期値)
using pll = pair<ll, ll>;
using pii = pair<int, int>;
using vc = vector<char>;
using vs = vector<string>;
using vb = vector<bool>;
using vvi = vector<vi>; //vvi table(行数, vi(列数, 初期値))
using vvc = vector<vc>;
using vvs = vector<vs>;
using vvb = vector<vb>;

int main() {
    ll n, d; cin >> n >> d;
    int cnt = 0;

    rep(i, n) {
        ll x, y; cin >> x >> y;
        if (x*x + y*y <= d*d) cnt++;
    }

    cout << cnt << endl;
}

Measured memory_bytes: 3632
n, c, k = (int(x) for x in input().split())
t = []
for _ in range(n): t.append(int(input()))
t.sort()
a = c_ = idx = 0
t_ = t[0]
while idx < n:
    if t[idx] - t_ > k or c_ == c :
        a += 1
        t_ = t[idx]
        c_ = 0
    elif idx == n - 1:
        idx += 1
        a += 1
    else:
        idx += 1
        c_ += 1
print(a)

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

int main(){
    long int A,B,V,W;
    int T;

    cin >> A >> V >> B >> W >> T;
    bool ans =0;
    if(A<B){
        A=A+V*T;
        B=B+W*T;
        if(A>=B){
            ans =1;
        }
    }else{
        A=A-V*T;
        B=B-W*T;
        if(A<=B){
            ans=1;
        }
    }

    if(ans){
        cout << "YES" << endl;
    }else {
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <string>
#include <stdlib.h>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <climits>
#include <iomanip>
#include <deque>

using namespace std;

int main()
{
  int64_t H;

  cin >> H;

  int attack_layer = 0;
  int64_t attack_num = 0;
  while (true) {
    attack_layer++;
    if (H == 1) {
      break;
    }
    else {
      H = H / 2;
    }
  }

  attack_num = pow(2, attack_layer) - 1;

  cout << attack_num << endl;

  return 0;
}


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

int n,k;
int t;
int b[105000];
bool p;
int main() {
	
	scanf("%d%d",&n,&k);
	
	int lx,s=0;
	for(int i=1;i<=n;i++) {
		char ch;
		ch=getchar();
		while (ch!='0' && ch!='1') ch=getchar();
		int x=ch-48;
		if (i==1) s++,p=(x==1);
		else {
			if (x!=lx) b[++t]=s,s=1;
			else s++;
		}
		lx=x;
	}
    b[++t]=s;
    
    //for(int i=1;i<=t;i++ )cout <<b[i]<<endl;
    
    
	if (p) {
		int sum=0,l=0,r;
		for(int i=1;i<=t;i++) {
			sum+=b[i];
			if (l == k) {
				r=i+1;
				break;
			} 
			if (!(i&1)) l++;
		}
		l=1;int ans=sum;
		for(;r<=t;r+=2,l+=2) {
			sum-=b[l];
			sum-=b[l+1];
			sum+=b[r];
			sum+=b[r+1];
			ans=max(ans,sum);
		}
		printf("%d",ans);	
	}
	
	else {
		int sum=0,l=0,r;
		for(int i=1;i<=t;i++) {
			sum+=b[i];
			if (l == k) {
				r=i+1;
				break;
			} 
			if (i&1) l++;
		}
		l=0;int ans=sum;
		for(;r<=t;r+=2,l+=2) {
			sum-=b[l];
			sum-=b[l+1];
			sum+=b[r];
			sum+=b[r+1];
			ans=max(ans,sum);
		}
		printf("%d",ans);
	}
	
	return 0;
}

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

using namespace std;

int main(){
    int N, M;
    while(cin >> N >> M){
        vector<int> a(N+1, 0), b(N+1, 0);
        for(int i=0;i<M;i++){
            int u, v; cin >> u >> v;
            if(u == 1) a[v] = 1;
            if(v == N) b[u] = 1;
        }
        bool ok = false;
        for(int i=2;i<N;i++) if(a[i] && b[i]) ok = true;
        cout << (ok ? "POSSIBLE" : "IMPOSSIBLE") << endl;
    }
}

Measured memory_bytes: 1792
import java.util.*;
 
public class Main {
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	String s = sc.next();
        int n[] = new int[4];
        String ans = "";
        for(int i = 0; i < 4; i++){
        	n[i] = Integer.parseInt(s.substring(i, i + 1));
        }
        if(n[0] + n[1] + n[2] + n[3] == 7){
        	ans = n[0] + "+" + n[1] + "+" + n[2] + "+" + n[3];
        }else if(n[0] + n[1] + n[2] - n[3] == 7){
        	ans = n[0] + "+" + n[1] + "+" + n[2] + "-" + n[3];
        }else if(n[0] + n[1] - n[2] + n[3] == 7){
        	ans = n[0] + "+" + n[1] + "-" + n[2] + "+" + n[3];
        }else if(n[0] - n[1] + n[2] + n[3] == 7){
        	ans = n[0] + "-" + n[1] + "+" + n[2] + "+" + n[3];
        }else if(n[0] + n[1] - n[2] - n[3] == 7){
        	ans = n[0] + "+" + n[1] + "-" + n[2] + "-" + n[3];
        }else if(n[0] - n[1] + n[2] - n[3] == 7){
        	ans = n[0] + "-" + n[1] + "+" + n[2] + "-" + n[3];
        }else if(n[0] - n[1] - n[2] + n[3] == 7){
        	ans = n[0] + "-" + n[1] + "-" + n[2] + "+" + n[3];
        }else if(n[0] - n[1] - n[2] - n[3] == 7){
        	ans = n[0] + "-" + n[1] + "-" + n[2] + "-" + n[3];
        }
        System.out.println(ans + "=7");
    }
}

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

using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<string> svec;

#define IN_LL(in) ll in; cin >> in
#define IN_STR(in) string in; cin >> in
#define IN_VEC(in, size) vec in; for(int i = 0; i < (size); ++i){int ____cur; cin >> ____cur; in.push_back(____cur); } 0
#define IN_SVEC(in, size) svec in; in.reserve(size); for(ll i = 0; i < (size); ++i) cin >> in[i]

#define OUT(out) cout << (out);
#define OUT_VEC(out) for(ll i = 0; i < (out).size(); ++i) cout << (out)[i];

ll func(ll day, vec a){
	ll res = day;
	for(ll hw : a){
		res -= hw;
	}
	if(res < 0) res = -1;

	return res;
}

int main(void){
	IN_LL(n); IN_LL(m);
	IN_VEC(a, m);

	ll out = func(n, a);

	OUT(out);
	return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
#define LEN 100005

typedef struct pp{
	char name[100];
	int t;
} P;

P Q[LEN];
int head,tail,n;

void enqueue(P x){
	Q[tail]=x;
	tail=(tail+1)%LEN;
}

P dequeue(){
	P x=Q[head];
	head=(head+1)%LEN;
	return x;
}

int main(){
	int elaps=0,c;
	int i,q;
	P u;
	cin>>n>>q;
	
	for(i=1;i<=n;i++){
		cin>>Q[i].name>>Q[i].t;
	}
	head=1; tail=n+1;
	
	while(head!=tail){
		u=dequeue();
		c=min(q,u.t);
		u.t-=c;
		elaps+=c;
		if(u.t>0) enqueue(u);
		else{
			cout<<u.name<<" "<<elaps<<endl;
		}
	}
	return 0;
}



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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	while(true){
		int n; cin>>n;
		if(n==0)break;
		int sum=0,ave=0;
		for(int i=0;i<n;++i){
			int s; cin>>s;
			sum+=s*s,ave+=s;
		}
		cout<<fixed<<setprecision(8)<<sqrt(1.0*sum/n-pow(1.0*ave/n,2))<<"\n"s;
	}
}


Measured memory_bytes: 3252
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<fstream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")

const ll mod = 1e9 + 7;
const ll inf = 1e18;

template < typename T >
void vprint(T &V){
    cout << V[0];
    ll L = V.size();
    FOR(i, 1, L){
        cout << " " << V[i];
    }
    cout << endl;
}

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

    // input
    ll N;
    cin >> N;

    vector<ll> P(N);
    FOR(i, 0, N){
        cin >> P.at(i);
    }

    vector<ll> A(N);
    FOR(i, 0, N){
        A[i] = 45000 * (i+1);
    }
    
    vector<ll> B(N);
    FOR(i, 0, N){
        B[i] = 1000000000 - A[i];
    }

    // vprint(A);
    // vprint(B);


    FOR(i, 0, N){
        ll index = P[i]-1;
        ll minus = N-i;
        A[index] -= minus;
        B[index] -= minus;
    }
    // br();
    // vprint(A);
    // vprint(B);

    // FOR(i, 0, N){
    //     pn(A[i]+B[i]);
    // }

    vprint(A);
    vprint(B);

    return 0;
}

Measured memory_bytes: 1152
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
inf = 10**17
mod = 10**9 + 7
#s=input().rstrip()

x=I()
pr=100
for i in range(100000):
    pr=int(pr*1.01)
    if pr>=x:
        print(i+1)
        sys.exit()

Measured memory_bytes: 9484
n=int(input())
A=[0]*n
S=input()

for i in range(n):
    if S[i]=="E":
        A[i]=1
E=sum(A)
e=E

ans=n+10
for i in range(n):
    if A[i]==1:
        e-=1
        ans=min(e+i-(E-e-1),ans)
    else:
        ans=min(e+i-(E-e),ans)
print(ans)

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

#define pb push_back
using namespace std;
 
int main()
{

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

    long n;
    cin>>n;
    long ar[n+1]={0};
    long x,y;
    for(long i=0;i<n-1;i++)
    {
    	cin>>x;
    	ar[x]++;
    }

    for(long i=1;i<=n;i++)
    {
    	cout<<ar[i]<<endl;
    }


	return 0;
}

Measured memory_bytes: 5204
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define RFOR(i,a,b) for(int i=(a);i>=(b);--i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define RREP(i,n) for(int i=(n-1);i>=0;--i)
#define CO cout<<
#define EN <<endl
#define CI cin>>

using namespace std;

int main() {
	int a, b; CI a >> b;
	int ans = 0;
	FOR(i, a, b) {
		int c = i % 10, d = i / 10000%10, e = i / 10 % 10, f = i / 1000 % 10;
		if (c == d && e == f)ans++;
	}
	CO ans EN;
  	return 0;
}

Measured memory_bytes: 384
n,d=map(int,input().split())
X=[[int(_) for _ in input().split()] for i in range(n)]
sqr_list=[]
for i in range(130):
    sqr_list.append(i**2)
count=0
for i in range(n-1):
    for j in range(i+1,n):
        sum=0
        for k in range(d):
            sum+=(X[i][k]-X[j][k])**2
        if sum in sqr_list:
            count+=1
print(count)

Measured memory_bytes: 3064
import java.util.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner in = new Scanner(System.in);
        long n = in.nextInt();
        long m = in.nextInt();
        long k[] = new long[11];
        long p[] = new long[11];
        int s[][] = new int[11][11];
        for (int i = 0; i < m; i++) {
            k[i] = in.nextInt();
            for (int j = 0; j < k[i]; j++) {
                s[i][j] = in.nextInt() - 1;
            }
        }
        for (int i = 0; i < m; i++) {
            p[i] = in.nextInt();
        }

        long res = 0;
        for (int b = 0; b < (1 << n); b++) {
            boolean ok = true;
            for (int i = 0; i < m; i++) {
                int cnt = 0;
                for (int j = 0; j < k[i]; j++) {
                    if (((b >> s[i][j]) & 1) == 0) {
                        continue;
                    }
                    cnt++;
                }
                if (cnt % 2 != p[i]) {
                    ok = false;
                    break;
                }
            }
            if (ok) {
                res++;
            }
        }
        System.out.println(res);
    }
}

Measured memory_bytes: 21844
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>
#include <random>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
//#define int long long

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

void solve() {
    int h,w;
    cin >> h >> w;
    int a,b;
    set<PII> s;
    multiset<int> m;
    REP(i,0,w) s.emplace(i,i);
    REP(i,0,w) m.insert(0);
    s.emplace(1<<30,1<<30);
    m.insert(1<<30);
    REP(i,0,h) {
        cin >> a >> b;
        --a;
        --b;
        auto it = s.lower_bound(MP(a,0));
        auto bt = it;
        int lv = -1;
        while (it != s.end() && it->first <= b) {
            chmax(lv, it->second);
            int diff = it->first - it->second;
            m.erase(m.lower_bound(diff));
            ++it;
        }

        if (it != bt) {
            s.erase(bt, it);
        }

        if (lv > -1 && b + 1 < w && s.lower_bound(MP(b+1,0))->first != b+1) {
            s.emplace(b+1,lv);
            m.insert(b+1-lv);
        }

        if ((*m.begin()) == 1<<30) cout << -1 << endl;
        else cout << (*m.begin()) + i + 1 << endl;
    }
}

signed main() {
    solve();
    
    return 0;
}

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

using namespace std;
typedef long long LL;

#define MAXN 1001
#define MOD 1000000007
#define mp make_pair

char S[MAXN];
int W;

int main(int argc, char **argv)
{
#ifdef OJ
    freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);
#endif
    ios::sync_with_stdio(false);

    cin >> S >> W;

    int N = strlen(S);
    for (int i = 0; i < N; i+=W) 
        cout << (char)S[i];

    cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    a = a+b;
    c = c+d;
    if(a<c) cout << "Right\n";
    else if(a>c) cout << "Left\n";
    else cout << "Balanced\n";
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TOPSIC
{
    partial class Program
    {
        static void Main(string[] args)
        {
          string[] ST = Console.ReadLine().Split(' ');

            string S = ST[0];
            string T = ST[1];

            string[] AB = Console.ReadLine().Split(' ');

            int A = int.Parse(AB[0]);
            int B = int.Parse(AB[1]);

            string U = Console.ReadLine();


            if (S == U)
            {
                A--;
            }
            else
            {
                B--;
            }


            Console.WriteLine(A + " " + B);


        }
    }
}

Measured memory_bytes: 11092
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string[]str = Console.ReadLine().Split();
		int X = int.Parse(str[0]);
		int Y = int.Parse(str[1]);
		int A = int.Parse(str[2]);
		int B = int.Parse(str[3]);
		int C = int.Parse(str[4]);
		int[]A1 = new int[A];
		int[]B1 = new int[B];
		int[]C1 = new int[C];
		string[]str2 = Console.ReadLine().Split();
		string[]str3 = Console.ReadLine().Split();
		string[]str4 = Console.ReadLine().Split();
		for(var i=0;i<A;i++){
			A1[i] = int.Parse(str2[i]);
		}
		for(var i=0;i<B;i++){
			B1[i] = int.Parse(str3[i]);
		}
		for(var i=0;i<C;i++){
			C1[i] = int.Parse(str4[i]);
		}
		Array.Sort(A1,(x,y)=>y-x);
		Array.Sort(B1,(x,y)=>y-x);
		Array.Sort(C1,(x,y)=>y-x);
		var list1 = new List<int>();
		long sum = 0;
		for(var i=0;i<X;i++){
			list1.Add(A1[i]);
			sum += A1[i];
		}
		for(var i=0;i<Y;i++){
			list1.Add(B1[i]);
			sum += B1[i];
		}
		list1.Sort();
		int a1 = 0;
		int b1 = 0;
		while(true){
			if(list1[a1]<C1[b1]){
				sum += C1[b1]-list1[a1];
				a1++;
				b1++;
				if(a1>=list1.Count||b1>=C){
                  break;
                }
            } else {
			if(a1<list1.Count-1){
				a1++;
			} else if(b1<C-1){
				b1++;
			} else {
				break;
			}
            }
		}
		Console.WriteLine(sum);
	}
}

Measured memory_bytes: 43084
#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

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

int card[2][5000];
int a, b;

int main() {
	cin >> a >> b;
	
	REP(i, a) scanf("%d", &card[0][i]);
	REP(i, b) scanf("%d", &card[1][i]);
	
	int ans = 0;
	REP(i, b) {
		int pos = i;
		REP(j, a) {
			if (pos >= b) break;
			if (card[0][j] != card[1][pos]) continue;
			pos++;
		}
		ans = max(ans, pos - i);
	}

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

Measured memory_bytes: 1288
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <iostream>

using namespace std;

int main(void) {
	int n, i, a, b, sum = 0;
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d %d", &a, &b);
		sum += b - a + 1;
	}
	printf("%d\n", sum);
	return 0;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
template<typename T>
using pque = priority_queue<T, vector<T>, greater<T>>;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

int main(){
	int a, b, c, d; scanf("%d%d%d%d", &a, &b, &c, &d);
	while(1){
		c -= b;
		if(c <= 0){
			printf("Yes\n");
			return 0;
		}
		a -= d;
		if(a <= 0){
			printf("No\n");
			return 0;
		}
	}
}


Measured memory_bytes: 3772
n = gets.to_i
numbers = gets.split(" ").map(&:to_i)

def gcd(n, m)

  n, m = m, n if m > n
  #p [n, m]

   loop {
    r = n % m
    break if r == 0
    n, m = m, r
  }
  m
end

gcd_from_left = []
gcd_from_right = []

gcd_from_left.push(numbers.first)
numbers[1..numbers.length - 1].each do |number|
  gcd_from_left.push(gcd(number, gcd_from_left.last))
end

gcd_from_right.push(numbers.last)
numbers[0..numbers.length - 2].reverse.each do |number|
  gcd_from_right.push(gcd(number, gcd_from_right.last))
end

gcd_from_right.reverse!

gcd_except_target = []

if(gcd_from_left.length > 2)
  gcd_from_left[0..gcd_from_left.length - 3].each_with_index do |number, index|
    gcd_except_target.push(gcd(number, gcd_from_right[index + 2]))
  end
end

gcd_except_target.push(gcd_from_left[-2])
gcd_except_target.push(gcd_from_right[1])

puts gcd_except_target.max

Measured memory_bytes: 14532
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace A
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var ABC = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
            var answer = 0;
            if (ABC[0] == ABC[1]) answer = ABC[2];
            if (ABC[0] == ABC[2]) answer = ABC[1];
            if (ABC[1] == ABC[2]) answer = ABC[0];
            Console.WriteLine(answer);
        }
    }
}


Measured memory_bytes: 27852
#pragma G++ optimize (2)
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <queue>
#define INF 0x3f3f3f3f
#define NO 30005
#define MO 100005
typedef long long ll;
typedef double db;
using namespace std;
inline ll read()
{
	char ch = ' ', last;
	ll ans = 0;
	while (ch < '0' || ch > '9')
		last = ch, ch = getchar();
	while (ch >= '0' && ch <= '9')
		ans = ans * 10 + int(ch - '0'), ch = getchar();
	if (last == '-')
		return -ans;
	return ans;
}
void write(ll x)
{
	if (x >= 10)
		write(x / 10);
	putchar(x % 10 + '0');
}
//head

string x;
//variable

void init()
{
	cin >> x;
}
//functions

int main()
{
	init();
	bool f1 = false, f2 = false;
	if (x[0] == '0')
		if (x[1] > '0')
			f1 = true;
	if (x[0] == '1')
		if (x[1] >= '0' && x[1] <= '2')
			f1 = true;
	if (x[2] == '0')
		if (x[3] > '0')
			f2 = true;
	if (x[2] == '1')
		if (x[3] >= '0' && x[3] <= '2')
			f2 = true;
	if (f1 && f2)
		cout << "AMBIGUOUS" << endl;
	else if(f1)
		cout << "MMYY" << endl;
	else if(f2)
		cout << "YYMM" << endl;
	else
		cout << "NA" << endl;
	return 0;
}
//main

Measured memory_bytes: 256
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace Test
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var r = cin.ReadInt;
            var D = cin.ReadInt;
            var x = cin.ReadInt;

            var xi = new List<int> {x};

            for(int i = 1; i < 11; i++){
                xi.Add(r * xi[i-1] - D);
                WriteLine(xi[i]);
            }
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}

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


int main() {
    ll n,d,x,y,ans=0;
    map<pair<ll,ll>,int> mp;
    cin >> n >> d;
    rep(i,n){
        cin >> x >> y;
        //if(mp[make_pair(x,y)]==0){
            mp[make_pair(x,y)] = 1;
            if(x*x + y*y <= d*d) ans++;
        //}
    }
    cout << ans << endl;

}

Measured memory_bytes: 16128
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m;
    cin>>n>>m;
    int arr[m];
    for(int i=0;i<m;i++){
        cin>>arr[i];
    }
    int sum = 0;
    for(int i=0;i<m;i++)
    sum+=arr[i];
    if(n - sum>=0)cout<<n-sum<<"\n";
    else cout<<"-1\n";
    return 0;
}

Measured memory_bytes: 3660
#include<cstdio>
#include<cstring>
#include<cmath>
#include<string>
#include<iostream>
using namespace std;

int main()
{
    long long int a, b, c, d, e;

    while (cin >> a >> b)
    {
        c = a + b;
        d = a - b;
        e = a * b;

        a = max(c, d);
        a = max(a, e);

        cout << a << endl;
    }

	return 0;
}


Measured memory_bytes: 256
import random
import sys
    
sys.setrecursionlimit(100000)
    
n, m = map(int, input().split())
# n, m = 200000, 200000
group = {i: 0 for i in range(1, n+1)}
edge = {}
g_mem = {}
g_num = 0
g_con = set()
    
for i in range(m):
    a, b = map(int, input().split())
    # a, b = random.sample(range(1,n+1), 2)
    if group[a]==0 and group[b] == 0:
        g_num += 1
        group[a] = g_num
        group[b] = g_num
        g_mem[g_num] = 2
    elif group[a] == 0:
        group[a] = group[b]
        g_mem[group[b]] += 1
    elif group[b] == 0:
        group[b] = group[a]
        g_mem[group[a]] += 1
    elif group[a] != group[b]:
        if edge.get(group[a]):
            edge[group[a]].add(group[b])
        else:
            edge[group[a]] = {group[b]}
        if edge.get(group[b]):
            edge[group[b]].add(group[a])
        else:
            edge[group[b]] = {group[a]}
    
# print(g_mem)
# print(sum(g_mem.values()))
# print(edge)
    
g_reached = {i: 0 for i in range(1, g_num+1)}
    
def dps(g_mem, edge, now):
    count = g_mem[now]
    if edge.get(now):
        for e in edge[now]:
            if g_reached[e] == 0:
                g_reached[e] = 1
                count += dps(g_mem, edge, e)
    return count
    
    
ans = []
for now in range(1, g_num+1):
    if g_reached[now] == 0:
        g_reached[now] = 1
        ans.append(dps(g_mem, edge, now))
    
# print(ans)
if len(ans) > 0:
    print(max(ans))
else:
    print(1)

Measured memory_bytes: 386016
import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

S = input()

ans = 0
cnt = 0
for s in S:
    if s in ['A','C','G','T']:
        cnt += 1
    else:
        ans = max(ans,cnt)
        cnt = 0
ans = max(ans,cnt)
print(ans)

Measured memory_bytes: 31128
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
#define int long long
int n, a[400000], q;
int b[400000];
signed main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		b[i] = a[i];
	}
	sort(b, b + n);
	int sum = 0;
	for (int i = 0; i < n; i++) 
		if (b[i] != a[i]) 
			sum++;
	if (sum == 0) {
		cout << 0 << endl;
		return 0;
	}
	cin >> q;
	for (int i = 0; i < q; i++) {
		int x, y;
		cin >> x >> y;
		x--; y--;
		if (a[x] == b[x] && a[y] != b[x]) sum++;
		if (a[y] == b[y] && a[x] != b[y]) sum++;
		if (a[x] != b[x] && a[y] == b[x]) sum--;
		if (a[y] != b[y] && a[x] == b[y]) sum--;
		swap(a[x], a[y]);
		if (sum == 0) {
			cout << i + 1 << endl;
			return 0;
		}
	}
	cout << -1 << endl;
}


Measured memory_bytes: 7844
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		int minA = S.length();
		int maxX = 0;

		for(int i=0;i<S.length();i++) {
			if(S.charAt(i)=='A' && i<=minA) {
				minA=i;
			}else if(S.charAt(i)=='Z' && i>=maxX){
				maxX = i;
			}
		}
		System.out.println(maxX-minA+1);


	}
	public static int sample(int n) {
		return n;
	}

}


Measured memory_bytes: 26672
import sys
def I(): return int(sys.stdin.readline().rstrip())

K = I()

Graph = [0]*K
for i in range(K):
    if (i+1) % K != (10*i) % K:
        Graph[i] = [((i+1) % K,1),((10*i) % K,0)]  # 1を加える,10倍する
    else:
        Graph[i] = [((10*i) % K,0)]

from collections import deque

q = deque([1])
d = [100]*K
d[1] = 1
# 01-BFS
while q:
    n = q.pop()
    if n == 0:
        continue
    else:
        for a,b in Graph[n]:
            if d[a] > d[n]+b:
                d[a] = d[n]+b
                if b == 0:
                    q.append(a)
                else:
                    q.appendleft(a)

print(d[0])


Measured memory_bytes: 86060
import java.util.*;
 
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
 
        int N = sc.nextInt();
        int K = sc.nextInt();
        int[] x = new int[N];
        long minans = 0;

        for(int i=0; i<N; i++){
            x[i] = sc.nextInt();
            minans += Math.abs(x[i]);
        }
        for(int i=0; i<=N-K; i++){
            long min = (long)Math.min(Math.abs(x[i]) + Math.abs(x[i] - x[i + K - 1]), Math.abs(x[i + K - 1]) + Math.abs(x[i] - x[i + K - 1]));
            minans = Math.min(minans, min);
        }
        System.out.println(minans);
    }
}

Measured memory_bytes: 50152
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <vector>
#include <functional>
using namespace std;
typedef long long ll;




int main() {
    int n;
    cin >> n;
    int cnt = 0;
    bool can = false;

    for (int i = 0; i < n;i++){
        int a, b;
        cin >> a >> b;
        if(a == b)
            cnt++;
        else
            cnt = 0;

        if(cnt==3)
            can = true;
    }
    cout << (can ? "Yes" : "No");
    return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(int i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    vector<string> ans(100);
    rep(i, 100) {
        rep(ii, 100) {
            ans[i] += ((i >= 50) ? "." : "#");
        }
    }
    rep(i, a - 1) {
        ans[i * 2 / 100 * 2][i * 2 % 100] = '.';
    }
    rep(i, b - 1) {
        ans[99 - i * 2 / 100 * 2][i * 2 % 100] = '#';
    }
    printf("100 100\n");
    rep(i, 100) printf("%s\n", ans[i].c_str());
    return 0;
}

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

using namespace std;

int main()
{
    int l, r, a[100001] = {}, n, x = 0;
    cin >> n;

    for (int i = 0; i < n; i++)
    {
        cin >> l >> r;

        for (int j = l; j <= r; j++)
            a[j] = 1;
    }

    for (int i = 1; i < 100001; i++)
        x += a[i];

    cout << x;
}


Measured memory_bytes: 640
L, R = map(int, input().split())
ans = 2019
for i in range(L, min(R + 1, L + 2019 + 1)):
    for j in range(i + 1, min(R + 1, L + 2019 + 1)):
        tmp = i * j % 2019
        if tmp < ans:
            ans = tmp
print(ans)

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		String[] s = new String[n];
		for(int i=0;i<n;i++){
			s[i] = scanner.next();
		}
		String result = "";
		for(char c='a';c<='z';c++){
			int x = 50;
			for(int i=0;i<n;i++){
				int count = 0;
				for(int j=0;j<s[i].length();j++){
					if(c == s[i].charAt(j)){
						count++;
					}
				}
				x = Math.min(x, count);
			}
			for(int i=0;i<x;i++){
				result += String.valueOf(c);
			}
		}
		System.out.println(result);
	}

}


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

int main(){
  int n;
  int b, f, r, v;
  int roominfo[4][3][10];
  cin >> n;

  //?????????
  for(int i=0; i<4; i++){
    for(int j=0; j<3; j++){
      for(int k=0; k<10; k++){
        roominfo[i][j][k] = 0;
      }
    }
  }

  //???????????\???
  for(int i=0; i<n; i++){
    cin >> b >> f >> r >> v;
    roominfo[b-1][f-1][r-1] += v;
  }

  //??????
  for(int i=0; i<4; i++){
    for(int j=0; j<3; j++){
      for(int k=0; k<10; k++){
        cout << " " << roominfo[i][j][k];
      }
      cout << endl;
    }
    if(i != 3) cout << "####################" << endl;
  }

}

Measured memory_bytes: 3068
n = int(input())

t,x,y = [],[],[]

for _ in range(n):
    t_,x_,y_ = [int(x) for x in input().split()]
    t.append(t_)
    x.append(x_)
    y.append(y_)

t_now = 0
p = (0,0)
ans = True

for i,z in enumerate(t):
    td = t[i] - t_now
    d = abs(p[0]-x[i]) + abs(p[1]-y[i])
    tmp = td - d
    if tmp >= 0 and tmp % 2 == 0:
        p = (x[i],y[i])
        t_now = t[i]
        continue
    else:
        ans = False
        break

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

Measured memory_bytes: 11736
#include <stdio.h>
#include <ctype.h>

int main()
{
    int ch, i;
    int count[26]={0};
    while( (ch=getchar())!=EOF ) {
        if(isalpha(ch)) count[tolower(ch)-'a']++;
    }
    for(i=0; i<26; i++) {
        printf("%c : %d\n", 'a'+i, count[i]);
    }
    return 0;
}

Measured memory_bytes: 524
// Author :
// Date :
// Problem:
// Solution:
// Comment:

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>

#define pp push
#define pb push_back
#define mp make_pair
#define xx first
#define yy second

#define eps 1e-11
using namespace std;

queue < pair < pair <double,double> , double>  > qu; // R, L, prob

main(){
    int k;
    double r,l;
    double h;
    double p,e,t;
    
    cin >> k >> r >> l;
    cin >> p >> e >> t;
    
    qu.pp(mp(mp(r,l),1));
    
    double ans = 0.0;
    
    while(k--){
        int siz = qu.size();
        
        //cout << "siz" << " " << siz << endl << endl;
        
        //cout << siz << endl;
        while(siz--){
            double rr = qu.front().xx.xx;
            double ll = qu.front().xx.yy;
            double prob = qu.front().yy;
            double h = (rr+ll) / 2;
            //cout << prob << endl;
            
            qu.pop();
            
            if(abs(t-ll) <= e && abs(t-rr) <= e ){
                ans+=prob;
                //cout << ans << endl;
            }
            else if(prob > eps){
                if(abs(t-e) < ll && abs(t+e) >= rr){
                //cout << prob << endl;
                double hh;
                
                //cout << prob*p << " " <<  prob*(1.0-p) << endl;
                
                //cout << rr << " " << h << " " << ll << endl;
                if(h < t){
                    qu.pp(mp(mp(rr,h) , prob*p) );
                    qu.pp(mp(mp(h,ll) , prob*(1.0-p) ) );
                }
                else{
                    qu.pp(mp(mp(h,ll) , prob*p) );
                    qu.pp(mp(mp(rr,h) , prob*(1.0-p) ) );
                }
            }
            }
        }
    }
    
    
    
    //cout << endl << endl << endl;
    
    while(qu.size()){
        double hh = (qu.front().xx.xx + qu.front().xx.yy)/2;
        
        if( abs(t-hh) <=e){
            ans+=qu.front().yy;
            //cout << hh << " " << qu.front().yy << endl;
        }
        qu.pop();
    }
    
    printf("%15lf\n",ans);
    #ifdef GEREL
        for(;;);
    #endif

    return 0;
}

Measured memory_bytes: 1276
#include <iostream>
#include <vector>
#include <string>
#include <cstdio>


int main()
{
    size_t n, m, d;
    std::cin >> n >> m >> d;
    if (n <= d) {
        std::cout << 0 << std::endl;
    } else {
        double x = (1 - d / (double) n) * (m - 1.0) / (double)n;
        if (d == 0) {
            printf("%.10lf\n", x);
        } else {
            printf("%.10lf\n",  2 * x);
        }
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    static Scanner sc;

    static int n,m;
    static boolean[][] ss;
    static int cnt;

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

        // ?????????????§???????
        String[] a;
        while(true) {
            a = GetSubStringLine();
            m = Integer.parseInt(a[0]);
            n = Integer.parseInt(a[1]);
            if (m == 0 && n == 0) {
                break;
            }
            ss = new boolean[n][m];
            int x = 0,y = 0;
            cnt = 0;
            for (int i=0;i<n;i++) {
                a = GetSubStringLine();
                for (int j=0;j<m;j++) {
                    switch (a[j].charAt(0)) {
                        case '1':
                            ss[i][j] = true;
                            break;
                        case '0':
                            ss[i][j] = false;
                            break;
                    }
                }
            }
            for (int i=0;i<n;i++) {
                for (int j=0;j<m;j++) {
                    if (ss[i][j]) {
                        cnt++;
                        dfs(i, j);
                    }
                }
            }
            System.out.println(cnt);
        }
    }

    static void dfs(int y, int x) {
        if (y < 0 || y >= n || x < 0 || x>= m) {
            return;
        }
        if (!ss[y][x]) {
            return;
        }
        ss[y][x] = false;
        for (int i=-1;i<2;i++) {
            for (int j=-1;j<2;j++) {
                if (i!=0||j!=0) {
                    dfs(y+i,x+j);
                }
            }
        }
    }

    public static String[] GetSubStringLine() {
        String s = sc.nextLine();
        return s.split(" ");
    }
}

Measured memory_bytes: 31620
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int R = Integer.parseInt(sc.next());
        
        System.out.println(N < 10 ? R + (100 * (10 - N)) : R);
    }
}

Measured memory_bytes: 21588
# a,bを入力
a, b = map(int, input().split())
#小数点以下が0のとき
if (a + b) % 2 == 0:
    print(int((a + b) / 2))
#小数点以下が0以外のとき
else:
    print(int((a + b + 1) / 2))


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

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef pair<LL, LL> PLL;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())

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

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;
const LL INF = 1e15;

int R, C, N;
void dfs(auto& G, int u, int p, vector<LL>& xs, LL& mr, LL& mc){
  if(u < R) mr = min(mr, xs[u]);
  else mc = min(mc, xs[u]);
  for(auto&& e: G[u]){
	if(e.FF == p) continue;
	if(xs[e.FF] != INF) continue;
	xs[e.FF] = e.SS - xs[u];
	dfs(G, e.FF, u, xs, mr, mc);
  }
}

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

  cin >> R >> C >> N;
  vector<vector<pair<int,LL>>> G(R+C);
  REP(i,N){
	int r, c, x; cin >> r >> c >> x;
	--r, --c;
	G[r].EB(R+c, x);
	G[R+c].EB(r, x);
  }

  vector<LL> xs(R+C, INF);
  REP(i,R+C){
	if(xs[i] == INF){
	  xs[i] = 0;
	  LL mr = INF, mc = INF;
	  dfs(G, i, -1, xs, mr, mc);
	  if(mr+mc < 0){
		cout << "No" << endl;
		return 0;
	  }
	}
  }

  REP(i,R+C){
	for(auto&& e: G[i])
	  if(e.SS != xs[i] + xs[e.FF]){
		cout << "No" << endl;
		return 0;
	  }
  }
  cout << "Yes" << endl;

  return 0;
}


Measured memory_bytes: 21120
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

template <typename T>
struct edge {
    int from, to;
    T cost;

    edge(int to, T cost) : from(-1), to(to), cost(cost) {}
    edge(int from, int to, T cost) : from(from), to(to), cost(cost) {}

    explicit operator int() const {return to;}
};

template <typename T>
vector<T> dijkstra(int s,vector<vector<edge<T>> > &G){
    int n=G.size();
    const T INF = numeric_limits<T>::max();
    using P = pair<T, int>;
    vector<T> d(n, INF);
    vector<int> b(n,-1);
    priority_queue<P,vector<P>,greater<> > Q;
    d[s]=0;
    Q.emplace(d[s],s);
    while(!Q.empty()){
        T cost;
        int i;
        tie(cost, i) = Q.top(); Q.pop();
        if(d[i] < cost) continue;
        for (auto &&e : G[i]) {
            auto cost2 = cost + e.cost;
            if(d[e.to] <= cost2) continue;
            d[e.to] = cost2;
            Q.emplace(d[e.to], e.to);
        }
    }
    return d;
}

int main() {
    int n, m, s, t;
    cin >> n >> m >> s >> t;
    vector<vector<edge<ll>>> vy(n), vs(n);
    for (int i = 0; i < m; ++i) {
        ll u, v, a, b;
        cin >> u >> v >> a >> b;
        vy[u-1].emplace_back(v-1, a);
        vy[v-1].emplace_back(u-1, a);
        vs[u-1].emplace_back(v-1, b);
        vs[v-1].emplace_back(u-1, b);
    }
    vector<ll> cy = dijkstra(s-1, vy), cs = dijkstra(t-1, vs);
    for (int i = 0; i < n; ++i) {
        cy[i] += cs[i];
    }
    for (int i = n-2; i >= 0; --i) {
        cy[i] = min(cy[i], cy[i+1]);
    }
    for (int i = 0; i < n; ++i) {
        printf("%lld\n", 1000000000000000-cy[i]);
    }
    return 0;
}


Measured memory_bytes: 18684
n = int(input())
hlist=list(map(int,input().split()))
count = 0
ans = 0
for i in range(0,n-1):
    if hlist[i] >= hlist[i+1]:
        count += 1
    else:
        if ans < count:
            ans = count
        count = 0

if ans < count:
    ans = count
print(ans)

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

using namespace std;

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

int main(){
  int d;
  while (cin>>d){
    int sum=0;
    for(int i=d;i<600;i+=d){
      sum+=i*i*d;
    }
    cout<<sum<<endl;
  }
  return 0;
}

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

using namespace std;

using int64 = long long;

struct BipartiteMatching {
  vector< vector< int > > graph;
  vector< int > match, alive, used;
  int timestamp;

  BipartiteMatching(int n) : graph(n), alive(n, 1), used(n, 0), match(n, -1), timestamp(0) {}

  void add_edge(int u, int v) {
    graph[u].push_back(v);
    graph[v].push_back(u);
  }

  bool dfs(int idx) {
    used[idx] = timestamp;
    for(auto &to : graph[idx]) {
      int to_match = match[to];
      if(alive[to] == 0) continue;
      if(to_match == -1 || (used[to_match] != timestamp && dfs(to_match))) {
        match[idx] = to;
        match[to] = idx;
        return (true);
      }
    }
    return (false);
  }

  int bipartite_matching() {
    int ret = 0;
    for(int i = 0; i < graph.size(); i++) {
      if(alive[i] == 0) continue;
      if(match[i] == -1) {
        ++timestamp;
        ret += dfs(i);
      }
    }
    return (ret);
  }

  void output() {
    for(int i = 0; i < graph.size(); i++) {
      if(i < match[i]) {
        cout << i << "-" << match[i] << endl;
      }
    }
  }
};

int main() {
  int X, Y, E;
  scanf("%d %d %d", &X, &Y, &E);
  BipartiteMatching bm(X + Y);
  for(int i = 0; i < E; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    bm.add_edge(a, X + b);
  }
  cout << bm.bipartite_matching() << endl;
}


Measured memory_bytes: 3352