akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, m, n) for(int i = m; i < (n); i++)
#define print(x) cout << x << endl;
#define printv(x) for(int i = 0; i < x.size(); i++){ cout << (x[i]) << " "; } cout << endl; 
#define printa(x) for(int i = 0; i < (sizeof(x)/sizeof(x[0])); i++){ cout << (x[i]) << " ";} cout << endl;

typedef long long ll;

using namespace std;

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

    int H,W,D,Q;
    int L[100001] = {0}, R[100001] = {0};
    cin >> H >> W >> D;
    vector< vector<int> > A(301, vector<int>(301, 0));
    vector< vector<int> > Hash(100001, vector<int>(2, 0));
    rep(i,0,H){
        rep(j,0,W){
            int a;
            cin >> a;
            A[i][j] = a;
            Hash[a][0] = i;
            Hash[a][1] = j;
        }
    }

    cin >> Q;
    rep(i,0,Q){
        int l,r;
        cin >> l >> r;
        L[i] = l;
        R[i] = r; 
    }
    vector<ll> s(100001);
    rep(i,1,H*W+1){
        if(i <= D){
            s[i] = 0;
        }else{
            s[i] = s[i-D] + abs(Hash[i][0] - Hash[i-D][0]) + abs(Hash[i][1] - Hash[i-D][1]);
        }
    }

    rep(i,0,Q){
        print(s[R[i]] - s[L[i]]);
        //while(1){
        //    if(g > R[i]) break;
        //    ans += abs(Hash[s][0] - Hash[g][0]) + abs(Hash[s][1] - Hash[g][1]);
        //    s += D;
        //    g += D;
        //}

    }

}


Measured memory_bytes: 8576
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
 
template<unsigned int mod_>
struct ModInt{
	using uint = unsigned int;
	using ll = long long;
	using ull = unsigned long long;
 
	constexpr static uint mod = mod_;
 
	uint v;
	ModInt():v(0){}
	ModInt(ll v):v(normS(v%mod+mod)){}
	explicit operator bool() const {return v!=0;}
	static uint normS(const uint &x){return (x<mod)?x:x-mod;}		// [0 , 2*mod-1] -> [0 , mod-1]
	static ModInt make(const uint &x){ModInt m; m.v=x; return m;}
	ModInt operator+(const ModInt& b) const { return make(normS(v+b.v));}
	ModInt operator-(const ModInt& b) const { return make(normS(v+mod-b.v));}
	ModInt operator-() const { return make(normS(mod-v)); }
	ModInt operator*(const ModInt& b) const { return make((ull)v*b.v%mod);}
	ModInt operator/(const ModInt& b) const { return *this*b.inv();}
	ModInt& operator+=(const ModInt& b){ return *this=*this+b;}
	ModInt& operator-=(const ModInt& b){ return *this=*this-b;}
	ModInt& operator*=(const ModInt& b){ return *this=*this*b;}
	ModInt& operator/=(const ModInt& b){ return *this=*this/b;}
	ll extgcd(ll a,ll b,ll &x,ll &y) const{
		ll u[]={a,1,0},v[]={b,0,1};
		while(*v){
			ll t=*u/ *v;
			rep(i,3) swap(u[i]-=t*v[i],v[i]);
		}
		if(u[0]<0) rep(i,3) u[i]=-u[i];
		x=u[1],y=u[2];
		return u[0];
	}
	ModInt inv() const{
		ll x,y;
		extgcd(v,mod,x,y);
		return make(normS(x+mod));
	}
	bool operator==(const ModInt& b) const { return v==b.v;}
	bool operator!=(const ModInt& b) const { return v!=b.v;}
	friend istream& operator>>(istream &o,ModInt& x){
		ll tmp;
		o>>tmp;
		x=ModInt(tmp);
		return o;
	}
	friend ostream& operator<<(ostream &o,const ModInt& x){ return o<<x.v;}
};
using mint = ModInt<998244353>;
 
const int MX = 2000010;
mint f[MX+1],g[MX+1];
mint C(int x,int y){
	return f[x]*g[y]*g[x-y];
}
void precalc(){
	f[0] = 1;
	rep1(i,MX) f[i] = f[i-1]*i;
	g[0] = 1;
	rep1(i,MX) g[i] = g[i-1]/i;
}
 
int main(){
	precalc();
	int A,B;
	cin>>A>>B;
	if(A>B) swap(A,B);
	mint ans = mint(A+B)*C(A+B-1,A-1);
	rep1(i,A){
		mint tmp = C(2*i,i) * C(A+B-2*i,A-i) / 2;
		ans += tmp;
	}
	ans /= C(A+B,A);
	ans += B-A;
	cout<<ans<<endl;
}

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

class Stack {
    int top, S[100];
    public:
    void initialize(){
        top = 0;
    }


    void push(int x){
        top++;
        S[top] = x;
    }

    int pop(){
        top--;
                                   
        return S[top +1];
    }
    void print(){
        cout << S[top] << endl;
    }

};


int main(){
    int x, y;
    char ch[100];
    Stack s;
    
    s.initialize();
    while(cin >> ch){
        if ( ch[0] == '+' ){
            y = s.pop();
            x = s.pop();
        
            s.push(x+y);

        } else if ( ch[0] == '-' ){
            y = s.pop();
            x = s.pop();
        
            s.push(x-y);

        } else if ( ch[0] == '*' ){
            y = s.pop();
            x = s.pop();
        
            s.push(x*y);

        } else {
            s.push(atoi(ch));
        }
    }
    
    s.print();

  return 0;
    
}


Measured memory_bytes: 3100
#!/usr/bin/env python3
#!/usr/bin/env pypy3

import sys
sys.dont_write_bytecode = True
stdin = sys.stdin
input = stdin.readline
sys.setrecursionlimit(10000000)

#import numpy as np
#import scipy as sp

# Python 3 modules: https://docs.python.org/3/library/

import math, itertools, operator
from math import *
from math import factorial as fact
from operator import itemgetter, attrgetter
from itertools import permutations, combinations
from functools import reduce, lru_cache
# Use scipy for stats: https://docs.scipy.org/doc/scipy/reference/stats.html
# Before Python 3.5.  Import from math after it.
from fractions import gcd
from fractions import Fraction as Frac

inf = float('inf')

def lcm(a, b):
    return a * b // gcd(a,b)

def perm(a, b):
    import scipy.special
    return scipy.special.perm(a, b, exact = True)

def comb(a, b):
    import scipy.special
    return scipy.special.comb(a, b, exact = True)

def dfact(n):
    import scipy.special
    return scipy.special.factorial2(n, exact = True)

def prod(l):
    return reduce(operator.mul, l)

def input_ints(func = input, sep = None, conv = int):
    return list(map(conv, func().split(sep = sep)))

################################################################################


def main():
    N, L = list(map(int, input().split()))
    aji = [None for i in range(N)]
    for i in range(N):
        aji[i] = L + i
    mi = inf
    for i in range(N):
        if abs(aji[i]) < mi:
            mi = abs(aji[i])
            mi_real = aji[i]
    print(sum(aji) - mi_real)


if __name__ == '__main__':
    main()


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

int main(){
  int a,m[1000000],cou=1,j;
  m[1]=0;
  m[2]=1;
  for(int i=3;i<1000000;i++){
    if(i%2==0){
      m[i]=cou;
      continue;
    }
    for(j=3;j*j<=i;j+=2)if(i%j==0)break;
    if(j*j>i)cou++;
    m[i]=cou;
  }
  while(cin>>a){
    cout << m[a]<<endl;
  }
  
 
  return 0;
}
  

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007

int N;
vector<int> g[101];
int h[101];
ll maxg[101];

void dfs(int v,int pre){
  h[v]=0;
  for(int nv : g[v]){
    if(nv==pre)continue;
    dfs(nv,v);
    maxch(h[v],h[nv]+1);
  }
}

void dfs2(int v,int pre,int d){
  if(pre==-1)maxch(maxg[d],(ll)g[v].size());
  else maxch(maxg[d],(ll)g[v].size()-1);
  for(int nv : g[v]){
    if(nv==pre)continue;
    dfs2(nv,v,d+1);
  }
}

ll calc(ll v1,ll v2,ll mh){
  memset(maxg,0,sizeof(maxg));
  dfs2(v1,v2,0);
  if(v2!=-1)dfs2(v2,v1,0);
  ll res=1;
  rep(i,mh-1){
    res*=maxg[i];
  }
  if(v2!=-1)res*=2;
  return res;
}

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

  cin>>N;
  rep(i,N-1){
    int a,b;
    cin>>a>>b;
    a--;b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  vector<int> cent;
  int minh=10000;
  rep(i,N){
    dfs(i,-1);
    if(minh>h[i]){
      cent.clear();
      minh=h[i]; cent.push_back(i);
    }else if(minh==h[i]){
      cent.push_back(i);
    }
  }
  assert((int)cent.size()<=2); assert((int)cent.size()>0);

  ll resa;
  ll resb=9e18;
  if((int)cent.size()==1){
    resa=minh+1;
    minch(resb,calc(cent[0],-1,minh+1));
    for(int v : g[cent[0]]){
      minch(resb,calc(cent[0],v,minh+1));
    }
  }else{
    resa=minh;
    minch(resb,calc(cent[0],cent[1],minh));
  }
  cout<<resa<<" "<<resb<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<bits/stdc++.h>
using namespace std;
int a[105];
int main()
{
    int n;
    scanf("%d",&n);
    int b;
    int i,j;
    for(i=1; i<=n; i++)
    {
        scanf("%d",&a[i]);
        b+=a[i];
    }
    int num;
    for(i=1; i<=n; i++)
    {
        int sum=0,ans=0;
        int x=i;
        for(j=1; j<=x; j++)
        {
            sum+=a[j];
        }
        for(j=n; j>x; j--)
        {
            ans+=a[j];
        }
        num=abs(ans-sum);
        if(num<b)
        {
            b=num;
        }
    }
    printf("%d",b);
    return 0;
}


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

int main(){
    long long N, A, B;
    cin >> N >> A >> B;
    if(abs(A-B)%2==0){
        cout << abs(A-B)/2 << endl;
    }else{
        long long Adis, Bdis;
        Adis = A - 1;
        Bdis = N - B;
        if(Adis<Bdis){
            cout << Adis + 1 + (B - A - 1)/2 << endl;
        }else{
            cout << Bdis + 1 + (B - A - 1)/2 << endl;
            }
    }
    return 0;
}

Measured memory_bytes: 256
n = int(input())
X = [[[0] * 10 for f in range(3)] for b in range(4)]
for i in range(n):
    b, f, r, v = map(int, input().split())
    X[b-1][f-1][r-1] += v
    
count = 0
for b in X:
    for f in b:
        print(' ', end='')
        print(*f)
    if count == 3:
        break
    print('#' * 20)
    count += 1


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

int main() {
	int n;
	cin >> n;
	if(n%7 == 0) cout << "thu" << endl;
	if(n%7 == 1) cout << "fri" << endl;
	if(n%7 == 2) cout << "sat" << endl;
	if(n%7 == 3) cout << "sun" << endl;
	if(n%7 == 4) cout << "mon" << endl;
	if(n%7 == 5) cout << "tue" << endl;
	if(n%7 == 6) cout << "wed" << endl;
	return 0;
}


Measured memory_bytes: 3128
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vp;
#define rep(i,n) for(ll i = 0; i < ll(n); i++)
#define all(v) v.begin() , v.end()
#define inputv(v,n) rep(i,n){\
    ll x;\
    cin>>x;\
    v.push_back(x);\
    }
const ll INF=99999999999999;
const ll MOD=1000000007;
 
int main() {
  ll h,w;
  cin>> h >> w;
  vector<string> s(h+1);
  rep(i,h){
    cin >> s[i];
  }
  s[h] = "#";
  rep(i,w){
    s[h] += "#";
  }
  rep(i,h){
    s[i] += "#";
  }
  vector<vector<ll> > mem1(h,vector<ll>(w,-INF));
  vector<vector<ll> > mem2(h,vector<ll>(w,-INF));
  rep(i,h){
  ll temp = 0;
  for(ll j=0; j<=w; j++){
    if(s[i][j] == '.'){
      temp++;
    }
    if(s[i][j] == '#'){
      for(ll k=(j-temp); k<j ; k++){
        mem1[i][k] = temp;
      }
      temp = 0;
    }
  }
  }
  rep(i,w){
  ll temp = 0;
  for(ll j=0; j<=h; j++){
    if(s[j][i] == '.'){
      temp++;
    }
    if(s[j][i] == '#'){
      for(ll k=(j-temp); k<j ; k++){
        mem2[k][i] = temp;
      }
      temp = 0;
    }
  }
  }
  ll ans = -INF;
  rep(i,h){
    rep(j,w){
      ans = max(ans,mem1[i][j]+mem2[i][j]-1);
    }
  }
  cout << ans;
 return 0;
}

Measured memory_bytes: 67072
a = int(input())
if (a % 10 == 2 or
    a % 10 == 4 or
    a % 10 == 5 or
    a % 10 == 7 or
    a % 10 == 9):
  print('hon')
elif (a % 10 == 0 or
      a % 10 == 1 or
      a % 10 == 6 or
      a % 10 == 8):
  print('pon')
else:
  print('bon')

Measured memory_bytes: 9180
#include<bits/stdc++.h>
using namespace std;
// -----------------<fast IO>------------------
#define IOS             ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FLSH             fflush(stdout)
#define fileIO(name) \
    freopen(name".in", "r", stdin); \
    freopen(name".out", "w", stdout);
#define PRECISION(x)     cout << fixed << setprecision(x);
#define endl             "\n"
// -----------------<Container manipulation / traversal macros>------------------
#define mp                 make_pair
#define pb                 push_back
#define ff                 first
#define ss                 second
#define sz(x)             ((int)((x).size()))
#define all(x)             (x).begin(),(x).end()
#define rep(i,n)         for(ll (i)=0;(i)<(n);(i)++)
#define forn(i,a,b)     for(ll (i)=(a);(i)<=(b);(i)++)
#define fill(l,a)        memset((l) , (a) , sizeof(l))
// -----------------<Some common useful functions>------------------
#define maX(a,b)        ( (a) > (b) ? (a) : (b))
#define miN(a,b)        ( (a) < (b) ? (a) : (b))
#define checkbit(n,b)   ( (n >> b) & 1)
#define INDEX(arr,i)      ( lower_bound(all(arr),i)-arr.begin())
#define in(b,a)         ( (b).find(a) != (b).end())
// -----------------<TypeDef Start>------------------
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector< std::vector<ll> > matrix;
typedef map<ll,ll> mii;
typedef vector<pii> vpii;
// -----------------<Constants>------------------
const int MAXN = 1000005;
const int SQRTN = 1003;
const int LOGN = 22;
const double PI=acos(-1);

const int INF=1e9;

int MOD = 1000000007;
const int FMOD = 998244353;
const double eps = 1e-9;
ll gcd(ll a,ll b)
{
    if(a==0)
    return(b);
    return(gcd(b%a,a));
}
ll lcm(ll a,ll b)
{
    return(a/gcd(a,b)*b);
}
ll power(ll a,ll b,ll p)
{
    ll res=1;
    a%=p;
    while(b>0)
    {
        if(b&1)
        res=res*a%p;
        a=a*a%p;
        b>>=1;
    }
    return(res);
}
ll modInverse(ll a, ll m)
{
    ll g = gcd(a, m);
    return(power(a,m-2,m));
}
/*ll b_search(ll arr[],ll n,ll s)
{
    ll l=0,r=n-1;
    while(l<=r)
    {
        ll mid=l+(r-l)/2;
        if(arr[mid]==s)
        return(mid);
        if(arr[mid]<s)
        l=mid+1;
        else
        r=mid-1;
    }
    return(-1);
}*/
void solve()
{
    ll n,k;
    cin>>n>>k;
    ll arr[n];
    for(ll i=0;i<n;i++)
        cin>>arr[i];
    sort(arr,arr+n);
    ll s=0;
    for(ll i=0;i<n-k;i++)
        s+=arr[i];
    cout<<s<<endl;
}

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


Measured memory_bytes: 1792
n = int(input())
A = [[0 for i in range(n)] for j in range(n)]

for i in range(n):
    u, k, *v = list(map(int, input().split()))
    for j in v:
        A[int(u)-1][int(j)-1] = 1

for row in A:
    msg = ' '.join(map(str, row))
    print(msg)


Measured memory_bytes: 5680
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll mod = 1e9+7;

//約数列挙
vector<ll> comdiv(ll x){
    vector<ll> res;
    stack<ll> big;
    for(ll i = 2; i*i <= x; i++){
        if(x%i == 0){
            res.push_back(i);
            if(x/i != i)big.push(x/i);
        } 
    }
    while(!big.empty()){
        res.push_back(big.top());
        big.pop();
    }
    res.push_back(x);
    return res;
}

int main(){
    ll n;
    cin >> n;
    vector<ll> a = comdiv(n);
    vector<ll> b = comdiv(n-1);
    ll ans = b.size();
    if(n == 2) ans--;
    //cout << ans <<endl;
    for(int i = 0; i < a.size(); i++){
        ll tmp = n;
        //cout << a[i] << endl;
        while(tmp%a[i] == 0){
            tmp /= a[i];
        }
        if(tmp%a[i] == 1) ans++;
    }
    cout << ans << endl;
    return 0;
}


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

using ll = long long;


int k;
ll ans;

int main() {
    std::cin >> k;
    std::priority_queue<ll, std::vector<ll>, std::greater<ll>> q;
    for (int i = 1; i <= 9; i++) {
        q.push(i);
    }
    for (int j = 0; j < k; j++) {
        ans = q.top();
        std::string s = std::to_string(ans);
        int p = s[s.size()-1] - '0';
        for (int r = -1; r <= 1; r++) {
            int m = p + r;
            if (m < 0 || m > 9) {
                continue;
            }
            std::string w = std::to_string(m);
            std::string t = s + w;
            q.push(std::stoll(t));
        }
        q.pop();
        
    }
    std::cout << ans << std::endl;
}

Measured memory_bytes: 2420
#include<iostream>
using namespace std;
int main(){
  
  bool red[100001]={};
  int a[100001];
  for(int i=0;i<100001;i++){
    a[i]=1;
  }

  red[1]=true;
  int n,m;
  cin>>n>>m;
  int x,y;
  for(int i=0;i<m;i++){
    cin>>x>>y;
    if(red[x])red[y]=true;
    a[x]--;
    a[y]++;
    if(a[x]==0)red[x]=false;
  }
  int count=0;
  for(int i=0;i<n;i++){
    if(red[i+1])count++;
  }
  cout<<count<<endl;
}


Measured memory_bytes: 768
import java.util.Scanner;
class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        while(true){
            int n = sc.nextInt();
            int x = sc.nextInt();
            if(n == 0 && x == 0){
                break;
            }
            
            int sum = 0;
            for(int i = 1 ; i <= n ; i++){
                for(int j = 1 ; j <= n ;j++){
                    for(int k = 1 ; k <= n ; k++){
                        if((i != j && j != k && i != k ) && (i + j + k == x)){
                            sum++;
                        }
                    }
                }
            }
            
            System.out.println(sum / 6);
            
        }
        
    }
}


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

bool check(int node, set<int> &contain, vector<vector<int>> &graph){
    for(auto e : graph[node]){
        if(!contain.count(e))return false;
    }
    return true;
}

int main(){
    int n, m;
    cin >> n >> m;
    vector<vector<int>> graph(n+1, vector<int>());
    for(int i=0;i<m;++i){
        int a, b;
        cin >> a >> b;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }

    deque<int> path;
    set<int> contain;
    path.push_back(1);
    path.push_back(graph[1][0]);
    contain.insert(path[0]);
    contain.insert(path.back());
    while(true){
        if(!check(path[0], contain, graph)){
            for(auto e : graph[path[0]]){
                if(!contain.count(e)){
                    path.push_front(e);
                    contain.insert(e);
                    break;
                }
            }
        }else if(!check(path.back(), contain, graph)){
            for(auto e : graph[path.back()]){
                if(!contain.count(e)){
                    path.push_back(e);
                    contain.insert(e);
                    break;
                }
            }
        }else{
            break;
        }
    }

    cout << path.size() << endl;
    for(int i=0;i<path.size();++i){
        cout << path[i];
        if(i == path.size() - 1)cout << endl;
        else cout << " ";
    }

    return 0;
}


Measured memory_bytes: 11392
n=int(input())
dp=[[[0.0]*(n+1) for i in range(n+1)] for j in range(n+1)]
dp[0][0][0]=0
a=[float(i) for i in input().split()]

p=a.count(1)
q=a.count(2)
r=a.count(3)

l=[1]
for i in range(1,1000):
    l.append(1.0/i)

for k in range(r+1):
    for j in range(q+r-k+1):
        for i in range(n-k-j+1):
            if i==j==k==0:
                continue
            res=n
            if i>0:
                res+=i*dp[i-1][j][k]
            if j>0:
                res+=j*dp[i+1][j-1][k]
            if k>0:
                res+=k*dp[i][j+1][k-1]
            res*=1/(i+j+k)
            dp[i][j][k]=res

print(dp[p][q][r])


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

int main(void){
    int N, K;
    cin >> N;
    cin >> K;
    int i = 1;
    int sum = 1;

    while(i <= N){
        if(sum < K)
            sum *= 2;
        else
            sum += K;
        i++;
    }
        
    cout << sum << endl;
    return 0;
    }


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

#define loop(i,n) for(int i = 0;i < int(n);i++)
#define rloop(i,n) for(int i = int(n);i >= 0;i--)
#define range(i,a,b) for(int i = int(a);i <= int(b);i++)
#define SZ(c) int(c.size())
#define ALL(c) c.begin(), c.end()
#define RALL(c) c.rbegin(), c.rend()
#define PI acos(-1)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define sfi1(v) scanf("%d",&v)
#define sfi2(v1,v2) scanf("%d %d",&v1,&v2)
#define sfi3(v1,v2,v3) scanf("%d %d %d",&v1,&v2,&v3)
#define sfll1(v) scanf("%I64d",&v);
#define sfll2(v1,v2) scanf("%I64d %I64d",&v1,&v2)
#define sfll3(v1,v2,v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
#define endl '\n'

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

string str[10];
int n ,m , k;

int main()
{

#ifndef ONLINE_JUDGE
	//freopen("in.in", "r", stdin);
	//freopen("out.in", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    cin >> n >> m >> k;
    int ans = 0;
    loop(i,n)cin >> str[i];

    loop(mskR,(1<<n))loop(mskC,(1<<m)){
        int cnt = 0;
        loop(i,n)if((mskR>>i)&1)
        loop(j,m)if((mskC>>j)&1)
        cnt += (str[i][j] == '#');

        ans += (cnt == k);
    }

    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 3608
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;  

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int MAXN=100;
const int MAXZ=MAXN;
const int MOD=1000000007;
int pw(int x,int n) { int ret=1; while(true) { if(n&1) ret=(ll)ret*x%MOD; if((n>>=1)==0) return ret; x=(ll)x*x%MOD; } }
void inc(int &a,int b) { if((a+=b)>=MOD) a-=MOD; }

int n;
int h[MAXN];

int z[MAXN],nz;

int dpalt[MAXN];
int dpdup[MAXN][MAXZ];

void run() {
	scanf("%d",&n); REP(i,n) scanf("%d",&h[i]);

	nz=0; REP(i,n) z[nz++]=h[i]; sort(z,z+nz); nz=unique(z,z+nz)-z;

	memset(dpalt,0,sizeof(dpalt)); memset(dpdup,0,sizeof(dpdup));
	REP(i,n) {
		int cz=lower_bound(z,z+nz,h[i])-z;
		if(i==0) {
			inc(dpalt[i],2);
			REPE(nj,cz) {
				int here=z[nj]-(nj==0?0:z[nj-1]),below=nj==0?0:z[nj-1],above=h[i]-z[nj];
				int ways=below==0?(ll)(pw(2,here)+MOD-2)*pw(2,above)%MOD:(ll)2*(pw(2,here)+MOD-1)*pw(2,above)%MOD;
				inc(dpdup[i][nj],ways);
			}
		} else {
			int pz=lower_bound(z,z+nz,h[i-1])-z;
			if(dpalt[i-1]!=0) {
				inc(dpalt[i],(ll)2*dpalt[i-1]%MOD);
				FORE(nj,pz+1,cz) {
					int here=z[nj]-z[nj-1],below=z[nj-1]-h[i-1],above=h[i]-z[nj];
					int ways=(ll)2*(pw(2,here)+MOD-1)*pw(2,above)%MOD;
					inc(dpdup[i][nj],(ll)dpalt[i-1]*ways%MOD);
				}
			}
			REP(j,nz) if(dpdup[i-1][j]!=0) {
				if(cz<j) {
					inc(dpalt[i],(ll)2*dpdup[i-1][j]%MOD);
				} else {
					int above=cz<=pz?0:h[i]-h[i-1];
					int ways=pw(2,above);
					inc(dpdup[i][j],(ll)dpdup[i-1][j]*ways%MOD);
				}
			}
		}
	}
	int ret=0;
	inc(ret,dpalt[n-1]);
	REP(j,nz) inc(ret,dpdup[n-1][j]);
	printf("%d\n",ret);
}

int main() {
	run();
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define V vector<ll>
using namespace std;
using ll = long long;


int main(){
    int a,b;
    cin>>a>>b;
    int dif=b-a;
    int B=0;
    Rep(i,1,b-a) B+=i;
    cout<<B-b<<endl;
}

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

int main() {
    long long n, ans=100000000000, x, a;
    cin >> n;
    for(long long i=1; i*i<=n; i++) {
        if(n%i==0) {
            x=1;
            a=n/i;
            while(a/10!=0) {
                a/=10;
                x++;
            }
            ans=min(ans, x);
        }
    }
    cout << ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int  i, j;
    string a;
    cin >> a;
    for (i = 0; i < 4; i++){
        for (j = 0; j < 4; j++){
            if(abs(i - j) == 1 && a[i] == a[j]){
                cout << "Bad" << endl;
                return 0;
            }
        }
    }
    cout << "Good" << endl;
    return 0;
}


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

using namespace std;

int main() {
    int k; cin >> k;
    long long int ans = 0;
    for (int a = 1; a <= k; ++a) {
        for (int b = 1; b <= k; ++b) {
            for (int c = 1; c <= k; ++c) {
                ans += __gcd(__gcd(a, b), c);
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3660
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int k = sc.nextInt();
    int count = 0;
    for (int i = 0; i < n; i++) {
      int num = sc.nextInt();
      if (num >= k) count++;
    }
    System.out.println(count);
  }
}


Measured memory_bytes: 46332
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
using namespace std;

int main() {
	int n,x,tmp[8];
	vector<int> r;
	cin >> n;
	for(int i=0; i<n; i++)
	{
		cin >> x;
		for (int j=0; j<8; j++)
		{
			tmp[j] = x%10;
			x/=10;
		}
		sort(tmp,tmp+8,greater<int>());
		int max=0,min=0;
		for (int j=0; j<8; j++)
		{
			max *= 10;
			max += tmp[j];
		}
		sort(tmp,tmp+8);
		for (int j=0; j<8; j++)
		{
			min *= 10;
			min += tmp[j];
		}
		r.push_back(max-min);
	}
	for (int i=0; i<n; i++)
	{
		cout << r[i] << endl;
	}
}

Measured memory_bytes: 0
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::{cmp::*, collections::*, mem::*},
};
fn main() {
    input! {//
        n:usize,
        mut l:[i64;2*n],
    }

    l.sort();
    let mut ans = 0;
    for i in 0..n {
        ans += l[2 * i];
    }
    println!("{}", ans);
}


Measured memory_bytes: 2160
#include <iostream>
#include <algorithm>
#include <cmath>
#include <climits>
#include <string>
#include <queue>
#include <vector>
#include <set>
#include <unordered_map>
using namespace std;

int main() {
  string s, t;
  cin >> s >> t;
  int x = stoi(s + t);
  for (int i = 0; i <= 1000; i++) {
    if (i * i == x) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 256
//
//  main.cpp
//  CADDi_2018
//
//  Created by Joe Mori on 2020/06/30.
//  Copyright © 2020 Joe Mori. All rights reserved.
//

#include <iostream>
#include<vector>
#include<map>
#include<cmath>
int main() {
    long long int N,P,sub,ans;
    std::cin>>N>>P;
    ans=1;
//    std::vector<bool>is_prime(P,true);
//    is_prime[0]=is_prime[1]=false;
    sub=P;
    std::map <long long int ,long long int>yaku;
    if(N==1){
        std::cout<<P<<std::endl;
        return 0;
    }
    yaku[1]=N;
    for(long long int i=2;i*i<=P;i++){
//        std::cout<<i<<std::endl;
        while(sub%i==0){
            yaku[i]++;
            sub=sub/i;
//            std::cout<<"sub:"<<std::endl;
        }
        if(sub==1)break;
    }
    for(auto i:yaku){
        auto key=i.first;
        auto y=i.second;
        //std::cout<<"約数"<<key<<"個数"<<y<<std::endl;
        if(y>=N){
            for(int j=1;j<=y/N;j++){
                ans*=key;
            }
        }
    }
    std::cout<<ans<<std::endl;
    return 0;
}


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

int main() {
  int N;
  cin >> N;
  
  int a1,b1;
  a1 = N / 1000;
  b1 = N % 1000;
  
  int a2,b2;
  a2 = b1 / 100;
  b2 = b1 % 100;
  
  int a3,b3;
  a3 = b2 / 10;
  b3 = b2 % 10;
  
  int a4;
  a4 = b3;
  
  if (a1 == a2 && a2 == a3 ||
      a2 == a3 && a3 == a4) {
    cout << "Yes" <<endl;
  }
  else { cout << "No" << endl; 
  }      
}


Measured memory_bytes: 256
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"

using namespace std;

const long long int MOD = 1000000007;

long long int N, M, K, H, W, L, R, V, E;

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

	int dir[] = { 0,1,0,-1,0 };
	cin >> W >> H;
	vector<string>ans;
	while (H) {
		vector<string>a(H);
		vector<string>b(H);
		for (int i = 0; i < H; i++) {
			cin >> a[i];
			cin >> b[i];
		}
		vector<vector<bool>>flag(H*W, vector<bool>(H*W));
		int asx, asy, agx, agy, bsx, bsy, bgx, bgy;
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				if (a[i][j] == 'L') {
					asy = i;
					asx = j;
				}
				if (a[i][j] == '%') {
					agy = i;
					agx = j;
				}
			}
		}
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				if (b[i][j] == 'R') {
					bsy = i;
					bsx = j;
				}
				if (b[i][j] == '%') {
					bgy = i;
					bgx = j;
				}
			}
		}
		queue<pair<int, int>>Q;
		flag[asy*W + asx][bsy*W + bsx] = true;
		Q.push({ asy * W + asx,bsy * W + bsx });
		while (!Q.empty()) {
			auto c = Q.front();
			Q.pop();
			int ay = c.first / W;
			int ax = c.first % W;
			int by = c.second / W;
			int bx = c.second%W;
			for (int i = 0; i < 4; i++) {
				int nay = ay + dir[i];
				int nax = ax + dir[i + 1];
				int nby = by + dir[i];
				int nbx = bx - dir[i + 1];
				nay = max(0, min(nay, (int)H - 1));
				nby = max(0, min(nby, (int)H - 1));
				nax = max(0, min(nax, (int)W - 1));
				nbx = max(0, min(nbx, (int)W - 1));
				if (a[nay][nax] == '#') {
					nay = ay;
					nax = ax;
				}
				if (b[nby][nbx] == '#') {
					nby = by;
					nbx = bx;
				}
				if (a[nay][nax] == '%'^b[nby][nbx] == '%')continue;
				if (flag[nay*W + nax][nby*W + nbx])continue;
				flag[nay*W + nax][nby*W + nbx] = true;
				Q.push({ nay*W + nax,nby*W + nbx });
			}
		}
		if (flag[agy*W + agx][bgy*W + bgx])ans.push_back("Yes\n");
		else ans.push_back("No\n");
		cin >> W >> H;
	}
	for (auto i : ans) {
		cout << i;
	}
	return 0;
}



Measured memory_bytes: 4116
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
#define all(x) (x).begin(),(x).end()
int INF = 100000000;

int main() {
  int N; cin >> N;
  int A;
  int cnt = 0;
  rep(i, N) {
    cin >> A;
    if (A % 2 == 1) {
      cnt++;
    }
  }
  if (cnt % 2 == 0) {
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


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

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

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// #include <ext/pb_ds/detail/standard_policies.hpp>

using namespace std;
// using namespace __gnu_pbds;
typedef long double ld;
typedef long long ll;
#define int ll
#define endl "\n"
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(c) c.begin(), c.end()
#define vi vector<int>
#define pii pair<int,int>
#define For(i,s,e) for (ll i=(s); i<(e); i++)
#define initialize(arr,elem) memset(arr,elem,sizeof(arr))
#define sz size
const int MOD = 1e9+7;
const int MAX_SZ = 3e3+9;
const int INF = 1e18+9;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
//shuffle(a.begin(),a.end(),rng) 
// typedef tree< int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int dp[MAX_SZ][MAX_SZ];
int n;
string s;

int solve(){
	for (int i=1;i<=n;i++) dp[0][i] =1;
	dp[0][1] = 1;
	for (int i =1;i<n;i++){
		int cur = 0;
		if (s[i-1] == '<') cur = 1;
		for (int j = 1;j<=i+1;j++){
			if (cur) dp[i][j] = dp[i-1][j-1];
			else dp[i][j] = (dp[i-1][n] - dp[i-1][j-1] + MOD)%MOD;
		}
		for (int j =1;j<=n;j++){
			dp[i][j] = (dp[i][j-1] + dp[i][j])%MOD;
		}
	}
	return dp[n-1][n];
}

void rand_shuff(vi &arr){
	random_device rd;
	mt19937 g(rd());
	shuffle(all(arr),g);
}

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
		
	cin>>n>>s;
	initialize(dp,0);
	cout<<solve()<<endl;

	return 0;
}


Measured memory_bytes: 71040
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n = ni()

print(0 if n%1000 == 0 else 1000-n%1000)

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

int main() {
  int x;
  rep(i,5) {
    cin>>x;
    if (x==0) cout<<i+1;
    
  }
}


Measured memory_bytes: 3616
#include<iostream>
using namespace std;
int a[100000];
int partitin(int n,int r)
{
	int x;
	int i;
	int t;
	x=a[r];
	i=n-1;
	for(int j=n;j<r;j++)
	{
		if(a[j]<=x)
	{	i++;
		t=a[i];
		a[i]=a[j];
		a[j]=t;
		}
	}
	t=a[i+1];a[i+1]=a[r];a[r]=t;
	return i+1;
}
int main()
{
	int n,m;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	m=partitin(0,n-1);
	for(int i=0;i<n;i++)
	{
	    if(i) cout<<" ";
		if(i==m) cout<<"[";
		cout<<a[i];
		if(i==m) cout<<"]";
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 3360
#include<bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using namespace std;

//ループマクロ
#define FOR(i , a , b)  for(int i = (a) ; i < (b) ; i++)
#define REP(i , n)      for(int i = 0 ; i < n ; i++)
#define REPR(i , n)     for(int i = n ; 0 <= i ; i--)

//入出力
#define SCOUT(x) cout << (x) << " "
#define VECCIN(x) for(auto& ele : (x) ) cin >> ele
#define VECOUT(x) for(auto& ele : (x) ) cout << ele << " "; cout << endl;

//その他
#define ALL(obj) (obj).begin() , (obj).end() 
#define P pair<int , int>
#define V vector<int>
#define M map<int, int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int , V , greater<int>>

int main(void) {

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

	int n;	cin >> n;
	vector<int> a(n + 1);
	for(int i = 1 ;i <= n ; i++)	cin >> a[i];
	vector<int> ans(n + 1);

	int ans_m = 0;
	for(int i = n ; 1 <= i ; i--){
	 	
	 	int sum = 0;
		for(int j = i * 2 ; j <= n ; j += i)
		 	sum += ans[j];

		if(sum % 2 == a[i])
		 	ans[i] = 0;
		else{
			ans[i] = 1;
			ans_m += 1;
		}
	}

	SCOUT(ans_m) << endl;

	for(int i = 1 ; i <= n ; i++)
		if(ans[i])	SCOUT(i);

	cout << endl;

	return 0;
}

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


void main() {
  char code[5];
  int i;
  scanf ("%s", code);
  
  for (i=1;i<4;i++) {
    if (code[i]==code[i-1]) {
      printf ("Bad");
      return;
    }
  }
  printf("Good");
  return;
}
 

Measured memory_bytes: 128
#include <stdio.h>

#define N_MAX 100000

int main(void)
{
	int i, j;
	int Max = 0;
	int N = 0;
	scanf("%d", &N);	

	int list[N_MAX] = {0};
	int save[N_MAX] = {0};
	
	for (j = 0; j < N_MAX; j++){
		list[j] = 2147483647;
		save[j] = 2147483647;
	}
	
	for (i = 0; i < N; i++){
		scanf("%d", &list[i]);
		save[i] = list[i];
	}
	
	for (i = 0; i < N; i++){
		if (list[i] > Max){
			Max = list[i];
		}
	}
	
	int Left = 0;
	int Right = Max;
	int Mid = 0;
	
	for (i = 0; i < N; i++){
		if (list[i] <= Max / 2){
			if (list[i] > Left){
				Left = list[i];
			}
		}else{
			if (list[i] < Right){
				Right = list[i];
			}
		}	
	}

	if (Max/2 - Left < Right - Max/2){
		Mid = Left;
	}else if (Max/2 - Left > Right - Max/2){
		Mid = Right;
	}else if (Max % 2 == 0){
		Mid = Left;
	}else{
		Mid = Right;
	}
	
	printf("%d %d\n", Max, Mid);
	
	return 0;
}

Measured memory_bytes: 512
require 'prime'

n, k = gets.split.map(&:to_i)
as = gets.split.map(&:to_i)

if as.max < k
  puts 'IMPOSSIBLE'
else
  gcd = as.max
  as.each do |a|
    gcd = gcd.gcd(a)
  end
  if k % gcd == 0
    puts 'POSSIBLE'
  else
    puts 'IMPOSSIBLE'
  end
end

Measured memory_bytes: 8988
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define fir first
#define sec second
#define MOD 1000000007
#define vvi vector<vector<int> >
#define vvs vector<vector<string> >
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define pb push_back
#define vi vector<int>
#define test(t) int t; cin>>t; while(t--)
#define vl vector<ll>
#define vb vector<bool>
#define vs vector<string>
#define vvl vector<vl>
#define loopin(i, n) for(int i = 0; i < (n); i++)
#define loopdec(i, n) for(int i = n-1; i >= 0; i--)
const int mod=1e9+7;


void solve(){
int d,t,s;
cin>>d>>t>>s;
float time=float(d)/s;
if(time<=t){
  cout<<"Yes"<<endl;
  }else{
  cout<<"No"<<endl;
  }

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

  solve();
return 0;
}



Measured memory_bytes: 3652
#include <cmath>
#include <iostream>
#include <string>
#include <vector> 
#include <algorithm>
#include <numeric>
#include <map>   
#include <stdio.h>

#define FOR(i,a,b) for(i=(a);i<(b);++i) 
#define FORR(i,a,b) for(i=(a);i>(b);--i)
#define REP(i,n) for(i=0;i<(n);++i)
#define REPR(i,n) for(i=(n);i>0;--i)
#define PB push_back
#define ll long long
#define INT_MAX 2147483647
#define LL_MAX 9223372036854775807
#define sortR(a,b) sort(a, b, greater<int>())

using namespace std;

	long long GCD(long long a, long long b) {
		if (a < b)
			swap(a, b);
		if (b == 0) return a;
		else return GCD(b, a % b);
	}
	bool sosuu_check(int num) {
		int i;
		for (i = 2; i <= sqrt(num); ++i) {
			if (num%i == 0)
				return false;
		}
		return (num < 2) ? false : true;
	}



int main() {
	string S;
	cin >> S;
	ll ans = 0, SIZE = (ll)S.size() - 1, i = SIZE, end = SIZE;
	while (i >= 0) {
		if (S[i] == 'B') {
			ans += end - i;
			end--;
		}
		i--;
	}
	cout << ans << endl;
}

Measured memory_bytes: 640
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args)throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String ascore[] = br.readLine().split(" ");
		String bscore[] = br.readLine().split(" ");
		int a = 0;
		int b = 0;
		for(int i=0; i<4; i++){
			a += Integer.parseInt(ascore[i]);
			b += Integer.parseInt(bscore[i]);
		}

		System.out.println(Math.max(a, b));
	}
}

Measured memory_bytes: 24408
#include <bits/stdc++.h>
#define ll long long int
#define c(a) ll a; cin>>a;
#define cs(a) string a; cin>>a;
#define ci(a) cin>>a;
#define co(a) cout<<a;
#define nl cout<<endl;
#define ca(arr,n) for(ll i=0;i<n;i++) cin>>arr[i];
#define f0(i,a,n) for(ll i=a;i>=n;i--)
#define f(i,n) for(ll i=0;i<n;i++)
#define f1(i,a,n) for(ll i=a;i<n;i++)
#define T ll t=1; cin>>t; while(t--)
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
const int nax = 1e4 + 44;
int ans[nax];

int main()
{
    fast;
    c(n)
    for (int i = 1; i*i <=n; i++)
    {
        for (int j = 1; i*i +j*j+j*i <=n; j++)
        {
            for (int k = 1; i*i+j*j+k*k+i*j+i*k+k*j <=n; k++)
            {
                ans[i*i+j*j+k*k+i*j+i*k+k*j]++;
            }
        }
    }
    f1(i,1,n+1) cout<<ans[i]<<endl;
    
    return 0;
}

/*It's not who I am underneath, but what I do that defines me

MMMMMMMMMMMMMMMMMMMMM.                             MMMMMMMMMMMMMMMMMMMMM
 `MMMMMMMMMMMMMMMMMMMM           M\  /M           MMMMMMMMMMMMMMMMMMMM'
   `MMMMMMMMMMMMMMMMMMM          MMMMMM          MMMMMMMMMMMMMMMMMMM'
     MMMMMMMMMMMMMMMMMMM-_______MMMMMMMM_______-MMMMMMMMMMMMMMMMMMM
      MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
      MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
      MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
     .MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM.
    MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
                   `MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM'
                          `MMMMMMMMMMMMMMMMMM'
                              `MMMMMMMMMM'
                                 MMMMMM 
                                  MMMM
                                   MM
*/


Measured memory_bytes: 3552
n=int(input())
if n==3:
  print(2,5,63)
else:
  if n%2==0:
    ans=[3,9]
    cnt=2
    for i in range(30001):
      if i%6==2:
        if i+2<=30000:
          ans.append(i)
          ans.append(i+2)
          cnt+=2
          if cnt==n:
            break
      else:
        continue
    if cnt<n:
      for i in range(12,30001):
        if i%12==3:
          if i+9<=30000:
            ans.append(i)
            ans.append(i+6)
            cnt+=2
            if cnt==n:
              break
        else:
          continue
    if cnt<n:
      for i in range(1,30001):
        if i%6==0:
          ans.append(i)
          cnt+=1
          if cnt==n:
            break
    print(*ans)
  else:
    ans=[3,6,9]
    cnt=3
    for i in range(30001):
      if i%6==2:
        if i+2<=30000:
          ans.append(i)
          ans.append(i+2)
          cnt+=2
          if cnt==n:
            break
      else:
        continue
    if cnt<n:
      for i in range(12,30001):
        if i%12==3:
          if i+9<=30000:
            ans.append(i)
            ans.append(i+6)
            cnt+=2
            if cnt==n:
              break
        else:
          continue
    if cnt<n:
      for i in range(7,30001):
        if i%6==0:
          ans.append(i)
          cnt+=1
          if cnt==n:
            break
    print(*ans)

Measured memory_bytes: 4564
#include <algorithm>
#include <iostream>
#include <vector>

int main()
{
    int h, w;
    std::cin >> h >> w;

    std::vector<std::string> a(h);
    for (int i = 0; i < h; i++) {
        std::cin >> a[i];
    }

    for (int i = 0; i < w + 2; i++) {
        std::cout << '#';
    }
    std::cout << std::endl;

    for (int i = 0; i < h; i++) {
        std::cout << '#';
        std::cout << a[i];
        std::cout << '#';
        std::cout << std::endl;
    }
    for (int i = 0; i < w + 2; i++) {
        std::cout << '#';
    }
    std::cout << std::endl;
}


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

int main()
{
    int n,ans=0,cnt=0,a[200005],i,j,k;
    cin>>n;
    for(i=0;i<n;i++){
        cin>>a[i];
    }
    for(i=0;i<n;i++){
        cnt=0;
        for(j=i+1;j<n;j++){
            if(a[j]<=a[j-1])
                cnt++;
                else
                break;
            
        }
        
        ans=max(ans,cnt);
        i=j-1;
    }
    cout<<ans;
}


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

#define int long long
const double PI = 3.14159265358979323846;
typedef vector<int> vint;
typedef pair<int, int> pint;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int N;
int a[55];
signed main() {
    cin >> N;
    for (int i = 1; i <= N; i++)cin >> a[i];
    int megurimegutte_everyone_nanikagamatte_irunokana_tsuyokunareru_soukimiha_hitorijanaiyo_standup = 0;
    for (int i = 1; i <= N; i++) if (abs(a[i]) >= abs(a[megurimegutte_everyone_nanikagamatte_irunokana_tsuyokunareru_soukimiha_hitorijanaiyo_standup]))megurimegutte_everyone_nanikagamatte_irunokana_tsuyokunareru_soukimiha_hitorijanaiyo_standup = i;
    cout << 2 * N - 1 << endl;
    for (int i = 1; i <= N; i++) cout << megurimegutte_everyone_nanikagamatte_irunokana_tsuyokunareru_soukimiha_hitorijanaiyo_standup << " " << i << endl;
    for (int i = 2; i <= N; i++) {
        if (a[megurimegutte_everyone_nanikagamatte_irunokana_tsuyokunareru_soukimiha_hitorijanaiyo_standup] > 0)cout << i - 1 << " " << i << endl;
        else cout << N - i + 2 << " " << N - i + 1 << endl;
    }
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

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

	if (N[N.length() - 1] == '2'
		|| N[N.length() - 1] == '4'
		|| N[N.length() - 1] == '5'
		|| N[N.length() - 1] == '7'
		|| N[N.length() - 1] == '9') {
		cout <<"hon" << endl;
	}
	else if (N[N.length() - 1] == '0'
		|| N[N.length() - 1] == '1'
		|| N[N.length() - 1] == '6'
		|| N[N.length() - 1] == '8') {
		cout << "pon" << endl;
	}
	else if (N[N.length() - 1] == '3') {
		cout <<"bon" << endl;
	}

}


Measured memory_bytes: 3628
using System;
class Program
{
	static void Main(string[] args)
	{
		// スペース区切りの整数の入力
		string[] input1 = Console.ReadLine().Split(' ');
		int H = int.Parse(input1[0]);
		int W = int.Parse(input1[1]);
        int N = 0;
        string[] outputs = new string[H*W];
        int[,] a = new int[H, W];

		// Arrayの入力
        for (int h_ = 0; h_ < H; h_++){
            string[] s = Console.ReadLine().Split(' ');
            for (int w_ = 0; w_ < W; w_++){
                a[h_, w_] = int.Parse(s[w_]);
            }
        }
        // 処理
        for (int h_ = 0; h_ < H; h_++){
            if (h_ % 2 == 0){
                for (int w_ = 0; w_ < W-1; w_++){
                    if (a[h_, w_] % 2 == 1){
                        a[h_, w_+1]++;
                        outputs[N] = (h_+1) + " " + (w_+1) + " " + (h_+1) + " " + (w_+2);
                        N++;
                    }
                }
                if (h_ < H-1){
                    if (a[h_, W-1] % 2 == 1){
                        a[h_+1, W-1]++;
                        outputs[N] = (h_+1) + " " + W + " " + (h_+2) + " " + W;
                        N++;
                    }
                }
            }
            else {
                for (int w_ = W-1; w_ > 0; w_--){
                    if (a[h_, w_] % 2 == 1){
                        a[h_, w_-1]++;
                        outputs[N] = (h_+1) + " " + (w_+1) + " " + (h_+1) + " " + w_;
                        N++;
                    }
                }
                if (h_ < H-1){
                    if (a[h_, 0] % 2 == 1){
                        a[h_+1, 0]++;
                        outputs[N] = (h_+1) + " " + 1 + " " + (h_+2) + " " + 1;
                        N++;
                    }
                }
            }

        }
		//出力
		Console.WriteLine(N);
        for (int n_=0; n_<N; n_++){
            Console.WriteLine(outputs[n_]);
        }
	}
}

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

#define FOR(i, a, b) for(int i = a; i < b; ++i)
#define REP(i, n) FOR(i, 0, n)
#define _ << " " <<
#define sz(x) ((int) x.size())
#define pb(x) push_back(x)

typedef long long ll;
typedef pair<int, int> point;

const int MAXN = 3e3 + 5;

ll n;
ll a[MAXN];

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

    cin >> n;
    REP(i, n)
        cin >> a[i];

    ll sol = 0;
    REP(i, n)
        sol += a[i] - 1;

    cout << sol;
}


Measured memory_bytes: 256
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
        m: usize,
        c: i32,
        b: [i32; m],
    };

    let mut count = 0;
    for _ in 0..n {
        input! {
            a: [i32; m],
        };

        let a: Vec<i32> = a;

        let mut sum: i32 = 0;
        for (ai, bi) in a.iter().zip(b.iter()) {
            sum += ai * bi;
        }
        sum += c;

        if sum > 0 {
            count += 1;
        }
    }

    println!("{}", count);
}


Measured memory_bytes: 2156