akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x) cerr << #x << " : " << x << '\n'

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const ll Mod = 1e9 + 7;
const int Maxn = 2e5 + 10;
const ll Inf = 2242545357980376863LL;
const ll Log = 30;
ll Base = 101;

ll dp1[Maxn];
ll dp2[Maxn];
int main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	str s;
	cin >> s;
	
	ll n = s.size();
	s = '!' + s;
	for(int i = 1 ; i <= n; i++){
		dp1[i] = dp2[i - 1] + 1;
		if(s[i] != s[i - 1]) dp1[i] = max(dp1[i], dp1[i - 1] + 1);
		if(i >= 2) dp2[i] = max(dp1[i - 2], dp2[i - 2]) + 1;
		else dp2[i] = -1000000;
	}
	//n = 5;
	cout << max(dp1[n], dp2[n]);
	return 0; 
}

/*

                                 ____              ,----..               ,----..
   ,---,                       ,'  , `.           /   /   \             /   /   \
  '  .' \                   ,-+-,.' _ |          /   .     :           /   .     :
 /  ;    '.              ,-+-. ;   , ||         .   /   ;.  \         .   /   ;.  \
:  :       \            ,--.'|'   |  ;|        .   ;   /  ` ;        .   ;   /  ` ;
:  |   /\   \          |   |  ,', |  ':        ;   |  ; \ ; |        ;   |  ; \ ; |
|  :  ' ;.   :         |   | /  | |  ||        |   :  | ; | '        |   :  | ; | '
|  |  ;/  \   \        '   | :  | :  |,        .   |  ' ' ' :        .   |  ' ' ' :
'  :  | \  \ ,'        ;   . |  ; |--'         '   ;  \; /  |        '   ;  \; /  |
|  |  '  '--'          |   : |  | ,             \   \  ',  /          \   \  ',  /
|  :  :                |   : '  |/               ;   :    /            ;   :    /
|  | ,'                ;   | |`-'                 \   \ .'              \   \ .'
`--''                  |   ;/                      `---`                 `---`
                       '---'

*/

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

int main(void){
    string s, t;
    int ans = 0;
    cin >> s >> t;
    for(int i = 0; i < s.size(); i++){
        if(s[i] != t[i]) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3856
package main

import (
	"fmt"
)

func main() {
	var a,b,c int
	fmt.Scan(&a,&b,&c)

	var ans string
	if a == b && a == c {
		ans = "No"
	} else if a != b && a != c && b != c{
		ans = "No"
	} else {
		ans = "Yes"
	}

	fmt.Println(ans)
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define mod 1000000007
#define int long long

int path(int x, int y, int h, int w, vector<vector<int>>&dp) {
	if (x > h - 1 || y > w - 1)return 0;
	if (dp[x][y] != -1)return dp[x][y];
	if (x == h - 1 && y == w - 1)return dp[x][y] = 1;
	if (dp[x][y] != -1)return dp[x][y];
	return dp[x][y] = (path(x, y + 1, h, w, dp) % mod + path(x + 1, y, h, w, dp) % mod) % mod;
}

void solve() {
	int h, w;
	cin >> h >> w;
	vector<vector<char>> a(h, vector<char>(w));
	int i, j;
	for (i = 0; i < h; i++) {
		for (j = 0; j < w; j++)cin >> a[i][j];
	}
	vector<vector<int>> dp(h, vector<int>(w));
	for (i = 0; i < h; i++) {
		for (j = 0; j < w; j++) {
			if (a[i][j] == '#')dp[i][j] =  0;
			else dp[i][j] = -1;
		}
	}
	int cnt = path(0, 0, h, w, dp);
	cout << cnt << endl;
	return;
}

int32_t main() {
	std::ios::sync_with_stdio(false);
	cout.tie(0);
	cin.tie(0);
	solve();
	return 0;
}


Measured memory_bytes: 12108
s=input()[::-1]
p=[1]+[0]*12
q=1
t=[[(i*k)%13 for i in range(10)]for k in range(13)]
for i in s:
    if i!="?":
        i=int(i)
        g=t[q][i]
        p=p[-g:]+p[:-g]
    else:
        d=[0]*13
        for j in t[q]:
            r=p[-j:]+p[:-j]
            d=[(r[i]+d[i])%(10**9+7)for i in range(13)]
        p=d
    q=(q*10)%13
print(p[5]%(10**9+7))

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

int main(){
    int s=0, f=0, n, count = 0;

    while(count != 3){
        cin >> n;
        if(n==5){
            f++;
        }else if(n==7){
            s++;
        }
        count++;
    }

    if(f==2 && s==1){
        cout << "YES" << endl;
    }else{
        cout << "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 REPR(i, n) for (int i = (n); i >= 0; i--)
#define ALL(x) (x).begin(), (x).end()
#define OUT(x) std::cout << (x) << std::endl
typedef long long ll;

int main() {
    int h, n;
    cin >> h >> n;
    int sum = 0;
    REP(i, n) {
        int a;
        cin >> a;
        sum += a;
    }
    if (sum >= h)
        OUT("Yes");
    else
        OUT("No");
}

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Problem Specific Parameter:

int h,w;

int ans[110][110];
vector<int> a;

int main(void){
	cin >> h >> w;

	int n;
	cin >> n;
	rep(i,n){
		int num;
		cin >> num;
		rep(loop,num) a.push_back(i+1);
	}


	rep(idx,h*w){
		const int i = idx/w;
		const int j = idx % w;
		
		if(i%2==0)
			ans[i][j]=a[idx];
		else
			ans[i][w-1-j] = a[idx];
	}

	rep(i,h){
		rep(j,w) cout << (j?" ":"") << ans[i][j];
		cout << endl;
	}


	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define INF 1e12
#define all(x) (x).begin(),(x).end()
#define sz(x) int((x).size())
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int x1,x2,y1,y2; cin>>x1>>y1>>x2>>y2;
	cout<<(x2-y2+y1)<<" "<<(y2-x1+x2)<<" "<<(x1-y2+y1)<<" "<<(y1-x1+x2)<<"\n";
	return 0;
}

Measured memory_bytes: 256
<?php
	$output = [];
	while( true ) {
		$n = trim( fgets(STDIN) );
		if( 0 == $n ) { break; }
		
		$s = explode( " ", trim( fgets(STDIN) ) );
		
		$sum = array_sum( $s );
		$ave = $sum / $n;
		$sum = 0;
		for( $i=0; $i<$n; $i++ ) {
			$sum += pow( $s[$i]-$ave, 2 );
		}
		array_push( $output, sqrt( $sum/$n ) );
	}
	
	print implode( PHP_EOL, $output );
?>

Measured memory_bytes: 15720
import java.util.Scanner;

public class Main {
    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int n = scanner.nextInt();
        final int k = scanner.nextInt();

        int max = scanner.nextInt();
        int gcd = max;

        for (int i = 0; i < n - 1; i++) {
            final int tmp = scanner.nextInt();
            max = Math.max(max, tmp);
            gcd = computeGCD(gcd, tmp);
        }

        System.out.println(k % gcd == 0 && k <= max ? "POSSIBLE" : "IMPOSSIBLE");
    }

    private static int computeGCD(final int a, final int b) {
        if (b > a) {
            return computeGCD(b, a);
        }

        if (b == 0) {
            return a;
        }

        return computeGCD(b, a % b);
    }
}


Measured memory_bytes: 50080
#include <stdio.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
#include <iomanip>
#include <unordered_map>
//#include <unordered_set>
//#include <boost/container/static_vector.hpp>
//#include <boost/unordered_set.hpp>
//#include <boost/unordered_map.hpp>
//#include <unistd.h>

const int MAX_N = 310;
const long long MOD = 1000000007;
int N, M;
int L[MAX_N], R[MAX_N], X[MAX_N];

std::vector<int> end_condition[MAX_N];
long long dp[MAX_N][MAX_N][MAX_N];

long long solve(int r, int g, int b) {
    if (dp[r][g][b] != -1) {
        return dp[r][g][b];
    }

    int pos = std::max(std::max(r, g), b);
    for (int i : end_condition[pos]) {
        int cnt = 0;
        if (L[i] <= r) { cnt++; }
        if (L[i] <= g) { cnt++; }
        if (L[i] <= b) { cnt++; }
        if (cnt != X[i]) {
            dp[r][g][b] = 0;
            return 0;
        }
    }

    long long ret;
    if (pos == N) {
        ret = 1;
    } else {
        ret = solve(pos + 1, g, b) + solve(r, pos + 1, b) + solve(r, g, pos + 1);
    }
    ret = ret % MOD;

    dp[r][g][b] = ret;
    return ret;
}

int main(int argc, char **argv) {
    std::cin >> N >> M;

    for (int i = 1; i <= M; i++) {
        std::cin >> L[i] >> R[i] >> X[i];
    }

    for (int i = 1; i <= M; i++) {
        end_condition[R[i]].push_back(i);
    }

    for (int i = 0; i < MAX_N; i++) {
        for (int j = 0; j < MAX_N; j++) {
            for (int k = 0; k < MAX_N; k++) {
                dp[i][j][k] = -1;
            }
        }
    }

    std::cout << solve(0, 0, 0) << std::endl;
    
    return 0;
}

Measured memory_bytes: 233088
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define endl '\n'
#define mod 1000000007
#define tol(s) transform(s.begin(),s.end(),s.begin(),::tolower)
#define tou(s) transform(s.begin(),s.end(),s.begin(),::toupper)
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define all(x) (x).begin(), (x).end()
void make_unique(vector<ll> vec)
{
sort(all(vec));
vec.resize(unique(all(vec)) - vec.begin());
}


int main() 
{   ios;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    int t1=1;
    //cin>>t;
    while(t1--)
    {int q,k,h,p,a,b,v,c,n,m,i,j,flag=0,count=0,move=0;
     string s,t;
     cin>>s>>t;
     int ls=s.length();
     int lt=t.length();
     int ans=100000;
     for(i=0;i<ls-lt+1;i++)
     {  count=0;
         for(j=0;j<lt;j++)
          {
              if(s[i+j]!=t[j])
               count++;
          }
          ans=min(ans,count);
     }
     cout<<ans<<endl;
     
    }
	return 0;
}


Measured memory_bytes: 3632
#include<stdio.h>

long A[100001];
long d[100001];
long s;
long N;
long num;

long sum(long n){
	return n*(n+1)/2;
}

void input(){
	int i;
	s = 0;
	scanf("%ld", &N);
	for( i = 0; i < N; i++ ){
		scanf("%ld", &A[i]);
		s += A[i];
	}
	num = s / sum(N);
	return;
}

int check(){
	int i;
	long j = 0;
	for( i = 0; i < N-1; i++ ){ d[i] = num - (A[i+1] - A[i]); }
	d[N-1] = num - (A[0] - A[N-1]);
	for( i = 0; i < N; i++ ){
		if( d[i] < 0 ){ return 0; }
		if( d[i] % N != 0 ){ return 0; }
		j += d[i] / N;
	}
	if( j != num ){ return 0; }
	return 1;
}

int main(){
	input();
	if( s % sum(N) != 0 ){ printf("NO\n"); return 0; }
	if( check() == 0 ){ printf("NO\n"); return 0; }
	printf("YES\n");
	return 0;
}

Measured memory_bytes: 1792
#include<iostream>
using namespace std;
int a[1000000],c;
int main() {
	int n,b;
	b = 1000000000;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < n; i++) {
		if (a[i] < b) {
			b= a[i];
			c = i+1;
		}
	}
	cout << c << endl;
}


Measured memory_bytes: 3420
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


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


	int N, M;
	cin >> N >> M;
	int S[2000], T[2000];
	rep(i, N) cin >> S[i];
	rep(i, M) cin >> T[i];

	ll mod = 1e9 + 7;
	ll dp[4001];

	rep(i, N + M + 1) dp[i] = 1;
	for (int i = N; i > 0; i--) {
		for (int j = i; j < i + M; j++) {
			if (S[N - i] == T[j - i]) dp[j] = dp[j - 1] + dp[j + 1];
			else dp[j] = dp[j - 1] + dp[j + 1] - dp[j] + mod;
			while (dp[j] >= mod) dp[j] -= mod;
		}
	}
	co(dp[M]);

	Would you please return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
void rd(int &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
void rd(long long &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
void wt_L(long long x){
  char f[20];
  int m=0, s=0;
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
template<class S, class T> inline S min_L(S a,T b){
  return a<=b?a:b;
}
template<class S, class T> inline S chmin(S &a, T b){
  if(a>b){
    a=b;
  }
  return a;
}
int N, st[200001], sts;
long long A[200001], g[200001], g1[200001], g2[200001];
void doit(){
  int i;
  long long now, x, y;
  sts = 0;
  g[0] = 0;
  now = A[0];
  for(i=1;i<N;i++){
    g[i] = g[i-1];
    while(now < A[i]){
      now *= 4;
      if(sts==0){
        g[i] += i * 2;
      }
      else{
        g[i] += (i - st[--sts]) * 2;
      }
    }
    x = now;
    y = A[i];
    while(x >= y*4){
      y *= 4;
      st[sts++] = i;
    }
    now = A[i];
  }
}
int main(){
  int i, j, k;
  long long res;
  rd(N);
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=0;Lj4PdHRW<N;Lj4PdHRW++){
      rd(A[Lj4PdHRW]);
    }
  }
  doit();
  for(i=0;i<N;i++){
    g1[i] = g[i] + i+1;
  }
  reverse(A, A+N);
  doit();
  for(i=0;i<N;i++){
    g2[i] = g[N-1-i];
  }
  res =min_L(g1[N-1], g2[0]);
  for(i=1;i<N;i++){
    chmin(res, g1[i-1] + g2[i]);
  }
  wt_L(res);
  putchar_unlocked('\n');
  return 0;
}
// cLay varsion 20180730-1

// --- original code ---
// int N; ll A[200001];
// 
// ll g[200001], g1[200001], g2[200001];
// 
// int st[200001], sts;
// 
// void doit(){
//   int i;
//   ll now;
//   ll x, y;
// 
//   sts = 0;
// 
//   g[0] = 0;
//   now = A[0];
//   rep(i,1,N){
//     g[i] = g[i-1];
//     while(now < A[i]){
//       now *= 4;
//       if(sts==0){
//         g[i] += i * 2;
//       } else {
//         g[i] += (i - st[--sts]) * 2;
//       }
//     }
//     
//     x = now; y = A[i];
//     while(x >= y*4){
//       y *= 4;
//       st[sts++] = i;
//     }
//     
//     now = A[i];
//   }
// }
// 
// {
//   int i, j, k;
//   ll res;
//   rd(N,A(N));
// 
// //  wt(A(N));
// 
//   doit();
//   rep(i,N) g1[i] = g[i] + i+1;
// 
//   reverse(A, A+N);
//   doit();
//   rep(i,N) g2[i] = g[N-1-i];
// 
// //  wt(g1(N));
// //  wt(g2(N));
// 
//   res = min(g1[N-1], g2[0]);
//   rep(i,1,N) res <?= g1[i-1] + g2[i];
// 
//   wt(res);
// }
// 


Measured memory_bytes: 6528
/*
 *    author: Tran Minh Khoa
 *    created: 14.05.2019 10:27:52
 *    Ho Chi Minh University of Science
 */

#include <bits/stdc++.h>

using namespace std;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
const string MAP = "URDL";

int H, W, N, xR, xC;
map<char, int> mp;
string s, t;

bool can(int x, int y) {
  return x >= 1 && x <= H && y >= 1 && y <= W;
}

bool canRemove(char X, char Y) {
  int u = mp[X];
  int v = mp[Y];
  int sR = xR, sC = xC;
  for (int i = 0; i < N; i++) {
    if (s[i] == X) {
      sR += dx[u];
      sC += dy[u];
    }
    if (!can(sR, sC)) {
      return true;
    }
    if (t[i] == Y) {
      if (can(sR + dx[v], sC + dy[v])) {
        sR += dx[v];
        sC += dy[v];
      }
    }
  }
  return false;
}


int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr); cout.tie(nullptr);
  cout.precision(10); 
  cout << fixed;
#ifdef KM777
  freopen("in", "r", stdin);
#endif

  cin >> H >> W >> N >> xR >> xC;
  cin >> s >> t;
  mp['U'] = 0; mp['R'] = 1;
  mp['D'] = 2; mp['L'] = 3;

  bool bad = false;
  bad |= canRemove('R', 'L');
  bad |= canRemove('L', 'R');
  bad |= canRemove('U', 'D');
  bad |= canRemove('D', 'U');
  if (!bad) {
    cout << "YES" << "\n";
  } else {
    cout << "NO" << "\n";
  }
  return 0;
}


Measured memory_bytes: 920
import math

n = int(input())
divisors = []
for i in range(1, int(n**0.5) +1):
    if n % i == 0:
        divisors.append(i)
        if i != n // i:
            divisors.append(n//i)

ans = math.pow(10, 12)
tmp = 0
for i in divisors:
    j = n / i
    tmp = i + j -2
    if tmp < ans:
        ans = tmp

print(int(ans))

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

using namespace std;

#define  CLR(a)  memset(a,0,sizeof(a))
#define  SET(a)  memset(a,-1,sizeof(a))
#define  nl "\n";
#define FIO ios_base::sync_with_stdio(false);cout.setf(ios::fixed);cout.precision(10);cout.tie(nullptr);cin.tie(nullptr);

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

template < class T> inline T biton(T n, T pos) { return n | ((T)1 << pos); }
template < class T> inline T bitoff(T n, T pos) { return n & ~((T)1 << pos); }
template < class T> inline T ison(T n, T pos) { return (bool)(n & ((T)1 << pos)); }
template < class T> inline T gcd(T a, T b) { while (b) { a %= b; swap(a, b); }return a; }

template <class T> inline T bigmod(T p, T e, T m) {
	T ret = 1;
	for (; e > 0; e >>= 1) {
		if (e & 1) ret = (ret * p) % m; p = (p * p) % m;
	} return (T)ret;
}

#define DEBUG

#ifdef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1)
{
	cerr << name << " is " << arg1 << std::endl;
}
template < typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args)
{
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " is " << arg1 << " | ";
	__f(comma + 1, args...);
}
#else
#define debug(...)
#endif


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

	map<int,int> mp;
    
    for(int i=0;i<n;i++){
		int it;
		cin>>it;
		mp[it]++;
	}
    int cnt=0;

	map<int,int> temp=mp;
   
	for(auto m:mp){
      
	    temp[m.first]--;

		if(temp[m.first]==0){
			temp.erase(m.first);
		}
        
		bool ok=true;

		for(long long i=1;i*i<=m.first;i++){
			 
			 if(m.first%i==0){
				long long one=i,two=m.first/i;
				if(temp.count(one) || temp.count(two)){
					ok=false;
					break;
				}
			 }
		}
        if(ok){
			cnt++;
		}
		temp[m.first]++;
	}

	cout<<cnt<<nl;
}

int main()
{
	FIO;

	int t = 1;
	while (t--)
	{
		solve();
	}

	return 0;
}


Measured memory_bytes: 22340
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
using namespace std;

#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define ALL(c) (c).begin(), (c).end()

template <typename T, typename U>
inline void assign_max(T& x, U& y, const T& value1, const U& value2) noexcept {
    if (x < value1) {
        x = value1;
        y = value2;
    }
}

int main() {
    string s, t; cin >> s >> t;

    enum class Choice { NONE, PICK, SHIFT_S, SHIFT_T };

    // dp[i][j]: s[0..i], t[0..j] の部分列の長さの最大値
    vector dp(s.size(), vector(t.size(), int()));
    vector choice(s.size(), vector(t.size(), Choice()));

    REP(i, s.size()) REP(j, t.size()) {
        int m = 0;
        Choice c = Choice::NONE;
        if (s[i] == t[j]) {
            if (i > 0 && j > 0) {
                assign_max(m, c, dp[i-1][j-1] + 1, Choice::PICK);
            } else {
                assign_max(m, c, 1, Choice::PICK);
            }
        }
        if (i > 0) {
            assign_max(m, c, dp[i-1][j], Choice::SHIFT_S);
        }
        if (j > 0) {
            assign_max(m, c, dp[i][j-1], Choice::SHIFT_T);
        }
        dp[i][j] = m;
        choice[i][j] = c;
    }

    // 復元
    string ans;
    for ( int i = s.size()-1, j = t.size()-1
        ; i >= 0 && j >= 0
        ;
    ) {
        switch (choice[i][j])
        {
        case Choice::NONE:
            --i; --j;
            break;
        case Choice::PICK:
            ans += s[i];
            --i; --j;
            break;
        case Choice::SHIFT_S:
            --i; break;
        case Choice::SHIFT_T:
            --j; break;
        }
    }
    reverse(ALL(ans));

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


Measured memory_bytes: 73732
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

const int MOD = 1000000007;

int H,W,d;
char grid[500][500];

void solveodd() {
    F0R(i,H) {
        F0R(j,W) {
            if (i % 2 == 0) {
                if (j % 2 == 0) grid[i][j] = 'R';
                else grid[i][j] = 'Y';
            } else {
                if (j % 2 == 0) grid[i][j] = 'G';
                else grid[i][j] = 'B';
            }
        }
    }
    F0R(i,H) {
        F0R(j,W) cout << grid[i][j];
        cout << "\n";
    }
}

void fill(int x, int y, char c) {
    vector<pii> todo;
    F0R(i,d/2) FOR(j,-(d/2-i)+1,d/2-i) todo.pb({x-i,y+j});
    F0R(i,d/2) FOR(j,-(d/2-i)+1,d/2-i) todo.pb({x+1+i,y+j});
    for (auto a: todo) if (0 <= a.f && a.f < H && 0 <= a.s && a.s < W) grid[a.f][a.s] = c;
}

void solveeven() {
    F0R(i,H) F0R(j,W) grid[i][j] ='*';
    FOR(i,-505,H+505) FOR(j,-505,W+505) {
        if (i % d == 0 && j % d == 0) {
            if ((i/d+j/d) % 2 == 0) fill(i,j,'R');
            else fill(i,j,'Y');
        } else if (((i%d)+d)%d == (d/2) && ((j%d)+d)%d == (d/2)) {
            if (((i-d/2)/d+(j-d/2)/d) % 2 == 0) fill(i,j,'G');
            else fill(i,j,'B');
        }
    }
    F0R(i,H) {
        F0R(j,W) cout << grid[i][j];
        cout << "\n";
    }
}

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin >> H >> W >> d;
	if (d % 2 == 1) solveodd();
	else solveeven();
}

// read!
// ll vs. int!

Measured memory_bytes: 8552
A,B,C,D=map(int,input().split())
mod=998244353
dp=[[0 for y in range(D-B+1)]for x in range(C-A+1)]
dp[0][0]=1
for x in range(C-A):
    dp[x+1][0]=(dp[x][0]*B)%mod
for y in range(D-B):
    dp[0][y+1]=(dp[0][y]*A)%mod
for x in range(C-A):
    for y in range(D-B):
        dp[x+1][y+1]=(dp[x+1][y]*(A+x))%mod
        dp[x+1][y+1]+=(dp[x][y+1]*(B+y))%mod
        dp[x+1][y+1]%=mod
        dp[x+1][y+1]-=(dp[x][y]*(A+x)*(B+y))%mod
        dp[x+1][y+1]%=mod
        dp[x+1][y+1]+=(dp[x+1][y]+dp[x][y+1])%mod
        dp[x+1][y+1]%=mod

print(dp[C-A][D-B])


Measured memory_bytes: 153064
#include <bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define si(x)	scanf("%d",&x)
#define sl(x)	scanf("%lld",&x)
#define ss(s)	scanf("%s",s)
#define pi(x)	printf("%d\n",x)
#define pl(x)	printf("%lld\n",x)
#define ps(s)	printf("%s\n",s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pl;
typedef vector<int>		vi;
typedef vector<ll>		vl;
typedef vector<pii>		vpii;
typedef vector<pl>		vpl;
typedef vector<vi>		vvi;
typedef vector<vl>		vvl;
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
	uniform_int_distribution<int> uid(0,lim-1);
	return uid(rang);
}
int mpow(int base, int exp); 
void ipgraph(int n, int m);
void dfs(int u, int par);

const int mod = 1'000'000'007;
const int N = 3e5, M = N;
//=======================

// vi g[N];
// int a[N];

void solve() {
  int i, n;
  cin >> n;
  vi x(n);
  ll sum = 0;
  fo(i,n){
   cin >> x[i];
   sum += x[i]; 
  }

  int avg1, avg2;
  if(sum%n==0){
    avg1 = sum/n;
    avg2 = avg1;
  }
  else{
    avg1 = sum/n;
    avg2 = sum/n + 1;
  }

  int stamina1 = 0, stamina2 = 0;
  fo(i,n){
    stamina1 = stamina1 + (avg1-x[i])*(avg1-x[i]);
    stamina2 = stamina2 + (avg2-x[i])*(avg2-x[i]);
  }
  cout << min(stamina2, stamina1);
}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());

    int t = 1;
    // cin >> t;
    while(t--) {
      solve();
    }

    return 0;
}

int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((ll)result * base) % mod;
    base = ((ll)base * base) % mod;
    exp >>= 1;
  }
  return result;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
 
#define endl '\n'
#define fi first
#define se second
#define MOD(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,n) for (int i = 0; i < (n); i++)
#define forr(i,a,b) for (int i = a; i <= b; i++)
#define all(v) v.begin(), v.end()
#define pb(x) push_back(x)
 
using namespace std;
 
typedef long long ll;
typedef double ld;
typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;

const int MX = 1005;
int n;
vector<string> t[10];
char res[MX][MX];

int main () {
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	t[3] = {
		"aab",
		"d.b",
		"dcc"
	};

	t[4] = {
		"aacd",
		"bbcd",
		"efgg",
		"efhh"
	};

	t[5] = {
		"aabxx",
		"d.byy",
		"dccxx",
		"xyx..",
		"xyx.."
	};

	t[6] = {
		"aabc..",
		"..bcaa",
		"aaxy..",
		"..xyaa",
		"aabc..",
		"..bcaa"
	};

	t[7] = {
		"aa.aa.x",
		"..a..ax",
		"..a..ay",
		"aa.aa.y",
		"..a..ax",
		"..a..ax",
		"xxyyxx."
	};

	cin >> n;
	if (n <= 2) {
		cout << -1 << endl;
		return 0;
	}

	if (n == 3) {
		for (auto s : t[3])
			cout << s << endl;
		return 0;
	}

	forn (i, MX) forn (j, MX) res[i][j] = '.';

	for (int i = 0; i + 8 <= n; i += 4)
		forn (x, 4) forn (y, 4)
			res[i + x][i + y] = t[4][x][y];

	int r = n % 4 + 4;
	forn (x, r) forn (y, r)
		res[n - r + x][n - r + y] = t[r][x][y];

	forn (i, n) {
		forn (j, n)
			cout << res[i][j];
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 2176
n = int(input())
s = input()
if n%2 == 1:
    print('No')
else:
    m = n//2
    ju = True
    for i in range(m):
        if s[i] != s[i+m]:
            ju = False
            break
    if ju:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 3064
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 1e9;
int MOD = 1e9+7;
int cnt[3];//4,2,1
main(){
    int N,A;
    cin >> N;
    for(int i = 0;i < N;i++){
        cin >> A;
        if(A % 4 == 0)cnt[0]++;
        else if(A % 2 == 0)cnt[1]++;
        else cnt[2]++;
    }
    if(cnt[1]){
        cnt[2]++;
    }
    if(cnt[0]+1 >= cnt[2] || cnt[1] == N){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

func main() {
	var n int
	fmt.Scan(&n)

	var (
		ans  int64 = 1
		a    int64
		over bool = false
		zero bool = false
	)

	for i := 0; i < n; i++ {
		fmt.Scan(&a)

		if a >= math.MaxInt64/ans {
			over = true
		}
		if a == 0 {
			zero = true
		}
		if !over && !zero {
			ans *= a
		}
		if ans > 1e18 {
			over = true
		}
	}

	if zero {
		fmt.Println(0)
	} else if over {
		fmt.Println(-1)
	} else {
		fmt.Println(ans)
	}
}


Measured memory_bytes: 6316
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define y1 zzz
#define fi first
#define se second
#define PII pair<int,int>
#define PII2 pair<int,PII >
#define PII3 pair<PII,int >
#define PII4 pair<PII,PII >
#define all(x) (x).begin(),(x).end()
#define pb push_back
int a[200010],k,n;
void solve()
{
    cin>>k>>n;
    for(int i=0;i<n;i++)cin>>a[i];
    int res=a[0]+k-a[n-1],sum=res;
    for(int i=1;i<n;i++)
    {
        sum+=a[i]-a[i-1];
        res=max(res,a[i]-a[i-1]);
    }
    cout<<sum-res;
}
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    //freopen("STRWC.inp","r",stdin);
    //freopen("FORMMAU.out","w",stdout);
    //int t;cin>>t;while(t--)
    solve();
    return 0;
}


Measured memory_bytes: 1792
import java.io.*;
import java.util.*;

public class Main{
    static MyReader in = new MyReader();
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args){
        char C = in.s().toCharArray()[0];
        out.println((char)(C+1));
        
        out.flush();
    }

    static class MyReader extends BufferedReader{
        MyReader(){
            super(new InputStreamReader(System.in));
        }

        String s(){
            try{return readLine();}catch(IOException e){return "";}
        }

        String[] ss(){
            return s().split(" ");
        }

        int i(){
            return Integer.parseInt(s());
        }

        int[] ii(){
            String[] ss = ss();
            int[] ii = new int[ss.length];
            for(int j = 0; j < ss.length; j++) ii[j] = Integer.parseInt(ss[j]);
            return ii;
        }

        ArrayList<Integer> li(){
            String[] ss = ss();
            ArrayList<Integer> li = new ArrayList<>();
            for(int j = 0; j < ss.length; j++) li.add(Integer.parseInt(ss[j]));
            return li;
        }

        long l(){
            return Long.parseLong(s());
        }

        long[] ll(){
            String[] ss = ss();
            long[] ll = new long[ss.length];
            for(int j = 0; j < ss.length; j++) ll[j] = Long.parseLong(ss[j]);
            return ll;
        }
    }
}


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

typedef int		BOOL;
#define TRUE	1;
#define FALSE	0;

typedef struct Word{
	char	word[31];
	int		page;
}	WORD;

WORD wordArray[100];

void input();
	BOOL is_smaller(WORD, int);
void output();

int main()
{
    input();
    output();
	
	return 0;
}

void input()
{
	int 	cnt1, cnt2;
	WORD	tempWORD;
	
	while(scanf("%s %d", tempWORD.word, &tempWORD.page) != EOF)
		for(cnt1 = 0; cnt1 < 100; cnt1++){
			if(wordArray[cnt1].page == 0){
				strcpy(wordArray[cnt1].word, tempWORD.word);
				wordArray[cnt1].page = tempWORD.page;
				break;
			}
			else if(is_smaller(tempWORD, cnt1)){
				for(cnt2 = 98; cnt2 >= cnt1; cnt2--){
					strcpy(wordArray[cnt2 + 1].word, wordArray[cnt2].word);
					wordArray[cnt2 + 1].page = wordArray[cnt2].page;
				}
				strcpy(wordArray[cnt1].word, tempWORD.word);
				wordArray[cnt1].page = tempWORD.page;
				break;
			}
		}
}

BOOL is_smaller(WORD tempWORD, int cnt)
{
	if(strcmp(tempWORD.word, wordArray[cnt].word) < 0){
		return TRUE;
	}
	else if(strcmp(tempWORD.word, wordArray[cnt].word) == 0){
		if(tempWORD.page < wordArray[cnt].page)
		{
			return TRUE;
		}
		else
		{
			return FALSE;
		}
	}
	else{
		return FALSE;
	}
}

void output()
{
	int		output_cnt = 0;
	char	last_print_word[31] = "";

	while(wordArray[output_cnt].page != 0)
	{
		if(strcmp(last_print_word, "") == 0)
		{
			printf("%s\n", wordArray[output_cnt].word);
			strcpy(last_print_word, wordArray[output_cnt].word);
		}
		else if(strcmp(wordArray[output_cnt].word, last_print_word) != 0)
		{
			printf("\n%s\n", wordArray[output_cnt].word);
			strcpy(last_print_word, wordArray[output_cnt].word);
		}
		else
		{
			printf(" ");
		}
		printf("%d", wordArray[output_cnt].page);
		output_cnt++;
	}
	printf("\n");
}

Measured memory_bytes: 640
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){

	int h,m,s;
	while(cin>>h>>m>>s&&!(h==-1&&m==-1&&s==-1)){
		int lefts=120*60;
		int nh,nm,ns;

		lefts-=(h*60*60+m*60+s);

		nh=lefts/3600;
		lefts%=3600;
		nm=lefts/60;
		lefts%=60;
		ns=lefts;
		printf("%02d:%02d:%02d\n",nh,nm,ns);

		lefts=(120*60-(h*60*60+m*60+s))*3;
		nh=lefts/3600;
		lefts%=3600;
		nm=lefts/60;
		lefts%=60;
		ns=lefts;
		printf("%02d:%02d:%02d\n",nh,nm,ns);
	}

	return 0;
}

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

int main() {
 	long long h,w ;
  cin >> h>> w;
  long long ans,x,y;
  if(h==1 || w==1){

  ans =1;
  }
  else if(h%2==0 && w%2==0){
    x=h/2;
    y=h/2;
    ans =x*w/2+y*(w/2);
  }
  else if(h%2==0 && w%2==1){
    x=h/2;
    y=h/2;
    ans=x*(w/2+1)+y*(w/2);
      
  }
  else if(h%2==1 && w%2==0){
    x=h/2+1;
    y=h/2;
    ans = x*w/2+y*(w/2);
  }
  else if(h%2==1 && w%2==1){
    x=h/2+1;
    y=h/2;
      ans=x*(w/2+1)+y*(w/2);
  }
  cout << ans << endl;

  }

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

using namespace std;
using ll = long long;
using ull = unsigned long long;

#ifndef __MACRO_H__
#define __MACRO_H__

#define all(collection)  (collection).begin(), (collection).end()		// begin to end
#define rep(i, begin, end) for (ll i = begin; i < end; i++)				// repeat
#define repr(i, begin, end) for (ll i = begin; end < i; i--)			// repeat reverse
#define size(collection) ((ll) (collection).size())						// collection size

#endif

bool IsSame(vector<ll> sub1, vector<ll> sub2)
{
	ll count = 0;
	rep(i, 'a', 'z' + 1)
	{
		if (sub1[i] == sub2[i])
			count++;
	}

	return (count == 'z' + 1 - 'a');
}

int main(void)
{
	string s; cin >> s;
	vector<ll> sub1('z'+1), sub2('z'+1);

	ll ans = 0;
	ll i = 0;
	sub1[s[i]]++;
	while (1)
	{
		if (++i == size(s))
			break;

		sub2[s[i]]++;

		if (!IsSame(sub1, sub2))
		{
			ans++;
			sub1 = sub2;
			fill(all(sub2), 0);
		}

	}

	cout << ans + 1;
	return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define int long long
const int MOD=1e9+7;
const int INF=1e15;

signed main(){
    int N;cin>>N;
    int a,b,c,d,e,f,g,h,x;
  	a=b=c=d=e=f=g=h=x=0;
    REP(i,N){
        int s;cin>>s;
        if(s<400){
            a++;
            continue;
        }
        if(s<800){
            b++;
            continue;
        }
        if(s<1200){
            c++;
            continue;
        }
        if(s<1600){
            d++;
            continue;
        }
        if(s<2000){
            e++;
            continue;
        }
        if(s<2400){
            f++;
            continue;
        }
        if(s<2800){
            g++;
            continue;
        }
        if(s<3200){
            h++;
            continue;
        }
        if(s>=3200)x++;
    }
    int maxans=0;
    int minans=0;
    if(a>0)minans++;
    if(b>0)minans++;
    if(c>0)minans++;
    if(d>0)minans++;
    if(e>0)minans++;
    if(f>0)minans++;
    if(g>0)minans++;
    if(h>0)minans++;
    maxans=minans+x;
  	if(minans==0&&x>=1){
      minans=1;
      maxans=x;
    }
    cout<<minans<<" "<<maxans<<endl;
}


Measured memory_bytes: 256
const input=require('fs').readFileSync('/dev/stdin', 'utf8').split(/[\s]/);const nin=()=>{const r = input[0];input.shift();return Number(r)};const nrin=(n)=>{const a:number[]=[];rep(n,()=>a.push(nin()));return a};const sin=()=>{const r = input[0];input.shift();return String(r)};const out=(...a)=>{console.log(...a)};const floor=(a)=>{return Math.floor(a)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const rep=(n, callback)=>{for(let i = 0;i < n; i++){callback()}};const strrep=(s, i, v)=>{return s.slice(0, i)+v+s.slice(i+1);};const permutation=({result=[],pre=[],post,n=post.length})=>{if(n>0){post.forEach((_,i)=>{const rest=[...post];const elem=rest.splice(i, 1);permutation({result, pre: [...pre,...elem],post:rest,n:n-1})})}else{result.push(pre)}return result};const sw=(s,a:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<a.length;i+=2){if(op==='=='){if(s==a[i])return a[i+1]}else if(op==='>='){if(s>=a[i])return a[i+1]}else if(op==='<='){if(s<=a[i])return a[i+1]}else if(op==='>'){if(s>a[i])return a[i+1]}else if(op==='<'){if(s<a[i])return a[i+1]}}return a[a.length-1];};const or=(a,...b)=>{for(let i=0;i<b.length;i++)if(a==b[i])return true;return false};const maxindex=(...a)=>{return a.indexOf(Math.max.apply(null,a))};const asc=(ar:number[])=>{return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{return ar.sort((a,b)=>{return b-a})};const ceil=a=>{return Math.ceil(a)};const srin=s=>{const a:string[]=[];rep(s,()=>a.push(sin()));return a};let ssinteger=-1;const ssin=()=>{ssinteger++;return input[0][ssinteger]};
const main = ()=>{
  let [a,b,c]=nrin(3)
  out(c-(a-b) <= 0 ? 0 : c-(a-b))
}
main()

Measured memory_bytes: 9420
import sys
input=sys.stdin.readline #文字列入力はするな！！
sys.setrecursionlimit(10**9) #再帰の上限をあげる
n=int(input())
a=list(map(int,input().split()))
z=[0]*(10**6+1)
ans=0
for i in a:
    z[i]+=1

x=[-1]*(10**6+1) #2以上の自然数に対して最小の素因数を表す
x[0]=0
x[1]=1
i=2
prime=[]
while i<=10**6:
    if x[i]==-1:
        x[i]=i
        prime.append(i)
    for j in prime:
        if i*j>10**6 or j>x[i]:break
        x[j*i]=j
    i+=1

for i in a:
    f=0
    u=i
    if z[u]>=2:
        f=1
    w=[[1,1]]
    p=x[u]
    cnt=1
    while u>1:
        if p==x[u//p]:
            cnt+=1
            u=u//p
        else:
            w.append([p,cnt])
            cnt=1
            u=u//p
            p=x[u]

    m=len(w)

    def s(d,y):
        global m
        global i
        global f
        if d==m-1:
            p=y
            if p!=i and z[p]>=1:
                f=1
        else:
            for j in range(w[d+1][1]+1):
                s(d+1,y*(w[d+1][0]**j))

    s(0,1)
    if f==0:
        ans+=1
print(ans)




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

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

const int MAXN = 2e5 + 5;

int N, M;
vector <pii> E[MAXN];
int l[MAXN], r[MAXN], d[MAXN];
bool bio[MAXN];
ll x[MAXN];

void load() {
	scanf("%d%d", &N, &M);
	for (int i = 0; i < M; i++) {
		scanf("%d%d%d", l + i, r + i, d + i);
		E[l[i]].push_back({r[i], d[i]});
		E[r[i]].push_back({l[i], -d[i]});
	}
}

void dfs(int node, ll curr) {
	bio[node] = true;
	x[node] = curr;
	for (auto it : E[node])
		if (!bio[it.first])
			dfs(it.first, curr + it.second);
}

bool solve() {
	for (int i = 1; i <= N; i++)
		if (!bio[i])	
			dfs(i, 0);
	
	for (int i = 0; i < M; i++)
		if (x[r[i]] - x[l[i]] != d[i])
			return false;
	
	return true;
}

int main() {
	load();
	puts(solve() ? "Yes" : "No");
	return 0;
}

Measured memory_bytes: 16256
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 1e2 + 10;

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n;
	cin >> n;
	cout << (n / 2)*(n - n / 2) << endl;
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstring>
#include <iostream>
#include <vector>
#include <cmath>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <functional>
#define rep(i,n) for (int i = 0; i < (n); ++i)

using namespace std;
const int MOD = 1000000007;


typedef long long int ll; 
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;

void floatOutPutSetup(){
    cout << fixed;
    cout << setprecision(10);
}

int main(){
    floatOutPutSetup();
    double a,b;
    ll bl,al;
    cin>>al>>b;
    bl=round(b*100);
    cout<<(al*bl/100);

    return 0;
}

Measured memory_bytes: 3736
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
static const int giga =  pow(10,9);

int main(void){
  int a,b,h;
  cin >> a >> b >> h;
  cout << (a+b)*(h/2) << endl;

  return 0;
}

Measured memory_bytes: 256
a = 'abcdefghijklmnopqrstuvwxyz'

while True:
    try:
        s = input()
    except:
        break
    for n in range(1, 27):
        t = s.translate(str.maketrans(a, a[n:] + a[:n]))
        if 'the' in t or 'this' in t or 'that' in t: break
    print(t)

Measured memory_bytes: 6720
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char map[][] = new char[50][50];
		int r = sc.nextInt();
		int c = sc.nextInt();
		sc.nextLine();
		for(int y = 0; y < r; y++) {
			String s = sc.nextLine();
			for(int x = 0; x < c; x++) {
				map[y][x] = s.charAt(x);
			}
		}
		
		int minCount = Integer.MAX_VALUE;
		int count;
		for(int w_line = 0; w_line < r - 2; w_line++) {
			count = 0;
			
			for(int line = 0; line <= w_line; line++) {
				count += difCharLineCount(map[line], 'W', c);
			}
			
			int t_cnt = count;
			
			for(int r_line = w_line + 2; r_line < r; r_line++) {
				for(int line = w_line + 1; line < r_line; line++) {
					count+= difCharLineCount(map[line], 'B', c);
				}
					
				for(int line = r_line; line < r; line++) {
					count+= difCharLineCount(map[line], 'R', c);
				}

				if (count < minCount) {
					minCount = count;
				} 
				count = t_cnt;
			}
			
		}

		System.out.println(minCount);
	}



private static int difCharLineCount(char[] chars, char targetChar, int limit) {
		int ret = 0;
		for(int x = 0; x < limit; x++) {
			if (chars[x] != targetChar) {
				ret++;
			}
		}
		return ret;
	}
}

Measured memory_bytes: 26584
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long int
#define pb push_back
#define mp make_pair
#define ip pair<int, int>
#define it pair<int, pair<int, int>>
#define F first
#define S second
#define fori(p, n) for(int i = p; i < n; i++)
#define forj(q, m) for(int j = q; j < m; j++)
#define fork(r, l) for(int k = r; k < l; k++)
#define revi(h) for(int i = h; i >= 0; i--)
#define all(v) v.begin(), v.end()
#define PI 3.14159265358
#define debug(x) cout<<"DEBUGGING --- "<<x<<endl;
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define input_from_file  freopen("input.txt", "r", stdin);
#define output_to_file freopen("output.txt", "w", stdout);
signed main(){
    fastio;
    //input_from_file; 
    //output_to_file;
    int n; cin>>n;
    vector<double>P(n + 1);
    fori(1, n + 1) cin>>P[i];
    vector<vector<double>>H(n + 1, vector<double>(n + 1, 0));
    H[0][0] = 1;
    fori(1, n + 1)
        forj(0, i + 1)
            H[i][j] = (i - 1 >= j ? H[i - 1][j] * (1 - P[i]) : 0) + (j ? H[i - 1][j - 1] * P[i] : 0);                          
    double ans = 0;
    fori(n / 2 + 1, n + 1) ans += H[n][i];
    cout<<fixed<<setprecision(10)<<ans<<endl;        
}

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

int main(void)
{
    long long N, A, B;
    long long ret = 0;
    long long tmp;

    scanf("%ld %ld %ld", &N, &A, &B);

    ret += A * (N / (A + B));
    tmp = N % (A + B);
    if (tmp >= A) {
        ret += A;
    } else {
        ret += tmp;
    }

    printf("%ld", ret);

    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define fastcin() cin.tie(0);ios::sync_with_stdio(false)
#define rep(i,n) for(int i=0;i<int(n);i++)
#define rep1(i,n) for(int i=1;i<=int(n);i++)
#define per(i,n) for(int i=int(n)-1;i>=0;i--)
#define per1(i,n) for(int i=int(n);i>0;i--)
#define foreach(i,n) for(auto &&i:n)
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort(all(x))
#define REV(x) reverse(all(x))
#define MAX(x) *max_element(all(x))
#define MIN(x) *min_element(all(x))
#define LOWitr(x, n) lower_bound(all(x), n)
#define UPRitr(x, n) upper_bound(all(x), n)
#define cii(x) int x;cin >> x
#define cill(x) LL x;cin >> x
#define cis(x) string x;cin >> x
#define co(x) cout << x << endl
#define dump(x)  cout << #x << " = " << (x) << endl
#define truecheck assert
#define pb push_back
#define mp make_pair
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef long long int64;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
template<class T,class U>bool chmax(T &a, const U &b){if (a<b){a=b;return true;}return false;}
template<class T,class U>bool chmin(T &a, const U &b){if (b<a){a=b;return true;}return false;}
template<class T,class U>void vcin(T &v, U n){rep(i, n){typename T::value_type a;cin >> a;v.pb(a);}}
const int INF = 1e9, MOD = 1e9 + 7;
const LL LLINF = 1e16;

int main() {
    fastcin();
    cout << fixed << setprecision(10);
    cii(n);
    vector<PII> vpii;
    rep(i, n){
        int x, y;
        cin >> x >> y;
        vpii.pb(mp(x, y));
    }
    double total = 0;
    rep(i, n-1){
        for (int j = i + 1; j < n; ++j) {
            total += sqrt(pow(vpii[i].F - vpii[j].F, 2) + pow(vpii[i].S - vpii[j].S, 2));
        }
    }
    double ans = total * 2 / n;
    co(ans);
    return 0;
}

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

int main(){
  int A,B;
  int ans=0;
  cin >> A >> B;
  
  for(int i=A;i<B+1;i++){
    int a,b,c,d,e;
    e=i%10;
    d=(i/10)%10;
    b=(i/1000)%10;
    a=(i/10000)%10;
    if(a==e&&b==d) ans++;
  }
  
  cout << ans <<endl;
}
    


Measured memory_bytes: 256
A,B,H,M=map(int,input().split())

def degh(H,M):
    bdeg=30
    return bdeg*(H+M/60)

import math
theta=math.radians(degh(H,M)-M*360/60)

# print(degh(H,M),M*360/60)

print((A**2+B**2-2*A*B*math.cos(theta))**0.5)

Measured memory_bytes: 9472