akhauriyash/Code-Regression huggingface dataset:
// She is Pretty pretty!
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define ll long long
#define ff first
#define ss second
#define mp make_pair
#define pb push_back

const int N = 1e6 + 100;
struct Node {
    ll w, s, v;
} a[N];
int dp[N];
bool cmp(Node a, Node b) { return a.w + a.s < b.w + b.s; }
int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i].w >> a[i].s >> a[i].v;
    }
    sort(a + 1, a + 1 + n, cmp);
    for (int i = 1; i <= n; i++) {
        for (int j = 2e4+10; j >= a[i].w; j--) {
            if (a[i].s + a[i].w >= j) {
                dp[j] = max(dp[j], dp[j - a[i].w] + a[i].v);
            }
        }
    }
    cout << *max_element(dp + 1, dp + 20000+10) << endl;
    return 0;
}

Measured memory_bytes: 2432
#include<stdio.h>

int dp[50];

int fib( int n ){
	if( n == 0 || n == 1 ){
		return dp[n] = 1;
	}
	if( dp[n] != -1 ){
		return dp[n];
	}
	return dp[n] = fib(n-1) + fib(n-2);
}

int main( void ){
	
	int n , i;
	for( i = 0; i < 50; i++ ){
		dp[i] = -1;
	}
	
	scanf( "%d" , &n );
	printf( "%d\n" , fib(n));
	
	return 0;
}


Measured memory_bytes: 2104
#include <bits/stdc++.h>
#include <string>
#include <stdlib.h>
#include <iostream>

using namespace std;

int main(){

    int r;
    int ans;

    cin >> r;

//    for(int i=1; i<101; i++){
//        ans=(i*i*3.14)/3.14;
//        cout << ans << endl;
//    }
    ans=r*r;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn=5005;
int k,n,cnt;
struct cmp {
	bool operator() (string x,string y) {
		return x<y;
	}
};
priority_queue<string,vector<string>,cmp> q;
char s[maxn];
map<string,bool> M;
int main() {
	//freopen("1.txt","r",stdin);
	scanf("%s",s+1);
	scanf("%d",&k);
	n=strlen(s+1);
	for (int i=1;i<=n;i++) {
		string t="";
		for (int j=i;j<=n&&i+k>j;j++) {
			t+=s[j];
			if (M[t]) continue;
			M[t]=1;
			q.push(t);
			cnt++;
			if (cnt>k) q.pop(),cnt--;
		}
	}
	cout<<q.top()<<endl;
	return 0;
}

Measured memory_bytes: 1920
d = []
n = int(input())
for _ in range(n):
    q = list(map(int,input().split()))
    if q[0] == 0:
        d.append(int(q[1]))
    if q[0] == 1:
        print (d[int(q[1])])
    if q[0] == 2:
        d.pop()



Measured memory_bytes: 13368
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i < (n); i++)
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}

int main()
{
    int N, M; cin >> N >> M;
    vector<int> A(N); cin >> A;
    int sum = accumulate(A.begin(), A.end(), 0);
    int c = 0;
    for (int a : A) {
        if (4 * M * a >= sum) {
            c++;
        }
    }
    cout << (c >= M ? "Yes" : "No") << endl;
}


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

int main() {
    int a, b;
    cin >> a >> b;
    int v = 0;
    for (int i = 0; i < 10005; i++) {
        if ((i * 8 / 100 == a) && (i / 10 == b)) {
            v = i;
            break;
        }
    }
    if (v == 0) {
        cout << -1 << endl;
    } else {
        cout << v << endl;
    }
    return 0;
}

Measured memory_bytes: 3624
import java.util.*;
import java.lang.*;

class Main {
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int H[] = new int[N];
        for(int i = 0; i < N; i++){
            H[i] = Integer.parseInt(sc.next());
        }

        int i = 0;
        int j = 0;
        int count = 0;
        int maxCount = 0;

        while(i < N){
            j = i;
            count = 0;
            while(j < N-1){
                if(H[j] >= H[j+1]){
                    count ++;
                    j ++;
                } else {
                    break;
                }
            }
            maxCount = Math.max(maxCount, count);
            i += count + 1;
        }


        System.out.println(maxCount);

    }
}





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

#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define endl '\n'

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;

const ll mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// head

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

    string s;
    cin >> s;
    if(s.back() == 's') {
        s += "es";
    } else {
        s += "s";
    }
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 3664
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
	int n,m,k;
	int ans = 0, cnt = 0;
	scanf("%d%d%d",&n,&m,&k);
	int Max = max(n, m);
	int Min = min(n, m);
	while(Min > 0)
	{
		cnt++;
		ans += Max;
		Min --;
		if(ans >= k)	break;
	}
	printf("%d",cnt);
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define int long long
#define mod 1000000007
#define INF LLONG_MAX/5
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1)*x%mod;
}
int mypow(int x, int y, int mood) {
	int res = 1;
	while (y > 0) {
		if (y & 1)res = res * x%mood;
		x = x * x%mood;
		y >>= 1;
	}
	return res;
}
signed main(){
	int a;
	cin>>a;
	printf("%.100lf",((a+1)/2)/(double)(a));
}


Measured memory_bytes: 256
import math

def comb(n, r):
    if r < 0 or r > n:
        return 0

    if r == 1:
        return n
    elif r == 2:
        return n* (n - 1) / 2
    else:
        return n * (n - 1) * (n - 2) / 6

def solve(i, k, smaller):
    if i == N:
        if k == 0:
            return 1
        else:
            return 0

    if k == 0:
        return 1

    if smaller:
        return comb(N - i, k) * math.pow(9, k)
    else:
        if S[i] == "0":
            return solve(i + 1, k, False)
        else:
            zero = solve(i + 1, k, True)
            aida = solve(i + 1, k - 1, True) * (int(S[i]) - 1)
            icchi = solve(i + 1, k - 1, False)
            return int(zero + aida + icchi)

S = input()
K = int(input())
N = len(S)

print(solve(0, K, False))


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

typedef long long ll;

int main() {
	ll n, m, mcd = 0, mcm = 1;
	ll ans;
	vector <ll> a;
	cin >> n >> m;
	a.resize(n);
	//sort();
	for(int i = 0; i < n; i++) {
		cin >> a[i];
		mcd = __gcd(mcd, a[i]);
	}
	for(int i = 0; i < n; i++) {
		a[i] /= mcd;
		if (a[i] % 2 == 0) {
			printf("%d\n", 0);
			return 0;
		}
	}
	mcm = a[0];
	for(int i = 1; i < n; i++) {
		mcm = a[i] * mcm / __gcd(a[i], mcm);
		if (mcm > 2 * m / mcd) {
			printf("%d\n", 0);
			return 0;
		}
		
	}
	
	ans = (2ll * m / (1ll * mcm * mcd) + 1) / 2;
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 1024
# your code goes here
A,B,C,X,Y = map(int,input().split())

if A + B < 2*C:
	print(X*A+B*Y)
else:
	ans1 = 2*C*max(X,Y)
	if X > Y:
		ans2 = 2*C*Y + A*(X-Y)
	else:
		ans2 = 2*C*X + B*(Y-X)
	print(min(ans1,ans2))

Measured memory_bytes: 3060
n = int(input())
li = list(map(int, input().split()))

li.sort(reverse=True)

vert = {}
even = []
ans = 0

for i in li:
	if i in vert:
		vert.pop(i)
		even.append(i)
		if len(even) == 2:
			ans = even[0] * even[1]
			break
	else:
		vert[i] = 1
print(ans)


Measured memory_bytes: 14252
#include <iostream>
#include <algorithm>
#include <string.h>

int N_MAX = 1000;

int N;

using namespace std;

int main(int argc, const char * argv[]) {
    int L[N_MAX];
    int i;
    
    memset(L, 0, sizeof(L));
    
    cin >> N;
    for(i = 0; i < 2*N; i++) {
        cin >> L[i];
    }
    
    sort(L, L+2*N);
    
    int sum = 0;
    for(i = 0; i < N; i++) {
        sum += min(L[2*i],L[2*i+1]);
    }
    
    cout << sum << endl;
    
    return 0;
}


Measured memory_bytes: 256
use std::str::FromStr;
use std::io::stdin;

fn main() {
    let (a, b) = {
        let vec: Vec<i32> = read_vec();
        (vec[0], vec[1])
    };
    let vec = vec![a + b, a - b, a * b];
    println!("{}", vec.iter().max().unwrap());
}

fn read_vec<T: FromStr>() -> Vec<T> {
    let mut line = String::new();
    stdin().read_line(&mut line).ok();
    line.trim().split_whitespace()
        .map(|i| i.parse().ok().unwrap()).collect()
}

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

#define all(A) begin(A), end(A)
#define rall(A) rbegin(A), rend(A)
#define sz(A) int(A.size())
#define pb push_back
#define mp make_pair

using namespace std;

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

int main () {
  ios::sync_with_stdio(false); cin.tie(0);
  int n;
  cin >> n;
  vector <int> a(n + 1);
  vector <int> vis(n + 1, 0);
  for (int i = 1; i <= n; i++) cin >> a[i];
  vector <int> ans;
  for (int i = n; i >= 1; i--) {
    int sum = 0;
    for (int j = i + i; j <= n; j += i) sum += vis[j];
    sum %= 2;
    if (sum == 0 and a[i] == 1) {
      ans.pb(i);
      vis[i] = 1;
    } else if (sum == 1 and a[i] == 0) {
      ans.pb(i);
      vis[i] = 1;
    }
  }
  cout << sz(ans) << '\n';
  for (int i = sz(ans) - 1; i >= 0; i--) cout << ans[i] << " \n"[i == 0];
  return (0);
}


Measured memory_bytes: 3192
#include<cstdio>
using namespace std;

int n, m, a[10][10], maxN = 0;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int dfs(int y, int x, int counter) {
  int ans = 0;
  for (int i = 0; i < 4; i++) {
    int ny = y, nx = x;
    while (1) {
      ny += dy[i], nx += dx[i];
      if (ny < 0 || nx < 0 || ny >= n || nx >= m) break;
      // if (a[ny][nx] == -1) break;
      if (a[ny][nx] == 1) {
        if (counter > 0) {
          a[ny][nx] = -1;
          ans += dfs(ny, nx, counter - 1);
          a[ny][nx] = 1;
        }
        break;
      }
      if (a[ny][nx] == 2 && counter == 0) return 1;
    }
  }
  return ans;
}

int main() {
  while (1) {
    scanf("%d%d", &m, &n);
    if (m == 0) break;
    int cx, cy;
    maxN = 0;
    for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) {
      scanf("%d", &a[i][j]);
      if (a[i][j] == 2) cy = i, cx = j;
      if (a[i][j] == 1) maxN++;
    }
    printf("%d\n", dfs(cy, cx, maxN));
  }
}



Measured memory_bytes: 2700
#include <bits/stdc++.h>
#ifdef BUG
    #include "debug.hpp"
#else
    #define DEBUG(var)
#endif

using namespace std;
template< class T1, class T2 > inline istream &
operator>>( istream & fin, pair< T1, T2 > & pr )
{ fin >> pr.first >> pr.second; return fin; }
template< class T0, class T1, class T2 > inline istream &
operator>>( istream & fin, tuple< T0, T1, T2 > & t )
{ fin >> get<0>(t) >> get<1>(t) >> get<2>(t); return fin; }
template< class T > inline istream &
operator>>( istream & fin, vector< T > & a ) {
for(auto & u: a) fin >> u; return fin; }
template<class T, size_t n> inline istream &
operator>>( istream & fin, array<T, n> & a ) {
for(auto & u: a) fin >> u; return fin; }
template<class FwdIter> inline auto
dump(FwdIter first, FwdIter last, const char * dlm = " ") -> void {
typedef typename iterator_traits<FwdIter>::value_type value_type;
copy(first, last, ostream_iterator<value_type>(cout, dlm)); }
template<typename T> vector<T> & operator--(vector<T> & a)
{ for(auto & i: a) --i; return a; }
/* @@@ ----------------------------------- */


int main(const int argc, char * argv [])
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  size_t n;
  int64_t l, t;
  cin >> n >> l >> t;
  vector<pair<int64_t, size_t>> xs(n);
  cin >> xs;

  vector<pair<int64_t, size_t>> a;
  a.reserve(n);

  for(const auto & pr: xs)
  {
    const auto inc = pr.second == 1 ? t : -t;
    const auto x = ((pr.first + inc) % l + l) % l;
    const auto i = a.size();
    a.emplace_back(x, i);
  }

  sort(begin(a), end(a));
  DEBUG(a);

  // dump(begin(a), end(a), "\n");
  {
    const auto i = a.front().second;
    int64_t k = 0;

    for(size_t j = 0; j < xs.size(); ++ j)
      if(xs[i].second != xs[j].second)
      {
        // distance to travel to meet first
        int64_t dx = xs[i].second == 1
          ? xs[j].first - xs[i].first
          : xs[i].first - xs[j].first;

        if(dx < 0) dx += l;

        if(dx < 2 * t + 1)
        {
          const auto inc = (2 * t - dx) / l;
          k += inc + 1;
        }
      }

    DEBUG(k);
    k %= (int64_t) n;

    if(xs[i].second == 1)
      k = (i + k) % n;
    else
      k = (i + n - k) % n;

    DEBUG(k);

    rotate(begin(a), begin(a) + (n - k) % n, end(a));
  }

  for(const auto & pr: a)
    cout << pr.first << '\n';

  return EXIT_SUCCESS;
}



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


const int N = 2e5+100;

struct Cor{
	int x, y, id;
}p[N];
bool cmp(Cor &a, Cor &b){
	return a.x < b.x;
}
int fa[N], sum[N], out[N];
set<int>st;

int find(int x){
	return fa[x] == x ? x : fa[x] = find(fa[x]);
}
void _union(int x, int y){
	int xr = find(x), yr = find(y);
	if(xr < yr) swap(xr, yr); 
	fa[xr] = yr;
	sum[yr] += sum[xr];
}
int main(){
	int n;
	cin >> n;
	for(int i = 1; i <= n; i++){
		cin >> p[i].x >> p[i].y;
		p[i].id = i;
	}		
	sort(p+1, p+n+1, cmp);
	for(int i = 0; i <= n; i++){
		fa[i] = i;
		sum[i] = 1;
	}
	for(int i = 1; i <= n; i++)	{
		while(st.size() && *st.begin()< p[i].y){
			_union(p[i].y, (*st.begin()));
			st.erase(st.begin());
		}
		st.insert(find(p[i].y));
	}
	for(int i = 1; i <= n; i++){
		out[p[i].id] = sum[find(p[i].y)];
	}
	for(int i = 1; i <= n; i++){
		cout << out[i] << endl;
	}
}

Measured memory_bytes: 12376
#include <vector>
#include <array>
#include <map>
#include <string>
#include <algorithm>
#include <iostream>
#include <set>
#include <random>
#include <cassert>
#include <fstream>

const int MOD = 1e9 + 7;
using namespace std;
bool is_prime(int n) {
    for (int i = 2; i < n; ++i) {
        if (n % i == 0) {
            return false;
        }
    }
    return true;
}
int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    int n;
    cin >> n;
    int a, b;
    cin >> a >> b;
    vector<int> x(n + 1);
    for (int i = 1; i <= n; ++i) {
        cin >> x[i];
    }
    int64_t ans = 0;
    for (int i = 2; i <= n; ++i) {
        int dist = x[i] - x[i - 1];
        ans += min<int64_t>(1ll * dist * a, b);
    }
    cout<<ans;
}



Measured memory_bytes: 640
import java.util.*;

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

    int count = 5;
    int[] list = new int[count];
    for (int i = 0; i < count ; i++ ) {
      list[i] = sc.nextInt();
    }

    int loss = 0;
    int maxLoss = 0;
    int result = 0;

    for (int i = 0; i < count; i++ ) {
      int order = list[i];

      if (order % 10 == 0) {
        loss = 0;
      } else {
        loss = 10 - (order % 10);
        maxLoss = Math.max(loss, maxLoss);
      }

      result += order + loss;
    }
    System.out.println(result - maxLoss);
  }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define rep(i,k,n) for(int i = k; i < n; i++)  
#define repp(i,k,n) for(int i = k; i <= n; i++) 
#define per(i,k,n) for(int i = k; i >= n; i--)

#define int long long
#define all(a) a.begin(),a.end()       

#define pb push_back
typedef long long ll; 
typedef pair<int, int> ii;
typedef pair<int,ii > iii; 
typedef vector<ii> vii;
typedef vector<char> vchar;
typedef vector<int> vi;
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound

#define mem(a, b) memset(a, b, sizeof(a));
#define mem0(a) memset(a, 0, sizeof(a));

#define INF 1000000000
//#define mod 998244353
#define mod 1000000007
#define endl "\n"


   //=\/=\/=\/=\/=\/=\/=\/=\/=\/=\        Jai Hind Dosto        /=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\\
  //=\/=\/=\/=\                    ̿̿ ̿̿ ̿̿ ̿'̿'\̵͇̿̿\з= ( ▀ ͜͞ʖ▀) =ε/̵͇̿̿/’̿’̿ ̿ ̿̿ ̿̿ ̿̿                             /=\/=\/=\/=\\
 //=\/=\/=\/=\                                                                               /=\/=\/=\/=\\
//=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\\



int modPow(int a, int b);           

                
void solve(){
    int n,k ;
    cin >> n >> k ;
    int a[n];
    rep(i,0,n)cin >> a[i];
    int l =1, r = 1e9;
    int ans = 0;
  //  cout << ans <<endl;
    while(l<=r){
        int mid = l + (r-l)/2;
        int sum = 0;
        rep(i,0,n){
            sum += a[i]/mid + (a[i]%mid>0) -1;
        }
        if(sum>k){
           // cout << mid <<endl;
            l = mid+1;
        }else if(sum<k){
            ans = mid;
            r = mid-1;
        }else{
            ans = mid;
            r = mid-1;
        }
    }
    cout << ans << endl;
    
}






signed main(){

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //cout << fixed;
    //cout <<setprecision(6);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    
   // int test=1; cin >> test; while(test--)
    solve();
}

int modPow(int a, int b){
    if(b==0)return 1;
    if(b%2==0){
        int x = a*a;
        x%=mod;
        return modPow(x,b/2);
    }
    return (a*modPow(a,b-1))%mod;
}




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

int main()
{

	long long X;
	cin >> X;

	long long count = 0;
	long long sum = 100;

	while(sum < X){
		count++;
		sum *= 1.01;
	}


	cout << count << endl;
	return 0;
}

Measured memory_bytes: 3636
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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

const ll mod=1e9+7;

ll dp[100005][15];

int main()
{
    string s;
    cin >> s;
    ll n=s.length();
    vector<ll> p(n);
    ll v=1;
    rep(i,n){
        p[i]=v;
        v*=10;
        v%=13;
    }
    dp[0][0]=1;
    for(ll i=0;i<n;i++){
        rep(j,13){
            if(s[n-1-i]=='?'){
                rep(k,10){
                    dp[i+1][(j+k*p[i]%13)%13]+=dp[i][j];
                    dp[i+1][(j+k*p[i]%13)%13]%=mod;
                }
            }
            else{
                ll num=(ll)(s[n-1-i]-'0');
                dp[i+1][(j+num*p[i]%13)%13]+=dp[i][j];
                dp[i+1][(j+num*p[i]%13)%13]%=mod;
            }
            
        }
    }
    cout  << dp[n][5] << endl;
    return 0;
} 

Measured memory_bytes: 12928
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
 
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
        return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

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

        int ans = 0;

        REP(i, n) {
                if (i + 3 <= n && s.substr(i, 3) == "ABC") {
                        ans++;
                }
        }

        cout << ans << endl;

        return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
 
int main(void){
    int i,j,k,a,b,dice[2][7],
        side[5] = {2,3,5,4,2},
        n = 0;
     
    for(i=0;i<2;i++)
      for(j=1;j<7;j++)
        scanf("%d", &dice[i][j]);
    
    for(i=0;i<6;i++){
      if(dice[0][1]==dice[1][1])
        for(j=0;j<4;j++){

  //一致判定
          for(k=1;k<7;k++)
            if(dice[0][k]!=dice[1][k]) break;
 
          if(k==7){
            printf("Yes\n");
            return 0;
          }

  //スピン
          dice[1][0] = dice[1][2];
          dice[1][2] = dice[1][3];
          dice[1][3] = dice[1][5];
          dice[1][5] = dice[1][4]; 
          dice[1][4] = dice[1][0]; 

      
      }
         
       //回転  
     
      dice[1][0] = dice[1][1];
         
      switch(i){
                 
          case 2:
              dice[1][1] = dice[1][3];
              dice[1][3] = dice[1][6];
              dice[1][6] = dice[1][4];
              dice[1][4] = dice[1][0]; 
              break;
             
          default:
              dice[1][1] = dice[1][2];
              dice[1][2] = dice[1][6];
              dice[1][6] = dice[1][5];
              dice[1][5] = dice[1][0]; 
              break;
        
          }
    }

    printf("No\n");
    return 0;
}

Measured memory_bytes: 580
package main

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

var (
	BufferSize = 100
)

func readLine(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func scanStr(sc *bufio.Scanner) string {
	if !sc.Scan() {
		panic(nil)
	}
	return sc.Text()
}

func scanInt(sc *bufio.Scanner) int {
	if !sc.Scan() {
		panic(nil)
	}
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	buf := make([]byte, BufferSize)
	sc.Buffer(buf, BufferSize)
	sc.Split(bufio.ScanWords)

	number := scanInt(sc)

	upper := number / 100
	lower := number % 100

	// 上二けたでMMある場合
	if 1 <= upper && upper <= 12 {
		if 1 <= lower && lower <= 12 {
			fmt.Println("AMBIGUOUS")
		} else {
			fmt.Println("MMYY")
		}
	} else if 1 <= lower && lower <= 12 {
		fmt.Println("YYMM")
	} else {
		fmt.Println("NA")
	}
}


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

using namespace std;

int main(){
  int K, N;
  cin >> K >> N;
  
  vector<int> A(N);
  for(int i = 0; i < N; i++) cin >> A[i];
  
  int dist = A[N - 1] - A[0];
  for(int i = 0; i < N - 1; i++){
    dist = min(K - (A[i + 1] - A[i]), dist);
  }
  
  cout << dist << endl;
  
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h> 
#define ll long long int
#define ld long double
#define ull unsigned long long
const double pi=3.14159265358979323846;
using namespace std;

bool isPrime(int n) 
{ 
    // Corner cases 
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
  
    // This is checked so that we can skip 
    // middle five numbers in below loop 
    if (n % 2 == 0 || n % 3 == 0) 
        return false; 
  
    for (int i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
  
    return true; 
} 
ll bigd(ll n) 
{
    ll in=1;
    for (ll i =2; i < n; i++)
    {
        if (n % i == 0) 
        {
            in= i;
            break;
        }    
    }   
    return in;
} 

ll ipow(ll base, ll exp)
{
    ll result = 1;
    for (;;)
    {
        if (exp & 1)
            result *= base;
        exp >>= 1;
        if (!exp)
            break;
        base *= base;
    }
    return result;
}
int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
    char c;
    cin>>c;
    if(c>='A' && c<='Z')
    cout<<"A"<<"\n";
    else
    cout<<"a"<<"\n";

}

Measured memory_bytes: 3632
import math
a, b, x = map(int, input().split())

if x < a*a*b/2:
    l = 2*x/b/a
    print(math.atan(b/l)*180/math.pi)
else:
    l = 2*x/a/a-b
    print(math.atan((b-l)/a)*180/math.pi)

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

H, N = map(int, input().split())
A = [0] * N
B = [0] * N
for i in range(N):
    a, b = map(int, input().split())
    A[i] = a
    B[i] = b
INF = 10**10
dp = [INF] * (H+1)
dp[0] = 0
for i in range(N):
    for j in range(H+1):
        dp[j] = min(dp[j], dp[max(0, j-A[i])]+B[i])
print(dp[H])


Measured memory_bytes: 42552
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e3+3;
int n,m;
string s[N];
int l[N][N],r[N][N],u[N][N],d[N][N];
int main(){
    ios::sync_with_stdio(false);
    cin>>n>>m;
    for(int i=1;i<=n;i++){
        cin>>s[i];s[i]="#"+s[i]+'#';
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
//            cout<<s[i][j];
            l[i][j]=(s[i][j]=='.'?l[i][j-1]+1:0);
//            cout<<l[i][j]<<endl;
        }
    }
    for(int i=1;i<=n;i++){
        for(int j=m;j>=1;j--){
            r[i][j]=(s[i][j]=='.'?r[i][j+1]+1:0);
        }
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            u[i][j]=(s[i][j]=='.'?u[i-1][j]+1:0);
        }
    }
    for(int i=n;i>=1;i--){
        for(int j=m;j>=1;j--){
            d[i][j]=(s[i][j]=='.'?d[i+1][j]+1:0);
        }
    }
    int ans=0;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            if(l[i][j]+u[i][j]+r[i][j]+d[i][j]-3>ans){
                ans=l[i][j]+u[i][j]+r[i][j]+d[i][j]-3;
//                cout<<i<<' '<<j;
            }
//            ans = max(ans,);
        }
    }
    cout<<max(ans,0)<<endl;
}


Measured memory_bytes: 70912
#include <stdio.h>

int main(void) {
  int a, b, c, tmp;
  scanf("%d %d %d", &a, &b, &c);

  for(int i = 0; i <= 3; i++) {
    if(a < b) {
      tmp = a;
      a = b;
      b = tmp;
    }
    if(b < c) {
      tmp = b;
      b = c;
      c = tmp;
    }
  }

  (a == (b + c)) ? printf("Yes\n"):printf("No\n");

  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

ll mod = 1000000007;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n;
    cin >> n;
    string s, t;
    cin >> s >> t;
    ll res = 3, type = 0, id = 1;
    if(s[0] != t[0]){
        type = 1;
        id++;
        res *= 2;
    }
    while(id < n){
        if(s[id] != t[id]){
            if(type) res *= 3;
            else res *= 2;
            type = 1;
            id++;
        }
        else{
            if(!type) res *= 2;
            type = 0;
        }
        res %= mod;
        id++;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
f=input; from bisect import bisect_left as g, insort as h
d={chr(97+i):[] for i in range(26)}
f(); s,i=list(f()),0
for c in s: d[c]+=[i]; i+=1
for _ in range(int(f())):
  a,b,c=f().split(); b=int(b)-1
  if a>'1': print(sum(1 for l in d.values() if g(l,b)<len(l) and l[g(l,b)]<int(c)))
  elif s[b]!=c: l=d[s[b]]; l.pop(g(l,b)); s[b]=c; h(d[c],b)

Measured memory_bytes: 28936
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int S = a * b;
		int C = 2*(a + b);
		System.out.println(S + " " + C);
		sc.close();
	}
}


Measured memory_bytes: 26392
N, K = map(int, input().split())
dp = [float('inf') for _ in range(N)]
h = list(map(int, input().split()))
dp[0] = 0
dp[1] = abs(h[1]-h[0])
for i in range(2, N):
    for k in range(1,min(K, i)+1):
        dp[i] = min(dp[i], dp[i-k]+abs(h[i]-h[i-k]))
print(dp[-1])

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

using namespace std;

#define S scanf
#define P printf
#define G getline
#define SZ size()
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define FI first
#define SE second
#define PI acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB push_back
#define PPF pop_front()
#define PPB pop_back()
#define MP make_pair
#define LL long long int
#define ULL unsigned long long int
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>
#define PLI pair<long long int,int>
#define PLL pair<long long int,long long int>
#define MII map<int,int>
#define MSI map<string,int>
#define MIS map<int,string>
#define MLI map<long long int,int>
#define FAST() ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)

LL big_mod(LL val,LL pow,LL mod);
LL mod_inverse(LL val,LL mod);




V<pair<PSI,int> >v;

bool compare(pair<PSI,int>x , pair<PSI,int>y)
{
    if(x.FI.FI < y.FI.FI)
    {
        return true;
    }
    if(x.FI.FI == y.FI.FI)
    {
        if(x.FI.SE > y.FI.SE)
        {
            return true;
        }
    }
    return false;
}

int main()
{
    FAST();

//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);

    int i,n,x;
    string s;
    cin >> n;
    for(i=1;i<=n;i++)
    {
        cin >> s >> x;
        v.PSB(MP(MP(s,x),i));
    }
    sort(v.B,v.E,compare);
    for(i=0;i<n;i++)
    {
        cout << v[i].SE << '\n';
    }
    return 0;
}







LL big_mod(LL val,LL pow,LL mod)
{
    LL res = 1;
    val = val % mod;
    while(pow > 0)
    {
        if(pow & 1)
        {
            res = (res*val) % mod;
        }
        pow = pow >> 1;
        val = (val*val) % mod;
    }
    return res;
}

LL mod_inverse(LL val,LL mod)
{
    LL mod1 = mod;
    if(mod == 1)
    {
        return 0;
    }
    LL y = 0;
    LL x = 1;
    LL quotient,temp;
    while(val > 1)
    {
        quotient = val / mod;
        temp = mod;
        mod = val % mod;
        val = temp;
        temp = y;
        y = x - quotient * y;
        x = temp;
    }
    if(x < 0)
    {
        x += mod1;
    }
    return x;
}


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

class F
{
	static void Main()
	{
		var n = long.Parse(Console.ReadLine());

		var r = Divisors(n - 1).Length - 1;

		r += Divisors(n).Skip(1).Count(k =>
		{
			var x = n;
			while (x % k == 0) x /= k;
			return x % k == 1;
		});
		Console.WriteLine(r);
	}

	static long[] Divisors(long n)
	{
		var r = new List<long>();
		for (long x = 1; x * x <= n; ++x) if (n % x == 0) r.Add(x);
		var i = r.Count - 1;
		if (r[i] * r[i] == n) --i;
		for (; i >= 0; --i) r.Add(n / r[i]);
		return r.ToArray();
	}
}


Measured memory_bytes: 28120
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 4e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//

int main() {
    init();
    string S;
    cin >> S;
    ll n = 0;
    rep(i, S.size())(n += S[i] - '0') %= 9;

    cout << (n == 0 ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3780
#include <bits/stdc++.h>
using namespace std;
#define Hello ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define endl '\n'
int main()
{
    Hello
    ll l, r, ans = 1e18;
    cin >> l >> r;
    if(r - l + 1 >= 2019)
        cout << 0;
    else{
        for(ll i = l; i <= r; i++){
            for(ll j = i + 1; j <= r; j++){
                ans = min(ans, (i * j) % 2019);
            }
        }
        cout << ans;
    }
    return 0;
}

Measured memory_bytes: 256
n = int(input())
MinNum = [10**4 for i in range(26)]
Alphabet = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", \
    "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
for i in range(n):
    s = input()
    for j in range(26):
        MinNum[j] = min(MinNum[j], s.count(Alphabet[j]))

ans = ""
for i in range(26):
    if MinNum[i] > 0:
        ans += Alphabet[i] * MinNum[i]

print(ans)

Measured memory_bytes: 3064
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<double,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
double gr[1010][1010];
double x[1010],y[1010],r[1010];
double dp[1010];
bool sumi[1010];
priority_queue<pint> q;
void aedge(int x,double y){
	if(dp[x]<=y) return;
	q.push(mp(-y,x));dp[x]=y;
}
double sq(double a){return a*a;}
int main()
{
	int n;
	cin>>x[0]>>y[0]>>x[1]>>y[1];r[0]=r[1]=0;
	cin>>n;
	rep(i,n) cin>>x[2+i]>>y[2+i]>>r[2+i];
	rep(i,n+2) rep(j,n+2){
		double d=sqrt(sq(x[i]-x[j])+sq(y[i]-y[j]));
		gr[i][j]=max(0.0,d-r[i]-r[j]);
		//cout<<i<<' '<<j<<' '<<gr[i][j]<<endl;
	}
	memset(sumi,false,sizeof(sumi));
	rep(i,1005) dp[i]=1e11;
	aedge(0,0);
	while(!q.empty()){
		pint p=q.top();q.pop();
		int x=p.se;double y=-p.fi;
		//cout<<x<<' '<<y<<endl;
		if(sumi[x]) continue;
		sumi[x]=true;
		rep(i,n+2) aedge(i,y+gr[x][i]);
	}
	printf("%.12f\n",dp[1]);
}


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

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

  ll ab,ac,ad,bc,bd,cd;
  ab = a*b;
  ac = a*c;
  ad = a*d;
  bc = b*c;
  bd = b*d;
  cd = c*d;
  ll ans = max(ac,max(ad,max(bc,bd)));
cout << ans << endl;

}

Measured memory_bytes: 3632
N = int(input())
A = list(map(int, input().split()))

rates = [0 for _ in range(8)]
gold = 0
for a in A:
    rate = a // 400
    if rate < 8:
        rates[rate] += 1
    elif rate >= 8:
        gold += 1

ansMin = 8 - rates.count(0)
if ansMin == 0:
    ansMin = 1
ansMax = min(ansMin + gold, N)
print(str(ansMin) + ' ' + str(ansMax))


Measured memory_bytes: 3060
# coding:utf-8

import itertools
from collections import defaultdict


N = int(input())

D = defaultdict(int)
for _ in range(N):
    S = input()[0]
    D[S] += 1

ans = 0
for a, b, c in itertools.combinations('MARCH', 3):
    ans += D[a] * D[b] * D[c]

print(ans)


Measured memory_bytes: 3572
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>


using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;

#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i,a,b) for(int i = (a); i < (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(v) ((int)v.size())

#define pb push_back
#define mp make_pair
#define mt make_tuple

int main(void)
{
    cin.sync_with_stdio(false);
    int D, G;
    cin >> D >> G;
    vector<int> P(D);
    vector<int> C(D);
    REP(d, D) {
        cin >> P[d] >> C[d];
    }
    vector<int> shff(D);
    REP(d, D) shff[d] = d;

    int ans = 1e9;
    do {
        int score = 0;
        int i = 0;
        int cnt = 0;
        for(auto d: shff) {
            auto point = (d + 1) * 100;
            auto need = ((G - score) + (point - 1)) / point;
            if (need <= P[d]) {
                cnt += need;
                break;
            }
            else {
                cnt += P[d];
                score += point * P[d] + C[d];
                if (score >= G) break;
            }
        }
        ans = min(ans, cnt);
    } while(next_permutation(ALL(shff)));
    cout << ans << endl;
    return 0;
}


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

int main() {
    int n;
    cin >> n;
    vector<pair<string, int>> l(n);
    for (int i = 0; i < n; i++)
        cin >> l[i].first >> l[i].second;
    string x;
    cin >> x;
    
    int y;
    for (int i = 0; i < n; i++) {
        if (l[i].first == x) {
            y = i;
            break;
        }
    }

    int ans = 0;
    for (int i = y+1; i < n; i++) {
        ans += l[i].second;
    }

    cout << ans << endl;    
}

Measured memory_bytes: 3644
import fractions
N = int(input())
A = list(map(int, input().split()))

L = [0]
R = [0]

for i in range(N):
    L.append(fractions.gcd(L[i],A[i]))
    R.append(fractions.gcd(R[i],A[N-i-1]))
R.reverse()

ans = 0

for i in range(N):
    ans = max(ans,fractions.gcd(L[i],R[i+1]))
    
print(ans)

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


void solve(long long N, long long x, std::vector<long long> a){
    ll cnt = 0;
    ll over;
    if(N == 2) {
        cout << max(0LL, a[0]+a[1]-x) << endl;
        return;
    }
    //* N >= 3
    for(ll i=0; i<N-2; i++){
        over = max(0LL, a[i]+a[i+1] - x);
        if(over > 0){
            a[i+1] = max(0LL, a[i+1]-over);
            cnt += over;
        }
    }
    cnt += max(0LL, a[N-2]+a[N-1]-x);
    cout << cnt << endl;
    
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long x;
    scanf("%lld",&x);
    std::vector<long long> a(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&a[i]);
    }
    solve(N, x, std::move(a));
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
#include <list>
#include <string>
#include <sstream>
#include <climits>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <cctype>
using namespace std;

int main() {
    string s1, s2, s3, ans;
    cin>>s1>>s2>>s3;
    ans=toupper(s1.front());
    ans+=toupper(s2.front());
    ans+=toupper(s3.front());
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    int N;
    cin>>N;
    long long K;
    cin>>K;
    vector<long long> A(N);
    for (long long &a: A)
        cin>>a;

    long long X = 0LL;  //  <=K
    long long Y = 0LL;
    for (int i=0; i<40; i++)
    {
        long long pX = X;
        long long pY = Y;

        long long c = 0;
        for (int j=0; j<N; j++)
            c += A[j]>>i&1;

        if (K>>i&1)
            X = max(pY + (1LL<<i)*c, pX + (1LL<<i)*(N-c));
        else
            X = pX + (1LL<<i)*c;
        Y = pY + (1LL<<i)*max(c, N-c);
    }
    cout<<X<<endl;
}


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

#define ll long long

const int mxN=300, M=1e9+7;
int n, a[21][21];
ll dp[1<<21];

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

	cin >> n;
	for(int i=0; i<n; ++i)
		for(int j=0; j<n; ++j)
			cin >> a[i][j];
	dp[0]=1;
	for(int i=1; i<1<<n; ++i)
		for(int j=0; j<n; ++j)
			if(i>>j&1&&a[__builtin_popcount(i)-1][j])
				dp[i]=(dp[i]+dp[i^1<<j])%M;
	cout << dp[(1<<n)-1];
}


Measured memory_bytes: 16640
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <numeric>
#include <queue>
#include <deque>

using namespace std;
using ll = long long int;

int main(){
    ll N, L;
    cin >> N >> L;
    ll sum = 0;
    for(ll i = 0; i < N; ++i) {
        sum += L + i;
    }
    if(L >= 0){
        sum -= L;
    }else if(L + N - 1 <= 0){
        sum -= (L + N - 1);
    }
    cout << sum << endl;
}


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

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

  int x;
  cin >> x;
  int res = 1;
  for (int i = 2; i < floor(sqrt(x)) + 1; i++) {
    res = max(res, (int)pow(i, (int)(log(x) / log(i) + 0.0001)));
  }  
  cout << res << '\n';
  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
const int INF = 1e9;
const int MOD = 1000000007;

 
int main() {
  ll n,c;
  cin >> n >> c;
  vector<ll> x(n),v(n);
  rep(i,n) { cin >> x[i] >> v[i];}
  
  vector<ll> right(n);
  vector<ll> left(n);
  
  ll v_sum = 0;
  rep(i,n){    
    v_sum += v[i];
    if(i == 0) right[i] = v_sum - x[i];
    else right[i] = max(right[i-1],v_sum - x[i]);
  }
  
  vector<ll> x2(n);
  rep(i,n){
    x2[i] = c - x[i];
  }
  
  reverse(x2.begin(),x2.end()); 
  reverse(v.begin(),v.end());
  
  v_sum = 0;
  rep(i,n){
    v_sum += v[i];
    if(i == 0) left[i] = v_sum - x2[i];
    else left[i] = max(left[i-1],v_sum - x2[i]);
  }
  
  ll ans = max(0LL,max(right[n-1],left[n-1]));
  
  rep(i,n-1){
    ans = max(ans,right[i] + left[n-i-2] - x[i]);
    ans = max(ans,left[i] + right[n-i-2] - x2[i]);
  }
  
  cout << ans << endl;
  
  /*rep(i,n){
    cout << right[i] << endl;
    cout << left[i] << endl;
  }*/
    
  return 0;
}



Measured memory_bytes: 4224
i;j;x[9<<14];m=9<<25;main(){for(;~scanf("%d",x+i++););for(;j<x[0]-x[1]+1;j++)m=fmin(x[j+x[1]+1]-x[j+2]+fmin(abs(x[j+2]),abs(x[j+x[1]+1])),m);printf("%d",m);}

Measured memory_bytes: 2516
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <complex>
#include <valarray>
#include <fstream>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <random>

#define _overload(a, b, c, d, ...) d
#define _rep1(X, A, Y) for (int (X) = (A);(X) <= (Y);++(X))
#define _rep2(X, Y) for (int (X) = 0;(X) < (Y);++(X))
#define rep(...) _overload(__VA_ARGS__, _rep1, _rep2)(__VA_ARGS__)
#define rrep(X,Y) for (int (X) = Y-1;(X) >= 0;--(X))
#define all(X) (X).begin(),(X).end()
#define len(X) ((int)(X).size())
#define mod(n, m) (((n)%(m)+(m))%m)
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
const int INFINT = 1 << 30;                          // 1.07x10^ 9
const ll INFLL = 1LL << 60;                          // 1.15x10^18
const double EPS = 1e-10;
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

const int MAX_M = 1<<17;
ll M, K;
bool used[MAX_M];

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

  cin >> M >> K;

  if (pow(2, M) <= K) {
      cout << -1 << endl;
      return 0;
  }

  if (K == 0) {
      rep(i, (1<<M)) {
          cout << i << ' ' << i << (i+1 == (1<<M) ? '\n' : ' ');
      }
      return 0;
  }

  ll judge = 0;
  for (ll i = 0; i < (1<<M); ++i) {
      judge ^= i;
  }

  for (int i = 0; i < M; ++i) {
      if ((K>>i)&1) {
          judge ^= (1<<i);
      }
  }



  if (judge != K) {
      cout << -1 << endl;
      return 0;
  }

  vector<int> ans;
  for (int i = 0; i < M; ++i) {
      if ((K>>i)&1) {
          used[1<<i] = true;
          ans.push_back(1<<i);
      }
  }
  for (int i = 0; i < (1<<M); ++i) {
      if (!used[i]) ans.push_back(i);
  }

  for (int i = (1<<M)-1; i >= 0; --i) {
      if (used[i]) ans.push_back(i);
  }
  
  for (int i = (1<<M)-1; i >= 0; --i) {
      if (!used[i]) ans.push_back(i);
  }

  for (int i = 0; i < len(ans); ++i) {
      cout << ans[i] << (i+1 == len(ans) ? '\n' : ' ');
  }

  return 0;
}


Measured memory_bytes: 3060
#include<stdio.h>
const int N = 1000000;
const int M = N + 200;
bool dp[M];

int main() {
    for(int i = 0; i <= M; i++) dp[i] = false;
    dp[0] = true;

    for(int i = 0; i <= N; i++) {
        dp[i + 100] |= dp[i];
        dp[i + 101] |= dp[i];
        dp[i + 102] |= dp[i];
        dp[i + 103] |= dp[i];
        dp[i + 104] |= dp[i];
        dp[i + 105] |= dp[i];
    }

    int n;
    scanf("%d", &n);
    printf("%d\n", dp[n] ? 1 : 0);
    return 0;
}

Measured memory_bytes: 1152
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        int b = in.nextInt();
        in.close();

        while (b > 0) {
            int temporary = a;
            a = b;
            b = temporary % b;
        }
        System.out.println(a);
    }
}



Measured memory_bytes: 26340
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scanner() string {
	sc.Scan()
	return sc.Text()
}

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func floatScanner() float64 {
	n, _ := strconv.ParseFloat(Scanner(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func stringSliceScanner(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scanner()
	}
	return a
}
func intSliceScanner(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = intScanner()
	}
	return a
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	a, b := intScanner(), intScanner()
	if a <= 5 {
		fmt.Println(0)
	} else if a <= 12 {
		fmt.Println(b / 2)
	} else {
		fmt.Println(b)
	}
}


Measured memory_bytes: 1772
import java.util.*;

public class Main {
    Scanner sc = new Scanner(System.in);
    public static void main(String[] args){
        new Main().run();
    }

    private void run(){
        int N = sc.nextInt();
        int[] A = new int[N];



        for(int i = 0; i < N-1; i++){
            A[sc.nextInt() - 1]++;
        }

        for(int a: A){
            System.out.println(a);
        }
        sc.close();
    }
}

Measured memory_bytes: 70928
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 1000000000
#define LINF 1000000000000000000
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define bit(n) (1LL<<(n))
using namespace std;

typedef pair<int, int> P;
typedef pair<long long, long long> LLP;

/*
    ユークリッドの互除法（正の整数x, yの最大公約数を返す）
*/

long long gcd(long long x, long long y) {
    if (x < y) swap(x, y);
    while (x % y != 0) {
        long long divisor = x % y;
        x = y;
        y = divisor;
    }
    return y;
}

/*
    最小公倍数を求める
*/

long long lcm(long long x, long long y) {
    long long g = gcd(x, y);
    return g * (x / g) * (y / g);
}

long long countDouble(long long x) {
    long long count = 0;
    while (x % 2 == 0) {
        x /= 2;
        count++;
    }
    return count;
}

int main() {
    
    int N, M;
    cin >> N >> M;
    vector<long long> a(N);
    rep(i,N) cin >> a[i];
    rep(i,N) a[i] /= 2;
    long long l = 1;
    rep(i,N) l = lcm(l, a[i]);

    long long c = countDouble(a[0]);
    rep(i,N-1) {
        if (c != countDouble(a[i + 1])) {
            cout << 0 << endl;
            return 0;
        }
    }

    long long x = M / l;
    if (x % 2 == 1) x++;
    cout << x / 2 << endl;

    return 0;
}

Measured memory_bytes: 1024