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

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define eee(a) (cerr << (#a) << ": " << (a) << endl);


using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using mint = map<int, int>;

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

const char sp = ' ';
const char cmm = ',';
const int MOD = 1e9+7;
const int INF = 1e9;
const ll LINF = 1e18;

ll mod(ll a, ll b){
    return (a%b+b)%b;
}
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);
}
void Yes(){
    cout << "Yes" << endl;
}
void No(){
    cout << "No" << endl;
}
void Judge(bool b){
    b ? Yes() : No();
}
void YES(){
    cout << "YES" << endl;
}
void NO(){
    cout << "NO" << endl;
}
void JUDGE(bool b){
    b ? YES() : NO();
}
ll powmod(ll b, ll e){
    ll r = 1; while(e > 0) {if(e&1) r = (r%MOD)*(b%MOD)%MOD; b = (b%MOD)*(b%MOD)%MOD; e >>= 1;} return r;
}
double distance(ll x1, ll y1, ll x2, ll y2){
    return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));
}

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;
}
template<typename T>
void ppp(T n){
    cout << n << endl;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {
    return s << "(" << p.first << ", " << p.second << ")";
}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
    int len = v.size();
    s << '[';
    for(int i = 0; i < len; ++i) {
        s << v[i]; if(i < len-1) s << ", ";
    }
    s << ']';
    return s;
}

struct aaa {
    aaa(){
        //cin.tie(0); ios::sync_with_stdio(0); 
        cout<<fixed<<setprecision(15);
    }
} fastio;

int main(){

    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    vector<int> s(n+2), t(n+2);
    partial_sum(a.begin(), a.end(), s.begin()+1,
                [](int x, int y){return max(x, y);});
    partial_sum(a.rbegin(), a.rend(), t.rbegin()+1,
                [](int x, int y){return max(x, y);});
    rep(i, n) ppp(max(s[i], t[i+2]));
    return 0;
}


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

ll fac(ll x,int a){
    ll ret = 1;
    for(int j=0; j<a; j++){
        ret *= x;
    }
    return ret;
}

int main() {
    ll n;
    cin >> n;
    ll ans = 0;
    for(int i=1; i<35; i++){
        if(fac(5,i)*2 > n) break;
        ans += n/(fac(5,i)*2);
    }
    if(n%2 == 0){
        cout << ans << endl;
    }
    else{
        cout << 0 << endl;
    }
}

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

using vi = std::vector<int>;
using vvi = std::vector<vi>;

vi bfs(const vvi &tree, int N, int root)
{
    vi d(N, -1);
    std::queue<int> next;
    d[root] = 0;
    next.push(root);

    while (!next.empty())
    {
        int cp = next.front(); next.pop();
        for (int node: tree[cp])
        {
            if (d[node] < 0)
            {
                d[node] = d[cp] + 1;
                next.push(node);
            }
        }
    }
    return d;
}

int farest_from_v_longer_u(const vi &du, const vi &dv, int N)
{
    int max_dist = 0, max_virt = -1;
    for (int i = 0; i < N; i++)
    {
        if (dv[i] > max_dist && dv[i] > du[i])
        {
            max_dist = dv[i];
            max_virt = i;
        }
    }
    return max_virt;
}

int main()
{
    int N, u, v;
    std::cin >> N >> u >> v;
    
    vvi tree(N);   
    for (int i = 0; i < N - 1; i++)
    {
        int a, b;
        std::cin >> a >> b;
        tree[a-1].push_back(b-1);
        tree[b-1].push_back(a-1);
    }
    --u;
    --v;

    auto dist_from_v = bfs(tree, N, v);
    auto dist_from_u = bfs(tree, N, u);

    int deadend = farest_from_v_longer_u(dist_from_u, dist_from_v, N);
    int ans = dist_from_v[deadend] - 1;

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

Measured memory_bytes: 6656
n = int(input())
taro = 0
hanako = 0
for i in range(n):
  t, h = input().split()
  if t > h:
    taro += 3
  elif t < h:
    hanako += 3
  else:
    taro += 1
    hanako += 1
print(taro, hanako)


Measured memory_bytes: 5596
#include <iostream>
#include <vector>
#include <limits>
#include <algorithm>
#include <set>
using namespace std;
using Int = long long;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,f,t) for(int i=f;i<t;i++)
#define P(ary) do { for(auto i:ary){ cout << i << " "; } cout << endl; } while (0)
int main()
{
    int x, a, b; cin >> x >> a >> b;
    cout << (abs(x-a) < abs(x-b) ? "A" : "B") << endl;
    return 0;
}

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

int main() {
	int n,A=0,B=0,AB=0,O=0;
	char bt[3];
	
	while(scanf("%d,%s",&n,bt)+1){
		if(bt[0]=='A'){
			if(bt[1]=='B')
				++AB;
			else ++A;
		}else if(bt[0]=='B'){
			++B;
		}else if(bt[0]=='O'){
			++O;
		}
	}
	cout<<A<<endl<<B<<endl<<AB<<endl<<O<<endl;
	return 0;
}

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

using namespace std;

using ll = int_fast64_t;
constexpr ll llmax = INT_FAST64_MAX; // std::numeric_limits<int_fast64_t>::max()
constexpr ll llmin = INT_FAST64_MIN; // std::numeric_limits<int_fast64_t>::min()
using ull = uint_fast64_t;
constexpr ull ullmax = UINT_FAST64_MAX; // std::numeric_limits<uint_fast64_t>::max()

#define FOR(i, b, e) for (int i = (b); i < (e); ++i)
#define RFOR(i, b, e) for (int i = ((e) - 1); (b) <= i; --i)
#define REP(i, N) for (int i = 0; i < (N); ++i)
#define RREP(i, N) for (int i = ((N) - 1); 0 <= i; --i)
#define scanInt(x) int x; scanf("%d", &(x)); getchar();
#define scanLLInt(x) ll x; scanf("%lld", &(x)); getchar();
#define scanVecInt(A, N) vector<int> A(N); REP(i, N){scanf("%d", &(A[i])); getchar();}
#define scanVecLLInt(A, N) vector<ll> A(N); REP(i, N){scanf("%lld", &(A[i])); getchar();}

int main()
{
    scanInt(N);
    string S;
    cin >> S;

    int result = 0;

    auto func = [&](int d){
        int len = 0;
        REP(i, N - d){
            if (S[i] == S[i + d]){
                len++;
                result = max(result, len);
                if (d <= len) break;
            }else{
                len = 0;
            }
        }
    };

    for (int d = N / 2; result < d; d--){
        func(d);
        if (d != N - d) func(N - d);
    }
    cout << result << endl;
}


Measured memory_bytes: 256
#include<queue>
#include<stack>
#include<math.h>
#include<cmath>
#include<bitset>
#include<stdio.h>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iostream>
#include<utility>
#include<functional>
#include<deque>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int main(){
  ll n,i;
  vector<ll> a(100010);
  cin >> n;
  ll ans=1;
  for(i=0;i<n;i++){
    cin >> a[i];
    if(a[i]==0){
      cout << "0" << endl;
      return 0;
    }
  }
  for(i=0;i<n;i++){
    if(1000000000000000000/a[i]<ans){
      cout << "-1" << endl;
      return 0;
    }
    ans=ans*a[i];
  }
  cout << ans << endl;
  return 0;
}

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

int main() {
	int n;
	cin >> n;
	vector<int>h(n);
	for (int i = 0; i < n; i++)cin >> h.at(i);
	vector<int>dp(n,-1);
	dp.at(0) = 0;
	dp.at(1) = abs(h.at(1) - h.at(0));
	for (int i = 2; i < n; i++) {
		dp.at(i) = min(dp.at(i - 1) + abs(h.at(i) - h.at(i - 1)), 
			dp.at(i - 2) + abs(h.at(i) - h.at(i - 2)));
	}
	cout << dp.at(n - 1) << endl;

}

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

using namespace std;

int f(long long x) {
	int s = 0;
	while (x) {
		s += x % 10;
		x /= 10;
	}
	return s;
}

int main() {
	long long n;
	ignore = scanf("%lld", &n);
	
	int ans = f(n);
	long long k = 1;
	while (n >= k) {
		ans = max(f(n - (n % k) - 1), ans);
		k = 10 * k;
	}
	
	printf("%d\n", ans);
	
	return 0;
}


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

int n;
int a[2020];
int dp[2020][2];

int func(int m, int t){
	if(dp[m][t] != 1e9+7) return dp[m][t];
	int res = abs(a[n+1-m] - a[n+1]);;
	for(int i=1; i<m; ++i){
		if(t == 0) res = max(res, func(m-i, 1-t));
		else res = min(res, func(m-i, 1-t));
	}
	return dp[m][t] = res;
}

int main(){
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	cin >> n;
	for(int i=0; i<n+2; ++i){
		cin >> a[i];
		dp[i][0] = dp[i][1] = 1e9+7;
	}
	cout << func(n, 0) << "\n";
}

Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main(void){
    string s1, s2;
    int m, k;
    int h[100];
    
    while(1) {
        k=0;
        cin >> s1;
        s2 = s1;
        if(s1 == "-") {
            break;
        }
        cin >> m;
        for(int i=0;i<m;i++) {
            cin >> h[i];
            k = k + h[i];
        }
        for(int i=0;i<s1.size();i++) {
            s1[i] = s2[(i+k)%s1.size()];
        }
        cout << s1 << endl;
    }
}

Measured memory_bytes: 3196
#include<bits/stdc++.h>
using namespace std;
#define inf 0x3f3f3f3f
#define ll long long
const int N=200005;
const int mod=1e9+7;
const double eps=1e-8;
const double PI = acos(-1.0);
#define lowbit(x) (x&(-x))
ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
ll qpow(ll a,ll b){ll res=1;while(b){if(b&1) res=res*a%mod;a=a*a%mod;b>>=1;}return res;}
ll inv(ll a,ll p){return qpow(a,p-2);}
int main()
{
    std::ios::sync_with_stdio(false);
    string s;
    while(cin>>s)
    {
        map<char,int> m;
        int l=s.length();
        for(int i=0;i<l;i++)
        {
            m[s[i]]++;
        }
        int flag=0;
        for(map<char,int>::iterator it=m.begin();it!=m.end();it++)
        {
            if((*it).second&1)
            {
                flag=1;
                break;
            }
        }
        if(!flag)
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
using System.Collections.Generic;
using static System.Math;
using System;

public class Hello
{
    public static void Main()
    {
        var d = new Dictionary<string, int>();
        var n = int.Parse(Console.ReadLine().Trim());
        var dmax = 0;
        for (int i = 0; i < n; i++)
        {
            var s = Console.ReadLine().Trim();
            if (d.ContainsKey(s)) d[s]++;
            else d[s] = 1;
            dmax = Max(dmax, d[s]);
        }
        var ans = new List<string>();
        foreach (var x in d)
            if (dmax == x.Value) ans.Add(x.Key);
        ans.Sort(StringComparer.OrdinalIgnoreCase);
        Console.WriteLine(string.Join("\n", ans));
    }
}


Measured memory_bytes: 50168
#include<bits/stdc++.h>
using namespace std;
const int N=1e4+10;
const int mod=998244353;
int gi() {
    int x=0,o=1;char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
int qpow(int a,int b) {
    int ret=1;
    while(b) {
        if(b&1) ret=1ll*ret*a%mod;
        a=1ll*a*a%mod,b>>=1;
    }
    return ret;
}
struct poly {
    vector<int> v;
    int& operator[](int x) {
        return v[x];
    }
    void set(int n) {
        v.resize(n+1);
    }
    int get() {
        return (int)v.size()-1;
    }
};
void NTT(poly &a,int n,int f,vector<int> &r) {
    for(int i=0;i<n;i++)
        if(i<r[i]) swap(a[i],a[r[i]]);
    for(int i=1;i<n;i<<=1) {
        int wn=qpow(3,(mod-1)/(i<<1));
        if(f==-1) wn=qpow(wn,mod-2);
        for(int p=i<<1,j=0;j<n;j+=p) {
            int w=1;
            for(int k=0;k<i;k++,w=1ll*w*wn%mod) {
                int x=a[j+k],y=1ll*w*a[j+k+i]%mod;
                a[j+k]=(x+y)%mod,a[j+k+i]=(x-y+mod)%mod;
            }
        }
    }
    if(f==-1) {
        int inv=qpow(n,mod-2);
        for(int i=0;i<n;i++) a[i]=1ll*a[i]*inv%mod;
    }
}
poly operator*(poly a,poly b) {
    int n=a.get(),m=b.get(),l=0;
    m+=n;for(n=1;n<=m;n<<=1) l++;
    vector<int> r(n);
    for(int i=0;i<n;i++) r[i]=(r[i>>1]>>1)|((i&1)<<(l-1));
    a.set(n-1),b.set(n-1);
    NTT(a,n,1,r),NTT(b,n,1,r);
    for(int i=0;i<n;i++) a[i]=1ll*a[i]*b[i]%mod;
    NTT(a,n,-1,r);
    a.set(m);return a;
}
poly qpow(poly a,int b,int n) {
    poly ret;ret.set(n);ret[0]=1;
    while(b) {
        if(b&1) ret=ret*a,ret.set(n);
        a=a*a,a.set(n),b>>=1;
    }
    return ret;
}
int n,m=0,e=0,fac[N],ifac[N];
char a[N],b[N];
int main() {//
    scanf("%s",a+1),scanf("%s",b+1),n=strlen(a+1);
    for(int i=1;i<=n;i++) {
        if(a[i]=='1'&&b[i]=='1') ++m;
        else if(a[i]=='0'&&b[i]=='1') ++e;
    }
    fac[0]=1;for(int i=1;i<=n+1;i++) fac[i]=1ll*fac[i-1]*i%mod;
    ifac[n+1]=qpow(fac[n+1],mod-2);
    for(int i=n;i>=0;i--) ifac[i]=1ll*ifac[i+1]*(i+1)%mod;
    poly Q;Q.set(m);
    for(int i=0;i<=m;i++) Q[i]=ifac[i+1];
    poly P=qpow(Q,e,m);
    int ans=0;
    for(int i=0;i<=m;i++) ans=(ans+P[i])%mod;
    ans=1ll*fac[e]*fac[m]%mod*fac[e+m]%mod*ans%mod;
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 1272
import java.util.*

fun solveFlippingSigns() {

    val sc = Scanner(System.`in`)
    val length: Int = sc.nextInt()
    val list = mutableListOf<Long>()
    var buf: Long = 0
    var minus = 0
    var answer: Long = 0

    for (x in 0 until length) {
        buf = sc.nextLong()
        if (buf < 0) {
            minus++
            buf *= -1;
        }
        list.add(buf)
    }

    val sum = list.sum()
    val min = list.min() ?: 0

    if (minus % 2 == 0) {
        answer = sum
    } else {
        answer = (sum - (2 * min))
    }

    println(answer)

}


fun main(args: Array<String>) {
    solveFlippingSigns()
}

Measured memory_bytes: 54596
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int Inf = 1000000000;
constexpr ll INF= 9 * 1e18;
constexpr ll MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<int,int> P;

template<typename T>
T Pow(T a,T b) {
    T ret = 1;
    for(int i = 0;i < b;i++) {
        ret *= a;
    }
    return ret;
}

ll Sum(ll A) {
    ll ret = 0;
    for(ll i = 1;i <= A;i++) {
        ret += i;
    }
    return ret;
}

int main() {
    string S;
    cin >> S;
    S += "<";
    ll ret = 0;
    ll left = 0;
    ll right = 0;
    for(int i = 0;i < S.size() - 1;i++) {
        if(S.at(i) == '>' && S.at(i + 1) == '<') {
            right++;
            ret += Sum(max(right,left));
            ret += Sum(min(right,left) - 1);
            right = 0;
            left = 0;
        }
        else if(S.at(i) == '>') {
            right++;
        }
        else {
            left++;
        }
    }
    if(left != 0) {
        ret += Sum(left);
    }
    cout << ret << endl;
}

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

int main(){
    int A,B,x;
    cin >> A >> B;
    int n=0;

    for(x=A; x<=B; x++){
        if(x/10000 == x%10){
            if((x/1000)%10 == (x/10)%10){
                n++;
                continue;
            }
        }
    }

    cout << n << endl;
}

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

using namespace std;

int main()
{
	int n,x,ans=0,flag=0;
	int a[105];
	scanf("%d %d",&n,&x);
	for(int i=0;i<n;i++)
        scanf("%d",&a[i]);
    sort(a,a+n);
	for(int i=0;i<n;i++)
    {
        if(x>=a[i])
        {
            ans++;
            x-=a[i];
        }
        else
            break;
    }
    if(x!=0 && ans==n)
        ans--;
	printf("%d\n",ans);





    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define print(x) cout << x << endl;
using namespace std;
typedef long long ll;

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

    int a, b;
    a = (int)((s[0] - '0') * 10 + (s[1] - '0'));
    b = (int)((s[2] - '0') * 10 + (s[3] - '0'));

    string res;
    if ((a > 12 || a == 0) && b <= 12 && b > 0) res = "YYMM";
    else if (a <= 12 && a > 0 && (b > 12 || b == 0)) res = "MMYY";
    else if (a <= 12 && a > 0 && b <= 12 && b > 0) res = "AMBIGUOUS";
    else res = "NA";

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 256
// --------------------<optimizations>--------------------
#pragma GCC optimize("O3")
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)\
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define pii pair<ll,ll>
#define vpii vector<pair<ll,ll> >
#define F first
#define S second
#define ld long double
#define built __builtin_popcountll
#define mst(a,i) memset(a,i,sizeof(a))
#define all(x) x.begin(),x.end()
#define itit(it,a) for(auto it=(a).begin(); it!=(a).end(); it++)
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define repr(i,a,b) for(ll i=a; i>b; i--)
#define reprr(i,a,b) for(ll i=a; i>=b; i--)
#define pi 3.14159265358979323846264338327950288419716939937510582097494459230
ll max3(ll x,ll y,ll z) {return max(max(x,y),z);}
ll min3(ll x,ll y,ll z) {return min(min(x,y),z);}
const ll M=2e5+10,M2=1e6+10,mod=1e9+7,inf=1e17+10;
void add(int& a, int b) {a+=b;if(a>=mod){a-=mod;}}
#define trace1(x)                  cerr<<#x<<": "<<x<<endl
#define trace2(x, y)              cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)              cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)          cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)     cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
int X[] = {0, 1, 0, -1};
int Y[] = {-1, 0, 1, 0};
ll power(ll x,ll n){ll result=1;while(n>0){if(n%2==1)result=(result*x)%mod; x=((x%mod)*(x%mod))%mod;n=n/2;}return result;}

ll x;

int main()
{
    #ifndef ONLINE_JUDGE
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #endif

    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> x;
    if(x<1200) cout << "ABC";
    else cout << "ARC";
    return 0;
}
/* The judge is never wrong! Your code is buggy 
   Look for:
 * * Read the problem carefully.
 * * Don't forget to sort(), mod, ll!!!!
 * * Initial value = +/- infinity instead of zero!!!
 * * an easier and alternate approach
 * * read the problem statement carefully
 * * if concept is correct and still WA, try with a different implementation
 * * special cases (n=1?)
 * * if you have no idea just guess the appropriate well-known algorithm instead of doing nothing :/
 */

Measured memory_bytes: 256
#include <iostream>

inline int calcGcd(int x,int y){
	while(x % y != 0){
		int num = x % y;
		x = y;
		y = num;
	}
	return y;
}

inline int calcLcm(int x,int y){
	return x / calcGcd(x,y) * y;
}

int main(){
	int a,b;
	while(std::cin >> a >> b)
		std::cout<< calcGcd(a,b)<<" "<<calcLcm(a,b)<<std::endl;
}

Measured memory_bytes: 1164
import java.util.*;

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

		int N = sc.nextInt();
		int count = 0;
		for(int i = 0; i < N; i++) {
			int a = sc.nextInt();

			while(a % 2 == 0) {
				count++;
				a /= 2;
			}
		}
		System.out.println(count);
	}
}

Measured memory_bytes: 34392
#include <iostream>
#include <vector>
#include <bitset>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
 
using namespace std;
typedef long long ll;
 
int main(){

  int S,W;
  cin >> S >> W;
  if(W>=S) cout << "unsafe" << endl;
  else cout << "safe" << endl;
  
  return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef vector<int> VI;
ll mm=1000000000;ll MM=mm+7;
#define rep(i, n) for(int i=0;i<n;i++)
#define PI 3.141592653589793

int main(){
 ll x,t;
 cin >> x >> t;
 if(x>=t){
 cout << x-t << endl;
 }
 else cout << 0 << endl;
}

Measured memory_bytes: 256
import sys
 
N = map(int, raw_input().strip().split(" "))
V = map(int, raw_input().strip().split(" "))
C = map(int, raw_input().strip().split(" "))
a = 0

for i in range(N[0]):
    if (V[i] - C[i]) > 0:
        a += (V[i]- C[i])

print(a)

Measured memory_bytes: 2568
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		for(int i = sc.nextInt(); i>0; i--){
			int a = sc.nextInt();
			int b = sc.nextInt();
			int c = sc.nextInt();
			if(a*a == (b*b + c*c) || b*b == (a*a + c*c) || c*c == (a*a + b*b))
				System.out.println("YES");
			else
				System.out.println("NO");
		}
	}
}

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

typedef pair<int,int> P;
typedef pair<int,P> PP;

class Union_Find
{
public:
    vector<int> par;

    void init(int n) {
        par.resize(n);
        for (int i = 0; i < n; i++) {
            par[i] = i;
        }
    }

    int find(int x) {
        if (x == par[x]) return x;
        return par[x] = find(par[x]);
    }

    void unite(int x, int y) {
        x = find(x);
        y = find(y);

        if (x < y) par[y] = x;
        else par[x] = y;
    }
};

int N, M;

void solve() {
    vector<PP> V;
    for (int i = 0; i < M; i++) {
        int x, y, c;
        cin >> x >> y >> c;
        x--; y--;
        V.push_back(PP(c, P(x, y)));
    }

    sort(V.begin(), V.end());

    vector<bool> used(N, false);
    int count = 0;
    Union_Find uf;
    uf.init(N);
    for (int i = 0; i < M; i++) {
        PP pp = V[i];
        int cost = pp.first;
        int x = pp.second.first;
        int y = pp.second.second;
        if (uf.find(x) == uf.find(y)) continue;
        count++;
        uf.unite(x, y);

        if (count == (N + 1) / 2) {
            cout << cost << endl;
            return ;
        }
    }
}

int main() {
    while (cin >> N >> M, N || M) solve();

    return 0;
}

Measured memory_bytes: 3168
N, M, X = map(int,input().split())
A = []
A = list(map(int,input().split()))
r1 = 0
r2 = 0
for i in A:
    if i > X:
        r1 += 1
    elif i<X:
        r2 += 1
if r1 > r2:
    print(r2)
else:
    print(r1)


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include<numeric>
using namespace std;
using P = pair<int, int>;
#define rep(i,n) for(int i=0; i<(n);i++)
typedef long long ll;


int main(){
    int n; cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    bool ans = true;
    rep(i,n){
        if(a[i]%2==0){
            if(a[i]%3!=0 && a[i]%5!=0) ans = false;
        }
    }
    if(ans){
        cout << "APPROVED" << endl;
    }else{
        cout << "DENIED" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
using ll = long long;
const int N = 1e5 + 9, M = 2209;
const ll INF = 1e10 + 7;
int n;
ll a, b[N];
map<ll, int>num;
map<ll, ll>rev;
set<ll>is;
int prime[M], tot, ans;
bool vis[M];
 
int main () {
	vis[1] = 1;
	for (int i = 2; i <= 2200; ++i) {
		if (!vis[i]) prime[++tot] = i;
		for (int j = 1; j <= tot && i * prime[j] <= 2200; ++j) {
			vis[i * prime[j]] = 1;
			if (i % prime[j] == 0) break;
		}
	}
	scanf("%d", &n);
	for (int i = 1; i <= n; ++i) {
		scanf("%lld", &a); b[i] = 1; ll r = 1;
//		printf("a[i]: %lld,", a);
		for (int j = 1; j <= tot; ++j) if (a % prime[j] == 0) {
			int k = 0;
			while (a % prime[j] == 0) {
				a /= prime[j];
				++k;
			}
			k %= 3;
			for (int t = (3 - k) % 3; t; --t) r *= prime[j];
			while (k--) b[i] *= prime[j];
		}
		if (r > INF) r = INF;
		b[i] *= a;
		ll d = ceil(sqrt(a));
		if (d * d == a) {
			r *= d;
		} else {
			r *= a;
			if (r >= INF) r = INF;
			r *= a;
			if (r >= INF) r = INF;
		}
//		printf("b[i]:%lld, r:%lld\n", b[i], r);
//		printf("%lld\n", b[i]);
		rev[b[i]] = r;
		++num[b[i]];
	}
	sort(b + 1, b + n + 1);
	n = unique(b + 1, b + n + 1) - b - 1;
	for (int i = 1; i <= n; ++i) {
		if (b[i] == 1) ++ans;
		else {
			if (!is.count(b[i]))
			ans += max(num[b[i]], num[rev[b[i]]]), is.insert(b[i]), is.insert(rev[b[i]]);
		}
	}
	printf("%d\n", ans);
	return 0;
}

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

int main() {
  int A ,B ,C ,D;
  cin >> A >> B >> C >> D;
  
  if(A + B > C + D) {
    cout << "Left" << endl;
  }
  else if(A + B == C + D) {
    cout << "Balanced" << endl;
  }
  else{
    cout << "Right" << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr<<#x<<": "<<x<<endl


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

    ll sum = 0;
    vector<ll> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
        sum += a[i];
    }
    map<ll,ll> mp;
    for(int i = 0; i < n; i++){
        mp[a[i]]++;
    }


    ll q;
    cin >> q;
    for(int i = 0; i < q; i++){
        ll b, c;
        cin >> b >> c;
        sum += (c-b)*mp[b];
        mp[c] += mp[b];
        mp[b] = 0;
        cout << sum << endl;
    }


    return 0;

}


Measured memory_bytes: 10056
import itertools
import time
start=time.time()
n,a,b,c=map(int,input().split())
l=[int(input()) for i in range(n)]
ans=1000000007
for i in range(2**n):
    use=[]
    for j in range(n):
        if((i>>j)&1):
            use.append(l[j])#使う竹の列挙
    loop='123'
    if(len(use)>=3):
        for j in (itertools.product(loop,repeat=len(use))):#グループ分けの列挙
            A=[]
            B=[]
            C=[]
            for k in range(len(use)):
                if(j[k]=='1'):
                    A.append(use[k])
                elif(j[k]=='2'):
                    B.append(use[k])
                elif(j[k]=='3'):
                    C.append(use[k])
            if(len(A)!=0 and len(B)!=0 and len(C)!=0):
                res=abs(sum(A)-a)+((len(A)-1)*10)+abs(sum(B)-b)+((len(B)-1)*10)+abs(sum(C)-c)+((len(C)-1)*10)
                ans=min(res,ans)
    else:
        continue
print(ans)

Measured memory_bytes: 3184
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <set>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)

int main(void){
	string s;	cin >> s;
	// int N; cin >> N;
	int ans_0 = 0;
	int ans_1 = 0;
	rep(i,s.size()){
		if (i%2==0)	{
			if (s[i]=='0')	ans_0++;
			else	ans_1++;
		}		else	{
			if (s[i]=='1')	ans_0++;
			else	ans_1++;
		}
	}
	int ans;
	if (ans_0>ans_1)	{
		ans = s.size() - ans_0;
	}	else	{
		ans = s.size() - ans_1;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 512
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;
char s[200001];
int main()
{
    int n,m,a=0,b=0;
    cin>>n>>m;
    scanf("%s",s);
    for(int i=0;i<n-1;i++)
    {
        if(s[i]=='L'&&s[i+1]=='R')a++;
        if(s[i]=='R'&&s[i+1]=='L')b++;
    }
    if(m<=min(a,b))cout<<n-(a+b+1)+min(min(a,b),m)*2<<endl;
    else cout<<n-1<<endl;
    
    return 0;
}


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

#define ll            long long
#define pb            push_back
#define si            set <int>
#define F             first
#define S             second
#define mii           map<int ,int >
#define msi           map<string,int >
#define mis           map<int , string>
#define fr(i,a,b)     for(int  i=a;i<=b;i++)
#define loop(i,n)     for(int i=0;i<n;i++)
#define all(v)        v.begin(),v.end()
#define vi            vector<int >
#define vii           vector<pair<int , int >>
#define vs            vector<string>
#define sz(x)         (int )x.size()
#define M             1000000007
#define mp            make_pair
#define input(arr,n)  loop(i,n) cin>>arr[i]
#define output(arr,n) loop(i,n) cout<<arr[i]<<" "
#define mod           998244353
#define sof           sizeof
using namespace std;
int gcd(int a,int b){
  if(b==0)return a;
  return gcd(b,a%b);
}

bool isPrime(int num){
    
    if(num==2) return true;
    if(num<2 || num%2==0) return false;
    for(int i = 3; i*i <=num; i+=2) {
       if(num % i == 0) {
          
          return false;
       }
    }
    return true;
   
}

bool comp(const pair<int,int> &a,const pair<int,int> &b){
  return a.F>b.F;
}

vector<vector<int>> L(3005,vector<int>(3005,-1));
string a,b;



void solve(){
  //cout<<"gadbad";
  
  cin>>a>>b;
  
  // declare size and reset size 
  int n=sz(a);
  int m=sz(b);
  L.resize(n+1, vector<int>(m+1));
 
  loop(i,n+1){
   
    loop(j,m+1){
      
      if(i==0 || j==0) L[i][j]=0;
      else if(a[i-1]==b[j-1]) {
        L[i][j]=1+L[i-1][j-1] ;
       
      }
      else {
        L[i][j]=max( L[i-1][j], L[i][j-1] );
      }
      
    }
  }
  //cout<<L[n][m]<<" ";
  char ch[L[n][m]+1];
  int x=L[n][m]-1;
  int i=n,j=m;
  while(i>0 && j>0 && x>=0){
    if(a[i-1]==b[j-1]){
      ch[x]=a[i-1];
      x--;
      i--,j--;
    }
    else{
      if(L[i-1][j]>L[i][j-1]){
        i--;
      }
      else j--;
    }
  }
  for(int i=0;i<L[n][m];i++){
    cout<<ch[i];
  }

  
}




signed main()   
{
  ios_base::sync_with_stdio(false);
  cin.tie(0); 
  cout.tie(0);
  #ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout); 
  #endif  

  int t;
  t=1;
  //cin>>t;
  loop(i,t){

      solve();
      if(i<t-1) cout<<"\n";
  }

  
  
  //directed graph
    



}
  


  



Measured memory_bytes: 39032
A, B, K = [int(x) for x in input().split()]

for i in range(K):
    if i % 2 == 0:
        if A % 2 == 1:
            A -= 1
        t = A // 2
        A -= t
        B += t
    else:
        if B % 2 == 1:
            B -= 1
        t = B // 2
        A += t
        B -= t
ans = (A, B)

print(" ".join(map(str, ans)))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
int main()
{
    string s;
    cin >> s;
    for(int i = 0;i < 4;i++)
    {
        cout << s[i];
    }
    cout << " ";
    for(int i = 4;i < s.size();i++)
    {
        cout << s[i];
    }
    cout << "\n";

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define P pair<ll, ll>
#define Graph vector<vector<ll>>
#define fi first
#define se second
constexpr ll mod = 1000000007;
constexpr ll INF = (1ll << 60);
constexpr double pi = 3.14159265358979323846;
template <typename T>
inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}

int main() {
    ll a, b, c;
    cin >> a >> b >> c;

    if (c - a - b > 0) {
        if ((c - a - b) * (c - a - b) > 4 * a * b) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>

#define MAX_N 10000

int main(){
  int N,Q,i,j,S[MAX_N],T,res = 0;
  scanf("%d",&N);
  for(i = 0 ; i < N ; i++){
    scanf("%d",&S[i]);
  }
  scanf("%d",&Q);
  for(i = 0 ; i < Q ; i++){
    scanf("%d",&T);
    for(j = 0 ; j < N ; j++){
      if(T == S[j]){
        ++res;
        break;
      }
    }
  }
  printf("%d\n",res);
  return 0;
}

Measured memory_bytes: 640
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <bitset>
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)

using namespace std;
typedef long long ll;


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


    ll ans=0;
    ll anss =0;
    ll count=0;
    ll i,j,h;
    ll Q,N,K,M;
    
    long double a, b;
    long double x;

    
    string S;

    ll flag=0;
    ll temp=0;

    cin  >>N;
    vector<ll> aa(N);
    for(i=0;i<N-1;i++){
        cin>>Q;
        aa[Q-1]++;
    }
    
for(i=0;i<N;i++){
        cout<< aa[i]<<endl;
    }

    return 0;
}

Measured memory_bytes: 4788
#include<bits/stdc++.h>
typedef long long int ll;
#define rep(i,n) for(int i = 0;i < n; i++)
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T & val) {
	std::fill((T*)array, (T*)(array + N), val);
}
using namespace std;
int n, m, a[100], s, p[10], q, sum, t,u;
bool b[10][10];
int main(void) {
	cin >> n >> m;
	Fill(b, false);
	rep(i, m) {
		cin >> q;
		rep(j, q) {
			cin >> s;
			b[i][s - 1] = true;
		}
	}
	rep(i, m)
		cin >> p[i];
	sum = 0;
	rep(i, (1 << n)) { 
		u = 0;
		rep(j, m) {
			t = 0; //swich
			rep(k, n) {
				if (i & (1 << k) && b[j][k])
					t++;//つながっていてかつオン
			}
			if (t % 2 == p[j])
				u++;
		}
		if (u == m)
			sum++;
	}
	cout << sum << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int h, w, i, j;

    while (1) {
        scanf("%d %d", &h, &w);

        if (h == 0 && w == 0)
            break;

        for (i = 1; i <= h; i++) {
            for (j = 1; j <= w; j++) {
                printf("#");
                if (j == w)
                    printf("\n");
            }
        }

        printf("\n");
    }

    return 0;
}

Measured memory_bytes: 572
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>

using namespace std;

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> X(M);
    for (int &i : X) cin >> i;
    sort(X.begin(), X.end());
    vector<int> mid;
    for (int i = 1; i < M; i++) {
        mid.push_back(X[i] - X[i - 1]);
    }
    sort(mid.begin(), mid.end());
    for (int i = 0; i < N - 1; i++)
        if (mid.empty() == false) mid.pop_back();
    const int ans = accumulate(mid.begin(), mid.end(), 0);
    cout << ans << endl;
    return 0;
}

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

int main(){
	string s;
	cin>>s;
	int n=s.length(),a=0,b=0;
	for(int i=0;i<n;i++){
		int x=(int)s[i]-'0';
		if(x%2==i%2) a++;
		else b++;
	}
	cout<<min(a,b)<<endl;
	return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

int main()
{
    int h, a;
    int ans;
    cin >> h >> a;

    ans = h / a;

    if (h % a != 0) {
        ans++;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 888
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        FastReader sc = new FastReader();
        int N = sc.nextInt();
        int[] arr = new int[N];
        for (int i=0; i<N; i++) {
            arr[i] = sc.nextInt();
        }
        int counter = 0;
        for (int i=1; i<N-1; i++) {
            if (check(arr[i-1], arr[i], arr[i+1])) counter++;
        }
        System.out.println(counter);
    }
    static boolean check(int a, int b, int c) {
        if (a > b && b > c) return true;
        if (c > b && b > a) return true;
        return false;
    }
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

}


Measured memory_bytes: 22612
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll read(){
	ll a=0,b=getchar(),c=1;
	while(!isdigit(b))c=b=='-'?-1:1,b=getchar();
	while(isdigit(b))a=a*10+b-'0',b=getchar();
	return a*c;
}
vector<pair<ll,ll> >A;
ll n,h,w,dp[3005],mod=1e9+7,fac[2<<17]={1},inv[2<<17]={1};
ll gao(ll x,ll y){
	return y?gao(x*x%mod,y/2)*(y%2?x:1)%mod:1;
}
ll check(ll x,ll y){
	return fac[x+y]*inv[x]%mod*inv[y]%mod;
}
int main(){
	h=read(),w=read(),n=read();
	for(int i=1;i<2<<17;i++)
		fac[i]=fac[i-1]*i%mod,inv[i]=gao(fac[i],mod-2);
	for(int i=0;i<n;i++)
		A.push_back({read()-1,read()-1});
	A.push_back({h-1,w-1});
	sort(A.begin(),A.end());
	for(int i=0;i<=n;i++){
		dp[i]=check(A[i].first,A[i].second);
		for(int j=0;j<i;j++)
			if(A[j].second<=A[i].second)
				dp[i]=(dp[i]-dp[j]*check(A[i].first-A[j].first,A[i].second-A[j].second)%mod+mod)%mod;
	}
	printf("%lld",dp[n]);
	return 0;
}

Measured memory_bytes: 4480
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
using namespace std;

int d;
string s;

int main () {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> s;
  if (s == "SUN") d = 7;
  if (s == "MON") d = 6;
  if (s == "TUE") d = 5;
  if (s == "WED") d = 4;
  if (s == "THU") d = 3;
  if (s == "FRI") d = 2;
  if (s == "SAT") d = 1;
  cout << d << endl;
}

Measured memory_bytes: 256
/* AOJ 0018 Sorting Five Numbers */

#include <stdio.h>

int
main(void)
{
    int n[5];
    int exchanges;
    int i, j, temp;

    for (i = 0; i < 5; i++)
        scanf("%d", n + i);

    for (i = 0; i < 4; i++) {
        exchanges = 0;

        for (j = 4; j > i; j--) {
            if (n[j - 1] < n[j]) {
                temp = n[j - 1];
                n[j - 1] = n[j];
                n[j] = temp;

                exchanges++;
            }
        }

        if (exchanges == 0) break;
    }

    printf("%d %d %d %d %d\n", n[0], n[1], n[2], n[3], n[4]);

    return 0;
}

Measured memory_bytes: 596
import java.util.*;

public class Main {


    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int  W = sc.nextInt();
        int  a = sc.nextInt();
        int  b = sc.nextInt();
        int  d = 0; 
        
        if( ( a + W ) < b ){
            d = b - ( a + W );
            System.out.println(d);
        }else if ( ( a + W ) == b ){
            System.out.println(0);
        }else if ( ( b + W ) < a ){
            System.out.println( a - ( b + W ) );
        }else if ( ( b + W ) == a ){
            System.out.println(0);
        }else if ( b > a && ( a + W ) > b ){
            System.out.println(0);
        }else if ( a == b ){
            System.out.println(0);
        }
    }
    
}

Measured memory_bytes: 23892
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		// 計算
		int result = 0;
		if(a > b){
		    for(int i = 0; i < a; i++){
		        System.out.print(b);
		    }
		}else{
		    for(int i = 0; i < b; i++){
		        System.out.print(a);
		    }
		}
		
		// 出力
		//System.out.println(result);
	}
}




Measured memory_bytes: 21716
#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 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 くらいまでいける */

int main(){
  int a,b;
  cin >> a >> b;

  if (a>9 || b>9){
    cout << -1 << endl;
    return 0;
  }

  cout << a*b << endl;

  return 0;
}

Measured memory_bytes: 256
use proconio::marker::Usize1;
use proconio::{fastout, input};
use std::collections::VecDeque;

pub struct AdjList {
    dim: usize,
    list: Vec<Vec<usize>>,
}

impl AdjList {
    pub fn new(d: usize) -> AdjList {
        AdjList {
            dim: d,
            list: vec![vec![]; d],
        }
    }

    pub fn dim(&self) -> usize {
        self.dim
    }

    pub fn add_edge(&mut self, from: usize, to: usize) {
        match self.list.get_mut(from) {
            Some(v) => v.push(to),
            None => self.list.insert(from, vec![to]),
        }
    }

    pub fn add_undirected_edge(&mut self, from: usize, to: usize) {
        self.add_edge(from, to);
        self.add_edge(to, from);
    }

    pub fn out_edges(&mut self, vertex: usize) -> Vec<usize> {
        self.list.get_mut(vertex).unwrap().to_vec()
    }

    pub fn in_edges(&mut self, v: usize) -> Vec<usize> {
        let mut res = vec![];
        for l in 0..self.dim() {
            if let Some(list) = self.list.get(l) {
                if list.contains(&v) {
                    res.push(l);
                }
            }
        }

        res
    }
}

#[fastout]
fn main() {
    input! {
        n: usize,
        m: usize,
        es: [(Usize1, Usize1); m],
    }

    let bad = 1_000_000 as usize;

    let mut res = vec![bad; n];
    res[0] = 0;

    let mut al = AdjList::new(n);
    for e in es {
        al.add_edge(e.0, e.1);
        al.add_edge(e.1, e.0);
    }
    let mut q = VecDeque::new();
    q.push_back(0 as usize);
    while !q.is_empty() {
        let now = q.pop_front().unwrap();
        let nxts = al.out_edges(now);
        for nxt in nxts {
            if res[nxt] == bad {
                res[nxt] = now;
                q.push_back(nxt);
            }
        }
    }

    if res.contains(&bad) {
        println!("No");
    } else {
        println!("Yes");
        for i in 1..n {
            println!("{}", res[i] + 1);
        }
    }
}


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

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for (int i = n-1; i >= 0; i--) {
        cout << a[i];
        if (i==0) {
            cout << endl;
        }else{
            cout << ' ';
        }
    }
    return 0;
}



Measured memory_bytes: 3092
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;

const int N = 200005;

int n;
pair<int, int> f[N][2];
char s[N];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> (s + 1);
    n = strlen(s + 1);
    for (int i = 1; i <= n; i++) {
        if (i == 1) {
            if (s[i] == 'P' || s[i] == '?') {
                f[i][0] = {0, 0};
            } else {
                f[i][0] = {-4 * N, 0};
            }
            if (s[i] == 'D' || s[i] == '?') {
                f[i][1] = {1, 0};
            } else {
                f[i][1] = {-4 * N, 0};
            }
        } else {
            if (s[i] == 'P' || s[i] == '?') {
                f[i][0] = max(make_pair(f[i - 1][0].fi, 0), make_pair(f[i - 1][1].fi, 1));
            } else {
                f[i][0] = {-4 * N, 0};
            }
            if (s[i] == 'D' || s[i] == '?') {
                f[i][1] = max(make_pair(f[i - 1][0].fi + 2, 0), make_pair(f[i - 1][1].fi + 1, 1));
            } else {
                f[i][1] = {-4 * N, 0};
            }
        }
    }
    for (int i = n, cur = (f[n][0].fi > f[n][1].fi ? 0 : 1); i >= 1; i--) {
        s[i] = (cur ? 'D' : 'P');
        cur = f[i][cur].se;
    }
    cout << (s + 1);
}


Measured memory_bytes: 6928
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <climits>
#include <string>
#include <queue>
#include <stack>
#include <map>
#include <cstring>
#include <numeric>
#include <set>

#define MOD 1000000007
#define INF 2000000000
#define sp ' '
#define st first
#define nd second
#define pb push_back
#define mp make_pair
#define FOR(YY, yy) for(long long yy = 0; yy < YY; ++yy)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector< vector<int> > vvi;
typedef pair<int, int> ii;
typedef vector<pair<int, int> > vii;
typedef vector<pair<int, pair<int, int> > > vpip;
typedef vector<bool> vb;
typedef priority_queue<int> pqi;

int main(int argc, char **argv)
{
    ios::sync_with_stdio(); cin.tie(0);
    string S;

    cin >> S;
    if(S == "Sunny") cout << "Cloudy" << endl;
    if(S == "Cloudy") cout << "Rainy" << endl;
    if(S == "Rainy") cout << "Sunny" << endl;

    return 0;
}

//cikisir



Measured memory_bytes: 256
#include<iostream>
#include<functional>
#include<utility>
#include<cmath>
#include<iomanip>
#include<algorithm>
#include<string>
#include<vector>

using namespace std;
const auto MOD = 1000000007;
const int INF = 1e9;
const long long LINF = 1e18;
#define rep(i,n) for(int i = 0; i < (n);i++)
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef vector<int> VI;
typedef vector<long long> VLL;


int n, m;
string s;

int main() {
	cin >> n;
	VI p(n);
	for (int i = 0; i < n; i++)
	{
		cin >> p[i];
	}
	int cnt = 0;
	for (int i = 0; i < n-2; i++)
	{
		if ((p[i + 1] < p[i + 2] && p[i + 1] >= p[i]) || (p[i + 1] < p[i] && p[i + 1] >= p[i + 2]))cnt++;
	}
	cout << cnt << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define pp push_back
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,m,i,p,l,j,k;
   cin>>n;
   int a[n];
   for(i=0; i<n; i++)
   {
       cin>>a[i];
   }
   p=0;
   //sort(a,a+n);
   for(i=0; i<n; i++)
   {
       for(j=i+1; j<n; j++)
       {
           for(l=j+1; l<n; l++)
           {

               if((a[i]!=a[j] && a[j]!=a[l] && a[i]!=a[l]))
               {
                   if((a[i]+a[j])>a[l] && (a[i]+a[l])>a[j] && (a[j]+a[l])>a[i])
                   {
                       p++;
                   }
               }

           }
       }
   }
    cout<<p<<endl;
}


Measured memory_bytes: 3600
#include <iostream>
#include <string>

using namespace std;

int main() {

    string S;
    cin >> S;

    int n = S.size();

    long long res = 0;

    /**
     * 考えられる数式は, 2 ^ (N-1) 通りある.
     */
    for (int mask = 0; mask < (1 << (n - 1)); mask++) {

        int idx = 0;
        int rng = 1;

        /**
         * bit 列を数式に変換するために, 各 bit に対して走査する.
         */
        for (int i = 0; i < n - 1; i++) {
            if (mask & (1 << i)) {
                res += stoll(S.substr(idx, rng));
                idx = i + 1;
                rng = 1;
            } else rng += 1;
        }
        res += stoll(S.substr(idx, rng));
    }
    cout << res << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
typedef long long LL;
const double PI = 3.1415926535898;
const double E = 2.718281828459;
const int INF = 0x7fffffff;
const int mod = 1e9 + 7;
const int maxn = 1e5 + 10;
LL a[maxn], b[maxn];
int n;
int main()
{
	LL sum = 0;
	cin >> n;
	for (int i = 0;i < n + 1;i++)
	{
		cin >> a[i];
	}
	for (int i = 0;i < n;i++)
	{
		cin >> b[i];
	}
	for (int i = 0;i < n;i++)
	{
		if (a[i] + a[i + 1] <= b[i])
		{
			sum += a[i] + a[i + 1];
			a[i + 1] = 0;
		}
		else if (a[i] >= b[i])
		{
			sum += b[i];
		}
		else if ((a[i] + a[i + 1] > b[i]) && (a[i] < b[i]))
		{
			sum += b[i];
			a[i + 1] = a[i] + a[i + 1] - b[i];
		}
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 1792
A,B = map(int,input().split())
a1 = A/0.08
a2 = (A+1)/0.08
X = []
for i in range(13,1263):
    if a1<=i<a2:
        X.append(i)
b1 = B/0.1
b2 = (B+1)/0.1
x = -1
for y in X:
    if b1<=y<b2:
        x = y
        break
print(x)

Measured memory_bytes: 38896