akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

int main(){
    int k, x;
    cin >> k >> x;
    int min_num = x - (k - 1);
    int max_num = x + (k - 1);
    for (int i=min_num;i<=max_num;i++){
        if (-1000000 <= i && i <= 1000000 ){
            if (i == 1000000 || i == max_num){
                cout << i << endl;
            }else{
                cout << i << ' ';
            }
        }
    }
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n, k; cin >> n >> k;
    int res = 0;
    while(n>0){
        if(res==0){
            res++; n -= k; //cout << n << "," << k << endl;
        }else{
            res++; n -= (k-1); //cout << n << "," << k << endl;
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3628
package main

import (
	"fmt"
)

func main() {
	var n, m int
	fmt.Scan(&n, &m)

	k := make([]int, m)
	s := make([][]int, m)
	for i := 0; i < m; i++ {
		fmt.Scan(&k[i])
		s[i] = make([]int, k[i])
		for j := 0; j < k[i]; j++ {
			fmt.Scan(&s[i][j])
			s[i][j]--
		}
	}
	p := make([]int, m)
	for i := 0; i < m; i++ {
		fmt.Scan(&p[i])
	}

	ans := 0
	for i := 0; i < (1 << uint(n)); i++ {
		ok := true
		for j := 0; j < m; j++ {
			c := 0
			for _, v := range s[j] {
				if (i>>uint(v))&1 == 1 {
					c++
				}
			}
			c %= 2
			if c != p[j] {
				ok = false
			}
		}
		if ok {
			ans++
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < n; ++i)
using ll = long long;
const ll MOD = 1000000007;//998244353;
int main() {
   ios::sync_with_stdio(false);
   cin.tie(0);
   ll n; cin >> n;
   ll ans = (n*n*n+3*n*n+2*n)/6;
   rep(i,n-1){
      ll u, v; cin >> u >> v;
      if (u>v)swap(u,v);
      ans -= u*(n-v+1);
   }
   cout << ans << endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define Int int64_t

using namespace std;

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

	vector<string> vec;
	vec.push_back(s.substr(0, 1));
	int idx = 1;
	while (idx < s.size()) {
		string curr = vec.back();
		if (curr.size() == 2) {
			vec.push_back(s.substr(idx, 1));
			++idx;
			continue;
		}
		if (curr[0] == s[idx]) {
			if (idx + 1 < s.size()) {
				vec.push_back(s.substr(idx, 2));
				idx += 2;
			} else {
				++idx;
			}
		} else {
			vec.push_back(s.substr(idx, 1));
			++idx;
		}
	}
	cout << vec.size() << endl;

	return 0;
}


Measured memory_bytes: 10996
def cmb(n, r, p):
    r = min(r, n - r)
    res = 1
    for i in range(r):
        res *= pow(i+1, p-2, p)  # 分母の逆元(フェルマーの定理)
        res *= n-i  # 分子
        res %= p
    return res

p = 10 ** 9 + 7
n, a, b = map(int, input().split())
ans = pow(2, n, p) - 1
ans -= cmb(n, a, p) + cmb(n, b, p)
print(ans % p)


Measured memory_bytes: 3064
#include <iostream>
#include <string>
using namespace std;
int main(void){
    int a,b,c,ans=0;
    cin>>a>>b>>c;
    int A=a,B=b,C=c;
    if(a%2==1||b%2==1||c%2==1){cout<<0<<endl;return 0;}
    if(a==b&&b==c){cout<<-1<<endl;return 0;}
    while(1){
        if(a%2==1||b%2==1||c%2==1){
            cout<<ans<<endl;break;
        }
        A=b/2+c/2;B=a/2+c/2;C=a/2+b/2;
        a=A;b=B;c=C;ans++;
    }
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include <iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>

using namespace std;
typedef long long ll;
typedef pair<int, int> Pr;

int N, M;
ll mod = 1000000007;

ll factorial(int n){
	ll ans = 1;
	for (int i = 1; i <= n; i++) {
		ans *= i;
		ans %= mod;
	}
	return ans;
}

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

	if (abs(N - M) > 1) {
		cout << 0 << endl;
	}
	else if(abs(N-M) == 1){
		cout << (factorial(N) * factorial(M)) % mod << endl;
	}
	else {
		cout << (((factorial(N) * factorial(M)) % mod)*2)%mod << endl;
	}
	return	0;
}

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

#define ll long long
#define ff first
#define ss second
#define pb push_back

using namespace std;

const int N = 1e6+69, mod = 1e9+9;

ll n,m,x,y,a,b,c,d,t,k,ans=1e18,cur,l,r;

ll A[N],dp[N],mx[N],mx1[N];

int main() {
    
    cin>>n;
   
    for(int i=0;i<(1<<n);i++)
        cin>>A[i];
    
    if(A[0]<A[1]){
        mx[1] = 1;
        mx1[1] = 0;
    } else {
        mx[1] = 0;
        mx1[1] = 1;
    }
    dp[1] = A[0]+A[1];
    mx[0] = 0;
    
    for(int i=2;i<(1<<n);i++){
        
        mx[i] = i;
        
        for(int j=0;j<n;j++)
        if( (i>>j) & 1){
            //cout<< (i^(1<<j)) <<endl;
            if(A[mx[i]] <= A[ mx[i^(1<<j)] ] && mx[i] != mx[i^(1<<j)] ){
                mx1[i] = mx[i];
                mx[i] = mx[i^(1<<j)];
            } else 
            if(A[mx1[i]] < A[ mx[i^(1<<j)] ] && mx1[i] != mx[i^(1<<j)] 
                                             && mx[i] != mx[i^(1<<j)]) {
                mx1[i] = mx[i^(1<<j)];
            }
        }
        
        dp[i] = max(A[mx[i]] + A[mx1[i]],dp[i-1]);
        //cout<<mx[i]<<" "<<mx1[i]<<" "<<i<<endl;
        
    }
    
    for(int i=1;i<(1<<n);i++)
    cout<<dp[i]<<" ";
   
}


Measured memory_bytes: 19456
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()

bool is_prime(const int n){
    switch(n) {
        case 0: // fall-through
        case 1: return false;
        case 2: return true;
    } // n > 2 が保証された

    if(n % 2 == 0) return false;

    // 上で i=2 相当は調べたので、i=3から奇数のみ調べる
    for(int i = 3; i * i <= n; i += 2) {
        if(n % i == 0) return false;
    }

    return true;
}

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> p(n);
    rep (i, n) {
        cin >> p[i];
    }
    sort(all(p));
    int ans = 0;
    rep (i, k) {
        ans += p[i];
    }
    cout << ans << endl;
}




Measured memory_bytes: 3628
function main(input) {
  const inputs =input.split('\n')
  const [X, Y] = inputs[0].split(' ').map(Number)
  for (let i = 0; i <= 25; i++) {
    for (let j = 0; j <= 50; j++) {
      if (i + j === X && i * 4 + j * 2 === Y) {
        console.log('Yes')
        return
      }
    }
  }
  console.log('No')
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 29676
#include<bits/stdc++.h>
using namespace std;
long long n,m,x,y,ans,a[100001],f[100001];
inline long long read()
{
   long long sum=0,x=1;
   char ch=getchar();
   while (ch<'0'||ch>'9')
   {
       if (ch=='-')
	     x=-1;
	   ch=getchar();
   }
   while (ch>='0'&&ch<='9')
   {
   	   sum=sum*10+ch-'0';
	   ch=getchar();
   }
   return sum*x;
}
inline void write(long long x)
{
    if (x<0)
	{
        putchar('-');
        x=-x;
    }
    if (x>9)
      write(x/10);
    putchar(x%10+'0');
    return;
}
inline long long find(long long x)
{
	if (x==f[x])
	  return x;
	return f[x]=find(f[x]);
}
int main()
{
	n=read();m=read();
	for (register long long i=1;i<=n;++i)
	{
		a[i]=read();
		f[i]=i;
	}
	for (register long long i=1;i<=m;++i)
	{
		x=read();y=read();
		x=find(x);y=find(y);
		f[x]=y;
	}
	for (register long long i=1;i<=n;++i)
	  if (find(a[i])==find(i))
	    ++ans;
	write(ans);
	return 0;
}

Measured memory_bytes: 5172
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200;
template <class T>
inline void _read(T &x)
{
	x = 0;
	char t = getchar();
	while (!isdigit(t) && t != '-') t = getchar();
	if (t == '-')
	{
		_read(x);
		x *= -1;
		return;
	}
	while (isdigit(t))
	{
		x = x * 10 + t - '0';
		t = getchar();
	}
}
int n, d;
struct pnt
{
	int x[MAXN];
};
pnt a[MAXN];
inline bool chkint(int x)
{
	for (int i = 1; i <= sqrt(x) + 20; ++i)
		if (i * i == x) return 1;
	return 0;
}
inline bool chk(pnt p, pnt q)
{
	int dis = 0;
	for (int i = 1; i <= d; ++i)
	{
		dis += (p.x[i] - q.x[i]) * (p.x[i] - q.x[i]);
	}
	if (chkint(dis)) return 1;
	else return 0;
}
int main()
{
	_read(n), _read(d);
	for (int i = 1; i <= n; ++i)
		for (int j = 1; j <= d; ++j)
			_read(a[i].x[j]);
	int ans = 0;
	for (int i = 1; i <= n; ++i)
		for (int j = i + 1; j<= n; ++j)
			ans += chk(a[i], a[j]);
	cout << ans << endl;	
	return 0;
}

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

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(), (a).end()
#define allg(a) (a).begin(), (a).end(), greater<int>()

using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;

const int INF = 1001001001;
const int MOD = 1000000007;
const long long INFL = (1LL << 60);
const double EPS = 1e-9;

int main() {
  int A, B, C, X, Y;
  cin >> A >> B >> C >> X >> Y;
  pair<int, int> piz[] = {make_pair(A, X), make_pair(B, Y)};

  int res = 0;
  if (A + B > C * 2) {
    pair<int, int> maxp, minp;
    if (X >= Y)
      maxp = piz[0], minp = piz[1];
    else
      maxp = piz[1], minp = piz[0];
    int diff = maxp.second - minp.second;
    res = C * minp.second * 2 + diff * maxp.first;
    int allC = C * maxp.second * 2;
    if (res > allC) res = allC;
  } else {
    res = A * X + B * Y;
  }

  cout << res << endl;
}

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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define fore(i,x,n) for(int i=x;i<n;i++)
#define all(a) a.begin(),a.end()
#define pb push_back
#define ordenar(a) sort(all(a))
typedef long long ll;
typedef vector<int> vi;

int n;
string a;

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

    fore(i,0,a.size()){
        cout<<(char)('A'+((a[i]-'A')+n)%26);
    }
    
    return 0;
}

Measured memory_bytes: 3628
#include <stdio.h>

int a, b, c = 0;
int x, y = 0;
int price = 0;
int min = 0;


int case1(int a, int b, int x, int y) {
  price = a * x + b * y;

  return price;
}

int case2(int c, int x, int y) {
  if(x > y) {
    price = c * 2 * x;
  }else{
    price = c * 2 * y;
  }

  return price;
}

int case3(int a, int b, int c, int x, int y) {
  if(x > y) {
    price = c * 2 * y + (x - y) * a;
  }else if(x < y) {
    price = c * 2 * x + (y - x) * b;
  }

  return price;
}

int compare(int a, int b, int c, int x, int y) {
  min = case1(a, b, x, y);
  if(min > case2(c, x, y)) {
    min = case2(c, x, y);
  }

  if(min > case3(a, b, c, x, y)) {
      min = case3(a, b, c, x, y);
  }

  return min;
}
  


int main(void) {

  scanf("%d %d %d %d %d", &a, &b, &c, &x, &y);


  printf("%d\n", compare(a, b, c, x, y));


  return 0; 

}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    int arr[n];
    for(int i=0;i<n;i++) cin>>arr[i];
    long long int dp[n];
    dp[n-1]=0;
    dp[n-2]=abs(arr[n-1]-arr[n-2]);
    for(int i=n-3;i>=0;i--){
        dp[i]=min(dp[i+1]+abs(arr[i+1]-arr[i]),dp[i+2]+abs(arr[i+2]-arr[i]));
    }
    cout<<dp[0]<<endl;
}

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

using namespace std;

typedef long long ll;
#define sint(a) scanf("%d",&a)
#define sint2(a,b) scanf("%d %d",&a,&b)
#define sll(a) scanf("%lld",&a)
#define sll2(a,b) scanf("%lld %lld",&a,&b)
#define mem(a,i) memset(a,i,sizeof(a))
const double pi=acos(-1);
const int maxn=1e5;
int flag,n;
void dfs(int k,int s)
{
    if(flag)
        return ;
    if((n-s)%k==0)
    {
        flag=1;
        return;
    }
    if(k==105)
        return ;
    for(int i=0;i*k+s<=n;i++)
        dfs(k+1,s+i*k);
}
int main()
{
    while(cin>>n)
    {flag=0;
        dfs(100,0);

        cout<<flag<<endl;
    }
    return 0;
}


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

int main() {
    int n; cin >> n;
    vector<int> v;
    for (int i = 0; i < n; i++) {
        int x; cin >> x;
        v.push_back(x);
    }
    sort(v.begin(), v.end());
    float current = v[0];
    for (int i = 1; i < n; i++) {
        current = (current + v[i]) / 2;
    }
    cout << current << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<queue>
#include<map>
using namespace std;
char s[200005];
char t[200005];
int a[30];
int main()
{
    scanf("%s",s);
    scanf("%s",t);
    int len=strlen(s);
    for(int i=0;i<len;i++)
    {
        if(a[t[i]-'a'+1]==0)
        {
            a[t[i]-'a'+1]=s[i]-'a'+1;
        }
        else
        {
            if(a[t[i]-'a'+1]!=s[i]-'a'+1)
            {
                printf("No");
                return 0;
            }
        }
    }
    memset(a,0,sizeof(a));
    for(int i=0;i<len;i++)
    {
        if(a[s[i]-'a'+1]==0)
        {
            a[s[i]-'a'+1]=t[i]-'a'+1;
        }
        else
        {
            if(a[s[i]-'a'+1]!=t[i]-'a'+1)
            {
                printf("No");
                return 0;
            }
        }
    }
    /*int flag1=0,flag2=1;
    for(int i=1;i<=26;i++)
    {
        if(a[i]!=i)flag1=1;
        if(a[i]==0)flag2=0;
    }
    if(flag1&&flag2)
    {
        printf("No");
        return 0;
    }*/
    printf("Yes");
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    //cout.precision(10);
    string s, t;
    cin >> s >> t;
    map<char, char> mp;
    char normal = mp['a'];
    for(int i = 0; i < s.size(); i++){
        if(mp[s[i]] == normal){
            mp[s[i]] = t[i];
            continue;
        }
        if(mp[s[i]] != t[i]){
            cout << "No" << endl;
            return 0;
        }
    }
    for(char x = 'a'; x <= 'z'; x++){
        if(mp[x] == normal){
            continue;
        }
        for(char y = x + 1; y <= 'z'; y++){
            if(mp[x] == mp[y]){
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}

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

int main(){
 int X;
 std::cin>>X;
 int u=0;
 while(u*u*u*u<X){
  u++;
 }
 //std::cout<<u<<std::endl;
 int A,B;
 for(long long i=0;i<2*u;i++){
  for(long long j=-u+1;j<=i;j++){
   long long y=i*i*i*i*i-j*j*j*j*j;
   if(y==X){
    A=i;
    B=j;
    break;
   }
  }
 }
 
 std::cout<<A<<" "<<B<<std::endl;
 return 0;
}

Measured memory_bytes: 3636
x = int(input())

list = []
for i in range(-1000, 1001):
    list.append(i ** 5)


def solve():
    for i in range(1, 2001):
        for j in range(i):
            if list[i] - list[j] == x:
                return [i-1000, j-1000]

ans = solve()
print(*ans)

Measured memory_bytes: 65384
import java.util.Scanner;
import java.util.Arrays;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    char[] s = sc.next().toCharArray();
    char[] t = sc.next().toCharArray();
    char[] u = new char[n * 2];
    for(int i = 0; i < n; i++){
      u[2 * i] = s[i];
      u[2 * i + 1] = t[i];
    }
    System.out.println(String.valueOf(u));

  }
}

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

#define rep(i, a, n)  for(int i=a; i<n; i++)
#define per(i, a, n)  for(int i=n-1; i>=a; i--)
#define fill0(n)  setfill('0') << right << setw(n)
#define all(x)  (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define MAX 1000000001;
using namespace std;
typedef long long ll;

ll n,k;
ll h[100100];

int main(){
  std::cin >> n >> k;
  rep(i,1,n+1)std::cin >> h[i];
  sort(h+1, h+n+1);
  ll res = MAX;
  rep(i,1,n-k+2){
    ll tmp = h[i+k-1] - h[i];
    res = min(res, tmp);
  }
  std::cout << res << '\n';
}


Measured memory_bytes: 1024
#include <cstdio>
#include <algorithm>
int n,l[103],ans;
int main(){
    scanf("%d",&n);for(int i=1;i<=n;i++) scanf("%d",&l[i]);std::sort(l+1,l+1+n);
    for(int i=1;i<=n;i++){
        for(int j=i+1;j<=n;j++){
            for(int k=j+1;k<=n;k++){
                if(l[i]+l[j]>l[k]&&l[j]-l[i]<l[k]&&l[i]!=l[j]&&l[j]!=l[k]&&l[i]!=l[k]) ++ans;
            }
        }
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 1732
N = int(input())
l = list(input())
from collections import deque
r = deque()
g = []
b = deque()
for i in range(N):
    if l[i] == "R":
        r.append(i)
    elif l[i] == "G":
        g.append(i)
    else:
        b.append(i)
from collections import defaultdict
d = defaultdict(int)
for i in range(len(b)):
    d[b[i]] = 1
ans = 0
na = len(b)
while r:
    rr = r.pop()
    for i in range(len(g)):
        gg = g[i]
        ans += na - d[(rr+gg) / 2] - d[min(rr,gg)-abs(gg-rr)] - d[max(rr,gg)+abs(gg-rr)]
print(ans)

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

const int N = 110;
int out[N];
int n, m, x, y;

int main(){
	while(~scanf("%d %d", &n, &m)){
		memset(out, 0, sizeof(out));
		while(m--){
			scanf("%d %d", &x, &y);
			out[x]++;
			out[y]++;
		}
		for(int i=1; i<=n; i++){
			printf("%d\n", out[i]);
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

int n;
double x[50],y[50];

double dist(double s, double t) {
  double ans = 0;
  rep(i,n){
    ans = max(ans,sqrt((s-x[i])*(s-x[i])+(t-y[i])*(t-y[i])));
  }
  return ans;
}

int main() {
  cin >> n;
  rep(i,n){
    cin >> x[i] >> y[i];
  }

  auto f = [](double xi){
    double yl = 0,yr = 1000;
    rep(i,100) {
      double cl = (yl*2+yr)/3, cr = (yl+yr*2)/3;
      if (dist(xi,cl) > dist(xi,cr)) {
        yl = cl;
      } else {
        yr = cr;
      }
    }
    return dist(xi,yl);
  };
  double xl = 0,xr = 1000;
  rep(i,100) {
    double cl = (xl*2+xr)/3, cr = (xl+xr*2)/3;
    if (f(cl) > f(cr)) {
      xl = cl;
    } else {
      xr = cr;
    }
  }
  printf("%.10f\n",f(xl));
}


Measured memory_bytes: 888
#city savers
n=int(input())
ans=0
a=list(map(int,input().split()))
b=list(map(int,input().split()))
for i in range(n):
    if a[i]>=b[i]:
        ans+=b[i]
        a[i]-=b[i]
    else:
        #a[i]<b[i]の時
        ans+=a[i]
        b[i]=b[i]-a[i]
        a[i]=0
        if a[i+1]>=b[i]:
            ans+=b[i]
            a[i+1]=a[i+1]-b[i]
 
        else:
            #a[i+1]<b[i]の時
            ans+=a[i+1]
            a[i+1]=0

print(ans)

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

// method I : odd + odd = even
// method II : even + even = even

using namespace std;

int main()
{
    int n, m;
    scanf("%d %d", &n, &m);

    long long p1 = 1, p2 = 1;
    for(int i = n ; i > n - 2 ; i--)
    {
        p1 *= i;
    }
    p1 /= 2;

    for(int i = m ; i > m - 2 ; i--)
    {
        p2 *= i;
    }
    p2 /= 2;

    printf("%lld\n", p1 + p2);
    return 0;
}


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

int main(){
  int a, b, c, k;
  cin >> a >> b >> c >> k;
  int sum = a + b + c;
  int m = max(a, max(b, c));
  sum = sum - m + m*pow(2, k);
  cout << sum;
  return 0;
}

Measured memory_bytes: 512
package main

import (
	"fmt"
	"math"
)

func main() {
	n := SingleInt()

	chs := make([][]int, n)

	for i := 0; i < n; i++ {
		chs[i] = make([]int, 3)
		for j := 0; j < 3; j++ {
			chs[i][j] = SingleInt()
		}
	}

	dp := make([][]int, n+1)
	dp[0] = make([]int, 3)
	for i := 0; i < n; i++ {
		dp[i+1] = make([]int, 3)
		for j := 0; j < 3; j++ {
			for k := 0; k < 3; k++ {
				if j != k {
					dp[i+1][k] = Max(dp[i][j]+chs[i][k], dp[i+1][k])
				}
			}
		}
	}

	var res int
	for i := 0; i < 3; i++ {
		res = Max(res, dp[n][i])
	}
	fmt.Printf("%#v\n", res)
}

func SingleInt() int {
	var n int
	fmt.Scan(&n)
	return n
}

func Max(nums ...int) int {
	if len(nums) == 0 {
		panic("function max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}


Measured memory_bytes: 12672
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

	static BufferedReader in;
	static PrintWriter out;
	static StringTokenizer tok;

	void solve() throws IOException {
		int n = ni();
		out.println((n%2==0)?n:2*n);
	}

	String ns() throws IOException {
		while (!tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine(), " ");
		}
		return tok.nextToken();
	}

	int ni() throws IOException {
		return Integer.parseInt(ns());
	}

	long nl() throws IOException {
		return Long.parseLong(ns());
	}

	double nd() throws IOException {
		return Double.parseDouble(ns());
	}

	String[] nsa(int n) throws IOException {
		String[] res = new String[n];
		for (int i = 0; i < n; i++) {
			res[i] = ns();
		}
		return res;
	}

	int[] nia(int n) throws IOException {
		int[] res = new int[n];
		for (int i = 0; i < n; i++) {
			res[i] = ni();
		}
		return res;
	}

	long[] nla(int n) throws IOException {
		long[] res = new long[n];
		for (int i = 0; i < n; i++) {
			res[i] = nl();
		}
		return res;
	}

	public static void main(String[] args) throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		tok = new StringTokenizer("");
		Main main = new Main();
		main.solve();
		out.close();
	}
}

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

#define rep(i,n) for(ll i = 0; i < n; i++)
#define per(i,n) for(ll i = n-1; i >= 0; i--)
#define REP(i,n) for(ll i = 1; i < n; i++)
#define PER(i,n) for(ll i = n; i >= 1; i--)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
using vb = vector<bool>;
using vc = vector<char>;
using vcc = vector<vc>;
using vP = vector<P>;
using vPP = vector<vP>;
using vPl = vector<Pl>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }



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

  int n, t;
  cin >> n >> t;
  vi v(n);
  rep(i,n) cin >> v[i];
  ll ans = 0;
  REP(i,n) {
    ans += min(v[i]-v[i-1], t);
  }
  ans += t;
  cout << ans << endl;
}

Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = (ll)1e9;
const ll mod = (ll)1e9 + 7;

int main()
{
	string s;
	while (cin >> s)
	{
		string ans = "";
		for (int i = 0; i < s.length(); i++)
		{
			if (s.at(i) == 'o' || s.at(i) == 'x')
			{
				switch (i)
				{
					case 0:
						if ((s.at(0) == s.at(1) && s.at(0) == s.at(2))
							|| (s.at(0) == s.at(3) && s.at(0) == s.at(6))
							|| (s.at(0) == s.at(4) && s.at(0) == s.at(8)))
						{
							ans = s.substr(0, 1);
						}
						break;
					case 1:
						if ((s.at(1) == s.at(4) && s.at(1) == s.at(7)))
						{
							ans = s.substr(1, 1);
						}
						break;
					case 2:
						if ((s.at(2) == s.at(5) && s.at(2) == s.at(8))
							|| (s.at(2) == s.at(4) && s.at(2) == s.at(6)))
						{
							ans = s.substr(2, 1);
						}
						break;
					case 3:
						if ((s.at(3) == s.at(4) && s.at(3) == s.at(5)))
						{
							ans = s.substr(3, 1);
						}
						break;
					case 6:
						if ((s.at(6) == s.at(7) && s.at(6) == s.at(8)))
						{
							ans = s.substr(6, 1);
						}
					break;
				}
			}

			if (ans != "")
			{
				cout << ans << endl;
				break;
			}
		}

		if (ans == "")
		{
			cout << "d" << endl;
		}
	}
}


Measured memory_bytes: 3148
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
using namespace std;
namespace adaptor = boost::adaptors;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define cy cout << "Yes" << endl
#define cn cout << "No" << endl
typedef long long ll;

bool divide(ll N, ll n){
	if (N%n == 0){return true;}
  	else{return false;}
}

void Main()
{
	ll N;
  	cin >> N;
	ll RN = floor(sqrt(N));
  
  	auto keta = [&](ll N){
  		ll ans=0;
      	while(N){
          	N /= 10;
          	ans++;
        }
      	return ans;
    };
  
  	ll ans = N;
	rep3rev(i,RN,1){
  		if(divide(N,i)){ 
          	ans = N/i;
        	cout << keta(ans) << endl;
          	return;
        }
    }
	return;
}

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, N) for (int i = 0; i < (int)N; ++i)
#define all(a) (a).begin(), (a).end()
class DAG {
 public:
  vector<int> topologicalSorted;
  bool valid;

  DAG(const vector<vector<int>>& G) {
    int V = G.size();
    vector<int> inDegree(G.size(), 0);
    for (int u = 0; u < V; u++) {
      for (auto v : G[u]) inDegree[v]++;
    }
    stack<int> s;
    for (int u = 0; u < V; u++)
      if (inDegree[u] == 0) s.push(u);

    while (!s.empty()) {
      int u = s.top();
      s.pop();
      topologicalSorted.push_back(u);
      for (auto& v : G[u]) {
        inDegree[v]--;
        if (inDegree[v] == 0) s.push(v);
      }
    }

    valid = static_cast<int>(topologicalSorted.size()) == V;
  }
};

int N, M;

int main() {
  cin >> N >> M;
  vector<vector<int>> G(N);
  rep(i, M) {
    int x, y;
    cin >> x >> y;
    --x, --y;
    G[x].push_back(y);
  }

  DAG dag(G);

  vector<int> dp(N, 0);
  for (int u : dag.topologicalSorted) {
    for (int v : G[u]) {
      dp[v] = max(dp[v], dp[u] + 1);
    }
  }

  cout << *max_element(all(dp)) << endl;

  return 0;
}


Measured memory_bytes: 6780
#pragma gcc optimize("Ofast")

#include "bits/stdc++.h"
using namespace std;
typedef int64_t lld;
typedef pair<int,int> pii;
typedef pair<lld,lld> pll;
typedef pair<int,pll> pip;
typedef pair<pll,int> ppi;
typedef pair<lld,pll> plp;
typedef pair<pll,lld> ppl;
typedef pair<pll,pll> ppp;
template<typename T>
using maxHeap = priority_queue<T,vector<T>,less<T>>;
template<typename T>
using minHeap = priority_queue<T,vector<T>,greater<T>>;
#define ff first
#define ss second
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define endl '\n'
#define jizz cin.tie(0);cout.tie(0);ios::sync_with_stdio(0);
inline void input(int &_x) {
    _x = 0;
    int _tmp = 1; char _tc = getchar();
    while((_tc < '0' || _tc > '9') && _tc != '-') _tc = getchar();
    if(_tc == '-') _tc = getchar(), _tmp = -1;
    while(_tc >= '0' && _tc <= '9') _x = _x*10+(_tc-48), _tc = getchar();
    _x *= _tmp;
}
inline void output(int _x) {
    char _buff[20]; int _f = 0;
    if(_x == 0)putchar('0');
    while(_x > 0)
    {
        _buff[_f++] = _x%10+'0';
        _x /= 10;
    }
    for(_f-=1; _f >= 0; _f--)
        putchar(_buff[_f]);
    putchar('\n');
}
template<typename Iter>
ostream& _out(ostream &s, Iter b, Iter e) {
    s<<"[";
    for ( auto it=b; it!=e; it++ ) s<<(it==b?"":" ")<<*it;
    s<<"]";
    return s;
}
template<class T1,class T2>
ostream& operator<<(ostream& out, pair<T1,T2> p) {
    return out << '(' << p.first << ", " << p.second << ')';
}
template<typename T>
ostream& operator <<( ostream &s, const vector<T> &c ) {
     return _out(s,c.begin(),c.end());
 }
#ifdef erd1
    #define pprint(x) cerr<<__PRETTY_FUNCTION__<<":"<<__LINE__<<" - "<<(#x)<<"="<<(x)<<endl
#else
    #define pprint(x)
#endif
#define int long long
const int mod = 1000000007;
int invmod(int x,int mod, int s0 = 1, int s1 = 0){
    return mod?invmod(mod,x%mod,s1,s0-s1*(x/mod)):s0;
}
// code starts here
vector<int> v,dp, tmp;
signed main(){
    int n, x, mx;
    cin >> n >> x;mx = x;
    for(int i = 0; i < n; i++){
        int a;cin >> a;v.pb(a);mx = max(mx, a);
    }
    dp.resize(mx+1), tmp.resize(mx+1);
    dp[x] = 1;
    sort(all(v));
    reverse(all(v));

    for(int i = 0; i < n; i++){
        int dv = (invmod(n-i-1, mod)+mod)%mod;
        for(int j = 0; j <= mx; j++){
            if(dp[j])tmp[j%v[i]]=(tmp[j%v[i]]+dp[j]*dv%mod)%mod;
        }
        for(int j = 0; j <= mx; j++){
            dp[j] = (dp[j] + tmp[j])%mod;
            tmp[j] = 0;
        }
    }
    lld ans = 0;
    for(int j = 0; j <= mx; j++){
        ans = (ans + j%v[n-1]*dp[j]%mod)%mod;
    }
    for(int i = 1;i < n; i++){
        ans = ans * i % mod;
    }
    cout << ans << endl;
}


Measured memory_bytes: 1792
n,x=gets.split.map &:to_i
if x==1||x==n*2-1
  puts "No"
else
  puts "Yes"
  if x==n
    (1..n*2-1).each{|e|puts e}
  elsif x<n
    (x+1..n).reverse_each{|e|puts e}
    (1...x).reverse_each{|e|puts e}
    puts x
    (n+1..n*2-1).reverse_each{|e|puts e}
  else # x>n
    (1..n-1).reverse_each{|e|puts e}
    puts x
    (x+1..n*2-1).reverse_each{|e|puts e}
    (n...x).reverse_each{|e|puts e}
  end
end

Measured memory_bytes: 4732
#include<iostream>
using namespace std;
int main()
{
	char a;
	int b;
	cin>>a;
	b=a;
	if(b==97||b==101||b==105||b==111||b==117)
	{
		cout<<"vowel"<<endl;
	}
	else cout<<"consonant"<<endl;
	return 0;
} 

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ITP1_7_D
{
    public class Program

    {
        public static void Main(string[] args)
        {
            int[] line = ReadIntAr();
            int[,] matA = new int[line[0], line[1]];
            int[,] matB = new int[line[1], line[2]];
            long[,] rlt = new long[line[0], line[2]];

            for (int i = 0 ; i < line[0] ; i++)
            {
                int[] tmp = ReadIntAr();
                for (int j = 0 ; j < line[1] ; j++)
                {
                    matA[i, j] = tmp[j];
                }
            }

            for (int i = 0 ; i < line[1] ; i++)
            {
                int[] tmp = ReadIntAr();
                for (int j = 0 ; j < line[2] ; j++)
                {
                    matB[i, j] = tmp[j];
                }
            }

            for (int i = 0 ; i < line[0] ; i++)
            {
                for (int j = 0 ; j < line[2] ; j++)
                {
                    for (int k = 0 ; k < line[1] ; k++)
                    {
                        rlt[i, j] += matA[i, k] * matB[k, j];
                    }
                }
            }

            for (int i = 0 ; i < line[0] ; i++)
            {
                for (int j = 0 ; j < line[2] ; j++)
                {
                    Console.Write(rlt[i, j]);
                    if (j == line[2] - 1) Console.Write(Environment.NewLine);
                    else Console.Write(" ");
                }
            }
        }

        static string ReadSt() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Console.ReadLine()); }
        static long ReadLong() { return long.Parse(Console.ReadLine()); }
        static double ReadDouble() { return double.Parse(Console.ReadLine()); }
        static string[] ReadStAr(char sep = ' ') { return Console.ReadLine().Split(sep); }
        static int[] ReadIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => int.Parse(e)); }
        static long[] ReadLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => long.Parse(e)); }
        static double[] ReadDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => double.Parse(e)); }

    }

}



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

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        char[] inputS = br.readLine().toCharArray();
        char[] inputT = br.readLine().toCharArray();

        int m = inputS.length;
        int n = inputT.length;
        int dp[][] = new int[m + 1][n + 1];
        for (int i = 0; i <= n; i++) dp[0][i] = 0;
        for (int j = 0; j <= m; j++) dp[j][0] = 0;
        for (int i = 1; i <= m; i++) {
            for (int j = 1; j <= n; j++) {
                if (inputS[i - 1] == inputT[j - 1]) {
                    dp[i][j] = dp[i - 1][j - 1] + 1;
                }
                else {
                    dp[i][j] = Math.max(dp[i - 1][j], dp[i][j - 1]);
                }
            }
        }
        StringBuilder sb = new StringBuilder();
        while(m > 0 &&  n > 0) {
            if (inputS[m - 1] == inputT[n - 1]){
                sb.append(inputS[m - 1]);
                m--;n--;
            }
            else if (dp[m][n - 1] > dp[m - 1][n]) n--;
            else m--;
        }
        System.out.println(sb.reverse());
    }
}


Measured memory_bytes: 88020
N,K=map(int,input().split())
A=list(map(int,input().split()))
A.sort(reverse=True)
mod=10**9+7
P=1
if N==K:
  for i in range(N):
    P=P*A[i]%mod
  print(P)
  exit()
B=[]
C=False
for i in range(N):
  if A[i]:
    B.append(A[i])
  else:
    C=True
if len(B)<K:
  print(0)
  exit()
B.sort(reverse=True,key=lambda x:abs(x))
Y=0
for i in range(K):
  if B[i]<0:
    Y+=1
  P=P*B[i]%mod
if Y&1==0:
  print(P)
  exit()
if Y==K:
  B.sort()
  if B[-1]<0:
    if C:
      print(0)
      exit()
    P=1
    for i in range(K):
      P=P*B[-(i+1)]%mod
    print(P)
    exit()
  for i in range(K-1,-1,-1):
    if B[0]<0:
      P=P*pow(B[i],mod-2,mod)*B[-1]%mod
      break
  print(P)
  exit()
Y,Z=0,0
for i in range(K,len(B)):
  if B[i]<0:
    Y=B[i]
    break
for i in range(K,len(B)):
  if B[i]>0:
    Z=B[i]
    break
if Y==Z==0:
  if C:
    print(0)
  else:
    print(P)
  exit()
if Y==0:
  for i in range(K-1,-1,-1):
    if B[i]<0:
      P=P*pow(B[i],mod-2,mod)
      break
    if i==0:
      if C:
        print(0)
      else:
        print(P)
      exit()
  print(P*Z%mod)
elif Z==0:
  for i in range(K-1,-1,-1):
    if B[i]>0:
      P=P*pow(B[i],mod-2,mod)
      break
    if i==0:
      if C:
        print(0)
      else:
        print(P)
      exit()
  print(P*Y%mod)
if Y==0 or Z==0:
  exit()
V,W=0,0
for i in range(K-1,-1,-1):
  if B[i]<0:
    V=B[i]
    break
for i in range(K-1,-1,-1):
  if B[i]>0:
    W=B[i]
    break
if Y*V>Z*W:
  print(P*Y*pow(W,mod-2,mod)%mod)
else:
  print(P*Z*pow(V,mod-2,mod)%mod)


Measured memory_bytes: 110328
let () =
  let max_seats (x, y, z) =
    int_of_float @@ (float_of_int (x - z)) /. (float_of_int (y + z))
  and input = Scanf.scanf "%d %d %d" (fun x y z -> (x, y, z))
  and println str = print_string (str ^ "\n")
  in
    println @@ string_of_int @@ max_seats input;;


Measured memory_bytes: 384
#include<bits/stdc++.h> 
#define ll long long
#define pb push_back
#define mp make_pair
using namespace std;
ll n;
ll dp[100005][3]={0};
ll happy(ll a[][3],ll prev,ll index)
{
	if(index<0)
	{
		return 0;
	}
	if(dp[index][prev]!=0)
	return dp[index][prev];
	if(prev==-1)
	{
		ll ans=0;
		for(ll i=0;i<3;i++)
		{
			ans=max(ans,a[index][i]+happy(a,i,index-1));
		}
		return ans;
	}
	if(prev==0)
	{
		ll ans1=0,ans2=0;
		ans1=a[index][1]+happy(a,1,index-1);
		ans2=a[index][2]+happy(a,2,index-1);
		dp[index][prev]=max(ans1,ans2);
	}
	else if(prev==1)
	{
		ll ans1=0,ans2=0;
		ans1=a[index][0]+happy(a,0,index-1);
		ans2=a[index][2]+happy(a,2,index-1);
		dp[index][prev]=max(ans1,ans2);
	}
	else if(prev==2)
	{
		ll ans1=0,ans2=0;
		ans1=a[index][1]+happy(a,1,index-1);
		ans2=a[index][0]+happy(a,0,index-1);
		dp[index][prev]=max(ans1,ans2);
	}
	return dp[index][prev];
}
ll gcd(ll a,ll b) 
{ 
	if (a == 0) 
		return b; 
	return gcd(b % a, a); 
} 
bool isprime(ll n)
{
    for(ll i=2;i<=sqrt(n);i++)
    {
        if(n%i==0)
            return false;
    }
    return true;
}
int main()
{
	cin>>n;
	ll a[n][3],i,j;
	for(i=0;i<n;i++)
	{
		for(j=0;j<3;j++)
		{
			cin>>a[i][j];
			dp[i][j]=0;
		}
	}
	ll ans=happy(a,-1,n-1);
	cout<<ans;
	return 0;
}

Measured memory_bytes: 11136
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace __gnu_pbds; 
using namespace std;
using   ll=long long;
using   ld=long double;

#define fast        	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ordered_set 	tree<pll, null_type,less<pll>, rb_tree_tag,tree_order_statistics_node_update>

#define endl        	"\n"
#define pb          	push_back
#define mp          	make_pair
#define F           	first
#define S           	second
#define int             long long int

#define ALL(v)      	v.begin(),v.end()
#define ALLR(v)     	v.rbegin(),v.rend()
#define pii         	3.14159265358979323
#define inf     		LLONG_MAX
#define ones(x)     	__builtin_popcount(x)
#define fill(a,b)   	memset(a,b,sizeof(a))
#define mod 			998244353

ll mod_pow(ll a,ll b) 
{
    ll res = 1;
    while(b)	
    {
        if(b&1) 	
        {
        	res=(res*a)%mod;
        }
        a=(a*a)%mod;
        b>>=1;
    }
    return res;
}

ll mod_inverse(ll a) 
{
	return mod_pow(a , mod-2);
}

void solve()
{
	int a[5];
	
	for(int i = 0; i < 5; ++i) {
		cin >> a[i];
		
		if(a[i] == 0) {
			cout << i+1;
			return;
		}
	}
}

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


Measured memory_bytes: 3548
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;


int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t;
    cin>>t;
    t%=10;
    if(t==3) cout<<"bon"<<endl;
    else if(t==0 || t==8 || t==6 || t==1) cout<<"pon\n";
    else cout<<"hon\n";
	return 0;
}


Measured memory_bytes: 3640
n=int(input())
arr=[0]*n
for i in range(n):
    s,p=input().split(' ')
    p=int(p)
    arr[i]=[i+1,s,p]
arr.sort(key=lambda x:x[1])

res=[]
index=0
arr.append([1000000,'na',111])
for i in range(1,n+1):
    if arr[i][1]!=arr[i-1][1]:
        tmp=arr[index:i]
        tmp.sort(key=lambda x:x[2],reverse=True)
        #print(tmp)
        res.extend(tmp)
        index=i

for i in range(n):
    print(res[i][0])    

Measured memory_bytes: 3064
use std::str::FromStr;

fn get_one<T : FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().parse().ok().unwrap();
}

fn get_vec<T : FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect();
}

fn main() {
    let x : i32 = get_one();
    let mut ans = 1;
    let v = [2,4,8,16,32,64];
    for p in v.iter() {
        if x < *p {
            break;
        }
        ans = *p;
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define ll 				long long
#define ld 				long double
#define fastio 			ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define debug(x) 		cerr<<#x<<" "<<x<<endl
#define cina(a,n) 		for(ll i = 0;i<n;i++)	cin>>a[i];
#define couta(a,n) 		for(ll i = 0;i<n;i++) cout<<a[i]<<" ";
#define fauto(ar)		for(auto x : ar)	cout<<x<<" ";
#define mod 			1000000007
#define inf				10010010010010010
#define siz 			100005
#define f 				first
#define s 				second
#define pb 				push_back
#define endl 			"\n"
#define ci 				cin.ignore()
using namespace std;
int main()
{
	ll n,k,i,j,p,flag;
	cin>>n>>k;
	ll a[n+1];
	for(i = 1;i<=n;i++)	cin>>a[i];
	
	ll dp[2][k+1];
	
	for(i = 0;i<=1;i++)
		for(j = 0;j<=k;j++)
			dp[i][j] = 0;
	
//	for(i = 0;i<=k;i++)
//	dp[0][i] = 1;
	
	ll sum[k+1];
	flag = 1;
	for(i = 1;i<=n;i++)
	{
		sum[0] = 1;
		for(j = 1;j<=k;j++)
		sum[j] = sum[j-1] + dp[flag^1][j],
		sum[j] %= mod;
		dp[flag][0] = 1;
		for(j = 1;j<=k;j++)
		{
			ll left = 0;
			if(j-a[i]-1 >= 0)
			left = sum[j-a[i]-1];
			
			ll right = sum[j];
			
			dp[flag][j] = right-left;
			dp[flag][j] %= mod;
			dp[flag][j] += mod;
			dp[flag][j] %= mod;
		}	
		flag ^= 1;
	}
	
	cout<<dp[flag^1][k];
	
	
}

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

void bubbleSort(V A, int n){
    int flag = 1;
    int ans = 0;
    for(int i = 0; flag; i++) {
        flag = 0;
        for(int j = n-1; j >= i+1; j--){
            if(A[j] < A[j-1]){
                swap(A[j], A[j-1]);
                flag = 1;
                ans++;
            }
        }
    }
    rep(i, 0, n){
        if(i) cout << " ";
        cout << A[i];
    }
    cout << endl << ans << endl;
}

int main() {

    int n; cin >> n;
    V A(n);
    rep(i,0,n) cin >> A[i];
    
    bubbleSort(A, n);

}



Measured memory_bytes: 3160
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <unordered_map>

using namespace std;

typedef long long ll;

const int sz = 2e5 + 5;

int n;
pair<int, int> a[sz];
ll b[2][sz];

void solve() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i].first >> a[i].second;
		b[0][i] = a[i].first + a[i].second;
		b[1][i] = a[i].first - a[i].second;
	}
	ll ans = 0;
	sort(b[0], b[0] + n);
	sort(b[1], b[1] + n);
	ans = max(ans, b[0][n - 1] - b[0][0]);
	ans = max(ans, b[1][n - 1] - b[1][0]);
	cout << ans;
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
#if defined(_DEBUG)
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int q = 1;
	//cin >> q;
	for (; q > 0; q--) {
		solve();
		//cout << endl;
	}
}

Measured memory_bytes: 8376
#ifdef MY_LOCAL
#define MY_NAMESPACE(ns) namespace ns {
#define MY_NAMESPACE_    }
#define MY_DEBUG(s)      s
#else
#define MY_NAMESPACE(ns) 
#define MY_NAMESPACE_    
#define MY_DEBUG(s)      
#endif

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <tuple>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define EPS (1e-7)
#define IINF ((int)1e9)


MY_NAMESPACE(testbed)
bool ABC167F_order(pll const& lhs, pll const& rhs)
{
	// first:  open
	// second: close

	int lhs_sign = 0;
	if (lhs.first > lhs.second)
		lhs_sign = 1;  // more open
	else if (lhs.first < lhs.second)
		lhs_sign = -1;  // more close

	int rhs_sign = 0;
	if (rhs.first > rhs.second)
		rhs_sign = 1;
	else if (rhs.first < rhs.second)
		rhs_sign = -1;

	if (lhs_sign != rhs_sign)
		return lhs_sign > rhs_sign;

	if (lhs_sign > 0)
		return lhs.second < rhs.second;  // use the smallest close at the first (because the restriction is toughest at the first)
	else
		return lhs.first > rhs.first;  // leave the smallest open for the last (because the restriction is toughest at the last)
}

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

	int n;
	cin >> n;
	vector<pll> num_live_open_and_close(n);
	for (int i = 0; i < n; i++)
	{
		string s;
		cin >> s;
		for (auto it = s.begin(); it != s.end(); it++)
		{
			if (*it == '(')
			{
				num_live_open_and_close[i].first++;
			}
			else  // *it==')'
			{
				if (num_live_open_and_close[i].first > 0)
					num_live_open_and_close[i].first--;
				else
					num_live_open_and_close[i].second++;
			}
		}
	}

	sort(num_live_open_and_close.begin(), num_live_open_and_close.end(), ABC167F_order);

	ll level = 0;
	for (auto it = num_live_open_and_close.begin(); it != num_live_open_and_close.end(); it++)
	{
		level -= it->second;
		if (level < 0)
		{
			cout << "No" << "\n";
			return 0;
		}
		level += it->first;
	}
	if (level == 0)
		cout << "Yes" << "\n";
	else
		cout << "No" << "\n";
	return 0;
}
MY_NAMESPACE_

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

int main(void) {
    int n, count=0;
    cin >> n;
    vector<int> l(n);
    for (int i=0; i<n; i++) {
        cin >> l.at(i);
    }
    sort(l.begin(), l.end());
    for (int i=0; i<n-2; i++) {
        for (int j=i+1; j<n-1; j++) {
            for (int k=j+1; k<n; k++) {
                if (l.at(k) >= l.at(i) + l.at(j)) {
                    break;
                }
                count++;
            }
        }
    }
    cout << count << endl;
}

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


const ll mod = 998244353;

struct mint{
  ll v;
  mint(ll a=0):v((a%mod+mod)%mod){}
  mint operator-() const {
    return mint(-v);
  }
  mint& operator+=(const mint a){
    if ((v += a.v) >= mod) v -= mod;
    return *this;
  }
  mint& operator-=(const mint a){
    if ((v += mod - a.v) >= mod) v -= mod;
    return *this;
  }
  mint& operator*=(const mint a){
    (v *= a.v) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  // v^t
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if(t&1) a *= *this;
    return a;
  }

  // for prime mod
  // Fermat's little theorem : a^(p-1) = 1 (mod p) when p is prime and a = 1 (mod p)
  mint inv() const {
    return pow(mod - 2);
  }
  mint& operator/=(const mint a){
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }

  // k < 10^6, n < 10^9
  static mint comb(ll n, ll k){
    mint num(1), den(1);
    for(int i=0; i<k; i++){
      num *= mint(n-i);
      den *= mint(i+1);
    }
    return num / den;
  }
};

// for cout <<
ostream& operator<<(ostream& stream, const mint a){
  stream << a.v;
  return stream;
}
int main() {
  ll n, m, k;
  cin >> n >> m >> k;
  mint ans(0), mm(m), m1(m-1);
  mint comb = mint::comb(n-1, k);
  mint powk = mint(m-1).pow(n-k-1);
  for (ll i = k; i >= 0; i--) {
    // ans += mint(m) * mint::comb(n-1, i) * mint(m-1).pow(n-i-1);
    ans += mm * comb * powk;
    powk *= m1;
    comb *= i;
    comb /= (n-i);
  }

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

Measured memory_bytes: 3632
#include <iostream>
using namespace std;
int pd(int a,int b)
{
	if ((b%10)*(b/10)==a&&(b%10)>=2&&(b/10)>=2)  return true;
	else return false;
}
int main()
{
	int m,n,total=0;
	cin>>m>>n;
	for (int i=1;i<=m;i++)
	{
		for (int j=1;j<=n;j++)
		{
			if (pd(i,j)) total++;
		}
	}
	cout<<total<<endl;
	return 0;
}

Measured memory_bytes: 256