akhauriyash/Code-Regression huggingface dataset:
/**
*     ________   ________   ___        ________          ________   ___        ________       ___    ___  _______    ________
*    |\   ____\ |\   __  \ |\  \      |\   __  \        |\   __  \ |\  \      |\   __  \     |\  \  /  /||\  ___ \  |\   __  \
*    \ \  \___|_\ \  \|\  \\ \  \     \ \  \|\  \       \ \  \|\  \\ \  \     \ \  \|\  \    \ \  \/  / /\ \   __/| \ \  \|\  \
*     \ \_____  \\ \  \\\  \\ \  \     \ \  \\\  \       \ \   ____\\ \  \     \ \   __  \    \ \    / /  \ \  \_|/__\ \   _  _\
*      \|____|\  \\ \  \\\  \\ \  \____ \ \  \\\  \       \ \  \___| \ \  \____ \ \  \ \  \    \/  /  /    \ \  \_|\ \\ \  \\  \|
*        ____\_\  \\ \_______\\ \_______\\ \_______\       \ \__\     \ \_______\\ \__\ \__\ __/  / /       \ \_______\\ \__\\ _\
*       |\_________\\|_______| \|_______| \|_______|        \|__|      \|_______| \|__|\|__||\___/ /         \|_______| \|__|\|__|
*       \|_________|                                                                        \|___|/
*/

#include <ext/rope>
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define ll long long
#define ull unsigned long long
typedef vector<vector<ll>> mat;

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

    int n , d;
    cin >> n >> d;
    cout << (n + 2 * d) / (2 * d + 1);

    return 0;
}


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

using namespace std;
using ll = long long int;
using P = pair<int, int>;

#define loop(i, n) for(int i = 0;i < n;i++)
#define INF 1000000000

int n, m, x;

int ans = INF;


void dfs(int i, vector<int> c, vector<vector<int>> a, int total, vector<int> check){
    bool ok = true;
    loop(j, m){
        if(check[j] < x) ok = false;
    }
    if(ok) ans = min(ans, total);

    if(i == n) return;

    dfs(i+1, c, a, total, check);

    loop(j, m){
        check[j] += a[i][j];
    }
    total += c[i];
    dfs(i+1, c, a, total, check);

    
}

int main(void){

    cin >> n >> m >> x;

    vector<int> c(n);
    vector<vector<int>> a(n, vector<int>(m));
    vector<int> check(m);
    loop(i, n){
        cin >> c[i];
        loop(j, m){
            cin >> a[i][j];
        }
    }

    dfs(0, c, a, 0, check);

    if(ans == INF){
        cout << -1 << endl;
    }else{
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 3628
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
using namespace std;

const long long int INF=99999999999999;
const long long int mod=1000000007;



    long long int n,m,k,sum=0,res=0,a[200005]={},ruiseki[200005]={},xornum[50]={},one=-1,two=-1,three=-1,cou[4]={};
int main() {
    
    map<long long int,long long int>mp;
	cout << fixed << setprecision(10);
    cin>>n;
    
    for(int i=0;i<n;i++){
        cin>>a[i];
        if(one==a[i]){cou[1]++;}
        else if(two==a[i]){cou[2]++;}
        else if(three==a[i]){cou[3]++;}
        if(one==-1){one=a[i];cou[1]=1;}
        if(one!=-1&&one!=a[i]&&two==-1){two=a[i];cou[2]=1;}
        if(one!=-1&&one!=a[i]&&two!=a[i]&&two!=-1&&three==-1){three=a[i];cou[3]=1;}
        if(one!=-1&&two!=-1&&three!=-1&&one!=a[i]&&two!=a[i]&&three!=a[i]){
            cout<<"No"<<endl;
            return 0;
        }
        
    }
    if(cou[1]==n&&one==0){cout<<"Yes"<<endl;return 0;}
    if((cou[1]==2*cou[2]&&two==0||cou[2]==2*cou[1]&&one==0)&&cou[3]==0){cout<<"Yes"<<endl;return 0;}
    if(cou[1]==cou[2]&&cou[2]==cou[3]&&(one ^ two)==three){cout<<"Yes"<<endl;return 0;}
    cout<<"No"<<endl;
} 


Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main(){
	char c;
	cin >> c;

	switch(c){
	case 'a':
	case 'e':
	case 'i':
	case 'o':
	case 'u':
		cout << "vowel" << endl;
		break;
	default:
		cout << "consonant" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
// E - Hopscotch Addict
#include <bits/stdc++.h>

using namespace std;

int main(int argc, char *argv[])
{
	ios::sync_with_stdio(false); cin.tie(0);
	int n, m, s, t;
	cin >> n >> m;
	vector<vector<int > > g(n), h(n);
	for (int i = 0; i < m; i++) {
		int u, v;
		cin >> u >> v;
		u--; v--;
		g[u].push_back(v);
	}
	cin >> s >> t;
	s--; t--;

	vector<int> vi[3], c(n, -1);
	vi[0] = vi[1] = vi[2] = vector<int>(n);
	c[s] = 0;
	vi[0][s] = 1;
	queue<pair<int, pair<int, int> > > q;
	for (q.push(make_pair(s, make_pair(0, 0))); !q.empty(); q.pop()) {
		int u = q.front().first, d = q.front().second.first, i = q.front().second.second, j = (i + 1) % 3;
		for (int i = 0; i < g[u].size(); i++) {
			int v = g[u][i];
			if (vi[j][v]) continue;
			vi[j][v] = 1;
			if (j == 0) {
				c[v] = d + 1;
				q.push(make_pair(v, make_pair(d + 1, j)));
			} else {
				q.push(make_pair(v, make_pair(d, j)));
			}
		}
	}

	cout << c[t] << endl;

	return 0;
}


Measured memory_bytes: 9600
//************************
//*  Date: 2018.8.25     *
//*  Problem:            *
//*  Author: xuziyuan    * 
//************************

#include <bits/stdc++.h>

#define rt0 return 0
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define LL long long
#define pii pair<int,int>
#define pb push_back
#define fi first
#define se second
#define mpr make_pair

using namespace std;

const LL MOD=1e9+7;

int n,k,ans=1e9,lb=0,ub;
int a[100010];

int main()
{
	scanf("%d%d",&n,&k);
	rep(i,n) scanf("%d",&a[i]);
	ub=k-1;
	for(;ub<n;lb++,ub++)
	{
		int res=0;
		if((a[lb]<=0&&a[ub]<=0)||(a[lb]>=0&&a[ub]>=0)) res=max(abs(a[lb]),abs(a[ub]));
		else res=(min(-a[lb],a[ub]))*2+max(-a[lb],a[ub]);
		//cout<<lb<<' '<<ub<<' '<<res<<' '<<min(-a[lb],a[ub])<<' '<<max(-a[lb],a[ub])<<endl;
		ans=min(ans,res);
	}
	printf("%d\n",ans);
	rt0;
}

Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>

using namespace std;

#define INF 1 << 29
#define LL long long int

LL const MOD = 1000000007;

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

    LL n,k;
    cin >> n >> k;

    vector<LL> a(n+1);

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

    vector<LL> sum(n+1,0),unsum(n+1,0);

    for(int i = 1; i < n+1; i++){
        sum[i] = sum[i-1] + a[i];
        unsum[i] = unsum[i-1] + (a[i] < 0 ? 0 : a[i]);
    }

    LL ans = 0;

    for(int i = 1; i + k - 1 < n+1; i++){
        LL tmp = (sum[i+k-1] - sum[i-1] < 0 ? 0 : sum[i+k-1] - sum[i-1]) + unsum[i-1] + unsum[n] - unsum[i+k-1];
        if(tmp > ans){
            ans = tmp;
        }
    }

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

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

//template
#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 ALL(v) (v).begin(),(v).end()
typedef long long int ll; typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A,size_t N,typename T>void Fill(A(&array)[N],const T &val){fill((T*)array, (T*)(array+N), val);}
const int inf = 0x3fffffff; const ll INF = 0x3fffffffffffffff;
//template end



int main(){
    int n; scanf("%d",&n); ll ans[100010]={};
    vector<P> a(n);
    rep(i,0,n)scanf("%lld",&a[i].first),a[i].second=-i;
    sort(ALL(a),greater<P>()); a.push_back({0,0});
    ll pre[2]={a[0].first,a[0].second};
    rep(i,1,n+1){
        ans[-pre[1]]+=i*(pre[0]-a[i].first),pre[0]=a[i].first,chmax(pre[1],a[i].second);
    }
    rep(i,0,n)printf("%lld\n",ans[i]);
    return 0;
}

Measured memory_bytes: 5760
#include<bits/stdc++.h>
using namespace std;
int n,m;
string a;
int main(){
    cin>>n>>m>>a;
    if(a[n]!='-') return cout<<"No"<<endl,0;
    for(int i=0;i<=n+m;i++){
        if(i==n) continue;
        if(a[i]<'0' || a[i]>'9') return cout<<"No"<<endl,0;
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 256
/**

  @@@@@@@  @@@@  @@@@  @@@@  @@@@  @
  @  @  @  @  @  @  @  @  @  @  @  @
  @  @  @  @  @  @  @  @  @  @  @  @
  @  @  @  @  @  @  @  @  @  @  @  @
  @  @  @  @@@@  @@@@  @@@@  @  @  @

**/
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ull unsigned long long
#define db double
#define ld long double
#define str string
#define pi pair
#define tup tuple
#define vec vector
#define temp template
#define tn typename

#define ff first
#define ss second
#define SZ(x) (ll) x.size()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define rsz resize
#define ins insert
#define fr front
#define bc back
#define pf push_front
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define mk make_pair

#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define ROF(i, a, b) for (ll i = (a); i >= (b); i--)
#define trav(a, x) for (auto &a : x)
#define popcount __builtin_popcountll
#define ctz __builtin_ctzll
#define clz __builtin_clzll
#define gcd __gcd

// DEBUG
#define ts to_string
temp<tn A, tn B> str ts(pi<A, B> p);
temp<tn A, tn B, tn C> str ts(tup<A, B, C> p);
str ts(const str& s) { return '"' + s + '"'; }
str ts(const char* s) { return ts((str) s); }
str ts(bool b) { return (b ? "true" : "false"); }
str ts(vec<bool> v) { bool f = true; str res = "{";
FOR(i, 0, static_cast<ll>(v.size()) - 1)
{ if (!f) res += ", "; res += ts(v[i]);
f = false; } res += "}"; return res; }
temp<size_t N> str ts(bitset<N> v) { str res = "";
trav(a, v) { res += (char) ('0' + a); } return res; }
temp<tn A> str ts(A v) { bool f = true; str res = "{";
trav(x, v) { if (!f) res += ", "; res += ts(x);
f = false; } res += "}"; return res; }
temp<tn A, tn B> str ts(pi<A, B> p) {
  return "(" + ts(p.ff) + ", " + ts(p.ss) + ")"; }
temp<tn A, tn B, tn C> str ts(tup<A, B, C> t) {
  return "(" + ts(get<0>(t)) + ", " + ts(get<1>(t)) + ", " + ts(get<2>(t)) + ")"; }
void DBG() { cerr << endl; }
temp<tn H, tn... T> void DBG(H h, T... t) { cerr << " " << ts(h); DBG(t...); }
#ifdef LOCAL
#define dbg(...) cerr << "[" << #__VA_ARGS__ << "]:", DBG(__VA_ARGS__);
#else
#define dbg(...) 42
#endif

// INPUT AND OUTPUT
temp<tn T> void re(T& x) { cin >> x; };
temp<tn H, tn... T> void re(H& h, T&... t) { re(h); re(t...); }
temp<tn T> void pr(T x) { cout << x; };
temp<tn H, tn... T> void pr(H h, T... t) { pr(h); pr(t...); }
temp<tn T> void pri(T x) { cout << x; cout << endl; }; // used for interactives
temp<tn H, tn... T> void pri(H h, T... t) { pri(h); pri(t...); }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll a, b, v, w, t;
  re(a, v, b, w, t);
  if (a > b) {
  	if (a - t * v <= b - t * w) {
  		pr("YES", '\n');
  		return 0;
		}
		pr("NO", '\n');
		return 0;
	}
	if (a + t * v >= b + t * w) {
		pr("YES", '\n');
		return 0;
	}
	pr("NO", '\n');
  return 0;
}



Measured memory_bytes: 3656
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#ifdef ENABLE_DEBUG
#define dump(a) cerr<<#a<<"="<<a<<endl
#define dumparr(a,n) cerr<<#a<<"["<<n<<"]="<<a[n]<<endl
#else
#define dump(a) 
#define dumparr(a,n) 
#endif
#define FOR(i, a, b) for(ll i = a;i < b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(ll i = b-1;i >= a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)
#define SIGN(a) (a==0?0:(a>0?1:-1))

typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll,pll> ppll;
typedef vector<ll> vll;

const ll INF=(1LL<<50);
#if __cplusplus<201700L
ll gcd(ll a, ll b) {
  if(a < b) return gcd(b, a);
  ll r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}
#endif

template<class S,class T>
std::ostream& operator<<(std::ostream& os,pair<S,T> a){
  os << "(" << a.first << "," << a.second << ")";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,vector<T> a){
  os << "[ ";
  REP(a.size()){
    os<< a[i] << " ";
  }
  os<< " ]";
  return os;
}


void solve(std::string C){
  cout<<char(C[0]+1)<<endl;
}

int main(){
    std::string C;
    std::cin >> C;
    solve(C);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,n,s) for(int i = s; i < (n); ++i)
#define rsrep(i,n,s) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;

int main() {
    int n;
    cin >> n;
    vpair r(n), b(n);
    rep(i, n) {
        int a, b;
        cin >> a >> b;
        r[i].fi = a;
        r[i].se = b;
    }
    rep(i, n) {
        int c, d;
        cin >> c >> d;
        b[i].fi = c;
        b[i].se = d;
    }
    int ans = 0;
    vbool use(n, false);
    sort(all(b));
    rep(i, n) {
        int mx = -1;
        int id = -1;
        rep(j, n) {
            if (use[j]) continue;
            if (b[i].fi > r[j].fi && b[i].se > r[j].se && r[j].se > mx) {
                mx = r[j].se;
                id = j;
            }
        }
        if (id != -1) {
            ans++;
            use[id] = true;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import numpy as np
n=int(input())
a=[]
m=[]
for i in range(n):
  a.append(int(input()))
m.append(a.index(max(a)))
m.append(a.pop(m[0]))
m.append(max(a))

for i in range(m[0]):
  print(m[1])
  
print(m[2])

for i in range(m[0]+1,n):
  print(m[1])

Measured memory_bytes: 21700
#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; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main()
{
    int N;
    cin >> N;
    vector<vector<int>> G(N);
    vector<pair<int, int>> edges(N - 1);
    rep(i, 0, N - 1)
    {
        int a, b;
        cin >> a >> b;
        --a; --b;
        G[a].push_back(b);
        G[b].push_back(a);
        edges[i] = make_pair(a, b);
    }

    vector<int> c(N);
    rep(i, 0, N) cin >> c[i];
    sort(c.rbegin(), c.rend());

    vector<int> scores(N, 0);

    priority_queue<pair<int, int>> pq;
    rep(i, 0, N)
    {
        pq.push(make_pair(G[i].size(), i));
    }

    queue<int> q;
    q.push(get<1>(pq.top()));

    int scoreIndex = 0;

    vector<bool> visited(N, false);

    while (!q.empty())
    {
        int index = q.front();
        q.pop();

        if (visited[index]) continue;

        visited[index] = true;
        scores[index] = c[scoreIndex++];
        if (scoreIndex >= N) break;

        for (const int node : G[index])
        {
            if (visited[node]) continue;
            q.push(node);
        }
    }

    int sum = 0;
    rep(i, 0, N - 1)
    {
        sum += min(scores[edges[i].first], scores[edges[i].second]);
    }
    cout << sum << endl;

    rep(i, 0, N)
    {
        cout << scores[i] << " ";
    }
    cout << endl;
}


Measured memory_bytes: 1280
#include<iostream>
    #include<string>
    using namespace std;
    int main()
     
    {
      string N;
      cin>>N;
      if((N[0]==N[1] && N[1]==N[2]) ||(N[1]==N[2] && N[2]==N[3]))
        {
          cout<<"Yes"<<endl;
        }else{
        cout<<"No"<<endl;
      }
      return 0;
    }


Measured memory_bytes: 256
a, b, c, x, y = map(int, input().split())
mini = 10000000000
if x < y: temp = y
else: temp = x
for i in range(0, temp * 2 + 1, 2):
    a_price = a * (x - int(i/2))
    b_price = b * (y - int(i/2))
    if a_price < 0:
        a_price = 0
    if b_price < 0:
        b_price = 0
    price = a_price + b_price + c * i
    # print(x - i/2, y - i/2, i, price)
    if price < mini:
        mini = price
print(mini)

Measured memory_bytes: 3064
#include <stdio.h>

/* 配列の要素を順番に出力 */
void trace(int A[],int N) {
    int i;
    for(i=0;i<N;i++) {
        /* 隣接する要素の間に1つの空白を出力 */
        if(i>0) printf(" ");
        printf("%d",A[i]);
    }
    printf("\n");
}

/* 挿入ソート(0オリジン配列) */
void insertionSort(int A[], int N) {
    int i,j,v;
    for(i=1;i<N;i++) {
        v=A[i];
        j=i-1;
        while(j>=0 && A[j] > v) {
            A[j+1] = A[j];
            j--;
        }
        A[j+1]=v;
        trace(A,N);
    }
}

int main(void)
{
    int N, i;
    int A[100];
    scanf("%d",&N);
    for(i=0;i<N;i++) scanf("%d",&A[i]);
    
    trace(A,N);
    insertionSort(A,N);
    return 0;
}



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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define FOR(i, start, end) for(int i = (start); i < (end); i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;

int H, W;
vs S;

int check(int x, int y)
{
    int dx[] = {-1, 0, 1};
    int dy[] = {-1, 0, 1};

    int res = 0;
    REP(i, 3)
    {
        REP(j, 3)
        {
            int nx = x + dx[i];
            int ny = y + dy[j];

            if(nx >= 0 && nx < W && ny >= 0 && ny < H)
            {
                if(S[ny][nx] == '#') res++;
            }
        }
    }

    return res;
}

void solve()
{
    cin >> H >> W;
    S = vs(H); REP(i, H) cin >> S[i];

    REP(i, H)
    {
        REP(j, W)
        {
            if(S[i][j] == '.')
            {
                cout << check(j, i);
            }
            else cout << S[i][j];
        }
        cout << endl;
    }
}

int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    solve();

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    double a,b,h,m;
    cin >> a >> b >> h >> m;
    double hangle = 30.0*h+(m/2.0);
    double mangle = 6.0*m;
    double theta = abs(hangle - mangle);
    double x = (M_PI * theta)/180.0;
    double ans = sqrt(pow(b,2) + pow(a,2) - 2*a*b*cos(x));
    printf("%.18f",ans);
}

Measured memory_bytes: 4228
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define REP2(i,x,n) for (int i = x; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);
static const int INF = 1e9+7;
#define REP(i,n) for (int i = 0; i <(n); ++i)
//debug 
#ifdef _DEBUG
#define debug(var)  do{cout << #var << " :";view(var);}while(0)
#else
#define debug(...)
#endif
template<typename T> void view(T e){cout << e << endl;}
template<typename T> void view(const vector<T>& v){for(const auto& e : v){ cout << e << " "; } cout << endl;}
template<typename T> void view(const vector<vector<T> >& vv){ for(const auto& v : vv){ view(v); } }


int main(){
  //in
  int n;
  cin >> n;
  vector<int> a(n);
  REP(i,n) cin >> a[i];

  //n = 1
  if(n == 1){
    if(a[0]%4 == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
  }

  //2で割り切れる回数が0,1,2をカウント
  int num2 = 0,num1 = 0,num0 = 0;
  debug(num2);
  debug(num1);
  debug(num0);
  REP(i,n){
    if(a[i]%4 == 0) num2++;
    else if (a[i]%2 == 0) num1++;
    else num0++;
  }

  debug(num2);
  debug(num1);
  debug(num0);

  bool ok = false;
  if(num1 > 0) num0++;
  if(num2 + 1 >= num0) ok = true;
  //if(num1 > 1 && num2 >= num0) ok = true;

  if(ok) cout << "Yes" << endl;
  else cout << "No" << endl;
  //out
  return 0;
}

Measured memory_bytes: 3780
#include<bits/stdc++.h>
#define dbug printf("I am here\n");
#define Fast ios_base::sync_with_stdio(false); cin.tie(0);
#define vs              v.size()
#define ss               s.size()
#define sot(v)        sort(v.begin(),v.end())
#define rev(v)        reverse(v.begin(),v.end())
#define ii                pair<int,int>
#define ll                long long
#define ull              unsigned long long
#define pb              push_back
#define mpp          make_pair
#define Okay         0
#define pi               3.14159

using namespace std;
const int ll cont = 10e6;
static const ll inf = 1e11;
void solve(){
    ll n, m;
    cin>>n;
    vector<int>a(n), b(n), permu(n);
    for(int i=0; i<n; i++){
        cin>>a[i];
    }
    for(int i=0; i<n; i++){
        cin>>b[i];
    }

    for(int i=0; i<n; i++)permu[i] = i+1;

    int cnt = 0, aa =0, bb = 0;
      while(next_permutation(permu.begin(), permu.end())){
//            for(int i=0; i<n; i++)cout<<permu[i]<<" ";
//            cout<<endl;
        cnt++;
        if(a == permu)aa = cnt;
        if(b == permu)bb = cnt;
      }
    cout<<abs(aa-bb)<<endl;
}

int main(){
    Fast;
    solve();

    return Okay;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
#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(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }

using P = pair<int, int>;
typedef long long ll;

const int MOD = 1e9+7;
const int INF = 1e9;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;cin>>N;
    vector<ll> h(N);
    rep(i,N)cin>>h[i];
    ll dp[N];
    rep(i,N+1)dp[i] = INF;
    dp[0] = 0;
    rep(i,N){
        if(i+1<N){
            dp[i+1] = min(dp[i+1], dp[i] + abs(h[i+1]-h[i]));
        }
        if(i+2<N){
            dp[i+2] = min(dp[i+2], dp[i] + abs(h[i+2]-h[i]));
        }
    }
    cout<<dp[N-1]<<endl;
}

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

int main(){
    long long k;
    cin >> k;
    vector<long long> ans(50, (k + 49) / 50 + 49);
    int s = (k + 49) / 50 * 50 - k;
    if (s != 0){
        for (int i = 0; i < 50; i++){
            if (i < s) ans[i] -= 51 - s;
            else ans[i] += s;
        }
    }
    cout << 50 << endl;
    for (int i = 0; i < 50; i++) {
        cout << ans[i];
        if (i != 49) cout << " ";
        else cout << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>

using namespace std;

int main(){

long long a,b,c,d,A,B;	
cin>>a>>b>>c>>d;
A = a*b;
B = c*d;

if(A >B) cout<<A<<endl;
if(A <B) cout<<B<<endl;
if(A==B) cout<<A<<endl;

return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int m,f,r,ans;
	
	while(1){
		scanf("%d",&m);
		scanf("%d",&f);		
		scanf("%d",&r);
		
		ans = m + f;
		
		if(m == -1 && f == -1 && r == -1){
			break;
		}
		
		else if(m == -1 || f == -1){
			printf("F\n");
		}
		
		else if(ans >= 80 ){
			printf("A\n");
		}
		
		else if(ans >= 65 && ans < 80 ){
			printf("B\n");
		}	
		
		else if(ans >= 50 && ans < 65){
			printf("C\n");
		}	
		
		else if(ans >= 30 && ans < 50 && r < 50){
			printf("D\n");
		}
		else if(50 <= r){
			printf("C\n");			
		}
		else if( ans < 30 ){
			printf("F\n");
		}
		

		
		else {
			
		} 
		
		
		
		
	}
	
	
	return 0;
}

Measured memory_bytes: 584
from collections import deque
Q=deque()
Q.append((0,1))
n,q=map(int,input().split())
edges=[[] for i in range(n+1)]
cnt=[0 for i in range(n+1)]
for i in range(n-1):
  a,b=map(int,input().split())
  edges[a].append(b)
  edges[b].append(a)
for i in range(q):
  p,x=map(int,input().split())
  cnt[p]+=x
while(Q):
  k=Q.popleft()
  cnt[k[1]]+=cnt[k[0]]
  for i in edges[k[1]]:
    if i!=k[0]:
      Q.append((k[1],i))
for i in range(1,n+1):
  print(cnt[i], end=" ")

Measured memory_bytes: 105036
// atc.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <vector>
#include <string>
#include    <algorithm>
using namespace std;

//int n, m, x;
//
//vector<int> c(12,0);
//vector<vector<int>> A(12, vector<int>(12, 0));



int main()
{
    int n, k,tmp;
    int min= 2147483647;
    cin >> n >> k;

    vector<double> H(n, 0);
    for (int i = 0; i < n; i++) {
        cin >> H[i];
    }

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

    for (int i = 0; i < n-k+1; i++) {
        tmp = H[i + k - 1] - H[i];
        if (tmp < min) {
            min = tmp;
        }
    }
    

    printf("%d", min);


    return 0;

}

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

int main(){
  int64_t N,M;
  cin>>N>>M;
  
  vector<int> ac(N+1,0);
  vector<int> s(N+1,0);
  
  for(int i=0;i<M;++i){
    int p;
    string st;
    cin>>p>>st;
    
    if(st=="AC" && ac[p]==0){
      ac[p]=1;
    }
    else if(st=="WA" && ac[p]==0){
      s[p] += 1;
    }
  }

  int ans=0;
  int pena=0;
  for(int i=1;i<=N;++i){
    ans += ac[i];
    if(ac[i]==1){
      pena += s[i];
    }
  }

  cout<<ans<<" "<<pena<<endl;
}

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

#define ll long long
#define EPSION numeric_limits<double>::epsilon()
#define REP(i,n) for(int i=0; i<n; ++i)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;

//ifstream f("input.in");
//ofstream g("output.out");

signed main(int argc, char **argv)
{
    IOS;

    ll a[5];
    ll dp[6] = {0};
    ll ans = 0;
    ll n, mi = LLONG_MAX;
    cin>>n;
    REP(i, 5)
    {
        cin>>a[i];
        if(mi > a[i])
            mi = a[i];
    }

    ans += 5;
    n -= mi;

    ans += (n / mi);
    if(n % mi > 0)
        ans++;

    cout<<ans;

    return 0;
}




Measured memory_bytes: 256
#include<iostream>
#include<string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstdint>
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main(){

int n;

cin >> n;

int d,sum;

cin >> d >> sum;

for(int i = 0; i < n; i++){
int a;
cin >> a;
sum += ((d-1)/a + 1);
}

cout << sum << endl;

return 0;
}

Measured memory_bytes: 256
/* When Talent doesn't work, Hard work beats Talent*/

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#include"bits/stdc++.h"

using namespace std;

#define Fast_D cout<<fixed<<setprecision(13);
#define FastIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#define nl "\n"
#define int long long
#define double long double
#define all(v) v.begin(),v.end()
#define scanstr(s) cin>>ws; getline(cin,s);

int tab[100001] ;

const int M = 1e9 +7;

int binaryExponentiation(int x,int n)
{
    int result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=result%M * x%M ;
        x=(x*x)%M;
        n=n/2;
    }
    return result%M;
}

const double PI = 3.141592653589793;

bool odd(int n)
{
	if(tab[0]!=1) return 0;
	for(int i=2;i<n;i+=2) if(tab[i] != 2) return 0;
	return 1;
}

bool even(int n)
{
	if(tab[0]!=0) return 0;
	for(int i=1;i<n;i+=2) if(tab[i] != 2) return 0;
	return 1;
}

void solve()
{
	int n;
	cin >> n;
	for(int i=0;i<n;i++)
	{
		int x;
		cin >> x;
		tab[x]++;
	}
	if((n%2==0 && even(n)) || (n%2==1 && odd(n)))
	{
		cout << binaryExponentiation(2,n/2);
	}
	else cout << "0";
}

int32_t main()
{
	FastIO;
	Fast_D;
	solve();
	return 0;
}


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

int main() {
  int n,k,ans=1;
  cin>>n>>k;
  for (int i=0;i<n;i++) {
    if (ans*2>ans+k) ans+=k;
    else ans*=2;
  }
  cout<<ans<<endl;
}

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

int main(){
  int n,m;
  cin >>n >>m;
  cout << (m*(m-1)+n*(n-1))/2 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>

#define MIN(a, b) (a < b ? a : b)
#define MAX(a, b) (a > b ? a : b)

int main(void) {
	uint32_t A, B;

	scanf("%"PRIu32"\n%"PRIu32, &A, &B);

	printf("%s", A <= 8 && B <= 8 ? "Yay!" : ":(");

	return 0;
}


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

int main(){
    int n,d;
    cin >> n >> d;
    d = d*2 + 1;
    int ans;
    if(n%d == 0){
        ans = n/d;
    }
    else{
        ans = n/d + 1;
    }

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

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"io"
	"log"
	"os"
	"strconv"
)

func main() {
	b := readBytes()
	if b[2] == b[3] && b[4] == b[5] {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

// sort ------------------------------------------------------------

type xxx struct {
	x int
}

type sortArray []xxx

func (s sortArray) Len() int           { return len(s) }
func (s sortArray) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s sortArray) Less(i, j int) bool { return s[i].x < s[j].x }

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

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	log.SetFlags(log.Lshortfile)
	readString, readBytes = newReadString(os.Stdin)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func sum(a []int) int {
	var ret int
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumFloat64(a []float64) float64 {
	var ret float64
	for i := range a {
		ret += a[i]
	}
	return ret
}

func gcd(m, n int) int {
	for m%n != 0 {
		m, n = n, m%n
	}
	return n
}

func lcm(m, n int) int {
	return m / gcd(m, n) * n
}


Measured memory_bytes: 640
#include<stdio.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
 
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;



int main(int argc, char const *argv[])
{
	int a,b,c,d;
	cin >> a >> b >> c >> d;
	if(a*b>c*d)
		cout << a*b << endl;
	else 
		cout << c*d << endl;

	return 0;
}

Measured memory_bytes: 256
from collections import deque
n,m=map(int,input().split())
g=[[] for i in range(n)]
ro=[0]*n
for i in range(n+m-1):
    a,b=map(int,input().split())
    g[a-1].append(b)
    ro[b-1]+=1
for i in range(n):
    if ro[i]==0:
        r=i
ans=[0]*n
q=deque([r])
while len(q)>0:
    u=q.popleft()
    for v in g[u]:
        ro[v-1]-=1
        if ro[v-1]==0:
            ans[v-1]=u+1
            q.append(v-1)
for i in ans:
    print(i)


Measured memory_bytes: 23948
from collections import deque
N,Q = map(int, input().split())
a = [0] * (N-1)
b = [0] * (N-1)
g=[[] for i in range(N+1)]
for i in range(N-1):
    a[i], b[i] = map(int, input().split())
    g[a[i]].append(b[i])
    g[b[i]].append(a[i])
p = [0] * Q
x = [0] * Q
ans=[0]*(N+1)
for i in range(Q):
    p[i], x[i] = map(int, input().split())
    ans[p[i]]+=x[i]
    
q = deque([1]) 
ch=[0]*(N+1)
while len(q) > 0:
    pp = q.popleft()     # キュー取りだし（先頭）
    if ch[pp]==0:
        ch[pp]=1
    for u in g[pp]:
        if ch[u]==1:
            continue
        ans[u]+=ans[pp]
        q.append(u)
    #print(pp,l,q)

    
for i in range(1,N+1):
    print(ans[i],end=' ')

Measured memory_bytes: 124928
#include <iostream>
#include <queue>
#include <unordered_map>
#include <vector>
using namespace std;

int main(){
    int n,m;
    cin >> n >> m;
    vector<vector<int>> map(n+1);
    int a,b;
    for(int i = 0;i<m;++i){
        cin >> a >> b;
        map[a].push_back(b);
        map[b].push_back(a);
    }
    unordered_map<int,int> solution;
    solution[1] = 0;
    queue<int> bfs;
    bfs.push(1);
    while(bfs.size()){
        int n = bfs.size();
        for(int i = 0;i<n;i++){
            int cur = bfs.front();
            for(int next:map[cur]){
                if(solution.find(next)==solution.end()){
                    solution[next] = cur;
                    bfs.push(next);
                }
            }
            bfs.pop();
        }
    }
    if(n==1){
        cout << "Yes" << endl;
        return 0;
    }
    for(int i = 2;i<=n;i++) {
        if(solution.find(i)==solution.end()){
            cout <<"No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    for(int i = 2;i<=n;i++){
        cout << solution[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 13784
#include <iostream>

using namespace std;
const int N=1e5+55;
bool dp[N];

int main()
{
    int n,k;
    cin>>n>>k;
    int a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];

    for(int i=1;i<=k;i++)
    {
        bool q=0;
        for(int j=0;j<n;j++)
        {
            if(i>=a[j]&&dp[i-a[j]]==0)
                q=1;
        }
        dp[i]=q;
    }
    if(dp[k])
        cout<<"First"<<endl;
    else
        cout<<"Second"<<endl;
    return 0;
}


Measured memory_bytes: 384
#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++)
using ll = long long;
using VI = vector<int>;
using VVI = vector<vector<int>>;
using P = pair<int, int>;

int main(){
	int n;
    cin >> n;
    int ans=0, a;
    rep(i,n){
        cin >> a;
        ans += a - 1;
    }

    cout << ans << endl;

	return 0;
}

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

using i8  = int8_t;   /* -128 ~ 127 */
using u8  = uint8_t;  /* 0 ~ 255 */
using i16 = int16_t;  /* -32,768 ~ 32,767 */
using u16 = uint16_t; /* 0 ~ 65,535 */
using i32 = int32_t;  /* -2,147,483,648 ~ 2,147,483,647 */
using u32 = uint32_t; /* 0 ~ 4,294,967,295 */
using i64 = int64_t;  /* -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 */
using u64 = uint64_t; /* 0 ~ 18,446,744,073,709,551,615 */
using f32 = float;    /* (-3.4 * 10^38) ~ (3.4 * 10^38) */
using f64 = double;   /* (-1.7 * 10^308) ~ (1.7 * 10^308) */
using f80 = __float80;
template <class T> using Vec = vector<T>;
constexpr i64 INF = 1010000000000000017;
constexpr i64 MOD = 1e9 + 7;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define YN(y, n, b) (b? y : n)
#define ALL(v) v.begin(), v.end()
#define GCD(a, b) __gcd(a, b) /* 最大公約数 */
#define LCM(a, b) a / __gcd(a, b) * b /* 最小公倍数 */

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

void Main() {
    i32 L, R, d;
    cin >> L >> R >> d;
    i32 sum = 0;
    for (i32 i = L; i <= R; i++) {
        if (i % d == 0) sum++;
    }
    cout << sum << endl;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define rep(i,ini,n) for(int i=ini;i<n;i++)
#define _rep(i,ini,n) for(int i=ini;i>=n;i--)
#define ToEnd(a) a.begin(),a.end()
uint64_t MOD=1000000007;

int main(){
    int N; cin>>N;
    vector<int> A(N);
    rep(n,0,N) cin>>A.at(n);

    vector<bool> TurnOn(N,false);
    TurnOn.at(0)=true;

    int i=0,ans=0;
    while(1){
        i=A.at(i)-1;
        ans++;
        if(i==1) break;
        if(TurnOn.at(i)){ans=-1; break;}
        TurnOn.at(i)=true;
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define int long long
#define mp make_pair
#define pb push_back
#define eb emplace_back
const int MOD=1e9+7;
const int INF=1e18;

signed main(){
    int A,B,H;cin>>A>>B>>H;
    cout<<(A+B)*H/2<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>
#include <list>
#include <iomanip>

using namespace std;
typedef long long ll;
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define all(x) x.begin(),x.end()


int main(){
	string s;cin>>s;
	int k;cin>>k;
	set<string> st;
	for(int l=1; l<=k; ++l){
	    for(int i=0; i+l<=s.size(); ++i){
	        st.insert(s.substr(i,l));
	    }
	}
    auto it=st.begin();
    while(--k)++it;
    cout<<*it<<endl;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0) 
#define X first
#define Y second 
#define nl '\n'
#define AC return 0
#define pb(a) push_back(a) 
#define mst(a,b) memset(a, b, sizeof a)
#define rep(i,n) for(int i = 0; (i)<(n); i++)
#define rep1(i,n) for(int i = 1; (i)<=(n); i++)
#define scd(a) scanf("%lld", &a)
#define scdd(a,b) scanf("%lld%lld", &a, &b)
#define scs(s) scanf("%s", s)
//#pragma GCC optimize(2)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
const ll INF = (ll)0x3f3f3f3f3f3f3f, MAX = 9e18, MIN = -9e18;
const int N = 1e6+10, M = 2e6+10, mod = 1e9+7, inf = 0x3f3f3f;
ll cnt[N], pre[N]; 

int find(int x)
{
	return x == pre[x] ? x : pre[x] = find(pre[x]);
}

int main()
{
	IOS;
	ll n, m, ans = MIN;
	cin>>n>>m;
	rep1(i, n)
		pre[i] = i;
	while(m--)
	{
		int a, b;
		cin>>a>>b;
		int x = find(a), y = find(b);
		if(x != y)
			pre[x] = y;
	}
	rep1(i, n)
	{
		int x = find(i);
		cnt[x]++, ans = max(ans, cnt[x]);
	}
	cout<<ans<<nl;
	
	AC;
} 

Measured memory_bytes: 11348
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size)
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
using lint = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main()
{
    int N;
    cin >> N;
    int ans = N*N*N;
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<functional>
#include<numeric>
#include<climits>
#include<queue>
 
using namespace std;

int s(long long n) {
	if (n < 10)return n;
	return n % 10 + s(n/10);
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, m;
	cin >> n >> m;
	vector<vector<int>> g(n+1, vector<int>());
	int a, b;
	for (int i = 0; i < m; ++i) {
		cin >> a >> b;
		g[a].push_back(b);
		g[b].push_back(a);
	}
	vector<bool> used(n + 1, false);
	used[a] = true;
	used[b] = true;
	vector<int> ansa{ a };
	vector<int> ansb{ b };
	bool refreshed = true;
	while (refreshed) {
		refreshed = false;
		for (const auto& e : g[a]) {
			if (!used[e]) {
				used[e] = true;
				ansa.push_back(e);
				a = e;
				refreshed = true;
				break;
			}
		}
	}
    refreshed = true;
	while (refreshed) {
		refreshed = false;
		for (const auto& e : g[b]) {
			if (!used[e]) {
				used[e] = true;
				ansb.push_back(e);
				b = e;
				refreshed = true;
				break;
			}
		}
	}
	cout << ansa.size() + ansb.size() << endl;
	for (int i = ansa.size() - 1; i >= 0;--i) {
		cout << ansa[i] << " ";
	}
	for (int i = 0; i < ansb.size()-1; ++i) {
		cout << ansb[i] << " ";
	}
	cout << ansb[ansb.size() - 1] << endl;


	return 0;
}

Measured memory_bytes: 6904
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (a * b) % mod
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define fi first
#define se second
typedef pair<int,int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;

int a[200000];
signed main(){
	int a, b;
	scanf("%lld%lld", &a, &b);
	if(a <= 0 and 0 <= b)printf("Zero\n");
	else if(a < 0 and b < 0){
		if((b-a)%2 == 0)printf("Negative\n");
		else printf("Positive\n");
	}else{
		printf("Positive\n");
	}
	return 0;
}







Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <string>
#include <stdlib.h>
#include <algorithm>
#include <functional>
 
using namespace std;
 
int main(void) {
	unsigned long int N, num = 1;
	unsigned long int H[101];
	cin >> N;
	for(int i = 0 ; i < N ; i++){
	    cin >> H[i];
	}
	
	for(int i = 1 ; i < N ; i++){
	    for(int j = 0 ; j < i ; j++){
	        if(H[j] > H[i]){
	            break;
	        }
	        if(j == i-1){
	            num++;
	        }
	    }
	}

    cout << num;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
vector<int> to[100010];
vector<int> ans(100010,-1);

void bfs(int i, int p){
    queue<pair<int,int>> queue;
    queue.push({i,p});
    //cout<<i<<"start"<<endl;
    while(queue.empty()==0){
        int ni = queue.front().first, np = queue.front().second;
        queue.pop();
        for(auto u : to[ni]){
            if(ans[u]==-1 && u!=np){
                ans[u]=ni;
                queue.push({u,ni});
            }
        }
    }
}

int main(){
    int n,m;
    cin >> n >> m;
    rep(i,m){
        int a,b;
        cin >> a >> b;
        a--; b--;
        to[a].push_back(b);
        to[b].push_back(a);
    }
    bfs(0,-2);
    cout<<"Yes"<<endl;
    for(int i=1;i<n;i++){
        cout<<ans[i]+1<<endl;
    }
    return 0;
}

Measured memory_bytes: 10520
def cin():  return list(map(int,input().split()))

N, M, Q = list(map(int,input().split()))
v = [[0 for _ in range(N)] for _ in range(N)]
p = [[0 for _ in range(2)] for _ in range(Q)]

for _ in range(M):
    a, b = cin()
    v[a - 1][b - 1] += 1;

for i in range(Q):
    a, b = cin()
    p[i][0] = a - 1;
    p[i][1] = b - 1;
    
def d2_add(a):
    w = len(a[0])
    h = len(a)
    da = [[0] * w for j in range(h)]
    da[0][0] = a[0][0]
    for i in range(1, w):
        da[0][i] = da[0][i - 1] + a[0][i]
    for i in range(1, h):
        cnt_w = 0
        for j in range(w):
            cnt_w += a[i][j]
            da[i][j] = da[i - 1][j] + cnt_w
    return da

def d2_calc(da, x1, y1, x2, y2):
    if x1 > x2 or y1 > y2:  return 0
    if x1 == 0 and y1 == 0:  return da[x2][y2]
    if x1 == 0:  return da[x2][y2] - da[x2][y1 - 1]
    if y1 == 0:  return da[x2][y2] - da[x1 - 1][y2]
    return da[x2][y2] - da[x1 - 1][y2] - da[x2][y1 - 1] + da[x1 - 1][y1 - 1]

ret = d2_add(v)
for i in range(Q):
    ans = d2_calc(ret, p[i][0], p[i][0], p[i][1], p[i][1])
    print(ans)

Measured memory_bytes: 93568
#include <iostream>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<vector>
using namespace std;

int main()
{
    long long int i,j,count=0;
    string s,t;
    cin>>s>>t;
    for(i=0,j=0; i<s.size(),j<t.size();i++,j++)
        if(s[i]!=t[j])
            count++;
    cout<<count<<endl;
    return 0;
}

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

int main(){
    long int n;
    cin>>n;
    vector<tuple<int,int>>a(n);
    for(int i=1;i<n+1;i++){
        long int v;
        cin>>v;
        get<0>(a.at(i-1))=v;
        get<1>(a.at(i-1))=i;
    }
    sort(a.begin(),a.end());
    for(int i=0;i<n;i++){
        cout<<get<1>(a.at(i));
        if(i==n-1)cout<<endl;
        else cout<<" ";
    }
}

Measured memory_bytes: 1536
x,y,a,b,c=map(int,input().split())
p=list(map(int,input().split()))#aこ
q=list(map(int,input().split()))#bko
r=list(map(int,input().split()))#cko



ans=0
p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)



ac=x-1
bc=y-1
for i in range(c):
    #print("DFGH")
    if p[ac]<q[bc] and p[ac]<r[i]:
        p[ac]=r[i]
        ac=max(0,ac-1)
    
    elif p[ac] >= q[bc] and q[bc]<r[i]:
        q[bc]=r[i]
        bc=max(0,bc-1)


for i in range(x):
    ans+=p[i]

    
for i in range(y):
    ans+=q[i]
print(ans)


Measured memory_bytes: 23328