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

class Program
{
    public void Proc()
    {
        string[] inpt = Console.ReadLine().Split(' ');
        int a = int.Parse(inpt[0]);
        int b = int.Parse(inpt[1]);
        int c = int.Parse(inpt[2]);

        bool isMatch = (a < b) && (b < c);
        Console.WriteLine(isMatch ? "Yes" : "No");
    }



    static void Main(string[] args)

    {

        Program prg = new Program();
        prg.Proc();

    }
}

Measured memory_bytes: 8784
#include <stdio.h>

int main(void) {
    int P, Q, R;

    scanf("%d %d %d",&P, &Q, &R);

    int abc = P + Q;
    int acb = R + Q;
    int bac = P + R;

    int result;

    if(abc < acb) {
        if(abc < bac) {
            result = abc;
        } else {
            result = bac;
        }
    } else {
        if(acb < bac) {
            result = acb;
        } else {
            result = bac;
        }
    }

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

}

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

typedef long long ll;
const int mxp=2500;

int n,m,s;
vector<pair<int,int>> g[50*(mxp+1)+5];
ll d[50*(mxp+1)+5];
int give[55],cost[55];

inline int id(const int &ver,const int &poss){
    return (ver-1)*(mxp+1)+poss;
}

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin>>n>>m>>s;
    s=min(s,mxp);
    for(int i=1;i<=m;i++){
        int u,v,a,b;
        cin>>u>>v>>a>>b;
        for(int i=a;i<=mxp;i++){
            g[id(u,i)].emplace_back(id(v,i-a),b);
            g[id(v,i)].emplace_back(id(u,i-a),b);
        }
    }
    for(int i=1;i<=n;i++){
        cin>>give[i]>>cost[i];
        give[i]=min(give[i],mxp);
        for(int j=0;j+give[i]<=mxp;j++){
            g[id(i,j)].emplace_back(id(i,j+give[i]),cost[i]);
        }
    }
    priority_queue<pair<ll,int>,vector<pair<ll,int>>,greater<pair<ll,int>>> pq;
    pq.push(make_pair(0,id(1,s)));
    memset(d,0x3f,sizeof(d));
    d[id(1,s)]=0;
    while(!pq.empty()){
        ll cd=pq.top().first;
        int x=pq.top().second;
        pq.pop();
        if(d[x]<cd)continue;
        for(pair<int,int> &p:g[x]){
            if(d[p.first]>d[x]+p.second){
                d[p.first]=d[x]+p.second;
                pq.push(make_pair(d[p.first],p.first));
            }
        }
    }
    for(int i=2;i<=n;i++){
        ll ans=1e18;
        for(int j=0;j<=mxp;j++){
            ans=min(ans,d[id(i,j)]);
        }
        cout<<ans<<endl;
    }

    return 0;
}

Measured memory_bytes: 17472
#include<cstdio>
#include<string>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;

const int N=2.5e5+7;
const int LogN=35;

template <typename _Tp> inline void IN(_Tp&x) {
    char ch;bool flag=0;x=0;
    while(ch=getchar(),!isdigit(ch)) if(ch=='-') flag=1;
    while(isdigit(ch)) x=x*10+ch-'0',ch=getchar();
    if(flag) x=-x;
}

int c[N],d[N],head[N],n,q,tot;
struct Edge {int nxt,to;} G[N<<1];
inline void add(int u,int v) {
	G[++tot]=(Edge){head[u],v},head[u]=tot;
	G[++tot]=(Edge){head[v],u},head[v]=tot;
}

struct Seg_Tree {
    #define mid ((l+r)>>1)
    int root[N],cnt;
    struct Tree{int l,r,d,t;} t[N*65];
    void updata(int&now,int last,int l,int r,int pos,int val) {
        now=++cnt,t[now]=t[last],t[now].d+=val,t[now].t++;
        if(l==r) return;
        if(pos<=mid) updata(t[now].l,t[last].l,l,mid,pos,val);
        else updata(t[now].r,t[last].r,mid+1,r,pos,val);
    }
	void JerryCAKIOI(int&now,int last) {t[now=++cnt]=t[last];}
    pair<int,int> query(int r1,int r2,int r3,int r4,int l,int r,int pos) {
		if(l==r) return make_pair(t[r1].t+t[r2].t-t[r3].t-t[r4].t,t[r1].d+t[r2]
		.d-t[r3].d-t[r4].d);
		if(pos<=mid) return query(t[r1].l,t[r2].l,t[r3].l,t[r4].l,l,mid,pos);
		else return query(t[r1].r,t[r2].r,t[r3].r,t[r4].r,mid+1,r,pos);
    }
	int ask(int r1,int r2,int r3,int r4) {return t[r1].d+t[r2].d-t[r3].d-t[r4].d;}
    #undef mid
}T;

int fa[N][LogN+2],dep[N];
void dfs(int u,int f) {
    if(c[u]) T.updata(T.root[u],T.root[f],1,n,c[u],d[u]);
	else T.JerryCAKIOI(T.root[u],T.root[f]);
    fa[u][0]=f,dep[u]=dep[f]+1;
    for(int i=1;i<=LogN;++i) fa[u][i]=fa[fa[u][i-1]][i-1];
    for(int i=head[u];i;i=G[i].nxt) {
        int v=G[i].to;
        if(v!=f) dfs(v,u);
    }return;
}
inline int Lca(int x,int y) {
    if(x==y) return x;
    if(dep[x]<dep[y]) swap(x,y);
    for(int i=LogN;i>=0;--i) if(dep[fa[x][i]]>=dep[y]) x=fa[x][i];
    if(x==y) return x;
    for(int i=LogN;i>=0;--i) if(fa[x][i]!=fa[y][i]) x=fa[x][i],y=fa[y][i];
    return fa[x][0];
}

int main() {
	IN(n),IN(q);
	int fuck=n;
	for(int i=1;i<fuck;++i) {
		int a,b,x,y;IN(a),IN(b),IN(x),IN(y);
		++n,c[n]=x,d[n]=y,add(a,n),add(n,b);
	}
	dfs(1,0);
	for(int i=1;i<=q;++i) {
		int x,y,u,v;
		IN(x),IN(y),IN(u),IN(v);
		int lca=Lca(u,v),flca=fa[lca][0];
		int ans=T.ask(T.root[u],T.root[v],T.root[lca],T.root[flca]);
		pair<int,int> res=T.query(T.root[u],T.root[v],T.root[lca],T.root[flca],1,n,x);
		ans-=res.second,ans+=res.first*y;
		printf("%d\n",ans);
	}
    return 0;
}

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

int main(){
    
    // 1. 入力情報.
    int h1, m1, h2, m2, k;
    scanf("%d %d %d %d %d", &h1, &m1, &h2, &m2, &k);
    
    // 2. 時間帯の長さは？
    int ans = 60 * h2 + m2 - 60 * h1 - m1 - k;
    
    // 3. 出力.
    printf("%d\n", ans);
    return 0;
    
}

Measured memory_bytes: 3768
#include <bits/stdc++.h>//Carefully Crafted by hetp111
using namespace std;
#define int long long
#define double long double
#define all(v) (v).begin(),(v).end()
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vii vector<pii>
#define MOD 1000000007
#define MOD2 998244353
#define MOD3 1000000009
#define PI acos(-1)
#define eps (1e-8)
#define INF (1e18)
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0)
template<class A,class B>ostream&operator<<(ostream&out,const pair<A,B>&a){return out<<"("<<a.first<<","<<a.second<<")";}
template<class A>ostream&operator<<(ostream&out,const vector<A>&a){for(const A &it:a)out<<it<<" ";return out;}
template<class A,class B>istream&operator>>(istream&in,pair<A,B>&a){return in>>a.first>>a.second;}
template<class A>istream&operator>>(istream&in,vector<A>&a){for(A &i:a)in>>i;return in;}
//ifstream cinn("in.in");ofstream coutt("out.out");
int poww(const int &a,int b,const int &m=MOD){if(b==0)return 1;int x=poww(a,b/2,m);x=x*x%m;if(b&1)x=x*a%m;return x;}
int ceil(const int &a,const int &b){return (a+b-1)/b;}
////Read:
//Check corner cases, n==1;
//
////Some function:
//__builtin_popcountll(), is_sorted(),

int f(const vector<pii> &v){
    int lst=-1;
    int spaces=0;
    multiset<int> add;
    for(auto c:v){
        spaces+=c.first-lst;
        lst=c.first;
        if(spaces>0){
            add.insert(c.second);
            spaces--;
        }else{
            if(!add.empty() && *add.begin()<c.second){
                add.erase(add.begin());
                add.insert(c.second);
            }
        }
    }
    int ans=0;
    for(int i:add)ans+=i;
    return ans;
}

signed main(){
    FASTER;
    int t;cin>>t;
    while(t--){
        vector<pii> L,R;
        int n,ans=0;cin>>n;
        for(int i=0;i<n;i++){
            int k,l,r;cin>>k>>l>>r;k--;
            if(l>=r)L.push_back({k,l-r});      //0 1 2 3 4 5 6 7 8 9
            else R.push_back({n-(k+1)-1,r-l}); //9 8 7 6 5 4 3 2 1 0
            ans+=min(l,r);
        }
        sort(all(L),[](pii a,pii b){
             if(a.first!=b.first)return a.first<b.first;
             return a.second>b.second;
        });
        sort(all(R),[](pii a,pii b){
             if(a.first!=b.first)return a.first<b.first;
             return a.second>b.second;
        });
        cout<<ans+f(R)+f(L)<<"\n";
    }
}



Measured memory_bytes: 11144
#include<bits/stdc++.h>
#define ull unsigned long long
#define ll int64_t 
#define f(i,s,e) for(i=s;i<e;++i)
#define endl << "\n"
#define sp << " "
#define INF INFINITY
#define mset(a,b) memset(a,b,sizeof(a))
#define mod 1000000007
#define mp(a,b) make_pair(a,b)
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define crap ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define PI 3.14159265358979323846264338327950288419716939937510
#define pb(a) push_back(a)
#define pf(a) push_front(a)

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
using namespace std;

int main()
{
	crap;
	ll i,j,k,n;
	cin >> n;
	vector <ll> arr(n);
	f(i,0,n)
		cin >> arr[i];
	ll count = 0;
	f(i,0,n)
		if(!(i&1) && (arr[i]&1))
			count++ ;
	cout << count endl ;
	return 0;
}
 
/*
If u haven't come up with an approach yet ,skip this one
  Try this when feeling stuck -
  1. Int overflow, array bounds
  2. Special cases (n=1?)
  3. Prove your approach to yourself(mathematical induction,counter-intuitive or stronger test cases)
  4. Calm down and don't look at standings and stop thinking about rating and think about the question
  5. Just do it! 
*/ 

//Benq's advice - 
/* 
	And following advices are must for me -
	* do something instead of nothing and stay organized
	* WRITE STUFF DOWN 
*/

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
const int dx[]={1,0,-1,0,1,-1,-1,1,0};
const int dy[]={0,1,0,-1,1,1,-1,-1,0};
const int INF = 1e9;
const long long LINF = 1e18;
const double EPS = 1e-8;
#define pb push_back
#define mk make_pair
#define fr first
#define sc second
#define reps(i,j,k) for(int i = (j); i < (k); ++i)
#define rep(i,j) reps(i,0,j)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
typedef long long ll;
typedef pair<ll,ll> Pii;
typedef pair<Pii,int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
template<class T>
ostream& operator<<(ostream &out, const vector<T> &v){
	out << "{";
	rep(i,v.size()){
		out << v[i] <<", ";
	}
	return out << "}" << endl;
}

int main() {
	ll N, A, B;
	cin >> N >> A >> B;
	ll prev = 1;
	vector<ll> s;
	rep(i,N){
		ll t;
		cin >> t;
		if(i != 0){
			s.pb(A*(t-prev));
		}
		prev = t;
	}
	ll sum = 0;
	rep(i,s.size()){
		sum += s[i];
	}
	sort(s.rbegin(),s.rend());

	rep(i,s.size()){
		if(s[i] > B){
			sum -= s[i];
			sum += B;
		}
	}

	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
#define ll  long long int
#define fast    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mod 1000000007
using namespace std;
ll h,w, ch, cw, dh, dw;
char arr[1000+5][1000+5];
ll dp[1000+5][1000+5];
bool vis[1000+1][1000+1];

ll recur(ll i, ll j, ll k){
priority_queue< pair<ll,pair<ll,ll> >, vector< pair<ll, pair<ll,ll>> >, greater< pair<ll, pair<ll,ll> > > > pq;

pq.push({k, {ch, cw}});
while(!pq.empty()){
    auto u = pq.top();
            pq.pop();

    i=u.second.first;
    j=u.second.second;

    if(i<1 ||  j<1 || i> h || j>w)
        continue;

    if(arr[i][j] =='#')
    continue;

    if(u.second.first==dh && u.second.second == dw)
        return u.first;    

    if(arr[i+1][j]!= '#'&& (dp[i+1][j]==-1 || dp[i+1][j] > dp[i][j])){
        pq.push({u.first, {i+1,j} });
        dp[i+1][j] = dp[i][j];
    }
    
    if(arr[i][j+1]!= '#'&& (dp[i][j+1]==-1 || dp[i][j+1] > dp[i][j])){
        pq.push({u.first, {i,j+1} });
        dp[i][j+1] = dp[i][j];
        }

    if(arr[i-1][j]!= '#' && (dp[i-1][j]==-1 || dp[i-1][j] > dp[i][j])){
        pq.push({u.first, {i-1,j} });
        dp[i-1][j] = dp[i][j];
        }

    if(arr[i][j-1]!= '#' && (dp[i][j-1]==-1 || dp[i][j-1] > dp[i][j])){
        pq.push({u.first, {i,j-1} });
        dp[i][j-1] = dp[i][j];
    }

    for(ll x=-2; x<=2; x++)
        for(ll y=-2; y<=2;y++){
            ll i1 = x+i, j1 = y + j;
            if(i1<1 ||  j1<1 || i1> h || j1>w)
                continue;

                if(arr[i1][j1]!='#' && (dp[i1][j1]== -1 || dp[i1][j1]>dp[i][j]+1))
                    {pq.push({dp[i][j]+1, {i1, j1} });
                        dp[i1][j1] = dp[i][j]+1;
                        
                    }

        }
}

return -1;
}



int main()
    {fast;
    ll t =1;
    //cin>>t;

while(t--){
    memset(dp,-1,sizeof(dp));
    memset(vis, 0, sizeof(vis));

    cin>>h>>w>>ch>>cw>>dh>>dw;

        for(ll i=1; i<=h; i++)
            for(ll j=1; j<=w; j++)
                cin>>arr[i][j];

        cout<<recur(ch,cw, 0)<<endl;
         //   for(ll i=1; i<=h; i++){
         //   for(ll j=1; j<=w; j++)
          //      cout<<dp[i][j]<<' ';
        //    cout<<endl;}


}
        return 0;
}

Measured memory_bytes: 13600
class UnionFind():
    # 作りたい要素数nで初期化
    # 使用するインスタンス変数の初期化
    def __init__(self, n):
        self.n = n
        # root[x]<0ならそのノードが根かつその値が木の要素数
        # rootノードでその木の要素数を記録する
        self.root = [-1]*(n+1)
        # 木をくっつける時にアンバランスにならないように調整する
        self.rnk = [0]*(n+1)

    # ノードxのrootノードを見つける
    def Find_Root(self, x):
        if(self.root[x] < 0):
            return x
        else:
            # ここで代入しておくことで、後の繰り返しを避ける
            self.root[x] = self.Find_Root(self.root[x])
            return self.root[x]
    # 木の併合、入力は併合したい各ノード
    def Unite(self, x, y):
        # 入力ノードのrootノードを見つける
        x = self.Find_Root(x)
        y = self.Find_Root(y)
        # すでに同じ木に属していた場合
        if(x == y):
            return 
        # 違う木に属していた場合rnkを見てくっつける方を決める
        elif(self.rnk[x] > self.rnk[y]):
            self.root[x] += self.root[y]
            self.root[y] = x

        else:
            self.root[y] += self.root[x]
            self.root[x] = y
            # rnkが同じ（深さに差がない場合）は1増やす
            if(self.rnk[x] == self.rnk[y]):
                self.rnk[y] += 1
    # xとyが同じグループに属するか判断
    def isSameGroup(self, x, y):
        return self.Find_Root(x) == self.Find_Root(y)

    # ノードxが属する木のサイズを返す
    def Count(self, x):
        return -self.root[self.Find_Root(x)]

n,m=map(int,input().split())
p=list(map(int,input().split()))
l=[list(map(int,input().split())) for _ in range(m)]
UF=UnionFind(n)
for i in l:
    UF.Unite(i[0],i[1])
ans=0
for i in range(n):
    if UF.isSameGroup(i+1,p[i]):ans+=1
print(ans)

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

/* using */
using namespace std;

/* main constructor */
struct Fast
{
    Fast()
    {
        std::cin.tie(0);
        ios::sync_with_stdio(0);
        //cout << fixed << setprecision(12);
    }
} fast;

/* template */
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;
}

/* define */
#define REP(i, x, n) for (int i = x; i < (int)(n); ++i)
#define RREP(i, x, n) for (int i = x - 1; i >= (int)(n); --i)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) REP(i, 1, n + 1)
#define rrep(i, n) RREP(i, n, 0)
#define each(i, n) for (auto &i : n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define eunique(x) (x).erase(unique(all(x)), (x).end())
//#define int long long

/* function */
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }

/* const */
const int inf = 1e9 + 7;

/* main */
signed main(void)
{
    int k, s, cnt = 0;
    cin >> k >> s;
    for (int i = 0; i <= k; i++)
    {
        for (int j = 0; j <= k; j++)
        {
            if (0 <= s - i - j && s - i - j <= k)
            {
                cnt++;
            }
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
IDENTIFICATION                   DIVISION.
PROGRAM-ID.                      ABC_069_B.
ENVIRONMENT                      DIVISION.
DATA                             DIVISION.
WORKING-STORAGE                  SECTION.
    01 s      PIC X(100).
    01 tmp    PIC X(4).
    01 len    PIC 9(3).

    01 ZS     PIC Z(3).
    01 DUMMY  PIC X(1).

    01 tmpl   PIC 9(2).
    01 l      PIC X(2).

PROCEDURE                        DIVISION.
MAIN.
    ACCEPT s.

    MOVE FUNCTION STORED-CHAR-LENGTH(s) TO len.

    SUBTRACT 2 FROM len GIVING tmpl.

    MOVE tmpl TO ZS.

    PERFORM UNLEN.

    STRING
        s(1:1)
        l(1:FUNCTION STORED-CHAR-LENGTH(l))
        s(len:1)
        INTO tmp
    END-STRING.

    DISPLAY tmp.
    STOP RUN.

UNLEN                            SECTION.
    UNSTRING
        ZS DELIMITED BY ALL SPACE
        INTO DUMMY l
    END-UNSTRING.


Measured memory_bytes: 384
def examA():
    S = SI(); N = len(S)
    T = "CODEFESTIVAL2016"
    ans = 0
    for i in range(N):
        if S[i]!=T[i]:
            ans +=1
    print(ans)
    return

def examB():
    N, A, B = LI()
    S = SI()
    d = defaultdict(int)
    for s in S:
        if s=="a":
            if d["a"]+d["b"]<A+B:
                print("Yes")
                d[s] += 1
            else:
                print("No")
        elif s=="b":
            if d["a"]+d["b"]<A+B and d["b"]<B:
                print("Yes")
                d[s] += 1
            else:
                print("No")
        else:
            print("No")
    return

def examC():
    W, H = LI()
    P = [I() for _ in range(W)]; P.sort()
    Q = [I() for _ in range(H)]; Q.sort()
    dh = 0; dw = 0
    p = 0; q = 0
    ans = 0
    for i in range(H+W):
        if (q<H and p<W and P[p]<Q[q]) or not q<H:
            ans += P[p]*(H+1-dh)
            p +=1; dw +=1
        else:
            ans += Q[q]*(W+1-dw)
            q +=1; dh+=1
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,ALPHABET, _ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 1e-9
alphabet = [chr(ord('a') + i) for i in range(26)]
ALPHABET = [chr(ord('A') + i) for i in range(26)]

if __name__ == '__main__':
    examC()


Measured memory_bytes: 12168
// ALDS1_11_B
#include <iostream>
#include <vector>
using namespace std;

void DFS(vector<vector<int> > A, vector<int> &d, vector<int> &f, vector<int> &visit, int &t, int v){
	
	visit[v] = 1;
	d[v] = t++;

	for(int i=0;i<A[v].size();i++)
		if((A[v][i] == 1) && (visit[i] == 0))
			DFS(A, d, f, visit, t, i);

	f[v] = t++;
}

int main(){
	int n, u, k, t=1;
	vector<vector<int> > A;
	vector<int> d, f, visit;

	cin>>n;
	A.resize(n);
	d.resize(n);
	f.resize(n);
	for(int i=0;i<n;i++){
		A[i].resize(n);
		visit.push_back(0);
	}

	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;
		int v;
		
		for(int j=0;j<k;j++){
			cin>>v;
			A[u-1][v-1] = 1;
		}
	}

	for(int i=0;i<n;i++)
		if(!visit[i])
			DFS(A, d, f, visit, t, i);
	
	for(int i=0;i<n;i++)
		cout<<i+1<<" "<<d[i]<<" "<<f[i]<<endl;

	return 0;
}

Measured memory_bytes: 5512
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main(){
    int K;
    string S;

    cin >> K;
    cin >> S;

    string ans = "";
    if(S.size() <=K ){
        ans = S;
    }else{
        for(int i=0; i<K; ++i){
            ans += S[i];
        }
        ans += "...";
    }

    cout << ans << endl;
}

Measured memory_bytes: 3628
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a,b,x;
    cin>>a>>b;
    int ac[a][b] ,bc[b];
    for(int i = 0;i<a;i++){
        for(int u = 0;u<b;u++){
            cin>>ac[i][u];
        }
    }
  
    
    for(int k = 0;k<b;k++){
        cin>>bc[k];
    }
    for(int i = 0;i<a;i++){
        for(int u = 0;u<b;u++){
            x += ac[i][u]*bc[u];
        }
        cout<<x<<endl;
        x = 0;
    }
}



Measured memory_bytes: 3104
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
//const ll mod=998244353;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

ll mod;

ll f(int n,int m){
	vl dp(m+1);
	dp[0]++;
	for(int i=0;i<n;i++){
		vl DP(m+1);
		for(int j=0;j<m;j++){
			(DP[0]+=dp[j])%=mod;
			(DP[j+1]+=dp[j])%=mod;
		}
		DP[m]=0;
		dp=DP;
	}
	ll t=0;
	for(auto i:dp) (t+=i)%=mod;
	return t;
}

const int M=200;

int n,m;
ll two[M];

int main(){
	cin>>n>>m>>mod;
	two[0]=1;
	for(int i=1;i<M;i++) two[i]=two[i-1]*2%mod;
	if(m%2==0){
		m=(m+2)/2;
		cout<<f((n+1)/2,m)*f(n/2,m)%mod<<endl;
		return 0;
	}
	if(m==1){
		cout<<f(n,3)<<endl;
		return 0;
	}
	if(n==m){
		cout<<two[n]<<endl;
		return 0;
	}
	vvl dp(m+2,vl(m+2));
	for(int i=0;i<=m/2;i++) dp[i][0]=two[max(0,m/2-i-1)];
	for(int i=m/2+1;i<=n/2;i++){
		vvl DP(m+2,vl(m+2));
		for(int j=0;j<m+2;j++) for(int k=0;k<m+2;k++) if(dp[j][k]){
			int t=min(m+1,j+1);
			(DP[0][0]+=dp[j][k])%=mod;
			(DP[t][0]+=dp[j][k])%=mod;
			if(k>1) (DP[0][k-1]+=dp[j][k])%=mod;
			if(!k) (DP[0][0]+=dp[j][k])%=mod;
			if(k>1) (DP[t][k-1]+=dp[j][k])%=mod;
			if(!k&&m+1-t>0) (DP[t][m+1-t]+=dp[j][k])%=mod;
		}
		dp=DP;
	}
	ll res=0;
	for(int i=0;i<m+2;i++) for(int j=0;j<m+2;j++) if(dp[i][j]){
		int len=m/2+n%2;
		int t=(j>len?0:j);
		(res+=dp[i][j]*(t?two[t]-1:1)%mod*two[len-t])%=mod;
	}
	cout<<res<<endl;
}

Measured memory_bytes: 640
use std::collections::HashMap;
use std::io::*;
use std::str::FromStr;

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
                        .bytes()
                        .map(|c| c.expect("failed to read char") as char)
                        .skip_while(|c| c.is_whitespace())
                        .take_while(|c| !c.is_whitespace())
                        .collect();

    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n = read::<usize>();
    let s = read::<String>().chars().collect::<Vec<char>>();
    let mut cnts = HashMap::<(Vec<char>, Vec<char>), usize>::new();
    for i in 0..(1 << n) {
        let mut red = vec![];
        let mut blue = vec![];
        for j in 0..n {
            if((i >> j) & 1) == 1 {
                red.push(s[n+j]);
            } else {
                blue.push(s[n+j]);
            }
        }
        *cnts.entry((red, blue)).or_insert(0) += 1;
    }

    let mut ans = 0;
    for i in 0..1 << n {
        let mut red = vec![];
        let mut blue = vec![];
        for j in 0..n {
            if ((i >> j) & 1) == 1 {
                red.push(s[j]);
            } else {
                blue.push(s[j]);
            }
        }
        red.reverse();
        blue.reverse();
        if cnts.contains_key(&(blue.clone(), red.clone())) {
            ans += cnts[&(blue, red)];
        }
    }
    println!("{}", ans);
}


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

static class Program
{
    static void Main()
    {
        RepeatInfinite<Func<string>>( Console.ReadLine )
            .Select( x => x() )
            .TakeWhile( x => x != "0,0" )
            .Select( x => Array.ConvertAll( x.Split( ',' ), int.Parse ) )
            .Aggregate(
                new { p = new[] { 0d, 0d }, t = 0d },
                (x, y) => new { 
                    p = new[] {
                        x.p[0] + y[0] * Math.Sin( x.t ),
                        x.p[1] + y[0] * Math.Cos( x.t ), },
                    t = x.t + y[1] / 180d * Math.PI, },
                x => x.p )
            .Select( x => (int)x )
            .ToList()
            .ForEach( Console.WriteLine );
    }

    static IEnumerable<TSource> RepeatInfinite<TSource>(TSource source)
    {
        while ( true )
            yield return source;
    }
}

Measured memory_bytes: 5960
def solve(string):
    n, *h = map(int, string.split())
    curr = None
    for _h in h[::-1]:
        if curr is None:
            curr = _h
            continue
        if _h <= curr:
            curr = _h
            continue
        if _h - 1 == curr:
            continue
        return "No"
    return "Yes"


if __name__ == '__main__':
    print(solve('\n'.join([input(), input()])))


Measured memory_bytes: 15172
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 2000000000
struct edge{
	int to,cost;
	edge(int a,int b):to(a),cost(b){}
};
vector<edge>az[25];
int V;
int d[25];
void dijkstra(int s){
	priority_queue<P,vector<P>,greater<P> > que;
	que.push(mp(0,s));
	fill(d,d+(V+1),INF);
	d[s]=0;
	while(!que.empty()){
		P p=que.top(); que.pop();
		if(d[p.second]<p.first) continue;
		for(int y=0;y<az[p.second].size();y++){
			edge e=az[p.second][y];
			if(d[e.to]>d[p.second]+e.cost){
				d[e.to]=d[p.second]+e.cost;
				que.push(mp(d[e.to],e.to));
			}
		}
	}
}
int main(){
	int m;
	scanf("%d %d",&V,&m);
	for(int i=0;i<m;i++){
		int aa,bb,cc,dd;
		scanf("%d,%d,%d,%d",&aa,&bb,&cc,&dd);
		az[aa].pb(edge(bb,cc));
		az[bb].pb(edge(aa,dd));
	}
	int st,en,total,cut;
	scanf("%d,%d,%d,%d",&st,&en,&total,&cut);
	dijkstra(st);
	total-=d[en];
	dijkstra(en);
	total-=d[st];
	total-=cut;
	printf("%d\n",total);
}

Measured memory_bytes: 1188
#include<iostream>
#include<algorithm>
#include<math.h>
#include<cstdio>
#include<ctype.h>
#include<stdio.h>
#include<set>
#include<vector>
#include<map>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<numeric>
#include<string>
typedef long long ll;
using namespace std;

ll gcd(ll a, ll b){
if(a<b){return gcd(b,a);}
else if(a%b){return gcd(b,a%b);}
else{return b;}
}
int main(){
  ll N;
  cin>>N;
  for(int i=0; i<=6; ++i){
  if(N>=pow(2,i)&&N<pow(2,i+1))
  cout<<pow(2,i)<<endl;
  }
  }
  
  
  

  
  

 


Measured memory_bytes: 512
import heapq
n, m = map(int, input().split())
ab = []
for _ in range(n):
    ab.append(list(map(int, input().split())))

ab.sort(key=lambda x:x[0])

heap = []
ind = 0
ans = 0
for i in range(1, m+1):
    while ind<len(ab):
        if ab[ind][0]==i:
            heapq.heappush(heap, -ab[ind][1])
            ind += 1
        else:
            break
    if len(heap)>0:
        ans += heapq.heappop(heap)
    elif ind==len(ab)-1:
        break
print(-ans)

Measured memory_bytes: 31932
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		int[]h = new int[n];
		for(int i = 0; i < n; i++) {
			h[i] = stdIn.nextInt();
		}
		if(n==1) {
			System.out.println("Yes");
			System.exit(0);
		}
		int max = 0;
		
		for(int i = 0; i < n-1; i++) {
			if(max == h[i]) {
				if(h[i] > h[i+1]) {
					System.out.println("No");
					System.exit(0);
				}
			}
			if(h[i]-1 > h[i+1]) {
				System.out.println("No");
				System.exit(0);
			}
			h[i]--;
			max = Math.max(h[i], max);
		}
		System.out.println("Yes");
		
	}

}


Measured memory_bytes: 49124
/* Just_Do_It ___________ICARUS__________________*/
                     
    #include <bits/stdc++.h>
    using namespace std;
           
    typedef long long ll;
    #define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    #define rep(i,a,n) for(int i=a;i<n;i++)
    #define per(i,n,a) for (int i=n;i>a;i--)
    #define te int t; std::cin >> t; while(t--)
    #define SZ 200010
    //# define M_PIl  3.141592653589793238462643383279502884L 
    /*   Proceed with CAUTION   */

    int main(){
        fastio;
        ll n,m,x,y,r,l;
        cin>>n>>m>>x>>y;
        ll a[n],b[m];
        rep(i,0,n) cin>>a[i];
        rep(i,0,m) cin>>b[i];
        sort(a,a+n);
        sort(b,b+m);
        l = a[n-1]; r = b[0];
       // cout<<l<<" "<<r<<endl;
        if(l>=r || x>=y || r<=x || y<=l){
        	cout<<"War"<<endl;
        	return 0;
        }
        cout<<"No War"<<endl;
    }	

Measured memory_bytes: 256
N = r = int(input())
l = 0
print(0)
S = input()
if S == "Vacant":
    exit()
while l < r - 1:
    m = (l + r) // 2
    print(m)
    s = input()
    if s == "Vacant":
        exit()
    if l & 1 == m & 1 and S == s or l & 1 != m & 1 and S != s:
        l = m
        S = s
    else:
        r = m
print(l)
input()
exit()

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

int main() {
	vector<long long> v(3);
	for(auto &i : v) cin>>i;
	sort(v.begin(),v.end());
	long long ans=0;
	if(v[1]&2==0||v[0]%2==0||v[2]%2==0){
	    cout<<0<<"\n";
	    return 0;
	}
	
	   cout<<v[0]*v[1]<<"\n";


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
/*
分岐の処理をどうするか
x軸y軸それぞれにプラマイ自由にできるか
最初のTまでだけ固定
わけられた数字のパーツあわせてxyにできるかどうか

2 3 5 7
8をつくる
せいぜい8000まで
mapとか8000*8000
*/
int main(){
  string S; cin>>S;
  ll X,Y; cin>>X>>Y;
  ll ssz=S.size(), i=0, tmp=0;
  vector<ll> A(0,0), B(0,0);
  map<ll,bool> M1,M2,M3,M4;
  bool row=false;
  while(S[i]=='F' && i<ssz){
    X--;
    i++;
  }
  i++;
  while(i<ssz){
    if(S[i]=='T'){
      if(tmp>0) (row)?A.emplace_back(tmp):B.emplace_back(tmp);   
      row=(row)?false:true;
      tmp=0;
    }
    else tmp++;
    i++;
  }
  if(tmp>0) (row)?A.emplace_back(tmp):B.emplace_back(tmp);    
  M2[0]=true;
  ll asz=A.size(), bsz=B.size();
//cout<<"a:"<<asz<<" b:"<<bsz;  
  for(i=0; i<asz; i++){
    M1=M2;
    M2.clear();
    for(auto v:M1){
      ll v1=v.first;
      M2[v1+A[i]]=true;
      M2[v1-A[i]]=true;
    }
  }
  M4[0]=true;
  for(i=0; i<bsz; i++){
    M3=M4;
    M4.clear();
    for(auto v:M3){
      ll v1=v.first;
      M4[v1+B[i]]=true;
      M4[v1-B[i]]=true;
    }
  }
  if(M2[X] && M4[Y]) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;

//cout<<endl;
//for(auto v:A)cout<<v<<" ";
//cout<<endl;
//for(auto v:B)cout<<v<<" ";

}

Measured memory_bytes: 1280
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <array>
#include <cstdio>
#include <cstdlib>

using namespace std;

const int NMMAX = 50;

int main()
{
    int N, M;
    if (scanf("%d%d", &N, &M) < 2) return 0;

    array<int, NMMAX> a;
    array<int, NMMAX> b;
    array<int, NMMAX> c;
    array<int, NMMAX> d;

    for (int i = 0; i < N; i++)
    {
        if (scanf("%d%d", &a[i], &b[i]) < 2) return 0;
    }

    for (int j = 0; j < M; j++)
    {
        if (scanf("%d%d", &c[j], &d[j]) < 2) return 0;
    }

    for (int i = 0; i < N; i++)
    {
        int cp = 0;
        int dist = 1000000000;
        for (int j = 0; j < M; j++)
        {
            int tmp = abs(a[i] - c[j]) + abs(b[i] - d[j]);
            if (tmp < dist)
            {
                dist = tmp;
                cp = j;
            }
        }
        printf("%d\n", cp + 1);
    }

    return 0;
}


Measured memory_bytes: 128
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <iterator>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>

using namespace std;

#define dump(n) cerr<<"# "<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();++i)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int,int> pii;

struct SegTree{
	vi data;
	int size;
	SegTree(int _size){
		for(int i=1;;i*=2)
			if(i>=_size){
				size=i;
				break;
			}
		data.assign(size*2,0);
	}
	void add(int i,int x){
		for(int j=size+i;j;j/=2)
			data[j]+=x;
	}
	int sum(int a,int b,int i,int l,int r){
		if(r<=a || b<=l) return 0;
		if(a<=l && r<=b) return data[i];
		int m=(a+b)/2,res=0;
		if(a<m) res+=sum(a,b,i*2+0,l,m);
		if(m<b) res+=sum(a,b,i*2+1,m,r);
		return res;
	}
	int ith(int i){
		int j=1;
		while(j<size){
			if(data[j*2+0]>i)
				j=j*2+0;
			else{
				i-=data[j*2+0];
				j=j*2+1;
			}
		}
		return j-size;
	}
};

int main()
{
	for(int q,l;cin>>q>>l,q|l;){
		SegTree st(q);
		vi girls;
		map<int,int> m;
		rep(i,q){
			int qu,x; cin>>qu>>x;
			if(qu==0){
				st.add(girls.size(),1);
				m[x]=girls.size();
				girls.push_back(x);
				if(st.data[1]>l){
					int j=st.ith(0);
					st.add(j,-1);
				}
			}
			if(qu==1){
				int j=st.ith(x-1);
				st.add(j,-1);
			}
			if(qu==2){
				int j=st.ith(x-1);
				cout<<girls[j]<<endl;
			}
			if(qu==3){
				int j=m[x];
				st.add(j,-1);
			}
		}
		puts("end");
	}
	
	return 0;
}

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

int main ()
{
  int64_t n, d, a, b, res=0; cin >> n >> d;
  
  map<int64_t,int64_t>mymap;
  
  for (int64_t i=0; i<n; i++)
  {
    cin >> a >> b;
    int64_t ans =(pow(a,2) + pow(b,2));
    if (sqrt(ans) <= d ) res++;
  }
  cout << res << endl;
  
}


Measured memory_bytes: 3612
import java.util.Scanner;

public class Main {
	  
	public static void main(String args[]) {
		    Scanner scanner = new Scanner(System.in);
		   
			int N = scanner.nextInt();
			int count = 0;
			
			
			if( N >= 105 ) 
			{
				count++;
			}
			if( N >= 135 ) 
			{
				count++;
			}
			if( N >= 165 ) 
			{
				count++;
			}
			if( N >= 189 ) 
			{
				count++;
			}
			if( N >= 195 ) 
			{
				count++;
			}
			
			System.out.println(count);
			
		    scanner.close(); }
		  }

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

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


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

int main() {
	int A,B,C,D,c1,c2;
	cin >> A >> B >> C >> D;

	c1 = A/D+((A%D)?1:0);
	c2 = C/B+((C%B)?1:0);

	if(c1 >= c2)
		cout << "Yes";
	else
		cout << "No";
	cout << endl;
}

Measured memory_bytes: 3596
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pqueue priority_queue
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  string S;
  cin>>S;
  string ans;
  for(int i=0;i<S.size();++i) {
    if(i%2==0) ans += S[i];
  }
  cout<<ans<<endl;
}



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



int main(){
  ll n;
  cin >> n;
  ll ans=n/25;
  n=n%25;
  if(n!=0)ans+=n/10;
  n=n%10;
  if(n!=0)ans+=n/5;
  n=n%5;
  ans+=n;
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 3108
/*input
7 8
1 2
1 3
2 4
3 5
3 6
4 7
5 7
6 7
*/
#include <bits/stdc++.h>
#define up(i,a,b) for(int (i) = (a);(i)<=(b);++(i))
#define down(i,b,a) for(int (i) = (b);i>=(a);--i)
#define bits(x,i) ((x >> i) & 1)
#define mid ((l+r)/2)
#define pr pair<int,int>
using namespace std;
const int N = 605;
long double E[N];
bool ok[N];
vector<int> G[N];
int n,m;
long double ans = 1005;
void solve(int block){
	E[n] = 0;
	for(int u=n-1;u>=1;--u){
		long double sum = 0, maxChild = 0;
		int num = G[u].size();
		for (auto v : G[u]){
			sum += E[v];
			maxChild = max(maxChild, E[v]);
		}
		if (u == block && num >= 2){
			sum-=maxChild;
			num--;
		}
		E[u] = sum/num + 1;
	}
	ans = min(ans, E[1]);
}
int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin >> n >> m;
	up(i,1,m){
		int u,v; cin >> u >> v;
		G[u].push_back(v);
	}
	for(int i=0;i<n;++i) solve(i);
	cout << fixed << setprecision(6) << ans;
	// dfs(1);
}

Measured memory_bytes: 4872
#include <iostream>
#include <string>
#include <sstream>
#include <utility>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <cmath>
#include <functional>
#include <chrono>
#include <cstring>
#include <bits/stdc++.h>

using namespace std;
typedef long long lint;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<lint> vl;
typedef pair<lint,lint> pll;
#define mpr make_pair

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

    int n; cin>>n;
    vi a(n);
    int cnt = 0;
    for (int i = 1; i<=n; ++i){
        int a; cin>>a;
        if (i%2 && a%2) cnt++;
    }
    cout<<cnt;

}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan0
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














int N, K, p[1010];
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> N >> K;
	rep(i, 0, N) cin >> p[i];

	int ans = 0;
	sort(p, p + N);
	rep(i, 0, K) ans += p[i];
	cout << ans << endl;
}







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

int main(){
  int X, Y;
  cin >> X >> Y;
  int Ans=max(0, 400000-X*100000)+max(0, 400000-Y*100000);
  if(X==1 && Y==1){
    Ans+=400000;
  }
  cout << Ans << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using static System.Math;
using static System.Array;
using static AtCoderSolve.Tool;

namespace AtCoderSolve
{
    class Solve
    {
        const int mod = 1000000007;
        const int INF = int.MaxValue / 2;
        const long SINF = long.MaxValue / 2;


        static void Main(string[] args)
        {
            //var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            //Console.SetOut(sw);
            var cin = new Scanner();

            string s = Console.ReadLine();
            Console.WriteLine(s.Length == 2 ? s : $"{s[2]}{s[1]}{s[0]}");

            //Console.Out.Flush();
        }


    }

    public class Scanner
    {
        public int[] SplitReader()
        {
            int[] array = Console.ReadLine().Split().Select(int.Parse).ToArray();
            return array;
        }
        public long[] SplitReaderL()
        {
            long[] array = Console.ReadLine().Split().Select(long.Parse).ToArray();
            return array;
        }
    }

    public static class Tool
    {
        static public void Initialize<T>(ref T[] array, T initialvalue)
        {
            for(var i = 0; i < array.Length; i++)
            {
                array[i] = initialvalue;
            }
        }
        static public long ModuloP(long value,long mod)
        {
            long r = value % mod;
            
            if (r * mod < 0)
            {
                r += mod;
            }
            return r;
        }

    }

    struct Pair<T> : IComparable<Pair<T>> where T : IComparable<T>
    {
        public T variable;
        public int index;

        public Pair(T val, int i)
        {
            variable = val;
            index = i;
        }

        public int CompareTo(Pair<T> otherPair)
        {
            return variable.CompareTo(otherPair.variable);
        }

        public int CompareIndex(Pair<T> otherPair)
        {
            return index.CompareTo(otherPair.index);
        }
    }



}






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

#define vec                vector<int>
#define vecll              vector<ll>
#define vecst              vector<string>
#define vecb               vector<bool>
#define vec2(var, n, m)    vector<vector<int>> var(n, vector<int>(m, 0))
#define vecll2(var, n, m)  vector<vector<ll>> var(n, vector<ll>(m, 0))

#define rep(i,n)         for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n)       for(ll i=(ll)m; i<(ll)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define arrst(var, n)    vecst var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define uniqueall(v)     v.erase(unique(v.begin(), v.end()), v.end());
#define f_sum(var)       accumulate(all(var), 0)
#define f_sumll(var)     accumulate(all(var), 0LL)
#define chmin(v1, v2)    v1 = min(v1, v2)
#define chmax(v1, v2)    v1 = max(v1, v2)
#define mp(v1, v2)       make_pair(v1, v2)
#define pb(var)          push_back(var)
#define prt(var)         cout << (var) << "\n"
#define prtd(n, var)     cout << fixed << setprecision(n) << var << "\n"
#define prtfill(n, var)  cout << setw(n) << setfill('0') << var;
#define prt2(v1, v2)     cout << v1 << " " << v2 << "\n"
#define prt3(v1, v2, v3) cout << v1 << " " << v2 << " " << v3 << "\n"
#define prtall(v)        rep(i,v.size()){cout<<v[i]<<(i!=v.size()-1?" ":"\n");}
void prtok(bool ok){prt(ok ? "yes" : "no");}
//----------------------------------------------------------------

int main(void) {
  ll n, m;
  cin >> n >> m;

  ll ans=1;
  if(abs(n-m)>1){
    ans=0;
  }

  if(abs(n-m)==1){
    rep(i,m){
      ans*=(i+1);
      ans%=MOD;
    }
    rep(i,n){
      ans*=(i+1);
      ans%=MOD;
    }
  }
  if(abs(n-m)==0){
    rep(i,m){
      ans*=(i+1);
      ans%=MOD;
    }
    rep(i,n){
      ans*=(i+1);
      ans%=MOD;
    }
    ans*=2;
    ans%=MOD;
  }

  prt(ans);

}


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

using namespace std;

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

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

int main(){
  int N, M;
  cin >> N;
  
  map<string, int> str;
  string s;
  for (int i = 0; i < N; i++){
    cin >> s;
    str[s] ++;
  }
  
  cin >> M;
  for (int i = 0; i < M; i++){
    cin >> s;
    str[s] --;
  }
  
  int ans = 0;
  for (auto i = str.begin(); i != str.end(); i++){
    if (ans < i->second){
      ans = i->second;
    }
  }
  if (ans < 0){
    ans = 0;
  }
  cout << ans << endl;
}


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

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
#define dump(x) cout << #x << " = " << (x) << endl
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

template<class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

template<class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
	os<<"{";
	rep(i, v.size()) {
		if (i) os<<",";
		os<<v[i];
	}
	os<<"}";
	return os;
}

inline void chmin(ll &x, ll y) { if (x >= y) x = y; }

ll dp[5010][5010];
const ll INF = TEN(18);

int main() {
	int N; ll A, B;
	cin >> N >> A >> B;
	vi p(N);

	rep(i, N) {
		cin >> p[i];
	}

	rep(i, 5010) {
		rep(j, 5010) {
			dp[i][j] = INF;
		}
	}

	dp[0][p[0]] = 0;
	dp[0][0] = A;

	for (int i = 1; i < N; ++i) {
		dp[i][p[i]] = A * i;
		rep(j, 5010) if (dp[i-1][j] != INF) { //skip
			chmin(dp[i][j], dp[i-1][j] + (p[i] < j ? B : A));
		}
		//fix
		rep(j, p[i]) {
			chmin(dp[i][p[i]], dp[i-1][j]);
		}
	}

	ll mini = INF;
	rep(j, 5010) chmin(mini, dp[N-1][j]);
	cout << mini << endl;
	return 0;
}

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

long long solve(string S) {
  long long cnt = 0, ret = 0;
  for(int i = 0; i < S.size(); i++) {
    cnt++;
    if(i == S.size() - 1 || S[i] != S[i+1]) {
      ret += cnt / 2;
      cnt = 0;
    }
  }
  return ret;
}

int main() {
  string S; cin >> S;
  int K; cin >> K;
  long long ans;
  if(string(S.size(), S[0]) == S) {
    ans = (S.size()) * K / 2LL;
  } else {
    string S1 = S + S;
    long long cnt1 = solve(S);
    long long cnt2 = solve(S1);
    ans = cnt1 + (cnt2 - cnt1) * (K-1LL);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e3+5;
const int mod=1e9+7;

int n,m;
char mp[maxn][maxn];
long long dp[maxn][maxn];

int main()
{
	dp[1][1]=1;
	cin>>n>>m;
	int i,j;
	for( i=1;i<=n;i++)
	{
		for( j=1;j<=m;j++)
		{
		cin>>mp[i][j];
		
		if(mp[i-1][j]=='.') dp[i][j]+=dp[i-1][j] ;
		if(mp[i][j-1]=='.') dp[i][j]+=dp[i][j-1] ;
		
		dp[i][j]%=mod;
		}
	}
	cout<<dp[n][m]<<endl;
	return 0;
}


Measured memory_bytes: 12460
import math
count = 0  
k = int(input())
for a in range(1,k+1):
  for b in range(a,k+1):
    for c in range(b,k+1):
      d = math.gcd(a,b)
      e = math.gcd(d,c)
      if a==b==c:
        count+=e
      elif a==b or b==c or c==a:
        count+=e*3
      else:
        count+=e*6
print(count)

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

std::string A;
std::string B;
std::string C;
int length_a;
int length_b;
int length_c;

int main()
{
  std::getline(std::cin, A, ' ');
  std::getline(std::cin, B, ' ');
  std::getline(std::cin, C);

  length_a = A.length();
  length_b = B.length();
  length_c = C.length();
  if(A.at(length_a-1)==B.at(0)){
    if(B.at(length_b-1)==C.at(0)){
      std::cout << "YES\n";
    }else{
      std::cout << "NO\n";
    }
  }else{
    std::cout << "NO\n";
  }
  return (0);
}


Measured memory_bytes: 256
n, x = map(int, input().split())

A = [1] * (n + 1)
P = [1] * (n + 1)
for i in range(1, n + 1):
    A[i] = A[i - 1] * 2 + 3
    P[i] = P[i - 1] * 2 + 1


def pate(m, y):
    if m == 0:
        return 1
    else:
        c = 0

        if y >= 1:
            y -= 1

        if y >= 1:
            if y >= A[m - 1]:
                y -= A[m - 1]
                c += P[m - 1]
            else:
                c += pate(m - 1, y)
                y = 0

        if y >= 1:
            y -= 1
            c += 1

        if y >= 1:
            if y >= A[m - 1]:
                y -= A[m - 1]
                c += P[m - 1]
            else:
                c += pate(m - 1, y)
                y = 0

        if y >= 1:
            y -= 1

        return c


print(pate(n, x))


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

const int N = 1e3 + 100;
const int W = 2e4;

ll dp[W+100];

struct Block {
    int w, s, v;
};

int main() {
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<Block> blocks(n);
    for (Block& b : blocks) {
        cin >> b.w >> b.s >> b.v;
    }
    sort(all(blocks), [](Block x, Block y) {
        return y.s-x.w > x.s-y.w;
    });
    for (Block b : blocks) {
        for (int i=min(b.s, W-b.w); i>=0; i--) {
            dp[i+b.w] = max(dp[i+b.w], dp[i]+b.v);
        }
    }
    cout << *max_element(begin(dp), end(dp)) << '\n';
}


Measured memory_bytes: 384