akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cmath>
#include <string>
#include <string.h>
#include <cstdlib>
#include <iomanip>
#include <stdio.h>

using namespace std;

int main(){

  double x1,y1,x2,y2;

  scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);

  printf("%.9lf\n",sqrt(pow(x2-x1,2)+pow(y2-y1,2)));
}


Measured memory_bytes: 3228
#include <iostream>
#include <sstream>
#include <vector>
#include <cmath>
#include <ctime>
#include <cassert>
#include <ctype.h>
#include <iomanip>
#include <cstdio>
#include <float.h>
#include <queue>
#include <set>
#include <map>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <stack>
#include <functional>
// #include <pair> 
       
using namespace std;
       
#define endl '\n'
#define MOD 1000000007
#define INF 1ll<<30
 
// #define MAX 100010
 
#define eps 1e-11
#define bit_max 1ll<<32
#define _USE_MATH_DEFINES
 
// long long binpow(long long a,long long b)
// {
//     if (b == 1) return a;
//     long long res = binpow(a, b/2)%MOD;
//     if (b % 2) return (res*((res*a)%MOD))%MOD;
//     else return (res * res)%MOD;
// }
 
// long long int fact(long long int a)
// {
//     if(a==0||a==1)
//         return 1;
//     long long int ans = 1;
//     for(int i=a;i>=1;i--)
//         ans = (ans * i);
//     return ans;
// }
 
// long long int ivmod(long long int a)
// {
//     return binpow(a,MOD-2);
// }
 
// long long int ncr(long long int a,long long int b)
// {
//     long long int pans=1;
//     for(int i =a;i>max(b,a-b);i--)
//         pans=pans*i;
//     long long int div = fact(min(b,a-b));
//     // cout<<ans<<"            "<<div<<endl;
//     pans = pans/div;
//     return pans;
// }

int counter[100005];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    // #endif   
    int n,m;
    cin>>n>>m;
    for(int i=0;i<m;i++)
    {
        int x,y;
        cin>>x>>y;
        counter[x]++;
        counter[y]++;
    }
    for(int i=1;i<=n;i++)
    {
        if(counter[i]%2!=0)
        {
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;
    return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<cstring>
#include<queue>
#include<algorithm>
#define maxn 50000+5
#define INF 1e9
#include<vector>
using namespace std;
typedef long long ll;
vector<ll> g;
char s[1005];
int main(){
cin>>s;
int ans=0;
for(int i=0;i<strlen(s);i++){
    if(s[i]=='1')
        ans++;
}
cout<<ans<<endl;
}


Measured memory_bytes: 256
// #pragma GCC target("avx2")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<complex>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3121000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
}
// ここから編集しろ
char in[110];
int main(){
	scanf("%s",in);
	int n=strlen(in);
	for(int i=0;i<n;i++){
		if(i%2==0&&in[i]=='L'){
			printf("No\n");return 0;
		}
		if(i%2==1&&in[i]=='R'){
			printf("No\n");return 0;
		}
	}
	printf("Yes\n");
}

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

int main()
{
    string s;
    long long n, z=0, r = 0, g = 0, b = 0;
    cin >> n;
    cin >> s;
    for (long long i = 0; i < n; i++)
    {
        if (s[i] == 'R')
        {
            z+=g*b;
            r++;
        }
        if (s[i] == 'G')
        {
            z+=r*b;
            g++;
        }
        if (s[i] == 'B')
        {
            z+=r*g;
            b++;
        }
    }
        for (long long o = 3; o-1 < n; o += 2) {
      for (long long i = o-1; i < n; i++){
        if (s[i] != s[i-o+1] && s[i-o+1] != s[i-o/2] && s[i-o/2] !=s[i])
          z--;
        }
    }
    cout<<z<<endl;
    return 0;
}

Measured memory_bytes: 3616
#include<stdio.h>
int main(){
 
  int i,j,num,count[26];
  char a[1200],ch;
 
  i = 0;
  while(scanf("%c",&ch)!=EOF){
      a[i]=ch;
      i++;
  }
 
  for(j=0;j<26;j++)
    count[j]=0;
   
 
  for(j=0;j<i;j++){
 
    if(a[j]>=65 && a[j]<=90){
      a[j]+=32;
    }
    if('a'<=a[j] && a[j]<='z'){
    num= a[j]-'a';
    count[num]++;
    }
  }
 
  for(j=0;j<26;j++){
    printf("%c : %d\n",j+97,count[j]);
  }
 
  return 0;
}


Measured memory_bytes: 2048
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < (int)n; ++i)
#define RREP(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define FOR(i, s, n) for (int i = s; i < (int)n; ++i)
#define RFOR(i, s, n) for (int i = (int)n - 1; i >= s; --i)
#define ALL(a) a.begin(), a.end()
#define IN(a, x, b) (a <= x && x < b)
template<class T>inline void out(T t){cout << t << "\n";}
template<class T,class... Ts>inline void out(T t,Ts... ts){cout << t << " ";out(ts...);}
template<class T>inline bool CHMIN(T&a,T b){if(a > b){a = b;return true;}return false;}
template<class T>inline bool CHMAX(T&a,T b){if(a < b){a = b;return true;}return false;}
constexpr int INF = 1e18;



signed main(){
	string s;
	cin >> s;
	vector<vector<int>>dp(s.size() + 1,vector<int>(2,-INF));
	vector<vector<int>>r(s.size() + 1,vector<int>(2,-1));
	dp[0][1] = 0;
	REP(i,s.size()){
		REP(j,2){
			if(s[i] == 'P'){
				if(CHMAX(dp[i + 1][0],dp[i][j])){
					r[i + 1][0] = j;
				}
			}else if(s[i] == 'D'){
				if(CHMAX(dp[i + 1][1],dp[i][j] + 1 + (j == 0))){
					r[i + 1][1] = j;
				}
			}else{
				if(CHMAX(dp[i + 1][0],dp[i][j])){
					r[i + 1][0] = j;
				}
				if(CHMAX(dp[i + 1][1],dp[i][j] + 1 + (j == 0))){
					r[i + 1][1] = j;
				}
			}
		}
	}
	string ans = "";
	int now = -1, to = -1;
	if(dp[s.size()][0] > dp[s.size()][1]){
		now = 0;
	}else{
		now = 1;
	}
	int N = s.size();
	while(now != -1){
		if(now == 0)ans += 'P';
		else ans += 'D';
		now = r[N--][now];
	}
	ans.pop_back();
	reverse(ALL(ans));
	out(ans);
}

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

int main()
{
  int N,K;
  cin>>N>>K;
  double s=0;
  for(int i=1;i<N+1;i++)
  {
    double ss=1;
    int b=i;
    while(b<K)
    {
      ss/=2;
      b*=2;
    }
    s+=ss;
  }
  s/=N;
  cout<<fixed<<setprecision(10)<<s<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long n;
int main() {
	cin>>n;
	string s;
	while(n) {
    	long long d=(n-1)%26;
	    s.insert(s.begin(),'a'+d);
    	n=(n-1)/26;
	}
	cout<<s<<endl;
	return 0;
} 

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

using ll = long long;
using ull = unsigned long long;

const double PI = acos(-1);
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;

#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
#define REP(i,n) for (int i = 0; i<n; i++)
#define ALL(a) begin(a), end(a)

int main (void) {
    int N;
    cin>>N;
    for (int i=0;i*4<=N;i++) {
        if ((N-4*i)%7==0) {
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}

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

vel_go=[0]
for ti, v_lim in zip(T,V):
    for _ in range(ti*2):
        v = min(vel_go[-1] + 0.5, v_lim)
        vel_go.append(v)

vel_back = [0]
for ti, v_lim in zip(T[::-1], V[::-1]):
    for _ in range(ti*2):
        v = min(vel_back[-1] + 0.5, v_lim)
        vel_back.append(v)
vel_back.reverse()

velocity = tuple(min(x,y) for x, y in zip(vel_go, vel_back))
ans = sum(0.25*(x+y) for x,y in zip(velocity[:-1], velocity[1:]))
print(ans)

Measured memory_bytes: 4724
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a=sc.nextInt(),b=sc.nextInt(),c=sc.nextInt();
    if(a==b){
      System.out.println(c);
    }else if(a==c){
      System.out.println(b);
    }else {
      System.out.println(a);
    }
  }
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
    int A,B;cin>>A>>B;
    int ans=-10000;
    ans=max(ans,A+B);
    ans=max(ans,A-B);
    ans=max(ans,A*B);
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <array>
#include <queue>
#include <map>

using namespace std;

#define ll long long
constexpr ll inf = 1e9+7;

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

    ll N;
    cin>>N;
    map<ll, ll> as;
    for (int n = 0; n < N; n++) {
        ll a;
        cin>>a;
        as[a-1]++;
        as[a]++;
        as[a+1]++;
    }
    priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, less<pair<ll, ll>>> q;
    for (auto&& a : as) q.push(make_pair(a.second, a.first));

    cout<<q.top().first<<endl; return 0;
}

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

int main() {
	string s;
	cin>>s;
	int ans=0;
	for(int i=0;i<s.length()/2;i++)
	{
	    if(s[i]!=s[s.length()-1-i])
	    ans++;
	}
	cout<<ans;
}


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

int main(){
	int n,res=0;
	cin>>n;
	if(n<10) res+=n;
	else{
		res+=9;
		if(n<1000) res+=max(0,n-99);
		else{
			res+=900;
			if(n<100000) res+=max(0,n-9999);
			else res+=90000;
		}
	}
	cout<<res<<"\n";
	return 0;
}

Measured memory_bytes: 256
#coding:utf-8
import sys,os
from collections import defaultdict, deque
from fractions import gcd
from math import ceil, floor
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0
def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    XLMIIS = lambda x: [LMIIS() for _ in range(x)]
    YN = lambda c : print('Yes') if c else print('No')
    MOD = 10**9+7

    list_N = list(map(int,list(input())))
    len_N = len(list_N)
    list_N = [0] + list_N

    K = II()
    dp0 = []
    dp1 = []
    for i in range(len_N+1):
        dp0.append([0]*(K+1))
        dp1.append([0]*(K+1))
    for i in range(1,len_N+1):
        dp0[i][0] = 1
    dp0[1][1] = max(list_N[1]-1,0)
    dp1[1][1] = 1
    for i in range(2,len_N+1):
        dp1[i][0] = dp1[i-1][0]
        for j in range(1,K+1):
            num = list_N[i]
            if num > 0:
                dp0[i][j] = dp0[i-1][j-1] * 9 + dp0[i-1][j] + dp1[i-1][j-1] * (num-1) + dp1[i-1][j]
                dp1[i][j] = dp1[i-1][j-1]
            else:
                dp0[i][j] = dp0[i-1][j-1] * 9 + dp0[i-1][j]
                dp1[i][j] = dp1[i-1][j]
                
    print(dp0[len_N][K]+dp1[len_N][K])
    dbg(dp0[len_N][K],dp1[len_N][K])






if __name__ == '__main__':
    main()

Measured memory_bytes: 77448
import sys
stdin = sys.stdin

sys.setrecursionlimit(10 ** 7)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x) - 1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())


def divisors(m: int):
    i = 1
    div = []
    while i * i <= m:
        if m % i == 0:
            div.append(i)
            div.append(m // i)
        i += 1

    return list(set(div))

n, k = li()
a = list(li())

ans = 1

# aの和を素因数分解
divs = divisors(sum(a))
divs.sort(reverse=True)

# 大きい順に判定
for div in divs:
    if div == 1:
        break

    amodr = [ai % div for ai in a]
    amodr.sort(reverse=True)
    rsum = sum(amodr)
    rnum = rsum // div

    req = rsum - sum(amodr[:rnum])

    if req <= k:
        ans = div
        break

print(ans)


Measured memory_bytes: 42076
N, K = map(int, input().split())
A = list(map(int, input().split()))
ans = 0

X = 0
for i in range(40, -1, -1):
    if X | (1 << i) > K:
        continue
    cnt = 0
    for j in range(N):
        if A[j] & (1 << i) == 0:
            cnt += 1
    if cnt > N - cnt:
        X |= (1 << i)

ans = 0
for i in range(N):
    ans += X ^ A[i]

print(ans)

Measured memory_bytes: 14620
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
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; }
template<typename T> T gcd(T a,T b){return b?gcd(b,a%b):a;}
const LL mod=1000000007;
const LL LINF=1LL<<62;
const int INF=1<<30;
int dx[]={1,0,-1,0,-1,1,1,-1};
int dy[]={0,1,0,-1,-1,-1,1,1};

int M_N = 2000000;

vector<LL> fact;
vector<LL> inver(M_N+1);
 
LL combi(int n,int r){
    if(n<r||n<0||r<0) return 0;
    return fact[n]%mod*inver[n-r]%mod*inver[r]%mod;
}
 
 
LL fpow(LL a, LL n){
    LL x = 1;
    while(n > 0){
        if(n&1){
            x=x*a%mod;
        }
        a=a*a%mod;
        n >>= 1;
    }
    return x;
}
 
void set_combi(){
    LL s=1;
    fact.push_back(1);
    for(int i=1;i<=M_N;i++){
        s*=i;
        s%=mod;
        fact.push_back(s);
    }
    inver[M_N]=fpow(fact[M_N],mod-2);
    for(int i=M_N-1;i>=0;i--){
        inver[i]=inver[i+1]*(i+1)%mod;
    }
}
 
LL hcombi(int n,int r){
    return combi(n+r-1,r); 
}

vector<LL> divi(LL K){
    vector<LL> v;
    for(LL i=1;i*i<=K;i++){
        if(K%i) continue;
        v.pb(i);
        v.pb(K/i);
    }
    sort(ALL(v));
    v.erase(unique(ALL(v)),v.end());
    return v;
}

vector<LL> pdivi(LL K){
    vector<LL> v;
    for(LL i=2;i*i<=K;i++){
        if(K%i) continue;
        v.pb(i);
        while(K%i==0){
            K/=i;
        }
    }
    if(K!=1) v.pb(K);
    return v;
}





int main(){
    set_combi();
    LL k;cin >> k;
    string s;cin >> s;
    LL ans = 0;
    LL n = s.length();
    vector<LL> l(k + 1, 0);
    for (int i = 0; i <= k; i++) {
        l[i] = fpow(25, i) * combi(n + i - 1, n - 1) %mod;
        ans = (ans + l[i] * fpow(26, k - i)) %mod;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 45164
#include <iostream>
#include<vector>
int n; int k; int q; int a;
using namespace std;
int main()
{
	vector<int> point(100006);
	cin >> n >> k >> q;
	for (int i = 0; i < n; i++) {
		point[i] = k - q;
	}
	for (int j = 0; j < q; j++) {
		cin >> a;
		++point[a - 1];
	}
	for (int i = 0; i < n; i++) {
		if (point[i] > 0)
			cout << "Yes" << endl;
		else
			cout << "No" << endl;
	}
}

Measured memory_bytes: 1024
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	H := nextInt()
	W := nextInt()
	m := make([]string, H)
	val1 := make([][]int, H)
	val2 := make([][]int, H)
	for i := 0; i < H; i++ {
		val1[i] = make([]int, W)
		val2[i] = make([]int, W)
	}

	for i := 0; i < H; i++ {
		m[i] = nextString()
	}

	for i := 0; i < H; i++ {
		for j := 0; j < W; j++ {
			if string(m[i][j]) == "#" {
				val1[i][j] = 0
				continue
			}
			if j > 0 {
				val1[i][j] = val1[i][j-1] + 1
			} else {
				val1[i][j] = 1
			}
		}

		for j := W - 2; j >= 0; j-- {
			if val1[i][j] == 0 {
				continue
			}
			val1[i][j] = Max(val1[i][j], val1[i][j+1])
		}

	}

	for i := 0; i < W; i++ {
		for j := 0; j < H; j++ {
			if string(m[j][i]) == "#" {
				val2[j][i] = 0
				continue
			}
			if j > 0 {
				val2[j][i] = val2[j-1][i] + 1
			} else {
				val2[j][i] = 1
			}
		}
		for j := H - 2; j >= 0; j-- {
			if val1[j][i] == 0 {
				continue
			}
			val2[j][i] = Max(val2[j][i], val2[j+1][i])
		}
	}
	maxV := 0
	for i := 0; i < H; i++ {
		for j := 0; j < W; j++ {
			maxV = Max(maxV, val1[i][j]+val2[i][j]-1)
		}
	}
	fmt.Println(maxV)
}

func nextInt() int {
	v, _ := strconv.Atoi(nextReader())
	return v
}

func nextInt64() int64 {
	v, _ := strconv.ParseInt(nextReader(), 10, 64)
	return v
}

func nextString() string {
	return nextReader()
}

func nextInts(n int) []int {
	r := make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt()
	}
	return r
}

func nextInt64s(n int) []int64 {
	r := make([]int64, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt64()
	}
	return r
}

var nextReader func() string

func init() {
	nextReader = NewScanner()
}

func NewScanner() func() string {
	r := bufio.NewScanner(os.Stdin)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)
	return func() string {
		r.Scan()
		return r.Text()
	}
}

func Min(a int, b int) int {
	if a > b {
		return b
	}
	return a
}

func Max(a int, b int) int {
	if a > b {
		return a
	}
	return b
}

func MinA(arg ...int) int {
	var s = arg[0]
	for _, v := range arg {
		s = Min(s, v)
	}
	return s
}

func MaxA(arg ...int) int {
	var s = arg[0]
	for _, v := range arg {
		s = Max(s, v)
	}
	return s
}

func Abs(a int) int {
	if a < 0 {
		return a * -1
	}
	return a
}


Measured memory_bytes: 71552
#include<bits/stdc++.h>
using ll  = long long;
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define erep(e,v) for(auto && e :v)
#define all(in) in.begin(), in.end()
#define MP make_pair
#define INF (sizeof(int) == 4 ? (int)1e9:(int)1e18)
#define EPS 0.0000000001
using namespace std;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
template<class T> void join(T &a){int t = 0;for(auto itr :a){if(t++)cout << " "; cout << itr;} cout <<endl; }
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
signed main(){
    //    std::ios_base::sync_with_stdio(false);
    //    cin.tie(NULL);
    int a,b,k; cin >> a >> b >> k;
    int cnt = 0;
    for(int i = 100; i >= 1;--i){
        if(i <= a and i <= b and b % i == 0 and a %i ==0){
            ++cnt;
            if(cnt ==k){
                return cout << i << endl,0;
            }
        }
    }
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using pil = pair<int, ll>;
using uint = unsigned int;
using matrix = vector<vector<uint>>;
template <typename T>
using Graph = vector<vector<T>>;
const int MOD = 1e9 + 7;

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

    int a = 0;
    for (int i = 0; i < 3; ++i) {
        char c;
        cin >> c;
        a |= (1 << (c - 'a'));
    }

    cout << (a == 7 ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <math.h>

using namespace std;

typedef long long ll;

int main() {
	int n, m, l; cin >> n >> m >> l;
	ll a[100][100];
	ll b[100][100];
	for (int y = 0; y < n; ++y) {
		for (int x = 0; x < m; ++x) {
			cin >> a[y][x];
		}
	}
	for (int y = 0; y < m; ++y) {
		for (int x = 0; x < l; ++x) {
			cin >> b[y][x];
		}
	}
	for (int y = 0; y < n; ++y) {
		for (int x = 0; x < l; ++x) {
			if (x) cout << " ";

			ll c = 0;
			for (int k = 0; k < m; ++k) {
				c += a[y][k] * b[k][x];
			}
			cout << c;
		}
		cout << endl;
	}
}



Measured memory_bytes: 3208
(let ((n (read))
      (ans 0)
      (min (expt 10 6)))
  (loop :for i :from 1 :to n
        :for p := (read)
        :do (setf min (min min p))
        :if (<= p min)
        :do (incf ans))
  (format t "~A~%" ans))


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

int charToInt(char c){
    char zero_num = '0';
    return (int)c - (int)zero_num;
}

signed main(){
    int X,Y;cin>>X>>Y;

    if(Y%2!=0){
        cout<<"No"<<endl;
        return 0;
    }
    if(Y >=2*X && Y<=4*X){
        cout<<"Yes"<<endl;
        return 0;

    }
        cout<<"No"<<endl;

    return 0;
}

Measured memory_bytes: 3632
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
	for (;;) {
		string s; cin >> s;
		if (s == "#") break;
		vector< vector<int> > l(3, vector<int>(3)), r(3, vector<int>(3));
		for (int i = 0; i < s.length(); i++) {
			int j = (s[i] - '1') % 3;
			vector< vector<int> > _l(3, vector<int>(3, INT_MAX / 2)), _r(3, vector<int>(3, INT_MAX / 2));
			for (int k = 0; k < 3; k++)
				for (int _k = k; _k < 3; _k++) {
					_r[k][j] = min(_r[k][j], l[k][_k]);
					_l[j][_k] = min(_l[j][_k], l[k][_k] + 1);
					_l[j][_k] = min(_l[j][_k], r[k][_k]);
					_r[k][j] = min(_r[k][j], r[k][_k] + 1);
				}
			l = _l; r = _r;
		}
		int mini = INT_MAX / 2;
		for (int k = 0; k < 3; k++)
			for (int _k = k; _k < 3; _k++)
				mini = min(mini, min(l[k][_k], r[k][_k]));
		cout << mini << endl;
	}
}

Measured memory_bytes: 1348
#include <cctype>
#include <cstdio>
#include <cstring>

using namespace std;

char S[111][22]; int N, H, Q, R, T[111], P[111];

int main()
{
    scanf("%d %d", &N, &H);
    
    for(int i = 0; i < N; i++)
    {
        scanf("%s %d", S[i], &T[i]);
    }
    
    char F[2];
    
    for(int i = 0; i < N; i++)
    {
        int ptr = 0;
        
        while(ptr != strlen(S[i]))
        {
            printf("? %s\n", S[i]); fflush(stdout);
            
            scanf("%s", F); R++;
            
            if(tolower(S[i][ptr]) == tolower(F[0]))
            {
                S[i][ptr] = '_'; ptr++; Q++;
            }
            else
            {
                P[i]++;
                
                if(P[i] > T[i])
                {
                    H--; break;
                }
            }
        }
        
        if(H == 0)
        {
            printf("! Game Over\n"); return 0;
        }
    }
    
    int r = Q * 1000 / R;
    
    printf("! Game Clear %d.%d\n", r / 10, r % 10);
    
    return 0;
}

Measured memory_bytes: 3372
#include<stdio.h>

int main(){
		char s[28];
		int a[27]={0},i,j;
		scanf("%s",s);
		for(i=0;s[i]!=0;i++){
				a[s[i]-'a']=1;
		}
		//printf("%d\n",i);
		if(i<26){
				printf("%s",s);
				for(i=0;i<26;i++){
						if(a[i]==0){
								putchar('a'+i);
								break;
						}
				}
				puts("");
				return 0;
		}
		int tmp=-1;
		for(i=25;i>=0;i--){
				for(j=s[i]-'a';j<26;j++){
						if(a[j]==2){
								tmp=i;
								break;
						}
				}
				a[s[i]-'a']++;
				if(tmp==i)break;
				
		}
		//printf("%d\n",i);
		if(i==-1){
				puts("-1");
				return 0;
		}
		for(i=0;i<tmp;i++)putchar(s[i]);
		putchar('a'+j);
		puts("");
		//printf("%d\n",j);
		return 0;
}


Measured memory_bytes: 128
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cfloat>
#include <complex>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i = 0;i < n; i++)
#define REP(i,n) for(int i = 1;i <= n; i++)
#define ll long long
using namespace std;



int main(){

    int A,B;
    string S,T,U;

    cin >> S >> T;
    cin >> A >> B;
    cin >> U;

    if(S == U){

        cout << A - 1 << " "<< B <<endl;

    }else if(T == U){

        cout << A << " " << B - 1 <<endl;
    }

    return 0;
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<ll, ll> pll;
struct pair_hash {
    template <class T1, class T2>
    size_t operator () (const pair<T1,T2> &p) const {
        auto h1 = hash<T1>{}(p.first);
        auto h2 = hash<T2>{}(p.second);
        return h1 ^ h2;  
    }
};
using Vote = pair<ll,ll>;
using Unordered_map = unordered_map<Vote, int, pair_hash>;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define FORD(i,a,b) for(ll i=a;i>=b;i--)
#define showvec(arr,a,b) for(ll i=a;i<b;i++) cout<<arr[i]<<" ";
#define read_input(arr,a,b) for(ll i=a;i<b;i++) cin>>arr[i];
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define endl '\n'
#define SmooothOperatorrrrr()                 \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                    \
    cout.tie(0);                   
#define deci(n) cout<<fixed<<setprecision(n)
const int mod=998244353;
const int mod2=1000000007;
#define M_PI 3.14159265358979323846
#define LL_MAX 9223372036854775807
#define MAXN 2000001
/**************************************************************************************************/
int main()
{
    SmooothOperatorrrrr();
    string s;cin>>s;
    int maxm=0;int count=0;
    FOR(i,0,s.size())
    {
        if(s[i]=='R')
            count++;
        else
        {
            maxm=max(maxm,count);
            count=0;
        }
    }
    maxm=max(maxm,count);
    cout<<maxm<<endl;
}       

Measured memory_bytes: 3596
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int gcd(int n, int m){
  if(n==0) return m;
  else return gcd(m%n,n);
}

int main(){
   long A, B;
   cin >> A >> B;

   int g = gcd(A, B);
   //cout << g <<endl;

   cout << A*(B/g) <<endl;

  return 0;
}




Measured memory_bytes: 256
data = []

while data = gets
	data = data.split(nil)
	data.map!{|n| n.to_i}

	data.sort!
	a = data[0]
	b = data[1]

	r = b % a

	while r != 0
		b = a
		a = r
		r = b % a
	end
	ans = a

	a = data[0]
	b = data[1]

	while a % b != 0
		a = a + data[0]
	end

	puts printf("%d %d", ans, a)
end

Measured memory_bytes: 8672
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); ++i)
#define fi first
#define se second
#define INF 1000000009
#define LLINF 1000000000000000009LL
using ll = long long;

int main(){
  int k,n;
  cin>>k>>n;
  vector<int>a(n);
  rep(i,n)cin>>a[i];
  int ans=INF;
  vector<int>d(n);
  rep(i,n){
    if(i+1==n){
      d[i]=k-a[i]+a[0];
    }
    else{
      d[i]=a[i+1]-a[i];
    }
  }
  rep(i,n){
    ans=min(ans,k-d[i]);
  }
  cout<<ans<<endl;
  return(0);
}


Measured memory_bytes: 1792
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
	static void solve(){//Here is the main function
		String s = next();
		HashMap<String, String> map = new HashMap<String, String>();
		map.put("A", "T");
		map.put("T", "A");
		map.put("C", "G");
		map.put("G", "C");
		myout(map.get(s));
	}
	//Method addition frame start



	//Method addition frame end
}


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

int N;
int d[110];

int main(){
    cin>>N;
    for (int i = 1; i <= 100; i++)
    {
        d[i] = 0;
    }
    
    for (int i = 0; i < N; i++)
    {
        int x;
        cin>>x;
        d[x] = 1;
    }
    
    int ans = 0;
    for (int i = 1; i <= 100; i++)
    {
        ans += d[i];
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
_,S = gets,-gets
c,l,r = 0,0,S.size-1
l += 1  while S[l] == ?R
r -= 1  while l<r && S[r] != ?R
while l < r
  c += 1
  l += 1
  r -= 1
  l += 1  while S[l] == ?R
  r -= 1  while l<r && S[r] != ?R
end
p c

Measured memory_bytes: 14476
let input = require('fs').readFileSync('/dev/stdin', 'utf8').split(' ');
// let input = '3 4 10 40'.split(' ');

const a = parseInt(input[0],10);
const b = parseInt(input[1],10);
const h = parseInt(input[2],10);
const m = parseInt(input[3],10);
const pi = Math.PI;

const arga = (h + m/60)*pi/6;
const argb = pi * m / 30;

const c = (a**2 + b**2 - 2*a*b*Math.cos(arga-argb))**0.5;

console.log(c);

Measured memory_bytes: 29772
#include<stdio.h>
 
#define MAX 100000
 
struct Node {
  int p,l,r;
};
 
struct Node T[MAX];
int D[MAX],H[MAX]; 

int Sibling(int);
void Depth(int,int);
int Height(int);
void print(int);

int main()
{
  int i,n,left,right,id,root = 0;
 
  scanf("%d",&n);
 
  for(i = 0; i < n ;i++){
    T[i].p = -1;
  }
 
  for(i = 0; i < n; i++){ 
    scanf("%d%d%d",&id,&left,&right);
 	T[id].l = left;
 	T[id].r = right;
 	if(left != -1) T[left].p = id;
 	if(right != -1) T[right].p = id;
  }
 
 for(i = 0; i < n; i++){
 	if(T[i].p == -1) root = i;
 }
 
 Depth(root, 0);
 Height(root);
 
 for(i = 0; i < n; i++){
 	print(i);
 }
  
  return 0;
}
 
int Sibling(int i){
 	if(T[i].p == -1) return -1;
 	else if(T[T[i].p].l != i && T[T[i].p].l != -1) return T[T[i].p].l;
 	else if(T[T[i].p].r != i && T[T[i].p].r != -1) return T[T[i].p].r;
 	else return -1;
 }
 
void Depth(int root,int x){
	if(root == -1) return;
	D[root] = x;
	Depth(T[root].l,x+1);
	Depth(T[root].r,x+1);
}

int Height(int root){
	int h1 = 0;
	int h2 = 0;
	if(T[root].l != -1) h1 = Height(T[root].l) + 1;
	if(T[root].r != -1) h2 = Height(T[root].r) + 1;
	
	if(h1 > h2){
	H[root] = h1;
	return h1;
	}
	else {
	H[root] = h2;
	return h2;
	}
}

void print(int i){
	int count = 0;
	
	printf("node %d: parent = %d, sibling = %d, ",i,T[i].p,Sibling(i));
	
	if(T[i].l != -1) count++;
	if(T[i].r != -1) count++;
	
	printf("degree = %d, depth = %d, height = %d, ",count,D[i],H[i]);
	
	if(T[i].p == -1) printf("root\n");
    else if(T[i].l == -1 && T[i].r == -1) printf("leaf\n");
    else printf("internal node\n");
}

Measured memory_bytes: 620
#include<iostream>
#include<cmath>
#include<string>
#include<cctype>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
        int a,b,c;
        cin>>a>>b>>c;
        int ans=0;
        for(int i=a;i<=b;i++){
                if(c%i==0) ans++;
        }
        cout<<ans<<endl;
        return 0;
}

Measured memory_bytes: 1160
C = input()
 
if C == "a":
    print("b")
elif C == "b":
    print("c")
elif C == "c":
    print("d")
elif C == "d":
    print("e")
elif C == "e":
    print("f")
elif C == "f":
    print("g")
elif C == "g":
    print("h")
elif C == "h":
    print("i")
elif C == "i":
    print("j")
elif C == "j":
    print("k")
elif C == "k":
    print("l")
elif C == "l":
    print("m")
elif C == "m":
    print("n")
elif C == "n":
    print("o")
elif C == "o":
    print("p")
elif C == "p":
    print("q")
elif C == "q":
    print("r")
elif C == "r":
    print("s")
elif C == "s":
    print("t")
elif C == "t":
    print("u")
elif C == "u":
    print("v")
elif C == "v":
    print("w")
elif C == "w":
    print("x")
elif C == "x":
    print("y")
elif C == "y":
    print("z")
else:
    print("era-")

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

template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
ll min(int a,ll b){return min((ll)a,b);} ll min(ll a,int b){return min(a,(ll)b);}
template <class S> void print(vector<S> &v){for(ll i=0; i<(ll)v.size(); i++){cerr << v[i] << ' ';}cerr << endl;}
template <class S> void print(vector<vector<S>> &v) {for (ll i = 0; i < (ll)v.size(); i++) {for (ll j = 0; j < (ll)v[i].size(); j++) {cerr << v[i][j] << ' ';}cerr << endl;}}

void Main();

int main(){
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	Main();
	return 0;
}

void Main(){
	using ld = long double;
	int n; cin >> n;
	ld s = 0;
	Rep(n){
		int a; cin >> a;
		s += 1/(ld)a;
	}
	cout << 1/s << endl;
}

Measured memory_bytes: 3792
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;
typedef long double ld;
//typedef tree <int,null_type,less <int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#define FAST                 \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
#define rep(g, i, n) for (ll g = i; g < n; g++)
#define rev(g, n, i) for (ll g = n - 1; g >= i; g--)
#define all(v) v.begin(), v.end()
#define pb push_back
#define mxe(v) *max_element(v.begin(), v.end())
#define mne(v) *min_element(v.begin(), v.end())
#define ve vector
#define bb break
#define cc continue
#define rem 1000000007
#define PI 3.141592653589793238462643383279502
ll power(ll x, ll y, ll p)
{
    ll res = 1; // Initialize result
    x = x % p;  // Update x if it is more than or
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1; // y = y/2
        x = (x * x) % p;
    }
    return res;
}
ll modInverse(ll n, ll p)
{
    return power(n, p - 2, p);
}
struct point
{
    ll x, y;
    double ang;
};
bool fun(point a,point b)
{
    return a.ang<b.ang;
}
int main()
{
    FAST
        // freopen("input1.txt", "r", stdin);
        // freopen("output.txt", "w", stdout);
        /*ll tests;
    cin>>tests;
    rep (gg,0,tests)
    {}*/
        ll n;
    cin >> n;
    ve<point> arr(n);
    rep(i, 0, n)
    {
        cin >> arr[i].x >> arr[i].y;
        if (arr[i].x>0&&arr[i].y>=0)
        {
            arr[i].ang=atan((double)arr[i].y/arr[i].x);
        }
        else if (arr[i].x<0&&arr[i].y>=0)
        {
            double val=(double)(arr[i].x)/arr[i].y;
            arr[i].ang=atan(abs(val))+PI/2;
        }
        else if (arr[i].x<0&&arr[i].y<=0)
        {
            double val=(double)(arr[i].y)/arr[i].x;
            arr[i].ang=atan(abs(val))+PI;
        }
        else if (arr[i].x>0&&arr[i].y<=0)
        {
            double val=(double)(arr[i].x)/arr[i].y;
            arr[i].ang=atan(abs(val))+3*PI/2;
        }
        else if (arr[i].x==0)
        {
            if (arr[i].y>=0)
            {
                arr[i].ang=PI/2;
            }
            else
            {
                arr[i].ang=3*PI/2;
            }
        }
    }
    sort(all(arr),fun);
    rep (i,0,n)
    {
        arr.pb(arr[i]);
    }
    ll ans = 0;
    rep(i, 1, n+1)
    {
        rep (j,0,2*n+1-i)
        {
            ll ax=0,ay=0;
            rep (z,j,j+i)
            {
                ax+=arr[z].x;
                ay+=arr[z].y;
            }
            ll ans1=ax*ax+ay*ay;
            ans=max(ans,ans1);
        }
    }
    double fans = sqrt(ans);
    cout << fixed << setprecision(25) << fans << "\n";
}


Measured memory_bytes: 512
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1<<29;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

int main() {
  string s;
  cin >> s;
  int x, y;
  cin >> x >> y;
  int N = s.size();

  vector<int> d;
  int cnt = 0;
  for (int i = 0; i < N; i++) {
    if (s[i] == 'T') {
      d.push_back(cnt);
      cnt = 0;
    } else {
      cnt++;
    }
  }
  d.push_back(cnt);

  int D = d.size();
  vector<set<int>> dp(D);
  dp[0].insert(d[0]);

  // D: 1, 2, 3, 4, 5
  // x: 0, 0, 2, 2, 4
  // y:-1 ,1, 1, 3, 3
  int xmax = ((D - 1) / 2) * 2;
  int ymax = (D / 2) * 2 - 1;

  // X
  for (int i = 2; i < D; i+=2) {
    for(auto &s : dp[i - 2]) {
      dp[i].insert(s + d[i]);
      dp[i].insert(s - d[i]);
    }
  }

  // Y
  for (int i = 1; i < D; i+=2) {
    if (i == 1) {
      dp[i].insert(d[i]);
      dp[i].insert(-d[i]);
    } else {
      for(auto &s : dp[i - 2]) {
        dp[i].insert(s + d[i]);
        dp[i].insert(s - d[i]);
      }
    }
  }
  bool xok = false, yok = false;
  if (ymax == -1) {
    yok = y == 0;
  } else {
    yok = dp[ymax].find(y) != dp[ymax].end();
  }
  xok = dp[xmax].find(x) != dp[xmax].end();

  if (yok && xok) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 232192
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(10000)

# Debug output
def chkprint(*args):
    names = {id(v):k for k,v in inspect.currentframe().f_back.f_locals.items()}
    print(', '.join(names.get(id(arg),'???')+' = '+repr(arg) for arg in args))

# Binary converter
def to_bin(x):
    return bin(x)[2:]

# --------------------------------------------

dp = None

def main():
    a, b = [int(_) for _ in input().split()]
    diff = b - a

    tower = 0
    ts = []
    for add in range(1, 1000):
        tower += add
        ts.append(tower)

    print(ts[diff-2] - a)

main()


Measured memory_bytes: 4800
#include<stdio.h>

int main(void)
{  
   int h , m, s;
   scanf("%d", &s);
   m = s / 60;
   h = m /60;
   s = s % 60;
   m = m % 60;
   printf("%d:%d:%d\n", h , m , s);
  
   return 0;
}

Measured memory_bytes: 592
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("Failed to read bytes") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let d:f64 = read();
    let t:f64 = read();
    let s:f64 = read();
    println!("{}", if d / s  <= t {"Yes"} else {"No"});
}


Measured memory_bytes: 2188
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
#include<set>
#include<queue>

using namespace std;

int main()
{
	int n,k;
	cin >> n >> k;
	int r,s,p;
	cin >> r >> s >> p;
	string t;
	cin >> t;
	long long ans=0;
	for(int i=0;i<n;i++)
	{
		if(i>=k)
		{
			if(t[i-k]==t[i])t[i]='*';
		}
		if(t[i]=='r')ans+=p;
		else if(t[i]=='s')ans+=r;
		else if(t[i]=='p')ans+=s;
	}
	cout << ans << endl;






}


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

int main(){
  int N;  cin >> N;
  vector<long long>A(N+1);
  vector<long long>B(N);
  long long monster = 0;
  for(int i=0;i<N+1;i++){
    cin >> A.at(i);
    monster += A.at(i);
  }
  for(int i=0;i<N;i++){
    cin >> B.at(i);
  }

  for(int i=0;i<N;i++){
    if(B.at(i) - A.at(i) >= 0){
      B.at(i) -= A.at(i);
      A.at(i) = 0;
    }
    else{
      A.at(i) -= B.at(i);
      B.at(i) = 0;
    }
    if(A.at(i+1) - B.at(i) >= 0){
      A.at(i+1) -= B.at(i);
      B.at(i) = 0;
    }
    else{
      B.at(i) -= A.at(i+1);
      A.at(i+1) = 0;
    }

  }
  for(int i=0;i<=N;i++){
    monster -= A.at(i);
  }
  cout << monster << endl;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define lld long long int
#define vec vector<lld>
#define pll pair<lld,lld>
#define pb push_back
#define ss second
#define ff first
#define mp make_pair
#define mod 1000000007
#define answer(x) cout<<endl<<"answer : "<<x<<endl<<endl;
#define op(x) cout<<x<<endl;
#define maxn 500005
#define lld_max 5000000000000000000
#define messi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int main() {messi lld t=1;//cin>>t;
    while(t--)
    {
        lld n=0,m=0,k=0,i=0,j=0,p=0,q=0,x=0,y=0,z=0,ans=0,cnt=0,l=0,r=0,mid=0,lo=0,hi=0;string s;bool flag=false;
        cin>>n;
        for(i=1;i<n;i++)
            cnt+=(n-1)/i;
        op(cnt);
    }
	return 0;
}
/*  CODED BY:-
 ________________________________________
|            __        __                |
|  /\   /\  |__)  /\  |  \ |__| \ /  /\  |
| /~~\ /~~\ |  \ /~~\ |__/ |  |  |  /~~\ |
|________________________________________|

*/


Measured memory_bytes: 3636
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>

using namespace std;

vector<map<int,int> > ans;

int mon[] = {10,50,100,500};
int ccount(map<int,int> co,int f);

int main(){
	while(1){
		int fee;
		cin >> fee;
		if(fee == 0) break;
		
		map<int,int> coin,ucoin,acoin;
		
		int count = 0;
		for(int i = 0;i < 4;i++){
			int n;
			cin >> n;
			count += n;
			coin[mon[i]] = n;
			ucoin[mon[i]] = 0;
		}
		int tans = 1e9;
		for(int i= 0;i <= coin[mon[0]];i++){
			ucoin[mon[0]] = i;
			for(int j = 0;j <= coin[mon[1]];j++){
				ucoin[mon[1]] = j;
				for(int k = 0;k <= coin[mon[2]];k++){
					ucoin[mon[2]] = k;
					for(int l = 0;l <= coin[mon[3]];l++){
						ucoin[mon[3]] = l;
						int ucount = i + j + k + l;
						int lcount = count - ucount + ccount(ucoin,fee);
						if(tans > lcount){
							tans = lcount;
							acoin = ucoin;
						}
					}
				}
			}
		}
		
		ans.push_back(acoin);
	}
	
	for(int i = 0;i < ans.size();i++){
		if(i != 0) cout << endl;
		for(int j = 0;j < 4;j++){
			if(ans[i][mon[j]] != 0) cout << mon[j] << " " << ans[i][mon[j]]<< endl;
		}
	}
}

int ccount(map<int,int> co,int f){
	int am = 0;
	for(int i = 0;i < 4;i++){
		am += co[mon[i]] * mon[i];
	}
	
	int cm = 0;
	if(am >= f){
		cm = am - f;
	}else{
		return 1e9;
	}
	
	int cnt = 0;
	for(int i = 3;i >= 0;i--){
		int tn = cm / mon[i];
		cnt += tn;
		cm -= tn * mon[i];
	}
	
	return cnt;
}

Measured memory_bytes: 3284
N,M = map(int,input().split())
A = list(map(int,input().split()))
A.sort(reverse=True)

#幸福度をX以上増やせる手が何通りあるか？を二分探索．
#左手で握る人は線形探索，右手が二分探索で探す
#最後は累積和で計算

inf = 2*10**5+1
X_top = inf
X_bot = 0 #M手以上の組み合わせが作れる最大値

#幸福度をX以上挙げられる手の通り数ががMになる境界を探す
while X_top - X_bot !=1:  
    X=(X_top+X_bot)//2
    num=0
    
    for i in range(N):
        ok=-1
        ng=N
        h1=A[i]
        
        #右手と左手の合計がXになる境界を探す
        while ng-ok!=1:
            med=(ok+ng)//2
            h2=A[med]
            if h1+h2>=X:
                ok=med
            else:
                ng=med
        num+=ok+1
    
    if num>=M:
        X_bot = X
    else:
        X_top = X
        
ok_list=[0]*N
#各左手に対して何個okなくみがあるか探す
for i in range(N):
        ok=-1
        ng=N
        h1=A[i]
        X = X_bot
        #右手と左手の合計がXになる境界を探す
        while ng-ok!=1:
            med=(ok+ng)//2
            h2=A[med]
            if h1+h2>=X:
                ok=med
            else:
                ng=med
        ok_list[i]=ok

S=[0]*(N+1)
for i in range(N):
    S[i+1]=S[i]+A[i]

ans=0
for i in range(N):
    ans += A[i]*(ok_list[i]+1)+S[ok_list[i]+1]

if sum(ok_list)+N>M:
    ans-=(sum(ok_list)+N-M)*X
print(ans)

Measured memory_bytes: 55892