akhauriyash/Code-Regression huggingface dataset:
/*
 ▓█████▄  ▄████▄  ▓██   ██▓ ██▓███   ██░ ██ ▓█████  ██▀███
▒██▀ ██▌▒██▀ ▀█   ▒██  ██▒▓██░  ██▒▓██░ ██▒▓█   ▀ ▓██ ▒ ██▒
 ░██   █▌▒▓█    ▄   ▒██ ██░▓██░ ██▓▒▒██▀▀██░▒███   ▓██ ░▄█ ▒
 ░▓█▄   ▌▒▓▓▄ ▄██▒  ░ ▐██▓░▒██▄█▓▒ ▒░▓█ ░██ ▒▓█  ▄ ▒██▀▀█▄
 ░▒████▓ ▒ ▓███▀ ░  ░ ██▒▓░▒██▒ ░  ░░▓█▒░██▓░▒████▒░██▓ ▒██▒
  ▒▒▓  ▒ ░ ░▒ ▒  ░   ██▒▒▒ ▒▓▒░ ░  ░ ▒ ░░▒░▒░░ ▒░ ░░ ▒▓ ░▒▓░
  ░ ▒  ▒   ░  ▒    ▓██ ░▒░ ░▒ ░      ▒ ░▒░ ░ ░ ░  ░  ░▒ ░ ▒░
  ░ ░  ░ ░         ▒ ▒ ░░  ░░        ░  ░░ ░   ░     ░░   ░
    ░    ░ ░       ░ ░               ░  ░  ░   ░  ░   ░
  ░      ░         ░ ░
*/
//focus less on how much problem you should solve within a fixed time and focus more on getting the problem solved and
//learning something from it
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define per(i,a,b) for(ll i=a; i>=b; i--)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vii vector <pair<ll,ll> >
#define sedes set <ll, greater <ll> >
#define seasc set <ll>
#define pb push_back
#define mkp make_pair
#define ff first
#define ss second
#define MOD 1000000007
#define prec(n) fixed<<setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define umap unordered_map<ll, ll>
#define map map<ll, ll>
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define mems(a, i) memset(a, i, sizeof(a))
#define endl '\n'
#define all(v) v.begin(),v.end()
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define deba(a) cout << #a << " " <<a << endl;
int main()
{
	fast;
#ifndef ONLINE_JUDGE
	freopen("D:\\input.txt", "r", stdin);
	freopen("D:\\output.txt", "w", stdout);
#endif
	int t = 1;
	// cin >> t;
	while (t--)
	{
		ll n;
		cin >> n;
		ll ans = 0;
		rep(i, 1, n)
		for (int j = 1; j * i < n; j++)
			ans++;
		cout << ans;
	}
	return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
int main()
{
	string a;
	int cnt=0;
	cin>>a;
	for (int i=0;i<a.size();i++)
		cnt+=(int)(a[i]-'0');
	cout<<(cnt%9?"No":"Yes")<<endl;
	return 0;
}


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

int main(){
  int n,x;
  cin >> n >> x;
  int d = 0;
  int c = 1;
  for (int i=0;i<n;i++){
    int l;
    cin >> l;
    d = d + l;
    if (d <= x){
      c++;
    }else{
      break;
    }
  }
  cout << c << endl;
  return 0;
}



Measured memory_bytes: 256
#include<math.h>
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define ll long long int
#define py printf("Yes\n")
#define pn printf("No\n")
#define in cin>>
using namespace std;
int INF = 1001001001;

int main()
{
    int x;
    cin >>x;
    vector <bool> expo(x+1);
    expo[1] = 1;
    for(int b=2;b<=x;b++){
    int a = b*b;
    while(a<=x){
    expo[a] = 1;
    a *= b;
    }
    }
    for(int i=x;i>=1;i--) if(expo[i]){
        cout <<i<<endl;
        return 0;
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <stack>
#include <cstdlib>
using namespace std;
stack<double> st;

double func(char c){
	double y = st.top();st.pop();
	double x = st.top();st.pop();
	if(c == '+')return x + y;
	if(c == '-')return x - y;
	if(c == '*')return x * y;
	if(c == '/')return x / y;
}

int main(){
	char s[100];
	while(scanf("%s", s) != EOF){
		if(strlen(s)==1 && (s[0]=='+' || s[0]=='-' || s[0]=='*' || s[0]=='/')){
			st.push(func(s[0]));
		}else{
			double d = atof(s);
			st.push(d);
		}
		if(getchar()=='\n'){
			printf("%.10f\n",st.top());
			st.pop();
		}
	}
	
	return 0;
}

Measured memory_bytes: 3212
/*ex6_2
 Sweet_Sweet_Soul */
#include <stdio.h>
#include <string.h>


int main(void) {
    int num=0;
    char text[110]; /*最大入力に対し余裕のある配列*/
    scanf("%s",text); /*%s=文字列指定*/
    num=strlen(text);
    printf("%c%d%c\n",text[0],num-2,text[num-1]); /*最初の文字、文字数−２、最後の文字の順に出力*/
    return 0;
}

Measured memory_bytes: 128
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect, bisect_left, bisect_right

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, K = MAP()
A = LIST()

# b = A[K:]

B = []
tmp = 1
# for a in A[:K]:
#     tmp *= a
tmp = 1
for i in range(N - K):
    tmp2 = tmp / A[i] * A[K + i]
    if tmp < tmp2:
        print("Yes")
    else:
        print("No")
    # print(tmp, tmp2)
    tmp = 1


Measured memory_bytes: 33468
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
typedef int64_t int64;
typedef uint32_t uint;
typedef uint64_t uint64;
using namespace std;

//---

template <typename T>
inline void print(const T& rhs){ std::cout<<" = "<<rhs<<std::endl; }
template <typename T>
inline void print(const std::vector<T>& rhs){
    std::cout<<" = [ ";
    for(uint i=0; i<rhs.size(); ++i){ std::cout<<rhs[i]<<' '; }
    std::cout<<"]"<<std::endl;
}
template <typename T>
inline void print(const std::vector<std::vector<T>>& rhs){
    std::cout<<" = "<<std::endl;
    std::cout<<"[[ ";
    for(uint p=0; p<rhs.size(); ++p){
        if(p!=0){ std::cout<<" [ "; }
        for(uint q=0; q<rhs[p].size(); ++q){
            std::cout<<rhs[p][q]<<' ';
        }
        if(p!=rhs.size()-1){ std::cout<<"]"<<std::endl; }
    }
    std::cout<<"]]"<<std::endl;
}
template <typename TL, typename TR>
inline void print(const std::vector<std::pair<TR,TL>>& rhs){
    std::cout<<" = [";
    uint i=0;
    for(; i<rhs.size()-1; ++i){ std::cout<<"[f: "<<rhs[i].first<<", s: "<<rhs[i].second<<"], "; }
    std::cout<<"[f: "<<rhs[i].first<<", s: "<<rhs[i].second<<"]]" << endl;
}
#define printn(var) {printf("%s", #var);print(var);}
#define printn_all(var) {printf("%s(%d): ", __func__, __LINE__);printf("%s", #var);print(var);}

//---

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int a, b; cin >> a >> b;
    cout << ((a+b-1)/2+1) << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REP2(i, n) for (int i = 1; i <= (int)(n); i++)
#define FOR(i, m, n) for (int i = m; i<n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define REVE(x) reverse(x.begin(), x.end())
#define ALL(x) (x).begin(), (x).end()
#define SUM(x) accumulate(x.begin(), x.end(),0);
#define vint(v,n) vector<int> v(n); REP(i,n) scanf("%lld", &v[i]);
#define vstr(v,n) vector<string> v(n); REP(i,n) scanf("%lld", &v[i]);
struct initon
{
    initon()
    {
        cin.tie(0);
        ios::sync_with_stdio(false);
    };
};
int k=0,n=0, m=0, l=0,a=0, b=0, c=0, d=0,e=0,ans=0,ans2=0,x=0,y=0;
string s,t,S;
signed main() {
    cin >> a;
   ans=a/100;
  ans2=a%100;
    if(ans<=12&&ans>0){
       if(ans2<=12&&ans2>0)cout <<"AMBIGUOUS";
      else cout <<"MMYY";
    }else{
       if(ans2<=12&&ans2>0)cout <<"YYMM";    
    else cout << "NA";
    }
}
      
      
      
      
      
        


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb emplace_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
#define PQ(T) priority_queue<T>
#define SPQ(T) priority_queue<T,vector<T>,greater<T>>
#define dame(a) {out(a);return 0;}
#define decimal cout<<fixed<<setprecision(15);
#define dupli(a) a.erase(unique(all(a)),a.end())
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef tuple<ll,ll,ll,ll> PPP;
typedef multiset<ll> S;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
using vvvvi=vector<vvvi>;
using vp=vector<P>;
using vvp=vector<vp>;
using vb=vector<bool>;
using vvb=vector<vb>;
const ll inf=1001001001001001001;
const ll INF=1001001001;
const ll mod=1000000007;
const double eps=1e-10;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())cout<<'('<<v[i].fi<<','<<v[i].se<<')';cout<<'\n';}
template<class T> void outvvp(T v){rep(i,v.size())outvp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size())outv(v[i]);}
template<class T> bool isin(T x,T l,T r){return (l)<=(x)&&(x)<=(r);}
template<class T> void yesno(T b){if(b)out("yes");else out("no");}
template<class T> void YesNo(T b){if(b)out("Yes");else out("No");}
template<class T> void YESNO(T b){if(b)out("YES");else out("NO");}
template<class T> void noyes(T b){if(b)out("no");else out("yes");}
template<class T> void NoYes(T b){if(b)out("No");else out("Yes");}
template<class T> void NOYES(T b){if(b)out("NO");else out("YES");}
void outs(ll a,ll b){if(a>=inf-100)out(b);else out(a);}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll modpow(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*modpow(a,b-1)%mod;ll k=modpow(a,b/2);return k*k%mod;}
vi fac,finv,inv;
void init(ll n){
    n*=3;
    fac=vi(n+5);finv=vi(n+5);inv=vi(n+5);
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    REP(i,2,n+5){
        fac[i]=fac[i-1]*i%mod;
        inv[i]=mod-inv[mod%i]*(mod/i)%mod;
        finv[i]=finv[i-1]*inv[i]%mod;
    }
}
long long modcom(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
int main(){
    ll n,k;cin>>n>>k;
    vi v(k);rep(i,k)cin>>v[i];
    vi dp(n+1);
    init(n);
    dp[0]=1;
    rep(i,k){
        vi ndp(n+1);
        rep(j,n+1)rep(t,v[i]+1){
            if(j+t>n)break;
            ndp[j+t]+=dp[j]*modcom(n-j,t)%mod*modcom(n-t,v[i]-t);
            ndp[j+t]%=mod;
        }
        dp=ndp;
    }
    out(dp[n]);
}

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

ll N, M;
char S[100][100];

int main(void) {
  cin >> N >> M;
  REP(i, 0, N) REP(j, 0, M) cin >> S[i][j];

  char ans[100][100];
  REP(i, 0, N) REP(j, 0, M) {
    if(S[i][j] == '#') ans[i][j] = '#';
    else {
      ll cnt = 0;
      REP(k, -1, 2) REP(l, -1, 2) if((k != 0 || l != 0) && 0 <= i + k && i + k < N && 0 <= j + l && j + l < M) {
        if(S[i + k][j + l] == '#') cnt++;
      }
      ans[i][j] = '0' + cnt;
    }
  }

  REP(i, 0, N) {
    REP(j, 0, M) cout << ans[i][j];
    cout << endl;
  }
}


Measured memory_bytes: 256
n = int(input())
minc=float('INF')
ans = [1,1]
for i in range(1,10**6+1):
    if n%i==0:
        x,y = i,n//i
        sumn = x+y-2
        if(minc>sumn):
            minc=sumn
            
print(minc)


Measured memory_bytes: 3064
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define F first
#define S second
#define endl '\n'
#define rep(i , a , n) for (int i=a; i<(int)(n); i++)
#define re(i , n)     for (int i=0; i<(int)(n); i++)
#define p push_back
#define em emplace_back
#define IOS ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define trace(a) cerr << #a << " = " << a << endl

using namespace std;

typedef pair<int, int> ii;
typedef long long ll;
typedef long double ld;

const int mod=7+1e9;
const int inf=1e9;
const int N=1e5+5;
int dp[N],h[N];
int n;
int f(int i)
{

    int &ret=dp[i];
    if(ret!=-1)return ret;
    int c1=inf,c2=inf;
    if(i+1<n)c1=abs(h[i]-h[i+1])+f(i+1);
    if(i+2<n)c2=abs(h[i]-h[i+2])+f(i+2);
    if(c1==c2&&c1==inf)return ret=0;
    return ret=min(c1,c2);
}
int main()
{
#ifdef LOCAL
    freopen("input.in", "r", stdin);
#endif
      IOS;
      cin>>n;
      re(i,n)
          cin>>h[i];
      memset(dp,-1,sizeof dp);
      cout<<f(0);
}



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

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

  string T = S.substr(0, N / 2);
  if (T + T == S)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>

int main(void){
  char a[4];
  char b[4];

  scanf("%s %s",a,b);

  if(a[0] == b[2] && a[1] == b[1] && a[2] == b[0]){
    printf("YES\n");
  }else{
    printf("NO\n");
  }
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <limits>

using namespace std;
using lli = long long int;

void Prlli(lli min, lli max, lli sum)
{
    cout << min << " " << max << " " << sum << endl;
}

int main() {
    lli n;
    cin >> n;
    lli max {numeric_limits<lli>::min()};
    lli min {numeric_limits<lli>::max()};
    lli sum {};

    if (n == 0)
        Prlli(0, 0, 0);
    else
    {
        for (lli i = 0, in = 0; i < n && cin >> in; ++i)
        {
            if (in > max)
                max = in;
            if (in < min)
                min = in;
            sum += in;
        }

        Prlli(min, max, sum);
    }
        


    return 0;
} 

Measured memory_bytes: 3104
def bb
    a = gets.chomp.to_i
    b = gets.chomp.to_i
    c = gets.chomp.to_i
    d = gets.chomp.to_i
    e = gets.chomp.to_i

    o = [a, b, c, d, e]
    sa = [0] # ...
    to = 0
    for i in 1..5
        am = o[i-1] % 10
        unless am == 0
            sa.push(10 - am)
            to += o[i-1] + 10 - am
        else
            to += o[i-1]
        end
    end

    #p sa
    p to-sa.max
end

bb


Measured memory_bytes: 1788
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#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 all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))

int main() {
    int N; cin >> N;
    vector<int> C(N), S(N), F(N);
    rep (i, 0, N-1) cin >> C[i] >> S[i] >> F[i];

    vector<int> ans(N, 0);
    rep (i, 0, N-1) {
        int arrive = S[i] + C[i], lag;
        rep (j, i+1, N-1) {
            int diff = arrive - S[j];
            if (diff >= 0) {
                lag = F[j] - (diff % F[j]);
                if (lag == F[j]) lag = 0;
                arrive += lag + C[j];
            }
            else
                arrive = S[j] + C[j];
        }
        ans[i] = arrive;
    }

    rep (i, 0, ans.size()) cout << ans[i] << endl;
}

Measured memory_bytes: 256
import sys
import math  # noqa
import bisect  # noqa
import queue  # noqa


def input():
    return sys.stdin.readline().rstrip()


def main():
    N, K = map(int, input().split())
    D = list(map(int, input().split()))

    while True:
        feasible = True
        for n in str(N):
            if int(n) in D:
                feasible = False
                break
        if feasible:
            break
        else:
            N += 1

    print(N)


if __name__ == '__main__':
    main()


Measured memory_bytes: 41048
// Ver19.03
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define INF (1 << 29) * 2
#define LLINF 4545454545454545454
#define MOD 1000000007
#define ll long long
#define ull unsigned long long
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int upll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? -1 : *(ll *)a > *(ll *)b ? 1 : 0; }
int downll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? 1 : *(ll *)a > *(ll *)b ? -1 : 0; }
void sortup(ll *a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll *a, int n) { qsort(a, n, sizeof(ll), downll); }

int main()
{
  ll n, k, i = 0, tmp = 0;
  scanf("%lld%lld", &n, &k);
  while (tmp < n)
  {
    tmp += pow(k, i) * (k - 1);
    i++;
  }
  printf("%lld\n", i);
}

Measured memory_bytes: 128
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.stdlib;

immutable int INF = 1 << 29;

void main() {
    auto N = readln.chomp.to!int;
    auto A = readln.split.map!(to!long).array;

    auto seppen = new long[](N);
    foreach (i; 0..N) seppen[i] = A[i] - i;

    int[long] cnt;
    foreach (a; seppen) cnt[a] += 1;

    long ans = 0;
    foreach (i, a; A) {
        long b = -2 * i.to!long - seppen[i];
        if (b in cnt) ans += cnt[b];
    }

    ans.writeln;
}


Measured memory_bytes: 24624
#include <stdio.h>
#include <string.h>

int main() {
  int i;
  char str[100001];
  scanf("%s", str);
  for(i = 0; i < strlen(str); i++) {
    if(i % 2 == 0) {
      printf("%c", str[i]);
    }
  }
  printf("\n");
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{   
    public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int[] t = new int[n+1];
      int[] x = new int[n+1];
      int[] y = new int[n+1];
      for(int i = 1;i <= n;i++){
      	t[i]=sc.nextInt();
        x[i]=sc.nextInt();
        y[i]=sc.nextInt();
      }
      for(int i = 0;i <= n-1;i++){
      	int k = Math.abs(x[i+1]-x[i])+Math.abs(y[i+1]-y[i]);
        if(t[i+1]-t[i]<k||(t[i+1]-t[i])%2!=k%2){
        	System.out.println("No");
            return;
        }
      }
      System.out.println("Yes");
    }
    public static int lcm(int x, int y){
      return x*y/gcd(x,y);
    }
    public static int gcd(int x, int y){
      if(x < y)return gcd(y,x);
      if(y==0)return x;
      return gcd(y,x%y);
    }
}

Measured memory_bytes: 90208
n, k = map(int, input().split())
S = input()
tmp = S[0]
count = 0
num_count = []
f = int(S[0])
for s in S:
    if tmp == s:
        count += 1
    else:
        num_count.append(count)
        count = 1
    tmp = s
num_count.append(count)
if S[0] == '0':
    num_count.insert(0, 0)
if S[-1] == '0':
    num_count.insert(-1, 0)
sum = [0]
for i in num_count:
    sum.append(sum[-1] + i)
a = 0
for i, num in enumerate(sum[::2]):
    left = i * 2
    right = min(i * 2 + 2 * k + 1, len(num_count))
    t = sum[right] - sum[left]
    a = max(a, t)
print(a)


Measured memory_bytes: 8308
function Main(input) {
	input = input.split(" ").map(Number);
	var n = -1;
	for(var i=input[0]*12;i<(input[0]*12)+1000;i++){
		if(Math.floor(i*0.08)==input[0]&&Math.floor(i*0.1)==input[1]){
			n = i;
			break;
		}
	}
	console.log(n)
}Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());

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

#define sz(x) (int)x.size() 
#define pb push_back 
#define mp make_pair 
#define fi(a, b) for(int i=a; i<=b; i++) 
#define fj(a, b) for(int j=a; j<=b; j++) 
#define fo(a, b) for(int o=a; o<=b; o++) 
#define fdi(a, b) for(int i=a; i>=b; i--) 
#define fdj(a, b) for(int j=a; j>=b; j--) 
#define fdo(a, b) for(int o=a; o>=b; o--) 

#ifdef LOCAL
#define err(...) fprintf(stderr, __VA_ARGS__)
#else
#define err(...) while(false) {}
#endif

typedef long long ll; 
typedef pair<int, int> pii; 
typedef pair<ll, ll> pll; 
typedef vector<int> vi; 
typedef vector<ll> vll;
typedef vector<pii> vpii; 
typedef vector<pll> vpll; 
typedef long double ld;
typedef unsigned long long ull;

/////////////////////////////////

int n, q;

vi go(int x) {
	vi res;
	while (1) {
		err("x = %d\n", x);
		res.pb(x);
		if (x == 1) break;
		int xx = (x % n);
		if (xx == 1) {
			x = (x - 1) / n;
		} else {
			x = (x + (n - xx) % n) / n;
		}
	}
	return res;
}

void solve() {
	fi(1, q) {
		int x, y;
		scanf("%d %d", &x, &y);
		if (n == 1) {
			printf("%d\n", min(x, y));
		} else {
			vi a = go(x);
			vi b = go(y);
			sort(a.rbegin(), a.rend());
			sort(b.rbegin(), b.rend());
			for (int x : a) {
				if (find(b.begin(), b.end(), x) != b.end()) {
					printf("%d\n", x);
					break;
				}
			}
		}
	}
}

int main() {
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

  scanf("%d %d", &n, &q);
	solve();		

	
#ifdef LOCAL
	err("ELAPSED TIME: %.3Lf\n", (ld) clock() / CLOCKS_PER_SEC);
#endif	
	
	return 0;
}

Measured memory_bytes: 1280
n = int(input())
a = list(map(int,input().split()))
al = []
g = []
k = []
g0 = 0
k0 = 0
for i in range(n):
    if i % 2 == 0:
        k0 += a[i]
        k.append(k0)
    else:
        g0 += a[i]
        g.append(g0)
if n % 2 == 0:
    al.append(g[n//2-1])
    al.append(k[n//2-1])
    for i in range(n):
        if i % 2 == 0 and i < n-2:
            now = i//2
            al.append(k[now]+g[-1]-g[now])
else:
    #print(g,k)
    al.append(g[-1])
    d = a[1]
    for i in range(n):
        if i % 2 == 0:
            al.append(k[-1]-a[i])
        else:
            now = (i-1)//2
            if i > 1 and i < n-2:
                #print(d,g[-1]-g[now],k[-1]-k[now+1],g[now-1],k[now-1],a[i])
                al.append(max(g[-1]-g[now],k[-1]-k[now+1])+max(d,k[now-1])+a[i])
                d = max(d+a[i],k[now-1]+a[i])
            elif i == 1:
                al.append(a[i]+max(g[-1]-g[now],k[-1]-k[now+1]))
                d = max(a[i],a[0])
            else:
                al.append(a[i] + max(d,k[now-1]))
#print(al)
print(max(al))

Measured memory_bytes: 119068
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    int n;
    ll answer;
    ll maxa,minc;
    cin >> n;
    answer = 0;
    vector<int> a(n);
    vector<int> b(n);
    vector<int> c(n);
    for(int i = 0;i < n;i++)cin >> a[i];
    for(int i = 0;i < n;i++)cin >> b[i];
    for(int i = 0;i < n;i++)cin >> c[i];
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    sort(c.begin(),c.end());
    for(int i = 0;i < n;i++){
        auto ita = lower_bound(a.begin(),a.end(),b[i]);
        auto itc = upper_bound(c.begin(),c.end(),b[i]);
        maxa = ita - a.begin();
        minc = c.end() - itc;
        answer += maxa*minc;
    }
    cout << answer << endl;
}

Measured memory_bytes: 1408
// スタックサイズ: 100MB

#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <unordered_map>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iomanip>
#include <queue>
#include <list>
#include <set>
using namespace std;

typedef int64_t ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
const ll INF = 1000000000000000000;
#define fori(i, a, b) for (ll i = (a); i < (b); ++i)
#define ford(i, a, b) for (ll i = (b - 1); (a) <= i; --i)
#define rep(i, n) fori(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define fst first
#define snd second
ll pw(ll x, ll y) { ll r = 1;  rep(i, y) { r *= x; }; return r; }




int main() {

	ll n, a, b;
	cin >> n >> a >> b;
	cout << min(a * n, b) << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){

	int a, b, n, m;

	while (1) {
		scanf("%d %d", &a, &b);
		if ((a == 0) && (b == 0))
		{
			break;
		}
		else
		{
			for (m = 1; m <= a; m++)
			{
				for (n = 1; n <= b; n++)
				{
					printf("#");
				}
				printf("\n");
			}
		}
		printf("\n");
	}
	
	return 0;
}

Measured memory_bytes: 1820
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

double tkt[8];
double flg[256][30];
double path[30][30];

int main(){

    for(int n, m, p, a, b; cin >> n >> m >> p >> a >> b;){
        a--;
        b--;
        if(n == 0)break;
        for(int i = 0; i < 256; i++){
            for(int j = 0; j < 30; j++){
                flg[i][j] = 1234;
            }
        }
        for(int i = 0; i < 30; i++){
            for(int j = 0; j < 30; j++){
                path[i][j] = 1234;
            }
        }
        for(int i = 0; i < n; i++)cin >> tkt[i];
        for(int i = 0; i < p; i++){
            int x, y, z;
            cin >> x >> y >> z;
            x--;
            y--;
            path[x][y] = z;
            path[y][x] = z;
        }
        flg[0][a] = 0.0;
        for(int bit = 0; bit < (1 << n); bit++){
            for(int f = 0; f < m; f++){
                double cs = flg[bit][f];
                if(cs > 1000)continue;
                for(int t = 0; t < m; t++){
                    if(path[f][t] > 1000)continue;
                    for(int b = 1, j = 0; j < n; b <<= 1, j++){
                       if(bit & b)continue;
                        flg[bit + b][t] = min(flg[bit + b][t], cs + path[f][t] / tkt[j]);
                    }
                }
            }
        }
        double ans = 1234;
        for(int i = 0; i < (1 << n); i++){
            ans = min(ans, flg[i][b]);
        }
        if(ans > 1000){
            printf("Impossible\n");
        }
        else{
            printf("%.9f\n", ans);
        }
    }

    return 0;
}


Measured memory_bytes: 3180
N,D = map(int,input().split())
X = [0]*N
Y = [0]*N
D = D*D
for i in range(N):
    X[i],Y[i] = map(int,input().split())

ans = 0
for i in range(N):
    d = X[i]**2+Y[i]**2
    if d <= D:
        ans += 1

print(ans)

Measured memory_bytes: 73148
#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
const int INF = 999999999;

struct UnionFind {
	vector<int>pare;

	UnionFind(int n) :pare(n, -1) {}

	void init(int n) { pare.assign(n, -1); }

	int root(int n) {
		if (pare[n] < 0) { return n; }
		return pare[n] = root(pare[n]);
	}

	bool same(int a, int b) {
		return root(a) == root(b);
	}

	bool merge(int a, int b) {
		a = root(a), b = root(b);
		if (a == b) { return false; }
		if (pare[a] > pare[b]) { swap(a, b); }
		pare[a] += pare[b];
		pare[b] = a;
		return true;
	}

	int size(int n) {
		return -pare[root(n)];
	}
};

int main() {
	long long a, b, k[100005], l[100005];
	cin >> a >> b;
	vector<long long>ans;
	for (int i = 0; i < b; ++i) {
		cin >> k[i] >> l[i];
		--k[i], --l[i];
	}
	UnionFind uf(a);
	long long mon = a * (a - 1) / 2;
	for (int i = 0; i < b; ++i) {
		ans.push_back(mon);
		int aa = k[b - 1 - i], bb = l[b - 1 - i];
		if (!uf.same(aa, bb)) {
			mon -= uf.size(aa)*uf.size(bb);
			uf.merge(aa, bb);
		}
	}
	for (int i = ans.size() - 1; i >= 0; --i) { cout << ans[i] << endl; }
}


Measured memory_bytes: 4212
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const N = Number(input[0][0]);
  const K = Number(input[1][0]);

  let answer = 1;

  for (let i = 0; i < N; i++) {
    answer = Math.min(answer * 2, answer + K);
  }

  return answer;
};

console.log(main(read()));


Measured memory_bytes: 29560
import Data.Int
import Data.List (sort)

md = 1000000007

mul_ :: Int64 -> Int64 -> Int64
mul_ x y = ( x * y )`mod` md

power_ :: Int64 -> Int64 -> Int64
power_ _ 0 = 1 
power_ x y = power_ (x `mul_` x) (y `div` 2) `mul_` if even y then 1 else x

div_ :: Int64 -> Int64 -> Int64
div_ x y = x `mul_` (power_ y (md - 2))

solve2 :: Int64 -> Int64 -> Int64 -> Int64 -> Int64 -> [Int64] -> [Int64]
solve2 _ _ 0    _    _ result = reverse result
solve2 l k i_ sum1 sum2 result = 
    solve2 l k (i_ - 1) next_sum1 next_sum2 (result_ : result)
    where
        i = k - i_ + 1
        next_sum1 = sum1 `mul_` (l + 2 - i) `div_` i
        next_sum2 = sum2 `mul_` if 1 == i then 1 else ((k - i + 1)`div_` (i - 1)) 
        result_ = next_sum1 `mul_` next_sum2

solve :: [Int64] -> [Int64]
solve (n:k:_)  = 
    solve2 (n-k) k k 1 1 []
    
main = interact $ unlines.(map show).solve.map read.words


Measured memory_bytes: 1532
#include<bits/stdc++.h>
using namespace std;
constexpr int64_t mod=1e9+7;

int main()
{
  int n;
  cin>>n;
  vector<tuple<int, int, bool>> red(n), blue(n);
  for (int i = 0; i < n; ++i)
  {
    cin>>get<1>(red[i])>>get<0>(red[i]);
    get<2>(red[i])=true;
  }
  for(int i=0; i < n; ++i) {
    cin>>get<0>(blue[i])>>get<1>(blue[i]);
    get<2>(blue[i])=true;
  }

  int cnt=0;
  sort(red.begin(), red.end());
  reverse(red.begin(), red.end());
  for(auto&& e: red) {
    swap(get<0>(e),get<1>(e));
  }
  sort(blue.begin(), blue.end());

  for (int i = 0; i < n; ++i)
  {
    for (int j = 0; j < n; ++j)
    {
      if(get<0>(blue[i]) > get<0>(red[j]) && 
        get<1>(blue[i]) > get<1>(red[j]) &&
        get<2>(blue[i]) && get<2>(red[j]) )
      {
        get<2>(blue[i])=false;
        get<2>(red[j])=false;
        cnt++;
      }
    }
  }

  cout<<cnt;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#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 all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
int main(){
	string s;
	cin>>s;
	int N = s.size();
	rep(i,N){
		rep(j,26){
			char c = 'a'+j;
			bool ok[100]={};
			rep(k,N){
				if(s[k]==c){
					for(int a=k-i;a<=k;a++){
						if(0<=a&&a<N) ok[a] = 1;
					}
				}
			}
			bool can = 1;
			rep(k,N-i) if(!ok[k]) can = 0;
			if(can){
				cout<<i<<endl;
				return 0;
			}
		}
	}
}


Measured memory_bytes: 768
#include<iostream>
#include<string>
#include<vector>
#include<stack>

using namespace std;

int main(void) {

    stack<char> stk;

    string s;
    cin >> s;

    stk.push(s[0]);

    for(size_t c =1; c < s.size(); ++c) {

        if (stk.empty()) {
            stk.push(s[c]);
        } else if ( stk.top() != s[c]) {
            stk.pop();
        } else {
            stk.push(s[c]);
        }
    }

    cout << s.size() - stk.size() << endl;

    return 0;
}

Measured memory_bytes: 512
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        List<Long> transportTimeList = new ArrayList<>();
 
        for (int i = 0; i < 5; i ++){
            transportTimeList.add(sc.nextLong());
        }
 
        Collections.sort(transportTimeList);
        long weakestWay = transportTimeList.get(0);
 
        long longestTimeToTransport = getLongestTime(n, weakestWay);
        long minimumTime = 5L;
        long answer = minimumTime + longestTimeToTransport -1;
 
        System.out.println(answer);
    }
 
    private static long getLongestTime(long n, long weakestWay){
        if (n % weakestWay == 0){
            return n / weakestWay;
        }else {
            return n / weakestWay + 1;
        }
    }
 
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N=1e5+5,mo=1e9+7;
LL Power(LL a,int b){
	LL ans=1;
	while(b){
		if(b&1)(ans*=a)%=mo;
		(a*=a)%=mo,b>>=1;
	}
	return ans;
}
int f[N];
int main(){
	int n,k;scanf("%d%d",&n,&k);
	LL ans=0;
	for(int i=k;i;i--){
		f[i]=Power(k/i,n);
		for(int j=i*2;j<=k;j+=i)(f[i]-=f[j])%=mo;
		ans+=1ll*i*f[i]%mo;
	}
	printf("%lld",(ans%mo+mo)%mo);
	return 0;
}

Measured memory_bytes: 4176
import java.util.Scanner

object Main {
  def solve(sc: => Scanner): Unit = {
    val N, K = sc.nextInt
    println(Array.fill[Int](N)(sc.nextInt).map(x => math.min(x, K - x) * 2).sum)
  }

  def main(args: Array[String]): Unit = {
    val sc: Scanner = new Scanner(System.in)
    solve(sc)
  }
}


Measured memory_bytes: 27456
n = int(input())
a = list(map(int, input().split()))
ans = 1;
for i in range(n):
    if ans > 10**18:
        break
    ans *= a[i]
if 0 in a:
    print(0)
elif ans <= 10**18:
    print(ans)
else:
    print(-1)

Measured memory_bytes: 21616
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=100050;
//ここまでテンプレ
int main(){
	int A,B;
	char o;
	cin>>A>>o>>B;
	if(o=='+')
		cout<<A+B<<endl;
	else
		cout<<A-B<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

/*構造体の定義*/
typedef struct {
	char suit;
	int value;
} Card ;


void swap_Card(Card *x, Card *y)
{
	Card temp = *x;
	*x = *y;
	*y = temp;
}


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

	int i,j;
	Card BC[N];
	Card SC[N];

	for (i = 0; i < N; i++) {
		Card c;
		scanf("%c", &c.suit);
		scanf("%d ", &c.value);
		BC[i] = c;
		SC[i] = c;
	}

	/* Bubble Sort */
    for (i = 0; i < N - 1; i++) {
        for (j = N - 1; j > i; j--) {
            if (BC[j].value < BC[j - 1].value)
                swap_Card(&BC[j], &BC[j - 1]);
        }
    }
	
	/* Selection Sort */
    for (i = 0; i < N - 1; i++) {
        int minj = i;
        for (j = i + 1; j < N; j++) {
            if (SC[j].value < SC[minj].value)
                minj = j;
        }
        swap_Card(&SC[i], &SC[minj]);
    }
	
	/* Output */
	for (i = 0; i < N - 1; i++) {
		printf("%c%d ", BC[i].suit, BC[i].value);
	}
	printf("%c%d\n", BC[N - 1].suit, BC[N - 1].value);
	puts("Stable");

	for (i = 0; i < N - 1; i++) {
		printf("%c%d ", SC[i].suit, SC[i].value);
	}
	printf("%c%d\n", SC[N - 1].suit, SC[N - 1].value);

	for (i = 0; i < N; i++) {
		if (BC[i].suit != SC[i].suit) {
			puts("Not stable");
			return 0;
		}
	}
	puts("Stable");

	return 0;
}


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

int main()
{
    int A, B;

    cin >> A >> B;

    if (A == 1)
        A += 13;
    if (B == 1)
        B += 13;
    
    if (A > B)
        cout << "Alice" << endl;
    else if (A == B)
        cout << "Draw" << endl;
    else 
        cout << "Bob" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=((n)-1);(i)>=0;(i)--)
#define itn int
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
using P = pair <int,int>; //to, cost
using WeightedGraph = vector<vector <P>>; //to cost
const long long INF = 1LL << 60;
const int MOD = 1000000007;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//https://www.creativ.xyz/dump-cpp-652/
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
 
// vector
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream &operator<<(ostream &os, map<T, U> &map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream &operator<<(ostream &os, set<T> &set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head &&head, Tail &&... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}

#ifdef DEBUG_
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif

signed main(void) { cin.tie(0); ios::sync_with_stdio(false);
    int n; cin>>n;
    vector <int> a(n);
    rep(i,n) cin>>a[i]; 
    int ans = a[0]-1;
    dump(ans);
    a[0] = 1;
    int now = 2;
    rep(i,n){
        if(i == 0) continue;
        if(a[i] == now) now++;
        if(a[i] <= now) continue;
        if(a[i] %now == 0){
            ans++;
            a[i] -= now+1;
        }
        ans += a[i]/now;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<cstring>

namespace ShangWuKeNengXieBuWanLe____XiaWu____no__ZhongWuJiXuXieBa
{
	typedef long long ll;
	const int N=15,M=N*N,MOD=1000000007;
	inline void inc(int a,int &b){b=(a+b)%MOD;}
	ll qpow(ll a,ll b){ll c=1;for(;b;b>>=1,a=a*a%MOD)if(b&1)c=c*a%MOD;return c;}

	int begin[N+2],next[M],to[M];
	int n,m,e,S;
	void add(int x,int y)
	{
		to[++e]=y;
		next[e]=begin[x];
		begin[x]=e;
	}
	void initialize()
	{
		scanf("%d%d",&n,&m);
		for(int i=1,u,v;i<=m;i++)
			scanf("%d%d",&u,&v),add(u,v);
		S=1<<n;
	}

	int f[1<<N];

	inline bool ins(int A,int p){return (A>>(p-1))&1;}
	int calc(int A,int B)
	{
		int ret=1;
		for(int p=1;p<=n;p++)
			if(ins(A,p))
			{
				int tmp=0;
				for(int i=begin[p],q;i;i=next[i])
					tmp+=ins(B,q=to[i]);
				tmp=qpow(2,tmp)-1;
				ret=(ll)ret*tmp%MOD;
			}
		for(int p=1;p<=n;p++)
			if(ins(B,p))
			{
				int tmp=0;
				for(int i=begin[p];i;i=next[i])
					tmp+=ins(A,to[i]);
				ret=(ll)ret*qpow(2,tmp)%MOD;
			}
		return ret;
	}

	inline bool precheck(int A){return !(ins(A,1)^ins(A,2));}
	void dp()
	{
		f[0]=1;
		for(int A=1;A<S;A++)
			for(int B=A;B;B=(B-1)&A)
				if(precheck(B))inc((ll)f[A^B]*calc(A^B,B)%MOD,f[A]);
	}
	void solve()
	{
		initialize();
		dp();
		int ans=qpow(2,m)-f[S-1];
		ans=(ans%MOD+MOD)%MOD;
		printf("%d\n",ans);
	}
}

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


Measured memory_bytes: 512
#include<stdio.h>
int main()
{
	int a,b,c,d;
	scanf("%d%d%d",&a,&b,&c);
	if(a>c)
	{
		d = a;
		a = c;
		c = d;
		
	}
	if(a>b)
	{
		d = a;
		a = b;
		b = d;
	}
	if(b>c)
	{
		d = b;
		b = c;
		c = d;
	}
	printf("%d %d %d\n",a,b,c);

	return 0;	
}

Measured memory_bytes: 596
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef pair<ll,ll> P;
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
const ll mod=1000000007;
//ios_base::sync_with_stdio(false);
//cin.tie(NULL);
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
map<int,ll> mp;
int main(){
int n;
cin>>n;
vector<ll> a(n);
ll sum=0;
for(int i=0;i<n;i++){
    cin>>a[i];
    sum+=a[i];
}
ll cnt=0;
    ll ans=inf;
    for(int i=0;i<n;i++){
        cnt+=a[i];
        chmin(ans,abs(sum-cnt*2));
    }
    cout<<ans<<endl;

}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);  
	cin.tie(NULL);
	string s;cin>>s;
	if(s[1]=='B'){
		cout<<"ARC"<<endl;
	}
	else{
		cout<<"ABC"<<endl;
	}
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define rep(i,j,k) for(int i = (int)j;i <= (int)k;i ++)
#define debug(x) cerr<<#x<<":"<<x<<endl
#define pb push_back

typedef long long ll;
typedef pair<int,int> pi;
const int MAXN = (int)1e6+7;

int a[MAXN];

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

    int sum,n;
    cin >> sum >> n;
    rep(i,1,n) {
        cin >> a[i];
        sum -= a[i];
    }
    cout << (sum<=0?"Yes":"No") << endl;
}




Measured memory_bytes: 640
// Stellar Performance of the Debunkey Family
#include<iostream>
#include<vector>
#include<set>
#include<climits>
using namespace std;

#define NONE 0

int prim(int n, vector< vector<int> >v)
{
  set<int>selected;
  set<int>::iterator it;
  int mincost,mini;
  int i;
  int ans=0;

  selected.insert(0);

  while(selected.size()!=n){
    mincost=INT_MAX;
    mini=NONE;

    for(it=selected.begin();it!=selected.end();it++){
      for(i=0;i<n;i++){
	if(selected.find(i)!=selected.end())continue;
	if(v[*it][i]==NONE)continue;
	if(v[*it][i]>=mincost)continue;
	mincost=v[*it][i];
	mini=i;
      }
    }

    if(mini==NONE)break;
    selected.insert(mini);
    ans+=mincost;
  }

  return ans;
}

int main()
{
  int n,m,a,b,cost;
  int i;
  while(cin>>n>>m,n|m){
    vector< vector<int> >v(n,vector<int>(n,NONE));
    for(i=0;i<m;i++){
      cin>>a>>b>>cost;
      v[a][b]=v[b][a]=cost;
    }
    cout<<prim(n,v)<<endl;
  }
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define int long long
#define mp make_pair
#define endl "\n"
#define pii pair<int,int> 
#define ff first
#define ss second
#define mii map<int,int>
#define si set<int>
#define sti stack<int>
#define qi queue<int>
#define vi vector<int>
#define pq priority_queue<int>
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const int M=1e9+7;
const int N=(1<<21)+100;
int dp[N];
int a[21][21];
int n;

int find(int mask,int rem){
    if(rem==0) return(1);
    if(dp[mask]!=-1) return(dp[mask]);
    int res=0;
    for(int i=0;i<n;i++){
        if(a[rem-1][i]==1){
            if((bool)(mask & (1<<i))){
                res=(find((mask)-(1<<i),rem-1)+res)%M;
            }
        }
    }
    return(dp[mask]=res);
}

int32_t main(){
    IOS;
    cin>>n;
    memset(dp,-1,sizeof(dp));
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            cin>>a[i][j];
        }
    }
    cout<<find((1<<n)-1,n);
}

Measured memory_bytes: 16640
#include<bits/stdc++.h>
using namespace std;
long long n,k,ans;
int main(){
	scanf("%lld%lld",&n,&k);
	if(!k){printf("%lld\n",n*n);return 0;}
	for(int i=k+1,x;i<=n;i++)
		{x=(n-i+1)/i,ans+=(i-k)*(x+1)+max(0ll,n-k-i*(x+1)+1);}
	printf("%lld\n",ans);
	return 0;
}


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

//string型文字列をint型整数にして返す
int str_to_num(string s) {return atoi(s.c_str());}
//約数の総数を返す
int count_divisor(int n){int c[n/2] = {1}; int n_half = n/2; for(int i=2;i<n_half;i++){if(n%i==0){n /= i;c[i]+=1;i--;if(n>1) continue;else break;}  }int r = 1;for(int i=2;i<n_half;i++){r *= c[i];}return r;}
//各桁の数の和を返す
int dig_num(int n){return (n<10) ? n: dig_num(n/10) + n%10;}

int main(){
  int N; cin >> N;
  int w[N];
  REP(i,N){cin >> w[i];}
  
  int r = 200;
  int s = 0; REP(i,N){s+=w[i];}
  REP(i,N){
    int x = 0;
    REP(j,i){x+=w[j];}
    int y = s-x;
    r = min(abs(y-x),r);
    if(r==0){break;}
  }

  cout << r << '\n';
}

Measured memory_bytes: 256
N = int(input())
A = [int(input()) for _ in range(N)]

total = sum(A)
if total%10 == 0:
  A.sort()
  for a in A:
    if a%10 != 0:
      total -= a
      break
  else: # 全部が10の倍数
    total = 0
print(total)    
      

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
 
ll extgcd(ll x,ll y,ll &a,ll &b){
  if(y==0){
    a=1;
    b=0;
    return x;
  }
  ll res=extgcd(y,x%y,b,a);
  b -= x/y*a;
  return res;
}
 
int main(){
  int Tc;
  cin>>Tc;
  while(Tc--){
    ll x,y,z,a,b;
    cin>>x>>y;
    z=extgcd(x,y,a,b);
    ll py=abs(a);
    ll px=abs(b);
    if(z<=50000){
      cout<<3<<endl;
      cout<<0<<' '<<0<<endl;
      if(x*py-y*px<0){
        cout<<x<<' '<<y<<endl;
        cout<<px<<' '<<py<<endl;
      }else{
        cout<<px<<' '<<py<<endl;
        cout<<x<<' '<<y<<endl;
      }
    }else{
      cout<<4<<endl;
      cout<<0<<' '<<0<<endl;
      cout<<x<<' '<<y-1<<endl;
      cout<<x/z<<' '<<y/z<<endl;
      cout<<x-1<<' '<<y<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 3112
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
//const double pi=acos(-1.0);
#define mod 1000000007
#define forn(i,k,n) for(ll i=k;i<n;i++)
#define fornr(i,k,k1) for(ll i=k;i>=k1;i--)
#define v(ll) vector<ll>
#define vl(a,n,ll,k) vector<ll> a(n,k)
#define vli(a,n) vector<ll> a(n)
#define init(a,n) vector<ll> a(n);forn(i,0,n)cin>>a[i]
#define vll(a,n,m,ll,k) vector<vector<ll>> a(n,vector<ll>(m,k))
#define mp(a,ll,ll1) map<ll,ll1> a
#define st(a,ll) set<ll> a
#define mpa make_pair
#define pr pair<ll,ll>
#define pb push_back
#define MAX 1000000
#define ed '\n'
#define fileTake ifstream cin("input.txt");ofstream cout("output.txt");
#define sortv(a) sort(a.begin(),a.end())
#define sorta(a,n) sort(a,a+n)
#define yeah "Yes"
#define nil "No"
#define All(x) x.begin(),x.end()
#define remDup(a) a.erase(unique(All(a)),a.end())
#define N 100
 
void swap(ll &x,ll &y) 
{ 
	x=x^y;
	y=x^y;
	x=x^y;
} 

template<typename T>
void print(T a){for(auto i=a.begin();i!=a.end();i++)cout<<*i<<" ";cout<<endl;}
bool isVowel(char c)
{
	if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u')return true;
	return false;
}

void sync(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}

int main(){
	sync();
	ll t;
	cin>>t;
	if(t>=30)cout<<yeah<<endl;
	else cout<<nil<<endl;
}

Measured memory_bytes: 3608
input_list = list(map(int, input().split()))
takahashi = input_list[0]
aoki = input_list[1]
turn = input_list[2]
if takahashi >= turn:
    takahashi -= turn
else:
    turn -= takahashi
    takahashi = 0
    if turn > aoki:
        aoki = 0
    else:
        aoki -= turn
print(takahashi, aoki)

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

typedef long long ll;
using namespace std;

int main() {
	
	int n,x,y,z,in;
	cin >> n;
	bool a[105],b[105],c[105];
	for (int i = 0;i <= n;i++){
		a[i] = false;
		b[i] = false;
		c[i] = false;
	}

	cin >> x;
	for (int i = 0;i < x;i++){
		cin >> in;
		a[in] = true;
	}	
	cin >> y;
	for (int i = 0;i < y;i++){
		cin >> in;
		b[in] = true;
	}
	cin >> z;
	for (int i = 0;i < z;i++){
		cin >> in;
		c[in] = true;
	}

	int ans = 0;

	for (int i = 1;i <= n;i++){
		if((!a[i] && c[i]) || (b[i] && c[i])) ans++;
	}

	printf("%d\n",ans);

	return 0;

}



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

typedef long long ll;
typedef vector<int> vi;

const double PI=acos(-1.0);
const ll MOD=1000000007ll;

ll n,a,b;
ll kai[200010]; ll inkai[200010];
void input()
{
    cin>>n>>a>>b;
}

ll power(ll p, ll q)
{   
    ll res=1;
    while(q>0){
        if(q&1) res=res*p%MOD;
        p=p*p%MOD;
        q>>=1;
    }
    return res;
}

ll nCr(ll p, ll q)
{
    ll res=1;
    for(ll i=0;i<q;++i) res=res*(p-i)%MOD;
    res=res*inkai[q]%MOD;
    return res;
}

void solve()
{
    kai[1]=1ll;
    for(ll i=1;i<200005;++i) kai[i+1]=((i+1ll)*kai[i])%MOD;
    inkai[200005]=power(kai[200005],MOD-2ll);
    for(ll i=200005;i>0;--i) inkai[i-1]=i*inkai[i]%MOD;

    ll ans=power(2,n)-1ll-nCr(n,a)-nCr(n,b);
    while(ans<0) ans+=MOD;
    cout<<ans<<endl;
}

int main()
{
    cin.tie();
    ios::sync_with_stdio(false);
    input();
    solve();
    return 0;
}

Measured memory_bytes: 3328