akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin >> s;
    vector<char> v;
    for(int i = 0;i < s.size();i++)
    {
        v.push_back(s[i]);
    }
    v.pop_back();
    v.pop_back();
    bool flag = true;
    while(true)
    {
        flag = true;
        for(int i = 0;i < v.size() / 2;i++)
        {
            if(v.at(i) != v.at(i + v.size() / 2))
            {
                v.pop_back();
                v.pop_back();
                flag = false;
                break;
            }
        }
        if(flag)
        {
            for(int i = 0;i < v.size();i++)
            {
                cout << v.size();
                return 0;
            }
        }
    }

    return 0;
}

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

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

    vector <long long> A;

    long long a;
    long long sum;
    for(long long i = 0; i < n; i++){
        cin >> a;
        sum += a;
        A.push_back(a);
    }
    
     vector <long long> S(n+1, 0);

    for(long long i = 0; i < n; i++){
        S[i+1] = S[i] + A[i];
    }

    long long minv = abs(S[1]-(sum - S[1]));

    for(long long i = 0; i < n; i++){
        if(i == n-1){
            continue;
        }
        long long delta = abs(S[i+1]-(sum - S[i+1]));
        minv = min(minv, delta);
    }

    cout << minv << endl;

    return 0;


}

Measured memory_bytes: 3440
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SHIFT_LEFT(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f),(t)-(f)))
#define ALL(a) (a).begin(),(a).end()
using namespace std;
ll bi[3][3];
bool op[3][3];
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll a,b,c,d,e,n;
  string s,ss,sss;
  for(int i=0;i<3;i++)
    for(int j=0;j<3;j++)
      cin>>bi[i][j];
  cin>>n;
  for(int i=0;i<n;i++){
    ll aa;cin>>aa;
    for(int j=0;j<3;j++)
      for(int k=0;k<3;k++)
	if(aa ==  bi[j][k]){
	  op[j][k] = true;
	}
  }
  bool ans = false;
  for(int i=0;i<3;i++){
    bool tate = true,yoko = true;
    for(int j=0;j<3;j++){
      if(op[i][j] == false)yoko = false;
      if(op[j][i] == false)tate = false;
    }
    if(tate || yoko)ans = true;
  }
  bool nana = true,na2=true;
  for(int i=0;i<3;i++){
    if(op[i][i] == false)nana = false;
    if(op[i][2-i] == false)na2 = false;
  }
  if(nana||na2)ans = true;
  if(ans)
  cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


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

int main() {

    int N, L;
    cin >> N >> L;
    if (L >= 0) {
        cout << (N - 1)*(L + 1 + L + N - 1) / 2;
        return 0;
    }
    if (L < 0 && ((L + N - 1) <= 0)) {
        cout << (N - 1)*(L + L + N - 2) / 2;
    }
    else {
        cout << (N)*(L + L + N - 1) / 2;


    }
}



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

const int MAX_N=1e5;

int N,A[MAX_N];

int main(){
	cin>>N;
	REP(i,N){
		cin>>A[i];
	}
	int ans=0;
	for(int i=0;i<N;){
		ans++;
		bool f=false;
		int p=A[i++];
		while(i<N && A[i]==p) i++;
		if (i==N)
			break;
		if(A[i]>p){
			f=true;
		}
		p=A[i];
		while(i<N && ((f && A[i]>=p) || (!f && A[i]<=p))) p=A[i++];
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using lint     = long long;
const lint inf = 1LL << 60;
const lint mod = 1000000007;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    lint x;
    cin >> x;
    for (lint i = 1; i < 10000000; ++i) {
        if (x * i % 360 == 0) {
            cout << i << "\n";
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 3648
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <stack>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#include <sstream>
#include <iomanip>
using namespace std;


#define int int64_t
#define vi vector<int>
#define vb vector<bool>
#define vbb vector< vector<bool> >
#define all(x) (x).begin(), (x).end()
#define vii vector< vector<int> >
#define rip(dp, n, m) vector< vector<int> > dp(n, vector<int>(m,0))
#define ff first
#define ss second
#define pii pair<int64_t, int64_t>
#define miv map<int, vector<int> >
#define mp make_pair
#define pb push_back
#define prr(x) cout << (#x) <<'	' << (x) << endl
#define pr(x) cout  << (x) << endl
#define f(i,n) for(i=0;i<n;i++)
#define pqb priority_queue<int>
#define pqs priority_queue<int,vi,greater<int> >
#define setbits(x)  __builtin_popcountll(x)
#define zrobits(x)  __builtin_ctzll(x)
#define mod 1000000007
#define inf 1e18
#define ps(x,y) fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x) int x; cin>>x; while(x--)
#define FIO  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int dr8[] = {1,1,0,-1,-1,-1, 0, 1};
int dc8[] = {0,1,1, 1, 0,-1,-1,-1};
int dr4[] = {1,0,0,-1};
int dc4[] = {0,1,-1,0};
int gcd(int a, int b)
{
    if(a%b==0) return b;
    return gcd(b, a%b);
}
void solve();

int32_t main()
{
    FIO;
    int t=1;
    //cin >> t;
for(int i=1;i<=t;i++)
    {
        solve();
    }
}
void solve()
{
    int i, n, j, m, k, l, t;

    cin >> n;
    if(n) cout << 0;
    else cout << 1;
}

Measured memory_bytes: 3652
import sys
from sys import exit
from collections import deque
from bisect import bisect_left, bisect_right, insort_left, insort_right
from heapq import heapify, heappop, heappush
from itertools import product, permutations, combinations, combinations_with_replacement
from functools import reduce
from math import gcd, sin, cos, tan, asin, acos, atan, degrees, radians

sys.setrecursionlimit(10**6)
INF = 10**20
eps = 1.0e-20
MOD = 10**9+7

def lcm(x,y):
    return x*y//gcd(x,y)
def lgcd(l):
    return reduce(gcd,l)
def llcm(l):
    return reduce(lcm,l)
def powmod(n,i,mod):
    return pow(n,mod-1+i,mod) if i<0 else pow(n,i,mod)
def div2(x):
    return x.bit_length()
def div10(x):
    return len(str(x))-(x==0)
def intput():
    return int(input())
def mint():
    return map(int,input().split())
def lint():
    return list(map(int,input().split()))
def ilint():
    return int(input()), list(map(int,input().split()))
def judge(x, l=['Yes', 'No']):
    print(l[0] if x else l[1])
def lprint(l, sep='\n'):
    for x in l:
        print(x, end=sep)
def ston(c, c0='a'):
    return ord(c)-ord(c0)
def ntos(x, c0='a'):
    return chr(x+ord(c0))
class counter(dict):
    def __init__(self, *args):
        super().__init__(args)
    def add(self,x,d=1):
        self.setdefault(x,0)
        self[x] += d
    def list(self):
        l = []
        for k in self:
            l.extend([k]*self[k])
        return l
class comb():
    def __init__(self, n, mod=None):
        self.l = [1]
        self.n = n
        self.mod = mod
    def get(self,k):
        l,n,mod = self.l, self.n, self.mod
        k = n-k if k>n//2 else k
        while len(l)<=k:
            i = len(l)
            l.append(l[i-1]*(n+1-i)//i if mod==None else (l[i-1]*(n+1-i)*powmod(i,-1,mod))%mod)
        return l[k]
def pf(x):
    C = counter()
    p = 2
    while x>1:
        k = 0
        while x%p==0:
            x //= p
            k += 1
        if k>0:
            C.add(p,k)
        p = p+2-(p==2) if p*p<x else x
    return C

H,W=mint()
c=[lint() for _ in range(10)]
A=[lint() for _ in range(H)]
cost=[INF]*10
cost[1]=0
h=[(0,1)]
heapify(h)
while h:
    d,i=heappop(h)
    if d>cost[i]:
        continue
    for j in range(10):
        tmp=c[j][i]+d
        if tmp<cost[j]:
            cost[j]=tmp
            heappush(h,(tmp,j))
ans=0
for i,j in product(range(H),range(W)):
    if A[i][j]>=0:
        ans+=cost[A[i][j]]
print(ans)

Measured memory_bytes: 74564
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <math.h>
#include <string>
#include <string.h>
#include <stack>
#include <queue>
#include <vector>
#include <utility>
#include <set>
#include <map>
#include <stdlib.h>
#include <iomanip>

using namespace std;

#define ll long long
#define vi vector<int>
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pi 3.14159265359


ll gcd(ll a, ll b)
{
	ll c;
	while (a != 0) {
		c = a; a = b % a;  b = c;
	}
	return b;
}

int main() {
	ll D, N;
	ll sum = 1;
	cin >>D >> N;
	REP(i, D) {
		sum *= 100;
	}
	if (N == 100) {
		N++;
	}
	cout << sum * N;

	return 0;

}

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

int main(){
    int n,m;
    cin >> n >> m;
    vector<int> cnt(m);
    rep(i,n){
        int k;
        cin >> k;
        rep(j,k){
            int a;
            cin >> a;
            a--;
            cnt[a]++;
        }
    }
    int ans = 0;
    rep(i,m){
        if(cnt[i] == n){
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    int ans = 1;
    for (int i = 2; ; i *= 2) {
        if (i > n) break;
        ans = i;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n = sc.read();
    let mut h: Vec<u64> = sc.vec(n);
    for i in (0..(n - 1)).rev() {
        if h[i] > h[i + 1] {
            h[i] -= 1;
        }
        if h[i] > h[i + 1] {
            println!("No");
            return;
        }
    }
    println!("Yes");
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 4352
use std::io::Read;

fn main() {
    let mut buf = String::new();

    std::io::stdin().read_to_string(&mut buf).unwrap();

    let mut iter = buf.split_whitespace();
    let n: usize = iter.next().unwrap().parse().unwrap();
    let T: usize = iter.next().unwrap().parse().unwrap();
    let mut c = vec![0; n];
    let mut t = vec![0; n];
    for i in 0..n {
        c[i] = iter.next().unwrap().parse().unwrap();
        t[i] = iter.next().unwrap().parse().unwrap();
    }
    let ans = (0..n)
        .filter(|i| t[*i] <= T)
        .map(|i| c[i])
        .min();

    println!("{}", match ans {
        Some(x) => x.to_string(),
        None => "TLE".to_string(),
    });
}


Measured memory_bytes: 4352
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Atc_0030
{
    class Program
    {
        static void Main(string[] args)
        {
            var str = Console.ReadLine();

            Int64 K = Int64.Parse(str.Split(' ')[0]);
            Int64 X = Int64.Parse(str.Split(' ')[1]);

            List<Int64> result = new List<long>();
            result.Add(X);

            if ((-1000000) < (X - (K - 1)))
            {
                for (long i = (X - (K - 1)); i < X; i++)
                {
                    result.Add(i);
                }
            }
            else
            {
                for (long i = (-1000000); i < X; i++)
                {
                    result.Add(i);
                }
            }


            if ((X + (K - 1)) < 1000000)
            {
                for (long i = X + 1; i <= X + K - 1; i++)
                {
                    result.Add(i);
                }
            }
            else
            {
                for (long i = X + 1; i <= 1000000; i++)
                {
                    result.Add(i);
                }
            }

            result.Sort();

            for (int i = 0; i < result.Count(); i++)
            {
                Console.Write(result[i].ToString() + " ");
            }

            Console.WriteLine();
        }
    }
}


Measured memory_bytes: 27924
s = list(input())
n = len(s)-1
def dfs(x,y):
  ans = 0
  if x == n:
    return sum(list(map(int,"".join(y).split("+"))))
  else:
    return dfs(x+1,y+"+"+s[x+1])+dfs(x+1,y+s[x+1])
print(dfs(0,s[0]))

Measured memory_bytes: 38896
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef map<int, int> mi;
typedef set<int> si;
#define VV(T) vector<vector< T > >
#define dump(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl

#define rep(i, n) REP(i, 0, n)                              // 0, 1, ..., n-1
#define REP(i, x, n) for(int i = x; i < n; i++)             // x, x + 1, ..., n-1
#define invrep(i, n) for(int i = (n)-1; i >= 0; i--)        // n-1, n-2, ..., 0
#define invREP(i, x, n) for(int i = (n)-1; i >= (x; i--)    // n-1, n-2, ..., x
#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(v) (v).begin() , (v).end()
#define RALL(v) (v).rbegin(), (v).rend()

#define PB push_back

#define COUT(x) cout << (x) << endl
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECCOUT(x) for(auto&youso_: (x) )cout<<youso_<<" ";cout<<endl

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; }

ll dp[100000];

int main(){
    int N; cin >> N;
    vi h(N);
    rep(i, N) cin >> h[i];
    rep(i, 100000) dp[i] = INF;

    dp[0] = 0;
    
    REP(i, 1, N){
        chmin(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]));
        if(i > 1) chmin(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]));
    }

    COUT(dp[N - 1]);

}

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

using namespace std;

#define pb push_back
#define eb emplace_back
#define ll long long
#define pii pair < int, int >
#define fr first
#define sc second
#define mk make_pair

const int N = (int)1e5 + 7;
const int inf = (int)1e9 + 7;

string f(ll x) {
  string s;
  while (x > 0) {
    s.push_back(char(x % 10 + '0'));
    x /= 10;
  }
  reverse(s.begin(), s.end());
  return s;
}

main() {
  ll n, asd;
  cin >> n;
  asd = n;
  int lg = 0;
  while (asd > 0) {
    asd /= 10;
    if (asd == 0) break;
    lg++;
  }
  int ans = lg * 9;
  string s = f(n);
  ans += (s[0] - '1');
  int res = 0;
  for (int i = 0; i < s.size(); i++) {
    res += (s[i] - '0');
  }
  cout << max(ans, res);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<cmath>
#define N 100005
#define A 1000005
#define MOD 998244353 //1000000007 // //100000000
#define INF 1000000000000000000
#define ll long long
//#define M_PI 3.141592653589793238463

using namespace std;

#define pii pair<ll, ll>
#define piii pair<ll, pii>
#define ft first
#define sd second
#define pb push_back
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n-1; i >= 0; i--)
#define itr(it, x) for(auto it = x.begin(); it != x.end(); it++)
#define mem(a, b) memset(a, (ll)b, sizeof(a))
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define edge(v, x, y) v[x].pb(y); v[y].pb(x);
#define popcount __builtin_popcount
#define ANS(s) {cout << s << "\n"; return;}

//~~~~~~fancy print~~~~~~~//
#define printpii(a) cout << a.ft << " " << a.sd << endl;
#define printpiii(a) cout << a.ft << " " << a.sd.ft << " " << a.sd.sd << endl;
#define print(a, n) rep(i, n) cout << a[i] << " "; cout << endl;
#define printv(v) for(auto x: v)cout << x << " "; cout << endl;
#define printm(a, n, m) rep(i, n) { rep(j, m) cout << a[i][j] << "\t"; cout << endl;}

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

void fast(){ios_base::sync_with_stdio(false);cin.tie(0);cout << setprecision(12) << fixed;}

void solve(){
    ll n;
    cin >> n;
    ll a[n];
    rep(i, n) cin >> a[i];
    sort(a, a+n);
    cout << a[n/2] - a[n/2-1];
}
main(){
    fast();
    ll t = 1; //cin >> t;
    while(t--){
        solve();
    }
}


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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;

template<class T>inline bool chmax(T &a, const T &b) { if (b > a) { a = b; return true; } return false; }
template<class T>inline bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

constexpr int INF = 1e9;
constexpr int MOD = 1e9 + 7;
constexpr long long LINF = 1e18;
constexpr double EPS = 1e-10;
constexpr double PI = M_PI;

void solve() {
    int N;
    cin >> N;
    vector<int> A(N), B(N);
    vector<int> cntA(N+1), cntB(N+1);
    for (int i=0; i<N; ++i) {
        int x;
        cin >> x;
        A[i] = x;
        ++cntA[x];
    }
    for (int i=0; i<N; ++i) {
        int x;
        cin >> x;
        B[i] = x;
        ++cntB[x];
    }

    for (int i=1; i<N+1; ++i) {
        if (cntA[i] + cntB[i] > N) {
            cout << "No" << '\n';
            return;
        }
    }

    cout << "Yes" << '\n';
    int shift = 0;
    int sumA = 0, sumB = 0;
    for (int i=1; i<N+1; ++i) {
        sumA += cntA[i];
        chmax(shift, sumA - sumB);
        sumB += cntB[i];
    }
    for (int i=0; i<N; ++i) {
        cout << B[(N+i-shift)%N];
        if (i == N-1) cout << '\n';
        else cout << ' ';
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}


Measured memory_bytes: 6344
///   Journey to the End of earth   ///
/// Gunjan Kumar ///
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// #include <functional> // for less 
// using namespace __gnu_pbds; 
using namespace std;
#define ll  long long
#define s(n) scanf("%d",&n)
#define ls(n) scanf("%lld",&n)
#define p(n) printf("%d",n)
// #define ln() printf("\n")
#define pln(n) printf("%d\n",n)
#define lpln(n) printf("%lld\n",n)
#define rep(i,a,n) for(int i=a;i<n;i++)
#define rev(i,a,n) for(int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define gcd __gcd
#define tc           ll t1; cin>>t1; while(t1--)
#define inp         ll n; cin>>n; ll arr[n]; rep(i,0,n) cin>>arr[i];
#define vect vector<ll>
#define sortv(v)       sort(v.begin(),v.end())
#define lower(v,n)    lower_bound(v.begin(),v.end(),n)-v.begin()
#define upper(v,n)    upper_bound(v.begin(),v.end(),n)-v.begin()
#define bitcount(n) __builtin_popcount(n)
#define ln <<endl
#define inf          LONG_MAX
#define ninf         LONG_MIN
#define fast         ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const   ll mod=1e9+7;
const ll N=1e5+5;



int main()
{

        
         int n;
         cin >> n;
         ll arr[n];
         rep(i,0,n)
         cin >> arr[i];

         ll dp[n];
         rep(i,0,n)
         dp[i]=0;
         
         dp[1]=abs(arr[1]-arr[0]);
         rep(i,2,n)
         dp[i]=min(dp[i-2]+abs(arr[i]-arr[i-2]),dp[i-1]+abs(arr[i]-arr[i-1]));
         // rep(i,0,n)
         // cout <<dp[i]<<" ";
         cout<<dp[n-1];

         
     return 0;
}



Measured memory_bytes: 1792
# 入力の取得(1行目。数値)
i = list(map(int, input().split()))

# 変数セット
boundCnt = i[0]
limit = i[1]

# 入力の取得(2行目。数値)
landpoints = list(map(int, input().split()))
#1回目のバウンド情報を加算(0座標)
landpoints.insert(0,0)
boundCnt += 1

nowCnt = 0
nowLandpoints = 0

for i in range(boundCnt):

   nowLandpoints += landpoints[i]
   if nowLandpoints > limit:
      break

   nowCnt += 1

print(nowCnt )


Measured memory_bytes: 3060
//include,using,define等
#pragma region header
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
#include <cstring>

// ===============================================================
//using系
#pragma region header
using namespace std;
using ll = long long;
using lint = long long;
using vl = vector<long long>;
using vvl = vector<vector<long long>>;
using vvi = vector<vector<int>>;
using vs = vector<string>;
using vc = vector<char>;
using vcc = vector<vector<char>>;
using vm = vector<short>;
using vmm = vector<vector<short>>;
using pii = pair<int, int>;
using psi = pair<string, int>;
using ld = long double;
using ull = unsigned long long;
using ui = unsigned int;
using qul = queue<ll>;
using pql = priority_queue<ll>;
const int dx[] = { 1,0,-1,0 };
const int dy[] = { 0,1,0,-1 };
constexpr ll mod = 1e9 + 7;
constexpr long double pi = 3.141592653589793238462643383279;
#pragma endregion
// ========================================================================
//define
#pragma region header
//#define int long long
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i <= n; i++)
#define INF (ll)10000000000000000
#define mod (ll)1000000007
#define P pair<lint,lint>
#pragma endregion
#pragma endregion



lint n, m, a, b;
char c[1010][1010];

int main() {
	cin >> n >> m >> a >> b;
	for (int i = 0; i < n; i++) 
		for (int j = 0; j < m; j++) 
			c[i][j] = '.';
	if (n * m < a * 2 + b * 2) {
		printf("NO\n");
		return 0;
	}
	if (m % 2 == 1) {
		for (int i = 0; i < n - 1; i += 2) {
			if (b != 0) {
				b--;
				c[i][m - 1] = '^';
				c[i + 1][m - 1] = 'v';
			}
		}
	}
	if (n % 2 == 1 && b % 2 == 1 && n > 2 && m > 2) {
		b--;
		c[n - 2][m - 3] = '^';
		c[n - 1][m - 3] = 'v';
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			if (b != 0) {
				if (c[i][j] == c[i + 1][j] && c[i][j] == '.') {
					b--;
					c[i][j] = '^';
					c[i + 1][j] = 'v';
				}
			}
		}
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			if (a != 0) {
				if (c[i][j] == c[i][j + 1] && c[i][j] == '.') {
					a--;
					c[i][j] = '<';
					c[i][j + 1] = '>';
				}
			}
		}
	}
	if (a > 0 || b > 0) {
		printf("NO\n");
	}
	else {
		printf("YES\n");
		for (int i = 0; i < n; i++)
			printf("%s\n", c[i]);
	}

	return 0;
}

Measured memory_bytes: 4592
#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
typedef long long ll;
#define rep(i,a,n) for(int i=a;i<n;i++)
#define rrep(i,n,a) for(int i=n;i>=a;i--)
#define FOR(i,n) for(int i=0;i<n;i++)
#define all(s) s.begin(),s.end()
#define vi vector<int>
#define vvi vector<vector<int>>
#define pcnt(n) __builtin_popcount(n)
const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const int INF = 1e18;
const double PI = acos(-1);

int ans;
vi h(100010);
vvi c(100010);


signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,m,a,b;
    cin>>n>>m;
    
    rep(i,0,n){
        cin>>h[i];
    }
    rep(i,0,m){
        cin>>a>>b;
        a--;b--;
        c[a].push_back(b);
        c[b].push_back(a);
    }
    rep(i,0,n){
        bool ok = true;
        for(auto x:c[i]){
            if(h[x]>=h[i]){ok=0;break;}
        }
        if(ok){ans++;}
    }
    cout<<ans<<endl;
}

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

int main()
{
  while(true)
  {
    int m,f,r,sum;
    cin >> m >> f >> r;

    if ( m==-1 && f==-1 && r==-1 ) break;

    sum = m + f;

    if ( m==-1 || f==-1 )
      cout << "F" << endl;
    else if ( 80 <= sum )
      cout << "A" << endl;
    else if ( 65 <= sum && sum < 80 )
      cout << "B" << endl;
    else if ( 50 <= sum && sum < 65 )
      cout << "C" << endl;
    else if ( 30 <= sum && sum < 50 )
      if ( 50 <= r )
        cout << "C" << endl;
      else
        cout << "D" << endl;
    else
      cout << "F" << endl;

  }

  return 0;
}



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

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

  bool flag = false;

  for (int i = 0; i < s.size(); i++) {
    char tmp;
    tmp = s.back();
    for (int j = s.size() - 1; j > 0 ; j--) {
      s[j] = s[j-1];
    }
    s.front() = tmp;

    if (s == t) {
      flag = true;
      break;
    }
  }

  if (flag) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
def examA():
    H, W = LI()
    S = [LSI() for _ in range(H)]
    Alpha = [chr(ord('A') + i) for i in range(26)]
    for i in range(H):
        for j in range(W):
            if S[i][j]=="snuke":
                ans = str(Alpha[j]) + str(i+1)
    print(ans)
    return

def examB():
    N = I()
    ans = []
    cur = int((N*2-1)**0.5)+1
    ansC = (cur+1)*cur//2
    neg = ansC-N
    if neg>cur:
        cur -=1
        ansC = (cur + 1) * cur // 2
        neg = ansC - N
    for i in range(1,cur+1):
        if i!=neg:
            ans.append(i)
    for v in ans:
        print(v)
#    print(cur,neg)
    return

def bfs(n,e,fordfs):
    #点の数、スタートの点、有向グラフ
    que = deque()
    que.append(e)
    len = [10**9]*n
    len[e] = 0
    while que:
        now = que.popleft()
        nowlen = len[now]
        for ne in fordfs[now]:
            if len[ne] == 10**9:
                len[ne] = nowlen+1
                que.append(ne)
    return len
def examC():
    N, M = LI()
    V = [[]for _ in range(N+M)]
    for i in range(N):
        L = LI()
        for k in range(1,L[0]+1):
            V[i].append(L[k]+N-1)
            V[L[k]+N-1].append(i)
    length = bfs(N+M,0,V)
    ans = "YES"
    for i in length[:N]:
        if i==10**9:
            ans = "NO"
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

if __name__ == '__main__':
    examC()


Measured memory_bytes: 38300
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

#define N 1000003

int getChar(char);
int getKey(char*);
int Insert(char*);
int Find(char*);

int H1(int key){return key%N;}
int H2(int key){return 1+(key%(N-1));}
int H0(int key,int i){return (H1(key)+i*H2(key))%N;}

char dic[N][14];

int main(void){
  int n,i;
  char order[9],str[14];

  for(i=0;i<N;i++) dic[i][0]='\0';

  scanf("%d", &n);

  for(i=0;i<n;i++){
    scanf("%s%s", order, str);

    if(order[0]=='i') Insert(str);
    else{
      if(Find(str)) printf("yes\n");
      else printf("no\n");
    }
  }
  return 0;
}

int getChar(char c){
  if(c=='A') return 1;
  else if(c=='C') return 2;
  else if(c=='G') return 3;
  else if(c=='T') return 4;
}

int getKey(char str[]){
  int sum=0,p=1,i;

  for(i=0;i<strlen(str);i++){
    sum+=p*(getChar(str[i]));
    p*=5;
  }

  return sum;
}

int Insert(char str[]){
  int key,i,j;

  key=getKey(str);
  i=0;

  while(i<N){
    j=H0(key,i);

    if(dic[j][0]=='\0'){
      strcpy(dic[j],str);
      return j;
    }else{
      i++;
    }
  }
}

int Find(char str[]){
  int i,j,key;

  key=getKey(str);

  i=0;
  while(1){
    j=(H1(key)+i*H2(key))%N;
    if(dic[j][0]=='\0' || i==N) return 0;
    if(strcmp(dic[j],str)==0) return 1;
    else i++;
  }
}

Measured memory_bytes: 14280
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

const ll mod = 1e9+7;

using vec = vector<ll>;
using mat = vector<vec>;

vec mul(mat A, vec b){
    vec ret(2);
    rep(i,2)rep(j,2){
        (ret[i] += A[i][j]*b[j]) %= mod;
    }
    return ret;
}

mat mat_mul(mat A, mat B){
    mat C(2,vec(2));
    rep(i,2)rep(j,2){
        rep(k,2) (C[i][j] += A[i][k]*B[k][j]) %= mod;
    }
    return C;
}

mat mat_pow(mat A, ll n){
    mat ret({{1,0},{0,1}});
    while(n){
        if(n&1) ret = mat_mul(ret, A);
        A = mat_mul(A,A);
        n>>=1;
    }
    return ret;
}

// F1 * F_idx未満の値の個数
ll num(ll idx){
    ll a = idx-1;
    ll n = (a+1)/2;
    return n*(a-n+1);
}

ll F(ll idx){
    if(idx==1) return 1;
    if(idx==2) return 2;

    mat A({{1,1},{1,0}});
    vec b({2,1});
    A = mat_pow(A, idx-2);
    vec res = mul(A,b);
    return res[0];
}

int main(){
    ll k;
    cin >>k;

    // dbg(num(2000000000));
    ll ok = 1, ng = 2000000000;
    while(ng-ok>1){
        ll mid = (ok+ng)/2;
        if(num(mid) < k) ok = mid;
        else ng = mid;
    }

    k -= num(ok)+1;
    ll n = (ok+1)/2;

    ll p;
    if(k<=(n-1)/2) p = 2*k+1;
    else p = 2*(n-k);
    ll q = ok - (p-1);

    cout << (F(p)*F(q))%mod << endl;
    return 0;
}



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

#define ll long long int
#define mem(n) memset(n,0,sizeof(n))
#define LCM(a,b) (a / __gcd(a,b) ) * b
#define gcd(a,b) __gcd(a,b)
#define for0(l,n) for(int l=0;l<n;l++)
#define for1(l,n) for(int l=1;l<=n;l++)
#define bug(n) cout<<">> "<<n<<" <<";
#define pb push_back
#define P1(a) cout<<a<<endl;
#define P2(a,b) cout<<a<<" "<<b<<endl;
#define P3(a,b,c) cout<<a<<" "<<b<<" "<<c<<endl
#define S1(a) cin>>a
#define S2(a,b)cin>>a>>b
#define S3(a,b,c) S2(a,b),S2(c)
#define squerit(n) (ll)n*n
#define FastRead        ios_base::sync_with_stdio(0);cin.tie(0)

bool vowel(char a)
{
    a= toupper(a);
    if((a=='A')||(a=='E')||(a=='I')||(a=='O')||(a=='U'))return 1;
    return 0;
}

ll n,m,q,a,b,c,sum=0,cnt=0;
ll arr[1000055];
map<ll,bool>mp;
string str;
int main()
{
    FastRead;
    ll d;
    cin>>a>>b>>c>>d;
    cin>>n;

    if(a*2<= b)b=a*2;

      if(b*2<=c)c=b*2;

      if(c*2<=d)d=c*2;

      ll ans  = (n/2) * d;
      if(n%2) ans+= c;
      cout<<ans<<endl;


}















Measured memory_bytes: 256
#include<iostream>
using namespace std;
const int maxi=8000;
int main()
{
     long long k,s,i,j,a[maxi],count,sum;
     while(cin>>k>>s)
     {
         for(i=0;i<=7500;i++)
            a[i]=0;
         count=0;
         for(i=0;i<=k;i++)
         {
             for(j=0;j<=k;j++)
             {
                 a[i+j]++;
             }
         }
         for(i=0;i<=k;i++)
         {
             sum=s-i;
             if(sum<0) continue;
             else count+=a[sum];
         }
         cout<<count<<endl;
     }
     return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

MAX = 10**5+1

n, k = map(int, input().split())
s = input()

pare = 0
for i in range(len(s)-1):
    if s[i] != s[i+1]:
        pare += 1

min_pare = max(pare - 2*k, 1)

print(n-min_pare)

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

using namespace std;

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

    int n = s.length();
    for (int i = 0; i < n; i++)
    {
        int need = s[i] == 'a' ? 0 : 'z' - s[i] + 1;
        if (need <= k)
        {
            k -= need;
            s[i] = 'a';
        }
    }

    k %= ('z' - 'a' + 1);

    while (k > 0)
    {
        if (s[n - 1] == 'z')
            s[n - 1] = 'a';
        else
            s[n - 1]++;

        k--;
    }

    cout << s << endl;

    return 0;
}


Measured memory_bytes: 512
function main(input){
    var nums = input.split('\n')[1].split(' ').map((n)=>parseInt(n,10));
    var count = 0;

    while(nums.every((n)=> (n%2)===0)){
        count++;
        nums = nums.map((n)=>n/2);
    }
    console.log(count);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

int main(void) {
    vector<int> a(9);
    for (int i = 0; i < 9; i++) {
        cin >> a.at(i);
    }
    int n;
    cin >> n;
    int b = 0;
    for (int i = 0; i < n; i++) {
        int bi;
        cin >> bi;
        for (int i = 0; i < 9; i++) {
            if (a.at(i) == bi) {
                b |= 1 << i;
            }
        }
    }
    if ((b & 448) == 448)
        cout << "Yes" << endl;
    else if ((b & 56) == 56)
        cout << "Yes" << endl;
    else if ((b & 7) == 7)
        cout << "Yes" << endl;
    else if ((b & 292) == 292)
        cout << "Yes" << endl;
    else if ((b & 146) == 146)
        cout << "Yes" << endl;
    else if ((b & 73) == 73)
        cout << "Yes" << endl;
    else if ((b & 273) == 273)
        cout << "Yes" << endl;
    else if ((b & 84) == 84)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3568
package main

import (
	"fmt"
)

func main() {
	var a,b int
	fmt.Scan(&a,&b)

	if (a + b) % 2 == 0 {
		fmt.Println((a + b) / 2)
	} else {
		fmt.Println((a + b) / 2 + 1)
	}
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define MAXN 200005
#define int long long
int n,p,i,x,c=1,ans,a[10005];
std::string s;
inline void read(int &x)
{
	short negative=1;
    x=0;
    char c=getchar();
    while(c<'0' || c>'9')
    {
    	if(c=='-')
			negative=-1;
		c=getchar();
	}
    while(c>='0' && c<='9')
        x=(x<<3)+(x<<1)+(c^48),c=getchar();
    x*=negative;
}
inline void print(int x)
{
    if (x<0)
        putchar('-'),x=-x;
    if (x>9)
        print(x/10);
    putchar(x%10+'0');
}
signed main(void)
{
	read(n),read(p);
	std::cin>>s;
	if (p==2 || p==5)
	{
		for (i=0;i<n;i++)
			if (!((s[i]-48)%p))
				ans+=i+1;
		return print(ans),0; 
	}
	a[0]++;
	std::reverse(s.begin(),s.end());
    for (i=0;i<n;i++)
	{
        (x+=c*(s[i]-48))%=p;
        (c*=10)%=p;
        ans+=a[x];
        a[x]++;
    }
    return print(ans),0; 
}

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

int main(){
  int n,k;
  string s;
  cin>>n>>k>>s;
  int group=1;
  rep(i,n-1){
    if(s[i]!=s[i+1]) group++;
  }
  cout<<n-1-max((group-1)-k*2,0)<<endl;
}


Measured memory_bytes: 3732
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007
#define llMAX 9223372036854775807
#define llMIN -9223372036854775808
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll n,a,b,c;

ll solve1(ll &a,ll &b,ll &c,ll no){
  ll ret=0;
  if (no==1){
    if (a>b){
      b++;
      a--;
      ret=1;
    }else{
      b--;
      a++;
      ret=0;
    }
  }
  if (no==2){
    if (a>c){
      c++;
      a--;
      ret=2;
    }else{
      c--;
      a++;
      ret=0;
    }
  }
  if (no==3){
    
    if (b>c){
      c++;
      b--;
      ret=2;
    }else{
      c--;
      b++;
      ret=1;
    }
  }
  return ret;
}



ll solve2(ll &a,ll &b,ll &c,ll no,ll no2){
  ll ret=0;
  for (int ii=0;ii<1;ii++){

  if (no==1){
    if (a>b){
      b++;
      a--;
      ret=1;
      break;
    }
    if (a<b){
      b--;
      a++;
      ret=0;
      break;
    }
    
    if (no2==2){b--;a++;ret=0;break;}
    if (no2==3){b++;a--;ret=1;break;}
    b--;a++;ret=0;
  }
  if (no==2){
    if (a>c){
      c++;
      a--;
      ret=2;
      break;
    }
    if (a<c){
      c--;
      a++;
      ret=0;
      break;
    }
    if (no2==1){c--;a++;ret=0;break;}
    if (no2==3){c++;a--;ret=2;break;}
    c--;a++;ret=0;


  }
  if (no==3){
    
    if (b>c){
      c++;
      b--;
      ret=2;
      break;
    }
    if (b<c){
      c--;
      b++;
      ret=1;
      break;
    }
    
    if (no2==1){b++;c--;ret=1;break;}
    if (no2==2){c++;b--;ret=2;break;}
    c++;b--;ret=2;

  }

  }

  return ret;
}


ll chk(ll &a,ll &b,ll &c){
  if (a<0)return 1;
  if (b<0)return 1;
  if (c<0)return 1;
  return 0;
}


int main(){
  
  cin >> n >> a>>b>>c;

  vi ans(n);
  vi si(n);
  string s;
  REP(i,n){
    cin>>s;
    si[i]=s[0]+s[1]-65*2;
  }

  if (a+b+c==0){
    cout<<"No"<<endl;
    return 0;
  }


  if (a+b+c==1){
    REP(i,n){
      ans[i]=solve1(a,b,c,si[i]);
      if (chk(a,b,c)==1){
        cout<<"No"<<endl;
        return 0;
      }
    }
    cout<<"Yes"<<endl;
    REP(i,n){
      s="A";
      s[0]+=ans[i];
      cout<<(s)<<endl;
    }
    return 0;
  }


  if (a+b+c==2){
    REP(i,n){
      ll ssi=-1;
      if (i<n-1) ssi=si[i+1];
      ans[i]=solve2(a,b,c,si[i],ssi);
      if (chk(a,b,c)==1){
        cout<<"No"<<endl;
        return 0;
      }
    }
    
    cout<<"Yes"<<endl;
    REP(i,n){
      s="A";
      s[0]+=ans[i];
      cout<<(s)<<endl;
    }
    return 0;

  }






    REP(i,n){
      
      ans[i]=solve1(a,b,c,si[i]);
      if (chk(a,b,c)==1){
        cout<<"No"<<endl;
        return 0;
      }
      
     /*
      ll ssi=-1;
      if (i<n-1) ssi=si[i+1];
      ans[i]=solve1(a,b,c,si[i],ssi);
      if (chk(a,b,c)==1){
        cout<<"No"<<endl;
        return 0;
      }
      */
    }

    cout<<"Yes"<<endl;
    REP(i,n){
      s="A";
      s[0]+=ans[i];
      cout<<(s)<<endl;
    }
    return 0;
  
  //cout<<ans<<endl;
  //return 0;
}

/*
6 2 0 0
AC
BC
BC
BC
AB
AC
*/

Measured memory_bytes: 4844
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String str = scan.nextLine();
        scan.close();

        String[] ks = str.split(" ");

        int n = 0;

        int k = Integer.parseInt(ks[0]);
        int s = Integer.parseInt(ks[1]);

        for (int x = 0; x <= k; x++) {
            for (int y = 0; y <= k; y++) {
                int z = s - x - y;
                if (0 <= z && z <= k) {
                    //System.out.println(x + ", " + y + ", " + z);
                    n++;
                }
            }
        }

        System.out.println(n);

    }
}


Measured memory_bytes: 20948
N=int(input())
A=[[0]*9 for i in range(9)]
sum=0
for i in range(1,N+1):
  s=str(i)
  if(int(s[0])!=0 and int(s[-1])!=0):
    A[int(s[0])-1][int(s[-1])-1]+=1
for i in range(9):
  for j in range(9):
    sum+=A[i][j]*A[j][i]
  #print(A[i][i])
#print(A)  
print(sum)

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

typedef long long ll;

ll gcd( ll x, ll y );
ll lcm( ll x, ll y );

int main()
{
    int a, b, c;
    cin >> a >> b >> c;

    if ( a == 1 && b == 1 || c == 1 ) {
        printf("Open\n");
    } else {
        printf("Close\n");
    }

    return 0;
}

ll gcd( ll x, ll y )
{
    if ( y == 0 ) return x;
    return gcd( y, x % y );
}

ll lcm( ll x, ll y )
{
    return x / gcd( x, y ) * y;
}



Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll M = 998244353;
const ll MN = 10001000;
ll fp[MN],ip[MN],pt[MN];
ll mul(ll a, ll b) {return (a*b)%M;}
ll bp(ll b, ll p) {
	ll ac = 1;
	while(p) {
		if(p&1) {ac = mul(ac,b);}
		b = mul(b,b);
		p >>= 1;
	}
	return ac;
}
ll fac(ll p) {
	if(p <= 1) {return 1;}
	if(fp[p] != -1) return fp[p];
	if(p > 10000) {fac(p-10000);}
	return fp[p] = mul(p,fac(p-1));
}
ll inv(ll b) {
	return bp(b,M-2);
}
ll ifac(ll b) {
	if(b < MN) {
		if(ip[b] != -1) {return ip[b];}
		return ip[b] = inv(fac(b));
	}
	return inv(fac(b));
}
ll ch(ll n, ll k) {
	if(k > n || k < 0) return 0;
	return mul(mul(fac(n),ifac(k)),ifac(n-k));
}
int main() {
	memset(fp,-1,sizeof(fp));
	memset(ip,-1,sizeof(ip));
	ll n;
	cin >> n;
	pt[0] = 1;
	for(int i=0;i<n;i++) {
		//pt[i+1] = mul(2,pt[i]);
		pt[i+1] = 2*pt[i];
		if(pt[i+1] >= M) {pt[i+1] -= M;}
	}
	ll res = bp(3,n);
	ll tot = 0;
	for(int i=0;i<n/2;i++) {
		tot += mul(ch(n,i),pt[i]);
	}
	tot *= 2;
	res = (res-tot);
	res = ((res%M)+M)%M;
	cout << res << '\n';
}


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

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

  int x = 0;
  int mx = x;
  for (int i = 0; i < N; i++) {
    if (S[i] == 'I') x++;
    else x--;

    if (x > mx) mx = x;
  }

  cout << mx << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#define my_abs(x) ((x) < 0 ? -(x) : (x))
int arr[500005], dp[500005], pos[500005];
int main()
{
	// freopen("ARC072-E.in", "r", stdin); 
	int n, d; 
	scanf("%d%d", &n, &d);
	for (int i = 0; i < n; i++)
		scanf("%d", arr + i); 
	dp[n] = 1; 
	for (int i = n - 1; i >= 0; i--)
	{
		if (dp[i + 1] <= arr[i] / 2)
			dp[i] = dp[i + 1]; 
		else
			dp[i] = dp[i + 1] + arr[i]; 
	}
	pos[0] = d; 
	for (int i = 0; i < n; i++)
	{
		if (my_abs(pos[i] - arr[i]) < pos[i])
			pos[i + 1] = my_abs(pos[i] - arr[i]); 
		else
			pos[i + 1] = pos[i]; 
	}
	int q; 
	scanf("%d", &q); 
	while (q--)
	{
		int x; 
		scanf("%d", &x); 
		puts(dp[x] <= pos[x - 1] ? "YES" : "NO"); 
	}
	return 0; 
}


Measured memory_bytes: 7680
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())

using namespace std;
typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const int INF = 1001001001;
const long long INFL = (1LL<<60);
const double eps = (1e-9);

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

  rep(i, s.size()) {
    int v = s[i] - 'A';
    int w = (v + n) % 26;
    s[i] = 'A' + w;
  }

  cout << s << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include <list>
#include<stack>
#include<queue>
#include <vector>
#include <set>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include <functional>
#include<fstream>

#define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define LL long long
#define CLR(a) memset((a),0,sizeof(a))
#define SZ(x) (int((x).size()))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<<str<<endl
using namespace std;

const LL MOD = 1000000007;// 10^9+7
const int INF = (1 << 30);


//変数
int N, M;




//サブ関数
//入力
void input()
{
	cin >> N >> M;
}

//計算
void calc()
{
	vector<LL> dp1(N + 1, 1);
	vector<LL> dp2(N + 1, 0);
	dp2[0] = 1;
	dp1[0] = 0;

	REP(roop, 2 * M) {
		if (roop % 2 == 0) {
			vector<LL> next1, next2;
			REP(j, N) next1.push_back((dp1[j] + dp1[j + 1]) % MOD);
			REP(j, N) next2.push_back((dp2[j] + dp2[j + 1]) % MOD);
			next1.push_back(0);
			next2.push_back(0);
			next2[0] += next1[0];
			next1[0] = 0;

			dp1 = next1;
			dp2 = next2;
		}
		else {
			vector<LL>next1, next2;
			next1.push_back(0);
			next2.push_back(dp2[0]);
			REP(i, N)next1.push_back((dp1[i] + dp1[i + 1]) % MOD);
			REP(i, N)next2.push_back((dp2[i] + dp2[i + 1]) % MOD);
			dp1 = next1;
			dp2 = next2;
		}
	}
	LL ans = 0;
	REP(i, N + 1) {
		ans += dp2[i];
		ans %= MOD;
	}
	cout << ans << endl;
}


//出力
void output()
{

}


//デバッグ
void debug()
{
	int N;
	cin >> N;
}


//メイン関数
int main()
{
	input();
	calc();
	output();
	debug();

	return 0;
}


Measured memory_bytes: 384
let area =
  [| [1; 4]
   ; [0; 2; 5]
   ; [1; 3; 6]
   ; [2; 7]
   ; [0; 5; 8]
   ; [1; 4; 6; 9]
   ; [2; 5; 7; 10]
   ; [3; 6; 11]
   ; [4; 9; 12]
   ; [5; 8; 10; 13]
   ; [6; 9; 11; 14]
   ; [7; 10; 15]
   ; [8; 13]
   ; [9; 12; 14]
   ; [10; 13; 15]
   ; [11; 14] |]

let m_d =
  [| [|0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0|]
   ; [|0; 1; 2; 3; 1; 2; 3; 4; 2; 3; 4; 5; 3; 4; 5; 6|]
   ; [|1; 0; 1; 2; 2; 1; 2; 3; 3; 2; 3; 4; 4; 3; 4; 5|]
   ; [|2; 1; 0; 1; 3; 2; 1; 2; 4; 3; 2; 3; 5; 4; 3; 4|]
   ; [|3; 2; 1; 0; 4; 3; 2; 1; 5; 4; 3; 2; 6; 5; 4; 3|]
   ; [|1; 2; 3; 4; 0; 1; 2; 3; 1; 2; 3; 4; 2; 3; 4; 5|]
   ; [|2; 1; 2; 3; 1; 0; 1; 2; 2; 1; 2; 3; 3; 2; 3; 4|]
   ; [|3; 2; 1; 2; 2; 1; 0; 1; 3; 2; 1; 2; 4; 3; 2; 3|]
   ; [|4; 3; 2; 1; 3; 2; 1; 0; 4; 3; 2; 1; 5; 4; 3; 2|]
   ; [|2; 3; 4; 5; 1; 2; 3; 4; 0; 1; 2; 3; 1; 2; 3; 4|]
   ; [|3; 2; 3; 4; 2; 1; 2; 3; 1; 0; 1; 2; 2; 1; 2; 3|]
   ; [|4; 3; 2; 3; 3; 2; 1; 2; 2; 1; 0; 1; 3; 2; 1; 2|]
   ; [|5; 4; 3; 2; 4; 3; 2; 1; 3; 2; 1; 0; 4; 3; 2; 1|]
   ; [|3; 4; 5; 6; 2; 3; 4; 5; 1; 2; 3; 4; 0; 1; 2; 3|]
   ; [|4; 3; 4; 5; 3; 2; 3; 4; 2; 1; 2; 3; 1; 0; 1; 2|]
   ; [|5; 4; 3; 4; 4; 3; 2; 3; 3; 2; 1; 2; 2; 1; 0; 1|] |]

let h a =
  let rec doit i acc =
    if i = 16 then acc
    else doit (i + 1) (acc + m_d.(a.(i)).(i))
  in doit 0 0

let idx_by_val x a =
  let n = Array.length a in
  let rec doit i =
    if i = n then raise Not_found
    else if x = a.(i) then i
    else doit (i + 1)
  in doit 0

let solve a =
  let goal = [|1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; 0|] in
  let rec idastar i limit space_i moved lower =
    if i = limit then begin
      if a = goal then (Printf.printf "%d\n" (List.length moved - 1); exit 0)
    end else
      let move j =
        let x = a.(j) in
        if x <> List.hd moved then
          let new_lower = lower - m_d.(x).(j) + m_d.(x).(space_i) in
          if new_lower + i <= limit then begin
            a.(j) <- 0;
            a.(space_i) <- x;
            idastar (i + 1) limit j (x :: moved) new_lower;
            a.(j) <- x;
            a.(space_i) <- 0;
          end in
      List.iter move area.(space_i)
  in
  let lower = h a in
  let rec doit limit =
    if limit <= 45 then begin
      idastar 0 limit (idx_by_val 0 a) [-1] lower;
      doit (limit + 1)
    end in
  doit lower

let () =
  solve (Array.init 16 (fun _ -> Scanf.scanf "%d " (fun i -> i)))

Measured memory_bytes: 4556