akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <climits>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REP1(i,n) for(ll i=1;i<=(ll)(n);i++)

ll gcd(int a, int b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

ll lcm(int a, int b)
{
   return a * b / gcd(a, b);
}

ll power(ll a, ll n)
{
    if (n == 0)
        return 1;
    ll p = power(a, n / 2);
    p = (p * p);
    if (n % 2)
        return (p * a);
    else
        return p;
}

int main(int argc, char *argv[]) {

  int k;
  string s;

  cin >> k;
  cin >> s;
    
  if( s.size() <= k ){
      cout << s << endl;
  } else {
      cout << s.substr(0,k) + "..." << endl;
  } 
  return 0;
}




Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<double>vec(n);
  for(int i = 0;i<n;i++) cin >> vec[i];
  sort(vec.begin(), vec.end());
  double anser = vec[0];
  for(int i = 0;i<n;i++){
    anser = (anser + vec[i])/2;
  }
  cout << anser << endl;
}

Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().strip()

def main():
    N, T = map(int, input().split())
    cv = [tuple(map(int, input().split())) for _ in range(N)]
    dp1 = [[0]*(T+1) for _ in range(N+2)] # [0, i]
    dp2 = [[0]*(T+1) for _ in range(N+2)] # [i, N]

    # 貰うdp
    for i in range(N):
        cost, value = cv[i]

        # dp1
        for now in range(min(T+1, cost)):
            dp1[i+1][now] = dp1[i][now]

        for now in range(cost, T+1):
            old = now - cost
            dp1[i+1][now] = max(dp1[i][now], dp1[i][old] + value)

        # dp2
        cost, value = cv[(N-i)-1]
        for now in range(min(T+1, cost)):
            dp2[N-i][now] = dp2[N-(i-1)][now]

        for now in range(cost, T+1):
            old = now - cost
            dp2[N-i][now] = max(dp2[N-(i-1)][now], dp2[N-(i-1)][old] + value)
    
    ans = 0
    for i in range(1, N+1):
        i_value = cv[i-1][1]
        i_max = max([dp1[i-1][j] + dp2[i+1][(T-1)-j] + i_value for j in range(T)])
        ans = max(ans, i_max)
    print(ans)


    

if __name__ == "__main__":
    main()

Measured memory_bytes: 179976
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
# from scipy.sparse.csgraph import floyd_warshall
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations, combinations_with_replacement
from heapq import heappop, heappush, heapify
from fractions import gcd
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7

def main():
    n = int(input())
    ans = n*(n+1)*(n+2)//6
    for i in range(n-1):
        u,v = map(int,input().split())
        if u > v:
            u,v = v,u
        ans -= (u)*(n-v+1)
    print(ans)
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 79440
def main():
    n, m, x = map(int, input().split())
    a = map(int, input().split())

    cost_move_to_left = 0
    cost_move_to_right = 0
    for i in a:
        if i > x:
            cost_move_to_left += 1
        elif i < x:
            cost_move_to_right += 1

    print(cost_move_to_left if cost_move_to_left < cost_move_to_right else cost_move_to_right)



if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
using System;

public class Program
{
  public static void Main(string[] args)
  {
    string[] read_1 = Console.ReadLine().Split(' ');
    int rows = int.Parse(read_1[0]);
    int columns = int.Parse(read_1[1]);
    int[,] spreadsheet = new int[rows+1,columns+1];
    for(int i = 0;i < rows;i++)
    {
      string[] read_2 = Console.ReadLine().Split(' ');
      for(int j = 0;j < columns;j++)
      {
        spreadsheet[i,j] = int.Parse(read_2[j]);
      }
    }
    // Console.WriteLine("!");
    for(int i = 0;i < rows;i++)
    {
      for(int j = 0;j < columns;j++)
      {
        spreadsheet[i,columns] += spreadsheet[i,j];
      }
    }
    // Console.WriteLine("!");
    for(int i = 0;i < columns;i++)
    {
      for(int j = 0;j < rows;j++)
      {
        spreadsheet[rows,i] += spreadsheet[j,i];
      }
      spreadsheet[rows,columns] += spreadsheet[rows,i];
    }
    for(int i = 0;i < rows+1;i++)
    {
      for(int j = 0;j < columns+1;j++)
      {
        Console.Write(spreadsheet[i,j]);
        if(j != columns) Console.Write(" ");
      }
      Console.WriteLine();
    }
  }
}

Measured memory_bytes: 9288
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n").map(Number);
var w=[1, 2, 4, 8, 16, 32, 64, 128, 256, 512];
w.reverse();
for(var i=0;i<Arr.length;i++){
   var a=Arr[i];
   var arr=[];
   w.forEach(function(v){
      if(a>=v){
         a=a-v;
         arr.push(v);
      }
   });
console.log(arr.reverse().join(" "));
}

Measured memory_bytes: 7904
#include <stdio.h>
int main(){
  int	d;
  scanf("%d", &d);
  if	 (d==22){ printf("Christmas Eve Eve Eve"); }
  else if(d==23){ printf("Christmas Eve Eve"); }
  else if(d==24){ printf("Christmas Eve"); }
  else if(d==25){ printf("Christmas"); }
  return 0;
}

Measured memory_bytes: 1680
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
const ll MOD=998244353;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

ll mod_pow(ll x,ll n){
  x%=MOD;
  ll res=1;
  while(n>0){
    if(n&1) res=res*x%MOD;
    x=x*x%MOD;
    n>>=1;
  }
  return res;
}

ll mod_inverse(ll x){
  return mod_pow(x,MOD-2);
}

//const ll MOD=998244353; // MOD == 119*2^23+1
//depends on mod_pow,mod_inverse

ll root[24],invroot[24];

void NTT_init(){
    for(int i=0;i<24;++i){
        root[i]=mod_pow(3,(MOD-1)/(1<<i));
        invroot[i]=mod_inverse(root[i]);
    }
}

vector<ll> NTT(vector<ll> a,bool inverse=false){
    int n=a.size();
    int high=0;
    for(int i=0;(1<<i)<n;++i) high++;

    for(int i=0;i<n;++i){
        int mask=0;
        for(int k=0;k<high;++k){
            if(i>>k&1) mask|=(1<<(high-1-k));
        }
        if(i<mask) swap(a[i],a[mask]);
    }

    for(int j=1;(1<<j)<=n;++j){
        int m=(1<<j);
        ll zeta=root[j];
        if(inverse) zeta=invroot[j];
        for(int i=0;i<n;i+=m){
            ll powzeta=1;
            for(int k=i;k<i+m/2;++k){
                ll s=a[k];
                ll t=a[k+m/2]*powzeta%MOD;

                a[k]=(s+t)%MOD;
                a[k+m/2]=(s-t+MOD)%MOD;
                powzeta=powzeta*zeta%MOD;
            }
        }
    }

    if(inverse){
        ll invn=mod_inverse(n);
        for(int i=0;i<n;++i) a[i]=a[i]*invn%MOD;
    }
    return a;
}

vector<ll> convolute(const vector<ll> &a,const vector<ll> &b){
    int size=a.size()+b.size()-1;
    int n=1;
    while(n<size) n<<=1;

    vector<ll> A(n,0),B(n,0);
    for(int i=0;i<a.size();i++) A[i]=a[i];
    for(int i=0;i<b.size();i++) B[i]=b[i];

    A=NTT(A);
    B=NTT(B);

    for(int i=0;i<n;++i) A[i]=A[i]*B[i]%MOD;
    A=NTT(A,true);

    A.resize(size);
    return A;
}

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

  int N,M;
  cin>>N>>M;
  vector<ll> A(N),B(M);
  rep(i,N) cin>>A[i];
  rep(i,M) cin>>B[i];

  NTT_init();

  vector<ll> C=convolute(A,B);
  for(auto c:C) cout<<c<<" ";
  cout<<"\n";

  return 0;
}


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

const int maxn = (1e5 + 12);
long long int a[maxn], mx, m, n;

int main() {
	cin >> n >> m;
	for (int i = 0; i < n; i++) cin >> a[i];
	for (int i = 0; i < n; i++) a[i] /= 2ll;
	mx = a[0];
	for (int i = 1; i < n; i++) {

		mx = ((mx * a[i]) / __gcd(mx, a[i]));
		if((mx / a[i]) % 2 == 0) return cout << 0, 0;
	}
	m -= (m % mx);
	mx = (m / mx);

	if(mx % 2) mx = (mx / 2) + 1;
	else mx /= 2;
	cout << mx;
	return 0;
}



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

int main(){
  long long a,x,y;
  int b = 0;
  cin >> a;
  b = sqrt(a);
  for(int i = b;i > 0;i--){
    if(a % i == 0){
      x = i;
      y = a / i;
      break;
    }
  }
  cout << x+y-2 << endl; 
}
  

Measured memory_bytes: 256
//111 B - AtCoder Beginner Contest 111 2018/09/29
#include <bits/stdc++.h>
#define rep(i ,n) for(int i=0;i<(int)(n);++i)
using namespace std;
typedef long long int int64;
typedef unsigned long long uint64;

bool is_tri_dig(int x){
    int d1,d2,d3;
    d1=((x/10)/10)%10;
    d2=(x/10)%10;
    d3=x%10;
    if( d1 == d2 && d2 == d3) return true;
    return false;
}

int main(){
    int n; cin >> n;
    for(int i=n;i<=999;++i){
        if (is_tri_dig(i)) {cout << i << 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()
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,ans=0,ans2=0,x=0,y=0;
string s,t,S;
signed main() {
    //cin >> n;
    //n >> x >> y;
    cin >> s >> t;
  REP(i,s.size()){
  if(s[i]==t[i])ans++;
  }
  cout << ans;
}

Measured memory_bytes: 3576
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
      int ans = 0;
		for(int i=1; i<=n; ++i){
          ans = ans + i;
        }
      System.out.println(ans);
	}
}


Measured memory_bytes: 35884
#include <bits/stdc++.h>
using namespace std;
const int N=2e6+10;
int q[N];
int main()
{
	//std::ios::sync_with_stdio(false);
	//cin.tie(0);
	int k;
	cin>>k;
	string s;
	cin>>s;
	int l=s.size();
	if(l>k)
	{
		for(int i=0;i<k;i++)cout<<s[i];
		cout<<"...";
	}
	else cout<<s;
}


Measured memory_bytes: 3596
n = int(input())
a  = list(map(int, input().split()))
wallet = 1000
stock = 0

for i in range(len(a)-1):
    if a[i] >= a[i+1]:
        wallet += stock*a[i]
        stock = 0
    else:
        stock += wallet//a[i]
        wallet %= a[i]

wallet += stock*a[n-1]

print(wallet)


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

using namespace std;
 
int main()
{
    int N;
    cin >> N;
    vector<int> B;
    for (int i=0; i<N-1; i++) {
        int temp;
        cin >> temp;
        B.push_back(temp);
    }
    long result = B[0];
    // cout << result << " ";
    for (int i=0; i<N-1; i++) {
        if (i != N-2 ) {
            if (B[i] > B[i+1]) {
                result += B[i+1];
            } else {
                result += B[i];
            }
        } else {
            result += B[i];
        }
        // cout << i << " " << N-1 << " " << B[i] << " " << B [i+1] << " " << result << endl;
    }
    // cout << endl;
    cout << result;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
	ll n,m,k,prefa[200050],prefb[200050];
	cin >> n >> m >> k;
	prefa[0]=0;
	for(int i=1; i<=n; i++){
		ll x;
		cin >> x;
		prefa[i]=prefa[i-1]+x;
	}
	prefb[0]=0;
	for(int i=1; i<=m; i++){
		ll x;
		cin >> x;
		prefb[i]=prefb[i-1]+x;
	}
	ll jwb=0;
	for(int i=0; i<=n; i++){
		if(prefa[i]>k)break;
		ll sisa=k-prefa[i];
		ll l=0,r=m,mid,ans=0;
		while(l<=r){
			mid=(l+r)/2;
			if(prefb[mid]<=sisa){
				l=mid+1;
				ans=mid;
			}
			else{
				r=mid-1;
			}
		}
		jwb=max(jwb,i+ans);
	}
	cout << jwb << endl;
}

Measured memory_bytes: 6728
S = [s for s in input()]
K = int(input())
N = len(S)

# print(S, K)

ord_a = ord('a')

T = [0]*N
for i in range(N):
    s = S[i]
    a = ord(s)
    r = (ord_a + 26 - a) % 26
    if r <= K:
        K -= r
        s = 'a'
    T[i] = s
if K > 0:
    t = T[N - 1]
    a = ord(t)
    a = ord_a + (a - ord_a + K) % 26
    T[N - 1] = chr(a)
print(''.join(T))


Measured memory_bytes: 51952
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int X,Y,a,b;
  cin >> X >> Y;
  a = (4*X - Y)*5;
  b = (Y - 2*X)*5;
  if(a%10==0 && b%10==0 && a>=0 && b >=0){cout<<"Yes"<<endl;}
  else{cout<<"No"<<endl;}
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define FOR(i, a, b) for(int i = (int)a; i <= (int)b; i++)
#define DEC(i, a, b) for(int i = (int)a; i >= (int)b; i--)
typedef pair<int, int> pi;
typedef pair<pi, int> pii;
typedef pair<pi, pi> pipi;
#define f first
#define s second
typedef vector<int> vi;
typedef vector<pi> vpi;
typedef vector<pii> vpii;
#define pb push_back
#define pf push_front
#define all(v) v.begin(), v.end()
#define disc(v) sort(all(v)); v.resize(unique(all(v)) - v.begin());
#define INF (int) 1e9 + 100
#define LLINF (ll) 1e18
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define sandybridge __attribute__((optimize("Ofast"), target("arch=sandybridge")))
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());    //can be used by calling rng() or shuffle(A, A+n, rng)
inline ll rand(ll x, ll y) { ++y; return (rng() % (y-x)) + x; } //inclusivesss

int n;
ld ans, a, cur;

int main() {
	fastio; cin >> n;
	FOR(i, 1, n) {
		cin >> a;
		cur += (1/a);
	}
	cout << fixed << setprecision(9) << 1/cur;
}


Measured memory_bytes: 3736
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <cmath>
#include <deque>
#include <iterator>
#include <map>
#include <queue>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
template<class T> inline bool chmax(T& a, T b) {if (a<b) {a=b; return true;} return false;}
template<class T> inline bool chmin(T& a, T b) {if (a>b) {a=b; return true;} return false;}

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;

int main() {
  ll n, l; cin >> n >> l;
  V<string> S(n); REP(i, n) cin >> S[i];
  sort(S.begin(), S.end());
  REP(i, n) cout << S[i];
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Here your code !

    string str[7]={"Wednesday","Thursday","Friday","Saturday","Sunday","Monday","Tuesday"};
    int month[13]={0,31,29,31,30,31,30,31,31,30,31,30,31};
    while(1){
            int m,d,n=0;
    cin>>m>>d;
    if(m==0) break;

    for(int i=1;i<m;i++){
        n=n+month[i];
    }
    n=n+d;
    
  
        
        cout<<str[n%7]<<endl;
    }
}

Measured memory_bytes: 1192
X, N = map(int, input().split())
if N == 0:
  print(X)
else:
  p = list(map(int, input().split()))
  flag = True
  i = 0
  ans_min = 2**8
  while flag:
    cand = X - i
    if not cand in p:
      ans_min = cand
      flag = False
    cand = X + i
    if not cand in p:
      ans_max = cand
      flag = False
    i += 1
    
  if ans_min != 2**8:
    print(ans_min)
  else:
    print(ans_max)

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

using namespace std;

typedef long long ll;

const ll M = 1e9 + 7;
ll n;
string s;
ll a[200005];
ll ans = 1;
ll cnt = 0;
ll cnt2 = 0;


int main()
{
    cin>>n>>s;
    for(ll i = 0; i < s.size(); i++)
    {
        bool v = false;
        if(s[i] == 'B') v = true;
        if(v ^ (cnt % 2)) cnt++, a[i] = 1;
        else cnt--, a[i] = -1;
        if(cnt < 0)
        {
            printf("0\n");
            return 0;
        }
    }
    if(cnt != 0)
    {
        printf("0\n");
        return 0;
    }
    for(ll i = 0; i < s.size(); i++)
    {
        if(a[i] == -1) ans *= cnt2, cnt2--;
        else cnt2++;
        ans %= M;
    }
    for(ll i = 1; i <= n; i++)
    {
        ans *= i;
        ans %= M;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 2180
N=int(input())
for i in range(1,3501):
    for j in range(i,3501):
        bw=4*i*j-N*i-N*j
        if bw<=0:
            continue
        if (N*i*j)%bw==0:
            print(i,j,(N*i*j)//bw)
            exit()

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for(int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

int main() {
    string s, t;
    cin >> s >> t;
    int n = s.size();
    int m = t.size();
    int ans = 1001001;
    rep(i,n-m+1){
        int tmp = 0;
        rep(j,m){
            if(s[i+j]!=t[j])tmp++;
        }
        ans = min(ans, tmp);
    }
    cout << ans << endl;
    return 0;
}




Measured memory_bytes: 3596
n = int(input())
arr = list(map(int,input().split()))
arr.sort(reverse=True)

if n % 2 == 0:
    ans = 2*sum(arr[:n//2]) -arr[0]
else:
    ans = 2*sum(arr[:n//2]) -arr[0] + arr[n//2]

print(ans)

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

using namespace std;
using llong = unsigned long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

template<typename T>
constexpr T inf = static_cast<T>(pow(10, static_cast<int>(log10(numeric_limits<T>::max())))) + 7;
constexpr llong mod = 1e9+7;

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

  cout << (a + b + 2 * sqrtl(a * b) < c ? "Yes": "No") << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, n) for(int i = 1; i < n; i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define yesorno(a) printf(a ? "yes\n" : "no\n")
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define YESorNO(a) printf(a ? "YES\n" : "NO\n")
using P = pair<int,int>;
using vi = vector<int>;
using vii = vector<vi>;
using ll = long long;
const int dx4[4] = {1,0,-1,0};
const int dy4[4] = {0,1,0,-1};
const int dx8[8] = {-1,0,1,1,1,0,-1,-1};
const int dy8[8] = {1,1,1,0,-1,-1,-1,0};

ll com(ll n, ll a){
  ll x = 1, y = 1;
  rep(i,a){
    x *= n-i;
    y *= i+1;
  }
  ll res = x / y;
  return res;
}

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

  string s;
  cin >> s;
  int n = s.size();
  bool ok = true;
  rep(i,n/2){
    if(s[i] != s[n-1-i]) ok = false;
  }
  for(int i = 0; i < n/2; i++){
    if(s[i] != s[n/2-1-i]) ok = false;
  }
  for(int i = (n+1)/2; i < n; i++){
    if(s[i] != s[(n-1)-(i-(n+1)/2)]) ok = false;
  }
  YesorNo(ok);
}

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

int N, M;
int s[5], c[5];
int d[3];

void _main() {
    cin >> N >> M;
    if (N == 1 && M == 0) {
        cout << 0 << endl;
        return;
    }
    REP (i, N) d[i] = -1;
    bool ng = false;
    REP (i, M) {
        cin >> s[i] >> c[i];
        s[i]--;
        if (d[s[i]] < 0) d[s[i]] = c[i];
        else if (d[s[i]] != c[i]) ng = true;
    }
    if (N > 1 && d[0] == 0) ng = true;
    if (ng) {
        cout << -1 << endl;
        return;
    }
    REP (i, N) cout << (d[i] < 0 ? (i == 0) : d[i]);
    cout << endl;
}

signed main(signed argc, char **argv) {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    _main();
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>

using namespace std;

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

	if (a > 12)
	{
		cout << b << endl;
	}
	else if (a > 5)
	{
		cout << b / 2 << endl;
	}
	else
	{
		cout << 0 << endl;
	}

	return 0;
}



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

class Program
{
    static void Main()
    {
        int N = int.Parse(Console.ReadLine());
        int[] A = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();

        //Aの左からインデックスiまでの最大公約数をインデックスiに格納する配列
        int[] X1 = new int[N];
        X1[0] = A[0];
        for(int i = 1; i < N; i++)
        {
            X1[i] = GCD(X1[i - 1], A[i]);
        }

        //Aの右からインデックスiまでの最大公約数をインデックスiに格納する配列
        int[] X2 = new int[N];
        X2[N - 1] = A[N - 1];
        for (int i = N - 2; i >= 0; i--)
        {
            X2[i] = GCD(X2[i + 1], A[i]);
        }

        int max = 0;

        for(int i = 0; i < N; i++)
        {
            if (i - 1 < 0)
            {
                max = Math.Max(max, X2[i + 1]);
            }
            else if (i + 1 > N - 1)
            {
                max = Math.Max(max, X1[i - 1]);
            }
            else
            {
                max = Math.Max(max, GCD(X1[i - 1], X2[i + 1]));
            }
        }

        Console.WriteLine(max);
    }

    static int GCD(int num1, int num2)
    {
        if (num1 <= num2)
        {
            int tmp = num1;
            num1 = num2;
            num2 = tmp;
        }

        int rem;
        Math.DivRem(num1, num2, out rem);

        if (rem == 0)
        {
            return num2;
        }
        else
        {
            return GCD(num2, rem);
        }
    }
}



static class MathUtil
{
    public static IEnumerable<IEnumerable<int>> GetPermutation(int n)
    {
        if (n == 0)
        {
            yield return Single(0);
            yield break;
        }

        for (int i = 0; i <= n; i++)
        {
            foreach (var x in GetPermutation(n - 1))
            {
                yield return Single(i).Concat(x.Select(itm => itm < i ? itm : itm + 1));
            }
        }
    }

    private static IEnumerable<int> Single(int x)
    {
        yield return x;
    }

    public static IEnumerable<int> EnumeratePrimeNumbers()
    {
        List<int> primes = new List<int>() { 2 };
        yield return 2;

        for (int i = 3; i < int.MaxValue; i++)
        {
            bool isPrime = true;
            int Sqrt = (int)Math.Sqrt(i) + 1;

            foreach (var prime in primes)
            {
                if (prime > Sqrt)
                {
                    break;
                }
                if (i % prime == 0)
                {
                    isPrime = false;
                    break;
                }
            }

            if (isPrime)
            {
                primes.Add(i);
                yield return i;
            }
        }
    }
}



Measured memory_bytes: 31068
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
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;}


int main() {
    int n;
    cin >> n;
    vector<int>dp(n+10000,n);
    dp[0] = 0;
    for(int i = 1;i<=n;i++) {
        for(int pow6 = 1;pow6<=i;pow6 *= 6) {
            chmin(dp[i],dp[i-pow6]+1); 
        }
        for(int pow9 = 1;pow9<=i;pow9 *= 9) {
            chmin(dp[i],dp[i-pow9]+1); 
        }
    }
    cout << dp[n] << endl;
}    

Measured memory_bytes: 640
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define PB push_back
#define MP make_pair
#define ll long long

inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}

int main(){
    std::ios::sync_with_stdio(false);

    multiset<ll> prices;
    ll n, m;
    cin >> n >> m;
    for(int i=0;i<n;++i)
    {
        int tmp;
        cin >> tmp;
        prices.insert(tmp);
    }

    while(m > 0)
    {
        ll largest = *(prices.rbegin());
        prices.erase(std::prev(prices.end()));
        prices.insert(largest / 2);
        --m;
    }
    ll ret = std::accumulate(prices.begin(), prices.end(), 0LL);
    cout << ret << endl;
}

Measured memory_bytes: 4992
#include<iostream>
#include<sstream>
#include<algorithm>
#include<vector>
#include<string>
typedef long long ll;
using namespace std;

int main(){
	ll N;
	cin>>N;
	vector< vector<pair<ll,ll> > > data(N);
	ll A;
	vector<pair<ll, ll> > buf;
	pair<ll, ll> pairbuf;
	string pattern = string(N,'0') + string(N,'1');
	for(int i=0; i<N; i++){
		cin>>A;
		buf.clear();
		for(int j=0; j<A; j++){
			cin>>pairbuf.first>>pairbuf.second;

			buf.push_back(pairbuf);
		}
		data[i]=buf;
	}
	vector<string> all;
	for ( int i = 0; i <= N; ++i ) {
		string str = pattern.substr(i,N);
    do {
      all.push_back(str);
    } while ( next_permutation(str.begin(), str.end()) );
  	}
	ll ans=0;
	ll a=0;
	ll x,y;
	ll flag=0;
	string check;

	for(int i=0; i<all.size(); i++){
		check = all[i];
		flag=0;
//		cout<<check<<endl;
		for(int j=0; j<check.size(); j++){
			if(check[j]=='1'){
				for(int k=0; k<data[j].size(); k++){
					x = data[j][k].first;
					y = data[j][k].second;
//					cout<<j<<"\t"<<x<<"\t"<<y<<"\t"<<check[x-1]<<"\t"<<y<<endl;
					if(check[x-1] - '0' != y){
						flag++;
					}
				}
			}
		}
		if(flag==0){
			a=0;
			for(int j=0; j<check.size(); j++){
				if(check[j] == '1'){
					a++;
				}
			}
			ans = max(ans,a);
		}
	}
	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 2172
#include<bits/stdc++.h>
using namespace std;
     
     
//#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long
#define sd(x) scanf("%d",&x)
#define sld(x) scanf("%lld",&x)
#define pld(x) printf("%lld\n",x)
#define pd(x) printf("%d\n",x)

int main(){
    int A,P;
    scanf("%d %d",&A,&P);
    int pcs = A*3+P;
    int pie = pcs/2;
    pd(pie);
    return 0;
}

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


int main() {
   int N;
   cin >> N;
   if(N %2 != 0){
       cout << N/2 + 1;
       return 0;
   }
   else
   cout << N/2; 
}
    


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int n;
  cin>>n;
  int s[n];
  for(int i=0;i<n;i++) cin>>s[i];
  int q;
  cin>>q;
  int t[q];
  for(int i=0;i<q;i++) cin>>t[i];
  int ans=0;
  int used[q];
  memset(used,0,sizeof(used));
  for(int i=0;i<n;i++){
    for(int j=0;j<q;j++){
      if(used[j]) continue;
      if(s[i]==t[j]){
	ans++;
	used[j]=1;
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3144
import math
N = int(input())
l_x = []
l_y = []
s = 0
a = (math.factorial(N) * (N-1)) // (((N-1)*N)//2)
for i in range(N):
    x,y = map(int,input().split())
    l_x.append(x)
    l_y.append(y)
for i in range(N):
    for j in range (i+1,N):
        m = (l_x[i]-l_x[j])**2 + (l_y[i] - l_y[j])**2
        s += math.sqrt(m)*a
print(s / math.factorial(N))

Measured memory_bytes: 38384
N = int(input())
As = list(map(int, input().split()))

sumA = sum(As)

ys = [0]*N
for i in range(1, N):
    ys[i] = As[i-1]-ys[i-1]

sumY = sum(ys)

z = sumA-sumY
#print(z)
#print(ys)
x = z - sumY

for i in range(N):
    ys[i] *= 2
    if i%2:
        ys[i] -= x
    else:
        ys[i] += x

print(' '.join(map(str, ys)))


Measured memory_bytes: 19484
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
int main()
{
	long long x, y;
	cin >> x >> y;
	long long cnt = 0;
	long long tmp = x;
	vector<long long> vec;
	long long pos = 0;
	while(1)
	{
		vec.push_back(tmp);
		tmp = vec[pos] * 2;
		if(tmp > y)
			break;
		pos++;
	}
	cout << vec.size() << endl;
	return 0;
}

Measured memory_bytes: 256
<?php
fscanf(STDIN, "%d %d", $N, $X);
$x = array_map("intval", explode(" ", trim(fgets(STDIN))));
$x[] = $X;
rsort($x);
$x_min = min($x);
$x = array_map(function($a) use($x_min) {return $a - $x_min;}, $x);

for ($i = 1; $i <= $N; $i++) {
    if (!isset($ans)) {
        $ans = gcd($x[$i - 1], $x[$i]);
    } else {
        $ans = gcd($ans, $x[$i]);
    }
    if ($ans === 1) break;
}
echo $ans;

//最大公約数
function gcd($m, $n){
    if($n > $m) list($m, $n) = array($n, $m);
     
    while($n !== 0){
        $tmp_n = $n;
        $n = $m % $n;
        $m = $tmp_n;
    }
    return $m;
}


Measured memory_bytes: 16884
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for (int i = 0; i < n; ++i)
#define REP(i,k,n) for (int i = k; i <= n; ++i)
#define REPR(i,k,n) for (int i = k; i >= n; --i)
#define pb push_back
#define F first
#define S second
#define I insert
#define mp make_pair
#define sz(a) (int)((a).size())
#define all(a) (a).begin(), (a).end()
#define debug1(a) cout<<" a : "<<a<<"\n"
#define debug2(a,b) cout<<" a : "<<a<<" b : "<<b<<"\n"
#define debug3(a,b,c) cout<<" a : "<<a<<" b : "<<b<<" c : "<<c<<"\n"
#define debug4(a,b,c,d) cout<<" a : "<<a<<" b : "<<b<<" c : "<<c<<" d : "<<d<<"\n"
// #define M 421412341324321
#define MOD 998244353 


signed main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	
	int n,m,p;
	cin>>n>>m>>p;

	int a[m+1][3];

	rep(i,m)
	{
		cin>>a[i+1][0]>>a[i+1][1]>>a[i+1][2];
		a[i+1][2] = p-a[i+1][2];
	}
	vector <int> d(n+1, INT_MAX);
	d[1] = 0;

	rep(i,n-1)
	{
		REP(j,1,m)
		{
			int x = a[j][0], y = a[j][1], w = a[j][2];
			if ( d[y]>d[x]+w)
			{
				d[y] = d[x]+w;
			}
		}
	}
	int temp = d[n];
	rep(i,n-1)
	{
		REP(j,1,m)
		{
			int x = a[j][0], y = a[j][1], w = a[j][2];
			if ( d[y]>d[x]+w)
			{
				d[y] = d[x]+w;
			}
		}
	}
	if (d[n]!=temp) cout<<-1;
	else
	{
		int ans = max(0LL,-d[n]);
		cout<<ans;
	}
	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define int long long
using namespace std;
vector<vector<int>> g;
vector<bool> used;
vector<vector<int>> dp;
int mod = 1e9 + 7;

void dfs(int v) {
    used[v] = true;
    dp[v][0] = 1;
    dp[v][1] = 1;
    for (auto to : g[v]) {
        if (!used[to]) {
            dfs(to);
            dp[v][0] *= (dp[to][0] + dp[to][1]);
            dp[v][0] %= mod;
            dp[v][1] *= dp[to][0];
            dp[v][1] %= mod;
        }
    }
}

int32_t main () {
    int n;
    cin >> n;
    g.resize(n);
    for (int i = 0; i < n-1; ++i) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    used.resize(n);
    dp.assign(n, vector<int>(2));
    dfs(0);
    cout << (dp[0][0] + dp[0][1]) % mod << endl;
}


Measured memory_bytes: 18324
#include<bits/stdc++.h>
#define de(x) cout<<#x<<"="<<x<<endl;
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define repd(i,a,b) for(int i=a;i>=(b);--i)
#define ll long long
#define mt(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define inf 0x7f
#define pii pair<int,int>
#define pdd pair<double,double>
#define pdi pair<double,int>
#define mp(u,v) make_pair(u,v)
#define sz(a) a.size()
#define ull unsigned long long
#define ll long long
#define pb push_back
const int maxn = 100010;
const double EPS = 1e-6;
using namespace std;
int a[maxn];
int v[maxn];
int main()
{
	int n;
	mt(v,0);
	scanf("%d",&n);
	rep(i,1,n+1) {
		scanf("%d",a+i);
	}
	int ans=0;
	rep(i,1,n+1){
		if(a[i]==i){
			i++;
			ans++;
		}
	}
	printf("%d\n",ans);
	return 0;
}



Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin>>S;
  vector<int>list(S.size());
  for(int i=0;i<S.size();i++){
    list.at(i)=S.at(i)-'0';
  }
  int mini=700;
  for(int i=0;i<S.size()-2;i++){
    int k;
    int t;
    k=list.at(i)*100+list.at(i+1)*10+list.at(i+2);
    t=max(k,753)-min(k,753);
    if(t<mini){
      mini=t;
    }
    else{
    }
  }
  cout<<mini<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin >> N;
    int tmp;
    int Ans[N];
    for(int i=0;i<N;i++){
        cin >> tmp;
        Ans[tmp-1] = i + 1;
    }

    for(int i=0;i<N;i++){
        cout << Ans[i] << " ";
    }
    return 0;
}

Measured memory_bytes: 1152
#include <iostream>  
#include <vector>
using namespace std;
int main(void)
{
	int hn, length;
	int min = 0;
	int k;
	vector<int> v1;
	cin >> length >> hn;
	cin >> k;
	v1.push_back(k);
	for (int i = 1; i < hn; i++)
	{
		int k;
		cin >> k;
		if (min < (k - v1[i - 1]))
		{
			min = (k - v1[i - 1]);
		}
			v1.push_back(k);
	}
	//cout << min;
	//cout << length - v1[hn - 1] + v1[0];
	if (min < (length - v1[hn - 1] + v1[0]))
		min = length - v1[hn - 1] + v1[0];
		cout << length - min;

}


Measured memory_bytes: 1400
import itertools

N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
permutation = list(itertools.permutations(range(1, N + 1)))

a = permutation.index(P) + 1
b = permutation.index(Q) + 1
print(abs(a - b))


Measured memory_bytes: 8052
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(), x.end()
#define inf 1e9
typedef pair<int,int> pii;
typedef pair <long long,long long> pll;
typedef long long ll; 
typedef long double ld; 
const ll mod = 1e9+7;

ll dp[22][(1<<22)];
int solve(vector<vector <int> > &comp, int i , int womenSubs , int n )
{
    if(i == n+1)
	{	if(womenSubs == 0)
			return 1;
		else
			return 0;
	}
	if(dp[i][womenSubs] != -1)
		return dp[i][womenSubs];
	ll ans = 0;
	for(int w = 0; w < n; w++)
	{	bool avail = (((1<<w)&(womenSubs)) == 0) ? 0 : 1;
		if(avail && comp[i][w+1])
		{
			ans = (ans + solve(comp, i+1 , (womenSubs ^ (1<<w)), n)) % mod;
		}
	}
	return dp[i][womenSubs] = ans;
} 
int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL);
	int n; cin >> n;
	vector <vector <int>> comp(n+1, vector <int>(n+1));
	memset(dp , -1, sizeof dp);
	for(int i = 1; i<= n; i++)
	{	for(int j = 1; j<= n; j++)
		{
			cin >> comp[i][j];
		}
	}
	cout << solve(comp,1 , ((1<<(n))-1) , n);
	return 0;
}


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

#ifndef ONLINE_JUDGE
	#define W(x, y) cerr << "\033[31m" << #x << " = " << x << "\033[0m" << y;
#else
	#define W(x, y)
#endif

#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vii vector<pii>
#define vl vector<ll>
#define vll vector<pll>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pi acosl(-1)
#define ld long double
#define prime (1000000000 + 7)
#define INF 1000000000

using namespace std;
 
ld pot(ld b, ll e){
	ld res = 1;
	while (e){
		if(e&1){
			res *= b;
		}
		b *= b;
		e >>= 1;
	}
	return res;
}

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

	ll n, m;
	cin >> n >> m;
	vector<vector<char>> mat(n, vector<char>(m)), mat2(n, vector<char>(m));
	for(int i = 0; i < n; ++i){
		for(int j = 0; j < m; ++j){
			cin >> mat[i][j];
			mat2[i][j] = mat[i][j];
		}
	}
	queue<pair<pll, ll>> fila;
	fila.push({{0, 0}, 1});
	vll dir{{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
	mat2[0][0] = '#';
	ll res = -1;
	while(!fila.empty()){
		auto a = fila.front();
		fila.pop();
		if(a.ff.ff == n-1 && a.ff.ss == m-1){
			res = -a.ss;
			for(int i = 0; i < n; ++i){
				for(int j = 0; j < m; ++j){
					if(mat[i][j] == '.'){
						res++;
					}
				}
			}
			break;
		}
		for(auto&p:dir){
			if(0 <= a.ff.ff + p.ff && a.ff.ff + p.ff < n &&
			  0 <= a.ff.ss + p.ss && a.ff.ss + p.ss < m &&
			  mat2[a.ff.ff + p.ff][a.ff.ss + p.ss] == '.'){
				mat2[a.ff.ff + p.ff][a.ff.ss + p.ss] = '#';
				fila.push({{a.ff.ff + p.ff, a.ff.ss + p.ss}, a.ss + 1});
			}
		}
	}
	cout << res << "\n";

	return 0;
}

// 2^x >= k/i

// s 		= 		p^1 + p^2 + p^3 + p^4 + ... + p^(n-1) + p^n
// s/p 		= p^0 + p^1 + p^2 + p^3 + p^4 + ... + p^(n-1)
// _____________________________________________________________
// s - s/p	= p^n - p^0
// s 		= (p^n - p^0)*p/(p - 1)


Measured memory_bytes: 256
def ans(a):
    ans = 1
    if 0 in a:
        return 0
    for i in A:
        ans *= i
        if 10 ** 18 < ans:
            ans = -1
            return ans
    return ans


N = int(input())
A = list(map(int, input().split()))

print(ans(A))


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

int main() {
  string S, T, U;
  int A, B;
  cin >> S >> T >> A >> B >> U;
  if (U == S) {
    cout << A - 1 << " " << B << endl;
  }
  else {
    cout << A << " " << B - 1 << endl;
  }

}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


class Mod:
    def __init__(self, m):
        self.m = m

    def add(self, a, b):
        return (a + b) % self.m

    def sub(self, a, b):
        return (a - b) % self.m

    def mul(self, a, b):
        return ((a % self.m) * (b % self.m)) % self.m

    def div(self, a, b):
        return self.mul(a, pow(b, self.m-2, self.m))

    def pow(self, a, b):
        return pow(a, b, self.m)


class Combination:
    def __init__(self, n, mod):

        g1 = [1, 1]
        g2 = [1, 1]
        inverse = [0, 1]
        for i in range(2, n + 1):
            g1.append((g1[-1] * i) % mod)
            inverse.append((-inverse[mod % i] * (mod//i)) % mod)
            g2.append((g2[-1] * inverse[-1]) % mod)
        self.MOD = mod
        self.N = n
        self.g1 = g1
        self.g2 = g2
        self.inverse = inverse

    def __call__(self, n, r):
        if (r < 0 or r > n):
            return 0
        r = min(r, n-r)
        return self.g1[n] * self.g2[r] * self.g2[n-r] % self.MOD

@mt
def slv(X, Y):
    C = Combination(10**6, 10**9+7)
    M = Mod(10**9+7)
    ans = 0
    for i in range(X+1):
        if (X - i) % 2 != 0:
            continue
        j = (X - i) // 2
        if 2*i + j != Y:
            continue
        ans = M.add(ans, C(i+j, i))

    return ans


def main():
    X, Y = read_int_n()
    print(slv(X, Y))


if __name__ == '__main__':
    main()


Measured memory_bytes: 125212
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int R = sc.nextInt();
		if(N >= 10) {
			System.out.println(R);
		}else {
			System.out.println( R + 100*(10 - N));
		}
		
		
	}
}




Measured memory_bytes: 21588
#include <iostream>
#include<vector>
#include<algorithm>
#include <queue>
#include <string>
#include <set>
#include <bitset>

using namespace std;
#define ff(i,n,m) for(int i=n;i<m;i++)
#define i64 int64_t
#define tos(x) to_string(x)

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

	vector<string> n(a),m(b);
	ff(i, 0, a) {//read n
		string x;
		cin >> x;
		n.at(i) = x;
	}
	ff(i, 0, b) {//read m
		string x;
		cin >> x;
		m.at(i) = x;
	}
	ff(i1, 0, a-b+1) {
		ff(i2, 0, a - b+1) {
			int cor = 0;
			ff(j, 0, b) {
				ff(k, 0, b) {
					if (n.at(i1 + j).at(i2 + k) == m.at(j).at(k)) {
						cor++;
					}
					else {
						cor = -1;
						break;
					}
				}
				if (cor == -1) {
					break;
				}
			}
			if (cor == b * b) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define all(x) x.begin(),x.end()

template<class T>
static inline std::vector<T> ndvec(size_t&& n, T val) { return std::vector<T>(n, std::forward<T>(val)); }
template<class... Tail>
static inline auto ndvec(size_t&& n, Tail&&... tail) {
  return std::vector<decltype(ndvec(std::forward<Tail>(tail)...))>(n, ndvec(std::forward<Tail>(tail)...));
}
template<class Cond> struct chain {
  Cond cond; chain(Cond cond) : cond(cond) {}
  template<class T> bool operator()(T& a, const T& b) const { if(cond(a, b)) { a = b; return true; } return false; }
};
template<class Cond> chain<Cond> make_chain(Cond cond) { return chain<Cond>(cond); }

void solve() {
  i64 N;
  cin >> N;
  vector<i64> A(N);
  rep(i,0,N) cin >> A[i];;
  string S;
  cin >> S;
  set<i64> bases;
  for(int i = N; i --> 0;) {
    if(S[i] == '0') {
      i64 x = A[i];
      for(auto iter = std::rbegin(bases); iter != std::rend(bases); iter++) {
        x = std::min(x, x ^ (*iter));
      }
      if(x != 0) bases.insert(x);
    }
    else {
      i64 x = A[i];
      for(auto iter = std::rbegin(bases); iter != std::rend(bases); iter++) {
        x = std::min(x, x ^ (*iter));
      }
      if(x != 0) {
        cout << "1" << "\n";
        return;
      }
    }
  }
  cout << "0" << "\n";
}

int main() {
  i64 T;
  cin >> T;
  while(T--) {
    solve();
  }
}


Measured memory_bytes: 3564
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)
mod = 10 ** 9 + 7


N, M = map(int, input().split())
a = [int(input()) for _ in range(M)]
a.append(-1)
a = a[::-1]

dp = [0] * (N + 10)
dp[0] = 1

# 配る
for i in range(N):
    if i == a[-1]:
        a.pop()
        dp[i] = 0
        continue
    dp[i + 1] += dp[i]
    dp[i + 1] %= mod
    dp[i + 2] += dp[i]
    dp[i + 2] %= mod

ans = dp[N]
print(ans)


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

typedef long lint;
typedef long long llint;
typedef pair<int, int> pint;
typedef pair<long long, long long> pllint;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const llint INF = 1<<21;
// static const llint MOD = 1e9 + 7;

bool compPair(const pint& arg1, const pint& arg2) { return arg1.first > arg2.first; }
template<class T> void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> void chmin(T& a, T b) { if (a > b) { a = b; } }

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

    int ans = 4, repmax = -1, reptmp, ntmp;
    for(int in=1;in<=n;in++) {
        reptmp = 0;
        ntmp = in;
        while(ntmp%2==0) {
            ntmp /= 2;
            reptmp++;
        }
        if(reptmp>repmax) {
            ans = in;
            repmax = reptmp;
        }
    }
    cout << ans << endl;
    return 0;
}


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

int main(){
  int A,B;
  cin >> A >> B;
  long long cnt=0;
  for(int i=1;i<=9;i++){
    for(int j=0;j<=9;j++){
      for(int k=0;k<=9;k++){
        int n=10000*i+1000*j+100*k+10*j+i;
        if(A<=n && n<=B) cnt++;
      }
    }
  }
  cout << cnt << endl;
  return 0;
}
        

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(ll i = 0; i < n; i++)
const ll INF = 1LL << 60;


int main(){
    double A, B, H, M;
    cin >> A >> B>> H >> M;
    double theta = abs(6.0 * M - ((H * 60.0 + M) * 0.5));
    if(theta == 180.0){
        cout << A + B << endl;
        return 0;
    }else if(theta > 180) theta = 360 - theta;
    theta = theta * M_PI / 180.0;
    double ans = A * A + B * B - 2 * A * B * cos(theta);
    cout << fixed << setprecision(15) << sqrt(ans) << endl;
}

Measured memory_bytes: 4224
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

int keta(long long int n){
  int ans=0;
  for(int i=0;; i++){
    n = n/10;
    if(n == 0) break;
    ans += 1;
  }
  return ans+1;
}
int main()
{
  long long int N;
  cin >> N;
  long long int A,B;
  A = 1;
  B = N;
  int mink = 100;
  for(int i=0; i < sqrt(N)+1; i++){
   if(A*B==N){
     int k = max(keta(A), keta(B));
     if(k < mink)
       mink = k;
   }
   A += 1;
   B = N/A;
  }
  cout << mink << 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 reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) begin(x), end(x)
#define uniq(x) (x).erase(unique(all(x)), end(x))
#define bit(n) (1LL << (n))
#define cdiv(a, b) (((a) - 1) / (b) + 1)
#define dump(x) cerr << #x " = " << (x) << endl
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template<typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
constexpr long double PI = 3.1415926535897932384626433832795028L;
constexpr int DY[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int DX[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T> void fin(T mes) {
    cout << mes << endl;
    exit(0);
}
template<typename T, typename U> bool chmax(T &a, const U &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> bool chmin(T &a, const U &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T, typename U> ostream &operator<<(ostream &os, const pair<T, U> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct setup {
    static constexpr int PREC = 20;
    setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

int K, S;
signed main() {
    cin >> K >> S;
    int ans = 0;
    for (int X = 0; X <= K; X++) {
        for (int Y = 0; Y <= K; Y++) {
            int Z = S - X - Y;
            if (0 <= Z && Z <= K) { ans++; }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main() {
	int a;
	int e;
	cin >> a;
	if (a < 105) {
		cout << '0' << "\n";
	}
	else if (a >= 105 && a < 135) {
		cout << '1' << "\n";
	}
	else if (a >= 135 && a < 165) {
		cout << '2' << "\n";
	}
	else if (a >= 165 && a < 189) {
		cout << '3' << "\n";
	}
	else if (a >= 189 && a < 195) {
		cout << '4' << "\n";
	}
	else{
		cout << '5' << "\n";
	}
	cin >> e;
}

Measured memory_bytes: 256