akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
//#include <math.h>
using namespace std;

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> PP;

//-----------------------------------------------------------------------------

string s;

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

	cin>>s;
	int sum=0,S=0,T=0;
	int i=0;
	while(s[i]=='T'&&i<s.size()) i++;
	while(i<s.size()) {
		if(s[i]=='S') {
			if(T==0) S++;
			else {
				sum+=min(S,T)*2;
				if(S>T) S-=T,T=0;
				else S=T=0;
				S++;
			}
		}
		else T++;
		i++;
	}
	//cout<<S<<' '<<T<<' '<<sum<<endl;
	if(S!=0) sum+=min(S,T)*2;
	cout<<s.size()-sum<<endl;


	return 0;
}


Measured memory_bytes: 720
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <functional>
#include <string>
#include <stack>
#include <set>
#include <sstream>
#include <iomanip>
#include <limits>
#include <cstring>

using namespace std;
using ll = long long;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<string, string> sP;
typedef pair<ll, pair<ll, ll>> PP;
typedef pair<double, double >pd;

const ll mod = 1e4;
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 1 << 30;
const ll INF2 = 9e18;
const double INF3 = 9e14;
const double eps = 1e-10;
const double PI = 3.14159265358979323846;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
const int tx[8] = { -1,0,1,-1,1,-1,0,1 }, ty[8] = { -1,-1,-1,0,0,1,1,1 };

#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define pb push_back
#define eb emplace_back
#define fr first
#define sc second






int main() {
	ll a[3], ans = INF;
	for (int i = 0;i < 3;i++)cin >> a[i];
	for (int i = 0;i < 3;i++) {
		for (int j = 0;j < 3;j++) {
			for (int k = 0;k < 3;k++) {
				if (i == j || j == k || i == k)continue;
				ans = min(ans, abs(a[i] - a[j]) + abs(a[j] - a[k]));
			}
		}
	}
	cout << ans << endl;
	return 0;
}


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

int main()
{
  int r = 0, c = 0;
  cin >> r >> c;

  int cell[r+1][c+1], i, j;

  //zero
    
  for(i = 0; i <= r; i++)
  {
    for(j = 0; j <= c; j++)
    {
      cell[i][j] = 0;
    }
  }
    
  //in
    
  for(i = 0; i < r; i++)
  {
    for(j = 0; j < c; j++)
    {
      cin >> cell[i][j];
    }
  }

  //calculate

  for(i = 0; i < r; i++)
  {
    for(j = 0; j < c; j++)
    {
      cell[i][c] += cell[i][j];
    }
  }

  for(j = 0; j <= c; j++)
  {
    for(i = 0; i < r; i++)
    {
      cell[r][j] += cell[i][j];
    }
  }

  //out

  for(i = 0; i <= r; i++)
  {
    for(j = 0; j <= c; j++)
    {
      cout << cell[i][j];

      if(j == c)
      {
        cout << endl;
      }
      else
      {
        cout << " ";
      }
    }
  }

  return 0;
}


Measured memory_bytes: 3084
#include <stdio.h>

typedef struct pp{
  char name[100];
  int t;
}P;

P Q[100001+1];
int head, tail, n;

void enqueue(P x){
  Q[tail] = x;
  tail++;
  tail = tail % 100001;
}

P dequeue(){
  P ret;
  ret = Q[head];
  head++;
  head = head % 100001;
  return ret;
}


int main(){
  int elaps = 0, c , zan;
  int i, q;
  P u;
  scanf("%d %d", &n, &q);

  for ( i = 0; i < n; i++){
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
  }
  head =0;
  tail = n;
  zan = n;
  while ( head != tail)
    {
      u = dequeue();
      if (u.t <=  q){
 elaps+=  u.t;
	 printf("%s %d\n",u.name , elaps);

	 }
      else if ( u.t > q){ elaps += q;u.t -= q;enqueue(u);}
    }
  return 0;
}



Measured memory_bytes: 11960
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <deque>
#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>
#include <queue>
#include <random>
#include <complex>
#include <regex>

using namespace std;

#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}


int main() {

    long long H, W;
    cin >> H >> W;

    vector<vector<long long>> A(H, vector<long long>(W));
    for (int i = 0; i < H; i++) for (int j = 0; j < W; j++)cin >> A[i][j];

    vector<long long> x(W);
    for (int i = 0; i < W; i++) x[i] = (i + 1) * (W - i);
    vector<long long> y(H);
    for (int i = 0; i < H; i++) y[i] = (i + 1) * (H - i);

    vector<vector<long long>> B(H, vector<long long>(W, 1));
    for (int i = 0; i < H; i++) for (int j = 0; j < W; j++) B[i][j] *= x[j];
    for (int i = 0; i < W; i++) for (int j = 0; j < H; j++) B[j][i] *= y[j];

    long long ans = 0;
    for (int i = 0; i < H; i++) for (int j = 0; j < W; j++) ans += A[i][j] * B[i][j];

    cout << ans <<endl;

}












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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    int n(s.size());
    long long prime = 1000000007;
    vector<long long> count_equal(n+1, 1);
    vector<long long> count_less(n+1, 0);
    // say that s_{<i} = s_0s_1...s_{i-1}. Then:
    // count_equal[i] is the number of pairs (a,b) with a+b = a^b = s_{<i}
    // count_less[i] is the number of pairs (a,b) with a+b = a^b < s_{<i}
    for (int i = 1; i <= n; ++i) {
        if (s[i-1] == '1') {
            count_equal[i] = (count_equal[i-1]*2) % prime;
            count_less[i] = (count_less[i-1]*3 + count_equal[i-1]) % prime;
        } else {
            count_equal[i] = count_equal[i-1];
            count_less[i] = (count_less[i-1]*3) % prime;
        }
    }
    long long result = (count_equal[n] + count_less[n]) % prime;
    cout << result << endl;
    return 0;
}


Measured memory_bytes: 2000
i = int(input())
100000
i1 = len(str(i))
sum1 = 0
for j in range(1, i1+1):
 if j % 2 == 0:
  sum1 = sum1
 elif j < i1:
  sum1 = sum1 + len(range(10**(j -1), 10**(j)))
 else:
  sum1 = sum1 + len(range(10**(j -1), i + 1 ))


print(sum1)



Measured memory_bytes: 3064
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: usize = read();

    let s = String::new();

    dfs(s, b'a', n);
}

fn dfs(s: String, mx: u8, n: usize) {
    if s.len() == n {
        println!("{}", s);
    } else {
        for i in b'a'..mx+1 {
            let mut cs = s.clone();
            cs.push(i as char);
            if i == mx {
                dfs(cs, mx+1, n);
            } else {
                dfs(cs, mx, n);
            }
        }
    }
}


Measured memory_bytes: 5500
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define ALL(x) (x).begin(),(x).end()
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define PRINT(var) std::cout<<#var"= "<<var<<std::endl

using namespace std;
typedef long long unsigned int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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


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

  ll n,a,b,x,y;
  cin >>n;
  vector<ll> s(5);
  vector<ll> p(6);
  REP(i,5) p[i]=0;
  cin >> s[0] >>s[1] >>s[2]>>s[3]>>s[4];
  sort(ALL(s));
  b=0;
  if(n/s[0]>0){
    if(n%s[0]==0){
      b=n/s[0]-1;
    }else{
      b=n/s[0];
    }
  }

  cout << b+5 <<endl;
  return 0;
}


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

int main(void){
  int a[102],N,i,j,buff,Ascore,Bscore;
  char str[1000],*p;
  
  fgets(str,sizeof(str),stdin);
  N=atoi(str);
  fgets(str,sizeof(str),stdin);
  p=strtok(str," \n");
  a[0]=atoi(p);
  for(i=1;i<N;i++){
   p=strtok(NULL," \n"); 
   a[i]=atoi(p);
  }
  
  for(i=0;i<N-1;i++){
   for(j=N-1;j>i;j--){
    if(a[j-1]<a[j]){
     buff=a[j-1],a[j-1]=a[j],a[j]=buff; 
    }
   }
  }
  for(i=0;i<N;i++){
  }
  
  for(i=0,Ascore=0;2*i<N;i++){
   Ascore+=a[2*i]; 
  }
  for(i=0,Bscore=0;2*i+1<N;i++){
   Bscore+=a[2*i+1]; 
  }
  
  printf("%d\n",Ascore-Bscore);
  
 return 0; 
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

int main(){
    int H, W, D; cin >> H >> W >> D;
    map<int, pair<int, int>> a;

    for(int i=1; i<=H; i++){
        for(int j=1; j<=W; j++){
            int A; cin >> A;
            a[A] = {i, j};
        }
    }

    vector<int> d(H*W+5, 0);
    for(int i=D+1; i<=H*W; i++){
        d[i] = d[i-D] + abs(a[i].first - a[i-D].first) + abs(a[i].second - a[i-D].second);
    }

    int q; cin >> q;
    vector<int> l(q), r(q);
    for(int i=0; i<q; i++) cin >> l[i] >> r[i];

    for(int i=0; i<q; i++){
        cout << d[r[i]] - d[l[i]] << endl;
    }
}

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

const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
const ll INF = 1e16;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)

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 (b<a) { a=b; return 1; } return 0; }

void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
//--------------------------------------------------------------------------------//

int main() {
    init();
    ll x;
    cin >> x;
    cout << x * x * x << endl;
}


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

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

    string days[8] = {"", "SAT", "FRI", "THU", "WED", "TUE", "MON", "SUN"};

    int i;
    for (i = 0; i < 8; i++) {
        if (S == days[i])
            break;
    }

    cout << i << endl;

    return 0;
}

Measured memory_bytes: 256
class Ans
    attr_accessor :N,:A
    def initialize(na: ,aa: )
        @N = na
        @A = aa
    end

    def solve
        if @A != 0
            if @N % @A != 0
                (@N/@A)+1
            else
                (@N/@A)
            end
        end
    end
end



N,A= gets.chomp.split.map(&:to_i)
ans = Ans.new(na: N,aa: A)
puts ans.solve

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define in freopen("input.txt", "r", stdin)
#define out freopen("output.txt", "w", stdout)  
#define rep(i,n) for(long long int (i)=0;(i)<(n);++(i))
#define ref(i,a,b) for (long long int (i)=(a); (i)<=(b); ++(i))
#define INF 0xFFFFFF
#define endl '\n'
const unsigned int mod = 1e9+7;
const int maxInt = 2147483647;
const int mx=3005;
ll a[mx];
ll dp[mx][mx];
int main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    int n;cin >> n;
    rep(i,n)cin >> a[i];
    for(int i=n-1;i>=0;--i){
    	for(int j=i+1;j<=n;++j){
    		dp[i][j]=max(a[i]-dp[i+1][j],a[j-1]-dp[i][j-1]);
    	}
    }
    cout << dp[0][n];
    return 0;
}


Measured memory_bytes: 70016
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long H = sc.nextLong();
		int sum = 0;
		long a = 1;
		long b = 0;
		sc.close();

		while (H > 1) {
			H = H / 2;
			sum++;
		}
		for (int i = 0; i < sum; i++) {
			a = 2 * a;
			b += a;
		}
		System.out.println(b + 1);
	}
}


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

using namespace std;
int main() {
    int A, B, C, X;
    int cnt = 0;

    cin >> A >> B >> C >> X;

    for (int i = 0; i <= A; i++) {
        for (int j = 0; j <= B; j++) {
            for (int k = 0; k <= C; k++) {
                int v = 500*i + 100*j + 50*k;
                if (v == X) cnt++;
            }
        }
    }
    cout << cnt << endl;
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

#define EPS 1e-14
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define INFLL (ll)1e18 //Long long infinity
#define INF (int)1e9 //Int infinity
#define MX 100005

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<vd> vvd;
typedef vector<string> vstr;

#define us unordered_set
#define um unordered_map
#define bs bitset

typedef vector<um<int, int>> graph;

#define RANGE(i,a,b,d) for (int i=min((int)a,(int)b); i<max((int)a,(int)b); i+=d)
#define RRANGE(i,a,b,d) for (int i=max((int)a,(int)b); i>min((int)a,(int)b); i+=d)
#define FOR(i,a,b) RANGE(i,a,b,1)
#define RFOR(i,a,b) RRANGE(i,a,b,-1)
#define REP(i,s) FOR(i,0,s)
#define RREP(i,s) RFOR(i,s-1,-1)
#define FORIT(it,l) for (auto it = l.begin(); it != l.end(); it++)
#define EACH(x,v) for (auto &x : v)

#define sz(x) (int)(x).size()
#define len(x) (int)sizeof(x)/sizeof(*x)
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define contains(m,x) (m.find(x) != m.end()) // check if an element in a map
#define isIn(S, s) (S.find(s) != string::npos) // check if substring

#define pv(v) EACH(x, v) cout << x << " "; cout << endl; // print vector/array
#define pvv(vv) EACH(xx, vv){pv(xx);} // print 2-d vector/2-d array
#define pm(m) EACH(x, m) cout << x.F << ":" << x.S << " "; cout << endl; //print map/lookup table

namespace std{
  // Used for hashing pair
  template <> struct hash<pi>{
    size_t operator()(const pi&x)const{
      ll P=38923, Q=109797901;
      return (size_t)((x.F*P+x.S)%Q);
    }
  };
};

// This is min queue
template<class T> using pqg = priority_queue<T, vector<T>, greater<T>>;

template <typename T>
void print(T t){
  cout << t << endl;
}

//Python style printing
template<typename T, typename... Args>
void print(T t, Args... args){
  cout << t << " ";
  print(args...);
}

const int MAXN = 105, MAXC = 100005;
int n, c, w[MAXN], v[MAXN];
ll dp[MAXN][MAXC];
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> c;
  REP(i, n) {
    cin >> w[i] >> v[i];
  }
  REP(i, n) {
    REP(j, c+1) {
      if(i == 0 && j == 0) dp[i][j] = 0;
      else {
        ll take = 0;
        if(i > 0) {
          if(j >= w[i]) take = dp[i-1][j-w[i]] + v[i];
          else take = dp[i-1][j];
        } else {
          if(j >= w[i]) take = v[i];
          else take = 0;
        }
        ll ignore = (i > 0 ? dp[i-1][j] : 0);
        ll useless = (j > 0 ? dp[i][j-1] : 0);
        dp[i][j] = max(take, max(ignore, useless));
        //print(i, j, dp[i][j]);
      }
    }
  }
  ll ans = dp[n-1][c];
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 80128
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,n,m) for(ll i=(n);i<(m);i++)
#define REP(i,n) FOR(i,0,n)
#define REPR(i,n) for(ll i=(n);i>=0;i--)
#define all(vec) vec.begin(),vec.end()
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using P=pair<ll,ll>;
using PP=pair<ll,P>;
using vp=vector<P>;
using vpp=vector<PP>;
using vs=vector<string>;
#define fi first
#define se second
#define pb push_back
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
const ll MOD=1000000007LL;
const int INF=1<<30;
const ll LINF=1LL<<60;
const int MAX_V=100000;
struct edge{ll to,cost[2];};
ll V,E;
vector<edge> G[MAX_V];
ll d[MAX_V][2];
void dijkstra(ll s,ll f){
    priority_queue<P,vector<P>,greater<P> > que;
    REP(i,V){
        d[i][f]=LINF;
    }
    d[s][f]=0LL;
    que.push(P(0LL,s));
    while(!que.empty()){
        P p=que.top();que.pop();
        ll v=p.se;
        if(d[v][f]<p.fi)continue;
        REP(i,G[v].size()){
            edge e=G[v][i];
            if(d[e.to][f]>d[v][f]+e.cost[f]){
                d[e.to][f]=d[v][f]+e.cost[f];
                que.push(P(d[e.to][f],e.to));
            }
        }
    }
}
int main(){
    cin>>V>>E;
    ll s,t;
    cin>>s>>t;
    s--;t--;
    REP(i,E){
        ll a,b,c,d;
        cin>>a>>b>>c>>d;
        a--;
        b--;
        G[a].pb({b,{c,d}});
        G[b].pb({a,{c,d}});
    }
    dijkstra(s,0);
    dijkstra(t,1);
    vl ans(V);
    REP(i,V){
        ans[i]=d[i][0]+d[i][1];
    }
    REPR(i,V-2){
        chmin(ans[i],ans[i+1]);
    }
    REP(i,V){
        cout<<1000000000000000LL-ans[i]<<endl;
    }
    return 0;
}

Measured memory_bytes: 13124
#include<iostream>
#include<cmath>
using namespace std;
 
int main(){
    double xa,ya,xb,yb,xc,yc,xd,yd;
    while(cin>>xa>>ya>>xb>>yb>>xc>>yc>>xd>>yd){
        double dot = (xa-xb)*(xc-xd) + (ya-yb)*(yc-yd);
        if(fabs(dot) < 1e-10)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
    return 0;
}

Measured memory_bytes: 1224
#include"bits/stdc++.h"
using namespace std;
using ll=long long;
using ull=unsigned long long;
constexpr auto inf=static_cast<ll>(1e18);
template<typename T=ll>inline T in(){T ret;cin>>ret;return ret;}
template<typename T=ll>inline auto vec2(size_t h,size_t w,T v=T()){return vector<vector<T>>(h,vector<T>(w,v));}
inline void setp(int n){cout<<fixed<<setprecision(n);}
inline void delnl(){cin.ignore(numeric_limits<streamsize>::max(),'\n');}

void subset_sum(const vector<ll>&v,vector<vector<ll>>&cnt,ll ss=0,ll depth=0,ll added=0)
{
    if(depth==v.size()){
        ++cnt[ss][added];
    }else{
        subset_sum(v,cnt,ss         ,depth+1,added);
        subset_sum(v,cnt,ss+v[depth],depth+1,added+1);
    }
}
int main()
{
    ll n=in(),a=in();
    vector<ll>x1(n/2),x2(n-n/2);
    for(auto&i:x1)i=in();
    for(auto&i:x2)i=in();

    auto cnt1=vec2<ll>(x1.size()*50+1,x1.size()+1,0);subset_sum(x1,cnt1);
    auto cnt2=vec2<ll>(x2.size()*50+1,x2.size()+1,0);subset_sum(x2,cnt2);

    ll ans=0;
    for(ll i=0;i<cnt1.size();++i){
        for(ll j=0;j<cnt1[0].size();++j){
            for(ll k=j==0?1:0;k<cnt2[0].size();++k){
                ll foo=(j+k)*a-i;
                if(0<=foo&&foo<cnt2.size())ans+=cnt1[i][j]*cnt2[foo][k];
            }
        }
    }
    cout<<ans<<endl;
}


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

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


	if(a==b && b==c)
	d=1;
	else if(a==b && a!=c)
	d=2;
	else if(a==c && a!=b)
	d=2;
	else if(c==b && a!=c)
	d=2;
	else if(a!=b && b!=c)
	d=3;
	cout<<d<<endl;
	}
	return 0;
}

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

using namespace std;

#define LL long long
#define DD double
#define Pb push_back
#define Bp pop_back
#define Pf push_front
#define Fp pop_front
#define Ub upper_bound
#define Lb lower_bound
#define In insert
#define All(x) x.begin(), x.end()
#define mem(a, b) memset(a, b, sizeof(a))
#define fast ios_base::sync_with_stdio(0);cin.tie(0)
#define X first
#define Y second
#define mx1 10
#define mx2 110
#define mx3 1010
#define mx4 10010
#define mx5 100010
#define mx6 1000010

typedef vector<LL> Vl;
typedef vector<DD> Vd;
typedef vector<bool> Vb;
typedef vector<Vl> VVl;
typedef pair<LL, LL> Pll;
typedef pair<DD, DD> Pdd;
typedef vector<Pll> Vpl;
typedef vector<Pdd> Vpd;
typedef queue<LL> Ql;
typedef stack<LL> Sl;
typedef deque<LL> Dl;

LL _set(LL N, LL pos) {return N = N | (1 << pos);}
LL _reset(LL N, LL pos) {return N = N & ~(1 << pos);}
bool _check(LL N, LL pos) {return (bool)(N & (1 << pos));}
bool _upper(char a) {return a >= 'A' && a <= 'Z';}
bool _lower(char a) {return a >= 'a' && a <= 'z';}
bool _digit(char a) {return a >= '0' && a <= '9';}

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

///**************************DONE****************************///

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

    LL p = 100, ans = 0;
    while(p < n){
        p += (p / 100);
        ans++;
    }

    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 3592
n, m = [int (x) for x in input().split(' ')]
a = [[0 for i in range(m)] for j in range(n)]
b = [0 for i in range(m)]
c = [0 for i in range(n)]
for s in range(0,n):
    a[s] = [int (x) for x in input().split(' ')]
for s in range(0,m):
    b[s] = int(input())
for s in range(0,n):
    for t in range(0,m):
        c[s] += a[s][t] * b[t]
for t in range(0,n):
    print("%d" % c[t])

Measured memory_bytes: 7996
N = int(input())
P = list(map(int, input().split()))
B = sorted(P)
for i in range(N):
    for j in range(N):
        P[i], P[j] = P[j], P[i]
        if P == B:
            print('YES')
            exit()
        P[i], P[j] = P[j], P[i]

print('NO')




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

int main()
{
  long a,b;
  long ans=1;
  cin >> a >> b;
  long gcd=__gcd(a,b);
  for(long i=2;i<=sqrt(gcd);++i){
    if(gcd%i==0){
      ++ans;
      while(gcd%i==0){
        gcd/=i;
      }
    }
  }
  
  if(gcd!=1){
    ++ans;
  }
  cout << ans;
  
  return 0;
}

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

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define SUM(x) accumulate(ALL(x), 0)
#define INF 1000000000000
#define MOD 10000007
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MAXR 100000

int main()
{
  int k; cin >> k;
  int a, b; cin >> a >> b;
  string ans = "NG";
  for (int i = a; i <= b; i++) {
    if (i % k == 0) {
      ans = "OK";
      break;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3628
function Main(input){
    const AB = input.split(' ').map(Number);

    // 最小公約数
    const GCD = (a, b) => {
        if(a % b === 0) return b;
        return GCD(b, a % b);
    }
    console.log((AB[0] * AB[1]) / GCD(AB[0], AB[1]));
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 29568
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define fi first
#define se second


int main() {
    ios_base::sync_with_stdio(false);
        cin.tie(NULL);
 string s;
 cin>>s;
 int cnt=0;
 for(int i=0;i<s.size()/2;i++)
 {
     if(s[i]!=s[s.size()-1-i])
        cnt++;
 }
 cout<<cnt;

}


Measured memory_bytes: 256
import bisect

# 入力
def read_data():
    N_ = int(input())
    L_ = list(map(int, input().split()))
    return N_, L_

#探索
def binarySearch(N :int, L):
    ans = 0
    L.sort()
    # a,b は固定する
    for a_index in range(N):
        for b_index in range(a_index + 1, N):
            sum_of_a_and_b = L[a_index] + L[b_index]
            # c の可動範囲の右端を求める
            c_right_index = bisect.bisect_left(L, sum_of_a_and_b)
            # c の可動範囲は[b_index + 1, c_right_index) 右端が)となっているので-1している
            ans += max(0, c_right_index - b_index - 1)
    print(ans)

N, L = read_data()
binarySearch(N, L)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef vector<int>Vl;
typedef pair<int,int>pii;
typedef vector<pii>Vll;
typedef vector<pair<int,pair<int,int> > >Vlll;
#define S second
#define F first
#define mp make_pair
#define ms(x,y) memset(x,y,sizeof(x))
#define pb push_back
#define sl(n) cin>>n
#define pl(n) cout<<n<<" "
const int N=1e5+2;
const int inf= (int)(1e19+10LL);
    
void solve(){
   int n,k;
   sl(n);sl(k);
   bool visited[n+1];
   ms(visited,false);
   for(int i=1;i<=k;i++){
   	  int x;
   	  sl(x);
   	  while(x--){
   	  	int d;
   	  	sl(d);
   	  	visited[d]=true;
   	  }
   }
   int cnt=0;
   for(int i=1;i<=n;i++)if(visited[i]==false)cnt++;
   cout<<cnt<<endl;
   
}

signed main(){
  int test=1;
// sl(test);
 while(test--){
 	solve();
 }
 
}


Measured memory_bytes: 3620
#![allow(non_snake_case,unused_imports,dead_code)]
use std::str::FromStr;
use std::collections::{HashMap,HashSet,VecDeque,BinaryHeap};
use std::cmp::{max,min,Reverse,Ordering};
use std::time::{Duration, Instant};
use rand::Rng;
 
use proconio::input;
use proconio::marker::{Chars,Usize1,Isize1};

fn main() {
    input!{
        N:usize,
        mut A:[usize;N],
    }
    A.sort_by_key(|&x| -(x as isize));

    let mut all_gcd = A[0];
    for &a in &A[1..]{
        all_gcd = gcd(all_gcd,a);
    }
    if all_gcd != 1{
        println!("not coprime");
        return;
    }

    while !(A.is_empty()) && A[A.len()-1] == 1{
        A.pop();
    }
    
    if A.is_empty(){
        println!("pairwise coprime");
        return;
    }
    let N = A.len();
    let primes = get_primes(1_000_000);
    if N > primes.len()+100{
        println!("setwise coprime");
        return;
    }
    let mut primes = primes.iter().collect::<Vec<_>>();
    primes.sort();

    let mut facs = HashSet::new();
    for &a in &A{
        let mut a = a;
        for &&p in &primes{
            if a==1 { break;}
            if p*p > a{
                if facs.contains(&a){
                    println!("setwise coprime");
                    return;
                }
                facs.insert(a);
                break;
            }
            if a%p == 0{
                if facs.contains(&p){
                    println!("setwise coprime");
                    return;
                }
                facs.insert(p);
                while a%p == 0{
                    a /= p;
                }
            }
        }

    }

    println!("pairwise coprime");

}

fn gcd(x:usize,y:usize) -> usize{
    if y==0{return x;}
    gcd(y,x%y)
}

fn get_primes(n:usize)->HashSet<usize>{
    //n以下の素数のHashSetを返す
        let mut ret = HashSet::new();
        let mut checked = vec![false;n+1];
        for i in 2..=n{
            if checked[i] {continue;}
            ret.insert(i);
            for j in 1..=(n/i){
                checked[i*j] = true;
            }
        }
        ret
    }


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

int main()
{
    long int n, r = 0, k = 0, s;
    cin>>n;
    if(n >= 500)
    {
        r = n/500;
        n = n%500;
        if(n>=5)
        {
            k = n/5;
        }
        s = r * 1000 + k * 5;
        cout<<s<<endl;
    }
    else
    {
        r = n/5;
        s = r*5;
        cout<<s<<endl;
    }
    return 0;
}
    

Measured memory_bytes: 256
using Base.Collections
function main()
	lines=readlines()
	N,K=map(x->parse(Int,x),split(shift!(lines)))
	A=[((t,d)=map(x->parse(Int,x),split(s));(d,t)) for s=lines]
	sort!(A)
	reverse!(A)
	count=zeros(Int,N)
	ans=0
	sp=0
	now=0
	P=PriorityQueue(Int,Int)
	for i=1:K
		d,t=A[i]
		if count[t]==0
			sp+=1
		end
		count[t]+=1
		now+=d
		P[i]=d
	end
	ans=now+sp^2
	for i=K+1:N
		d,t=A[i]
		if count[t]!=0
			continue
		end
		while !isempty(P)&&count[A[peek(P).first][2]]==1
			dequeue!(P)
		end
		if isempty(P)
			break
		end
		id=dequeue!(P)
		now-=A[id][1]
		count[A[id][2]]-=1
		count[t]+=1
		now+=d
		P[i]=d
		sp+=1
		ans=max(ans,now+sp^2)
	end
	println(ans)
end
main()


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

using namespace std;

#define ll long long 
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mkp make_pair
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define ff first
#define ss second
#define endl "\n"
#define MOD 1000000007
#define MOD1 998244353
#define inf LLONG_MAX

ll GCD(ll x,ll y){if(y==0)return x;return GCD(y,x%y);}
ll LCM(ll x,ll y){return (x*y)/(GCD(x,y));}
ll LOGK(ll x,ll k){if(x>=k)return 1+LOGK(x/k,k);return 0;}
ll MPOW( ll a, ll b, ll m) { if(b==0) return 1; ll x=MPOW(a,b/2,m); x=(x*x)%m; if(b%2==1) x=(x*a)%m; return x;}
ll MINV(ll a,ll m) {return MPOW(a,m-2,m);}

class pnc{
  ll FACT_MAX,MODU;
  vector<ll> fact;
public:
  pnc( ll n, ll m) { FACT_MAX = n; fact.resize(FACT_MAX); MODU = m; MFACT_INIT(MODU);}
  void MFACT_INIT( ll m) { fact[0]=1; for(ll i=1;i<FACT_MAX;++i) fact[i]=(i*fact[i-1])%MODU;}
  ll MFACT( ll n) { return fact[n];}
  ll PERM( ll n, ll r) { return (fact[n]*::MINV(fact[n-r],MODU))%MODU;}
  ll COMB( ll n , ll r) { return (PERM(n,r)*::MINV(fact[r],MODU))%MODU;}
};

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

    ll test=1;
    //cin>>test;
    while(test--)
    {
        ll n,k;
        cin>>n>>k;

        vector<ll> prev(n+1);

        for(ll i=0;i<n;i++)
        {
            cin>>prev[i];
        }

        vector<ll> f;
        vector<ll> ans(n);

        for(ll i=0;i<n;i++)
        f.pb(n);

        while(k--)
        {
            vector<ll> nxt(n+1,0);

            for(ll i=0;i<n;i++)
            {
                if(prev[i]+i<=n)
                nxt[prev[i]+i]++;
                else
                nxt[n]++;

                if(i-prev[i]-1>=0)
                nxt[i-prev[i]-1]--;
            }

            for(ll i=n-1;i>=0;i--)
            nxt[i]+=nxt[i+1];

            for(ll i=0;i<n;i++)
            {
                ans[i]=nxt[i];
                prev[i]=nxt[i];
            }

            if(ans==f)
            break;
        }

        for(auto i:ans)
        cout<<i<<' ';
    }
}

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

namespace program
{
    class Program
    {
        static void Main()
        {
          int[] num = Input.ScanIntArray();
          Console.WriteLine(num[0]+num[1] > 9 ? "error" : $"{num[0]+num[1]}");
        }
    }

    static class Input
    {
        static public int ScanInt() { return int.Parse(Console.ReadLine()); }
        static public uint ScanUint() { return uint.Parse(Console.ReadLine()); }
        static public long ScanLong() { return long.Parse(Console.ReadLine()); }
        static public ulong ScanUlong() { return ulong.Parse(Console.ReadLine()); }
        static public int[] ScanIntArray() { return Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); }
        static public uint[] ScanUintArray() { return Console.ReadLine().Split(' ').Select(x => uint.Parse(x)).ToArray(); }
        static public long[] ScanLongArray() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray(); }
        static public ulong[] ScanUlongArray() { return Console.ReadLine().Split(' ').Select(x => ulong.Parse(x)).ToArray(); }

        static public string ScanStr() { return Console.ReadLine(); }
        static public string[] ScanStrArray() { return ScanStr().Split(' '); }
    }

    static class MyMath
    {
        public static int GCD(int a, int b)
        {
            Func<int, int, int> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }
        public static ulong GCD(ulong a, ulong b)
        {
            Func<ulong, ulong, ulong> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }
        public static int LCM(int a, int b)
        {
            return a * b / GCD(a, b);
        }
        public static ulong LCM(ulong a, ulong b)
        {
            return a * b / GCD(a, b);
        }
    }
}


Measured memory_bytes: 13396
#include<stdio.h>
int main()
{
	int a[101][101], b[101][101];
	long c[101][101]={{0}}; 
	int n, m, l, i, j, k;  
	
	scanf("%d%d%d", &n, &m, &l);  
	
	for(i=0; i<n; i++)
	{
		for(j=0; j<m; j++)
		{
			scanf("%d", &a[i][j]); 
		}
	}
	
	for(i=0; i<m; i++)
	{
		for(j=0; j<l; j++) 
		{
			scanf("%d", &b[i][j]);
		} 
	}
	
	for(i=0; i<n; i++)
	{
		for(k=0; k<m; k++)
		{
			for(j=0; j<l; j++)
			{
				c[i][j] += a[i][k] * b[k][j];    
			}
		}
	}

	for(i=0; i<n; i++) 
	{
		for(j=0; j<l; j++)
		{
			printf("%ld", c[i][j]);       
			
			if(l-1 == j) 
			{
				printf("\n");   
			}
			else
			{
				printf(" ");    
			}
		}
	}
	return 0; 
}

Measured memory_bytes: 772
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func nextInt() int {
        i, e := strconv.Atoi(nextStr())
        if e != nil {
                panic(e)
        }
        return i
}

func main() {
        sc.Split(bufio.ScanWords)
        op := ""

        for op != "?" {
                a := nextInt()
                op = nextStr()
                b := nextInt()

                switch op {
                case "+":
                        fmt.Println(a + b)
                case "-":
                        fmt.Println(a - b)
                case "*":
                        fmt.Println(a * b)
                case "/":
                        fmt.Println(a / b)
                }
        }
}


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

def main():
    n,q = map(int, input().split())
    way = [[] for _ in range(n)]
    for i in range(n-1):
        a,b = map(int, input().split())
        way[a-1].append(b-1)
        way[b-1].append(a-1)
    add = [0]*n
    for i in range(q):
        a,b = map(int, input().split())
        add[a-1] += b
    ans = [-1]*n
    ans[0] = add[0]
    
    stack = [(0,add[0])]
    while stack:
        a,b = stack.pop()
        for i in range(len(way[a])):
            if (ans[way[a][i]]==-1):
                stack.append((way[a][i],b+add[way[a][i]]))
                ans[way[a][i]] = b+add[way[a][i]]
    print(*ans)
    
if __name__=="__main__":
    main()

Measured memory_bytes: 73604
N,C,K = list(map(int,input().split()))
a = [int(input()) for i in range(N)]
a.sort()

if C == 1:
  print(N)
else:
  cnt = 0
  ans = 0
  left = 0
  right = 0
  for i in range(N):
    if left <= a[i] <= right:
      cnt += 1
      if cnt == C:
        left = 0
        right = 0
    else:
      left = a[i]
      right = a[i] + K
      cnt = 1
      ans += 1
    #print(left,right)
    #print(cnt)
    #print("------")
  else:
    print(ans)

Measured memory_bytes: 50264
#include<bits/stdc++.h>
using namespace std;
 
#define pii pair<int,int>
#define pll pair<ll,ll>
#define eb emplace_back
#define ll long long
#define nl '\n'
#define in() ( { int a ; scanf("%d",&a); a; } )
 
const int N = 3e5 + 9;
const int mod = 1e9 + 7;
//int dx[]={1,0,-1,0,1,-1,-1,1};
//int dy[]={0,1,0,-1,1,1,-1,-1};

int main()
{
    double l, ans;
    int L;
    cin >> L;
    l = L / 3.0;
    ans = l * l * l;
    cout << fixed << setprecision(12) << ans << nl;
}

Measured memory_bytes: 256
def main():
    N, S = map(int, input().split())
    A = tuple(map(int, input().split()))

    MOD = 998244353

    dp = [[0]*(S+1) for _ in range(N+1)]
    dp[0][0] = 1
    # morau
    for i, a in enumerate(A):
        dp[i][0] = pow(2, i, MOD)
            
        for j in range(S+1):
            if j >= a:
                dp[i+1][j] = 2 * dp[i][j]
                dp[i+1][j] %= MOD
                dp[i+1][j] += dp[i][j-a]
                dp[i+1][j] %= MOD
            else:
                dp[i+1][j] = 2 * dp[i][j]
                dp[i+1][j] %= MOD
                

    print(dp[N][S])
if __name__ == "__main__":
    main()

Measured memory_bytes: 132516
n = gets.to_i
a = gets.chomp.split(" ").map(&:to_i)
b = Array.new(n).map{Array.new}
n.times do |i|
  b[i] = [a[i],i]
end
b = b.sort{|x,y| x[0] <=> y[0]}
b.each do |x|
  print "#{x[1]+1} "
end


Measured memory_bytes: 20464
n, k = map(int, input().split())
A = list(map(int, input().split()))

list=[-1]*n
list[1-1]=0 #町1は0ばんめ

p=1
count=0
end=False

while True:
    count+=1
    p=A[p-1]
    if count==k:
        end=True
        break

    if list[p-1]==-1:
        list[p-1]=count
    else:
        loop=count-list[p-1]
        break

if end==False:
    count+=loop*(((k-count)//loop)-1)
    while True:
        count+=1
        p=A[p-1]
        if count==k:
            end=True
            break

print(p)

Measured memory_bytes: 32380
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] result = new int[N];
		for (int i = 1; i <= N; i++) {
			int a = sc.nextInt();
			result[a - 1] = i;

		}
		
		for(int i = 0; i < N; i++) {
			if (i != N - 1) {
				System.out.print(result[i] + " ");
			} else {
				System.out.print(result[i]);
			}
		}
	}
}

Measured memory_bytes: 60712
#include <iostream>
#define MAX 45

using namespace std;

int f[MAX];

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

int main(){
  int n; cin >> n;
  for(int i=0;i<=n;i++) f[i]=-1;
  cout << fib(n) << endl;
}

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

int main(){
  char c;
  cin >> c;
  if (c == 'a') {
  cout << "vowel" << endl;
  }
  else if (c == 'i') {
    cout << "vowel" << endl;
  }
  else if (c == 'u') {
    cout << "vowel" << endl;
  }
  else if (c == 'e') {
    cout << "vowel" << endl;
  }
  else if (c == 'o') {
    cout << "vowel" << endl;
  }
  else {
    cout << "consonant" << endl;
  }
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
long dp[101][8],mod=1e9+7,p[]={1,1,2,3,5,8,13,21};
int h,w,k;
main()
{
	cin>>h>>w>>k;
	dp[0][0]=1;
	for(int i=0;i<h;i++)
	{
		for(int j=0;j<w;j++)
		{
			if(j>0)(dp[i+1][j-1]+=dp[i][j]*p[j-1]*p[w-j-1])%=mod;
			(dp[i+1][j]+=dp[i][j]*p[j]*p[w-j-1])%=mod;
			if(j<w-1)(dp[i+1][j+1]+=dp[i][j]*p[j]*p[w-j-2])%=mod;
		}
	}
	cout<<dp[h][k-1]<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
 
 
int main(void){
 
 int n,a,b;
 scanf("%d",&n);
 if(n==1){
 printf("Hello World\n");
}
else{
 scanf("%d %d",&a,&b);
  printf("%d\n",a+b);
}
 
 
return 0;
 
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <numeric>
#include <random>
using namespace std;

const int cm = 1 << 17;
char cn[cm], *ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

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

inline int gcd_of_vector(int A[100000], int begin, int end){
  int result = A[begin];
  for(int i=begin;i<end;i++){
    result = gcd(A[i],result);
  }
  return result;
}

inline int gcd_of_vector_with_skip(int A[100000], int skip, int size){
  int result = A[0];
  if(skip==0)result=A[1];
  for(int i=1;i<size;i++){
    if(i==skip)continue;
    result = gcd(A[i],result);
  }
  return result;
}

int main() {
  int N=getint();
  int A[100000];
  for(int i=0;i<N;i++)A[i]=getint();

  if(N>=100){
    cout<<max(gcd_of_vector(A,0,N/2),gcd_of_vector(A,N/2,N))<<"\n";
  }else{
    int ans=0;
    for(int i=0;i<N;i++){
      ans=max(ans,gcd_of_vector_with_skip(A,i,N));
    }
    cout<<ans<<"\n";
  }
  return 0;
}


Measured memory_bytes: 768
let () = Scanf.scanf "%d\n%s" @@ fun n s ->
  let (dpw, dpb) =
    Array.fold_left (fun (dpw, dpb) -> function
      | '#' -> (1 + dpw, min dpw dpb)
      | '.' -> (dpw, 1 + min dpw dpb)) (0, 0) @@
    Array.init n (String.get s) in
  Printf.printf "%d\n" @@ min dpw dpb
  



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

int main(){
    int a,b,c,t;
    cin >> a >> b >> c;
	if(a>b){
		t=a;
		a=b;
		b=t;
	}
    if(b>c){
    	t=b;
		b=c;
		c=t;
    }
    if(a>b){
		t=a;
		a=b;
		b=t;
	}
    cout << a <<" "<< b <<" "<< c <<"\n";
    return 0;
}


Measured memory_bytes: 3104
#include<cstdio>
#include<cstring>
#include<algorithm>
#define MAXN 10000006
using namespace std;
char s[MAXN];
int w;
int main()
{
	scanf("%s",s);
	scanf("%d",&w);
	for(int i=0;i<strlen(s);i+=w)
		printf("%c",s[i]);
}

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

n = int(input())
csfn = [() for i in range(n-1)]
tl = [0]*n
for i in range(n-1):
  c,s,f = map(int,input().split())
  csfn[i] += (c,s,f)
  
  for j in range(i+1):
    if tl[j] < csfn[i][1]:
      tl[j] = csfn[i][1] + csfn[i][0]
    elif tl[j] % csfn[i][2] == 0:
      tl[j] += csfn[i][0]
    else:
      tl[j] += csfn[i][0] + csfn[i][2] - tl[j] % csfn[i][2]
for k in tl:
  print(k)  

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define pi 3.141592653589793
using namespace std;


int main() {
//    cout << setprecision(10);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);


    string s;
    cin >> s;
    for (int i = 0; i < s.size(); i++) {
        if (i % 2 && s[i] == 'R') {
            cout << "No";
            return 0;
        }

        if (i % 2 == 0 && s[i] == 'L') {
            cout << "No";
            return 0;
        }
    }

    cout << "Yes";


}

Measured memory_bytes: 256
n = int(input())
houses = [[[0 for i in range(10)]for j in range(3)]for k in range(4)]

for i in range(n):
    a, b, c, d = list(map(int, input().split()))
    houses[a-1][b-1][c-1] += d

for i in range(4):
    if i > 0:
        print('#' * 20)
    for j in range(3):
        for k in range(10):
            print(' ', end = '')
            print(houses[i][j][k], end = (''))
        print()


Measured memory_bytes: 5636
#include<bits/stdc++.h>
        #define ll  long long
        #define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
        #define rep(i,a,b)  for(ll i=a;i<b;i++)
        #define pb push_back
        #define Max(x,y,z) max(x,max(y,z))
        #define f first
        #define s second
        #define lbd lower_bound
        #define sz(x)       (ll)x.size()
        #define pi 3.1415926536
        #define mod 1000000007
        #define MOD 998244353
        using namespace std;
        void solve()
        {
            ll n,m,k,res=0,l=0,r=0,z,sum1=0,cnt1=0,h,c,x,y;
            string t;
            cin>>n;
            ll ar[n+1];
            ll br[n];
            rep(i,0,n+1) cin>>ar[i];
            rep(i,0,n) cin>>br[i];
            ll ans=0;
            rep(i,0,n)
            {   ans+=min(res,ar[i]);
                ar[i]-=min(res,ar[i]);
                x=min(ar[i],br[i]);
                ans+=x;
                ar[i]-=x;
                res=br[i]-x;
            }
            ans+=min(ar[n],res);
            cout<<ans;

            
            
        }
        int main()
        {   
            /*#ifndef ONLINE_JUDGE
            freopen("input.txt","r",stdin);
            freopen("output.txt","w",stdout);
            #endif*/
     
            speed_up
            ll t;
            //cin>>t;
            t=1;
            while(t--)
                solve();
        }

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define rrep(i,n) for(int i=(int)n-1;i>=0;--i)
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T& a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U& u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U& u,const V... v){for(auto& e:u)fill_v<T>(e,v...);}

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

    int n, m;
    cin >> n >> m;
    string s;
    cin >> s;
    vector<set<int>> g(n);
    auto cnt = make_vec<int>(n, 2);
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        if (g[a].count(b)) continue;
        g[a].insert(b);
        g[b].insert(a);
        cnt[a][s[b] == 'B']++;
        if (a != b) cnt[b][s[a] == 'B']++;
    }

    queue<int> q;
    rep(i, n) if (!cnt[i][0] || !cnt[i][1]) q.push(i);
    while (!q.empty()) {
        int v = q.front(); q.pop();
        if (cnt[v][0] == -1) continue;
        for (int u : g[v]) {
            g[u].erase(v);
            cnt[u][s[v] == 'B']--;
            if (!cnt[u][s[v] == 'B']) q.push(u);
        }
        cnt[v][0] = cnt[v][1] = -1;
    }
    rep(i, n) if (cnt[i][0] != -1) {
        puts("Yes");
        return 0;
    }
    puts("No");
}


Measured memory_bytes: 41028
n = gets.chomp.to_i
if n >= 64
    puts "64"
elsif n >= 32
    puts "32"
elsif n >= 16
    puts "16"
elsif n >= 8
    puts "8"
elsif n >= 4
    puts "4"
elsif n >= 2
    puts "2"
else
    puts "1"
end

Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<int, nuint_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> new_data_set; 
#define int long long
#define MOD 1000000007
#define what_is(x) cerr << #x << " is " << x << endl;
#define loop(i,a,n) for(int i=a;i<n;i++)
#define pb emplace_back
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, szof(x))
#define sortall(x) sort(aint(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626 
 
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
typedef pair<int, int> pt;

// int arr[2][2]={{0,1},{1,0}};
signed main() {

	fastio();
	//#define LOCAL_DEFINE	
	#ifdef LOCAL_DEFINE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
		//https://zhuhan0.blogspot.com/2017/09/leetcode-425-word-squares.html
		//https://yzygitzh.github.io/algorithm/2018/11/09/leetcode-summary.html
		//https://beginnersbook.com/2015/03/why-dont-we-call-run-method-directly-why-call-start-method/
		//https://leetcode.com/problems/lfu-cache/
	// int n,k;
	// cin>>n>>k;
	// vector<int> arr(n);
 // 	for(int i=0;i<n;i++)
 // 	{
 // 		cin>>arr[i];
 // 	}
 // 	set<int> hash;
 // 	int ans=0;
 // 	bool flag=false;
 // 	for(int i=0;i<k;i++)
 // 	{
 // 		if(hash.lower_bound(arr[i])!=hash.end())
 // 		{
 // 			flag=true;
 // 		}
 // 		hash.insert(arr[i]);
 // 	}
 // 	if(flag)
 // 	{
 // 		ans++;
 // 	}
 // 	bool flag1=false;
 // 	for(int i=k;i<n;i++)
 // 	{
 // 		cout<<ans<<endl;
 // 		hash.erase(arr[i-k]);
 // 		if(hash.lower_bound(arr[i])!=hash.end())
 // 		{
 // 			ans++;
 // 		}else if(hash.lower_bound(arr[i-k])!=hash.begin())
 // 		{
 // 			ans++;
 // 		}else{
 // 			flag1=true;
 // 		}

 // 		hash.insert(arr[i]);	
 // 	}
 // 	if(!flag || !flag1)
 // 		ans++;
 // 	cout<<ans;

	int n;
	cin>>n;

	if(n%2)
	{
		cout<<fixed<<setprecision(10)<<((double)(n/2+1)/(double)n);
	}else{
		cout<<(0.5)<<endl;
	}	
 	return 0;
}
 

Measured memory_bytes: 256