akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define in(x) cin >> x
#define out(x) cout << x
#define outn(x) cout << x << '\n'
#define outs(x) cout << x << ' '
#define rep(i,s,e) for(long i=s;i<e;i++)
#define repeq(i,s,e) for(long i=s;i<=e;i++)


int main() {
	ll n, ans=0;
	bool flg = false;
	in(n);
	vll s(n);
	rep(i, 0, n) {
		in(s[i]);		
		ans += s[i];
	}
	sort(s.begin(), s.end());
	if (ans % 10 == 0) {
		flg = true;
		rep(i, 0, n) {
			if (s[i]%10!=0) {
				ans -= s[i];
				flg = false;
				break;
			}
		}
	}
	if (flg) {
		outn(0);
	}
	else {
		outn(ans);
	}

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;

#define getmid(l,r) ((l) + ((r) - (l)) / 2)
#define MEM(a,b) memset(a,b,sizeof(a))
#define MP(a,b) make_pair(a,b)
#define PB push_back

typedef long long ll;
typedef pair<int,int> pii;
const double eps = 1e-8;
const int INF = (1 << 30) - 1;

int main(){
	int N,M,a,b;
	scanf("%d%d",&N,&M);
	for(int i = 1; i <= N; ++i){
		for(int j = 1; j <= M; ++j){
			char s[10];
			scanf("%s",s);
			if(strcmp(s,"snuke") == 0){
				a = i;
				b = j;
			}
		}
	}
	printf("%c%d\n",'A' + b - 1,a);
	return 0;
}

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

ll MOD = 998244353;

// g = eGCD(a, b, s, t)  --->  sa + tb = g
constexpr ll eGCD(ll a, ll b, ll& s, ll& t) {
  if (a == 0) {
    s = 0;
    t = 1;
    return b;
  }
  ll u = 0;
  ll g = eGCD(b % a, a, t, u);
  s = u - (b / a) * t;
  return g;
}

constexpr ll gcd(ll a, ll b) {
  ll dummy1 = 0;
  ll dummy2 = 0;
  return eGCD(a, b, dummy1, dummy2);
}

struct Fp {
  ll val;

  Fp(ll t = 0) :
    val(t < 0 ? MOD + t % MOD : t >= MOD ? t % MOD : t) {}

  Fp& operator +=(const Fp& t) {
    val += t.val;
    if (val >= MOD) val -= MOD;
    return *this;
  }

  Fp& operator -=(const Fp& t) {
    val -= t.val;
    if (val < 0) val += MOD;
    return *this;
  }

  Fp& operator *=(const Fp& t) {
    val = (val * t.val) % MOD;
    return *this;
  }

  Fp inv() const {
    if (val == 0) {
      cerr << "inv() is called for zero." << endl;
      exit(1);
    }
    ll u = 0;
    ll v = 0;
    eGCD(val, MOD, u, v);
    return Fp(u);
  }

  Fp& operator /=(const Fp& t) {
    return (*this) *= t.inv();
  }

  Fp operator +(const Fp& t) const { return Fp(val) += t; }
  Fp operator -(const Fp& t) const { return Fp(val) -= t; }
  Fp operator *(const Fp& t) const { return Fp(val) *= t; }
  Fp operator /(const Fp& t) const { return Fp(val) /= t; }
  Fp operator -() const { return Fp(-val); }

  bool operator ==(const Fp& t) const { return val == t.val; }
  bool operator !=(const Fp& t) const { return val != t.val; }
  
  operator ll() const { return val; }

};

class Comb {
  int nMax;
  vector<Fp> vFact;
  vector<Fp> vInvFact;
public:
  Comb(int nm) : nMax(nm), vFact(nm+1), vInvFact(nm+1) {
    vFact.at(0) = 1;
    for (int i = 1; i <= nMax; i++) vFact.at(i) = i * vFact.at(i-1);
    vInvFact.at(nMax) = vFact.at(nMax).inv();
    for (int i = nMax; i >= 1; i--) vInvFact.at(i-1) = i * vInvFact.at(i);
  }
  Fp fact(int n) { return vFact.at(n); }
  Fp comb(int n, int r) {
    return vFact.at(n) * vInvFact.at(r) * vInvFact.at(n-r);
  }
  // The number of permutation extracting r from n.
  Fp perm(int n, int r) {
    return vFact.at(n) * vInvFact.at(n-r);
  }
};

/* 
   Power function    power(a, b) == a^b
   Speed is O(log b).
   The same source code can be used for integers by replacing
   Fp with int etc.  Unfortunately, replacing Fp with auto does not
   make the function generic for int and Fp.
 */
Fp power(Fp a, int b) {
  Fp twoPow = a;
  Fp rv = 1;
  while (b > 0) {
    if (b & 1) rv *= twoPow;
    twoPow *= twoPow;
    b >>= 1;
  }
  return rv;
}


int main(int argc, char *argv[]) {
  // C-style stdio functions should not be used.
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  ll N; cin >> N;
  Comb cmb(N);
  Fp cnt = Fp(0);
  vector<Fp> p2(N+1);
  p2.at(0) = 1;
  for (int i = 1; i <= N/2+1; i++) p2.at(i) = Fp(2) * p2.at(i-1);
  for (ll n = N/2 + 1; n <= N; n++) {
    // cnt += cmb.comb(N, n) * power(2, N-n);
    cnt += cmb.comb(N, n) * p2.at(N-n);
  }
  Fp ans = power(3, N) - Fp(2) * cnt;
  cout << ll(ans) << endl;

  return 0;
}



Measured memory_bytes: 234624
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define int long long
#define MAX INT_MAX
#define MIN INT_MIN
#define ss second
#define ff first
#define double long double
const int mod = 1e9+7;

string win(int k, vector<int> &v){
	int n = v.size();
	vector<bool> dp(k+1);
	dp[0] = 0;
	for(int i = 0; i <= k; i++){
		for(int j = 0; j < n; j++){
			if(i >= v[j] && dp[i-v[j]] == 0)
				dp[i] = 1;
		}
	}
	return (dp[k] == 1)?"First":"Second";
}

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n, k;
	cin >> n >> k;
	vector<int> v(n);
	for(int i = 0; i < n; ++i)
		cin >> v[i];
	cout << win(k, v) << endl;	
	return 0;
}


Measured memory_bytes: 256
s = raw_input()

operate = []
for letter in set(s):
    index = [i for i, x in enumerate(s) if x == letter]
    temp = [-1]
    index.append(len(s))
    temp.extend(index)
    index[:] = temp[:]
    diff = [(index[i + 1] - index[i] - 1) for i in range(len(index) - 1)]
    operate.append(max(diff))
result = min(operate)
print(result)


Measured memory_bytes: 2568
#include <algorithm>
#include <chrono>
#include <cmath>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#include <atcoder/dsu>

using namespace std;
using namespace atcoder;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

const int INF = 2000000009;
const ll INFL = 1e18 + 5LL;
const ld EPS = 1e-11;

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

    int n, m;
    cin >> n >> m;

    dsu d(n);
    int ans = n - 1;
    for (int i = 0; i < m; ++i) {
        int u, v;
        cin >> u >> v;
        --u;
        --v;
        if (!d.same(u, v)) {
            --ans;
            d.merge(u, v);
        }
    }

    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 3724
/**Bismillahir Rahmanir Raheem
    Author:Refatul Fahad**/

#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define ull unsigned long long
#define ff first
#define ss second
#define pb push_back
#define vi vector<int>
#define pii pair<int,int>
#define pil pair<int,ll>
#define IOS  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl '\n'
#define sz(s)  (int)s.size()
#define all(s)  s.begin(),s.end()
const int N = 1e5 + 5;
const ll M = (ll)1e9 + 7;
const double pi=2*acos(0.0);
const double esp=1e-9;
int Set(int N,int pos) {
    return N=N | (1<<pos);
}
int reset(int N,int pos) {
    return N= N & ~(1<<pos);
}
bool check(int N,int pos) {
    return (bool)(N & (1<<pos));
}

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

vi adj[N];
bool vis[N];
int edcnt[N],deg[N];

void dfs(int node) {
    vis[node]=true;
    for(int x:adj[node]) {
        edcnt[x]=max(edcnt[x],edcnt[node]+1);
        --deg[x];
        if(!deg[x]) {
            dfs(x);
        }
    }
}
int main() {

    //IOS;
    /// freopen("input.txt","r",stdin);
    /// freopen("output.txt","w",stdout);

    int test=1;
    //cin>>test;
    for(int cs=1; cs<=test; ++cs) {
        int n,m,ans=0;
        cin>>n>>m;
        for(int i=1; i<=m; ++i) {
            int x,y;
            cin>>x>>y;
            adj[x].pb(y);
            ++deg[y];
        }
        for(int i=1; i<=n; ++i) {
            if(!vis[i]&&!deg[i]) {
                dfs(i);
            }
        }
        for(int i=1; i<=n; ++i) {
            ans=max(ans,edcnt[i]);
        }
        cout<<ans<<endl;
    }
    return 0;
}



Measured memory_bytes: 14436
N = int(input())-1
C = "abcdefghijklmnopqrstuvwxyz"
k = len(C)
c = 1
while N >= k**c:
    N -= k**c
    c += 1
s = ""
while c > 0:
    s = s+C[N//(k**(c-1))]
    N = N % (k**(c-1))
    c -= 1
print(s)


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

#define ll long long
#define INF 99999999
#define rep(i,n) for(int i=0,temp=(int)(n);i<temp;++i) 
#define repi(i,start,end) for(int i=start,temp=(int)(end);i<end;++i)
#define rfor(v,x) for(const auto& x : v) //xは値を表す
#define all(x) (x).begin(),(x).end()
#define SORT(v, n) sort(v, v+n)
#define vsort(v) sort(v.begin(), v.end())
#define vfsort(v,lambda) sort(v.begin(),v.end(),lambda)
#define vint vector<int>
#define vvint vector<vector<int>>
#define vin(v) rep(i,v.size()) {cin >> v[i];}
//最終奥義
//#define int long long
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int ctoi(char c) {return c-'0';}
//(lambda (x y) (< x y)) => [](int x, int y) -> int { return x<y; }

signed main(void){
  int m,d;cin >> m >> d;
  int ans=0;
  repi(i,1,m+1){
    repi(j,1,d+1){
      int d1=j%10,d10=j/10;
      if(d1*d10==i&&d1>1&&d10>1){
        ans++;
      }
    }
  }
  cout << ans << endl;

}


Measured memory_bytes: 256
n, m = map(int,input().split())
z = []
for i in range(n):
  z.append(-1)
for i in range(m):
  x1,y1=[int(i) for i in input().split()]
  if z[x1-1] != -1:
    if z[x1-1] != y1:
      print(-1)
      exit(0)
  if x1 == 1:
    if y1 == 0:
      if n != 1:
        print(-1)
        exit(0)
  z[x1-1] = y1
if n != 1:
  if z[0] == -1:
    z[0] = 1
else:
  if z[0] == -1:
    z[0] = 0
for i in range(1,n):
  if z[i] == -1:
    z[i] = 0
for s in z:
  print(s, end ="")

Measured memory_bytes: 3064
#include <stdio.h>
main(){
  int i,d;
  long long s;
  while(scanf("%d",&d) !=EOF){
    s=0;
    for(i=d;i<=600-d;i+=d) s+=(long long)i*i*d;
    printf("%lld\n",s);
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long int ll;
typedef unsigned long long int ull;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> o_set;

#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define     int                 ll
#define     xx                  first
#define     yy                  second    
#define     all(a)              a.begin(),a.end()
#define     present(DT, val)    (DT.find(val) != DT.end()) //for set and map
#define     cpresent(DT, val)   (find(all(DT),val) != DT.end()) //vectors
#define     input               "/home/pollution/Desktop/WorkSpace/C++/Files/input.txt"
#define     output              "/home/pollution/Desktop/WorkSpace/C++/Files/output1.txt"
#define     error               "/home/pollution/Desktop/WorkSpace/C++/Files/error.txt"
#define     IO()                ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define     INF                 2e18
#define     MOD                 1000000007
#define     clr(x)              memset(x, 0, sizeof(x))
#define     out(a)              for (auto i: a) cout<<i<<' '; cout<<'\n'
#define     setd(val,n)         cout<<fixed<<setprecision(n)<<val<<'\n'

void solve(){
    int s;
    cin >> s;
    if(s <= 2) {
        cout << "0\n";
    }else if(s < 6) {
        cout << "1\n";
    }
    else{
	    vector<int> dp(s+1, 0);
	    dp[0] = 1;
	    for(int i = 3; i < s+1; ++i){
	        for(int j = 3 ; j <= s ; j++){
	            if(i-j < 0){
	            	continue;
	            }
	            dp[i] += dp[i-j];
	            dp[i] %= MOD;
	        }
	    }
	    cout << dp[s] << '\n';
	}
}

signed main() { 
    IO();
    
    int t=1;
    // cin>>t;
    while(t--) solve();
    return 0; 
}

Measured memory_bytes: 3636
n = int(input())
lr = [tuple(map(int, input().split())) for _ in range(n)]
ans = max(r - l + 1 for l, r in lr)
lr.sort()
ml, mr = lr.pop()
lr.sort(key=lambda x: x[1])
l2, r2 = lr[0]
if n >= 3 and ml <= r2:
    ans = max(ans, min(mr, r2) - ml + 1 + max(ri - li + 1 for li, ri in lr[1:]))
for l, r in lr[1:]:
    if ml <= r:
        ans = max(ans, min(mr, r) - ml + 1 + r2 - l2 + 1)
    l2, r2 = max(l2, l), min(r2, r)
    if not l2 <= r2:
        break
else:
    ans = max(ans, mr - ml + 1 + r2 - l2 + 1)
print(ans)


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

int n;
int main()
{
	while(~scanf("%d" ,&n))
	{
		int res=n; //最大情况肯定为n次  全部每次取1元 
		for(int i=0;i<=n;i++)
		{
			int cc=0;
			int t=i;
			while(t) cc+=t%6,t/=6;  //计算6进制的系数和 
			t=n-i;
			while(t) cc+=t%9,t/=9;  //计算9进制的系数和 
			if(res>cc) res=cc; 
		
		}
		printf("%d\n",res);
	}

}


Measured memory_bytes: 256
#!/usr/bin/perl

use strict;
use warnings;

my $x = <STDIN>;

if ($x<100) {
    print "0\n";
    exit;
}
my $y = $x % 100;
my $cnt = ($x - $y) / 100;
if ($y<=5*$cnt) {
    print "1\n";
} else {
    print "0\n";
}

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

int main(){
  int n;
  cin>>n;
  int x[n],y[n];
  for(int i=0;i<n;i++) cin>>x[i]>>y[i];
  double sum=0;
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      sum+=sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]));
    }
  }
  

  cout << setprecision(15)<<sum*2/n<<endl;
  
}

Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))
sum_mod=[0]
for i in range(N):
  sum_mod+=[(sum_mod[i]+A[i])%(10**9+7)]
ans=0
for i in range(N):
  ans=(ans+sum_mod[i]*A[i])%(10**9+7)
print(ans)

Measured memory_bytes: 31364
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>
#include <cassert>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    if (k <= a) {
        cout << k << endl;
    }
    else if (k <= a + b) {
        cout << a << endl;
    }
    else {
        cout << a - (k - a - b) << endl;
    }
    return 0;
}


Measured memory_bytes: 3556
import java.io.*;
 
public class Main{
    public static void main(String[] args)throws IOException{
        BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
        while(true){
            String s=reader.readLine();
            if(s==null)System.exit(0);
            String[] t=s.split(" ");
            int a,b;
            a=Integer.parseInt(t[0]);
            b=Integer.parseInt(t[1]);
            int sum=a+b;
            int co=0;
            while(sum>0){
                co++;
                sum/=10;
            }
            System.out.println(co);
        }
     
    }
}


Measured memory_bytes: 24412
n=int(input())
p=tuple(map(int,input().split()))
q=tuple(map(int,input().split()))
temp=[0]*n
for i in range(0,n):
  temp[i]=i+1
from itertools import permutations
templ=list(permutations(temp,n))
for i in range(0,len(templ)):
  if templ[i]==p:
    a=i
  if templ[i]==q:
    b=i
print(abs(a-b))

Measured memory_bytes: 8052
#include "bits/stdc++.h"
using namespace std;

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < n; i++)
#define Rep(i, n) for(int i = 1; i < n; i++)

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vii = vector<pair<int, int>>;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); }
int round_int(int a, int b) { return (a + (b - 1)) / b; }

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };

// ──────────────────────────────────────────────────────────────────────────────

int main() {
	int n; cin >> n;
	string s, t; cin >> s >> t;
	for (int i = 0; i < n; ++i) {
		cout << s[i] << t[i];
	}
	cout << endl;
}

Measured memory_bytes: 256
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <fstream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <cstdint>
#include <chrono>

using namespace std;
#define     loop(n,i,a)     for(ll i=a;i<n;i++)
#define     loopR(n,i,a)    for(ll i=a-1;i>=n;i--)
#define     all(arr,n)      arr,arr+n
#define     allv(v)         (v).begin(),(v).end()
#define     rallv(v)        (v).rbegin(),(v).rend()
#define     m_p             make_pair
#define     ll              long long
#define     pii             pair<ll,ll>
#define     vi              vector<int>
#define     vll             vector<ll>
#define     vii             vector<pii>
#define     sz(x)           (int)x.size()
#define     pb              push_back
#define     endl            "\n"
#define     Endl            "\n"
#define     f               first
#define     s               second
#define     mem(dp,n)       memset(dp,n,sizeof dp)
template<typename T>void max_self(T &a,T b){a=max(a,b);}
template<typename T>void min_self(T &a,T b){a=min(a,b);}
int dx[] = { 1 , 0 ,-1 , 0 ,-1 ,-1 , 1 , 1 };
int dy[] = { 0 , 1 , 0 ,-1 ,-1 , 1 ,-1 , 1 };
int KnightI[] = { 2, 1, -1, -2, -2, -1, 1, 2 };
int KnightJ[] = { 1, 2, 2, 1, -1, -2, -2, -1 };
void fast(){
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
        vector<string> __attribute__ ((unused)) args,
        __attribute__ ((unused)) int idx,
        __attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
const ll mxN=3e5+10,oo=0x3f3f3f3f,MOD=998244353;
const long double PI = acos(-1),eps=1.0e-14;

void solve(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    int o=0,c=0;
    loop(n,i,0){
        if(s[i]=='(')
            o++;
        else{
            if(o)o--;
            else c++;
        }
    }
    while(c--)
        cout<<'(';
    cout<<s;
    while(o--)
        cout<<')';
}
int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    fast();
    solve();

}


Measured memory_bytes: 3640
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

using ll = long long;
using P = std::pair<ll, ll>;

constexpr ll INF = 1ll<<60;

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<class S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

ll X, Y;

int main() {
  std::cin >> X >> Y;

  rep( x, 1000 ) rep( y, 1000 ) {
    if( x+y > X )
      continue;

    if( x+y==X && 2*x+4*y == Y ) {
      std::cout << "Yes" << std::endl;

      return 0;
    }
  }

  std::cout << "No" << std::endl;

  return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#include <cstdio>
using namespace std;
int b[100005];
int main()
{
    int n,m,i,j,k=0,p,q;
    cin>>n>>k>>q;
    for(i=1;i<=q;i++)
    {
        cin>>m;
        b[m]++;
    }
    for(i=1;i<=n;i++)
    {
         if(b[i]==0)
         {
             j=k-q;
             if(j<=0)
             {
                 cout<<"No"<<endl;
             }
             else
             {
                 cout<<"Yes"<<endl;
             }

         }
         else
         {
             j=k-(q-b[i]);
             if(j<=0)
             {
                 cout<<"No"<<endl;
             }
             else
             {
                 cout<<"Yes"<<endl;
             }
         }
    }

}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <string>
#include <functional> 
#include <vector>
#include <numeric>
#include <stack>
#include <queue>
#include <utility>


using namespace std;

int main(){
    string a;
    cin >> a;

    if(a == "abc" ||
    a == "acb" ||
    a == "bac" ||
    a == "bca" ||
    a == "cab" ||
    a == "cba" ){
        cout << "Yes";
        return 0;
    }

    cout << "No";

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <random>
#include <cstdio>
#include <cstring>
#include <cmath>

// for i in f..<t {... : as Swift
#define forin(i, f, t) for(auto i = f; i < t; i++)

using namespace std;
using ll = long long;

const ll MaxSize = 1 << 18;
ll a[MaxSize], b[MaxSize];

void zeta(int n) {
    const auto m = 1UL << n;
    for (ll i = 1; i < m; i <<= 1) {
        for (ll j = 0; j < m; j++) {
            if (i & j) {
                auto top = max(a[j], a[i^j]);
                b[j] = max(max(top ^ a[j] ^ a[i^j], b[j]), b[i^j]);
                a[j] = max(a[j], a[i^j]);
            }
        }
    }
}

int main() {
    int n;
    cin >> n;
    const auto size = 1UL << n;
    for (auto i = 0; i < size; i++) {
        cin >> a[i];
    }
    
    zeta(n);
    
    ll Max = 0;
    for (auto i = 1; i < size; i++) {
        Max = max(Max, a[i] + b[i]);
        cout << Max << endl;
//        cerr << a[i] << ' ' << b[i] << endl;
    }
    
}



Measured memory_bytes: 7168
#include <iostream>
#include <algorithm>
#include <array>
using namespace std;

int main(){

  array <int, 3> a = {};
  int i = 0;
  int ans = 0;

  for (i = 0; i < 3; i++){
    cin >> a[i];
  }

  sort(a.begin(),a.end());
  ans = a[2] - a[0];

  cout << ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=100005,p=1000000007;
int read(){
	int f=1,g=0;
	char ch=getchar();
	for (;!isdigit(ch);ch=getchar()) if (ch=='-') f=-1;
	for (;isdigit(ch);ch=getchar()) g=g*10+ch-'0';
	return f*g;
}
int n,m,l,r,b[N],deg[N],siz[N],ans1[N],ans2[N];
pair<int,int> a[N];
vector<int> e[N];
void dfs(int x,int fa){
	if (e[x].size()>2){puts("-1");exit(0);}
	b[++m]=x;
	for (auto y : e[x])
	if (y!=fa) dfs(y,x);
}
void getans(int *ans){
	int cnt=0;
	for (int i=l;i<=r;i++){
		int t=b[i]+1;
		ans[cnt+t]=cnt+1;
		for (int j=1;j<=b[i];j++)
		ans[cnt+j]=cnt+1+j;
		cnt+=t;
	}
}
int main(){
	n=read();
	for (int i=1;i<n;i++){
		int u=read(),v=read();
		a[i]=make_pair(u,v);
		deg[u]++;deg[v]++;
	}
	for (int i=1;i<=n;i++) deg[i]--;
	for (int i=1;i<n;i++){
		int u=a[i].first,v=a[i].second;
		if (deg[u]&&deg[v]){e[u].push_back(v);e[v].push_back(u);}
		else if (deg[u]) siz[u]++;
		else siz[v]++;
	}
	for (int i=1;i<=n;i++)
	if (deg[i]&&(e[i].size()<=1)) {dfs(i,0);break;}
	for (int i=1;i<=m;i++) b[i]=siz[b[i]];
	l=1;r=m;
	if (b[l]){b[l]--;l--;}
	if (b[r]){b[r]--;r++;}
	getans(ans1);
	reverse(b+l,b+r+1);
	getans(ans2);
	int fl=0;
	for (int i=1;i<=n;i++)
	if (ans1[i]!=ans2[i]) {fl=(ans1[i]<ans2[i]);break;}
	for (int i=1;i<=n;i++) printf("%d ",(fl) ? ans1[i] : ans2[i]);
	printf("\n");
	return 0;
}

Measured memory_bytes: 13440
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define ALL(v) (v).begin(), (v).end()

int main()
{
  ll X; cin >> X;
  ll sum = 0;
  for (int i = 1;; ++i) {
    sum = sum + i;
    for (int j = 0; j <= i; ++j) {
      if (sum-j == X) {
        cout << i << endl;
        return 0;
      }
    }
  }
}

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

int main()
{
    int a, b, i , j;
    cin>>a>>b;
    while(a != 0 && b != 0)
    {
        for(i = 1; i <= a; i++)
        {
            for(j = 1; j <= b; j++)
            {
                if((i == 1) || (i == a) || (j == 1) || (j == b))
                    cout<<"#";
                else
                    cout<<".";
            }
            cout<<endl;
        }
        cout<<endl;
        cin>>a>>b;
    }
}



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

s = len(set(a))
m = s - k
if m <= 0:
    print(0)
    exit()
    
a.sort()
l = [0] * (a[-1] + 1)
for i in a:
    l[i] += 1

l.sort()
ans = 0
for x in l:
    if x == 0:
        pass
    else:
        ans += x
        m -=1
        if m == 0:
            print(ans)
            exit()

Measured memory_bytes: 89680
#include<bits/stdc++.h>
#define up(l,r,i) for(int i=l;i<=r;i++)
#define dn(l,r,i) for(int i=l;i>=r;i--)
using namespace std;

typedef long long LL;
const int INF =2147483647;
int qread(){
	int w=1,c,ret;
	while((c=getchar())> '9'||c< '0')
	w=(c=='-'?-1:1); ret=c-'0';
	while((c=getchar())>='0'&&c<='9')
	ret=ret*10+c-'0';
	return ret*w;
}
int n;
stack <char> s;
string ans,pre,scc;
int main(){
	n=qread(),s.push('#');
	up(1,n,i) switch(getchar()){
		case '(': s.push('('),ans+='('; break;
		case ')':
			ans+=')';
			if(s.top()!='#') s.pop(); else pre+='(';
	}
	while(s.top()!='#') scc+=')',s.pop();
	cout<<pre+ans+scc<<endl;
	return 0;
}


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

#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rep2(i, m, n) for(int i = (int)m; i < (int)n; i++)
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vii; //2次元配列
typedef vector<ll> vll;
typedef vector<string> vs;

/*FUNCs=================================================*/



/*MAIN==================================================*/
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);   //cin cout 高速化

    int w,h,n,x=0,y=0,a=0,x0=0,y0=0;  cin >> w >> h >> n;
    int xw = w, yh = h;
    rep(i,n){
        cin >> x >> y >> a;
        if(a == 1 && x0 < x) x0 = x;
        else if(a == 2 && xw > x) xw = x;
        else if(a == 3 && y0 < y) y0 = y;
        else if(a == 4 && yh > y) yh = y;
    }
    int xx = xw-x0, yy = yh-y0;
    int s = xx * yy;
	if(xx < 0 && yy < 0) s = 0;
    cout << (s > 0 ? s : 0) << '\n';
}

Measured memory_bytes: 256
using System;

public class Hello
{
    public static void Main()
    {
        while (true)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            var x = int.Parse(line[0]);
            var y = int.Parse(line[1]);
            var s = int.Parse(line[2]);
            if (x == 0 && y == 0 && s == 0) break;
            var ret = 0; var maxret = 0;
            for (int i = 1; i <= s - 1; i++)
                for (int j = 1; j <= s - 1; j++)
                {
                    if (i * (100 + x) / 100 + j * (100 + x) / 100 == s) ret = i * (100 + y) / 100 + j * (100 + y) / 100;
                    maxret = Math.Max(maxret, ret);
                }
            Console.WriteLine(maxret);
        }
    }
}



Measured memory_bytes: 8996
#include <stdio.h>
#include <stdlib.h>

int asort(const void *A,const void *B){return *(int*)A>*(int*)B?1:0;}
int main(void){
    int count[4]={},n;
    for (int i=0; i<6; i++){
        scanf("%d",&n);
        count[n-1]++;
    }
    qsort (count,4,sizeof(int),asort);
    if (count[0]==1 && count[1]==1 && count[2]==2 && count[3]==2){
        printf("YES\n");
    } else {
        printf("NO\n");
    }
    
    
    
    return 0;
}


Measured memory_bytes: 128
fun main() {
    val s = next()
    val t = next()
    printYesNo(s.length + 1 == t.length && s == t.dropLast(1))
}

val sc = java.util.Scanner(System.`in`)
fun next(): String = sc.next()
fun nextInt() = sc.nextInt()
fun next2Int() = Pair(nextInt(), nextInt())
fun next3Int() = Triple(nextInt(), nextInt(), nextInt())
fun nextIntArray(size: Int) = IntArray(size) { nextInt() }
fun nextLong() = sc.nextLong()
fun nextLine(): String = sc.nextLine()
fun nextList() = nextLine().split(" ")
fun printYesNo(isYes: Boolean) = println(if (isYes) "Yes" else "No")
fun printString(action: StringBuilder.() -> Unit) = println(buildString(action))

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

int n, a[105], b[105];
int ans;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> n;
	for (int i = 1; i <= n; ++i) cin >> a[i], a[i] += a[i - 1];
	for (int i = 1; i <= n; ++i) cin >> b[i];
	for (int i = n; i >= 1; --i) b[i] += b[i + 1];

	for (int i = 1; i <= n; ++i) {
		ans = max(ans, a[i] + b[i]);
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define ill long long
using namespace std;

int main() {
  int n, m, sum = 0;
  cin >> n >> m;
  vector<int> v(m);
  rep(i, 0, m) {
    cin >> v[i];
    sum += v[i];
  }
  if(n - sum >= 0) {
    cout << n - sum;
  } else {
    cout << -1;
  }
}

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

public static partial class Program
{
    public static void Main()
    {
        var hw = CRL().ArrayInts();
        var h = hw[0];
        var w = hw[1];
        for (int i = 0; i < h; i++)
        {
            var s = CRL();
            for (int j = 0; j < 2; j++)
            {
                CWL(s);
            }
        }
    }
}

public static partial class Program
{
    //テンプレここから
    public static int ToInt(this double d) => (int) d;
    public static long ToLong(this double d) => (long) d;
    public static int ToInt(this string str) => int.Parse(str);
    public static long ToLong(this string str) => long.Parse(str);
    public static long[] ToLong(this IEnumerable<string> strs) => strs.Select(x => x.ToLong()).ToArray();
    public static int[] ToInt(this IEnumerable<string> strs) => strs.Select(x => x.ToInt()).ToArray();
    public static long[] ArrayLongs(this string str, char opr = ' ') => str.Split(opr).ToLong();
    public static int[] ArrayInts(this string str, char opr = ' ') => str.Split(opr).ToInt();
    public static string CRL() => Console.ReadLine();
    public static void CWL(object obj) => Console.WriteLine(obj);
    public static long Diff(long a, long b) => Math.Abs(Math.Max(a, b) - Math.Min(a, b));
    public static int Diff(int a, int b) => Math.Abs(Math.Max(a, b) - Math.Min(a, b));
    public static long Sign(this long i) => Math.Sign(i);
    public static bool IsEven(this long i) => i % 2 == 0;
    public static bool IsEven(this int i) => i % 2 == 0;
    public static long[] dx = new long[] {0, -1, 0, 1};
    public static long[] dy = new long[] {-1, 0, 1, 0};
    public static long mod = 1000000007;
    public static string alphabet = "abcdefghijklmnopqrstuvwxyz";
    public static long ToLong(this char c) => c.ToString().ToInt();
    public static long[] Sort(this long[] array) => array.OrderBy(x => x).ToArray();
    public static int[] Sort(this int[] array) => array.OrderBy(x => x).ToArray();
    public static long[] DSort(this long[] array) => array.OrderByDescending(x => x).ToArray();
    public static int[] DSort(this int[] array) => array.OrderByDescending(x => x).ToArray();
    public static string Join(this IEnumerable<string> array, string sep = "") => string.Join(sep, array);
    public static string Join(this IEnumerable<char> array, string sep = "") => string.Join(sep, array);
    public static long GCD(long a, long b) => b == 0 ? a : GCD(b, a % b);

    public static long LCM(long a, long b) => a * b / GCD(a, b);

    //テンプレここまで
}

Measured memory_bytes: 13396
#include<iostream>
using namespace std;
int main(){
 int n,a,b;
 cin>>n>>a>>b;

 int ans=0;

 for(int i=0;i<n+1;i++){
  int wa=i/10000+(i/1000)%10+(i/100)%10+(i/10)%10+i%10;
  if(wa>=a && wa<=b){
   ans+=i;
  }
 }
 cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b;
  cin >> a >> b;
  
  if ((a*b) % 2 == 0) {
    cout << "Even" << endl;
  }
  
  else {
    cout << "Odd" << endl;
  }
}

Measured memory_bytes: 256
import math
N = int(input())
S = []
for i in range(N):
  S.append(list(map(int, input().split())))
def dist(a, b):
  return ((a[0]-b[0])**2 + (a[1]-b[1])**2) ** 0.5
D = [dist(S[i], S[j]) for i in range(N-1) for j in range(i+1, N)]
print (sum(D)*(N-1)/N/(N-1)*2)

Measured memory_bytes: 3188
// Problem : D - Wizard in Maze
// Contest : AtCoder - AtCoder Beginner Contest 176
// URL : https://atcoder.jp/contests/abc176/tasks/abc176_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)


/*ヽ｀、ヽ｀｀、ヽ｀ヽ｀、、ヽ ｀ヽ 、ヽ｀🌙｀ヽヽ｀ヽ、ヽ｀
ヽ｀、ヽ｀｀、ヽ 、｀｀、 ｀、ヽ｀ 、｀ ヽ｀ヽ、ヽ ｀、ヽ｀｀、
ヽ、｀｀、｀、ヽ｀｀、 、ヽヽ｀、｀、、ヽヽ、｀｀、 、 ヽ｀、 
ヽ｀｀、 ヽ｀ヽ｀、、ヽ ｀ヽ 、 🚶ヽ｀｀｀｀ヽヽヽ｀、、ヽ｀、、ヽ*/

// #pragma GCC optimize ("O3")
// #pragma GCC target ("sse4")

#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,b,a) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
 
#define bug(x) cout<<#x<<"="<<x<<endl; 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
 
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const ld pii=3.14159265359; 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 200001; //check the limits, dummy
 int H,W;
 vi grd[MX];
int dx[]={0,0,-1,1,1,1,-1,-1},dy[]={1,-1,0,0,1,-1,1,-1};
 inline bool isValid(int x,int y)
 {
 	if(x>=0 && x<H && y>=0 && y<W && !grd[x][y])
 		return true;
 	return false;
 }
 
int main() 
{
	ios_base::sync_with_stdio(0); cin.tie(0);    
	cin>>H>>W;
	pi st,en;
	cin>>st.f>>st.s>>en.f>>en.s;
	st.f--,st.s--,en.f--,en.s--;
	F0R(x,H)
	{
		string str;
		cin>>str;
		F0R(y,W)
		{
			grd[x].pb(str[y]=='#'?1:0);
			// cout<<grd[x][y];
		}
		// cout<<nl;
	}
	int mvs[H][W];
	// int vis[H][W]={0};
	fill(mvs[0],mvs[0]+H*W,INT_MAX);
	// 0/1 BFS
	deque<pi> q;
	q.pb(st);
	// vis[st.f][st.s]=1;
	mvs[st.f][st.s]=0;
	while(sz(q)!=0)
	{
		pi S=q.front();
		q.pop_front();
		F0R(x,4)
		{
			pi v={S.f+dx[x],S.s+dy[x]};
			if(isValid(v.f,v.s) && mvs[v.f][v.s]>mvs[S.f][S.s])
			{
				q.push_front(v);
				mvs[v.f][v.s]=mvs[S.f][S.s];
			}
		}
		FOR(x,-2,3)
		{
			FOR(y,-2,3)
			{
				int a=S.f+x,b=S.s+y;
				if(isValid(a,b) && mvs[a][b]>mvs[S.f][S.s]+1)
				{
					q.pb({a,b});
					mvs[a][b]=1+mvs[S.f][S.s];
				}
			}
		}
	}
	mvs[en.f][en.s]=mvs[en.f][en.s]==INT_MAX?-1:mvs[en.f][en.s];
	cout<<mvs[en.f][en.s];
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343

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

int main(){
    int n,u,k;
    int *U;
    cin>>n;
    
    int A[n][n];
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            A[i][j]=0;
        }
    }
    for(int i=0;i<n;i++){
        cin>>u>>k;
        U= new int[k];
        for(int j=0;j<k;j++){
            cin>>U[j];
            A[i][U[j]-1]=1;
            
        }
    
    } 
    for(int i=0;i<n;i++){
        cout<<A[i][0];
        for(int j=1;j<n;j++){
           cout<<" "<<A[i][j];
        }
        cout<<endl;
    }


}


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

int main() {
    string S;
    cin >> S;
    if (S == "Sunny") cout << "Cloudy\n";
    else if (S == "Cloudy") cout << "Rainy\n";
    else cout << "Sunny\n";
    return 0;
}


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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debug3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define debugB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

// ------------------------------------------------------------------------------------------

const int NN = 111111;
int N;
// ll A[NN], B[NN], C[NN];

int main() {
   cin >> N;
   vec<ll> A(N), B(N), C(N);
   rep (i, N) { cin >> A[i]; }
   rep (i, N) { cin >> B[i]; }
   rep (i, N) { cin >> C[i]; }

   sort(all(A)); sort(all(B)); sort(all(C)); 

   vec<ll> AtoB(N);
   rep (i, N) {
      auto itrA = lower_bound(all(A), B[i]);
      // if (itrA == A.end()) continue;
      int aNum = itrA - A.begin();
      AtoB[i] = aNum;
   }
   vec<ll> BtoC(N);
   rep (i, N) {
      auto itrC = upper_bound(all(C), B[i]);
      if (itrC == C.end()) continue;
      int cNum = N - (itrC - C.begin());
      BtoC[i] = cNum;
   }

   ll ans = 0;
   rep (i, N) {
      ans += AtoB[i] * BtoC[i];
   }

   cout << ans << endl;

   return 0;
}

Measured memory_bytes: 4224
import java.util.Scanner;

public class Main {
    public static void main(String args[]){
        Scanner stdIn = new Scanner(System.in);
        int n = stdIn.nextInt();
        int num[] = new int[n];
        
        for(int i = 0; i < n; i++){
            num[i] = stdIn.nextInt();
        }
        
        int max = 0;
        int semax = 0;
        
        for(int i = 0; i < n; i++){
            if(num[i] >= max){
                semax = max;
                max = num[i];
                //System.out.println(max + " " + semax);
            }else if (num[i] >= semax){
                semax = num[i];
            }
        }
        
        for(int i = 0; i < n; i++){
            if(max == num[i]){
                System.out.println(semax);
            }else{
                System.out.println(max);
            }
        }
    }
}


Measured memory_bytes: 104748
#include <bits/stdc++.h>
using namespace std;
#define int long long

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

     if(n>81){
          cout<<"No";
          return 0;
     }
     
     for(int i=1;i<=n;i++){
          if(n%i==0){
               if(i<=9 and n/i<=9){
                    cout<<"Yes";
                    return 0;
               }
          }
     }
    cout<<"No";
}

Measured memory_bytes: 256
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define rep(i,n) for(int i = 0 ; i < (int)(n) ; i++)

int imos[114514];

void solve(long long N, long long C, vector<long long> s, vector<long long> t, vector<long long> c){
	vector< pair<int,int> > seg[30];
	for(int i = 0 ; i < N ; i++){
		c[i]--;
		seg[c[i]].push_back({s[i],t[i]});
	}

	for(int i = 0 ; i < C ; i++){
		sort(seg[i].begin(),seg[i].end());
		vector< pair<int,int> > newSeg;
		if( seg[i].size() == 0 ) continue;
		pair<int,int> s = seg[i][0];
		for(int j = 1 ; j < seg[i].size() ; j++){
			if( s.second == seg[i][j].first ){
				s.second = seg[i][j].second;
			}else{
				newSeg.push_back(s);
				s = seg[i][j];
			}
		}
		newSeg.push_back(s);
		for( auto x : newSeg ){
			imos[x.first] += 1;
			imos[x.second+1] += -1;
		}
	}

	int mx = imos[0];
	for(int i = 1 ; i < 114514 ; i++)
		mx = max(mx,imos[i] = imos[i-1] + imos[i]);
	cout << mx << endl;


	
}

int main(){	
	long long C;
	long long N;
	scanf("%lld",&N);
	vector<long long> c(N-1+1);
	vector<long long> s(N-1+1);
	vector<long long> t(N-1+1);
	scanf("%lld",&C);
	for(int i = 0 ; i <= N-1 ; i++){
		scanf("%lld",&s[i]);
		scanf("%lld",&t[i]);
		scanf("%lld",&c[i]);
	}
	solve(N, C, s, t, c);
	return 0;
}



Measured memory_bytes: 6656
#include <stdio.h>
 
int main(void){

	int m;	/* ??????????¨?????????°m */
	int f;	/* ??????????¨?????????°f */
	int r;	/* ???????¨?????????°r */

	while(1){
		scanf("%d %d %d",&m,&f,&r);
		if((m==-1)&&(f==-1)&&(r==-1)){
			break;	/* m f r????????????-1?????¨?????\???????????? */
	}

	if((m!=-1)&&(f!=-1)){
		if((m+f)>=80){
			printf("A\n");	/* ??????????¨???¨??????????¨????????¨??????°???80??\???????????°??????A????????? */
	}

	else if((m+f)>=65){
		printf("B\n");		/* ??????????¨???¨??????????¨????????¨??????°???65??\???80??????????????°??????B????????? */
	}

	else if(((m+f)>=50)||(r>=50)){
		printf("C\n");		/* ??????????¨???¨??????????¨????????¨??????°???50??\???60??????????????°??????C????????? */
	}

	else if((m+f)>=30){
		printf("D\n");		/* ??????????¨???¨??????????¨????????¨??????°???30??\???50??????????????°??????D????????? */
	}

		else{
			printf("F\n");	/* ??????????¨???¨??????????¨????????¨??????°???30??????????????°??????F????????? */
		}
	}
		else{
			printf("F\n");	/* ??????????¨??????????????¨????????????????????¬????????????´?????????F????????? */
		}
    }

	return 0;
}

Measured memory_bytes: 584
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define debug(x)      cerr << "L" << __LINE__ << ": " << #x << " = " << (x) << endl
#define YN(x)         cout << ((x) ? "YES" : "NO") << endl
#define Yn(x)         cout << ((x) ? "Yes" : "No") << endl
#define yn(x)         cout << ((x) ? "yes" : "no") << endl
#define absi(x)       ( ((x) >= 0) ? (x) : (-(x)) )
#define debugvec(v)   rep(i, v.size()) cerr << "L" << __LINE__ << ": " << #v << "[" << i << "] = " << v[i] << endl;
#define debugvec2(v)  cerr << "L" << __LINE__ << ": " << #v << " = { "; rep(i, v.size()) cerr << v[i] << (i + 1 == v.size() ? "" : ", "); cerr << " }" << endl;
typedef long long ll;  // 10^18 くらいまでいける

// for DP
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 ll INF = 1LL << 60;

int main(){
  int n, r;
  cin >> n >> r;
  if (n<10){
    cout << r + 100 * (10-n) << endl;
  }else{
    cout << r << endl;
  }
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main{

	public static void main(String[] args) {
		Scanner src = new Scanner(System.in);
		int S = src.nextInt();
		int s = (S%3600)%60;
		int m = (S%3600)/60;
		int h = S/3600;
		
		System.out.println(h+":"+m+":"+s);
	}

}

Measured memory_bytes: 17248
#include <iostream>
#include <cmath>

using namespace std;

int main() {
    int N;
    int K;

    cin >> N >> K;

    double ans = 0;

    for (int i = 1; i <= N; ++i) {
        if (i < K) {
            ans += pow(0.5, ceil(log2((double)K / i)));
        }
        else {
            ans += 1.0;
        }
    }
    printf("%.11f\n", ans / N);
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <queue>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

const int MOD = 1000000007, INF = 1111111111; 
using namespace std;
typedef long long lint;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N, W;
	cin >> N >> W;

	struct item { int w, val; };
	vector<item> item(N);
	for (int i = 0; i < N; i++) cin >> item[i].w >> item[i].val;

	vector<vector<lint>> dp(N + 1, vector<lint>(100001, INF));
	dp[0][0] = 0;
	for (int i = 1; i <= N; i++) {

		for (int j = 0; j <= 100000; j++) {
			if (j - item[i - 1].val >= 0) dp[i][j] = min(dp[i - 1][j - item[i - 1].val] + item[i - 1].w, dp[i - 1][j]);
			else dp[i][j] = dp[i - 1][j];
		}
	}

	int ans = 0;
	for (int j = 0; j <= 100000; j++) if (dp[N][j] <= W) ans = j;

	cout << ans;

	return 0;
}

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

int main()
{
  ll l, r;
  cin >> l >> r;
  r = min(r, l + 4038);
  ll ans = 2019;
  for (ll i = l; i <= r; i++)
  {
    for (ll j = i + 1; j <= r; j++)
    {
      ans = min(ans, (i * j) % 2019);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3636
#include<stdio.h>
int n, A[50];

int solve(int i, int m) {
	if (m == 0) return 1;
	if (i >= n) return 0;

	int res = solve(i + 1, m) || solve(i + 1, m - A[i]);
	return res;
}

int main(void) {
	int q, M, i;

	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d", &A[i]);
	}
	scanf("%d", &q);
	for (i = 0; i < q; i++) {
		scanf("%d", &M);
		if (solve(0, M)) {
			printf("yes\n");
		}
		else{
			printf("no\n");
		}
	}
	return 0;
}

Measured memory_bytes: 1800