akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <ccomplex>
#include <vector>
#include <cassert>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric>
#include <list>
#include <assert.h>
#include <math.h>
#include <valarray>
#include <stdio.h>
#include <algorithm>
#include <set>
#include <complex>
#include <list>
#include <time.h>
#include <stack>
#include <locale>
#include <clocale>
#include <ctype.h>
#include <wchar.h>
#include <random>
#include <vector>
#include <unordered_map>
#include <bitset>

using namespace std;
typedef long long int LL;
typedef long long int ll;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

using graph = vector<vector<int>>;


void dfs(int v, const graph& G, vector<int>& res, vector<int>& used) {
	used[v] = 1;
	for (auto to : G[v]) if (used[to] == 0) {
		dfs(to, G, res, used);
	}
	res.push_back(v);
}

vector<int> topo_sort(const graph& G) {
	int V = G.size();
	vector<int> ide(V);
	for (int i = 0; i < V; i++) {
		for (auto to : G[i]) {
			ide[to]++;
		}
	}
	vector<int> res;
	vector<int> used(V);
	for (int i = V - 1; i >= 0; i--) {
		if (ide[i] == 0) {
			dfs(i, G, res, used);
		}
	}
	reverse(res.begin(), res.end());
	return res;
}


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

  LL N, M;
  cin >> N >> M;

  graph g(N);
  graph g2(N);

  REP(i,N-1+M){
    LL a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a].push_back(b);
    g2[b].push_back(a);
  }

  auto a = topo_sort(g);
  vector<int> b(N);
  REP(i,N){
    b[a[i]] = i;
  }

  REP(i,N){
    if(g2[i].size()==0){
      cout << 0 << endl;
    }else{
      LL max = -1;
      LL maxnode = -1;
      REP(j, g2[i].size())
      {
        if(b[g2[i][j]]>max){
          max = b[g2[i][j]];
          maxnode = g2[i][j];
        }
      }
      cout << maxnode + 1 << endl;
    }
  }
}


Measured memory_bytes: 18944
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<iomanip>
using namespace std;
int main()
{
    cout << fixed << setprecision(10);
    // 整数の入力
    int N, K ;
    cin >> N >> K ;
    double N_d, K_d;
    N_d = static_cast<double>(N);
    K_d = static_cast<double>(K);
    double sum_prob = 0.0;
    for(int j=1;j<=N;j++){
        double each_prob = 0.0;
        double need_i = 0.0;
        if(j<K){
            double j_d = static_cast<double>(j);
            for(int i=1;i<100;i++){
                double i_d = static_cast<double>(i);
                if( (j * pow(2.0,i_d))>=K ){
                    sum_prob += (1.0/N_d)*pow(0.5,i_d);
                    break;
                }
            }
        }
        else{
            sum_prob += (1.0/N_d);
        }
    }

    cout << sum_prob << endl;

    return 0;
}


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

int main() {
    string a, b, c;
    cin >> a >> b >> c;
    int x=a.length(), y=b.length(), z=c.length();
    int i=-1, j=-1, k=-1;
    char now=a[++i];
    while(i!=x && j!=y && k!=z) {
        if(now=='a') now=a[++i];
        else if(now=='b') now=b[++j];
        else if(now=='c') now=c[++k];
    }

    if(i==x) cout << "A" << endl;
    else if(j==y) cout << "B" << endl;
    else if(k==z) cout << "C" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
	int n, k;
	long double prob = 0;
	cin >> n >> k;
	for(int i = 1, temp, cnt ; i<= n ; i++){
		cnt = 0;
		temp = i;
		while(temp < k){
			temp <<= 1;
			++cnt;
		}
		temp /= i;
		prob += (1.0 / n) * (1.0 / temp);
	}
	cout.precision(12);
	cout << fixed << prob;
	return 0;
}


Measured memory_bytes: 256
/*Remember: The Struggle Is Important*/

//CF,CC,AtC,SPOJ: hp1999
//HE: hemant269
//HR: hemant2132

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

#define     int          long long int
#define     fast()       ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define     all(x)       x.begin(),x.end()
#define     mem(a,b)     memset(a,b,sizeof(a))
#define     gcd(a,b)     (__gcd((a),(b)))
#define     lcm(a,b)     (((a)*(b))/gcd((a),(b)))
#define     pb           push_back
#define     ins          insert
#define     F            first
#define     S            second

const int inf=1e18,M=1e9+7;
const int N=1;

void solve()
{
    int n;
    cin>>n;

    vector<int> v(n-1),ans(n,inf);
    for(int i=0;i<n-1;++i)
        cin>>v[i];

    for(int i=0;i<n-1;++i)
    {
        ans[i]=min(ans[i],v[i]);
        ans[i+1]=v[i];
    }

    cout<<accumulate(all(ans),0ll);
}

int32_t main()
{
    fast();

    int t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }

    return 0;
}



Measured memory_bytes: 256
N, X = map(int, input().split())
arr = [0] * N
for i in range(N):
    arr[i] = int(input())
arr.sort()
ans = 0
while 0 <= X:
    X -= arr[ans]
    ans += 1
    if ans == N:
        ans += X // arr[0]
        break
print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
#include <queue>
using namespace std;
typedef long long int ll;
typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
typedef pair<ll,ll> pairs;
vector<pairs> p;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
bool pairCompareSecond(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.second < secondElof.second;
}
#define MAX_N 100100
#define MOD 1000000007
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};
// 四方向への移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}
 
ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    return p;
}
 
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}
 
ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

void  base_num(ll data,ll base){
    if(data==0) return;
    ll next=abs(data)%abs(base);
    if(data<0) next=(abs(base)-next)%abs(base);
    base_num((data-next)/base,base);
    cout << next;
}



int main(){
    ll n,ans=0;
    cin >> n;
    ll a[n];
    for (ll i=0;i<n;i++){
        cin >> a[i];
    }
    vector<pair<ll,ll>> p;
    sort(a,a+n);
    ll c=1;
    for (ll i=1;i<n;i++){
        if (a[i-1]==a[i]){
            c++;
        }else{
            p.push_back(make_pair(c,a[i-1]));
            c=1;
        }
    }
    p.push_back(make_pair(c,a[n-1]));
    sort(p.begin(),p.end(),pairCompare);
    for (ll i=0;i<p.size();i++){
        if (p[i].first!=p[i].second){
            if (p[i].first>p[i].second){
                ans+=p[i].first-p[i].second;
            }else{
                ans+=p[i].first;
            }
        }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3188
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
#include<limits.h>
#include<deque>
#include<cstdio>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N = 1000000;
const int mod = 998244353;
const int INF = 1 << 30;
#define rep(i,n) for(ll i=(ll)0;i<(ll)n;++i)
#define ALL(x) x.begin(),x.end()
#define pp pair<ll,ll>
#define fi first
#define se second
#define pb push_back
#define fix(n) fixed<<setprecision(n)
#define itr vector<ll>::iterator
int main() {
	string s;
	cin >> s;
	int a = 0;
	rep(i, s.size())a += s[i] - '0';
	cout << (a == 1 ? 10 : a) << endl;
	return 0;
}

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

using namespace std;

const int N = 100005;

vector<int> g[N];
int in[N], parent[N];

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m + (n - 1); i++) {
    int u, v;
    cin >> u >> v;
    in[v]++;
    g[u].push_back(v);
  }
  queue<int> q;
  for (int i = 1; i <= n; i++) {
    if (in[i] == 0) {
      q.push(i);
      break;
    }
  }
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (auto v : g[u]) {
      in[v]--;
      if (in[v] == 0) {
        q.push(v);
        parent[v] = u;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << parent[i] << '\n';
  }
  return 0;
}


Measured memory_bytes: 7040
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
    	
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
		int ans = 0;

		for (int i = 1; i <= 9;i ++ ){
			for (int j = 1; j <= 9;j ++ ){
	        	if(N == i*j) {
	        		System.out.println("Yes");
	           		sc.close();
	                return ;
	        	}
	        }
		}

		System.out.println("No");

   		sc.close();
        return ;

    }
    
    static long Factorial (int i) {
    	if (i == 0) {return 1;}

    	if (i == 1) {
    		return 1;
    	}else {
    		return (i * Factorial(i-1));
    	}
    }
}



Measured memory_bytes: 21972
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>//sort,reverse
#include<utility>//pair
#include<queue>//queue,priority_queue
#include<deque>//double_ended queue
#include<map>//map
using namespace std;
typedef long long LL; 
typedef pair<LL,LL> P;//Pでpair<-,->を表す。
const LL MAX=2000010;
const LL MOD=1000000007;
typedef map<LL,LL>::iterator Itr;

/*ここから*/
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

/*ここまで*/

int main()
{ 
    // 前処理
    COMinit();
    LL k;
    cin>>k;
    string s;
    cin>>s;
    LL n=s.size();
    LL ans[n+k+1];
    LL b[n+k+1];
    LL pow[n+k+1];
    for(int i=0;i<=n+k;i++){
        if(i==0){pow[i]=1;}
        else{pow[i]=(pow[i-1]*25)%MOD;}
    }
    for(int i=0;i<=n+k;i++){
        ans[i]=0;
        b[i]=0;
    }
    for(int i=0;i<=n+k;i++){
        if(i<n-1){b[i]=0;}
        else{
            b[i]=(pow[i-n+1]*COM(i,n-1))%MOD;
        }
    }
    for(int i=1;i<=n+k;i++){
        ans[i]=(26*ans[i-1]+b[i-1])%MOD;
    }
    cout<<ans[n+k]<<endl;
    return 0;
}

Measured memory_bytes: 98076
//abc108_b.cpp
//Sat Sep  1 21:05:08 2018

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

int main(){
	int x1,y1,x2,y2;
	cin >> x1 >> y1 >> x2 >> y2;
	int delx = x2-x1;
	int dely = y2-y1;

	int x3 = x2 - dely;
	int y3 = y2 + delx;
	int x4 = x3 - delx;
	int y4 = y3 - dely;
	cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;
//	printf("%.4f\n",ans);
}

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

int main() {
    int n,k;
    string s;
    cin >> n;
    cin >> s;
    cin >> k;
    char c = s[k-1];
    for (auto l :s){
        if (l!=c) cout << '*';
        else cout << l;
    }
    cout << endl;
    return 0;
}

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

using namespace std;

int main()
{
	int a, b, c, d, p, x, y;
	cin >> a >> b >> c >> d >> p;
		x = a*p;
		if (p <= c){
			y = b;
		}
		else{
			p - c;
			y = d*(p-c)+b;
		}

		if (y < x){
			cout << y << endl;
		}
		else{
			cout << x << endl;
		}

	return 0;
}

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

#define rep(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define rng(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define rbf(i, v) for (auto& (i) : (v))
#define All(x) (x).begin(),(x).end()
#define cAll(x) (x).cbegin(),(x).cend()
#define COL(x) cout << x << endl
#define CO(x) cout << x
#define upsort(x) sort((x).begin(),(x).end())
#define downsort(x) sort((x).begin(),(x).end(),greater<int>())
//#define int long long

template<typename T> inline constexpr auto sqr(T x) { return (x) * (x); }
void printd(double x) { printf("%.10lf\n", x); }

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

const double PI = 3.141592653589793;
const int MOD = 1000000007;
const int INF = INT_MAX;

signed main()
{
	int H,N;
	cin >> H >> N;

	VI A(N);
	rbf(a, A) cin >> a;

	rbf(a, A) H -= a;

	if (H > 0) COL("No");
	else COL("Yes");

	return 0;
}

Measured memory_bytes: 640
#include <cassert>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <limits.h>
#include <map>
#include <queue>
#include <set>
#include <string.h>
#include <vector>

using namespace std;
typedef long long ll;

const int MAX_N = 1'000'010;
int spf[MAX_N];

void build_spf_table(int N) {
  memset(spf, -1, sizeof(spf));
  spf[0] = 0;
  spf[1] = 1;

  for (int n = 2; n <= N; ++n) {
    if (spf[n] != -1) continue;

    for (int x = n; x <= N; x += n) {
      spf[x] = n;
    }
  }
}

ll divisor_count(int x) {
  map<int, ll> counter;

  while (x > 1) {
    int e = spf[x];

    counter[e]++;
    x /= e;
  }

  ll cnt = 1;

  for (auto it : counter) {
    cnt *= it.second + 1LL;
  }

  return cnt;
}

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

  build_spf_table(N);
  ll ans = 0;

  for (int n = 1; n <= N - 1; ++n) {
    ans += divisor_count(n);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 7536
#include <iostream>
#include <map>
#include <queue>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
using namespace std;
#pragma warning (disable: 4996)

long long N, K, A[1 << 18], cnt0;
vector<long long> V1, V2;

long long ranged_1(vector<long long> A, vector<long long> B, long long cl, long long cr) {
	// [cl, cr] 間の個数
	long long cnt = 0;
	for (int i = 0; i < A.size(); i++) {
		long long el = (cl + A[i] - 1) / A[i];
		long long er = cr / A[i];
		long long pos1 = lower_bound(B.begin(), B.end(), el) - B.begin();
		long long pos2 = lower_bound(B.begin(), B.end(), er + 1) - B.begin();
		cnt += (pos2 - pos1);
	}
	return cnt;
}

long long ranged_2(vector<long long> A, vector<long long> B, long long cl, long long cr) {
	// [cl, cr] 間の個数
	long long cnt = 0;
	for (int i = 0; i < A.size(); i++) {
		long long el = (cl + A[i] - 1) / A[i];
		long long er = cr / A[i];
		long long pos1 = lower_bound(B.begin(), B.end(), el) - B.begin(); pos1 = max(pos1, 1LL * i + 1LL);
		long long pos2 = lower_bound(B.begin(), B.end(), er + 1) - B.begin();
		cnt += max(0LL, pos2 - pos1);
	}
	return cnt;
}

long long solve(long long border) {
	long long ans = 0;

	// 0 であるものの数え上げ
	if (border >= 0) {
		ans += cnt0 * (cnt0 - 1LL) / 2LL;
		ans += cnt0 * (N - cnt0);
	}

	// 負であるものの数え上げ
	ans += ranged_1(V1, V2, -border, 1LL << 60);

	// 正であるものの数え上げ
	ans += ranged_2(V1, V1, 0, border);
	ans += ranged_2(V2, V2, 0, border);

	return ans;
}

int main() {
	cin >> N >> K;
	for (int i = 1; i <= N; i++) {
		cin >> A[i];
		if (A[i] < 0) V1.push_back(-A[i]);
		else if (A[i] > 0) V2.push_back(A[i]);
		else cnt0++;
	}
	sort(V1.begin(), V1.end());
	sort(V2.begin(), V2.end());

	long long L = -(1LL << 60), R = (1LL << 60), M, minx = (1LL << 60);
	for (int i = 0; i < 68; i++) {
		M = (L + R) / 2;
		long long s = solve(M);
		if (s >= K) { R = M; minx = min(minx, M); }
		else { L = M; }
	}
	cout << minx << endl;
	return 0;
}

Measured memory_bytes: 5908
N=int(input())
S=input()
r=[[] for i in range(10)]
for i in range(N):
    r[int(S[i])].append(i)
#print(r)
ans=0
import bisect
for i in range(0,10):
    for j in range(0,10):
        for k in range(0,10):
            #print(r[i],r[j],r[k])
            if (len(r[i])*len(r[j])*len(r[k]))>0:
                le=bisect.bisect_right(r[j],r[i][0])
                ri=bisect.bisect_left(r[j],r[k][-1])
                if le<ri:
                    ans+=1
                    #print(i,j,k)
print(ans)


Measured memory_bytes: 40432
#include <bits/stdc++.h>
#define r1(i, n) for (int i=0;i<n;i++)
#define r2(i, n) for (int i=1;i<n;i++)
#define intc(n) int n; cin >> n;
#define ll long long
#define llc(n) ll n; cin >> n;
using namespace std;
int main() {
  llc(n);
  ll a,b;
  a=n/500;
  n=n%500;
  b=n/5;
  cout << a*1000+5*b << endl;
}

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

int h[100000];
int dp[100000];

int main()
{
	int N;
	cin >> N;
	copy_n(istream_iterator<int>(cin), N, h);
	fill(dp, dp + N, 999999);
	dp[0] = 0;
	dp[1] = abs(h[1]-h[0]);
	for (int i = 2; i < N; ++i)
		dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]));
	cout << dp[N-1];
}


Measured memory_bytes: 1024
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>
using namespace std;
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();}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define EACH(t,i,c) for(t::iterator i=(c).begin(); i!=(c).end(); ++i)
const double EPS = 1e-10;
const double PI  = acos(-1.0);

vi coins;

int memo[310][300]={};
int dfs(int n,int prev){
	if(memo[n][prev]){
		return memo[n][prev];
	}
	if(n==0){
		return 1;
	}
	int ret=0;
	REP(i,coins.size()){
		if(coins[i]<prev){
			continue;
		}
		if(coins[i]>n){
			break;
		}
		ret+=dfs(n-coins[i],coins[i]);
	}
	return memo[n][prev]=ret;
}
int main(){
	int n;
	int value=1;
	while(value*value<=300){
		coins.push_back(value*value);
		value++;
	}
	while(cin>>n,n){
		cout<<dfs(n,0)<<endl;
	}
}

Measured memory_bytes: 1516
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce
import pprint
sys.setrecursionlimit(10 ** 9)


INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007

n, m, k = LI()
for i in range(n + 1):
    for j in range(m + 1):
        if k == i * m + j * n - i * j * 2:
            print('Yes')
            exit()
else:
    print('No')




Measured memory_bytes: 41968
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main(){

    input!{
        n: usize,
        d: [usize;n],
    }

    let mut sum = 0;

    for i in 0..n{
        for j in i+1..n{
            sum += d[i]*d[j];
        }
    }

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

Measured memory_bytes: 4352
#!/usr/bin/ruby
#encoding: utf-8

#input 
N,L = gets.split.map(&:to_i)

alltaste = 0
(1..N).each do |i|
  alltaste += (L+i-1)
end

#puts "alltaste = #{alltaste}"

min = 10000000
diffary = []
tmptaste = 0
diff = 0
(1..N).each do |i|
  tmptaste = alltaste - (L+i-1)
  #puts "tmptaste = #{tmptaste}"
  diff = (alltaste - tmptaste).abs
  
  diffary.push(diff)

end

#puts diffary.min
ans = 0

(1..N).each do |i|
  tmptaste = alltaste - (L+i-1)
  diff = (alltaste - tmptaste).abs

  if diff == diffary.min
    ans = tmptaste
  end
end

puts ans 


Measured memory_bytes: 1788
#include <stdio.h>

int getGCD(int x, int y)
{
	if (y == 0){
		return (x);
	}
	getGCD(y, x % y);
}

int getLCM(int x, int y)
{
	if ((x == 0) || (y == 0)){
		return (0);
	}
	return ((x / getGCD(x, y)) * y);
}

int main(void)
{
	long x, y;
	long gcd,lcm;
	
	while (scanf("%d %d", &x, &y) != EOF){
		gcd = getGCD(x, y);
		lcm = getLCM(x, y);
		printf("%d %d\n", gcd, lcm);
	}
	
	return (0);
}

Measured memory_bytes: 592
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;

/*
<url:https://arc075.contest.atcoder.jp/tasks/arc075_b>
問題文============================================================
 あなたが散歩していると、突然 N 体の魔物が出現しました。
 それぞれの魔物は 体力 という値を持ち、i 体目の魔物の出現時の体力は hi です。
 体力が 0 以下となった魔物は直ちに消滅します。
 
 幸い、あなたは熟練の魔法使いであり、爆発を引き起こして魔物を攻撃できます。
 一回の爆発では、以下のように魔物の体力を減らすことができます。
 
 生存している魔物を一体選び、その魔物を中心に爆発を引き起こす。
 爆発の中心となる魔物の体力は A 減り、その他の魔物の体力はそれぞれ B 減る。
 ここで、A と B はあらかじめ定まった値であり、A>B である。
 すべての魔物を消し去るためには、最小で何回の爆発を引き起こす必要があるでしょうか？
=================================================================

解説=============================================================

================================================================
*/
ll N,A,B;
vector<ll> h;

bool C(ll m){
    ll cnt = 0;
    ll dif = A - B;
    for(int i = 0; i < N;i++){
        ll X = h[i] - m*B;
        if(X <= 0) continue;
        cnt += (X + dif - 1)/dif;
    }
    return cnt <= m;
}
int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
    cin >> N >> A >> B;
    h.resize(N);
    for(auto &in:h) cin >> in;
    ll l = 0, r = INF + 1000;
    while(r - l > 1){
        ll m = (l + r)/2;
        if(C(m)){
            r = m;
        }else{
            l = m;
        }
    }
    cout << r << endl;
	return 0;
}


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

using namespace std;

#define M 1005
#define MOD 1000000007
#define lim 1e18
#define ll long long
#define mp make_pair
#define fi first
#define se second

int k = 1, T, mx;
ll x, y, res, fib[M];

vector< pair<ll, ll> > exellent[M];

inline ll read()
{
	ll x = 0, f = 1; char ch = getchar();
	while (!isdigit(ch)) { if (ch == '-') f = -1; ch = getchar(); }
	while (isdigit(ch)) { (x *= 10) += ch - '0'; ch = getchar(); }
	return x * f;
}

int main()
{
	fib[0] = fib[1] = 1;
	while (fib[k] + fib[k-1] <= lim)
	{	k++; fib[k] = fib[k-1] + fib[k-2]; }

	exellent[1].push_back(mp(1, 2));
	for (int i = 2; i <= k; i++)
	{
		for (pair<ll, ll> p : exellent[i-1])
			exellent[i].push_back(mp(p.se, p.fi + p.se));
		exellent[i].push_back(mp(fib[i+1], fib[i+1] + fib[i-1]));
	}

	T = read();
	while (T--)
	{
		x = read(), y = read(); mx = 1, res = 0;
		if (x > y) swap(x, y);
		while (mx+2 <= k && fib[mx+1] <= x && fib[mx+2] <= y) mx++;
		for (pair<ll, ll> p : exellent[mx])
		{
			if (p.fi <= x && p.se <= y)
				(res += (y - p.se) / p.fi + 1) %= MOD;
			if (p.se <= x)
				(res += (x - p.se) / p.fi + 1) %= MOD;
		}
		if (mx == 1) res += x;
		printf("%d %lld\n", mx, res);
	}

	return 0;
}

Measured memory_bytes: 4380
#include<cstdio>
#include<iostream>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<deque>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<limits>
#include<boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
using namespace std;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I,N) for(auto I=0;I<(N);++I)
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                                      ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}
inline                                              void out(double p){printf("%.10f\n",p);}
template<class T>inline                             void outs(T p){for_each(all(p),out<decltype(p[0])>);}
template<class T>inline void outs(vector<T> V){int n=V.size();rep(i,n)cout<<V[i]<<" \n"[i==n-1];}
inline void solve(void){
  ld N,M;in(N,M);
  vector<ll>A(N);ins(A);
  ll sum=accumulate(all(A),0);
  sort(rall(A));
  out(A[M-1]>=sum/(4*M)?"Yes":"No");
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
    int X;
    cin>>X;
    if(X>=400&&X<=599){
        cout<<"8";
    }else if(X>=600&&X<=799){
        cout<<"7";
    }else if(X>=800&&X<=999){
        cout<<"6";
    }else if(X>=1000&&X<=1199){
        cout<<"5";
    }else if(X>=1200&&X<=1399){
        cout<<"4";
    }else if(X>=1400&&X<=1599){
        cout<<"3";
    }else if(X>=1600&&X<=1799){
        cout<<"2";
    }else if(X>=1800&&X<=1999){
        cout<<"1";
    }

}

Measured memory_bytes: 3128
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
typedef long long ll;
typedef long double ld;
int main(){
    ll n,a;cin>>n>>a;
    string ans;
    if((n%500)<=a){
        ans="Yes";
    }else{
        ans="No";
    }
    cout<<ans<<endl;
    return 0;
}


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

int parent(int i){ return i/2; }
int left(int i){ return i*2; }
int right(int i){ return i*2 + 1;}


void maxHeapify(int A[], int H, int i){
    int l = left(i);
    int r = right(i);

    int largest;
    if(l <= H && A[l] > A[i]){
        largest = l;
    } else {
        largest = i;
    }
    if(r <= H && A[r] > A[largest]){
        largest = r;
    }

    if(largest != i){
        swap(A[largest], A[i]);
        maxHeapify(A, H, largest);
    }
}
void buildMaxHeap(int A[], int n){
    for(int i=n/2; i>=1; i--){
        maxHeapify(A, n, i);
    }
}

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

    buildMaxHeap(A, n);

    for(int i=1; i<=n; i++){ cout << " " << A[i]; }
    cout << endl;

    return 0;
}


Measured memory_bytes: 4968
#include<bits/stdc++.h>
using namespace std;
namespace FAST_IO
{
	template<typename T> void read(T &a)
	{
		a=0;
		int f=1;
		char c=getchar();
		while(!isdigit(c))
		{
			if(c=='-')
			{
				f=-1;
			}
			c=getchar();
		}
		while(isdigit(c))
		{
			a=a*10+c-'0';
			c=getchar();
		}
		a=a*f;
	}
	template <typename T> void write(T a)
	{
		if(a<0)
		{
			a=-a;
			putchar('-');
		}
		if(a>9)
		{
			write(a/10);
		}
		putchar(a%10+'0');
	}
	template <typename T> void writeln(T a)
	{
		write(a);
		puts("");
	}
}
int n,m;
struct city
{
	int z,t,id;
	string op;
};
city cities[100001];
bool cmp(city a,city b)
{
	if(a.z==b.z)
	{
		return a.t<b.t; 
	}
	return a.z<=b.z;
}
bool cmp2(city a,city b)
{
	return a.id<b.id;
}
int main()
{
	FAST_IO::read(n);
	FAST_IO::read(m);
	for(int i=1;i<=m;i++)
	{
		FAST_IO::read(cities[i].z);
		FAST_IO::read(cities[i].t);
		cities[i].id=i;
	}
	sort(cities+1,cities+m+1,cmp);
	int g=1;
	for(int i=1;i<=m;i++)
	{
		if(cities[i].z==cities[i-1].z)
		{
			g++;
		}
		else
		{
			g=1;
		}
		stringstream tmp,tmp2;
		tmp<<cities[i].z;
		string tt;
		tmp>>tt;
		for(int j=1;j<=6-tt.size();j++)
		{
			cities[i].op+='0';
		}
		cities[i].op+=tt;
		tmp2<<g;
	//	cout<<g<<endl;
		tmp2>>tt;
		for(int j=1;j<=6-tt.size();j++)
		{
			cities[i].op+='0';
		}		
		cities[i].op+=tt;
	}
	sort(cities+1,cities+m+1,cmp2);
	for(int i=1;i<=m;i++)
	{
		cout<<cities[i].op<<endl;
	}
}

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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using Pi = pair<int, int>;
using Ti = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

struct Dinic {
  struct edge {
    int to, capacity, rev, id, isrev;
    edge(){}
    edge(int to, int capacity, int rev):to(to), capacity(capacity), rev(rev){}
  };

  vector< vector<edge> > graph;
  vector<int> level, iter;
  Dinic(int sz):graph(sz), level(sz), iter(sz){};
  void add_edge(int from, int to, int capacity) {
    graph[from].push_back(edge(to, capacity, (int)graph[to].size()));
    graph[to].push_back(edge(from, 0, (int)graph[from].size()-1));
  }
  void bfs(int source) {
    fill(level.begin(), level.end(), -1);
    queue<int> que;
    level[source] = 0;
    que.push(source);
    while(!que.empty()) {
      int v = que.front(); que.pop();
      for(int i = 0; i < (int)graph[v].size(); i++) {
	edge& e = graph[v][i];
	if(e.capacity > 0 && level[e.to] < 0) {
	  level[e.to] = level[v] + 1;
	  que.push(e.to);
	}
      }
    }
  }
  int dfs(int v, int sink, int f) {
    if(v == sink) return f;
    for(int &i = iter[v]; i < (int)graph[v].size(); i++) {
      edge& e = graph[v][i];
      if(e.capacity > 0 && level[v] < level[e.to]) {
	int d = dfs(e.to, sink, min(f, e.capacity));
	if(d > 0) {
	  e.capacity -= d;
	  graph[e.to][e.rev].capacity += d;
	  return d;
	}
      }
    }
    return 0;
  }
  int max_flow(int source, int sink) {
    int flow = 0;
    while(1) {
      bfs(source);
      if(level[sink] < 0) return flow;
      fill(iter.begin(), iter.end(), 0);
      int f; while((f = dfs(source, sink, inf)) > 0) flow += f;
    }
  }
};


signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int n;
  cin >> n;
  vint a(n);
  int sum = 0;
  rep(i, n) {
    cin >> a[i];
    if(a[i] > 0) sum += a[i];
  }

  int s = n, t = s+1, V = t+1;
  Dinic graph(V);
  rep(i, n) {
    if(a[i] < 0) graph.add_edge(s, i, -a[i]);
    else graph.add_edge(i, t, a[i]);
  }
  reps(i, 1, n+1) {
    for(int j = i*2; j <= n; j += i) {
      graph.add_edge(i-1, j-1, inf);
    }
  }
  cout << sum - graph.max_flow(s, t) << endl;

  return 0;
}


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

typedef pair<int,int> P;
#define ll long long
#define ld long double
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define sz(x) ((int)(x).size())
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
int main()
{
    double r;
    cin >> r;
    cout << setprecision(11) << (double)2*r*PI << endl;
}

Measured memory_bytes: 3776
N=int(input())
his=list(map(int,input().split()))
DP=[]
DP.append(0)
DP.append(abs(his[0]-his[1]))
for i in range(2,N):
  DP.append(min(DP[i-1]+abs(his[i-1]-his[i]),DP[i-2]+abs(his[i-2]-his[i])))
print(DP[-1])

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

int main(){
  int i,j,n;
  cin>>n;
  vector<vector<int>> arr(n, vector<int> (3, 0));
  vector<vector<int>> dp(n, vector<int> (3, 0));

  int ans=0;
  for(i=0; i<n; i++)
  for(j=0; j<3; j++)
  cin>>arr[i][j];

  dp[0][0]=arr[0][0];
  dp[0][1]=arr[0][1];
  dp[0][2]=arr[0][2];

  for(i=1; i<n; i++)
  {
    dp[i][0]=arr[i][0]+max(dp[i-1][1], dp[i-1][2]);
    dp[i][1]=arr[i][1]+max(dp[i-1][0], dp[i-1][2]);
    dp[i][2]=arr[i][2]+max(dp[i-1][1], dp[i-1][0]);
  }
  cout<<max(dp[n-1][0], max(dp[n-1][1],dp[n-1][2]))<<endl;
  return 0;
}


Measured memory_bytes: 11136
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(x) (x).begin(), (x).end()
#define in(x, l, r) (ll)(l) <= (x) && (x) < (ll)(r)

int main() {
    int L, R, d;
    cin >> L >> R >> d;
    int ans = 0;
    rep(i,L,R+1) {
        if (i % d == 0) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3592
from itertools import accumulate,combinations
n,k = map(int,input().split())
a = list(map(int,input().split()))
acc = [0]+list(accumulate(a))
ls = []
for i,j in combinations(acc,2):
  ls.append(j-i)
x = max(ls).bit_length()
ans = 0
for i in range(x-1,-1,-1):
  cnt = 0
  for j in ls:
    if ans+2**i & j == ans+2**i:
      cnt += 1
  if cnt >= k:
    ans += 2**i
print(ans)

Measured memory_bytes: 56076
#include <iostream>

typedef long long ll;

int main() {
  ll N, M;  std::cin >> N >> M;
  if (N > M)  std::swap(N, M);
  if (N == 1 and M == 1)
    std::cout << 1 << "\n";
  else if (N == 1)
    std::cout << std::max(0LL, M-2) << "\n";
  else
    std::cout << (N-2) * (M-2) << "\n";


  return 0;
}


Measured memory_bytes: 3616
fun main (args:Array<String>){
    val testCase = readLine()!!.toInt()
    var judgeCountMap = mutableMapOf<String, Int>()
    judgeCountMap["AC"] = 0
    judgeCountMap["WA"] = 0
    judgeCountMap["TLE"] = 0
    judgeCountMap["RE"] = 0

    for (i in 1..testCase){
        val judge = readLine()!!
        judgeCountMap[judge] = judgeCountMap[judge]!!.inc()
    }

    println("AC x ${judgeCountMap["AC"]}")
    println("WA x ${judgeCountMap["WA"]}")
    println("TLE x ${judgeCountMap["TLE"]}")
    println("RE x ${judgeCountMap["RE"]}")
}


Measured memory_bytes: 59156
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#define LL long long
#define PP std::pair<LL,int>
LL W, H;
LL SW[100010], SH[100010];
std::vector<PP> P;
LL ans;
LL a[2];
int main() {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cin >> W >> H;
	a[0] = W + 1, a[1] = H + 1;
	for (int i = 0; i < W; i++) {
		LL tmp;
		std::cin >> tmp;
		P.emplace_back(PP{ tmp,0 });
	}
	for (int i = 0; i < H; i++) {
		LL tmp;
		std::cin >> tmp;
		P.emplace_back(PP{ tmp,1 });
	}
	std::sort(P.begin(), P.end());
	for (auto u : P) {
		a[u.second]--;
		ans += u.first*a[(u.second + 1) & 1];
	}
	std::cout << ans << std::endl;
	return 0;
}

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

int main() {
  vector<int> x(4), y(4);
  cin >> x[0] >> y[0] >> x[1] >> y[1];
  x[2] = x[1] - (y[1] - y[0]);
  y[2] = y[1] - (x[0] - x[1]);
  x[3] = x[0] - (y[1] - y[0]);
  y[3] = y[0] + (x[1] - x[0]);
  cout << x[2] << " " << y[2] << " " << x[3] << " " << y[3] << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
map<pair<ll,char>,ll> mp;
ll go(ll n,vector<ll> &a,vector<ll> &b,vector<ll> &c,ll pos=0,char pre='#')
{
	if(pos==n)
	return 0;
	if(pos>n)
	return INT_MIN;
	if(mp.count({pos,pre}))
	return mp[{pos,pre}];
	
	ll res=INT_MIN;
	if(pre=='a')
	{
		ll ans1=b[pos]+go(n,a,b,c,pos+1,'b');
		ll ans2=c[pos]+go(n,a,b,c,pos+1,'c');
		res=max(res,max(ans1,ans2));
	}
	else if(pre=='b')
	{
		ll ans1=a[pos]+go(n,a,b,c,pos+1,'a');
		ll ans2=c[pos]+go(n,a,b,c,pos+1,'c');
		res=max(res,max(ans1,ans2));
	}
	else if(pre=='c')
	{
		ll ans1=a[pos]+go(n,a,b,c,pos+1,'a');
		ll ans2=b[pos]+go(n,a,b,c,pos+1,'b');
		res=max(res,max(ans1,ans2));
	}
	else {
		ll ans1=a[pos]+go(n,a,b,c,pos+1,'a');
		ll ans2=b[pos]+go(n,a,b,c,pos+1,'b');
		ll ans3=c[pos]+go(n,a,b,c,pos+1,'c');
		res=max(res,max(ans1,max(ans2,ans3)));
	}
	return mp[{pos,pre}]=res;
}
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  ll n;
  cin>>n;
  vector<ll> a(n),b(n),c(n);
  for(int i=0;i<n;i++)
  {
  	cin>>a[i]>>b[i]>>c[i];
  }
  cout<<go(n,a,b,c)<<endl;
 
  
}

Measured memory_bytes: 36992
#include <bits/stdc++.h>
using namespace std;
int main() {
	string s;
  	cin >> s;
  	if(s == "Rainy") cout << "Sunny";	
  	else if(s == "Sunny") cout << "Cloudy";
  	else cout << "Rainy";
  	cout << '\n';
  	return 0;
}


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

using namespace std;

int main() {
    int n;
    cin >> n;
    int arr[n];
    int sorted[n];
    for (int i = 0; i < n; i++) {
        cin >> arr[i];
        sorted[i] = arr[i];
    }
    sort(sorted, sorted + n);
    for (int i = 0; i < n; i++) {
        if (arr[i] < sorted[n - 1]) {
            cout << sorted[n - 1] << endl;
        } else {
            cout << sorted[n - 2] << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3200
#include <stdio.h>
#include <stdbool.h>

int parent[100005];
int diff_weight[100005];

void init(int nmemb) {

    for (int i = 0; i < nmemb; i++) {
        parent[i] = -1;
        diff_weight[i] = 0;
    }
}

int root(int x) {
    if (parent[x] < 0) {
        return x;
    }

    // 累積和的に重みを再計算
    int r = root(parent[x]);
    diff_weight[x] += diff_weight[parent[x]];
    parent[x] = r;

    return parent[x];
}

int weight(int x) {
    root(x);
    return diff_weight[x];
}

int diff(int x, int y) {
    return weight(y) - weight(x);
}
    
bool isSameGroup(int x, int y) {
    return root(x) == root(y);
}

void unite(int x, int y, int w) {
    if (isSameGroup(x, y)) {
        return;
    }

    w += weight(x);
    w -= weight(y);
    x = root(x);
    y = root(y);
    
    parent[y] = x;
    diff_weight[y] = w;
}

int groubSize(int x) {
    return -parent[root(x)];
}

int main()
{
    init(100005);
    
    int n;
    int u, v, w;

    scanf("%d", &n);
    for (int i = 0; i < n - 1; i++) {
        scanf("%d %d %d", &u, &v, &w);

        unite(u, v, w);
    }

    printf("1\n");
    for (int i = 2; i <= n; i++) {
        if (diff(1, i) % 2 == 0) {
            printf("1\n");
        }
        else {
            printf("0\n");
        }
    }

    return 0;
}


Measured memory_bytes: 1536
#include <iostream>
#include <algorithm>
#include <cmath>

int main()
{
    int ans, a, b, c, k, max;
    std::cin >> a >> b >> c >> k;
    max = std::max(a, std::max(b, c));
    for(int i = 0;i < k;i++){
        max *= 2;
    }
    if(std::max(a, std::max(b, c)) == a){
        std::cout << max + b + c;
        return 0;
    }
    else if(std::max(a, std::max(b, c)) == b){
        std::cout <<max + a + c;
        return 0;
    }
    else{
        std::cout << max + a + b;
        return 0;
    }

}

Measured memory_bytes: 256
#include <cstdio>
using namespace std;
int main() {
    char c;
    const char a = 'a';
    int cnt[26];
    for (int i = 0; i < 26; i++)
        cnt[i] = 0;
    while ((c = getchar()) != EOF) {
        if (65 <= c && c <= 90) {
            c += 32;
            cnt[c-a]++;
        }
        else if (97 <= c && c <= 122) {
            cnt[c-a]++;
        }
    }
    for (int i = 0; i < 26; i++)
        printf("%c : %d\n", a+i, cnt[i]);
}

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

#define INF 2000000001

using namespace std;
vector<vector<int>> warshallFloyd(int v, vector<vector<int>> g){
    auto ds = vector<vector<int>>(g);
    for(int i = 0; i < v; ++i){
        for(int j = 0; j < v; ++j){
            if(ds[i][j] == INF){
                continue;
            }
            for(int k = 0; k < v; ++k){
                if(ds[k][i] != INF){
                    ds[k][j] = min(ds[k][i] + ds[i][j], ds[k][j]);
                }
            }
        }
    }
    return ds;
}

bool hasNegativeCycle(vector<vector<int>> ds){
    for(int i = 0; i < ds.size(); ++i){
        if(ds[i][i] < 0){
            return true;
        }
    }
    return false;
}
int main(){
    int v, e;
    cin >> v >> e;
    auto g = vector<vector<int>>();
    for(int i = 0; i < v; ++i){
        g.push_back(vector<int>(v, INF));
        g[i][i] = 0;
    }
    int s, t, w;
    for(int i = 0; i < e; ++i){
        cin >> s >> t >> w;
        g[s][t] = w;
    }
    auto ds = warshallFloyd(v, g);
    if(hasNegativeCycle(ds)){
        cout << "NEGATIVE CYCLE" << endl;
    } else {
        for(auto xs : ds){
            for(auto it = xs.begin(); it != xs.end(); ++it){
                if(it != xs.begin()){
                    cout << " ";
                }
                if(*it != INF){
                    cout << *it;
                } else {
                    cout << "INF";
                }
            }
            cout << endl;
        }
    }

}

Measured memory_bytes: 1352
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <algorithm>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

// to container
template <class C>
void input(C &c)
{
    for_each(c.begin(), c.end(), [](auto &i) { cin >> i; });
}

// to number, string
template <class T>
T input()
{
    T data;
    cin >> data;
    return data;
}

int main()
{
    ll N = input<ll>(), M = input<ll>();

    ll ml = -1, mr = 1000000;
    for (ll i = 0; i < M; i++)
    {
        ll l = input<ll>(), r = input<ll>();
        if (l > mr || r < ml)
        {
            cout << 0 << endl;
            return 0;
        }
        ml = max(ml, l), mr = min(mr, r);
    }

    cout << mr - ml + 1 << endl;

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
using namespace std;
#define maxn 100005
#define sentinel 2000000000
struct card
{
    char suit;
    int value;
};
typedef struct card card;
 
card L[maxn/2],R[maxn/2];
card a[maxn],b[maxn];
int n;
 
void _merge(int left,int mid,int right)
{
    int n1=mid-left;
    int n2=right-mid;
    for(int i=0;i<n1;++i)
        L[i]=a[left+i];
    for(int i=0;i<n2;++i)
        R[i]=a[mid+i];
    L[n1].value=R[n2].value=sentinel;
    int i=0,j=0;
    for(int k=left;k<right;k++)
    {
        if(L[i].value<=R[j].value)
            a[k]=L[i++];
        else
            a[k]=R[j++];
    }
}
void mergesort(int n,int left,int right)
{
    int mid;
    if(left+1<right)
    {
        mid=(left+right)>>1;
        mergesort(n,left,mid);
        mergesort(n,mid,right);
        _merge(left,mid,right);
    }
}
int _partition(int n,int p,int r)
{
    card x=b[r];
    int i=p-1;
    for(int j=p;j<r;j++)
    {
        if(b[j].value<=x.value)
        {
            i++;
            card t=b[i];
            b[i]=b[j];
            b[j]=t;
        }
    }
    card t=b[i+1]; b[i+1]=b[r];b[r]=t;
    return i+1;
}
void quicksort(int n,int p,int r)
{
    int q;
    if(p<r)
    {
        q=_partition(n,p,r);
        quicksort(n,p,q-1);
        quicksort(n,q+1,r);
    }
}
int main()
{
    int stable=1;
    scanf("%d",&n);
    for(int i=0;i<n;++i)
    {
        char str[3];
        int x;
        scanf("%s %d",str,&x);
        a[i].suit=b[i].suit=str[0];
        a[i].value=b[i].value=x;
    }
    mergesort(n,0,n);
    quicksort(n,0,n-1);
    for(int i=0;i<n;++i)
    {
        if(a[i].suit!=b[i].suit) stable=0;
    }
    if(stable) printf("Stable\n");
    else printf("Not stable\n");
    for(int i=0;i<n;++i)
    {
        printf("%c %d\n",b[i].suit,b[i].value);
    }
    return 0;
}

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

#ifdef LOCAL
#include "../../dump.hpp"
#else
#define dump(...)
#endif

#define rep(i,n) for(int i=0,i##_cond=(n);i<i##_cond;i++)
#define FOR(i,a,b) for(int i=(a),i##_cond=(b);i<i##_cond;i++)
#define ROF(i,a,b) for(int i=(a)-1,i##_cond=(b);i>=i##_cond;i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで大きい順
#define UNIQUE(v) v.erase(unique(all(v)),v.end())
#define SUM(a) accumulate(all(a),0)
#define sz(x) ((int)(x).size())
#define pb push_back
#define fst first
#define snd second
#define mp make_pair

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<ll,ll> pii;


#define int ll

const int inf = 1ll<<62;
const int mod = 1e9+7;

main(){
  int n; cin >> n;
  vvi a(n, vi(n)); rep(i, n) rep(j, n) cin >> a[i][j];

  // 最短距離かチェック
  rep(k, n) rep(i, n) rep(j, n)
    if(a[i][j] > a[i][k] + a[k][j]){
      cout << -1 << endl;
      return 0;
    }
  
  // importantな辺を数える
  int ans = 0;
  rep(i, n) rep(j, n){
    bool f = true;
    rep(k, n)
      if(k != i and k != j and a[i][j] == a[i][k] + a[k][j])
	f = false;
    if(f) ans += a[i][j];
    //cout << ans << endl;
  }

  cout << ans / 2 << endl;
}

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

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

  int ans = n;
  char c = 'a';

  while(1){
    cin >> c;
    if(c == '=') break;
    cin >> n;

    if(c == '+') ans += n;
    else if(c == '-') ans -= n;
    else if(c == '*') ans *= n;
    else if(c == '/') ans /= n;

  }

  cout << ans << endl;

  return 0;

}




Measured memory_bytes: 3096