akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define repeat(i, n) for(int (i) = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const double EPS = numeric_limits<double>::epsilon();
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

int main() {
	map<int, int> A1;
	int n1, m1, l1, n2, m2, l2, n3, m3, l3;
	cin >> n1 >> m1 >> l1;
	A1[n1] = 0;
	A1[m1] = 0;
	A1[l1] = 0;

	cin >> n2 >> m2 >> l2;
	A1[n2] = 0;
	A1[m2] = 0;
	A1[l2] = 0;

	cin >> n3 >> m3 >> l3;
	A1[n3] = 0;
	A1[m3] = 0;
	A1[l3] = 0;
	int N;
	cin >> N;

	string result = "No";

	repeat(i, N) {
		int d = 0;
		cin >> d;
		A1[d]++;
	}

	auto x1 = A1.at(n1);
	auto y1 = A1.at(m1);
	auto z1 = A1.at(l1);

	auto x2 = A1.at(n2);
	auto y2 = A1.at(m2);
	auto z2 = A1.at(l2);

	auto x3 = A1.at(n3);
	auto y3 = A1.at(m3);
	auto z3 = A1.at(l3);
	if (x1 >= 1 && y1 >= 1 && z1 >= 1) {
		result = "Yes";
	}
	if (x2 >= 1 && y2 >= 1 && z2 >= 1) {
		result = "Yes";
	}
	if (x3 >= 1 && y3 >= 1 && z3 >= 1) {
		result = "Yes";
	}

	if (x1 >= 1 && y2 >= 1 && z3 >= 1) {
		result = "Yes";
	}
	if (x3 >= 1 && y2 >= 1 && z1 >= 1) {
		result = "Yes";
	}

	if (x1 >= 1 && x2 >= 1 && x3 >= 1) {
		result = "Yes";
	}
	if (y1 >= 1 && y2 >= 1 && y3 >= 1) {
		result = "Yes";
	}
	if (z1 >= 1 && z2 >= 1 && z3 >= 1) {
		result = "Yes";
	}

	cout << result << endl;
	return 0;
}


Measured memory_bytes: 256
// At Coder :: Beginner Contest 178 :: B - Product Max 
// https://atcoder.jp/contests/abc178/tasks/abc178_b

#include <bits/stdc++.h>

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    long long soln{numeric_limits<long long>::min()};
    soln = max(soln, a * c);
    soln = max(soln, b * c);
    soln = max(soln, a * d);
    soln = max(soln, b * d);
    cout << soln << "\n";
    return EXIT_SUCCESS;
}


Measured memory_bytes: 3648
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"sort"
	"strconv"
)

func sumR(a []int, n int, mod int) (ret int) {
	for i := n; i < len(a); i++ {
		ret += mod - a[i]
	}
	return
}

func sumL(a []int, n int) (ret int) {
	for i := 0; i <= n; i++ {
		ret += a[i]
	}
	return
}

func Solve(stdin io.Reader, stdout io.Writer) {
	sc := bufio.NewScanner(stdin)

	/* 単語ごとに入力するならこれ */
	sc.Split(bufio.ScanWords)

	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())

	sc.Scan()
	k, _ := strconv.Atoi(sc.Text())

	a := make([]int, n)
	b := make([]int, n)

	sum := 0

	for i := 0; i < n; i++ {
		sc.Scan()
		a[i], _ = strconv.Atoi(sc.Text())
		sum += a[i]
	}
	var divs []int

	sqrt := int(math.Sqrt(float64(sum)))
	for i := 1; i <= sqrt; i++ {
		if sum%i == 0 {
			divs = append(divs, i)
			if i != sum/i {
				divs = append(divs, sum/i)
			}
		}
	}
	sort.Sort(sort.Reverse(sort.IntSlice(divs)))

	ret := 1
	sort.Ints(a)
	for _, i := range divs {
		if sum % i != 0 {
			continue
		}
		for j := 0; j < len(a); j++ {
			b[j] = a[j] % i
		}
		sort.Ints(b)
		for j := 1; j < len(b); j++ {
			b[j] += b[j - 1]
		}
		for j := 0; j < len(b) - 1; j++ {
			if b[j] == i * (len(b) - 1 - j) - b[len(b) - 1] + b[j] && b[j] <= k {
				_, _ = fmt.Fprintf(stdout, "%d\n", i)
				os.Exit(0)
			}
		}
	}
	_, _ = fmt.Fprintf(stdout, "%d\n", ret)
}

func main() {
	Solve(os.Stdin, os.Stdout)
	return
}

Measured memory_bytes: 768
package main

import (
    "bufio"
    "fmt"
    "os"
    "strings"
    "strconv"
    "regexp"
)

func main() {
    scanner := bufio.NewScanner(os.Stdin)
    var r string
    r, _ = readOneLine(scanner)
    var so = s2i(r)
    i := so
    for {
        if isPrime(i) {
            break
        }
        i++
    }
    fmt.Println(i)
}

func isPrime(num int) bool {
    if num == 2 {
        return true
    }
    if num % 2 == 0 {
        return false
    }
    for i:=num; i>2;i-=2 {
        if num != i && num % i == 0 {
            return false
        }
    }
    return true
}

func readOneLine(scanner *bufio.Scanner) (string, bool) {
    var s string
    var eof = false
    if scanner.Scan() {
        s = scanner.Text()
    } else {
        eof = true
    }
    return s, eof
}

func s2i(s string) int {
    var intVal,_ = strconv.Atoi(s)
    return intVal
}

func i2s(i int) string {
    return string(i)
}

func s2f(s string) float64 {
    var floatVal,_ = strconv.ParseFloat(s, 64)
    return floatVal
}

func sum(i []int) int {
    sum := 0
    for _,val := range i {
        sum += val
    }
    return sum
}

func split(s string) []string {
    return strings.Fields(s)
}

func strAry2intAry(strs []string) []int {
    var ret = make([]int, 0, len(strs))
    for _ , str := range strs {
        var intVal, _ = strconv.Atoi(string(str));
        ret = append(ret, intVal)
    }
    return ret
}

func intAry2strAry(nums []int) []string {
    var ret = make([]string, 0, len(nums))
    for _ , num := range nums {
        var strVal = strconv.Itoa(num);
        ret = append(ret, strVal)
    }
    return ret
}

func ary2str(strs []string) string {
    return strings.Join(strs, " ")
}

func regexpExample() {
    // Your code here!
    var str = "13:20"
    r := regexp.MustCompile(`(\d+):(\d+)`)
    fmt.Println(r.FindStringSubmatch(str))
}

func reverse(res []int) []int {
    for i, j := 0, len(res)-1; i < j; i, j = i+1, j-1 {
        res[i], res[j] = res[j], res[i]
    }
    return res
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
 
const ll INF = 1LL<<62;
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; }
using Graph = vector<vector<int>>;

typedef pair<int, int> P;
typedef priority_queue<int, vector<int>, greater<int>> PQ;
const int MOD = 1000000007;

template<class Abel> struct WeightedUnionFind {
    vector<int> par;
    vector<int> rank;
    vector<Abel> diff_weight;

    WeightedUnionFind(int n = 1, Abel SUM_UNITY = 0) {
        init(n, SUM_UNITY);
    }

    void init(int n = 1, Abel SUM_UNITY = 0) {
        par.resize(n); rank.resize(n); diff_weight.resize(n);
        for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0, diff_weight[i] = SUM_UNITY;
    }

    int root(int x) {
        if (par[x] == x) {
            return x;
        }
        else {
            int r = root(par[x]);
            diff_weight[x] += diff_weight[par[x]];
            return par[x] = r;
        }
    }

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

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y, Abel w) {
        w += weight(x); w -= weight(y);
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y), w = -w;
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        diff_weight[y] = w;
        return true;
    }

    Abel diff(int x, int y) {
        return weight(y) - weight(x);
    }
};

int main(){
    int N,M; cin >> N >> M;
    
    WeightedUnionFind<int> wuf(N);
    rep(i,M){
        int l, r, d;
        cin >> l >> r >> d;
        --l, --r;
        if (wuf.issame(l, r)){
            int diff = wuf.diff(l, r);
            if (diff != d){
                cout << "No" << endl;
                return 0;
            }
        }
        else{
            wuf.merge(l, r, d);
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 4540
#include <stdio.h>
#define N 100

void trace(int A[], int n){
    for(int i = 0; i < n; i++){
            printf("%d", A[i]);
            if(i != n - 1){
                printf(" ");
            }

    }
    printf("\n");
}

int selectsort(int a[], int n){
    int tmp, minj, cnt, flag;
    cnt = 0;
    for(int i = 0; i < n; i++){
        minj = i;
        for(int j = i + 1; j < n; j++){
            if(a[j] < a[minj]){
                minj = j;
            }

        }
        tmp = a[i];
        a[i] = a[minj];
        a[minj] =tmp;
        if(minj !=i)cnt++;
    }

    trace(a, n);
    return cnt;

}


int main(){
    int n, i;
    int A[N + 1];

    scanf("%d", &n);
    for (i = 0; i < n; i++ ) scanf("%d", &A[i]);


    printf("%d\n", selectsort(A, n));

    return 0;
}


Measured memory_bytes: 1940
#include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<cstdlib>
#include<bitset>
#include<utility>
using namespace std;

#define ll long long
#define MP make_pair

int main(void) {
	int n,t,a,i,ansnum;
	double h[1000]={},tmp,sa=1000000;
	cin>>n>>t>>a;
	for (i = 0; i < n; i++) {
		cin>>h[i];
		tmp=abs(t-h[i]*0.006-a);
		//cout<<tmp<<"\n";
		if(sa>tmp){

			ansnum=i;
			sa=tmp;
			//cout<<ansnum<<"aa\n";
		}
	}

	cout<<ansnum+1<<"\n";


	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
  string T, buf;
  cin >> T;
  transform(T.begin(), T.end(),T.begin(), ::toupper);
  int times = 0;
  while (cin >> buf) {
    if(buf == "END_OF_TEXT") break;
    else{
      transform(buf.begin(), buf.end(), buf.begin(), ::toupper);
      if(buf == T) times++;
    }
  }
  cout << times << endl;
}

Measured memory_bytes: 1192
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define fi first
#define se second
using namespace std;
int main(){
	ll ans;
	ll x;
	cin>>x;
	if(x>=1800)ans=1;
	else if(x>=1600)ans=2;
		else if(x>=1400)ans=3;
			else if(x>=1200)ans=4;
				else if(x>=1000)ans=5;
					else if(x>=800)ans=6;
						else if(x>=600)ans=7;
							else ans=8;
	cout<<ans;
}


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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<bool> vb;

const int MAXN = 1e5+1;

vi graph[MAXN];
int v[MAXN], matrix[MAXN];

int findMax(int x){
    if(v[x]) return matrix[x];
    v[x] = 1;
    int len=0;
    for(int i:graph[x]){
        len = max(len,findMax(i)+1);
    }
    return matrix[x] = len;
}

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

    int n, m; cin >> n >> m;

    for(int i=0; i<m; i++){
        int f, t; cin >> f >> t;
        graph[f].push_back(t);
    }

    int len = 0;
    for(int i=1; i<=n; i++){
        len = max(len, findMax(i));
    }

    cout << len << '\n';

    return 0;
}



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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	string s; cin>>s;
	int n=s.size(), ret=INT_MAX;
	for (int i=0; i<2; i++) {
		int cur=0;
		for (int j=0; j<n; j++)
			if(s[j]-'0'!=(i+j)%2)
				cur++;
		ret=min(ret,cur);
	}
	cout<<ret<<"\n";
	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define inf 0x3f3f3f3f
#include<string.h>
#define pi acos(-1.0)
using namespace std;
int n,m;
const int maxn=2e5+10;
vector<int>vec[maxn];
int sum[maxn];int pre[maxn];
void bfs()
{
	queue<int>q;q.push(1);
	sum[1]=0;
	while(!q.empty())
	{
		int u=q.front();q.pop();
		for(int i=0;i<vec[u].size();i++)
		{
			int v=vec[u][i];
			//cout<<v<<endl;
			if(sum[v]>sum[u]+1)
			{
				pre[v]=u;
				sum[v]=sum[u]+1;
			//	cout<<sum[v]<<endl;
				q.push(v);
			}
		}
	}
	
}
int main()
{
  int n,m;cin>>n>>m;
  memset(sum,inf,sizeof(sum));
  for(int i=1;i<=m;i++)
  {
  	int x,y;cin>>x>>y;
  	vec[x].push_back(y);
	vec[y].push_back(x); 
  }
  bfs();bool f=true;
   for(int i=1;i<=n;i++)
   {
   //	cout<<sum[i]<<endl;
   	if(sum[i]==inf)f=false;
   }
  if(!f)cout<<"No"<<endl;
  else
  {
  	   cout<<"Yes"<<endl;
  	    for(int i=2;i<=n;i++)
  	    cout<<pre[i]<<endl;
  }
	return 0;
 } 

Measured memory_bytes: 13540
dice_num, use_num = [int(n) for n in input().rstrip().split()]

points = [int(n) for n in input().rstrip().split()]

sum = sum(points[:use_num])
max_sum = sum
    
for i in range(dice_num-use_num):
    next = sum + points[i+use_num] - points[i]
    max_sum = max(next,max_sum)
    sum = next
    
max_sum_expectation = (use_num + max_sum)/2

print(max_sum_expectation)

Measured memory_bytes: 25188
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.format;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;

alias sread = () => readln.chomp();
alias Point2 = Tuple!(long, "y", long, "x");

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void minAssign(T, U = T)(ref T dst, U src)
{
    dst = cast(T) min(dst, src);
}

void maxAssign(T, U = T)(ref T dst, U src)
{
    dst = cast(T) max(dst, src);
}

enum MOD = (10 ^^ 9) + 7;

void main()
{
    long N = lread();
    auto A = aryread();
    long sum;
    foreach(a;A)
    {
        while (~a & 1)
        {
            sum++;
            a >>= 1;
        }
    }
    writeln(sum);
}


Measured memory_bytes: 2684
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>

#define int long long
#define MOD7 1000000007
#define MOD9 1000000009

#define rep(i, n) for (int i = 0; i < (n); i++)
#define itrep(i, a) for (auto i = (a).begin(); i != (a).end(); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()
#define mp(a, b) make_pair((a), (b))

using namespace std;

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

template<class T> void inputVector(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < v.size(); i++) cin >> v[i];
}

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

	vector<int> D;
	inputVector(D, N);
	sort(all(D));

	multiset<int> st;
	st.insert(0);
 
	rep(i, N) {
		st.insert(D[i] * (i % 2 ? -1 : 1));
	}

	vector<int> v;
	for (int num : st) {
		v.push_back(num);
	}

	int ret = 100000;
	rep(i, N) {
		ret = min(ret, v[i + 1] - v[i]);
	}
	ret = min(ret, abs(v[0] + 24 - v[N]));

	cout << ret << endl;

    return 0;
}


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

int main() {
    int N; cin >> N;
    vector<int> L(N);
    for(int i=0; i<N; ++i) cin >> L[i];
    sort(begin(L), end(L));

    long long res = 0;
    for(int i=0; i<N; ++i) {
        for(int j=i+1; j<N; ++j) {
            int mi = L[j] - L[i];
            int ma = L[i] + L[j];
            int l = upper_bound(begin(L), end(L), mi) - begin(L);
            int r = lower_bound(begin(L), end(L), ma) - begin(L);
            if(l == r) continue;
            res += max(r - j - 1, 0);
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 256
// $%D%$.$%M%$.$%Y%$
// $%h%$:$%m%$:$%s%$

#pragma GCC optimize("O3")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define IOS ios::sync_with_stdio(false); cin.tie(0)
#define ll long long
#define ld long double
#define rep(i,a,n) for (int i=(int)(a);i<(int)(n);i++)
#define per(i,a,n) for (int i=(int)(n-1);i>=(int)(a);i--)
#define mp(a, b) make_pair(a, b)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pil pair<int, ll>
#define pli pair<ll, int>
#define fi first
#define se second


const int MOD = 1e9+7; // 998244353; // = (119<<23)+1
const int MX = 2e5+5;
const ll INF = 1e18;
const ld PI = 4*atan((ld)1);
const int xd[4] = {1,0,-1,0}, yd[4] = {0,1,0,-1};


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


int main() {
    int n;
    cin >> n;
    int c1 = 0;
    for (int i = 0; i < n; ++i) {
        int x, y;
        cin >> x >> y;
        if (x == y) {
            ++c1;
        }
        else {
            c1 = 0;
        }
        if (c1 == 3) {
            cout << "Yes\n";
            return 0;
        }
    }
    cout << "No\n";
    return 0;
}

Measured memory_bytes: 3644
#include<stdio.h>
int main(void)
{
    int i,a[10];
	for(i=0;i<3;i++){
	scanf("%d",&a[i]);
	}
	for(i=0;i<1;i++){
	if(a[i]==1&&a[i+1]==1&&a[i+2]==0){
	printf("Open\n");
	}
	else if(a[i]==0&&a[i+1]==0&&a[i+2]==1){
	printf("Open\n");
	}
	else{
	printf("Close\n");
	}
	}
	return 0;
	}

Measured memory_bytes: 584
from subprocess import call
call (('pypy3', '-c', """
from collections import deque

def main():
    h, w = map(int, input().split())
    A = [list(input()) for _ in range(h)]
    d = [[10**9] * w for _ in range(h)]
    que = deque([])
    
    for i in range(h):
        for j in range(w):
           if A[i][j] == "#":
               que.append([i, j])
               d[i][j] = 0
           else:
               d[i][j] = 10 ** 9
            
    while que:
        x, y = que.popleft()
        dx = [1, 0, -1, 0]
        dy = [0, 1, 0, -1]
        for i in range(4): 
            nx = x + dx[i]
            ny = y + dy[i]
            if 0 <= nx < h and 0 <= ny < w and d[nx][ny] == 10**9:
                d[nx][ny] = d[x][y] + 1
                que.append([nx, ny])
    ans = 0
    for i in range(h):
        for j in range(w):
            ans = max(ans, d[i][j])
    print(ans)
    
    return
    
main()

"""))

Measured memory_bytes: 180916
#include <iostream>
#include <queue>
using namespace std;
int ball[10];
int dfs(int k,int B,int C)
{
    if(k == 10)
        return 1;
    if(ball[k] > B)
        return dfs(k + 1,ball[k],C);
    if(ball[k] > C)
        return dfs(k + 1,B,ball[k]);
    return 0;
}
int main(void)
{
    int n;
    cin>>n;
    while(n--){
        int i;
        queue<int> left,right;
        for(i = 0;i < 10;i++)
            cin>>ball[i];
        if(dfs(0,0,0))
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;
    }
    return 0;
}

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

int main()
{
    string s;
    cin >> s;
    int c = 0;
    string t = "CODEFESTIVAL2016";
    rep(i, 16)
    {
        if (s[i] != t[i])
        {
            c++;
        }
    }
    cout << c << endl;
}

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

#define ll long long int
int main () {
    int N,W,wt,val;
    cin>>N>>W;
    vector <ll> fdp(W+1); // 0....W
    for (int i=0; i<N; i++) {
        cin>>wt>>val;
        for (int j=W-wt; j>=0; j--) {
            fdp[j+wt] = max(fdp[j+wt], fdp[j]+val);
        }
    }
    cout<<*max_element(fdp.begin(), fdp.end());
    
    return 0;    
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <queue>
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm>
#include <numeric>  // std::accumulate(m.begin(), m.end(), 0LL);
#include <functional>
#include <cassert>
#include <cctype>  // std::islower(), std::isupper(), std::tolower, std::toupper
#include <iomanip> // std::std::setprecision(X)
#include <limits>  //std::numeric_limits<int>::max(), min()

typedef long long ll;

int main (void) {
  std::string s,t; std::cin >> s >> t;
  std::sort(s.begin(), s.end());
  std::sort(t.begin(), t.end(), std::greater<>());
  if ( s < t ) std::cout << "Yes" << std::endl;
  else std::cout << "No" << std::endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args){

		Scanner scan = new Scanner(System.in);
		int first	= scan.nextInt();
		int second	= scan.nextInt();
		int therd	= scan.nextInt();
		
		if ((first == 5 || first == 7) & (second == 5 || second == 7) & (therd == 5 || therd == 7) & (first + second + therd == 17)) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}
	}
}

Measured memory_bytes: 9684
#include<iostream>
using namespace std;
int main()
{	
  	int a,b,c,d;
  	cin>>a>>b>>c>>d;
  	int a1=c/b;
  	if(c%b!=0) a1++;
  	int b1=a/d;
  	if(a%d!=0) b1++;
  	if(a1<=b1) cout<<"Yes";
  	else cout<<"No";
}

Measured memory_bytes: 3596
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 11 17:09:47 2020

@author: sd18016
"""

s = list(input())
ans = []

for i in range(len(s)):
    if s[i] == "0":
        ans.append("0")
    elif s[i] == "1":
        ans.append("1")
    else:
        if len(ans) == 0:
            pass
        else:
            ans.pop()

print("".join(ans))

Measured memory_bytes: 3060
#include <bits/stdc++.h>//Carefully Crafted by hetp111
using namespace std;
#define int long long
#define double long double
#define all(v) (v).begin(),(v).end()
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vii vector<pii>
#define MOD (1000000007)
//#define MOD (998244353)
#define PI acos(-1)
#define eps (1e-8)
#define INF (1e18)
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0)
template<class A,class B>ostream&operator<<(ostream&out,const pair<A,B>&a){return out<<"("<<a.first<<","<<a.second<<")";}
template<class A>ostream&operator<<(ostream&out,const vector<A>&a){for(const A &it:a)out<<it<<" ";return out;}
template<class A,class B>istream&operator>>(istream&in,pair<A,B>&a){return in>>a.first>>a.second;}
template<class A>istream&operator>>(istream&in,vector<A>&a){for(A &i:a)in>>i;return in;}
//ifstream cinn("input.txt");ofstream coutt("output.txt");

signed main(){
    FASTER;
    vi v(3);cin>>v;
    set<int> st(all(v));
    if(st.size()==2){
        cout<<"Yes";
    }else cout<<"No";
}



Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int k = scan.nextInt();
        int q = scan.nextInt();
        int[] a = new int[q];
        int[] p = new int[n];
        for(int i = 0; i < n; i++){
            p[i] = k - q;
        }
        for(int i = 0; i < q; i++){
            a[i] = scan.nextInt() - 1;
            p[a[i]]++;
        }
        for(int i = 0; i < n ; i++){
            if(p[i] <= 0){
                System.out.println("No");
            }else{
                System.out.println("Yes");
            }
        }
    }
}

Measured memory_bytes: 59900
from collections import defaultdict
import sys,heapq,bisect,math,itertools,string
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
AtoZ = [chr(i) for i in range(65,65+26)]
atoz = [chr(i) for i in range(97,97+26)]

S = list(input())

if len(S) == len(set(S)):
	print('yes')
else:
	print('no')

Measured memory_bytes: 3828
#include "bits/stdc++.h"

using namespace std;

void solve()
{
	int N;
	cin >> N;
	vector<long> as(N);
	for (int i = 0; i < N; i++) cin >> as[i];
	long ans = 0, r = 0, x = 0;
	for (int l = 0; l < N; l++)
	{
		while(r < N && (x+as[r] == (x^as[r])))
		{
			x ^= as[r++];
		}
		ans += r-l;
		if (l == r) r++;
		else x ^= as[l];
	}
	cout << ans << endl;
}

int main(void)
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <cmath>
#include <vector>

using namespace std;
 
#define MOD pow(10, 9) + 7
 
int main()
{
  int n;
  long long ans = (long long)1;
  cin >> n;
  vector<int> nums(n + 1, 0);
  for (int i = 0; i < n; i++) {
    int num;
    cin >> num;
    nums[num]++;
  }
  //validation
  if (n % 2 == 0) {
    if (nums[0] != 0) {
      cout << 0 << endl;
      return 0;
    }
    for (int i = 1; i <=n; i++) {
      if (i % 2 == 1 && nums[i] != 2) {
        cout << 0 << endl;
        return 0;
      }
    }
  } else {
    if (nums[0] != 1) {
      cout << 0 << endl;
      return 0;
    }
    
    for (int i = 1; i <=n; i++) {
      if (i % 2 == 0 && nums[i] != 2) {
        cout << 0 << endl;
        return 0;
      }
    }
  }
  
  
  for (int i = 1; i <= n/2; i++)
  {
    ans *= 2;
    ans %= (long long)MOD;
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
//author:luckYrat(twitter:@luckYrat_)
//<ここに一言>

//せんげん！
#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <bitset>

#include <cctype>
#include <utility>
#include <climits>


//なまえくーかん！
using namespace std;
using ll = long long;
using P = pair<ll,ll>;

//てーすう！
const int mod = 1000000007;
const int inf = (1<<30)-1;
const ll linf = (1LL<<62LL)-1;
const double EPS = (1e-10);

//でふぁいん！
#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)

//みじかく！
#define pb push_back
#define fir first
#define scn second
#define ednl endl

//いぇすのー！
#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")

//きんぼーnほーこー！！
P ar4[4] = {{0,1},{0,-1},{1,0},{-1,0}};
P ar8[8] = {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
/*
確認ポイント
cout << fixed << setprecision(n) << 小数計算//n桁の小数表記になる

計算量は変わらないが楽できるシリーズ
min(max)_element(iter,iter)で一番小さい(大きい)値のポインタが帰ってくる
count(iter,iter,int)でintがiterからiterの間にいくつあったかを取得できる
*/
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}
int main(){
	string s;cin>>s;
	if(s[2]==s[3]&&s[4]==s[5]){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define uu unsigned
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define MOD 1000000007
#define pi pair<int,int>
#define pl pair<ll,ll>
#define mkp make_pair
#define ss second
#define ff first
#define all(x) x.begin(),x.end()
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define pb push_back
#define pf push_front
#define printcas cout<<"Case "<<cas<<": "
#define _ continue;
#define endl '\n'
#define __ cout<<endl;continue;
#define vc4d(nam,type,a,b,c,d,fix) vector<vector<vector<vector<type>>>> nam(a,vector<vector<vector<type>>>(b,vector<vector<type>>(c,vector<type>(d,fix))))
const ll oo=(1ll<<60);
int gg(){
    int x=0,w=1;char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
    if(ch=='-')w=0,ch=getchar();
    while(ch>='0'&&ch<='9')x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
    return w?x:-x;
}
class ttt
{
public:
    ll r,l,i;
    ttt(){r=l=i=0;}
    bool operator < (ttt p){return r<p.r;}
};
const ll MX=500010;
ll v[MX]={0},tree[MX<<2]={0},ans[MX]={0},last[MX]={0},n,m;
ttt q[MX];

void update(ll id,ll val,ll node=1,ll b=1,ll e=n)
{
    if(e<id or b>id)return;
    if(b>=id and e<=id )
    {
        tree[node]=val;return;
    }
    ll mid=(b+e)>>1,left=(node<<1),right=left+1;
    update(id,val,left,b,mid);
    update(id,val,right,mid+1,e);
    tree[node]=tree[left]+tree[right];
}
ll qr(ll l,ll r,ll node=1,ll b=1,ll e=n)
{
    if(e<l or b>r)return 0;
     if(b>=l and e<=r )
    {
       return tree[node];
    }
    ll mid=(b+e)>>1,left=(node<<1),right=left+1;
    return qr(l,r,left,b,mid)+qr(l,r,right,mid+1,e);
}

int main()
{
     io;
    int T=1;
    //T=gg();
    //cin>>T;
    //for(int cas=1;cas<=T;cas++)
    while(T--)
    {
       n=gg(),m=gg();
       ll i,j=1,k,l;
       for(i=1;i<=n;i++)v[i]=gg();
       for(i=1;i<=m;i++)
       {
           q[i].l=gg(),q[i].r=gg(),q[i].i=i;
       }
       sort(q+1,q+m+1);
       for(i=1;i<=n;i++)
       {
           if(last[v[i]])update(last[v[i]],0);
           last[v[i]]=i;
           update(i,1);
           for(;j<=m and q[j].r==i;j++)
           {
               ans[q[j].i]=qr(q[j].l,q[j].r);
           }
       }
       for(i=1;i<=m;i++)cout<<ans[i]<<endl;
    }
    return 0;
}


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

bool isPal(string s){
	for (unsigned i = 0; i <= s.length() / 2; i++){
		if (s[i] != s[s.length() - i - 1]){
			return false;
		}
	}
	return true;
}
		


int main(){
	string s;
	cin >> s;
	string result = "No";
	
	if (isPal(s)){
		string s1 = s.substr(0, s.length() / 2);
		if (isPal(s1)){
			result = "Yes";
		}
	}
	cout << result;

	return 0;
}


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

using namespace std;

typedef unsigned long long ll; 

int main(){ 
  ll n, w; 
  cin >> n >> w; 
  vector<int> v(n+1), W(n+1); 
  for (int i =1 ; i<=n ; i++){
    cin >> W[i]  >> v[i];
  }

  ll dp[n+1][w+1]; 
  
  for(int i =0 ; i <= n; i++){ 
    for(int j = 0 ; j <= w; j++){ 
      dp[i][j] = 0; 
    }
  }
  
  for(int i = 1; i <= n; i++){ 
    for(int j = 0 ;  j <= w; j++){ 
      if (j - W[i] < 0 ) { 
        dp[i][j]  = dp[i-1][j]; 
        continue; 
      }
      dp[i][j]  = max(dp[i-1][j], v[i] + dp[i-1][j - W[i]]);   
    }
  }
  /*
  for(int i =0 ; i <n+1; i++){ 
    for(int j =0 ;j < w+1; j++){
      cout << dp[i][j]  << " " ;
    }
    cout << endl;
  }
  */ 

  cout << dp[n][w] << endl; 
} 


Measured memory_bytes: 79104
#include<bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
#define time_taken_start int begtime = clock();
#define time_taken_end int endtime = clock(); \
cerr << "\n\n" << "Time elapsed: " << \
(endtime - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n"; \
return 0;
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define mod 1000000007
#define inf 1000000000000000007
#define eps 0.0000000001
#define pi acosl(-1)
#define pii pair<int,int>
#define pdd pair<ld,ld>
#define pll pair<ll,ll>
#define ff first
#define ss second
#define vii vector<int>
#define vpl vector<pll>
#define vll vector<ll>
#define mseti multiset <ll>
#define msetd multiset <ll,greater<ll>>
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound 
#define stp fixed<<setprecision(20)
#define endl '\n'
ll n;
ll power(ll x,ll y)
{
    ll res=1;
  
    while(y>0)
    {
        if(y&1)
            res=res*x;
        res%=mod;
        y=y>>1;
        x=x*x;
        x%=mod;
    } 
    return res; 
}
ll inv(ll x)
{
    return power(x,mod-2);
}
vll v[200009];
ll e[200009],sz[200009],fac[200009],val[200009];
ll dfs(ll q)
{
    e[q]=1;
    ll s=0;
    for(auto i:v[q])
    {
        if(e[i]==1)
            continue;
        s+=dfs(i);
    }
    sz[q]=s;
    return(s+1);
}
ll dfs1(ll q)
{
    e[q]=1;
    ll l=fac[sz[q]];
    for(auto i:v[q])
    {
        if(e[i]==1)
            continue;
        l*=inv(fac[sz[i]+1]);
        l%=mod;
        l*=dfs1(i);
        l%=mod;
    }
    return l;
}
void dfs2(ll q)
{
    e[q]=1;
    for(auto i:v[q])
    {
        if(e[i]==1)
            continue;
        ll p=val[q];
        ll s=sz[i];
        ll sn=n-sz[i]-1;
        p*=s+1;
        p%=mod;
        p*=inv(fac[sn]);
        p%=mod;
        p*=fac[sn-1];
        p%=mod;
        val[i]=p;
        dfs2(i);
    }
}
int main()
{
    FAST
    #ifdef ayk_16
    freopen("input.txt","rt",stdin);
    freopen("output.txt","wt",stdout);
    #endif
    fac[0]=1;
    for(ll i=1;i<=200000;i++)
    {
        fac[i]=fac[i-1]*i;
        fac[i]%=mod;
    }
    ll x,y;
    cin>>n;
    for(ll i=1;i<n;i++)
    {
        cin>>x>>y;
        v[x].pb(y);
        v[y].pb(x);
    }
    dfs(1);
    for(ll i=0;i<=n;i++)
        e[i]=0;
    val[1]=dfs1(1);
    for(ll i=0;i<=n;i++)
        e[i]=0;
    dfs2(1);
    for(ll i=1;i<=n;i++)
        cout<<val[i]<<endl;
}

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

using namespace std;


int main()
{
    int n;
    cin >> n;
    vector<int> h(n);

    for(int i = 0; i < n; i++)
    {
        cin >> h[i];
    }
    vector<int> dp(n, INT_MAX);
    dp[0] = 0;
    dp[1] = abs(h[1] - h[0]);
    for(int i = 2; i < n; i++)
    {
        dp[i] = min(dp[i - 2] + abs(h[i] - h[i - 2]),
                    dp[i - 1] + abs(h[i] - h[i - 1]));
    }
    cout << dp[n - 1];
    return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>

int main(void){
	int n , a , b , c , d , count;
	while(scanf("%d" , &n)!=EOF){
		count = 0;
		for(a=0;a<10;a++){
			for(b=0;b<10;b++){
				for(c=0;c<10;c++){
					for(d=0;d<10;d++){
						if(a+b+c+d==n) count++;
					}
				}			
			}
		}
	printf("%d\n" , count);
	}
	return 0;
}

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define repr(i,n) for(int i=(n);i>=0;--i)
#define cinv(n,vec) VL (vec)(n);for(auto&v:vec)cin>>v;
#define int long long
#define itn int
#define pb push_back
#define m_p make_pair
#define m_t make_tuple
#define eb emplace_back
#define p_p(a,b) pb(m_p(a,b))
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(all(a),greater<>())
#define UNIQUE(a) a.erase(unique(all(a)),a.end())
#define SZ(a) (ll)(a.size())
#define ENDL cout<<endl
#define debg(a) cout<<#a<<" "<<a<<endl;
#define debgp(a) cout<<#a<<" "<<a.fi<<" : "<<a.se<<endl
#define call(a) for(auto i:a)cout<<i<<" ";cout<<endl
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
#define out(a) cout<<(a)<<endl
#define cont const auto
#define fi first
#define se second
#define V vector
#define P pair
#define T tuple
#define VV(type,name,y,x,a) vector<vector<type>> name = vector<vector<type>>(y,vector<type>(x,a))
#define PQ priority_queue
typedef long long ll;
typedef double D;
typedef long double LD;
typedef string str;
typedef vector<ll> VL;
typedef pair<ll,ll> PL;
typedef vector<pair<ll,ll>> VP;
typedef tuple<ll,ll,ll> T3;
typedef tuple<ll,ll,ll,ll> T4;
const long long INF = 1LL<<60;
const long long MOD = 1e9+7;
void Yes(){cout<<"Yes"<<endl;}
void No(){cout<<"No"<<endl;}
void YN(bool b){cout<<(b?"Yes":"No")<<endl;}
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T>inline bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int h,w;
  cin>>h>>w;
  V<str> a(h);
  rep(i,h)cin>>a[i];

  int cnt=0;
  rep(i,h)rep(j,w)cnt+=(a[i][j]=='#');
  out(cnt==h+w-1?"Possible":"Impossible");
  
  return 0;
}



Measured memory_bytes: 256
import sys
sys.setrecursionlimit(300000)
class BinomialCoefficient(object):

    def __init__(self, N=510000, MOD=10**9+7):
        self.fac = [1, 1]
        self.finv = [1, 1]
        self.inv = [0, 1]
        self.MOD = MOD
        for i in range(2, N + 1):
            self.fac.append((self.fac[-1] * i) % MOD)
            self.inv.append((-self.inv[MOD % i] * (MOD // i)) % MOD)
            self.finv.append((self.finv[-1] * self.inv[-1]) % MOD)

    def C(self, n, r):
        if r < 0 or n < r:
            return 0
        return self.fac[n] * self.finv[r] * self.finv[n - r] % self.MOD

    def P(self, n, r):
        if r < 0 or n < r:
            return 0
        return self.fac[n] * self.finv[n - r] % self.MOD


def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI0(): return map(lambda s: int(s) - 1, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
def LMI0(): return list(map(lambda s: int(s) - 1, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')


N, M = MI()
bi = BinomialCoefficient()

ans = 0
for i in range(0, N + 1):
    sgn = (-1) ** i
    lans = bi.C(N, i) * bi.P(M - i, N - i) % MOD
    lans = lans * sgn
    ans = (ans + lans + MOD) % MOD

ans = ans * bi.P(M, N) % MOD
print(ans)

Measured memory_bytes: 192904
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iomanip>
#include <float.h>
#include <math.h>
using namespace std;
using ll = long long;


unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;
    UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

long long modinv(long long a, long long mod) {
    return modpow(a, mod - 2, mod);
}


int main() {
    ll n;
    cin >> n;
    queue<ll> z;
    for (int i = 1; i < 10; i++) {
        z.push(i);
    }
    vector<ll> s;
    while (s.size() < 112358) {
        ll d = z.front();
        s.push_back(d);
        ll b = d % 10;
        ll a = b + 1;
        ll c = b - 1;
        if (c > -1 && c < 10)z.push(10 * d + c);
        if (b > -1 && b < 10)z.push(10 * d + b);
        if (a > -1 && a < 10)z.push(10 * d + a);
        z.pop();
    }
    cout << s.at(n-1) << endl;
}

Measured memory_bytes: 6028
a=int(input())
b=int(input())
c=int(input())
x=int(input())
ans=0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            money=500*i+100*j+50*k
            if money==x:
                ans+=1
print(ans)

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

const int MAX = 101010;
vector<bool> eratos(MAX, true);
vector<int> ps(101010);

void init()
{    
    eratos.at(0) = eratos.at(1) = false;
    for(int i = 2; i < MAX; i++){
        for(int j = i + i; j <= MAX; j += i){
            eratos[j] = false;
        }
    }
    ps[0] = 0;
    for(int i = 1; i < MAX - 1; i++)
    {
        if(eratos[i] && eratos[(i + 1) / 2])
        {
            ps[i] = 1;
        }
    }
    for(int i = 1; i < MAX - 1; i++)
    {
        ps[i + 1] += ps[i];
    }
}


int q;

int main()
{
    init();
    cin >> q;
    rep(i, q)
    {
        int l, r;
        cin >> l >> r;
        cout << ps[r] - ps[l - 1] << "\n";
    }
    
    return 0;
}

Measured memory_bytes: 1024
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main
{
	public static void main(String[] args)
	{
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
		int[][] points = new int[n+1][3];
		for(int i=1;i<=n;i++){
		    points[i][0] =scn.nextInt();
		    points[i][1] =scn.nextInt();
		    points[i][2] =scn.nextInt();
		}
		// System.out.println(maxHappiness(1,points,-1));
		int[][] memo = new int[n+1][3];
		System.out.println(maxHappiness_dp(1,points));

	}


    public static int maxHappiness_dp(int day, int[][] points) {
		int len = points.length;
		int[][] dp = new int[len][3];
		for (int cday = len - 1; cday > 0; cday--) {
			for (int ca = 0; ca < 3; ca++) {

				if (cday == points.length - 1) {
					dp[cday][ca] = points[cday][ca];
					continue;
				}

				int ans = Integer.MIN_VALUE;
				for (int i = 0; i < 3; i++) {
					if (i != ca) {
						int ch = points[cday][ca] + dp[cday + 1][i];
						//maxHappiness_memoized(day + 1, points, i, memo);
						ans = Math.max(ans, ch);
					}
				}

				dp[cday][ca] = ans;
			}
		}
		return Math.max(dp[1][0], Math.max(dp[1][1], dp[1][2]));
	}
	
}


Measured memory_bytes: 64796
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

struct Spl{auto r="".splitter;auto rd(){r=readln.splitter;}auto bd(T)(ref T t){t=r.front.to!T;r.popFront;}}
auto _s = Spl();
auto getV(T...)(ref T t){foreach(ref u;t)_s.bd(u);}
auto getA(T)(size_t n,ref T t){t=new T(n);foreach(ref u;t)_s.bd(u);}
auto readV(T...)(ref T t){_s.rd; getV(t);}
auto readA(T)(size_t n,ref T t){_s.rd;getA(n,t);}

void main()
{
  int n; readV(n);
  int[] w; readA(n, w);

  int s = w.sum;
  foreach (i; 1..n)
    s = min(s, (w[0..i].sum-w[i..$].sum).abs);

  writeln(s);
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){

  int a[25];
  double b[25];
  
  for(int i=0;i<24;i++){
    scanf("%d %lf",&a[i],&b[i]);
  }

  for(int k=8;k<=24;k+=8){
    
    for(int i=k-8;i<k-1;i++){
      for(int j=i+1;j<k;j++){
	if(b[i] > b[j]){
	  swap(a[i],a[j]);
	  swap(b[i],b[j]);
	}
      }
    }

  }
  
  for(int i=0;i<=16;i+=8){
    printf("%d %g\n%d %g\n",a[i],b[i],a[i+1],b[i+1]);
  }
  
  if(b[2] < b[10] && b[2] < b[18]){
    printf("%d %g\n",a[2],b[2]);
    if(b[10] < b[18]) printf("%d %g\n",a[10],b[10]);
    else printf("%d %g\n",a[18],b[18]);
  }
  else if(b[10] < b[2] && b[10] < b[18]){
    printf("%d %g\n",a[10],b[10]);
    if(b[2] < b[18]) printf("%d %g\n",a[2],b[2]);
    else printf("%d %g\n",a[18],b[18]);
  }
  else if(b[18] < b[2] && b[18] < b[10]){
    printf("%d %g\n",a[18],b[18]);
    if(b[2] < b[10]) printf("%d %g\n",a[2],b[2]);
    else printf("%d %g\n",a[10],b[10]);
  }
  return (0);
}

Measured memory_bytes: 2568
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N;
    vector<int> X(N);
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        int data;
        cin >> data;
        X[i] = data;
    }

    vector<int> distances(100);
    for (int p = 0; p < 100; p++)
    {
        int dist = 0;
        for (int i = 0; i < N; i++)
        {
            dist += (X[i] - p) * (X[i] - p);
        }
        distances[p] = dist;
    }

    int min = *min_element(distances.begin(), distances.end());
    cout << min << endl;

    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define debug(x) cout<<#x<<"::"<<x<<endl;
using namespace std;
typedef long long ll;

void solve()
{
	double l;
	cin>>l;
	double x=(double)l/3;
	cout<<setprecision(12)<<x*x*x<<'\n';

}

int main()
{
	
	int t;
	t=1;
	while(t--)
		solve();
	return 0;
}

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

int main() {
    int N;
    cin>>N;
    vector<int> a(N);
    for(int i=0;i<N;i++)
        cin>>a.at(i);
    sort(a.begin(),a.end());
    reverse(a.begin(),a.end());
    int sum1=0,sum2=0;
    for(int i=0;i<N;i+=2){
        sum1+= a.at(i);
    }
    for(int i=1;i<N;i+=2){
        sum2+= a.at(i);
    }
    cout<<sum1-sum2<<endl;
}


Measured memory_bytes: 256
n = int(input())
x=[]
i=1
while not i == 10:
    x.append(i*1)
    i+=1
i=1
while not i == 10:
    x.append(i*2)
    i+=1
i=1
while not i == 10:
    x.append(i*3)
    i+=1
i=1
while not i == 10:
    x.append(i*4)
    i+=1
i=1
while not i == 10:
    x.append(i*5)
    i+=1
i=1
while not i == 10:
    x.append(i*6)
    i+=1
i=1
while not i == 10:
    x.append(i*7)
    i+=1
i=1
while not i == 10:
    x.append(i*8)
    i+=1
i=1
while not i == 10:
    x.append(i*9)
    i+=1
i = 1
for i in range(len(x)):
    if x[i] == n:
        print('Yes')
        quit()
print('No')


Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(i) begin(i), end(i)

const int INF = 0x3fffffff;
const ll MINF = 0x7fffffffffff;
const ld DINF = numeric_limits<ld>::infinity();
const int MOD = 1000000007;
const int MODD = 998244353;
const ld EPS = 1e-9;
const ld PI = 3.1415926535897932;

ll gcd(ll a, ll b){ while(b){ ll c = b; b = a % b; a = c; } return a; }
ll lcm(ll a, ll b){ if(!a || !b) return 0; return a * b / gcd(a, b); }
ll pow_mod(ll n,ll k,ll m){ll r = 1;for(; k > 0;k >>= 1) {if (k & 1) r = (r * n) % m; n = (n * n) % m;}return r;}

//ここから。
int main(){
    ll N;
    cin >> N;
    vector<vector<int>> happy(N,vector<int>(3));
    rep(i,N) rep(j,3) cin >> happy[i][j];
    vector<vector<int>> sum(N,vector<int>(3,0));
    rep(i,3) sum[0][i] = happy[0][i];

    rep(i,N - 1){
        sum[i+1][0] = max(sum[i][1],sum[i][2]) + happy[i+1][0];
        sum[i+1][1] = max(sum[i][0],sum[i][2]) + happy[i+1][1];
        sum[i+1][2] = max(sum[i][0],sum[i][1]) + happy[i+1][2];
    }

    cout << max(sum[N-1][0],max(sum[N-1][1],sum[N-1][2])) << endl;
}

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

const int MAXN = 2007;
const int MOD = 1000 * 1000 * 1000 + 7;

ll fct[MAXN];

using arr = array<ll, MAXN>;
using varr = array<arr, 2>;

vector <int> e[MAXN];

arr f[MAXN];
int sz[MAXN];
arr fnt[MAXN];
arr fclosed[MAXN];

ll pw(ll a, int b = MOD - 2) {
    if (b == 0) {
        return 1;
    }

    ll v = pw(a, b / 2);
    v = (v * v) % MOD;
    if (b & 1) {
        v = (v * a) % MOD;
    }

    return v;
}

ll rev2 = pw(2);


arr mrg(int s1, const arr& a1, int s2, const arr& a2, int off = 0) {
    arr r;
    r.fill(0);
    for (int i = 0; i < s1; ++i) {
        for (int j = 0; j < min(s2, MAXN - 1 - s1 - off); ++j) {
            r[i + j + off] = (r[i + j + off] + a1[i] * a2[j]) % MOD;
        }
    }

    return r;
}



arr ad(const arr& a1, const arr& a2) {
    arr r;
    r.fill(0);
    for (int i = 0; i < MAXN; ++i) {
        r[i] = (a1[i] + a2[i]) % MOD;
    }

    return r;
}

arr d2(const arr& a1) {
    arr r;
    r.fill(0);
    for (int i = 0; i < MAXN; ++i) {
        r[i] = (a1[i] * rev2) % MOD;
    }

    return r;
}


arr m2(const arr& other) {
    return ad(other, other);
}

int main() {
#ifdef PAUNSVOKNO
    freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false); cout.setf(ios::fixed); cout.precision(20); cout.tie(nullptr); cin.tie(nullptr);
    int n;
    cin >> n;
    for (int i = 2; i <= n; ++i) {
        int x;
        cin >> x;
        e[x].push_back(i);
    }

    for (int i = n; i >= 1; --i) {
        sz[i] = 1;
        auto& cf = f[i];
        auto& cfnt = fnt[i];
        auto& cclosed = fclosed[i];

        cfnt[0] = 1;

        for (int u : e[i]) {
            arr tot_sum = ad(f[u], fnt[u]);
            arr c_sum = ad(tot_sum, fclosed[u]);
            arr m_sum = ad(m2(fnt[u]), f[u]);
            
            arr nf = mrg(sz[i], cf, sz[u], c_sum);
            nf = ad(nf, mrg(sz[i], cfnt, sz[u], m_sum, 1));

            arr ncf = mrg(sz[i], cfnt, sz[u], c_sum);

            arr nclosed = mrg(sz[i], cclosed, sz[u], c_sum);
            nclosed = ad(nclosed, d2(mrg(sz[i], cf, sz[u], m_sum, 1)));

            cf = nf;
            cfnt = ncf;
            cclosed = nclosed;


            sz[i] += sz[u];
        }

    }

    ll ans = 0;
    ll mul = 1;
    
    fct[0] = 1;
    for (int i = 1; i <= n; ++i) {
        fct[i] = (fct[i - 1] * i) % MOD;
    }

    auto tot = f[1];

    for (int i = 0; i <= n; ++i) {
        tot[i] = (tot[i] + fnt[1][i] + fclosed[1][i]) % MOD;
    }


    for (int i = 0; i < n; ++i) {
        ll vl = (tot[i] * fct[n - i]) % MOD;

        if (i & 1) {
            ans -= vl;
        } else {
            ans += vl;
        }

        ans %= MOD;
    }

    if (ans < 0) {
        ans += MOD;
    }

    cout << ans << "\n";
}

Measured memory_bytes: 94848