akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef pair<int,pii> pip;
typedef vector<pip>vip	;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1<<30;
int dp[300][300][4];
int main(){
	int n;
	int dx[]={0,-1,-1,-1};
	int dy[]={-1,-1,0,1};
	while(cin>>n,n){
		vector<string>in(n);
		rep(i,n)cin>>in[i];
		rep(i,n)rep(j,n)rep(k,4)if(in[i][j]=='1'){
			if(i==0&&j==0)dp[i][j][k]=1;
			else if(i==0&&k||j==0&&k<2||j==n-1&&k==3)dp[i][j][k]=1;
			else dp[i][j][k]=dp[i+dx[k]][j+dy[k]][k]+1;
		}else dp[i][j][k]=0;
		int out=0;
//		rep(i,n){rep(j,n)cout<<" "<<dp[i][j][0];cout<<endl;}
		rep(i,n)rep(j,n)rep(k,4)out=max(out,dp[i][j][k]);
		cout<<out<<endl;
	}
}

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

class Main {

    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        String S = sc.next();
        String T = sc.next();

        int ans = 0;

        for (int i=0; i<3; i++) {
            if (S.charAt(i) == T.charAt(i)){
                ans ++;
            }
        }
        System.out.println(ans);
    }

    static class MyScanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;
    
        String next() {
            try {
                while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                    tokenizer = new StringTokenizer(reader.readLine());
                }
            } catch (IOException ignored) {
            }
            return tokenizer.nextToken();
        }
    
        int nextInt() {
            return Integer.parseInt(next());
        }
    
        long nextLong() {
            return Long.parseLong(next());
        }
    }
}

Measured memory_bytes: 21076
#include        "iostream"
#include        "algorithm"
#include		"numeric"
#include        "cstring"
#include        "math.h"
#include        "string"
#include        "vector"
#include        "ctime"
#include        "queue"
#include        "stack"
#include        "map"
#include        "set"

#include        <ext/pb_ds/assoc_container.hpp> // Common file
#include        <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include        <ext/pb_ds/detail/standard_policies.hpp>

using namespace std;
using namespace __gnu_pbds;


#define          f first
#define          lgn 25
#define          endl '\n'
#define          sc second
#define          N (int)2e5+5
#define          pb push_back
#define          mod 1000000007
#define          ld long double
#define          vi vector<int>
#define          eb emplace_back
#define          vpii vector<pii>
#define          mii map<int,int>
#define          int long long 
#define          pii pair<int,int>
#define          pq priority_queue
#define          test(x) while(x--)
#define          all(x) begin(x),end(x)
#define          allr(x) rbegin(x),rend(x)
#define          fo(i,a,n) for(int i=a;i<n;i++)
#define          rfo(i,n,a) for(int i=n;i>=a;i--)
#define          db(x) cout<<#x <<" : "<< x <<endl;
#define          FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define          time() cerr << "Time : " << (double)clock() / (double)CLOCKS_PER_SEC << "s\n"
#define          PI acos(-1.0)
#define 		 bug(...)       __f (#__VA_ARGS__, __VA_ARGS__)

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

template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{
     const char* comma = strchr (names + 1, ',');
     cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

inline void INP()
{
	#ifndef ONLINE_JUDGE
	    freopen("in.txt","r",stdin);   
	    freopen("ou.txt","w",stdout);
	#endif 
}

const int inf = 0x3f3f3f3f;
const int INF = 0x3f3f3f3f3f3f3f3f;

int n,m,k,q;
string s;
int vis[N],dp[N],h[N];

void go()
{
	cin >> n >> q;

	fo(i,0,n) cin >> h[i];

	memset( dp , 0x3f3f3f3f , sizeof dp);

	dp[0] = 0;

	fo(i,0,n)
	{
		fo(k,0,q+1)
		{
			if( k < n and ( i - k ) >= 0 )
			{
				dp[i] = min( dp[i] , dp[i-k] + abs(h[i] - h[i-k] ) );
			}
		}
	}

	cout << dp[n-1] << endl;
	
}

int32_t main()
{
	//INP(); 
	FAST;     
	int t=1; 
	// cin>>t;
	test(t) go();
}


Measured memory_bytes: 3584
#include <iostream>
#include <ccomplex>
#include <vector>
#include <cassert>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric>
#include <list>
#include <assert.h>
#include <math.h>
#include <valarray>
#include <stdio.h>
#include <algorithm>
#include <set>
#include <complex>
#include <list>
#include <time.h>
#include <stack>
#include <locale>
#include <clocale>
#include <ctype.h>
#include <wchar.h>

using namespace std;
typedef long long int LL;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)


int xcomp(vector<LL>& a, vector<LL>& b) {
	return a[0] < b[0];
}

#define XSORT(c) sort((c).begin(),(c).end(),xcomp)

#define ALL(x) (x).begin(),(x).end()
LL mod = 1000000007;



int main() {

	string s;
	cin >> s;
	REP(i, s.size() - 8) {
		cout << s[i];
	}
	cout << endl;
}

Measured memory_bytes: 256
N = int(input())
INF = 10 ** 9
dp = [INF] * (N + 1)
dp[0] = 0
M = set()
M.add(1)
i = 1
while True:
    if 6 ** i > N:
        break
    M.add(6 ** i)
    i += 1
i = 1
while True:
    if 9 ** i > N:
        break
    M.add(9 ** i)
    i += 1
for i in range(N):
    for m in M:
        if i + m > N:
            continue
        dp[i + m] = min(dp[i + m], dp[i] + 1)
print(dp[N])

Measured memory_bytes: 9648
#include <bits/stdc++.h>
#include <regex>
#ifdef _DEBUG
#include "debug.h"
#endif
#define int ll
#define FOR(i, s, e) for (int i = int(s); i < int(e); ++i)
#define REP(i, e) FOR(i, 0, e)
#define all(v) (v).begin(),(v).end()
#define mkpr make_pair
#define mktp make_tuple
#define tv(tp, i) get<(i)>(tp)
#define CLEAR(obj) obj = decltype(obj)()
#define var auto
#define OUT(type) type &
#define IN(type) const type &
#define self (*this)
#define in :
#define True true
#define False false
using namespace std; using int32 = int32_t; using str = string; using cstr = const str;
using ll = long long; using ull = unsigned long long; using cint = const int; using cll = const ll;
using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vvl = vector<vl>;
using vb = vector<bool>; using vvb = vector<vb>; using vd = vector<double>; using vvd = vector<vd>;
using vc = vector<char>; using vvc = vector<vc>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>; using pdd = pair<double, double>; using psl = pair<string, ll>;
using tiii = tuple<int, int, int>; using tlll = tuple<ll, ll, ll>;
static const int MGN = 10; static const int ARYSZ_MAX = (int)1e7;
static const ll LINF = LLONG_MAX/2;
#ifdef int
static const int INF = LINF;
#else
static const int INF = INT_MAX/2;
#endif
static double EPS = 1e-9;
#define FASTCIN() cin.tie(0);ios::sync_with_stdio(false);
#ifdef IMPORT_SAMPLE
#define DEBUG_IMPORT(file) vs args(argv, argv+argc);str sample = make_sample(args, file);ifstream ifs(sample); cin.rdbuf(ifs.rdbuf());
#else
#define DEBUG_IMPORT(file)
#endif
static inline bool DBLEQ(double a, double b) {return abs(a - b) < EPS;}
static inline void EPR(str msg) {cerr << msg << endl;}
static inline void AST(bool exp, str msg) {if(!exp){EPR(msg);} assert(exp);}
static inline void TAST(bool exp, str msg) {if(!exp){EPR(msg);} while(!exp){}}


int32 main(int32 argc, char* argv[]) {
    FASTCIN();
    DEBUG_IMPORT("sample-1");


    int N; cin>>N;
    vi A(N),B(N),C(N);
    REP(i,N) cin>>A[i]>>B[i]>>C[i];

    var dp = vvi(N+1, vi(3, 0));
    // dp[i][j] := i 日目に j をやって得られる幸福度の最大値

    dp[0][0] = A[0]; dp[0][1] = B[0]; dp[0][2] = C[0];

    FOR(i,1,N) {
        dp[i][0] = A[i] + max(dp[i-1][1], dp[i-1][2]);
        dp[i][1] = B[i] + max(dp[i-1][0], dp[i-1][2]);
        dp[i][2] = C[i] + max(dp[i-1][0], dp[i-1][1]);
    }

    int ans = max(dp[N-1][0], max(dp[N-1][1], dp[N-1][2]));
    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 8064
#include<bits/stdc++.h>
using namespace std;
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int ans = 0;
    string S;
    cin >> S;
    if (S == "SUN") ans = 7;
    if (S == "MON") ans = 6;
    if (S == "TUE") ans = 5;
    if (S == "WED") ans = 4;
    if (S == "THU") ans = 3;
    if (S == "FRI") ans = 2;
    if (S == "SAT") ans = 1;
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(a) (a).begin(),(a).end()
#define N_MAX 1000
#define ll long long int
using namespace std;

int main() {
	string S, T; cin >> S >> T;
	int A, B; cin >> A >> B;
	string U; cin >> U;

	if (U == S) A--;
	else if (U == T) B--;

	cout << A << ' ' << B<< endl;
}


Measured memory_bytes: 256
def bellman_ford(x, V, E):
    V[x][0] = 0
    negative = [False for _ in range(len(V))]
    for i in range(len(V) - 2):
        for a, b, c in E:
            if V[b][0] > V[a][0] + c:
                V[b][0] = V[a][0] + c
                V[b][1] = a

    for a, b, c in E:
        if V[b][0] > V[a][0] + c:
            negative[b] = True
        elif negative[a]:
            negative[b] = True

    return V, negative

INF = 10 ** 15
n, m = map(int, input().split())
V = [[INF, 0] for _ in range(n + 1)]
E = []
for i in range(m):
    ai, bi, ci = map(int, input().split())
    E.append([ai, bi, -ci])
V, negative = bellman_ford(1, V, E)
if negative[n]:
    print('inf')
else:
    i = n
    ans = 0
    while(i != 1):
        d, i = V[i]
        ans += d
    print(-V[n][0])


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

namespace AtCoder2 {
	class Program {
		static void Main(string[] args) {

			//出力の都度更新をやめる
			var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
			Console.SetOut(sw);


			Ans();

			//更新する
			Console.Out.Flush();
			
		}
public static void Ans() {

			var inputArray = retreiveLongArray();
			var inputCount = 1;

			// 不正な入力は処理しない
			if (inputArray.Length != inputCount) {
				Console.WriteLine("invalid input");
				return;
			}
			long N = inputArray[0];

			//答えの出力
			var ans = N >=30 ? "Yes":"No";
			Console.WriteLine(ans);

		}

		/// <summary>
		/// スペースで区切られた文字列配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static string[] retreiveStringArray() {
			var inputArray = Console.ReadLine().Split(' ');
			return inputArray;
		}

		/// <summary>
		/// スペースで区切られた整数配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static long[] retreiveLongArray() {
			var inputArray = Console.ReadLine().Split(' ');
			var longArray = inputArray.Select(s => long.Parse(s));
			return longArray.ToArray();
		}


		/// <summary>
		/// 2組みずつの入力データ(数値)からTuppleListを作成する
		/// </summary>
		/// <param name="N"></param>
		/// <returns></returns>
		private static List<Tuple<long, long>> createLongTuppleList(long N) {
			var inpList = new List<Tuple<long, long>>();

			for (int i = 0; i < N; i++) {
				var inp = retreiveLongArray();
				var item1 = inp[0];
				var item2 = inp[1];
				inpList.Add(new Tuple<long, long>(item1, item2));
			}
			return inpList;
		}
	}
}

Measured memory_bytes: 28072
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define FAST ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define dofloat cout<<fixed<<setprecision(8)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define bitcount _builtin_popcount
#define all(vec) vec.begin(),vec.end()
#define rall(vec) vec.rbegin(),vec.rend()
using namespace __gnu_pbds;
using namespace std;
//typedef
typedef long long ll;
typedef long double ld;
typedef vector<long long> vl;
typedef pair<long long,long long> pll;
typedef vector<pair<long long,long long> > vll;
typedef vector<pair<int,int> > vii;
typedef vector<int> vi;
typedef pair<int,int> ii;
//constants
const long long MOD=1000000007;
const long long MAX=100005;
const long double PI=3.14159265359;
const long double G=9.807;
const long long INF=1e18;
const long double EPS=1e-6;
//
#define forn(i, n)for(ll i=0;i<n;i++)
// gcd of a and b
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
// distance between (a,b) and (c,d)
long double dis(long long a,long long b,long long c,long long d){return sqrt( ((a)-(c))*((a)-(c))+((b)-(d))*((b)-(d)) );}
// simple prime check
bool isprime(long long a){
if(a==2)return 1;
if(!(a&1))return 0;
for(ll i=3;i*i<=a;i+=2){
	if(a%i==0)return 0;
}
return 1;
}
// fast expo
long long mpow(long long base,long long exponent,long long modulus){
if(modulus==1)return 0;
long long result = 1;
base=base%modulus;
while(exponent){
		if(exponent%2 == 1)
			result=(result*base)%modulus;
		exponent=exponent>>1;
		base=(base*base)%modulus;
	}
return result;
}
// modular inverse
ll minv(ll a,ll mod){
	ll _gcd=gcd(a,mod);
	assert(_gcd==1);
	return mpow(a,mod-2,mod);
}

/*
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
*/

/*
ll dx[]={1,0,-1,0,1,1,-1,-1};
ll dy[]={0,-1,0,1,1,-1,-1,1};
*/

/*
void sieve(int N){
	for(int i=0;i<=N;i++){
		spf[i]=i;
	}
	for(int i=2;i*i<=N;i++){
		if(spf[i]==i){
			for(ll j=i*i;j<=N;j+=i){
				spf[j]=min(spf[j],i);
			}
		}
	}
	return;
}
*/

/*
void nCr(ll n,ll k){
	ll i,j;
	for(i=0;i<=n;i++){
		for(j=0;j<=min(i,k);j++){

			if(j==0 or j==i)C[i][j]=1LL;
			else  C[i][j]=(C[i-1][j-1]+C[i-1][j])%MOD;

		}
	}
	return;
}
*/
/*
ll ncr(ll N,ll K){
	if(N<K)return 0;
	if(K==0)return 1;
	if(N==0)return 0;

	ll den=1;
	for(ll i=1;i<=K;i++)den*=i;
	ll num=1;
	while(K--){
		num*=N;
		if(num%den==0){
			num/=den;
			den=1;
		}
		N--;
	}

	return num;
}
*/
string s;
ll n,k;
ll ending[100005];
vl pre;
int main(){FAST;
cin>>n>>k;
cin>>s;
ll present = 0;
for(ll i=0;i<n;i++){
	if(s[i]=='0'){
		present=1;
		while(i+1<n and s[i+1]=='0'){
			i++;
		}	
		ending[i]=1;
	}
}
ll ans=0;
for(ll i=0;i<n;i++){
	if(ending[i]){
		pre.pb(i);
	}
	if(ending[i] or s[i]=='1'){
		ll sz = pre.size();
		ll idx = sz-k-1;
		if( idx < 0 ){
			// then we can obtain full till now
			ans=max(ans,i+1);
		}
		else{
			ans=max(ans,i-pre[idx]);
		}
	}
}
cout<<ans;
return 0;
}




Measured memory_bytes: 1788
#include <cstdio>



int main(){
    int N;
    scanf("%d",&N);
    switch (N%10)
    {
    case 0:
    case 1:
    case 6:
    case 8:
        puts("pon");
        break;
    case 2:
    case 4:
    case 5:
    case 7:
    case 9:
        puts("hon");
        break;
    
    default:
        puts("bon");
    }

    return 0;
}

Measured memory_bytes: 3168
let readIntArray () =
    stdin.ReadLine().Split(" ") |> Array.map int

let choice ok ng bool = if bool then ok else ng

()
|> readIntArray
|> fun [| _; _; x; y |] ->
    let xMax =
        ()
        |> readIntArray
        |> Array.sortDescending
        |> Array.head

    let yMin =
        () |> readIntArray |> Array.sort |> Array.head

    xMax < yMin && x < y && xMax < y && x < yMin
|> choice "No War" "War"
|> printfn "%s"


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

int main() {
  
  int W, H, x, y, r; cin >> W >> H >> x >> y >> r;
  
  if ((0 <= x - r && x + r <= W) && (0 <= y - r && y + r <= H)) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  
}


Measured memory_bytes: 3116
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <iomanip>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <climits>
#include <bitset>
#include <cassert>

using namespace std;

const int SIZE = 1 << 17;

int pointer = SIZE;
char buffer[SIZE];

char Advance() {
    if (pointer == SIZE) {
        fread(buffer, 1, SIZE, stdin);
        pointer = 0;
    }
    return buffer[pointer++];
}

int Read() {
    int answer = 0, sign = 1;
    char ch = Advance();
    while (!isdigit(ch) && ch != '-')
        ch = Advance();
    if (ch == '-') {
        sign = -1;
        ch = Advance();
    }
    while (isdigit(ch)) {
        answer = answer * 10 + ch - '0';
        ch = Advance();
    }
    return answer * sign;
}

char ReadCh() {
    char ch = Advance();
    while (!isalpha(ch))
        ch = Advance();
    return ch;
}

const int MAXN = 100000;

vector<int> g[1 + MAXN];
bool has[1 + MAXN];
int answer = 0;

void DFS(int node, int father) {
    int good = 0, sons = 0;
    for (auto &son : g[node])
        if (son != father) {
            DFS(son, node);
            sons++;
            if (has[son])
                good++;
        }
    if (good)
        has[node] = true;
    if (sons <= 1)
        return;
    has[node] = true;
    if (good < sons - 1)
        answer += sons - 1 - good;
}

int main() {
    //freopen("tema.in", "r", stdin);
    //freopen("tema.out", "w", stdout);
    int n;
    scanf("%d", &n);
    for (int i = 1; i < n; i++) {
        int a, b;
        scanf("%d%d", &a, &b);
        a++;
        b++;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    bool chain = true;
    int root;
    for (int i = 1; i <= n; i++)
        if (g[i].size() > 2) {
            chain = false;
            root = i;
            break;
        }
    if (chain) {
        printf("1\n");
        return 0;
    }
    DFS(root, 0);
    printf("%d\n", answer);
    return 0;
}


Measured memory_bytes: 9984
N, K = map(int, input().split())
import math
ans = 0
for i in range(1,N+1):
  if i <= K:
    a = math.ceil(math.log2(K/i))
    prb = (1/2)**a/N
  else:
    prb = 1/N
  ans += prb
print(ans)

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

int main(){
    int n;
    cin >> n;
    vector<int>a(n);
    long long total = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        total += a[i];
    }
    
    map<int, int>mp;
    for(int i = 0; i < n; i++){
        mp[a[i]] += 1;
    }
    
    int q;
    cin >> q;
    while(q--){
        int b, c;
        cin >> b >> c;
        long long current_value = mp[b];
        long long diff = c - b;
        total += (diff)*current_value;
        
        mp[b] = 0;
        mp[c] += current_value;
        
        cout << total << endl;
    }
}


Measured memory_bytes: 8048
using System;
using System.Collections.Generic;
using System.Linq;
// using System.Linq;

namespace easy_Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            // float[] ABN = Array.ConvertAll(Console.ReadLine().Split(),float.Parse);
            // int[] NK = Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
            // long K = long.Parse(Console.ReadLine());
            // int[] abc = Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
            // string S = Console.ReadLine();
            // int a = int.Parse(Console.ReadLine());
            // int b = int.Parse(Console.ReadLine());
            // int h = int.Parse(Console.ReadLine());
            // float N = float.Parse(Console.ReadLine());
            string c = Console.ReadLine();
            string B = Console.ReadLine();
            // string[] AopB = Console.ReadLine().Split();
            // var s = (new string[] { Console.ReadLine(), Console.ReadLine(), Console.ReadLine() }).Select(float.Parse);
            // float[] a = Array.ConvertAll(Console.ReadLine().Split(),float.Parse);
            // var X = Console.ReadLine();
            // int[,] abcd = new int[NMQ[2],4];
            // int[] A = new int[NMQ[0]];
            // int[] A_num = new int[NMQ[0]];
            // long[] s=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
            // var hs=new Dictionary<long,long>();
            // for(int i=0;i<s[0];i++){
            //     long[] q=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
            //     if(hs.ContainsKey(q[0])){hs[q[0]]+=q[1];}
            //     else{hs.Add(q[0],q[1]);}
            // }
            // List<long> kl=new List<long>(hs.Keys);
            // kl.Sort();
            // foreach(long k in kl){
            //     s[1]-=hs[k];
            //     if(s[1]<1){Console.WriteLine("{0}",k);break;}
            // }
            bool ans = true;
            if(B.Length-1==c.Length){
                for(int i = 0; i< c.Length;i++){
                 if(c[i]==B[i]){
                     
                 }else{
                     ans = false;
                 }
                }
            }else{
                ans = false;
            }
            Console.WriteLine(ans?"Yes":"No");
        }
        //最小公倍数
        static long Lcm(long a, long b)
        {
            return a/Gcd(a,b)*b;
        }

        //最大公約数
        static long Gcd(long m, long n)
        {
            if(n==0)return m;
            return Gcd(n,m%n);
        }
    }
}

Measured memory_bytes: 17208
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>

#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)1e18;
const double PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	int N;
	cin >> N;
	vector< pair<LL,LL> > v(N);
	LL MIN = INF;
	LL MAX = 0;
	for(int i=0;i<N;++i){
		cin >> v[i].first >> v[i].second;
		if( v[i].first > v[i].second ){
			swap( v[i].first, v[i].second );
		}
		MIN = min( MIN, v[i].first );
		MAX = max( MAX, v[i].second );
	}
	sort( v.begin(), v.end() );

	/*
	Rmax = MAX && Bmin = MIN
	*/
	LL ans1 = LINF;
	LL Rmin = LINF;
	LL Bmin = LINF;
	LL Rmax = 0;
	LL Bmax = 0;
	Rmax = MAX;//Rminを大きくする
	Bmin = MIN;//Bmaxを小さくする
	for(int i=0;i<N;++i){
		Rmin = min( Rmin, v[i].second );//大きい方をRへ
		Bmax = max( Bmax, v[i].first );//小さい方をBへ
	}
	ans1 = (Rmax-Rmin) * (Bmax-Bmin);
	
	/*
	Rmax = MAX, Rmin = MIN
	*/
	Rmin = MIN;
	Rmax = MAX;
	Bmin = LINF;
	Bmax = 0;
	LL ans2 = LINF;

	vector< pair<LL,LL> > rui(N);
	for(int i=N-1;i>=0;--i){
		if( i == N-1 ){
			rui[i].first = v[i].first;
			rui[i].second = v[i].first;
		}else{
			rui[i].first = min( rui[i+1].first,v[i].first);
			rui[i].second = max( rui[i+1].second, v[i].first );
		}
	}
	
	LL BminPre = LINF;
	LL BmaxPre = 0;
	for(int i=0;i<=N;++i){//大きい方をBにする個数。
		if( i < N ){
			Bmin = rui[i].first;
			Bmax = rui[i].second;
		}else{
			Bmin = LINF;
			Bmax = 0;
		}
		if( i ){
			BminPre = min( BminPre,v[i-1].second );
			BmaxPre = max( BmaxPre,v[i-1].second );
			Bmin = min( Bmin, BminPre );
			Bmax = max( Bmax, BmaxPre );
		}
		ans2 = min( ans2,(Rmax-Rmin)*(Bmax-Bmin) );
	}
	cout << min(ans1,ans2) << endl;
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	
	
	solve();
}
#pragma endregion //main()


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

#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for(int i = ( n ) - 1; i >= ( m ); i--)
#define sort_asc( X ) sort(( X ).begin(), ( X ).end())
#define sort_desc( X ) sort(( X ).begin(), ( X ).end(), greater <>())
#define endl "\n"

template <class T> bool chmax( T& a, T b );
template <class T> bool chmin( T& a, T b );
int* eratosthenes( int N );
bool bit_search( int pattern, int N );
void initialize( void );

const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;
template <typename T, typename K> struct P {
	T a; K b;
};
int main( void ){
	// initialize();
	int N;
	cin >> N;
	cout << N << ": ";
	vector <P <ll, ll> > vec;
	int lim = sqrt(N)+1;
	rep( i, 2, N + 1 ){
		if (i >= lim){
			vec.push_back( P <ll, ll>{N, 1} );
			break;
		}
		if (N % i == 0){
			vec.push_back( P <ll, ll>{i, 0} );
			while(N % i == 0){
				N /= i;
				vec.back().b++;
			}
		}
	}
	rep( i, 0, vec.size()){
		rep(j,0,vec[i].b){
			printf("%lld%s", vec[i].a, ((i==vec.size()-1) && (j == vec[i].b-1))?"":" ");
		}
	}
	cout << endl;
}

template <class T> bool chmax( T& a, T b ) {
	if (a < b){
		a = b; return true;
	}
	return false;
}
template <class T> bool chmin( T& a, T b ) {
	if (a > b){
		a = b; return true;
	}
	return false;
}
int* eratosthenes( int N ){
	int* prime_array = new int[ N + 1 ];
	int lim = N;
	prime_array[ 0 ] = 0;
	prime_array[ 1 ] = 0;
	rep( i, 2, N + 1 ){
		prime_array[ i ] = 1;
	}
	rep( i, 2, lim ){
		if (prime_array[ i ] == 0)
			continue;
		lim = N / i;
		for(int j = i * 2; j < N + 1; j += i){
			prime_array[ j ] = 0;
		}
	}
	return prime_array;
}
bool bit_search( int pattern, int N ){
	int cnt = 0;
	rep( bit, 0, N ){
		if (pattern & ( 1 << bit )){
			cnt++;
		}
	}
	return true;
}
void initialize( void ){
	cout << fixed << setprecision( 10 );
}



Measured memory_bytes: 3300
#include <algorithm>
#include <climits>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <vector>

using namespace std;
constexpr long long int INF = std::numeric_limits<long long int>::max();
#define int long long int

int N, K;
string s;

void skip(int &i, char c) {
  while (s[i] == c) {
    i++;
  }
}

void solve() {
  // int x;
  // cout << endl;

  int ans = 0;

  int right = 0;
  int left = 0;
  skip(right, '1');
  for (int i = 0; i < K; i++) {
    skip(right, '0');
    skip(right, '1');
  }

  ans = right;
  while (right < N) {
    skip(left, '1');
    skip(left, '0');
    skip(right, '0');
    skip(right, '1');
    ans = max(ans, right - left);
  }

  cout << ans << endl;
}

signed main() {
  cin >> N >> K;
  cin >> s;
  solve();
  return 0;
}


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

a = n
ans = 0
while a >= 0:
    if a % 4 == 0:
        print("Yes")
        ans = 1
        break
    a -= 7
a = n
if ans == 0:
    while a >= 0:
        if a % 7 == 0:
            print("Yes")
            ans = 1
            break
        a -= 4
if ans == 0:
    print("No")



Measured memory_bytes: 3060
using System;
class Program {
  static void Main(string[] args) {
    string[] _list1 = Console.ReadLine().Split();
    string[] _list2 = Console.ReadLine().Split();

    int N = int.Parse(_list1[0]);
    int K = int.Parse(_list1[1]);
    int[] A = new int[N];

    for (int i = 0; i < N; ++i) {
      A[i] = int.Parse(_list2[i]);
    }

    Array.Sort(A, (a, b) => b - a);

    int ans = 0;
    for (int i = 0; i < K; ++i) {
      ans += A[i];
    }

    Console.WriteLine(ans);
  }
}


Measured memory_bytes: 13268
x, n = map(int, input().split())
try:
    p = list(map(int, input().split()))
except:
    p=[]


a = 0
b = 0
while b == 0:
    if x - a not in p:
        print(x-a)
        b = b + 1
    elif x + a not in p:
        print(x+a)
        b = b + 1
    a = a + 1

Measured memory_bytes: 9188
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll solve(ll n){
    return (n*(n-1))/2;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll n,m;
    cin>>n>>m;
    cout<<solve(n)+solve(m);
    return 0;
}


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

require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.chomp.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

def exponential_with_mod(n, k, mod)
  return 1 if k == 0
  return n if k == 1

  if k % 2 == 1
    (n * (exponential_with_mod(n, k/2, mod) ** 2 % mod)) % mod
  else
    (exponential_with_mod(n, k/2, mod) ** 2) % mod
  end
end

# mod m での aの逆元
# mが素数のときのみ有効
def modinv(a, m)
  b = m; u = 1; v = 0

  while b != 0
    t = a / b
    a -= t * b
    c = a; a = b; b = c
    u -= t * v
    c = u; u = v; v = c
  end
  u %= m
  u += m if u < 0
  u
end

def nCk(n, k, mod)
  ue = 1
  shita = 1
  k.times do |a|
    ue = ue * (n - a) % mod
    shita = shita * (k - a) % mod
  end
  ue * modinv(shita, mod) % mod
end

N = get_int

MOD = 10 ** 9 + 7

@memo = Array.new(N+1) { {} }

def ok(last4)
  4.times do |i|
    return false if last4.include?('ACG')
    chars = last4.split('')
    return false if chars.each_cons(2).with_index.any? do |_, i|
      (((i-1) >= 0 ? chars[0..(i-1)] : []) + [chars[i+1], chars[i]] + chars[(i+2)..]).join('').include?('ACG')
    end
  end
  return true
end

def dfs(cur, last3)
  return @memo[cur][last3] if @memo[cur][last3]
  return 1 if cur == N

  ret = 0
  %w[A C G T].each do |s|
    ret = (ret + dfs(cur+1, last3[1..] + s)) % MOD if ok(last3 + s)
  end
  @memo[cur][last3] = ret
  ret
end

puts dfs(0, 'TTT')


Measured memory_bytes: 14736
N = int(input())
S = list(input())

#処理部分
f = 0
b = 0
count = 0
for i in range(N-1, -1, -1):
    if S[i] == '(':
        if count > 0:
            count -= 1
        else:
            b += 1
    else:
        count += 1

#出力
for i in range(count):
    print ('(', end = '')
for i in S:
    print (i, end = '')
for i in range(b):
    print (')', end = '')
print ()



Measured memory_bytes: 3064
import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.Collectors;

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

        int N = sc.nextInt();
        int[] X = new int[N];
        for (int i = 0; i < X.length; ++i) {
            X[i] = sc.nextInt();
        }

        System.out.println(solve(X));

        sc.close();
    }

    static String solve(int[] X) {
        int[] sorted = Arrays.stream(X).boxed().sorted().mapToInt(x -> x).toArray();

        int leftMedian = sorted[sorted.length / 2 - 1];
        int rightMedian = sorted[sorted.length / 2];

        return Arrays.stream(X).mapToObj(x -> String.valueOf((x <= leftMedian) ? rightMedian : leftMedian))
                .collect(Collectors.joining("\n"));
    }
}

Measured memory_bytes: 88540
#include <bits/stdc++.h>
#pragma GCC optimize("O3")

#define fi first
#define se second
#define em emplace
#define eb emplace_back
#define mp make_pair
#define pi pair<int,int>
#define vi vector<int>
#define vpi vector<pair<int,int>>
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define endl '\n'

#define si(v) int(v.size())
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep2(i, n, m) for (ll i = n; i <= (m); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (m); --i)

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

using ll = long long;
using ld = long double;
using namespace std;

constexpr ll MOD = 1000000007;

signed main()
{
  cout << fixed << setprecision(20);
  ios::sync_with_stdio(false);
  cin.tie(0);
  
  string s; cin >> s;
  int n = si(s);

  string t = s.substr(0, (n-1)/2);
  string u = s.substr((n+3)/2-1);

  auto f = [&](string x) {
    string y = x;
    reverse(all(x));

    return x == y;
  };

  if (f(s) && f(t) && f(u)) cout << "Yes\n";
  else cout << "No\n";
  
  return (0);
}

Measured memory_bytes: 3664
#include<iostream>
using namespace std;
int main()
{
  int A,B,C;
  cin >> A >> B >> C;
  if(A>C && C>B){
      cout << "Yes" << endl;
  }
  else if(A<C && C<B){
      cout << "Yes" << endl;
  }
  else{
      cout << "No" << endl;
  }
  
}


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

using ll = long long;
using P = pair<int, int>;
constexpr int MOD = 998244353;

int N;
vector<P> robots;

void solve() {
  sort(robots.begin(), robots.end());
  robots.emplace_back(INT_MAX, 0);
  vector<int> next(N);
  vector<int> dp(N + 1, 0);
  dp[N] = 1;
  for (int i = N - 1; i >= 0; i--) {
    int far = robots[i].first + robots[i].second;
    int j = i + 1;
    while (far > robots[j].first) {
      j = next[j];
    }
    next[i] = j;
    dp[i] = (dp[i + 1] + dp[j]) % MOD;
  }
  cout << dp[0] << endl;
}

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

  cin >> N;
  for (int i = 0; i < N; i++) {
    int x, d;
    cin >> x >> d;
    robots.emplace_back(x, d);
  }

  solve();
}

Measured memory_bytes: 3440
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

from collections import Counter

n = int(input())
d = Counter(map(int, input().split()))
m = int(input())
t = Counter(map(int, input().split()))

for k in t:
    if k not in d:
        print('NO')
        sys.exit(0)
    elif t[k] > d[k]:
        print('NO')
        sys.exit(0)
print('YES')


Measured memory_bytes: 132824
n = int(input())
t=0
x=0
y=0
ans ="Yes"
for i in range(n):
  tt,xx,yy = map(int,input().split())
  dif = abs(x-xx)
  dif +=abs(y-yy)
  if dif>(tt-t) or dif%2 !=(tt-t)%2:
    ans = "No"
    break;
  t=tt
  x=xx
  y=yy
print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
long long n,m;
int main()
{
	cin>>n>>m;
	if(2*n>m)
	{
		cout<<m/2<<endl;
	}
	if(2*n==m)
	{
		cout<<n<<endl;
	}
	if(2*n<m)
	{
		cout<<n+(m-2*n)/4<<endl;
	}
}

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

int gcd(int x,int y){
  if(x%y==0) return y;
  else return gcd(y,x%y);
}

int main() {
  ll a,b;
  cin >> a >> b;
  cout << a * b / gcd(a,b);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main()
{
	int H, W;
	std::cin >> H >> W;

	while (H != 0 || W != 0) {
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				if ((i + j) % 2) {
					std::cout << ".";
				}
				else {
					std::cout << "#";
				}
			}
			std::cout << std::endl;
		}
		std::cout << std::endl;
		std::cin >> H >> W;
	}
}

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

using namespace std;

vector < pair <int, pair <int, int> > > v;
set <int> stt;

int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int x, y;
    cin >> x >> y;
    v.push_back({x, {y, 0}});
  }
  for (int i = 0; i < n; ++i) {
    int x, y;
    cin >> x >> y;
    v.push_back({x, {y, 1}});
  }
  sort(v.begin(), v.end());
  int ans = 0;
  for (auto &e : v) {
    int x = e.first;
    int y = e.second.first;
    int op = e.second.second;
    if (!op) {
      stt.insert(y);
    } else {
      auto it = stt.lower_bound(y);
      if (it != stt.begin()) {
        --it;
        ++ans;
        stt.erase(it);
      }
    }
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 256
//コンパイラ最適化用
#pragma GCC optimize("Ofast")
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<chrono>//実行時間計測
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm,accumulate
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//順序保持しないmap
#include<unordered_set>//順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

//マクロ
//forループ
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size()) 
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define print(a) cout << a << endl;
#define cin(x) cin >> x;

int main(){
    //入力の高速化用のコード
    //ios::sync_with_stdio(false);
    //cin.tie(nullptr);

 ll n=0, money = 1000;
  cin(n);
  vector<int> price(n);
  REP(i,n){
  cin(price.at(i));
  }
 
  REP(i, n-1){
    if (price.at(i) < price.at(i+1)){
      ll stock = money / price.at(i);
      money +=  (price.at(i+1) - price.at(i)) * stock;
    }
  }

  print(money);
  return 0;
}


Measured memory_bytes: 3612
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
	n,m = readline() |> split |> parseMap
	a = Array{Int}(2,m)
	for i in 1:m
		a[:,i] = readline() |> split |> parseMap
	end
	a = sortcols(a, by=x->x[2])
	count = 0
	mcut = 0
	for i in 1:m
		if a[1,i] > mcut
			count += 1
			mcut = a[2,i]-1
		end
	end
	println(count)
end

main()


Measured memory_bytes: 158956
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define setbits(x) __builtin_popcount(x)
#define setbitsll(x) __builtin_popcountll(x)
//#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define se second
#define fi first
#define pai acos(-1)
#define maxe max_element
#define mine min_element
#define fn(i,x) for(i=0;i<x;i++)
#define fs(i,s,x) for(i=s;i<x;i++)
#define fr(i,x) for(i=x;i>=0;i--)
#define fit(itr,s) for(itr=s.begin();itr!=s.end();itr++)
#define W while
#define pp pair<ll,ll>
#define ppi pair<int,int>
#define vl vector<ll>
#define vll vector<pp >
#define vi vector<int>
#define vii vector<ppi>
#define debug(x) cerr<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;
#define debug4(x,y,z,w) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\t"<<#w<<" :: "<<w<<endl;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define boost  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define SIZE 5000 + 1
const ll MAX=1e9;
const ll mod=998244353;
ll expo(ll x,ll n,ll M=mod)
{
    ll ans=1;
    while(n>0)
    {
        if(n&1){ans=(ans*x)%M;}
                x=(x*x)%M;
                n>>=1;
    }
    return ans;
}


void solve()
{
    
 ll w,s;
 cin>>s>>w;
 if(w>=s)
    cout<<"unsafe"<<endl;
 else
    cout<<"safe"<<endl;
}

int main()
{
  boost;
  ll t=1;
 // cin>>t;
  while(t--)
  {
      solve();
  }
}


Measured memory_bytes: 3652
from itertools import*
n,k=map(int,input().split())
s=input()
t=[0]*(s[0]=="0")+[len(list(g)) for _,g in groupby(s)]+[0]*(s[-1]=="0"or(1-("1"in s)))
a,b=t[::2],t[1::2]
l=len(t)//2;k=min(k,l)
t=r=sum(a[:k+1]+b[:k]) 
for w,x,y,z in zip(a,b,a[k+1:],b[k:]):
	t+=-w-x+y+z
	r=max(r,t)
print(r)

Measured memory_bytes: 5644
using System;
using System.Collections.Generic;
using System.Linq;

class Progaram
{
    static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());
        var al = new List<long>();
        var bl = new List<long>();
        int index;
        long num;
        for (var i = 0; n > i; i++)
        {
            num = long.Parse(Console.ReadLine());
            if (bl.Count == 0)
            {
                bl.Add(num);
                continue;
            }
            index = bl.BinarySearch(num);
            if (index < 0)
            {
                index = ~index;
                bl.Insert(index, num);
            }
            else bl.RemoveAt(index);
        }
        Console.WriteLine(bl.Count);
    }
}

Measured memory_bytes: 16224
#include<stdio.h>
int main()
{
	int n;
	scanf("%d", &n);
	int i;
	int a[55];
	for (i = 0; i < n; i++)
		scanf("%d", &a[i]);
	int max, min;
	max = min = 0;
	for (i = 0; i < n; i++)
	{
		if (a[i] > a[max])
			max = i;
		if (a[i] < a[min])
			min = i;
	}
	printf("%d\n", 2 * n - 2);
	if (a[max] + a[min] >= 0)
	{
		for (i = 0; i < n; i++)
			if (i != max)
				printf("%d %d\n", max + 1, i + 1);
		for (i = 0; i < n - 1; i++)
			printf("%d %d\n", i + 1, i + 2);
	}
	else
	{
		for (i = 0; i < n; i++)
			if (i != min)
				printf("%d %d\n", min + 1, i + 1);
		for (i = n - 1; i > 0; i--)
			printf("%d %d\n", i + 1, i);
	}
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define ANS cout << ans << endl
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))
#define int long long
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define VIin(a) for(int i=0; i<a.size(); i++) cin >> a[i]
#define OUT(a) cout << a << endl
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
/*最大公約数*/int gcd(int x, int y) { return y ? gcd(y,x%y) : x;}
/*最小公倍数*/int lcm(int a, int b) { int g = gcd(a, b); return a / g * b; }
/*素数判定*/int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*約数列挙*/vector<int> getDivisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------------------------------------
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int a,b,k; cin >> a >> b >> k;
    int ma = gcd(a,b);
    VI y = getDivisor(ma);
    REVERSE(y);
    OUT(y[k-1]);

    return 0;
}

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

  int main(){
cout<< fixed << setprecision(12);

double r;
cin>>r;

double x =acos(-1);

double s = r * r * x;

double v = (r + r) * x;
cout<<s<<" "<<v<<endl;

return 0;
}


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

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define rep(i, n) repd(i, 0, n)

using namespace std;

using ll = long long;
using ul = unsigned long long;
ll mod = 1000000007;

int main() {
source:
    string s;
    cin >> s;
    if (s.length() == 26) {
        char memo[27] = {};
        rep(i, 26) { memo[i] = s[i]; }
        memo[26] = '!';
        next_permutation(memo, memo + 27);
        string ans;
        rep(i, 27) {
            if (memo[i] == '!') {
                break;
            } else {
                ans += memo[i];
            }
        }
        if (ans.length() == 0) {
            cout << -1 << endl;
            return 0;
        }
        cout << ans << endl;
    } else {
        bool memo[26] = {};
        rep(i, s.length()) { memo[s[i] - 'a'] = true; }
        rep(i, 26) {
            if (!memo[i]) {
                cout << s << char('a' + i) << endl;
                return 0;
            }
        }
    }
    return 0;
}



Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define int long long
#define ALL(v) (v).begin(),(v).end()
#define Vi vector<int>
#define pb push_back
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>b;i--)
#define leng(n) (int)(log10(n)+1)
#define INF 9000000000000000000
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm

signed main() {
  int n , k;
  cin >> n >> k;
  Vi a(n);
  rep(i,0,n) cin >> a[i];
  sort(ALL(a));
  reverse(ALL(a));
  int ans = 0;
  rep(i,0,k) ans += a[i];
  cout << ans << endl;
}


Measured memory_bytes: 256
const line = require('fs').readFileSync('/dev/stdin', 'utf-8').split('\n');

const newNode = (id, left, right) => {

    const degree = left === -1 && right === -1 ? 0
                 : left === -1 || right === -1 ? 1
                 : 2;

    return {
        id : id,
        parent : -1,
        left : left,
        right : right,
        degree : degree,
        depth : null,
        height : 0,
        sibling : -1,
        type : ''
    };
};

const setDepth = tree => {
    const root = tree.filter(x => x.parent === -1)[0];
    const helper = (node, n) => {
        node.depth = n;
        if (node.left !== -1) helper(tree[node.left], n+1);
        if (node.right !== -1) helper(tree[node.right], n+1);
    };
    helper(root, 0);
};

const setType = node => {
    node.type = node.parent === -1 ? 'root'
              : node.left === -1 && node.right === -1 ? 'leaf'
              : 'internal node';
};

const setHeight = (tree, id, n) => {
    if (id === -1) return n-1;
    return Math.max(setHeight(tree, tree[id].left, n+1), setHeight(tree, tree[id].right, n+1));
};

const setSibling = (tree) => {
    tree.forEach(x => {
        if (x.left !== -1) tree[x.left].sibling = x.right;
        if (x.right !== -1) tree[x.right].sibling = x.left;
    });
};

const nodeToString = node => {
    return `node ${node.id}: parent = ${node.parent}, sibling = ${node.sibling}, degree = ${node.degree}, depth = ${node.depth}, height = ${node.height}, ${node.type}`;
};

const n = parseInt(line[0]);
const data = line.slice(1, n+1)
                 .map(x => x.split(' ').map(Number));
const tree = data.map(xs => newNode(xs[0], xs[1], xs[2]));
tree.sort((a, b) => a.id - b.id);
tree.forEach(x => {
    if (x.left !== -1) tree[x.left].parent = x.id;
    if (x.right !== -1) tree[x.right].parent = x.id;
});
tree.forEach(x => setType(x));
setDepth(tree);
tree.forEach(x => {
    x.height = setHeight(tree, x.id, 0);
});
setSibling(tree, 0);
tree.map(x => nodeToString(x))
    .forEach(x => console.log(x));



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

#define int long long
#define vvi vector<vector<int>>
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

const int INF = 1e18;

int A, B, Q;
vector<int> s, t;

int solve(int key) {
  int ret = INF;

  // x -> (s or t) -> (t or s)
  auto itr1 = lower_bound(all(s), key);
  auto itr2 = lower_bound(all(t), key);
  if (abs(*itr1) != INF and abs(*itr2) != INF) {
    chmin(ret, max(*itr1, *itr2) - key);
  }

  // t -> x -> s
  auto t1 = upper_bound(all(t), key) - 1;
  auto s1 = lower_bound(all(s), key);
  if (abs(*t1) != INF && abs(*s1) != INF) {
    chmin(ret, abs(*s1 - *t1) + min(abs(key-*s1), abs(key-*t1)));
  }

  // s -> x -> t
  auto s2 = upper_bound(all(s), key) - 1;
  auto t2 = lower_bound(all(t), key);
  if (abs(*t2) != INF && abs(*s2) != INF) {
    chmin(ret, abs(*s2 - *t2) + min(abs(key-*s2), abs(key-*t2)));
  }

  // (s or t) -> (t or s) -> x
  auto itr3 = upper_bound(all(s), key) - 1;
  auto itr4 = upper_bound(all(t), key) - 1;
  if (abs(*itr3) != INF and abs(*itr4) != INF) {
    chmin(ret, key - min(*itr3, *itr4));
  }

  return ret;
}

signed main() {
  cin >> A >> B >> Q;
  s.resize(A);
  t.resize(B);
  rep (i, A) { cin >> s[i]; }
  rep (i, B) { cin >> t[i]; }
  // -INF, INFを入れておくとイテレータを-1しても変な動作をしない
  s.push_back(INF);
  t.push_back(INF);
  s.push_back(-INF);
  t.push_back(-INF);
  sort(all(s));
  sort(all(t));

  while (Q--) {
    int x;
    cin >> x;
    int ans = solve(x);
    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 2912