akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

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; }

#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;

const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;

int main(){
    int n;
    cin >> n;
    vector<ll>cnt(100001), a(n);
    rep(i, 0, n){
        cin >> a[i];
        cnt[a[i]]++;
    }
    sort(a.begin(),a.end());
    ll p = 0;
    rep(i, a[0], a[a.size()-1]+1){
        if(cnt[i]>1)p += (cnt[i]-1);
    }
    ll q = n-p;
    if(q%2==0)cout << q - 1 << endl;
    else cout << q << endl;
}

Measured memory_bytes: 4792
s = input()
ans = []

def latterCount(idx, s):
    if len(s) == 0:
        return 0
    if s[idx] != 'L':
        return 0

    count = 1
    for i in range(idx+1, len(s)):
        if s[i] == 'L' and s[i] == s[i-1]:
            count += 1
        else:
            break
    return count

def formerCount(idx, s):
    if len(s) == 0:
        return 0
    if s[idx] != 'R':
        return 0

    count = 1
    for i in reversed(range(idx)):
        if s[i] == 'R' and s[i] == s[i+1]:
            count += 1
        else:
            break
    return count

s = s.replace('RL', 'W')

#print(s)

for i in range(len(s)):
    if s[i] == 'R' or s[i] == 'L':
        ans.append(0)
    else:
        if i > 0:
            rCount = formerCount(i-1, s)
        else:
            rCount = 0
            #        print('rCount: ' + str(rCount))
        if i < len(s) - 1:
            lCount = latterCount(i+1, s)
        else:
            lCount = 0
#        print('lCount: ' + str(lCount))
        first = rCount // 2 + 1 + (lCount // 2 + lCount % 2)
        second = (rCount // 2 + rCount % 2) + 1 + lCount // 2
        ans.append(first)
        ans.append(second)

print(' '.join([str(i) for i in ans]))





Measured memory_bytes: 10648
#include <bits/stdc++.h>
#include <vector> 
# include <cstdint>
#define FOR(i,l,r) for(int i=(l);i<(r);++i)
#define RFOR(i,l,r) for(int i=(l);i>=(int)(r);i--)
#define rep(i,n)  FOR(i,0,n)
#define rrep(i,n)  RFOR(i,n-1,0)

#define int long long
using namespace std;
const int MX = 1e6;
const int inf = 1e9;
const int mod = 1e9+7;
using ll = long long;
using P = pair<ll, ll>;
vector<int> to[100005];
int cost[100005];

int x[10];
int y[10];

double dist(ll i, ll j) {
    int xx = (x[i]-x[j])*(x[i]-x[j]);
    int yy = (y[i]-y[j])*(y[i]-y[j]);
    return sqrt(xx+yy);
}

signed main(){
    int n;
    cin >> n;
    vector<double> v(n);
    rep(i, n) cin >> v[i];

    int tmp = 0;
    int ans = 0;
    rep(i, n-1) {
        if(v[i]>=v[i+1]) {
            tmp++;
            ans = max(tmp, ans);
        }else tmp = 0;
    }
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 3328
#import <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

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

  string s;
  cin >> s;
  ll n = s.size();

  ll ans = 0;
  ll cnt = 0;
  rep(i, n) {
    if (s[i] == 'A') {
      cnt++;
    } else if (i+1 < n and s.substr(i, 2) == "BC") {
      ans += cnt;
      i++;
    } else {
      cnt = 0;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 720
#include<bits/stdc++.h>
using namespace std;
int n,ans;
long long a[110];
int main() {
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%lld",&a[i]);
	sort(a+1,a+n+1);
	for(int i=1;i<=n;i++)
		for(int j=i+1;j<=n;j++)
			for(int k=j+1;k<=n;k++)
				if(a[i]+a[j]>a[k]&&a[i]!=a[j]&&a[j]!=a[k]) ans++;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 3828
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    x,y,z = f()
    cnt = x//(y+z)

    if  x%(y+z) >= z:
        print(cnt)
    else:
        print(cnt-1)


solve()


Measured memory_bytes: 2940
<?php
$in = explode(" ",trim(fgets(STDIN)));
$a = $in[0];
$b = $in[1];
$c = $in[2];

if(($a<$c && $c<$b) || ($b<$c && $c < $a)){
     echo "Yes";
    }else{
     echo "No";
    }
?>

Measured memory_bytes: 3828
// Author : Mohamed Sameh
#include <bits/stdc++.h>
typedef long long ll ;
#define pb push_back
#define f first
#define s second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define SZ(a) (int)a.size()
#define Flush fflush(stdout);
using namespace std ;
int h , n ;
const int M = 1e3 ;
int a[M][2];
ll dp[M][10001];
ll solve(int idx = 0 , int rem = h )
{
    if (rem <= 0 )return 0 ;
    if (idx >= n )return 1e12;
    //cout << idx <<" " << rem <<"\n";
    ll &ret = dp[idx][rem];
    if (~ret)return ret ;
    ret = solve(idx + 1 , rem );
    ret = min (ret , a[idx][1] + solve(idx , rem - a[idx][0]));
    return ret;
}
int main()
{
    memset(dp , -1 ,sizeof dp);
    scanf ("%d%d" , &h , &n );
    for (int i =0 ; i < n ;i++)
    {
        scanf ("%d%d" , a[i] , a[i]+1);
    }
    printf ("%lld\n" , solve());

}


Measured memory_bytes: 78848
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int a[200005], dp[1000005];
int main(){
    int n;
    scanf("%d", &n);
    for(int i=1;i<=n;i++) scanf("%d", &a[i]), dp[a[i]]++;
    for(int i=1000000;i>=1;i--){
        for(int j=i+i;j<=1000000;j+=i) dp[j] += dp[i];
    }
    int ans = 0;
    for(int i=1;i<=n;i++){
        if(dp[a[i]] == 1) ans++;
    }
    printf("%d\n", ans);
}

Measured memory_bytes: 8500
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int x,a,b;
  cin >> x >> a >> b;
  if(b-a<=0) puts("delicious");
  else if(b-a<=x) puts("safe");
  else puts("dangerous");
  return 0;
}


Measured memory_bytes: 256
def main():

    _ = int(input())
    h = [int(x) for x in input().split()]
    limit = h[-1]
    
    # 後ろから見ていく
    for num in reversed(h[:-1]):
        if limit > num:
            limit = num
        elif limit + 2 <= num:
            print("No")
            return
    print("Yes")

if __name__ == "__main__":
    main()

Measured memory_bytes: 14396
#include<stdio.h>

int main(){
  int i,t[101];
  int max,n;

  max = 0;
  for(i=0;i<=100;i++)t[i] = 0;

  while(scanf("%d",&n)!=EOF){
    t[n]++;
    if(max<t[n])max = t[n];
  }

  for(i=0;i<=100;i++)
    if(t[i]==max)printf("%d\n",i);

  return 0;
}

Measured memory_bytes: 0
import sys


input = sys.stdin.readline


def make_sum_set(i, v):
    if i == N:
        S.add(v)
        return
    else:
        make_sum_set(i+1, v)
        make_sum_set(i+1, v+A[i])


def main():
    make_sum_set(0, 0)
    for m in M:
        if m in S:
            print("yes")
        else:
            print("no")


if __name__ == "__main__":
    N = int(input())
    A = [int(a) for a in input().split()]
    Q = int(input())
    M = [int(m) for m in input().split()]
    S = set()
    main()


Measured memory_bytes: 5664
#include <iostream>
using namespace std;
long long w(long long a)
{
	int rtn=0;
	while(a!=0)
	{
		a/=10;
		rtn++;
	} 
	return rtn;
}
int main(int argc, char** argv) {
	long long n,ans=0;
	cin >> n;
	for(long long i=1;i*i<=n;i++)
	{
		if(n%i!=0)
			continue;
		ans=w(n/i);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import sys, math
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7

N, M = rl()
A = []
Cs = []
for i in range(M):
	a, b = rl()
	C = rl()
	A.append(a)
	Cs.append(C)

def get_bit(C):
	b = 0
	for c in C:
		b = b | (1 << (c-1))
	return b
bits =[]
for C in Cs:
	b = get_bit(C)
	bits.append(b)

start = 0
end = 2**N-1

import heapq

heap = []
heapq.heappush(heap, (0, start))

visited = {}
ans = -1
while heap:
	c, n = heapq.heappop(heap)
	if n in visited:
		continue
	if n == end:
		ans = c
		break
	visited[n] = 1
	for i, b in enumerate(bits):
		m = n | b
		if m in visited:
			continue
		cost = A[i]
		heapq.heappush(heap, (c + cost, m))
print(ans)


Measured memory_bytes: 125404
using System;

class rectangle
{
    public static void Main()
    {
        string a = Console.ReadLine();
        char b = ' ';
        string[] c = a.Split(b);


        int d = int.Parse(c[0]);
        int e = int.Parse(c[1]);

        int s = d * e;
        int l = 2 * d + 2 * e;

        Console.WriteLine("{0} {1}",s,l);
    }
}


Measured memory_bytes: 9184
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
ans = sum(B)
for i in range(0,N-1):
    if A[i]+1 == A[i+1]:
        ans += C[A[i]-1]
print(ans)


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

#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace __gnu_pbds;
using namespace std;
#define int long long
//for set
// typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;   
// for multiset
typedef tree<
pair<int, int>,
null_type,
less<pair<int, int>>,
rb_tree_tag,
tree_order_statistics_node_update> ordered_multiset;

#define ff first
#define ss second
#define endl "\n"
#define all(x) (x).begin(), (x).end()
#define PI 3.1415926535897932384626433832795
int MOD=1e9+7;
int powmod(int a,int l, int md){int res=1;while(l){if(l&1)res=res*a%md;l/=2;a=a*a%md;}return res;}
int binpow(int a,int l){int res=1;while(l){if(l&1)res=res*a;l/=2;a=a*a;}return res;}
typedef long long ll; typedef vector<ll> vi; typedef pair<ll, ll> ii; typedef vector<ii> vii;
#define pb push_back
int __set(int b, int i) {return b|(1<<i);} //set ith bit
int __unset(int b, int i) {return b&(~(1UL<<i));}
int __check(int b, int i) {return b&(1<<i);} //returns 0 if ith bit is 0
int mulmod(int a, int b, int md) {return ((a%md)*(b%md))%md;}
int addmod(int a, int b, int md) {return (a+b)%md;}
int submod(int a, int b, int md) {return (((a-b)%md)+md)%md;}
int divmod(int a, int b, int md) {return mulmod(a, powmod(b, md-2, md), md);} //if md is prime;
const ll inf = 0xFFFFFFFFFFFFFFFL; //very large number
priority_queue<int, vector<int>, greater<int> > pq; //for min priority_queue
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
clock_t time_p=clock();
void time()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
int dp[100][100000];

int32_t main(void)
{
	IOS;
	string k; int d;
	cin>>k>>d;
	int n = k.length();
	vi a(n+1);
	for(int i = 0; i < n; i++)
		a[i+1]=k[i]-'0';
	for(int i = 0; i < 10; i++) {
		if(n==1 && i==0)
			continue;
		dp[(i%d)][1]++;
	}
	// for(int i = 0; i < d; i++) {
	// 	for(int j = 1; j <= n; j++)
	// 		cout<<dp[i][j]<<" ";
	// 	cout<<endl;
	// }
	for(int i = 1; i < n; i++) {
		for(int j = 0; j < d; j++) {
			for(int k = 0; k < 10; k++) {
				if(i==n-1 && k == 0)
					continue;
				// cout<<k<<endl;
				// cout<<j<<" "<<k<<" "<<(j+k)%d<<" "<<dp[j][i]<<endl;
				dp[(j+k)%d][i+1]+=dp[j][i];
				dp[(j+k)%d][i+1]%=MOD;
			}
		}
	}
	// for(int i = 0; i < d; i++) {
	// 	for(int j = 1; j <= n; j++)
	// 		cout<<dp[i][j]<<" ";
	// 	cout<<endl;
	// }
	int ans=0, rem=0;
	for(int i = 1; i <= n; i++) {
		if(i==n) {
			// cout<<"in1 "<<rem<<endl;
			for(int j = 0; j <= a[i]; j++) {
				// if(i==1 && j==0)
				// 	continue;
				if((rem+j)%d==0) {
					// cout<<"in"<<endl;
					ans = (ans+1)%MOD;
				}
			}
		}
		else {
			for(int j = 0; j < a[i]; j++) {
				// if(i==1 && j==0)
				// 	continue;
				// cout<<j<<" "<<((d-rem-j)%d+d)%d<<" "<<n-i<<" "<<dp[((d-rem-j)%d+d)%d][n-i]<<endl;
				ans += dp[((d-rem-j)%d+d)%d][n-i];
				ans %= MOD;
			}
		}
		rem += a[i];
		rem %= d;
	}
	// if(rem%d==0) ans++;
	ans = (ans-1+MOD)%MOD;
	cout<<((ans+MOD)%MOD)<<endl;
	time();
	return 0;
}

Measured memory_bytes: 76416
#include<bits/stdc++.h>
#define int long long
#define p pair<int, int>
#define endl '\n'
const int INF = 1000000001;
const long double E = 0.00000001;

using namespace std;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int n;
    cin >> n;
    vector<int> a(n);
    for (int q = 0; q < n; q++){
        cin >> a[q];
    }
    vector<vector<int>> s(n, vector<int>(30));
    vector<int> ans(n, 0);
    for (int q = 1; q < n; q++){
        for (int q1 = 0; q1 < 30; q1++){
            s[q][q1] = (((a[q] >> q1) & 1) != ((a[0] >> q1) & 1));
        }
    }
    for (int q1 = 0; q1 < 30; q1++){
        int sum1 = 0;
        for (int q = 1; q < n; q++){
            sum1 += s[q][q1];
        }
        ans[0] |= ((sum1 % 2 != ((a[0] >> q1) & 1)) << q1);
    }
    for (int q = 1; q < n; q++){
        for (int q1 = 0; q1 < 30; q1++){
            if (((a[q] >> q1) & 1) != ((a[0] >> q1) & 1)){
                ans[q] |= ((1-((ans[0] >> q1) & 1)) << q1);
            }else{
                ans[q] |= (((ans[0] >> q1) & 1) << q1);
            }
        }
    }
    for (int q: ans){
        cout << q << ' ';
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 60912
#include<bits/stdc++.h>
using namespace std;
int data[200005];
int main()
{
	int n,k;
	long long int sum=0;
	cin>>n>>k;
	for(int i=0;i<n;i++)
	{
		cin>>data[i];
	}
	sort(data,data+n);
	for(int i=0;i<n-k;i++)
	{
		sum+=data[i];
	}
	cout<<sum;
	return 0;
}

Measured memory_bytes: 1024
//==========================Head files==========================
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<queue>
#include<cmath>
#include<set>
#include<iostream>
#include<map>
#define LL long long
#define db double
#define mp make_pair
#define pr pair<int, int>
#define fir first
#define sec second
#define pb push_back
#define ms(i, j) memset(i, j, sizeof i)
using namespace std;
//==========================Templates==========================
inline int read() {
    int x = 0, f = 1; char c = getchar();
    while(c < '0' || c > '9'){if (c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9'){x = x * 10 + c - '0'; c = getchar();}
    return x * f;
}
inline LL readl() {
    LL x = 0, f = 1; char c = getchar();
    while(c < '0' || c > '9'){if (c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9'){x = x * 10 + c - '0'; c = getchar();}
    return x * f;
}
int power(int a, int b) {
	int ans = 1;
	while (b) {
		if(b & 1) ans = ans * a;
		b >>= 1; a = a * a;
	}
	return ans;
}
int power_mod(int a, int b, int mod) {
	a %= mod;
	int ans = 1;
	while (b) {
		if(b & 1) ans = (ans * a) % mod;
		b >>= 1, a = (a * a) % mod;
	}
	return ans;
}
LL powerl(LL a, LL b) {
	LL ans = 1ll;
	while (b) {
		if(b & 1ll) ans = ans * a;
		b >>= 1ll;a = a * a;
	}
	return ans;
}
LL power_modl(LL a, LL b, LL mod) {
	a %= mod;
	LL ans = 1ll;
	while (b) {
		if(b & 1ll) ans = (ans * a) % mod;
		b >>= 1ll, a = (a * a) % mod;
	}
	return ans;
}
LL gcdl(LL a, LL b) {return b == 0 ? a : gcdl(b, a % b);}
LL abssl(LL a) {return a > 0 ? a : -a;}
int gcd(int a, int b) {return b == 0 ? a : gcd(b, a % b);}
int abss(int a) {return a > 0 ? a : -a;}
//==========================Main body==========================
#define LD "%I64d"
#define D "%d"
#define pt printf
#define sn scanf
#define pty printf("YES\n")
#define ptn printf("NO\n")
//==========================Code here==========================
int main() {
	LL n;
	cin >> n;
	--n;
	cout << (1 + n) * n / 2;
	return 0;
}

Measured memory_bytes: 256
use proconio::input;
fn main() {
    input!{
        n: usize,
        a: [u64; n],
    };
    let m = 1000000007;
    let mut sa = vec![];
    let mut sum = 0;
    let mut ans = 0;
    for i in 0..a.len() {
        let idx = a.len()-1-i;
        // eprintln!("{}", a[idx]);
        sum = sum + a[idx];
        sum = sum % m;
        sa.push(sum);
    }
    sa.reverse(); // 6 5 3
    for i in 0..a.len()-1 {
        // eprintln!("{} + {} * {}", ans, a[i], sa[i+1]);
        ans = ans + a[i] * sa[i+1];
        ans = ans % m;
    }
    println!("{}", ans);
}

Measured memory_bytes: 7348
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main(){
 ll n;
 cin>>n;
 vector<ll>arr(n+1,0);
 for(ll i=1;i<=n;i++)
 {
 	for(ll j=1;j*i<=n;j++)
 	{
 		arr[i*j]++;
	 }
 }
 ll sum=0;
 for(ll i=1;i<=n;i++){
 	sum+=(i*arr[i]);
 	
 }
 cout<<sum<<"\n";
	
}

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

using namespace std;

int N, K,a,s,b;
void pre(){
    
    cin >> N >> K;

  vector<bool> nn(N, false);
  for (int i = 0; i < N; i++) {
 
    cin >> a;
    for (int j = 0; j < a; j++) {
    
      cin >> b;
      nn[b - 1] = true;
    }
  }

   s = 0;
  for (int i = 0; i < N; i++) {
    if (nn[i] == false) {
      s++;
    }
  }

  cout << s << '\n';

    
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(15);

pre();
  
  return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
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 long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	int n;
	cin >>n;
	set<pair<int,int>>ans;
	if(n%2==0){
		for(int i=1;i<=n;i++){
			for(int j=i+1;j<=n;j++){
				if(1+n==i+j){continue;}
				ans.insert(mp(i,j));
			}
		}
	}else{
		for(int i=1;i<=n;i++){
			for(int j=i+1;j<=n;j++){
				if(n==i+j){continue;}
				ans.insert(mp(i,j));
			}
		}
	}
	cout<<ans.size()<<endl;
	repi(itr,ans){
		cout<<(itr->F)<<" "<<(itr->S)<<endl;
	}


	
}
/*
1 2 3 4 

1 4
2 3

1 2 4 3

1~6
1:2 3 4 5 (6)= 20-6
2:1 3 4 (5) 6= 19-5
3:1 2 (4) 5 6= 18-4
4:1 2 (3) 5 6 =17-3
5:1 (2) 3 4 6=16-2
6:(1) 2 3 4 5=15-1

1 2 3 4 5

  3
1 5 2
  4

1 2 3 (4) 5 = 14
2 1 (3) 4 5 = 13
3 1 (2) 4 5=12
4 (1) 2 3 5 = 11
5  1 2 3 4=10
15*2=30 6

1 2 3

1 3
2 3

1~7
1 2 3 4 5 7 = 21
2 1 3 4 6 7 = 21
3 1 2 5 6 7 = 21
4 1 2 5 6 7 = 21
5 1 3 4 6 7 = 21 
6 2 3 4 5 7 = 21
7 1 2 3 4 5 6 = 21
*/

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

template <typename t>
void mi(t& a, const t& b) { a = min(a, b); }

template <typename t>
void ma(t& a, const t& b) { a = max(a, b); }

constexpr int g1 = 1000 * 1000 * 1000, si = 1024 * 1024, si_log = 10 + 10, mod = static_cast<int>(1e9) + 7;
constexpr long double eps = 1.0e-9;
int n, ar[si], br[si];
char car[si];
vector<int> gr[si];
int64_t su;

void tr(int pos = 1)
{
  if (car[0])
    return;

  if (7 == pos)
  {
    if (7 == su)
    {
      car[0] = char(ar[0] + '0');
    }
    return;
  }

  car[pos] = '+';
  auto ind = (pos+1) >> 1;
  auto v = ar[ind];
  assert(0 <= v && v <= 9);
  su += v;
  tr(pos + 2);

  if (car[0])
    return;
  su -= v;



  car[pos] = '-';
  su -= v;
  tr(pos + 2);

  if (car[0])
    return;
  su += v;
}

int64_t sol()
{
  auto r = 0 * numeric_limits<int64_t>::max();

  {
    auto w = n;
    for (int i = 3; 0 <= i; --i)
    {
      auto di = w % 10;
      ar[i] = di;
      car[2*i] = char(di + '0');
      w /= 10;
    }
  }

  car[0] = 0;
  su = ar[0];
  tr();
  car[7] = '=';
  car[8] = '7';

  puts(car);
  return r;
}

int main()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  while (1 == scanf("%d", &n))
  {
    //auto s = 
    sol();
    //puts(s ? "Yes" : "No");
    //cout << s << '\n';
#ifndef _DEBUG
    break;
#else
    for (int i = 0; i <= n + 2; i++)
    {
      gr[i].clear();
    }
    memset(car, 0, sizeof car);
    memset(ar, 0, sizeof ar);
    memset(br, 0, sizeof br);
#endif
  }
  return 0;
}


Measured memory_bytes: 28928
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define pb            push_back
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())

// code
// ------------------------------------------------
int main() {
  int a,b;
  cin >> a >> b;
  
  int ans = 0;
  
  ans = a - ( b >= a ? 0 : 1 );
  
  cout << ans;
  
  return 0;
}

// funcの実体
// ------------------------------------------------
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int n,h,w;
    cin>>n>>h>>w;
    int ans=0;
    int a,b;
    for (int i=0;i<n;i++){
        cin>>a>>b;
        ans+=(a>=h&&b>=w );
    }
    cout<<ans;
};


Measured memory_bytes: 3560
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int[] n = new int[s.length() - 2];
    int min = 1000;
    for (int i = 0; i < n.length; i++) {
      n[i] = Integer.parseInt(s.substring(i, i + 3));
    }
    for (int i = 0; i < n.length; i++) {
      if (Math.abs(n[i] - 753) < min) {
        min = Math.abs(n[i] - 753);
      }
    }
    System.out.println(min);
  }

}


Measured memory_bytes: 22732
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<unordered_map>
#include<array>
#include<map>
#include<bitset>
#include<iomanip>
#include<list>
#include <numeric>
using namespace std;
typedef unsigned long long int ulint;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
#define RE return 0
//ios::sync_with_stdio(false);
//std::cin.tie(0);
//<< setprecision(20)
const int mod=(int)1000000007;
const llint big=(llint)(2.19e15)+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double ena=2.71828182845904523536;
const long double eps=1e-7;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
template <class T> void soun(T& ar)
{sort(ar.begin(),ar.end());ar.erase(unique(ar.begin(),ar.end()),ar.end());}
llint gcd(llint a,llint b){if(a%b==0){return b;}else{return gcd(b,a%b);}}
llint lcm(llint a,llint b){return a/gcd(a,b) *b;}
template<class T,class U> auto LB(T& ve,U in){return lower_bound(ve.begin(),ve.end(),in);}
template<class T,class U> auto UB(T& ve,U in){return upper_bound(ve.begin(),ve.end(),in);}
template<class T,class U> auto LBI(T& ve,U in){return LB(ve,in)-ve.begin();}
template<class T,class U> auto UBI(T& ve,U in){return UB(ve,in)-ve.begin();}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
using pli=pair<llint,int>;
using daic=priority_queue<pli,vector<pli>,greater<pli>>;
int main(void){
	int n;cin>>n;
	while(n--){
		char c;cin>>c;
		if(c=='Y'){cout<<"Four\n";RE;}
	}
	cout<<"Three\n";
	RE;
}

Measured memory_bytes: 256
N,M = map(int,input().split())
A = sorted([list(map(int,input().split())) for _ in range(N)],key=lambda x:x[0])
ans = 0
tot = 0
for i in range(N):
    a,b = A[i]
    if tot+b<M:
        tot += b
        ans += a*b
    else:
        n = M-tot
        ans += a*n
        break
print(ans)

Measured memory_bytes: 94224
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner scan = new Scanner(System.in);
		String a = scan.next();
		if(Character.isUpperCase(a.charAt(0))) {
			System.out.println("A");
		} else {
			System.out.println("a");
		}
	}

}

Measured memory_bytes: 26984
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String a = sc.next();
    String b = a;
    String n;
    int len;
    int lenans = 4;
    int i = 0;
    n = String.valueOf(i);
    b = a.replace(n,"");
    len = b.length();
    if(len < lenans){
        lenans = len;
      }
    b = a;
    System.out.println(lenans);
  }
}


Measured memory_bytes: 21972
package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

type Card struct {
	Mark   string
	Number string
}

var sc = bufio.NewScanner(os.Stdin)

func splitInputLine() []string {
	sc.Scan()
	line := sc.Text()
	return strings.Split(line, " ")
}

func bubbleSort(target []Card) []Card {
	for i := 0; i < len(target); i++ {
		for j := len(target) - 1; j > i; j-- {
			if target[j].Number < target[j-1].Number {
				tmp := target[j]
				target[j] = target[j-1]
				target[j-1] = tmp
			}
		}
	}
	return target
}

func selectionSort(target []Card) []Card {
	for i := 0; i < len(target); i++ {
		minj := i
		for j := i; j < len(target); j++ {
			if target[j].Number < target[minj].Number {
				minj = j
			}
		}
		tmp := target[i]
		target[i] = target[minj]
		target[minj] = tmp
	}
	return target
}

func isStable(in []Card, out []Card) bool {
	for i := 0; i < len(in); i++ {
		for j := i + 1; j < len(in); j++ {
			for a := 0; a < len(out); a++ {
				for b := a + 1; b < len(out); b++ {
					if in[i].Number == in[j].Number && in[i] == out[b] && in[j] == out[a] {
						return false
					}
				}
			}
		}
	}
	return true
}
func printCardsSlice(cards []Card) {
	for i := 0; i < len(cards); i++ {
		fmt.Print(cards[i].Mark + cards[i].Number)
		if i != len(cards)-1 {
			fmt.Print(" ")
		}
	}
	fmt.Print("\n")
}
func main() {
	sc.Scan()
	cardsString := splitInputLine()
	var cards1, cards2 []Card
	for i := 0; i < len(cardsString); i++ {
		str := cardsString[i]
		card := Card{str[:1], str[1:2]}
		cards1 = append(cards1, card)
		cards2 = append(cards2, card)
	}
	sortedBubble := bubbleSort(cards1)
	sortedSelection := selectionSort(cards2)
	printCardsSlice(sortedBubble)
	fmt.Println("Stable")
	stable := isStable(sortedBubble, sortedSelection)
	printCardsSlice(sortedSelection)
	if stable {
		fmt.Println("Stable")
	} else {
		fmt.Println("Not stable")
	}
}



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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
   int a,b;
   cin>>a>>b;
   int ans=0;
    for (int i = 0; i < 2; ++i) {
        if(a>=b){
            ans+=a;a--;
        }
        else {
            ans+=b;b--;
        }
    }
    cout <<ans <<endl;
}


Measured memory_bytes: 3560
S=gets.chop
T=gets.chop

idx=Hash.new{|h,k|h[k]=Array.new}
S.chars.each.with_index do |s, i|
  idx[s] << i
end

if T.chars.any?{|t|idx[t].empty?}
  p -1
  exit
end

n = 0
i = -1
T.chars do |t|
  i = idx[t].bsearch{|x|i<x}
  next if i
  n += 1
  i = idx[t][0]
end
p n*S.size+i+1


Measured memory_bytes: 17148
import java.util.Scanner;

public class Main {

	private static final long MOD = 1_000_000_007L;

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			System.out.println(((modPow(10, n) - modPow(9, n) * 2 % MOD + modPow(8, n)) % MOD + MOD) % MOD);
		}
	}

	private static long modPow(long n, long m) {
		long result = 1L;
		while (m > 0) {
			if (1 == (m & 1)) {
				result = result * n % MOD;
			}
			n = n * n % MOD;
			m >>= 1;
		}
		return result;
	}
}


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

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

    int m[n];
    int min = 1000;

    int sum = 0;

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

        min = std::min(min, m[i]);
        sum += m[i];
    }

    cout << n + ((x - sum) / min) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
    int W,H,x,y,r;
    
    scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
    
    if (x -r < 0 || W < x + r){
        printf("No\n");
    }else if (0 <= y+r && H < y+r){
        printf("No\n");
    }else if (y+r < 0 && y+r <= H){
        printf("No\n");
    }
    else{
        printf("Yes\n");
    }
    
    return 0;
}


Measured memory_bytes: 2100
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 char") 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 a: i32 = read();
    let b: i32 = read();

    let x: i32 = a + b;
    let y: i32 = a - b;
    let z: i32 = a * b;

    let v: Vec<i32> = vec![x, y, z];

    let ans: i32 = v.into_iter().max().unwrap();
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <array>
#include <algorithm>
#include <limits>
#include <cmath>
#include <functional>

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
#define rep(i, a, b) for(int i = (a); i < (b); ++i )
#define rrep(i, a, b) for(int i = (a); i > (b); --i )
#define REP(i, a, b) for(int i = (a); i <= (b); ++i )
#define RREP(i, a, b) for(int i = (a); i >= (b); --i )
#define ullrep(i, a, b) for(ull i = (a); i < (b); ++i )
#define ullrrep(i, a, b) for(ull i = (a); i > (b); --i )
#define ullREP(i, a, b) for(ull i = (a); i <= (b); ++i )
#define ullRREP(i, a, b) for(ull i = (a); i >= (b); --i )

ull V[100001];
int A, B, C, X, Y;
int main() {
    cin >> A >> B >> C >> X >> Y;
    int maxv = std::max(X, Y);
    int minv = std::min(X, Y);
    REP(i, 0, maxv) {
        ull sum = 0;
        if (X > i) sum += (X - i) * A;
        if (Y > i) sum += (Y - i) * B;
        sum += i * 2 * C;
        V[i] = sum;
    }
    cout << *std::min_element(V, V + maxv + 1) << endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<cmath>
#include <iomanip>
using namespace std;
int main(){
    double a,b,c,d,x;
    cin>>a>>b>>c>>d;
    x = sqrt((a-c)*(a-c)+(b-d)*(b-d));
    cout<<fixed<<setprecision(100)<<x<<endl;
    return 0;
}


Measured memory_bytes: 3280
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {


		Scanner stdin = new Scanner(System.in);
		BufferedReader input = new BufferedReader(new InputStreamReader(System.in));


		int a = 2;
		int aN = 0;
		int b = 0;

		while(stdin.hasNext()) {
			int n = stdin.nextInt();
			
			for(int i = 0; i < n - 1; i++) {
				
				b += i + 2;

			}

			aN = a + b;
			System.out.println(aN);
			b = 0;

		}

	}

}

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

using namespace std;

int N, pw, vw[100000], pf[100000], vf[100000], th[100000];

double f(double v)
{
  double ret = v * pw;
  for(int i = 0; i < N; i++) {
    ret += max(0.0, double(th[i] - vw[i] * v) / vf[i]) * pf[i];
  }
  return (ret);
}

int main()
{
  while(scanf("%d", &N), N) {
    scanf("%d", &pw);
    for(int i = 0; i < N; i++) {
      scanf("%d %d %d %d", vw + i, pf + i, vf + i, th + i);
    }
    double low = 0, high = 1e9;
    for(int i = 0; i < 300; i++) {
      double left = (low * 2 + high) / 3;
      double right = (low + high * 2) / 3;
      if(f(left) < f(right)) high = right;
      else low = left;
    }
    printf("%.10lf\n", f(low));
  }
}

Measured memory_bytes: 4664
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
int main()
{
  int n;
  cin >> n;
  vector<int> P(n), Q(n);
  for (int i = 0; i < n; i++)
    cin >> P[i];
  for (int i = 0; i < n; i++)
    cin >> Q[i];
  vector<int> A(n);
  for (int i = 0; i < n; i++)
    A[i] = i + 1;
  map<vector<int>, int> mp;
  do
  {
    mp[A] = mp.size();
  } while (next_permutation(A.begin(), A.end())); // 順列生成
  int ans = abs(mp[P] - mp[Q]);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 5248
#include<bits/stdc++.h>
using namespace std;
int main() {
	int N, ans = 0;
	cin >> N;
	for (int i = 1; i <= N; i++)
	{
		if (i <= 9 || (i >= 100 && i <= 999) || (i >= 10000 && i <= 99999)) ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
using System;
using System.Linq;

namespace CompetitiveProg
{
    class Program
    {
        static void Main(string[] args)
		{
			var ab = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

			if (ab.All(x => x <= 9 && x >= 1))
			{
				Console.WriteLine(ab[0] * ab[1]);
			}
			else
			{
				Console.WriteLine(-1);
			}
		}
    }
}


Measured memory_bytes: 13396
n=int(input())
a=list(map(int,input().split()))

rui=[]
rui.append(a[0])
for x in range(1,n):
  b=rui[-1]+a[x]
  rui.append(b)

ans=[]
for y in range(n-1):
  ans.append(abs((rui[n-1]-rui[y])-rui[y]))
  
print(min(ans))

Measured memory_bytes: 36160
import java.io.BufferedReader;
import java.io.InputStreamReader;

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

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = br.readLine();
        
        String[] strAry = line.split(" ");
        
        int x = Integer.parseInt(strAry[0]);
        int y = Integer.parseInt(strAry[1]);
        
        System.out.println(x*y + " " + 2*(x+y));
    }
}

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define in(v) if (scanf("%d", &v)<1);

int main() {
  int N; in(N);

  int odd = 0;
  rep(i, N) {
    int a; in(a);
    if (a % 2 == 1)
      ++odd;
  }
  if (odd % 2 == 0)
    printf("YES\n");
  else
    printf("NO\n");

  return 0;
}


Measured memory_bytes: 256
// #include {{{
#include <iostream>
#include <cassert>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <ctime>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <string>
#include <bitset>
#include <vector>
#include <complex>
#include <algorithm>
using namespace std;
// }}}
// #define {{{
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
// }}}

const int N = 1e5 + 10 , P = 1e9 + 7;
int n , x[N];

int main(){
  scanf("%d",&n);
  rep(i,0,n) scanf("%d",x+i);
  ll ans=1,frog=0;
  rep(i,0,n) {
    frog++;
    if(x[i]<frog*2-1) {
      (ans*=frog)%=P;
      frog--;
    }
  }
  rep(i,1,frog+1) (ans*=i)%=P;
  printf("%lld\n",ans);
  return 0;
}


Measured memory_bytes: 640
n = int(input())
a = [int(input()) for _ in range(n)]
a.sort(reverse=True)

if n % 2 == 0:
    a_l = a[: n//2]
    a_s = a[n//2:]
    print((2 * sum(a_l) - min(a_l)) - (2 * sum(a_s) - max(a_s)))

else:
    x = 2 * sum(a[:(n-1)//2-1]) + sum(a[(n-1)//2-1:(n-1)//2+1]) - 2 * sum(a[(n-1)//2+1:])
    y = 2 * sum(a[:(n-1)//2]) - sum(a[(n-1)//2:(n-1)//2+2]) - 2 * sum(a[(n-1)//2+2:])
    print(max(x, y))

Measured memory_bytes: 7756
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>

#define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++)
#define rep(i,n) reps(i,0,n)
using namespace std;
using ll = long long;

int main(){
    int x,y;
    cin >> x >> y;
    cout << x + y/2 << endl;


    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
//#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rev(i,b,a) for (ll i = b - 1; i >= a; i--)
#define all(v) v.begin(), v.end()
#define maxe(v) *max_element(v.begin(), v.end())
#define mine(v) *min_element(v.begin(), v.end())
#define pb push_back
#define pf push_front
#define rem 1000000007
#define cont continue
//#define minn 999999999
//#define maxx 0
ll gcd(ll a, ll b);

ll gcd(ll a, ll b)
{
    if (a == 0)
        return b;
    return gcd(b%a, a);
}
ll modulo(ll a, ll b)
{
    ll r = a % b;
    return r < 0 ? r + b : r;
}
//ncr
ull ncr(ull n, ull r)
{
    if(r > n - r) r = n - r; // because C(n, r) == C(n, n - r)
    ull ans = 1;
    ull i;

    for(i = 1; i <= r; i++) {
        ans *= n - r + i;
        ans /= i;
    }

    return ans;
}
///////////////////////////////////////////////////////
class abc
{
    public:
    ll x;
    ll y;
};
bool fun1(abc xx,abc yy)
{
    return (abs(xx.x) + abs(xx.y) ) < ( abs(yy.x) + abs(yy.y) ) ;
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    /*ll tc;
    cin>>tc;
    while(tc--)
    {}*/
    ll k,n;
    cin>>k>>n;
    ll a[n];
    rep(i,0,n)
    {
        cin>>a[i];
        //if( a[i]==0 )
        //a[i]=k;
    }
    ll ans=a[n-1]-a[0];;
    rep(i,1,n)
    {
        ll x=a[i-1]-a[i];
        //if( x>=0 )
        x+=k;
        ans=min(ans,x);
    }
    cout<<ans<<endl;
    //ans=min(a[)
}


Measured memory_bytes: 1792
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
using namespace std; 
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
const int INF = 1<<29;
typedef long long ll;
inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }
template<class T> void chmax(T & a, const T & b) { a = max(a, b); }
template<class T> void chmin(T & a, const T & b) { a = min(a, b); }
/////////////////////////////////////////////////////////////////////
int main()
{int n;
	set <string> s;
	cin>>n;
	while(n>0)
	{n--;
		string x;
		cin>>x;
		s.insert(x);
	}
	cout<<s.size();
    return 0;
}

Measured memory_bytes: 19096
#include <stdio.h>
#define MAX_INPUT 100000
#define MAX_NUM 1000000001

int n, input[MAX_INPUT];
int dp[MAX_INPUT];

void bsearch(int n, int st, int en);

int main(void)
{
    int i, j;

    scanf("%d",&n);

    for (i = 0; i < n; i++) {
        scanf("%d",&input[i]);
    }

    for (i = 0; i < MAX_INPUT; i++) {
        dp[i] = MAX_NUM;
    }

    for (i = 0; i < n; i++) {
        bsearch(input[i], 0, i);
    }

    for (i = 0; i < n; i++) {
        if (dp[i] == MAX_NUM) {
            break;
        }
    }

    printf("%d\n",i);
    return 0;
}

void bsearch(int n, int st, int en) 
{
    if ((st+en)/2 == st || (st+en)/2 == en) {
        if (n == dp[st]) {
            return ;
        } else if (n < dp[st]) {
            dp[st] = n;
        } else {
            dp[en] = n;
        }
    } else if (n < dp[(st+en)/2]) {
        bsearch(n, st, (st+en)/2);
    } else {
        bsearch(n, (st+en)/2, en);
    }
}

Measured memory_bytes: 1380
// https://atcoder.jp/contests/

#include <bits/stdc++.h>
#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for (int(i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for (int(i) = (m); (i) < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;

int main()
{
  string S, atcg = "ATCG";
  cin >> S;

  ll m = 0, t = 0;

  for (auto &c : S)
  {
    if (atcg.find(c) != string::npos)
    {
      t++;
    }
    else
    {
      m = max(m, t);
      t = 0;
    }
  }

  cout << max(m, t) << '\n';

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dump(...)
#endif
#define endl "\n"
#define ll long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define INF (1 << 30 - 1)
#define LLINF (1LL << 60)
#define vi vector<int>
#define vvi vector<vector<int>>
#define pi pair<int, int>
#define ALL(a) (a).begin(), (a).end()
#define BIT(n) (1LL << (n))
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()) //sortしてからつかうこと
constexpr ll MOD = 1e9 + 7;
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;
ll ans = 0;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec)
        is >> x;
    return is;
}

signed main() {
    cin >> S;
    cout << S.substr(0, 3) << endl;
}

Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>

#define FOR_LT(i, beg, end) for (int i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (int i = beg; i <= end; i++)
#define FOR_DW(i, beg, end) for (int i = beg; end <= i; i--)

using namespace std;

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

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

	cout << max(0, c - (a - b)) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int N, A, B;
    int soma, a, b, aux=12;

    scanf("%d", &N);

    for(int i = 1; i <= N/2; i++){
        a = 0;
        b = 0; 

        B = i;
        A = N-B;

        while(A){
            a = a + (A%10);
            A = A/10;
        }        

        while(B){
            b = b + (B%10);
            B = B/10;
        }
        
        if(i == 1){
            soma = a+b;
        } else if ((a+b) <= soma){
            soma = a+b;
            aux = i;
        }
    }
    printf("%d\n", soma);

    return 0;
}

Measured memory_bytes: 1724
import java.util.Scanner;
class Main {
 public static void main(String[] args) {
   Scanner read = new Scanner(System.in);
   String word = read.nextLine();
   if((word.charAt(2)==word.charAt(3)) && (word.charAt(4)==word.charAt(5))) {
     System.out.println("Yes");
   } else {
    System.out.println("No"); 
   }
 }
}

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

#define LL long long
const int N = 2e5 + 5;
LL n, p, mod, mul = 1, pre[N], ans, sum;
string s;

int main() {
    ios::sync_with_stdio(0), cin.tie(0);
    
    cin >> n >> p >> s;
    if(p == 2 || p == 5) {
        for(int i = 0; i < n; i++) if((s[i] - '0') % p == 0) ans += i+1;
        return cout << ans, 0;
    }   

    reverse(s.begin(), s.end());

    mul = 1, pre[0]++;
    for(int i = 0; i < n; i++) {
        sum += (s[i] - '0') * mul;
        sum %= p;
        pre[sum]++;
        mul = mul * 10 % p;
    }

    for(int i = 0; i < p; i++) ans += (pre[i] * (pre[i] - 1)) / 2;
    cout << ans;
}

Measured memory_bytes: 3764
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define mod (int)(1e9+7)
#define INF (ll)(1e18)
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }


void solve();

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

void solve() {
    int n, k, s;
    cin >> n >> k >> s;
    vector<int> a(n);
    if (s != 1e9) {
        rep(i, k) a[i] = s;
        rep3(i, k, n) a[i] = s + 1;
        rep(i, n) cout << a[i] << " "; cout << endl;
    } else {
        rep(i, k) a[i] = s;
        rep3(i, k, n) a[i] = 1;
        rep(i, n) cout << a[i] << " "; cout << endl;
    }
}


Measured memory_bytes: 1664
function Main(input) {
	input = input.trim().split(" ").map((a)=>Number(a));
  var a = input[0];
  var b = input[1];
  var c = input[2];
  if(a == b && a != c){
     console.log(c);
  }else if(a != b && a == c){
    console.log(b);
  }else{
    console.log(a);
  }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
#include<stdio.h>
#include<algorithm>
using namespace std;
int main()
{
	
	
		int a[10],i;
		for(i=0;i<10;i++){
			scanf("%d",&a[i]);
		}
		sort(a,a+10);
		for(i=9;i>6;i--){
			printf("%d\n",a[i]);
		}
		return 0;
}

Measured memory_bytes: 1044
#include <cstdint>
#include <iostream>

namespace null_null {

using i32 = std::int_fast32_t;
using i64 = std::int_fast64_t;
using u32 = std::uint_fast32_t;
using u64 = std::uint_fast64_t;
using usize = std::size_t;

} // namespace null_null

namespace null_null {

u32 calc(u32 num) {
  u32 cnt = 0;
  while (num) {
    num /= 10;
    cnt++;
  }
  return cnt;
}

void main_() {
  u32 N;
  std::cin >> N;

  u32 ans = 0;
  for (u32 i = 1; i <= N; i++) {
    if (calc(i) % 2) {
      ans++;
    }
  }

  std::cout << ans << std::endl;
}

} // namespace null_null

int main() {
  null_null::main_();
  return 0;
}

Measured memory_bytes: 256