akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;

class Procon
{
    public Procon() { }
    static void Main(string[] agrs)
    {
        new Procon().Do();
    }

    Scanner cin;

    public void Do()
    {
        cin = new Scanner();
        int N = cin.nextInt();
        if (N < 1000)
        {
            Console.WriteLine("ABC");
            return;
        }
        Console.WriteLine("ABD");
    }
}

class Scanner
{
    string[] s;
    int i;
    int max_i;

    public Scanner()
    {
        s = new string[0];
        max_i = 0;
        i = 0;
    }

    public string nextString()
    {
        if (i >= s.Length)
        {
            s = Console.ReadLine().Split(' ');
            max_i = s.Length;
            i = 0;
            if (max_i == 0)
            {
                return "";
            }
            return s[i++];
        }
        else
        {
            return s[i++];
        }
    }

    public int nextInt()
    {
        return int.Parse(nextString());
    }


    public long nextLong()
    {
        return long.Parse(nextString());
    }

    public double nextDouble()
    {
        return double.Parse(nextString());
    }

    public string[] arrayString()
    {
        return Console.ReadLine().Split(' ');
    }

    public int[] arrayInt()
    {
        string[] str = Console.ReadLine().Split(' ');
        int[] array = new int[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = int.Parse(str[i]);
        }
        return array;
    }

    public long[] arrayLong()
    {
        string[] str = Console.ReadLine().Split(' ');
        long[] array = new long[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = long.Parse(str[i]);
        }
        return array;
    }

    public double[] arrayDouble()
    {
        string[] str = Console.ReadLine().Split(' ');
        double[] array = new double[str.Length];
        for (int i = 0; i < str.Length; i++)
        {
            array[i] = double.Parse(str[i]);
        }
        return array;
    }
}

Measured memory_bytes: 11092
/**
 *    author:  otera    
**/
#include<iostream>
#include<string> 
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm> 
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

//#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int MAX = 100100;
int dp[MAX];

void solve() {
	int n, d, x; cin >> n >> d >> x;
    vector<vector<int>> p(d, vector<int>(n));
    rep(i, d) {
        rep(j, n) {
            cin >> p[i][j];
        }
    }
    rep(i, d - 1) {
        rep(j, MAX) dp[j] = j;
        rep(j, n) {
            rep(k, MAX) if(k - p[i][j] >= 0) chmax(dp[k], dp[k - p[i][j]] + p[i + 1][j]);
        } 
        int y = 0;
        rep(j, x + 1) chmax(y, dp[j]);
        x = y;
    }
    cout << x << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>                          
using namespace std;    
int n,a[105][30],l,x,b,f;
string s;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++) 
	{
		cin>>s;
		for(int j=0;j<s.size();j++) a[i][s[j]-96]++;
		if(i!=1) 
		{
			b=s[0]-96;
			if(b!=x) f=1;
			for(int j=1;j<i;j++)
			{
				for(l=1;l<=26;l++)
					if(a[j][l]!=a[i][l]) break;
				if(l==27) f=1;
			}
		}
		x=s[s.size()-1]-96;
	}
	if(f==0) cout<<"Yes";
	else cout<<"No";
	return 0;
}

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

int N, M;
int WA[105000];
bool AC[105000];

void solve() {
    cin >> N >> M;
    int WAnum = 0;
    int ACnum = 0;
    for(int i = 1; i <= N; i++) {
        WA[i] = 0;
        AC[i] = false;
    }
    while(M--) {
        int p;
        string S;
        cin >> p >> S;
        if(AC[p]) continue;
        if(S == "AC") {
            AC[p] = true;
            ACnum++;
            WAnum += WA[p];
        } else if(S == "WA") {
            WA[p]++;
        }
    }
    cout << ACnum << " " << WAnum << endl;
    return;
}

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

Measured memory_bytes: 768
n,*a=`dd`.split.map &:to_i
p (1..2*n).bsearch(&->x{
	b=a.map{|e|e<x}
	1.upto(n){|i|
		[-1,1].map{|f|return x if b[n+i*f-1]==x=b[n+i*f-f-1]}
	}
	b[0]
})-1

Measured memory_bytes: 41940
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
typedef long long ll;
typedef unsigned int uint;
using namespace std;

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

    int a, b;
    cin >> a >> b;

    string ans;
    if (a > 0) ans = "Positive";
    else if (b < 0) {
        if ((b-a)%2 == 1) ans = "Positive";
        else ans = "Negative";
    }
    else ans = "Zero";

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

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(void){
  int N,two=0,four=0;
  cin>>N;
  vector<int> a(N);
  for(int i=0;i<N;i++){
      cin >> a.at(i);
      if(a.at(i)%4==0){
          four ++;
      }
      else if(a.at(i)%2==0){
          two ++;
      }
  }
  if(four+two/2>=N/2){
      cout<<"Yes"<<endl;
  }
  else{
      cout<<"No"<<endl;
  }
}

Measured memory_bytes: 640
n = int(input())
light = [0] * (n+1)

for i in range(1,n+1):
  light[i] = int(input())
s = 1
ans = 0
while light[s] != 2 and ans <= n:
  s = light[s]
  ans += 1

if light[s] == 2:
  print(ans + 1)
else:
  print(-1)

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

int main(){
    int n, x, y; cin >> n >> x >> y;
    vector<vector<int> > dp(n+1, vector<int>(n+1, 0));
    for(int i = 1; i <= n; i++){
        for(int l = 1; l <= n; l++){
            dp[i][l] = abs(i - l);
            if(i < l){
                dp[i][l] = min(dp[i][l], abs(x-i) + 1 + abs(l-y));
            }
            if(x <= i && y >= i){
                    int k = abs(i - x) + 1 + abs(l - y);
                    int k1 = abs(i-y) + 1 + abs(l - x);
                    dp[i][l] = min({dp[i][l], k, k1});
            }
            if(l < i){
                dp[i][l] = min(dp[i][l], abs(i - y) + 1 + abs(l-x));
            }
        }
    }
    vector<int> lis(n+1, 0);
    for(int i = 1; i <= n; i++){
        for(int l = 1; l <= n; l++){
            lis[dp[i][l]] += 1;
            //cout << dp[i][l];
        }
        //cout << endl;
    }
    for(int i = 1; i <= n-1; i++){
        cout << lis[i]  /2 << endl;
    }
}

Measured memory_bytes: 16000
import java.util.*;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {
	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	int[][] c;

	Main(BufferedReader in) throws IOException {
		c = new int[3][3];
		for (int i = 0; i < 3; ++i) {
			String[] tokens = in.readLine().split(" ");
			for (int j = 0; j < 3; ++j) {
				c[i][j] = Integer.parseInt(tokens[j]);
			}
		}
		for (int i = 0; i < 3; ++i) {
			for (int j = 1; j < 3; ++j) {
				c[j][i] -= c[0][i];
			}
		}
		for (int i = 0; i < 3; ++i) {
			c[0][i] = 0;
		}
		boolean enable = true;
		for (int i = 0; i < 3; ++i) {
			boolean cond = true;
			for (int j = 1; j < 3; ++j) {
				if (c[i][j] != c[i][0]) {
					cond = false;
				}
			}
			if (!cond) {
				enable = false;
				break;
			}
		}
		System.out.println((enable ? "Yes" : "No"));
	}

	void calc() {
	}

	void showResult() {
	}
}


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

int main(){
    int R;
    cin >> R;
    cout << R*2*3.141592 << endl;
    return 0;
 }


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

int main(){
    std::vector<int> vec{1, 2, 3};
    int a, b;
    std::cin >> a >> b;

    for(auto i = 0; i < 3; i++){
        if(vec.at(i) != a && vec.at(i) != b){
            std::cout << vec.at(i) << std::endl;
        }
    }
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 0x3f3f3f3f
const int maxn=1e3+5;
char maze[maxn][maxn];
int h,w;
int ch,cw,dh,dw;
bool vis[maxn][maxn];
int dis[maxn][maxn];
int drow[4]={0,0,1,-1};
int dcol[4]={1,-1,0,0};
bool inboard(int row,int col)
{
    if(row>=0&&row<h&&col>=0&&col<w)
        return true;
    return false;
}
struct Node{
    int row,col,len;
    Node(){}
    Node(int r_,int c_,int l_):row(r_),col(c_),len(l_){}
    bool operator<(const Node&node)const{
        return len>node.len;
    }
};
int main(void)
{
    cin>>h>>w>>ch>>cw>>dh>>dw;
    for(int i=0;i<h;++i)
        for(int j=0;j<w;++j)
            cin>>maze[i][j];
    ch--,cw--,dh--,dw--;
    priority_queue<Node> pq;
    memset(vis,0,sizeof(vis));
    memset(dis,inf,sizeof(dis));
    dis[ch][cw]=0;
    pq.push(Node(ch,cw,dis[ch][cw]));
    while(!pq.empty())
    {
        Node now=pq.top();
        pq.pop();
        vis[now.row][now.col]=true;
        for(int i=0;i<4;++i)
        {
            int nextrow=now.row+drow[i];
            int nextcol=now.col+dcol[i];
            if(inboard(nextrow,nextcol)&&maze[nextrow][nextcol]=='.'&&vis[nextrow][nextcol]==false)
                if(dis[nextrow][nextcol]>now.len)
                    pq.push(Node(nextrow,nextcol,now.len)),dis[nextrow][nextcol]=now.len;
        }
        for(int i=now.row-2;i<=now.row+2;++i)
            for(int j=now.col-2;j<=now.col+2;++j)
                if(inboard(i,j)&&maze[i][j]=='.'&&vis[i][j]==false)
                    if(dis[i][j]>now.len+1)
                        pq.push(Node(i,j,now.len+1)),dis[i][j]=now.len+1;
    }
    if(vis[dh][dw]==false) cout<<-1<<endl;
    else cout<<dis[dh][dw]<<endl;
    return 0;
}

Measured memory_bytes: 9500
h, w, n = [int(i) for i in input().split()]
if n == 0:
  a = b = [0] 
else:
  a, b = zip(*
  [[int(i) for i in input().split()] for j in range(n)])

board = { }

ans = [0] * 10
ans[0] = max(0, (h-2)) * max(0, (w-2))

for a, b in zip(a, b):
  for i in range(max(2, a-1), min(h, a+2)):
    for j in range(max(2, b-1), min(w, b+2)):
      try:
        ans[board.get((i, j), 0)] -= 1
        board[(i, j)] = board.get((i, j), 0) + 1
        ans[board[(i, j)]] += 1
      except:
        pass

for i in range(10):
  print(ans[i])

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

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

  int x = s.size(), y = t.size();
  if (n >= x + y) {
    cout << n << endl;
  } else {
    for (int i = min(x, y); i >= 0; --i) {
      if (s.substr(x - i, i) == t.substr(0, i) && x + y - i >= n) {
        cout << x + y - i << endl;
        break;
      }
    }
  }

  return 0;
}

Measured memory_bytes: 256
def exp(n):
  return n * (n + 1) / n / 2

N, K = map(int, input().split())
p = list(map(int, input().split()))
a = [0.0]
for i in range(N):
  a.append(a[i] + exp(p[i]))
m = 0
for i in range(N - K + 1):
  m = max(m, a[i + K] - a[i])
print(m)

Measured memory_bytes: 25060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T, class U> using Pa = pair<T, U>;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vec<int> A(N);
    for(auto& a:A) cin >> a;
    int B = 20;
    vec<int> cnt(B);

    auto check = [&](){
        return all_of(cnt.begin(),cnt.end(),[](int x){return x<=1;});
    };

    auto add = [&](int x){
        for(int i=0;i<B;i++) if(x>>i&1) cnt[i]++;  
    };

    auto del = [&](int x){
        for(int i=0;i<B;i++) if(x>>i&1) cnt[i]--;
    };

    int r = 0;
    ll ans = 0;
    for(int l=0;l<N;l++){
        bool ok = check();
        if(ok){
            while(r<N){
                add(A[r]);
                if(!check()){
                    del(A[r]);
                    break;
                }
                r++;
            }
//            cerr << l << " " << r << "\n";
            ans += r-l;
        }
        del(A[l]);
    }
    cout << ans << "\n";
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
	static public void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int d = scan.nextInt();
		int n = scan.nextInt();
		scan.close();

		if (d == 0) {
			if (n == 100) {
				System.out.println("101");
			} else {
				System.out.println(n);
			}
		} else if (d == 1) {
			if (n == 100) {
				System.out.println("10100");
			} else {
				System.out.println(100 * n);
			}
		} else if (d == 2) {
			if (n == 100) {
				System.out.println("1010000");
			} else {
				System.out.println(10000 * n);
			}
		}

	}
}


Measured memory_bytes: 23764
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
long long N,a[200005],b[200005],zj,ans;
int main()
{
	scanf("%lld",&N);
	for(long long i=1;i<=N;i++)
	{
		scanf("%lld",&a[i]);
		b[i]=a[i];
		a[i]-=i;
	}
	sort(a+1,a+N+1);
	zj=a[N/2+1];
	for(long long i=1;i<=N;i++)
	ans+=abs(b[i]-i-zj);
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 3328
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

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

    int N = scanner.nextInt();
    List<StringBuilder> list = rec('a', 'a', N - 1);
    for (StringBuilder sb : list) {
      System.out.println(sb.toString());
    }
  }

  private static List<StringBuilder> rec(char ch, char max, int remain) {
    List<StringBuilder> res = new ArrayList<>();
    if (remain == 0) {
      res.add(new StringBuilder().append(ch));
      return res;
    }

    if (max < ch + 1) max = (char) (ch + 1);
    for (char c = 'a'; c <= max; c++) {
      List<StringBuilder> list = rec(c, max, remain - 1);
      for (StringBuilder sb : list) {
        StringBuilder sb2 = new StringBuilder().append(ch);
        sb2.append(sb);
        res.add(sb2);
      }
    }
    return res;
  }
}


Measured memory_bytes: 73680
#pragma GCC optimize ("Ofast")
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i=(a); i<(b); i++)
#define FORD(i, a, b) for (int i=(a); i>(b); i--)
#define PPC(x) __builtin_popcount(x)
#define MSB(x) (31 - __builtin_clz(x))
#define SZ(x) ((int)(x).size())
#define pb push_back
#define ALL(x) (x).begin(), (x).end()
#define ithBit(m, i) ((m) >> (i) & 1)
#define ft first
#define sd second
#define kw(a) ((a) * (a))
#ifdef DEBUG
#include "debug.h"
#else
#define dbg(...) 0
#endif
using namespace std;

const int maxN = 100000000;

int T[maxN];

void solve()
{
	FOR(x, 1, 101) FOR(y, 1, 101) FOR(z, 1, 101)
		T[x*x + y*y + z*z + x*y + y*z + z*x]++;
	int n;
	scanf ("%d", &n);
	FOR(i, 1, n+1)
		printf("%d\n", T[i]);
}

int main()
{		
	int t = 1;
	//scanf ("%d", &t);
	while (t--)
		solve();
	return 0;
}


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

int main()
{
    string str;
    cin>>str;
    int flag=0,counter=0;
    for(int i=0,j=str.size()-1;i<j;i++,j--)
    {
        if(str[i]!=str[j])counter++;
    }
   // cout<<counter<<endl;
    int len = str.size();
    int n = (len-1)/2;
    for(int i=0,j=n-1;i<j;i++,j--)
    {
        if(str[i]!=str[j])counter++;
    }
   //  cout<<counter<<endl;
    len = str.size();
     n = (len+3)/2;
      for(int i=n-1,j=len-1;i<j;i++,j--)
    {
        if(str[i]!=str[j])counter++;
    }
   //  cout<<counter<<endl;
    if(counter==0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


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

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

  int ans = 1;
  for(int i = 0; i < n; ++i){
    if(ans*2 >= ans+k) ans +=k;
    else ans *= 2;
  }
  cout << ans << "\n";
}

Measured memory_bytes: 3640
import java.io.IOException;
import java.io.InputStream;
import java.util.*;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int N = sc.nextInt();
		int result = 0;
		int beforeB = 100001;
		
		for (int i = 1; i <= N - 1; ++i) {
			int temp = sc.nextInt();
			result += Math.min(beforeB, temp);
			if (i == N - 1) result += temp;
			beforeB = temp;
		}
		
		System.out.println(result);
		
	}

}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}


Measured memory_bytes: 23124
#include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <stack>
#include <string>
#include <vector>
typedef long long ll;
using namespace std;
const int MOD = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;
#define int long long
#define vint vector<int>
#define pint pair<int, int>
#define pb(a) push_back(a)
#define all(v) v.begin(), v.end()
#define dbg(x) cerr << #x << " = " << (x) << endl
#define yn(b) cout << ((b) ? "Yes" : "No") << endl
#define YN(b) cout << ((b) ? "YES" : "NO") << endl

int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

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

	int K, X;
	cin >> K >> X;

	int G = 500 * K;

	yn(G >= X);

	return 0;
}

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

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

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

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

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

template <typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

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


int main() {
  int N, K;

  cin >> N >> K;

  double ans = 0;

  for (int i=1; i<=N; i++) {
    int counter = 0;
    ll tmp = i;
    while(tmp < K) {
      counter ++;
      tmp *= 2;
    }
    ans += pow(0.5, counter);
  }

  printf("%.15lf\n", ans / N);

  return 0;
}


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

using namespace std;

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

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

    vector<bool> pressed(n + 1, false);
    int current = 1;
    int count = 0;
    while (true) {
        if (current == 2) {
            cout << count << '\n';
            break;
        }
        if (pressed[current]) {
            cout << -1 << '\n';
            break;
        }

        pressed[current] = true;
        current = a[current - 1];
        ++count;
    }
}



Measured memory_bytes: 640
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#define    boost        ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define    nl           "\n"
#define    ll           long long
#define    pb           push_back
#define    mpr          make_pair
#define    fr(i,a,n)    for(ll i=a;i<n;++i)
#define    fr0(i,n)     for(ll i=0;i<n;++i)
#define    pii          pair<int, int>
#define    FO           find_by_order
#define    OK           order_of_key
#define    mem(a)       memset(a,0,sizeof(a))
#define    ff           first
#define    ss           second


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


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


template<typename T> void TIME(T start, T end)
{
#ifndef ONLINE_JUDGE
	double time_taken =  chrono::duration_cast<chrono::nanoseconds>(end - start).count();
	time_taken *= 1e-9;
	cout << "\nExecuted in: " << fixed
	     << time_taken << setprecision(9);
	cout << " sec";
#endif
}

///----------------------------- | FUNCTIONS | --------------------------------------///

/*
const int N = 2e5 + 5;

vector<int> adj[N];
bool visited[N];
//int val[N];
//int depth[N];
//int parent[N];

void dfs(int v)
{
	visited[v] = true;
	for (int u : adj[v])
	{
		if (!visited[u])
		{
			//parent[u] = v;
			//depth[u] = depth[v] + 1;
			dfs(u);
		}
	}
}
*/

// left shift << multiply by 2
// right shift >> divide by 2

///----------------------------- | START FROM HERE | --------------------------------------///

#define int long long //change int main to int32_t main


void solve()
{
	int n, d;
	cin >> n >> d;
	int x[n], y[n];
	fr0(i, n) cin >> x[i] >> y[i];
	d = d * d;
	int count = 0;
	fr0(i, n)
	{
		if (d >= (x[i] * x[i] + y[i] * y[i])) count++;
	}
	cout << count << nl;

}





int32_t main()
{
	auto start = chrono::high_resolution_clock::now();
	boost;
	fio();
	int t;
	t = 1;
	//cin >> t;
	while (t--) solve();
	auto end = chrono::high_resolution_clock::now();
	TIME(start, end);
	return 0;
}




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

int main()
{
  int n,minN=191,maxN=-1001;
  cin>>n;
  vector<int> a(n);
  for(auto &i:a)
  {
    cin>>i;
    minN = min(minN,i);
    maxN = max(maxN,i);
  }
  if(minN==maxN)
  {
    cout<<"0\n";return 0;
  }
  int ans_val=1e9,temp;
  for(int i=minN;i<=maxN;i++)
  {
    temp = 0;
    for(auto k:a) temp += ((k-i)*(k-i));
    if(temp<ans_val)
    {
      ans_val = temp;
    }
  }
  cout<<ans_val<<"\n";
  
  
  return 0;
}

Measured memory_bytes: 256
def input_n
  gets.to_i               # 単一整数
end

def input_s
  gets.chomp              # 文字列。chompを付けないと改行文字がついてくる
end

def input_a
  gets.split.map(&:to_i)  # スペースで区切られた複数の整数
end

def input_o(num)
  num.times.map { gets.to_i }  # 縦に並んだ複数の整数。たまにある
end

def output_f(num)
  puts sprintf("%.12f", num)
end

s = input_s

arr = s.split(//)
puts [arr.count("0"), arr.count("1")].min * 2


Measured memory_bytes: 6780
#include<bits/stdc++.h>
#define PI acos(-1.0)
#define pb push_back
#define F first
#define S second
using namespace std;
typedef long long ll;
const int N=2e5+5;
const int MOD=1e9+7;
ll a[N];
ll sum[N];
//ll ans[N];

string myto_string(ll x){
    string ans="";
    while(x){
        ans+= x%10+'0';
        x/=10;
    }
    reverse(ans.begin(),ans.end());
    return ans;
}

bool check(ll x){
    string t=myto_string(x);
    string tt=t;
    reverse(t.begin(),t.end());
    return t==tt?1:0;
}
int main(void){
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);

    ll l,r;
    cin >>l >>r;
    ll ans=0;
    for(ll i=l;i<=r;++i){
        if(check(i))    ans++;
    }
    cout <<ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,ma=INT_MIN,mi=INT_MAX,num;
int main()
{
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>num;
        ma=max(ma,num-mi);
        mi=min(mi,num);
    }
    cout<<ma<<"\n";
    return 0;
}



Measured memory_bytes: 3100
def solve():
  ans = 0
  N = int(input())
  C = list(map(int, input().split()))
  C.sort()
  mod = 10**9+7
  for i in range(N):
    ans += C[i]*(N+1-i)
  ans = ans*pow(2,2*N-2)%mod
  return ans
print(solve())

Measured memory_bytes: 31500
open System

let s = Console.ReadLine().ToCharArray() |> Array.toList

let ziped = [1..s.Length] |> List.zip <| s

let odd s =
    match s with
    |'R'|'U'|'D' -> true
    | _ -> false

let even s =
    match s with
    |'L'|'U'|'D' -> true
    |_ -> false

let rec move list =
    match list with
    | [] -> "Yes"
    | head :: tail ->
        let a,b = head 
        match a % 2 with
            | 0 -> if even b then move tail else "No"
            | _ -> if odd b then move tail else "No"

ziped |> move |> printfn "%s"  

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

using namespace std;

int dig(int x) {
  int r = 0;
  while (x) {
    r += x%10;
    x /= 10;
  }
  return r;
}

int main() {
  int n,mi=1e9,tmp;
  cin >> n;
  for (int i=1;i<n;++i) {
    tmp = dig(i)+dig(n-i);
    mi = min(mi, tmp);
  }
  cout << mi << endl;
}

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

// #undef DEBUG  // Uncomment this line to forcefully disable debug print.
#if DEBUG
template <typename T>
void debug(T value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                              \
  do {                                        \
    cerr << #__VA_ARGS__ << ": ";             \
    debug(__VA_ARGS__);                       \
    cerr << " (L" << __LINE__ << ")" << endl; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define in(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << std::endl;
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define out(...) write_to_cout(__VA_ARGS__);

#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using ll = long long;

using namespace std;

int main() {
  in(int, n);
  vector<int> v(n);
  rep(i, n) cin >> v[i];
  vector<vector<pair<int, int>>> counts(2);
  rep(i, 2) {
    map<int, int> m;
    for (int j = i; j < n; j += 2) m[v[j]]++;
    for (auto [k, v] : m) {
      counts[i].push_back({v, k});
    }
    sort(all(counts[i]), greater());
  }
  rep(i, 2) for (auto [k, v] : counts[i]) dbg(i, k, v);
  rep(i, 2) dbg(counts[i].size());
  // 1 2 3 1 1 1
  // 1 3 1
  // 2 1 1
  // 1 2 1 2 1 2
  // 2 1 2 1 2 1

  if (counts[0][0].second != counts[1][0].second) {
    out(n - (counts[0][0].first + counts[1][0].first));
  } else {
    vector<int> second(2);
    rep(i, 2) second[i] = counts[i].size() == 1 ? 0 : counts[i][1].first;
    rep(i, 2) dbg(second[i]);
    out(n -
        max(counts[0][0].first + second[1], counts[1][0].first + second[0]));
  }
}


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

using namespace std;



void solve()
{


string s,t;
cin >> s >> t;
int c=0;
for (int i=0; i<s.length(); i++)
    if (s[i]!=t[i])c++;
cout << c;

}

int main()
{
ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int t=1;
//cin >> t;
while (t--) solve();

}


Measured memory_bytes: 3824
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <string>
#include <map>
#include <vector>
#include <stack>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

char mass[16][16];

char solve(int i, int j)
{
    if (mass[i][j] == '1' && mass[i][j+1] == '1' && mass[i+1][j] == '1' && mass[i+1][j+1] == '1') {
        return 'A';
    }
    else if (mass[i][j] == '1' && mass[i+1][j] == '1' && mass[i+2][j] == '1' && mass[i+3][j] == '1') {
        return 'B';
    }
    else if (mass[i][j] == '1' && mass[i][j+1] == '1' && mass[i][j+2] == '1' && mass[i][j+3] == '1') {
        return 'C';
    }
    else if (mass[i][j] == '1' && mass[i+1][j] == '1' && mass[i+1][j-1] == '1' && mass[i+2][j-1] == '1') {
        return 'D';
    }
    else if (mass[i][j] == '1' && mass[i][j+1] == '1' && mass[i+1][j+1] == '1' && mass[i+1][j+2] == '1') {
        return 'E';
    }
    else if (mass[i][j] == '1' && mass[i+1][j] == '1' && mass[i+1][j+1] == '1' && mass[i+2][j+1] == '1') {
        return 'F';
    }
    else if (mass[i][j] == '1' && mass[i][j+1] == '1' && mass[i+1][j] == '1' && mass[i+1][j-1] == '1') {
        return 'G';
    }
    
    return 0;
}

int main(void)
{
    char c;
    bool f;
    
    while (!cin.eof()) {
        f = false;
        
        rep(i, 16) {
            rep(j, 16) {
                mass[i][j] = '0';
            }
        }

        rep(i, 8) {
            cin >> mass[i];
        }
        
        rep(i, 8) {
            rep(j, 8) {
                if (mass[i][j] == '1' && f == false) {
                    c = solve(i, j);
                    cout << c << endl;
                    f = true;
                }
            }
        }
    }
    
    return 0;
}

Measured memory_bytes: 1132
n = int(input())
argv = input().split()

dic = {}
for a in argv:
    i = int(a)
    v = dic.get(i, 0)
    dic[i] = v + 1

count = 0
for k in dic.keys():
    size = dic.get(k)
    if k < size:
        count += size - k
    elif k > size:
        count += size

print(count)


Measured memory_bytes: 23292
#Union Find
import sys
#木の根を求める
def find(x,par):
    if par[x] == x:
        return x
    else:
        return find(par[x],par)

#xとyの属する集合の併合
def unite(x,y,par,rank):
    x = find(x,par)
    y = find(y,par)
    
    if x != y:
        #xとyの属している集合が異なる時
        if rank[x] < rank[y]:
            par[x] = y
        else:
            par[y] = x
            if rank[x]==rank[y]:
                rank[x] += 1

#xとyが同じ集合に属するかの判定
def same(x,y,par):
    return find(x,par) == find(y,par)
    
input = sys.stdin.readline
n,k,L = map(int,input().split())
rpar = [] #親
tpar = []
rrank = [0]*n#木の深さ
trank= [0]*n

#初期化
for i in range(n):
    #par[i]:i rank[i]:0
    rpar.append(i)
    tpar.append(i)


for i in range(k):
    x,y = map(int,input().split())
    unite(x-1,y-1,rpar,rrank)
for i in range(L):
    x,y = map(int,input().split())
    unite(x-1,y-1,tpar,trank)

num = []
d = {}
for i in range(n):
    num.append(find(i,rpar)+find(i,tpar)*10**6)
    if num[-1] in d:
        d[num[-1]] += 1
    else:
        d[num[-1]] = 1
res = ''
for i in range(n):
    if i != 0:
        res += ' '
    
    res += str(d[num[i]])

print(res)

Measured memory_bytes: 42124
#include <stdio.h>

int main(void)
{
	static char str[100000000];
	int i;
	
	scanf("%[^\n]s", str);
	
	for (i = 0; str[i] != '\0'; i++){
		if (str[i] >= 'a' && str[i] <= 'z'){
			printf("%c", str[i] - ('a' - 'A'));
		}
		else {
			printf("%c", str[i]);
		}
	}
	printf("\n");
	
	return (0);
}

Measured memory_bytes: 0
#include "iostream"
using namespace std;

int main() {
    string S;
    cin >> S;
    int b_count = 0;
    int w_count = 0;
    for (int i = 0; i < S.length(); i++) {
        if ((i % 2) == 0) {
            if(S[i] == '0') {
                w_count++;
            } else {
                b_count++;
            }
        } else {
            if(S[i] == '1') {
                w_count++;
            } else {
                b_count++;
            }
        }
    }
    cout << min(w_count, b_count) << endl;
}

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

int main() {
	int N; cin >> N;
	int c[510], s[510], f[510];
	for (int i = 0; i < N-1; i++) {
		cin >> c[i] >> s[i] >> f[i];
	}
	for (int i = 0; i < N; i++) {
		int sum = 0;
		int z = i + 1;
		for (int j = i; j < N-1; j++) {
			if (sum <= s[j]) {
				sum = s[j] + c[j];
			}
			else if (sum % f[j] != 0) {
				sum = (sum / f[j] + 1) * f[j] + c[j];
			}
			else sum += c[j];
		}
		cout << sum << endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
namespace FAST_IO
{
	template<typename T> void read(T &a)
	{
		a=0;
		int f=1;
		char c=getchar();
		while(!isdigit(c))
		{
			if(c=='-')
			{
				f=-1;
			}
			c=getchar();
		}
		while(isdigit(c))
		{
			a=a*10+c-'0';
			c=getchar();
		}
		a=a*f;
	}
	template <typename T> void write(T a)
	{
		if(a<0)
		{
			a=-a;
			putchar('-');
		}
		if(a>9)
		{
			write(a/10);
		}
		putchar(a%10+'0');
	}
	template <typename T> void writeln(T a)
	{
		write(a);
		puts("");
	}
}
int n,k,q;
int g[100001];
int main()
{
	cin>>n>>k>>q;
	for(int i=0;i<q;i++)
	{
		int tmp;
		cin>>tmp;
		g[tmp]++;
	}
	for(int i=1;i<=n;i++)
	{
		if(k+g[i]-q>0)
		{
			puts("Yes");
		}
		else
		{
			puts("No");
		}
	}
}

Measured memory_bytes: 1024
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main(){

    input!{
        s: chars,
    }

    let l = s.len();
    let mut ans: String = String::new();
    for i in 0..l{
        ans.push_str("x");
    }
    println!("{}", ans);

}

Measured memory_bytes: 4352
//・。・b
#include<iostream>
#include<cstring>
using namespace std;
#define INFTY (1<<30)
int h,heap[2000001];

void maxHeapify(int i){
  int l,r,largest;
  l=2*i;
  r=2*i+1;
  //左の子、自分、右の子で値が最大のノードを見る
  if(l<=h && heap[l]>heap[i]) largest=l;
  else largest=i;
  if(r<=h && heap[r]>heap[largest]) largest=r;
  if(largest!=i){
    swap(heap[i],heap[largest]);
    maxHeapify(largest);
  }
}

void increasekey(int i,int key){
  if(key<heap[i]) return;
  heap[i]=key;
  while(i>1 && heap[i/2]<heap[i]){
    swap(heap[i/2],heap[i]);
    i=i/2;
  }
}

void insert(int key){
  h++; 
  heap[h]=-INFTY;
  increasekey(h,key);
}

int extract(){
  int maxv;
  if(h<1) return -INFTY;
  maxv=heap[1];
  heap[1]=heap[h--];
  maxHeapify(1);
  return maxv;
}

int main(){
  int key;
  string com;
  while(1){
    cin>>com;
    if(com=="end") break;
    if(com=="insert"){
      cin>>key;
      insert(key);
    }else cout<<extract()<<endl;
  }
  return 0;
}



Measured memory_bytes: 7108
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define Ans(f, y, n) if(f) cout << y << endl; else cout << n << endl;
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i, v.size()){ cout << v[i] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i, m.size()){ REP(j, m[i].size()){ cout << m[i][j] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

template<typename T> void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readv_m1(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};

int mod = 1000000007;
//int mod = 998244353;
#define Add(x, y) x = (x + (y)) % mod
#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    int N, Q; cin >> N >> Q;
    string S; cin >> S;
    vec c(N + 1, 0);
    FOR(i, 1, N){
        c[i + 1] = c[i];
        if(S[i - 1] == 'A' && S[i] == 'C') c[i + 1]++;
    }
    int l, r;
    REP(i, Q){
        cin >> l >> r;
        l--; r--;
        int ans = c[r + 1] - c[l + 1];
        //if(l >= 1 && S[l] == 'C' && S[l - 1] == 'A') ans--;
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 1872
import java.util.*;
class Main{
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		ArrayList<String> input = new ArrayList<String>();
		while(in.hasNext()){
			input.add(in.next());
		}
		int X=Integer.parseInt(input.get(0));
		int t=Integer.parseInt(input.get(1));
		if(X>t){System.out.println(X-t);}
		else {System.out.println(0);}
	}
}

Measured memory_bytes: 21844
#include <stdio.h>
#include <algorithm>

using namespace std;

char data[1000000];

int main(void)
{
	int n;
	int max = 0;
	
	while (scanf("%d", &n) != EOF){
		data[n]++;
	}
	
	for (int i = 0; i < 1000000; i++){
		
		if (data[i] > max){
			max = data[i];
		}
	}
	for (int i = 0; i < 1000000; i++){
		if (data[i] == max){
			printf("%d\n", i);
		}
	}
	
	return (0);
}
	

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

int main() {
    int n, m, q;
    cin >> n >> m >> q;
    vector<vector<int>> v(q);

    vector<int> temp(4);
    for (int i = 0; i < q; i++) {
        cin >> temp[0] >> temp[1] >> temp[2] >> temp[3];
        v[i] = temp;
    }

    vector<int> flgv(m + n - 1);
    vector<int> tempA(n);
    int cntflg  = 0;
    int cnt     = 0;
    int index   = 0;
    int tempAns = 0;
    int ans     = 0;
    for (int i = 0; i < pow(2, m + n - 1); i++) {
        cntflg = 0;
        for (int j = 0; j < m + n - 1; j++) {
            flgv[j] = 0;
            if (i >> j & 1) {
                flgv[j] = 1;
                cntflg++;
            }
        }
        if (cntflg == m - 1) {
            cnt   = 0;
            index = 0;
            for (int j = 0; j < m + n - 1; j++) {
                if (flgv[j] == 0) {
                    tempA[index] = cnt;
                    index++;
                }
                else {
                    cnt++;
                }
            }
            tempAns = 0;
            for (int j = 0; j < q; j++) {
                if (tempA[v[j][1] - 1] - tempA[v[j][0] - 1] == v[j][2]) {
                    tempAns += v[j][3];
                }
            }
            ans = max(ans, tempAns);
        }
    }
    cout << ans << endl;

    return 0;
}

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

int main(){
  int N, K;
  cin >> N >> K;
  vector<int> A(N);
  for(int i = 0; i < N; ++i){
    cin >> A[i];
  }
  for(int i = K; i < N; ++i){
    if(A[i] > A[i-K]){
      puts("Yes");
    }else{
      puts("No");
    }
  }
}


Measured memory_bytes: 4044
#include <bits/stdc++.h>
using namespace std;
int main() {
  int x,y; cin>>x>>y;
  for(int i=0; i<=x; i++){
    if(i*2+(x-i)*4==y){
      cout<<"Yes";
      return 0;
    }
  }
  cout<<"No";
}

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int ll;
int main(){
  string s,t="abcdefghijklmnopqrstupwxyz";
  cin >>s;
  ll k;
  cin >>k;
  ll ss=s.size(),cnt=0,j=0;
  vector <string> v;
  for(ll j=0;j<26;j++){
  for(ll i=0;i<ss;i++){
    if(s[i]==t[j]){
      for(ll l=1;l<=(ss-i);l++){
        if(l>k) break;
        string p=s.substr(i,l);
        ll a=0;
        for(ll o=0;o<v.size();o++)if(p==v[o]) a=1;
        if(a!=1) cnt++,v.push_back(p);
      }
    }
  }
  if(cnt>=k) break;
}
  sort(v.begin(),v.end());
  cout << v[k-1]<<endl;
}


Measured memory_bytes: 256
/******************************************************************************

рассвет.

*******************************************************************************/
#include <bits/stdc++.h>
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define rapgame ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define eb emplace_back
#define vi vector <int>
#define vlli vector <lli>
#define vulli vector <ulli>
#define vchar vector <char>
#define vstr vector <string>
#define vb vector <bool>
#define fst first
#define sec second
#define all(a) (a).begin(),(a).end()
#define srt(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define vpii vector <pair <int,int> >
#define pii pair <int,int>
#define vplli vector <pair <lli,lli> >
#define vvi vector <vector <int> >
#define vvlli vector <vector <lli> >
#define vvpii vector <vector <pair <int,int>> >
#define fr(i,n) for (int i = 0; i < (n); ++i)
#define frbig(i,n) for (lli i = 0; i < (n); ++i)
#define fra(i,a,n) for (lli i = a; i < (n); ++i)
#define run(c,s) for(auto c:s)
#define read(n) int n; cin >> n;
#define readchar(n) char n; cin >> n;
#define readstr(n) string n; cin >> n;
#define readarr(a,n) fr(i,n) cin >> a[i];
#define read2(x,y) int x,y; cin >> x >> y;
#define read2ll(x,y) long long int x,y; cin >> x >> y;
#define readll(n) lli n; cin >> n;
#define watch(x) cout << (#x) << " is " << (x) << endl
#define print_array(x) fr(i,x.size()) cout << x[i];
using namespace std;

const lli MOD=1e9+7;
const lli MAXN=5e4+1;
const ld PI=acos(-1);

int main(){
    rapgame
    //freopen("bridges.in", "r", stdin);
    //freopen("bridges.out", "w", stdout);
    int t=1;
    //cin>>t;
    while(t--){
         read2ll(n,x);
         lli sum=0,ans=n+1;
         fr(i,n){
             readll(y);
             sum+=y;
             if(sum>x){ ans=i+1; break;}
         }
         cout << ans;
    }
    return 0;
}

Measured memory_bytes: 3612
a,b,c,k = map(int, input().split())
cheak = 10**18
ans = a-b
def calc(a,b,c,k):
    if a == b:
        return 0
    elif ans < 0:
        if k % 2 == 1:
            return -ans
        else:
            return ans
    else:
        if k % 2 == 1:
            return -ans
        else:
            return ans
ans_n = calc(a,b,c,k)
if ans_n > cheak:
    print("Unfair")
else:
    print(ans_n)


Measured memory_bytes: 3060
#pragma GCC optimize("Ofast")
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define uni(e) e.erase(unique(e.begin(),e.end()),e.end())
#define double long double
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int INF=1e10;
int MOD=1e9+7;
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
}
int kurai(int a,int b){
  int m=pow(10,b),n=pow(10,b-1);
  return (a%m)/n;
}
int ketawa(int a){
  int k=0;
  rep(i,keta(a)){
  k+=kurai(a,i+1);
  }
  return k;
}
int gcd(int a,int b){
  if(a%b==0)
    return b;
  return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
int mid(int a,int b,int c){
  vector<int> k(3);
  k[0]=a;k[1]=b;k[2]=c;
  sort(all(k));
  return k[1];
}
bool sosuu(int a){
  bool b=1;
  if(a<=1)
    return 0;
  else{
  rep1(i,sqrt(a)-1){
  if(a%(i+1)==0)
  b=0;
  }
  return b;
  }
}
int modpow(int a,int b,int m=MOD){
 if(!b)return 1; if(b&1)return modpow(a,b-1,m)*a%m;
 int memo = modpow(a,b>>1,m);
 return memo*memo%m;
}
int fact_mod(int n) {
    int f=1; 
for(int i=2;i<n+1;i++) f=f*(i%MOD)% MOD;
    return f;
}
int mod_pow(int x,int n) {
    int res=1;
    while(n>0){
        if(n&1) res=(res*x)%MOD; 
        x=(x*x)%MOD;        
n>>=1; 
    }
    return res;
}
int c_mod(int n, int r) {
    if(r>n-r) r=n-r;
    if(r==0) return 1;
    int a=1;
    rep(i,r) 
a=a*((n-i)%MOD)%MOD;
    int b=mod_pow(fact_mod(r), MOD-2);
    return (a%MOD)*(b%MOD)%MOD;
}
signed main(){
  int a;
  cin>>a;
  string b;
  cin>>b;
  bool k=0;
  int h=0;
  rep(i,a){
  if(b[i]=='R')
    h++;
  }
  int g=0;
  rep(i,h){
  if(b[i]=='W')
    g++;
  }
  out(g);
}

Measured memory_bytes: 3932