akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
#define lf long double
#define pb push_back
#define mp make_pair
#define F first
#define S second
typedef pair <ll,ll> ii;
typedef vector <ll> vi;
typedef vector <ii> vii;
typedef vector <bool> vb;
typedef vector <vector <ll> > vv;
typedef vector <vector <vector<ll> > > vvv;
typedef vector <string> vs;
typedef vector <lf> vf;
#define tr1(x) cerr << #x << ": " << x << endl
#define tr2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << endl
#define tr3(x,y,z) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define tr4(x,y,z,w) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<" | "<<#w<<": "<<w<<endl
#define trv(a) cerr<<#a<<": ";for(ll zz=0;zz<a.size();zz++) cerr<<a[zz]<<" ";cerr<<endl
#define trii(x) cerr<<#x<<": ("<<x.F<<","<<x.S<<")\n";
#define trset(s) cerr<<#s<<": ";for(auto &i:s) cerr<<i<<" ";cerr<<"\n"
#define mod 1000000007ll
#define inf 9999999999999999ll
#define nl endl
#define sz(x) (ll)(x).size()
#define all(x) x.begin(), x.end()
#define modulo 998244353ll

ll fun(vi &a,ll index,ll req,map <ii,__int128> &m)
{
    if(req<0)
        return -inf;
    if(m.find(mp(index,req))!=m.end())
        return m[mp(index,req)];
    __int128 &an=m[mp(index,req)];
    ll n=sz(a);
    if(index>=n)
    {
        if(req!=0)
            return an=-inf;
        return an=0;
    }
    ll left=n-index;
    if(req>(left+1)/2)
    {
        return an=-inf;
    }
    return an=max(fun(a,index+1,req,m),a[index]+fun(a,index+2,req-1,m));
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    vi a(n,0);
    for(ll i=0;i<n;i++)
        cin>>a[i];
        map <ii,__int128> m;
        cout<<fun(a,0,sz(a)/2,m)<<nl;
}


Measured memory_bytes: 47008
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll n;cin>>n;
  ll a[n];for(ll i=0;i<n;i++)cin>>a[i];
  sort(a,a+n);
  ll ans=0;
  for(ll i=0;i<(n-1)/2;i++)ans+=2*a[n-1-i];
  if(n%2==0){
    for(ll i=0;i<(n-1)/2;i++)ans-=2*a[i];
    ans+=a[n/2];
    ans-=a[n/2-1];
  }
  else{
    ll anss=0;
    for(ll i=0;i<(n-1)/2-1;i++)ans-=2*a[i];
    ans-=a[(n-1)/2-1];
    ans-=a[(n-1)/2];
    for(ll i=0;i<(n-1)/2;i++)anss-=2*a[i];
    anss+=a[(n-1)/2];
    anss+=a[(n-1)/2+1];
    for(ll i=(n-1)/2+2;i<n;i++)anss+=2*a[i];
    ans=max(ans,anss);
  }
  cout<<ans<<endl;
}

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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  ll n;
  cin >> n;

  ll ans = 0;
  ll x = n;
  ll m = 0;
  if(n%2 != 0){
    cout << 0 << endl;
    return 0;
  }

  x /= 2;
  while(x != 0){
    ans += x/5;
    x /= 5;
  }

  cout << ans << endl;
}


Measured memory_bytes: 384
#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn main() {
    //let n = read::<usize>();
    //let n = read::<u32>();
    let v = read_vec::<i32>();
    let w = v[0];
    let h = v[1];
    let x = v[2];
    let y = v[3];
    let r = v[4];

    if x + r <= w && x - r >= 0 && y + r <= h && y - r >= 0 {
        println!("Yes");
    } else {
        println!("No");
    }
}



Measured memory_bytes: 5028
#include<algorithm>
#include<iostream>
#include<vector>
#define rep(i,a) for(int i=0;i<a;i++)
using namespace std;
int main(){
  int n;
  cin>>n;
  const int inf=2e9;
  int r=1;
  vector<int>out(n+1,inf);
  out[0]=-1;
  rep(i,n){
    int a;cin>>a;
    for(int j=r;i>=0;j--){
      if(out[j]<a){
	out[j+1]=a;
	r=max(r,j+1);
	break;
      }
    }
    //rep(i,n)cout<<" "<<out[i];
    //cout<<" "<<out[n]<<endl;
  }
  cout<<r<<endl;
}

Measured memory_bytes: 1532
#include <bits/stdc++.h>
#define ll long long
#define rep(X,N) for(int X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define pback push_back
#define mpair make_pair
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end() 
#define CERR if(false) cerr

using namespace std;

int main(){

    int h,w,a,b;
    cin >> h >> w >> a >> b;

    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            int tmp;
            if((i < b && j < a) || (i >= b && j >= a)){
                tmp = 1;
            }else tmp = 0;

            cout << tmp;
        }
        cout << endl;
    }

    return 0; 
}


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

using namespace std;

typedef long long ll;

#define MOD (int)1e9+7
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>b;--i)
#define vi vector<int>
#define vl vector<ll>
#define ld long double
#define vvi vector<vector<int>>
#define vvl vector<vector<long long>>
#define pii pair<int,int>
#define pll pair<long,long>
#define vpii vector<pii>
#define vpll vector<pll>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define PI 3.1415926535897932384626433832795
#define fix(f,n) fixed<<setprecision(n)<<f
#define all(x) x.begin(),x.end()

ll powM(ll a,ll b,ll m )
{ 
  a%=m;
  ll ans=1;
  while(b>0)
  {
    if(b&1)ans=ans*a%m;
    a=a*a%m;
    b>>=1;
  }

return ans;
}

ll c(ll a,ll b)
{
  if(a==0)return b==0?1:0;

if(b>a)return 0;

  ll val=1;
ll fac=1;
for(int i=1;i<=b;i++)fac*=i;
for(int i=a;i>=a-b+1;i--)val*=i;

  return val/fac;

}

ll f(ll n)
{
  ll ans=1LL;
  while(ans<=n)ans<<=1;

return ans;
}

int main()
{
   ios_base::sync_with_stdio(false);
    cin.tie(NULL);


ll n;cin>>n;
string s="";
if(abs(n)&1)
{
  n--;
  s+='1';
}
else s+='0';
//cout<<s<<"\n";

if(!n)
{
  cout<<"0"<<"\n";
  return 0;
}

while(n)
{
  if(abs(n)%8==0)s+="00";
  else if(abs(n+2)%8==0)
    {
      s+="10";
      n+=2;
    }
  else if(abs(n-2)%8==0)
  {
    s+="11";
    n-=2;
  }
  else
  {
    s+="01";
    n-=4;
  }
  n/=4;
}


ll z=s.size();
if(s[z-1]=='0')s.erase(s.begin()+z-1);

reverse(all(s));
cout<<s<<"\n";

return 0;

}


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

/*
	Name:
	Author: Xia Ruize
	Date:
*/

/*
bool is_prime(int x)
{
	if(x<2)
		return false;
	for(int i=2;i*i<=x;i++)
	{
		if(x%i==0)
		{
			return false;
		}
	}
	return true;
}
*/

int main()
{
	int n;
	cin>>n;
	string s;
	cin>>s;
	for(int i=0;i<s.size();i++)
	{
		s[i]+=n;
		if(s[i]>'Z')
		{
			s[i]-=26;
		}
	}
	cout<<s<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <set>
#define ll long long
using namespace std;

int main() 
{
    ll a;
    cin >> a;
    set<string> s;
    string t;
    for(ll i = 0; i < a; i++) {
        cin >> t;
        s.insert(t);
    }

    cout << s.size() << endl;
}

Measured memory_bytes: 19256
n,m=map(int,input().split())
ab = [list(map(int,input().split())) for i in range(n)]
acsd=sorted(ab,key=lambda a:a[0])
yen_tot=0
n_b=m
def count_p(store,n_v):
    yen,num=store
    return yen*min(n_v,num),max(n_v-num,0)
for s in acsd:
    cost,rem=count_p(s,n_b)
    yen_tot+=cost
    n_b=rem
    if rem==0: break
print(yen_tot)

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

#define rep(a,b) for(int a = 0;a < b;a++)
#define REP(i, x, n) for(int i = x; i < n; i++)
#define P(a) cout << a << endl
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define ssort(v) sort(v.begin(),v.end())
#define rev(v) reverse(v.begin(),v.end())
#define vP(v) for(int i = 0;i < v.size();i++){cout << v[i];if(i != v.size()-1)cout << endl;}
#define vcin(v,n) rep(i,n){int a;cin >> a;v.pb(a);}

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int dx[] = { 1, -1 , 0 , 0 };
int dy[] = { 0,  0,  1, -1 };
//int dx[] = { 1, 0 };
//int dy[] = { 0, 1 };
ll MOD = 1000000007;

unsigned long long str_to_int(std::string str) {
	unsigned long long ret;
	std::stringstream ss; ss << str;
	ss >> ret;
	return ret;
}

void solve(){
	int n;
	cin >> n;
	vector<int> u,d;
	rep(i,n){
		int a;
		cin >> a;
		u.pb(a);
	}
	rep(i,n){
		int a;
		cin >> a;
		d.pb(a);
	}
	int maxi = -1;
	REP(i,1,n+1){
		int sum = 0;
		REP(j,0,i) {
			sum += u[j];
		}
		REP(j,i-1,n){
			sum += d[j];
		}
		maxi = max(maxi,sum);
	}
	P(maxi);
}

int main() {
	solve();
	return 0;
}


Measured memory_bytes: 256
qhsd=list(map(int, input().split()))
N=int(input())
# ls0=[0.25, 0.5, 1.0, 2.0]
# ls=[]
# for i in range(4):
# 	ls.append([8//(2**i)*qhsd[i],ls0[i],qhsd[i]])
# ls.sort()
# # print(ls)

# ans=0
# for i in range(4):
# 	if N<ls[i][1]:
# 		continue
# 	ans+=int(N//ls[i][1]*ls[i][2])
# 	N=int(N-N//ls[i][1]*ls[i][1])
# 	if N==0:
# 		break
# 	# print(i, ans, N)
# print(ans)

print((N//2)*min(8*qhsd[0],4*qhsd[1],2*qhsd[2],1*qhsd[3])+(N%2)*min(4*qhsd[0],2*qhsd[1],1*qhsd[2]))

Measured memory_bytes: 3060
#include<stdio.h> 

int main()
{   
    int a,h,m,s;
    scanf("%d",&a);
        h=a/3600;
        m=(a-3600*h)/60;
        s=(a-3600*h)%60;
            printf("%d:%d:%d\n",h,m,s); 
     return 0;
}


Measured memory_bytes: 2736
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
using namespace std;

const int MOD = 1e9 + 7;

int main() {
        int n;
        scanf("%d", &n);
        vector<pair<long long, int>> a(2 * n);
        for (int i = 0; i < 2 * n; i ++) {
                scanf("%lld", &a[i].first);
                if (i < n) a[i].second = 1;
                else a[i].second = -1;
        }
        sort(a.begin(), a.end());
        int total = 0;
        long long ans = 1;
        for (int i = 0; i < 2 * n; i ++) {
                int type = a[i].second;
                if (type > 0 && total < 0) ans = ans * -total % MOD;
                if (type < 0 && total > 0) ans = ans * total % MOD;
                total += type;
        }
        printf("%lld\n", ans % MOD);
        return 0;
}



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

int main(){
    int n;
    while(cin >> n, n != 0){
        int ideal_id;
        double bmi, weight, height, min_diff = 100000;
        int id;
        for(int i=1; i<=n; i++){
            cin >> id >> height >> weight;
            bmi = weight/((height/100.0)*(height/100.0));
            if(min_diff > abs(bmi-22.0)){
                min_diff = abs(bmi-22.0);
                ideal_id = id;
            }
        }
        cout << ideal_id << endl;
    }
    return 0;
}

Measured memory_bytes: 0
n=int(input())
a=[]
cnt=0
now=0
for i in range(n):
  a.append(int(input())-1)
flg=False
for i in range(n):
  if now==1:
    flg=True
    break
  now=a[now]
  cnt+=1
print(cnt if flg else -1)  

Measured memory_bytes: 7192
D, G = map(int, input().split(' '))
p_c_pairs = [(i+1, list(map(int, input().split(' ')))) for i in range(D)]

import itertools, math
ans = float('inf')
nums = list(range(D))
for n in range(D+1):
    for num in itertools.combinations(nums, n):

        probs, score = 0, 0
        for i in num:
            j, (p, c) = p_c_pairs[i]
            probs += p
            score += 100 * j * p + c

        if G > score:
            i = max([i for i in nums if i not in num])
            j, (p, c) = p_c_pairs[i]
            m = min(p, int(math.ceil((G - score) / (100 * j))))
            probs += m
            score += 100 * j * m
            if m == p:
                score += c

        if G <= score:
            ans = min(ans, probs)

print(ans)

Measured memory_bytes: 42588
import sys, re
from math import ceil, floor, sqrt, pi, factorial#, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left
from functools import reduce
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_list(N): return [s_list() for _ in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7

def bfs(graph: list, n: int, start: int, ans: list):
    q = deque([start])
    visited = [INF] * n
    visited[0] = 1
    while len(q) != 0:
        node = q.popleft()
        for leaf in graph[node]:
            if visited[leaf] != INF:
                continue
            ans[leaf] = node + 1
            visited[leaf] = 1
            q.append(leaf)

def create_graph(n: int, l: list) -> list:
    graph = [[] for _ in range(n)]
    for a, b in l:
        graph[a-1].append(b-1)
        graph[b-1].append(a-1)
    return graph

def main():
    n, m = i_map()
    num_list = i_row_list(m)

    graph = create_graph(n, num_list)

    ans = [0] * n

    bfs(graph, n, 0, ans)

    Yes()
    for a in ans[1:]:
        print(a)

if __name__ == '__main__':
    main()


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

int main() {
  int N;
  cin >> N;
  
  vector<int> x(N);
  for (int i=0; i<N; i++) {
    cin >> x[i];
  }
  
  long long min_sum = 1e9 + 7;
  
  for (int j=0; j<=100; j++) {
    long long sum = 0;
    for (int i=0; i<N; i++) {
      sum += pow(j - x[i], 2);
    }
    min_sum = min(sum, min_sum);
  }

  cout << min_sum << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <set>
#include <cmath>
#include <string>

using namespace std;

int main(void) {
    int n;
    cin >> n;
    if(n < 1000)
        cout << "ABC";
    else
        cout << "ABD";
    cout << endl;
    return 0;
}


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); ++i)

using ll = long long;
using pint = pair<int, int>;
using mint = map<int, int>;

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

const char sp = ' ';
const char cmm = ',';
const int MOD = 1e9+7;
const int INF = 1e9;
const ll LINF = 1e18;

ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll b, ll e, ll m){ll r=1;while(e>0){if(e&1)r=(r%m)*(b%m)%m;b=(b%m)*(b%m)%m;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

template<typename T>
void ppp(T n){cout << n << endl;}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
	int len = v.size();
    s << '[';
	for (int i = 0; i < len; ++i) {
		s << v[i]; if (i < len-1) s << ", ";
	}
    s << ']';
	return s;
}

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

	int a, b, c;
	cin >> a >> b >> c;

	Judge(min(a,b) <= c and c <= max(a, b));


    return 0;
}


Measured memory_bytes: 256
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <iostream>
#include <algorithm>
using namespace std;
int N, M;
int main() {
	ios::sync_with_stdio(false);
	cin >> N >> M;
	cout << (M * 1900 + (N - M) * 100) * (1 << M) << endl;
	return 0;
}

Measured memory_bytes: 256
N=int(input())
D=[0]*(N+1)
for i in range(2,N+1):
  a=i
  for j in range(2,i+1):
    while a%j==0:
      D[j]+=1
      a//=j
def num(x):
  cnt=0
  for i in D:
    if i>=x-1:
      cnt+=1
  return cnt

print(num(75)+num(25)*(num(3)-1)+num(15)*(num(5)-1)+num(5)*(num(5)-1)*(num(3)-2)//2)


Measured memory_bytes: 3064
#include<bits/stdc++.h> 
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
#define endl "\n"
#define mod 1000000007
#define mod2 998244353
#define double long double
#define pb push_back
#define swap(x,y) (x^=y^=x^=y)
#define TC int TESTCASE;cin>>TESTCASE;while(TESTCASE--)
#define oo 1500000000000000000
#define mem(a,b) memset(a,b,sizeof(a))
#define debug1(a) cout<<#a<<" = "<<(a)<<endl;
#define debug2(a,b) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<endl;
#define debug3(a,b,c) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<endl;
#define debug4(a,b,c,d) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<", "<<#d<<" = "<<(d)<<endl;
using namespace std;
 
int modexpo(int x,int p){
    int res = 1;x = x%mod;
    while(p){
        if(p%2)res = res * x;
        p >>= 1;
        x = x*x % mod;
        res %= mod;
    }
    return res;
}
 
int max(int a,int b){return (a>b?a:b);}
 
int min(int a,int b){return (a<b?a:b);}
 
struct edge{int u,v,w;edge(int a,int b,int c){u=a;v=b;w=c;}};
 
struct compare{
    bool operator() (const edge a, const edge b) const{
        if(a.u == b.u){
            if(a.v == b.v){
                return a.w < b.w;
            }
            return a.v < b.v;
        }
        return a.u < b.u;
    }
};

int32_t main(){
    IOS
    int n;
    cin >> n;
    int arr[n+1];
    arr[0] = 0;
    map<int,vector<int>>mp;
    for(int i=1;i<=n;i++){
        cin >> arr[i];
        mp[arr[i]].pb(i);
    }
    if(!mp.count(1)){
        cout<<-1<<endl;
        return 0;
    }
    int cur = 0;
    int no = 1;
    for(auto x : mp){
        if(x.first != no){
            break;
        }
        auto temp = upper_bound(x.second.begin(),x.second.end(),cur);
        if(temp == x.second.end()){
            break;
        }
        cur = *temp;
        no++;
    }
    no--;
    if(no == 0){
        cout<<-1<<endl;
        return 0;
    }
    else{
        cout<<n - no<<endl;
    }
} 

Measured memory_bytes: 27056
def div_two_time(num):
    count = 0
    while num %2 ==0:
        count +=1
        if num %2 == 0:
            num = num /2
        else:
            break
    return count

import numpy as np 
n = int(input())
seq = list(map(int, input().split()))
count = [div_two_time(seq[i]) for i in range(n)]
print(sum(count))

Measured memory_bytes: 22352
n,m=map(int, input().split()) 
key=[]
for i in range(m):
    a,b = map(int,input().split())
    c = list(map(int,input().split()))
    rock = 0
    for j in c:
        rock += 2**(j-1)
    key.append([a,rock])

DP=[[float('inf')]*2**n for i in range(m+1)]
DP[0][0]=0

for i in range(m):
    for j in range(2**n):
        DP[i+1][j] = DP[i][j]
        DP[i+1][j] = min(DP[i+1][j],key[i][0]+DP[i][j-(j&key[i][1])])
if DP[-1][-1]==float('inf'):
    print(-1)
else:
    print(DP[-1][-1])

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

int main(){
	int n;
  	cin >> n;
  	bool ans = true;
  	rep(i, n){
    	int a;
      	cin >> a;
      	if(a % 2 == 0){
        	if(a % 3 == 0 || a % 5 == 0) continue;
          	else {
              ans = false;
              break;
            }
        }  
    }
  	
 	if(ans) cout << "APPROVED" << endl;
  	else cout << "DENIED" << endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define  rep(i,n) for(ll i = 0; i < (n); ++i)
inline ll gcd(ll a,ll b) { return b?gcd(b,a%b):a; }

int main()
{
    ll a,b,k;
    cin>>a>>b>>k;
    cout<<max(a-k,0LL)<<" "<<max(0LL,min(b,a+b-k))<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <cmath>
#include <limits>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
ll Max(ll(a), ll(b), ll(c)) {
	return max(max(a, b), c);
}
ll Min(ll(a), ll(b), ll(c)) {
	return min(min(a, b), c);
}

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



int main() {

	ll N;
	cin >> N;
	vector<ll> dp(N);
	vector<ll> h(N);
	rep(i, N) {
		cin >> h.at(i);
		dp.at(i) = 999999999;
	}
	dp.at(0) = 0;
	dp.at(1) = abs(h.at(1)- h.at(0));
	for (ll i = 2; i < N; i++) {
		chmin(dp.at(i), dp.at(i-1) + abs(h.at(i) - h.at(i-1)));
		chmin(dp.at(i), dp.at(i-2) + abs(h.at(i) - h.at(i-2)));
	}
	cout << dp.at(N-1) << endl;
}


Measured memory_bytes: 1792
#include <iostream>                                                                                                                                                          
                                                                                                                                                                             
using namespace std;                                                                                                                                                         
int main() {                                                                                                                                                                 
  int D;                                                                                                                                                                     
  cin >> D;                                                                                                                                                                  
  string ans;                                                                                                                                                                
  if (D == 25) ans = "Christmas";                                                                                                                                            
  else if (D == 24) ans = "Christmas Eve";                                                                                                                                   
  else if (D == 23) ans = "Christmas Eve Eve";                                                                                                                               
  else ans = "Christmas Eve Eve Eve";                                                                                                                                        
  cout << ans << endl;                                                                                                                                                       
  return 0;                                                                                                                                                                  
}

Measured memory_bytes: 256
n,m,x=map(int , input().split())
cost_list=list(map(int,input().split()))

result=0

if x>cost_list[m-1] or x<cost_list[0]:
    result=0
else:
    cost_larger_n=sum([1 for i in cost_list if i>x and i<n]) 
    if cost_larger_n <= m-cost_larger_n:
        result=cost_larger_n
    else:
        result=m-cost_larger_n

print(result)


        

Measured memory_bytes: 3060
#include<cstdio>
#include<algorithm>
using namespace std;
#define mod 1000000007
#define N 200005
typedef long long LL;
LL f1[N],s[N];
int n;
inline LL pow(LL a,int k)
{
    LL x=1;
    while(k)
	{
        if(k&1)
			x=x*a%mod;
        a=a*a%mod;
        k>>=1;
    }
    return x;
}
inline void prepare() 
{
    s[0]=1;
    for(int i=1;i<=n;i++)
        s[i]=s[i-1]*i%mod;
    f1[0]=1;
    f1[n]=pow(s[n],mod-2);
    for(int i=n-1;i>0;i--)
        f1[i]=f1[i+1]*(i+1)%mod;
}
inline LL C(int a,int b)
{
    if(a<0||b<0)
		return 1;
    return s[a]*f1[b]%mod*f1[a-b]%mod;
}
int main()
{
    int h,w,a,b;
    scanf("%d%d%d%d",&h,&w,&a,&b);
    n=h+w-2;
    prepare();
    LL ans=C(h+w-2,h-1);
    for(int i=1;i<=b;i++) 
	{
        ans-=C(h-a+i-2,h-a-1)*C(a-1+w-i,a-1)%mod;
        ans=(ans+mod)%mod;
    }
    printf("%lld\n",ans);
}


Measured memory_bytes: 3328
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <iterator>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
#include <time.h>
#include <complex>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define sc second
#define fr first
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rRep(i,a,b) for(int i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ll INF=1000000011;
constexpr ll MOD2=998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS=10e-8;
template <class T, class U> inline bool chmax(T& lhs, const U& rhs) { if (lhs < rhs) { lhs = rhs; return 1; } return 0; }
template <class T, class U> inline bool chmin(T& lhs, const U& rhs) { if (lhs > rhs) { lhs = rhs; return 1; } return 0; }
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
  for(auto i=begin(v); i != end(v); ++i){
    if(i !=begin(v)) os << ' ';
    os << *i;
  }
  return os;
}

int main(){
  ll N,A[200007],B[200007],T=0;
  cin >> N ;
  rep(i,N){
    cin >> A[i];
  }
  rep(i,N){
    cin >> B[i];
  }
  rep(i,N){
    if(clock()>500000){
      return 0;
    }
    if(T==0){
      ll K=A[i]^B[0],L=0,P=0;
      if((A[i]^B[0])==(A[(i+1)%N]^B[1])){
        P=1;
      }
      rep(j,N){
        if((A[(i+j)%N]^B[j])!=K){
          L=1;
          break;
        }
      }
      if(L==0){
        cout << i << " " << K << endl;
        T=1;
      }
    }
    else{
      if((A[i]^B[0])==(A[(i+1)%N]^B[1])){
        cout << i << " " << (A[i]^B[0]) << endl;
      }
    }
  }
}

Measured memory_bytes: 6528
#![allow(unused)]

//入力マクロここから
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
//入力マクロここまで

//input
//use std::io::Read;

//collections
//use std::collections::BTreeMap;
//use std::collections::BTreeSet;
//use std::collections::HashMap;
//use std::collections::HashSet;
//use std::collections::VecDeque;
//use std::collections::BinaryHeap;

//use std::cmp::*;

fn main() {
    input! {
        n: usize,
        a: [u64;n],
        b:[u64;n],
        c:[u64;n],
    }

    let mut a = a;
    let mut b = b;
    let mut c = c;

    a.sort();
    b.sort();
    c.sort();

    let mut cnt = 0;
    for x in b {
        let mut ok = -1;
        let mut ng = n as i64;
        while (ng - ok).abs() > 1 {
            let mid = (ok + ng) / 2;
            if a[mid as usize] < x {
                ok = mid;
            } else {
                ng = mid;
            }
        }
        let a_num = ok + 1;

        let mut ok = n as i64;
        let mut ng = -1;
        while (ng - ok).abs() > 1 {
            let mid = (ok + ng) / 2;
            if c[mid as usize] > x {
                ok = mid;
            } else {
                ng = mid;
            }
        }
        let c_num = n as i64 - ng - 1;
        cnt += a_num * c_num;
    }

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


Measured memory_bytes: 8444
#include <bits/stdc++.h>
#define maxn 39
using namespace std;
int n,m,t;
int a[maxn][maxn],b[maxn][maxn],c[maxn][maxn];
char s[maxn];
void op(){
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++)
            printf("%d ",a[i][j]);
        puts("");
    }
}
void Copy(){
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)
            b[i][j]=a[i][j];
}
void Recover(){
     for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)
            a[i][j]=b[i][j];
}
int cancel(bool &ok){
    int ans=0;
    for(int i=1;i<=n;i++){
        int cur=1;
        while(cur<=m){
            int L=cur;
            while(cur+1<=m&&a[i][cur]==a[i][cur+1])
                cur++;
            int R=cur;
            if(R-L+1>=t&&a[i][cur]!=-1){
                ok=1;
                ans+=(R-L+1)*a[i][cur];
                for(int j=L;j<=R;j++)
                    a[i][j]=-1;
            }
            cur++;
        }
    }
    return ans;
}
void drop(bool &ok){
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)
            c[i][j]=a[i][j];
    for(int j=1;j<=m;j++){
        vector<int>tmp;
        for(int i=n;i>=1;i--)
            if(a[i][j]!=-1)
                tmp.push_back(a[i][j]);
        for(int i=0;i<(int)tmp.size();i++)
            a[n-i][j]=tmp[i];
        for(int i=1;i<=n-tmp.size();i++)
            a[i][j]=-1;
    }
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)
            if(a[i][j]!=c[i][j])
                ok=1;
}
int solve(){
    int step=0,ans=0;
    bool tmp;
    drop(tmp);
   // op();
    while(1){
        bool ok=0;
        int val=cancel(ok);
        drop(ok);
        ans+=val*(1<<step);
        step++;
        if(!ok)
            break;
    }
    return ans;
}
int main(){
    int ans=0;
    cin>>n>>m>>t;
    for(int i=1;i<=n;i++){
        scanf("%s",s+1);
        for(int j=1;j<=m;j++)
            a[i][j]=s[j]-'0';
    }

    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            Copy();
            a[i][j]=-1;
            ans=max(ans,solve());
            Recover();
        }
    }
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
int main()
{
    vector<int>v(3);
    for(int i=0;i<3;i++)
    cin>>v[i];
    if(count(v.begin(),v.end(),5)==2&&count(v.begin(),v.end(),7)==1)
    cout<<"YES";
    else
    cout<<"NO";
}

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

using namespace std;

int main() {

	int l, n;
	cin >> l >> n;
	vector<int> x(n), w(n);
	for (int i = 0; i < n; i++)
		cin >> x[i] >> w[i];

	int weight = 0;

	for (int i = 0; i < n; i++) {
		weight += x[i] * w[i];
	}

	if (weight == 0) {
		cout << 0 << endl;
	}
	else if (weight > 0) {
		cout << 1 << endl;
		cout << -1 <<  " " << weight << endl;
	}
	else {
		cout << 1 << endl;
		cout << 1 << " " << -weight << endl;
	}

	return 0;
}


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

using ll = long long;
using ld = long double;

int main()
{
    int n,a;
    cin >> n >> a;
    
    
    if (n%500 <=a) {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**6)
INF = 10 ** 9 + 1  # sys.maxsize # float("inf")
MOD = 10 ** 9 + 7


def debug(*x):
    print(*x, file=sys.stderr)


def solve(SOLVE_PARAMS):
    pass


def main():
    N = int(input())
    ret = False
    count = 0
    for i in range(N):
        a, b = map(int, input().split())
        if a == b:
            count += 1
            if count == 3:
                ret = True
                break
        else:
            count = 0

    if ret:
        print("Yes")
    else:
        print("No")


# tests
T1 = """
5
1 2
6 6
4 4
3 3
3 2
"""
TEST_T1 = """
>>> as_input(T1)
>>> main()
Yes
"""

T2 = """
5
1 1
2 2
3 4
5 5
6 6
"""
TEST_T2 = """
>>> as_input(T2)
>>> main()
No
"""

T3 = """
6
1 1
2 2
3 3
4 4
5 5
6 6
"""
TEST_T3 = """
>>> as_input(T3)
>>> main()
Yes
"""


def _test():
    import doctest
    doctest.testmod()
    g = globals()
    for k in sorted(g):
        if k.startswith("TEST_"):
            doctest.run_docstring_examples(g[k], g, name=k)


def as_input(s):
    "use in test, use given string as input file"
    import io
    f = io.StringIO(s.strip())
    g = globals()
    g["input"] = lambda: bytes(f.readline(), "ascii")
    g["read"] = lambda: bytes(f.read(), "ascii")


input = sys.stdin.buffer.readline
read = sys.stdin.buffer.read

if sys.argv[-1] == "-t":
    print("testing")
    _test()
    sys.exit()

main()


Measured memory_bytes: 62104
import math as M
def R(A): return (A[0]**2+A[1]**2)**.5
def I(i): return [map(int,raw_input().split()) for _ in [0]*i]
def C(a,b): return a>b or abs(a-b)<1e-6
def f(e1):
  tx,ty,sx,sy=e1
  x=[]
  st=[tx-sx,ty-sy]; rst=R(st)
  for e2 in WP:
    wx,wy,r=e2
    wt=[tx-wx,ty-wy]; rwt=R(wt)
    sw=[wx-sx,wy-sy]; rsw=R(sw)
    F=[rwt<r,rsw<r]
    c=1
    if F==[1,0] or F==[0,1]: return 0
    elif F==[0,0]:
      a=M.pi/2-M.acos(r/rsw)
      b=M.acos(round((sw[0]*st[0]+sw[1]*st[1])/rsw/rst,4))
      if C(a,b) and C(rst**2,rsw**2-r**2): return 0
    x.append(c)
  return all(x)

while 1:
  n=input()
  if n==0: break
  WP=I(n)
  P=I(input())
  for e in P: print ["Safe","Danger"][f(e)]

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

int main(){
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    int min_idx = 1e8;
    int min_num = 1e8;
    rep(i, n) {
        cin >> a[i];
        if ( a[i] < min_num ) {
            min_num = a[i];
            min_idx = i;
        }
    }
    int min_cnt = 0;
    rep(i, n) {
        if ( a[i] == min_num ) ++min_cnt;
    }
    if ( min_cnt == n ) {
        cout << 0 << endl;
        return 0;
    }
    if ( n == k ) {
        cout << 1 << endl;
        return 0;
    }
    int left_num = ( min_idx + k - 2 ) / ( k - 1 );  
    int right_num = ( n - left_num * ( k - 1 ) - 1 + k - 2 ) / ( k - 1 );
//    cout << left_num << " " << right_num << endl;
    cout << left_num + right_num << endl;
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <cstring>
#include<vector>
#include <list>
#include<climits>
#include<algorithm>
#include<bitset>
#include<cmath>
#include<functional>
#include <numeric>
#include <map>
#include <tuple>
#include <string>
#define FORi(N) for(int i=0;i<N;++i)
#define FORj(N) for(int j=0;j<N;++j)
#define FORk(N) for(int k=0;k<N;++k)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
ll gcd(ll m,ll n){
  if(n==0)return abs(m);
  return(gcd(n,m%n));
}
void putYN(bool b){
  if(b){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}
void swap(ll &a,ll &b){
  ll tmp=a;
  a=b;
  b=tmp;
}
int main(){
  ll A,B,C,D;
  cin>>A>>B>>C>>D;
  ll CD=C*D;
  /*if(A==B&&A%C!=0&&A%D!=0){
    cout<<1<<endl;
    return 0;
  }
  if(A==B){
    cout<<0<<endl;
    return 0;
  }*/
  A-=1;
  //B-=1;
  ll lowA=(A/CD)*CD;
  ll lowB=(B/CD)*CD;
  ll B_A = B-A;
  ll sum =B_A;
  sum -= B/C+B/D-B/(CD/gcd(C,D));
  sum += A/C+A/D-A/(CD/gcd(C,D));
  
  //if(B_A%CD==0)sum+=1;
  //if(B%CD==0)sum++;
  //if(lowA!=A)
  //sum -= (A-lowA+1)/C+(A-lowA+1)/D;
  //if(upB!=B)
  //sum += (B-lowB+1)/C+(B-lowB+1)/D;
  //else sum-=1;
  //if(lowA==A)sum+=1;
  //if(upB==B)sum+=1;
  cout<<sum<<endl;
  return 0;
  
}


Measured memory_bytes: 256
import java.util.Scanner;


// abc160_d
public class Main {

    public static String Y = "Yes";
    public static String N = "No";
    public static String I = "IMPOSSIBLE";
    public static String B = "Bad";
    public static String G = "Good";

    public static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {

        int n = ni(); // 頂点の個数
        int x = ni(); // xとy（x+1 < y）の間にも辺
        int y = ni();

        int[] count = new int[n - 1];

        x--;
        y--;

        for (int i = 0; i < n - 1; i++) {
            for (int j = i + 1; j < n; j++) {
                // 最小の候補1（X,Yの辺を利用しない場合）
                int mina = Math.abs(i - j);
                // 最小の候補2（X,Yの辺を利用する場合、i⇒X⇒Y⇒jの順番）
                int minb = Math.abs(i - x) + 1 + Math.abs(j - y);
                // 最小の候補3（X,Yの辺を利用する場合、i⇒Y⇒X⇒jの順番）
                int minc = Math.abs(i - y) + 1 + Math.abs(j - x);

                int min = min(min(mina, minb), minc);

                count[min - 1]++;

            }
        }

        for (int res : count) {
            out(res);
        }

    }

    /*
     * 以下メソッド集
     */
    static int ni() {

        return sc.nextInt();
    }

    static long nl() {

        return sc.nextLong();
    }

    static String n() {

        return sc.next();
    }

    static char[] nc() {

        return sc.next().toCharArray();
    }

    static int kaijo(int n) {

        if (n == 0 || n == 1) {
            return 1;
        } else {
            return n * kaijo(n - 1);
        }
    }

    static int fib(int n) {

        return (n == 1 || n == 0) ? n : fib(n - 2) + fib(n - 1);
    }

    static long lcm(long m, long n) {

        return m * n / gcd(m, n);
    }

    static int lcm(int m, int n) {

        return m * n / gcd(m, n);
    }

    static long gcd(long a, long b) {

        return (b == 0) ? a : gcd(b, a % b);
    }

    static int gcd(int a, int b) {

        return (b == 0) ? a : gcd(b, a % b);
    }

    static void out(String info) {

        System.out.println(info);
    }

    static void out(int info) {

        System.out.println(info);
    }

    static void out(double info) {

        System.out.println(info);
    }

    static void out(long info) {

        System.out.println(info);
    }

    static void out(char info) {

        System.out.println(info);
    }

    static void outn(String info) {

        System.out.print(info);
    }

    static void outn(int info) {

        System.out.print(info);
    }

    static void outn(double info) {

        System.out.print(info);
    }

    static void outn(long info) {

        System.out.print(info);
    }

    static void outn(char info) {

        System.out.print(info);
    }

    static int max(int a, int b) {

        return Math.max(a, b);
    }

    static long max(long a, long b) {

        return Math.max(a, b);
    }

    static int min(int a, int b) {

        return Math.min(a, b);
    }

    static long min(long a, long b) {

        return Math.min(a, b);
    }
}

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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int main()
{
    ll i,j;
    ll x,y,z;
    cin >> x >> y >> z;
    swap(x,y);
    swap(x,z);
    cout << x << " " << y << " " << z << endl;

    return 0;
}

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<string> picture_A(N), picture_B(M);
  for (int i = 0; i < N; i++) cin >> picture_A.at(i);
  for (int j = 0; j < M; j++) cin >> picture_B.at(j);
  
  bool answer = false;
  for (int i = 0; i <= N - M; i++) {
    for (int j = 0; j <= N - M; j++) {
      for (int k = 0; k < M; k++) {
        string tmp = picture_A.at(i + k).substr(j, M);
        if (tmp != picture_B.at(k)) break;
        if (k == M - 1) answer = true;
      }
      if (answer) break;
    }
    if (answer) break;
  }
  
  if (answer) cout << "Yes\n";
  else cout << "No\n";
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<queue>
using namespace std;
//1~n個のノードのダイクストラ
//こっちの方が速い
long long inf=100000000000000007;
class Edge{
public:
//int s;
int t;
long long len;
};
class Node{
    public:
    int num;//node番号
    long long dist;//startからの距離
    vector<Edge> edge;//自分から生えている辺
    bool comp;//dijkstra中で到達しているかどうか
    void in_edge(Edge &edge_in){
        edge.push_back(edge_in);
    }  
};
bool operator >(const Node& a,const Node &r){
        return a.dist > r.dist;
    }
void dijkstra(vector<Node> &node,int s,int t,int n){
    //n個のノードでできたグラフのsからtまでの最短距離を計算する
    //この時各要素のdistの値はsからの最短距離となる
    for(int i=1;i<=n;i++){
        //初期化
        node[i].dist=inf;
        node[i].num=i;
        node[i].comp=true;
    }
    node[s].dist=0;
    priority_queue<Node,vector<Node>,greater<Node>> que;
    que.push(node[s]);
    while(!que.empty()){
        Node buf;
        buf=que.top();//
        que.pop();
        int k=buf.num;
        if(node[k].comp){
            node[k].comp=false;
            int edge_num=buf.edge.size();
            for(int i=0;i<edge_num;i++){
                int buf_t=node[k].edge[i].t;
                int buf_len=node[k].edge[i].len;
                if(node[buf_t].dist>node[k].dist+buf_len){
                node[buf_t].dist=node[k].dist+buf_len;
                que.push(node[buf_t]);
                }
            }
        }
    }
}
int main(){
    int n,s,t,m;//n:node_num,s:start_node,t:goal_node,m:edge_num
    cin>>n>>m;
    s=1;
    t=n;
    vector<Node> node(n+1);
    for(int i=n;i>1;i--){
        Edge pri;
        pri.t=i-1;
        pri.len=0;
        node[i].in_edge(pri);
    }
    for(int i=0;i<m;i++){
        int a,b;
        long long l;
        cin>>a>>b>>l;
        Edge in;
//        in.s=a;
        in.t=b;
        in.len=l;
        node[a].in_edge(in);//有向グラフの場合ここまで
//        in.s=b;
        in.t=a;
        node[b].in_edge(in);//無向グラフの場合こっちも
    }
    dijkstra(node,s,t,n);
    if(node[t].dist==inf)node[t].dist=-1;
    cout<<node[t].dist<<endl;
    return 0;
}

Measured memory_bytes: 24752
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
char s[SIZE];
int dp[SIZE];
template <class T>
void maa(T& x,T y){
    if(x<y)x=y;
}
template <class T>
void mii(T& x,T y){
    if(x>y)x=y;
}
int main(){
    RS(s);
    int n=LEN(s);
    REP(i,n){
        if(s[i]=='<'){
            maa(dp[i+1],dp[i]+1);;
        }
    }
    for(int i=n-1;i>=0;i--){
        if(s[i]=='>'){
            maa(dp[i],dp[i+1]+1);
        }
    }
    LL an=0;
    FOR(i,0,n)an+=dp[i];
    W(an);
    return 0;
}


Measured memory_bytes: 4608