akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define inf 1000000000
#define eb emplace_back
#define pb push_back
#define fi first
#define se second
#define fastread ios::sync_with_stdio(false);cin.tie(NULL)
#define rng_23 mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pii;
typedef vector<ll> vi;
typedef vector<pair<ll,ll>> vii;
typedef set<ll> si;
typedef multiset<ll> msi;
typedef map<ll,ll> mii;
ll res(ll n,ll k)
{
    while(n%k==0)
            n/=k;
    return (n%k==1 || n==1);
}
int main()
{

    ll n,cnt=0;
    cin>>n;
    if(n==2){
        cout<<"1";
        return 0;
    }
    for(ll i=2;i<=sqrt(n);i++)
        cnt+=res(n,i);
    //cout<<cnt<<endl;
    for(ll i=1;i<=sqrt(n-1);i++){
        if((n-1)%i==0 && (n-1)/i>sqrt(n)){
            cnt++;
        }
    }
    //cout<<cnt<<endl;
    //cnt-=(n-1)==((ll)sqrt(n-1)*(ll)sqrt(n-1));
    cnt++;
    cout<<cnt;

}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

    private static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

    public static void main(final String[] args) throws IOException {
        FastReader in = new FastReader();
        PrintWriter out = new PrintWriter(System.out, true);

        int n = in.nextInt();
        int k = in.nextInt();
        int[] snukes = new int[n + 1];

        for (int i = 1; i <= k; i++) {
            int d = in.nextInt();
            for (int j = 1; j <= d; j++) {
                snukes[in.nextInt()]++;
            }
        }
        int answer = 0;
        for (int i = 1; i <= n; i++) {
            if (snukes[i] == 0) {
                answer++;
            }
        }
        out.println(answer);
    }
}


Measured memory_bytes: 34108
dp=[[1<<30 for _ in range(1001)] for _ in range(1001)]
dp[0][0]=0
n,m=map(int,input().split())
d=[int(input()) for _ in range(n)]+[0]
c=[int(input()) for _ in range(m)]+[0]
for i in range(m):
    for j in range(n+1):
        if dp[i][j]< dp[i+1][j]:dp[i+1][j]=dp[i][j]
        e=d[j]*c[i]
        if dp[i][j]+e<dp[i+1][j+1]:dp[i+1][j+1]=dp[i][j]+e;
print(dp[m][n])

Measured memory_bytes: 23208
#include"bits/stdc++.h"
using namespace std;

void Main() {
	int N;
	long long total = 0;
	cin >> N;
	for (int i = 1; i <= N; i++) {
		if (i % 3 == 0 || i % 5 == 0) {
			continue;
		}
		total += i;
	}
	cout << total << endl;
}

int main() {
	std::cout << std::fixed << std::setprecision(15);
	Main();
}

Measured memory_bytes: 3640
#include <iostream>

int main() {
	int a, b;
	int c;

	std::cin >> a >> b; 
	c = (a % 2 * b % 2) % 2;
	if (c == 0) {
		std::cout << "Even" << std::endl;
	} else {
		std::cout << "Odd" << std::endl;
	}

	return 0;
}

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

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

  int N_prefix= N / 10;
  int N_suffix= N % 1000;
  
  if ( N_prefix % 111 == 0 || N_suffix % 111 == 0){
  	cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

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

int main() {

  int N;
  cin >> N;

  vector<int> a(N+1);

  for (int i = 1; i < N+1; i++) {
    cin >> a[i];
  }

  vector<int> b(N+1);
  
  for (int i = N; 1 <= i; i--) {
    int count = 0;
    for (int j = i; j <= N; j += i) {
      if (b[j] == 1) {
        count++;
      }
    }
    if (count % 2 == a[i]) {
      b[i] = 0;
    } else {
      b[i] = 1;
    }
  }

  vector<int> result;
  for (int i = 1; i < N+1; i++) {
    if (b[i] == 1) {
      result.push_back(i);
    }
  }

  cout << result.size() << endl;

  for (int i = 0; i < result.size(); i++) {
    cout << result[i];
    if (i != N) {
      cout << " ";
    }
  }

  cout << endl;

}

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

using namespace std;

int n;
int v[100005];

void init() {
    cin >> n;
    for(int i = 0 ; i < n ; i++) cin >> v[i];
}

int test(int a, int b) {
    int ans = 0;
    for(int i = 0 ; i < n ; i += 2) if(v[i] != a) ans++;
    for(int i = 1 ; i < n ; i += 2) if(v[i] != b) ans++;
    return ans;
}
void solve() {
    map<int, int> m[2];
    for(int i = 0 ; i < n ; i++) m[i%2][v[i]]++;
    vector<pair<int, int> > v[2];
    for(int i = 0 ; i < 2 ; i++) {
        for(auto j : m[i]) v[i].push_back(make_pair(j.second, j.first));
        sort(v[i].begin(), v[i].end());
        reverse(v[i].begin(), v[i].end());
    }
    
    if(v[0][0].second == v[1][0].second) {
        if(v[0].size() == 1 && v[1].size() == 1) cout << min(v[0][0].first, v[1][0].first) << '\n';
        else if(v[0].size() == 1) {
            cout << test(v[0][0].second, v[1][1].second) << '\n';
        }
        else if(v[1].size() == 1) {
            cout << test(v[0][1].second, v[1][0].second) << '\n';
        }
        else {
            cout << min(test(v[0][1].second, v[1][0].second), test(v[0][0].second, v[1][1].second)) << '\n';
        }
    }
    else {
        cout << test(v[0][0].second, v[1][0].second) << '\n';
    }
}

int main() {
    init();
    solve();
}


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

int main() {
	int n, nmin, nmax;
	int a[500];
	int b[500];
	int c[3];
	int gapmax = -100;
	int gap;
	int pass;

	a[0] = 0;
	b[0] = 0;
	c[0] = 0;

	while (1) {
		cin >> n >> nmin >> nmax;

		if (n == 0 && nmin == 0 && nmax == 0) { 
			break; 
		}
		pass = 0;
		gapmax = -100;

		for (int i = 1; i < n + 1; i++) {
			cin >> a[i];
		}
		for (int i = 1; i < n + 1;i++){
			b[i] = a[i] - a[i + 1];
			}
		for (int i = nmin; i < nmax+1; i++) {
			if (gapmax<=b[i]){
				gapmax= b[i];
				pass = i;
			}
			
		}
		cout << pass << endl;	
	}	
}

Measured memory_bytes: 1164
//
#include <vector>
#include <set>
#include <array>
#include <iostream>
#include <cstdio>
#include <cstdint>
#include <algorithm>
#include <numeric>
#include <bitset>
#include <string>
//
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i,n) for(ll i=0;i<(n);++i)
inline void yes(bool cond) { cond ? puts("Yes") : puts("No"); }
template<typename Type> inline void chmin(Type& a, Type b) { if (a > b) a = b; }
template<typename Type> inline void chmax(Type& a, Type b) { if (a < b) a = b; }
template<typename Arr, typename Type> inline void fill(Arr& arr, Type v) { std::fill(arr.begin(), arr.end(), v); }
template<typename Type> inline void sort(Type& arr) { std::sort(arr.begin(), arr.end()); }
template<typename Type> inline Type nth(vector<Type>& arr, size_t pos) { std::nth_element(arr.begin(), arr.begin() + pos, arr.end()); return arr[pos]; }
constexpr double BIGP = 1000000007L;
constexpr double INF_I = std::numeric_limits<double>::max();
constexpr double INF_F = std::numeric_limits<float>::infinity();
constexpr double PI = 3.14159265358979323846L;
//
int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    bool valid = true;
    rep(i, N)
    {
        ll a;
        cin >> a;
        bool v2 = a % 2 == 0;
        bool v3 = a % 3 == 0;
        bool v5 = a % 5 == 0;
        valid &= !v2 || (v3 || v5);
    }
    if (valid)
        cout << "APPROVED ";
    else
        cout << "DENIED  ";
    return 0;
}

Measured memory_bytes: 3120
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;

#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

struct CombMod{
    fac: Vec<u64>,
    inv: Vec<u64>,
    finv: Vec<u64>,
    mmod: u64,
}

impl CombMod{
    pub fn new(max: u64, m: u64) -> CombMod{
        let max: usize = max as usize;
        let mut fac: Vec<u64> = vec![0;max+1];
        let mut finv: Vec<u64> = vec![0;max+1];
        let mut inv: Vec<u64> = vec![0;max+1];

        fac[0] = 1;
        fac[1] = 1;
        finv[0] = 1;
        finv[1] = 1;
        inv[1] = 1;

        for i in 2..max+1{
            fac[i] = fac[i-1] * i as u64 % m;
            inv[i] = m - inv[m as usize %i] * (m/(i as u64)) % m;
            finv[i] = finv[i-1] * inv[i] % m;
        }

        CombMod{
            fac: fac,
            finv: finv,
            inv: inv,
            mmod: m,
        }
    }

    fn get(&self, n: u64, m: u64) -> u64{
        assert!(n >= m && n != 0 && m != 0);
        self.fac[n as usize] * self.finv[m as usize] % self.mmod
            * self.finv[(n-m) as usize] % self.mmod
    }
}

fn main(){
    let line: Vec<u64> = read_as_vec();

    let (n, k) = (line[0], line[1]);
    let m = 1000000007;
    let pos_comb = CombMod::new(2000, m);
    let parti_comb = CombMod::new(2000, m);

    for i in 1..k+1{
        if n-k+1 < i || k-1 < i-i{
            println!("0");
        }else if i-1 == 0{
            println!("{}", pos_comb.get(n-k+1, i));
        }else{
            println!("{}", (pos_comb.get(n-k+1, i) * parti_comb.get(k-1, i-1))%m);
        }
    }
}


Measured memory_bytes: 4352
#include <stdio.h>
#include <algorithm>
using namespace std;

int a[55], b[55], c[55], d[55], A[11], n, m, q, ans;

void recursion(int lev)
{
	int i;

	if (lev > n)
	{
		int sum = 0;
		for (i = 1; i <= q; i++)
			if (A[b[i]] - A[a[i]] == c[i])
				sum += d[i];
		ans = max(ans, sum);
	}
	else
	{
		for (i = A[lev - 1]; i <= m; i++)
		{
			A[lev] = i;
			recursion(lev + 1);
		}
	}
}

int main(void)
{
	int i;

	scanf("%d %d %d", &n, &m, &q);
	for (i = 1; i <= q; i++)
		scanf("%d %d %d %d", &a[i], &b[i], &c[i], &d[i]);

	A[0] = 1;
	recursion(1);

	printf("%d", ans);
	return 0;
}

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

using namespace std;

int s;
set<int> st;

const int MAX_M = 1000000;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    cin >> s;
    
    int res = 0;
    int cur = s;
    set<int> se;
    
    se.insert(cur);
    for (int i=2; i<1e8; ++i) {
        if (cur%2==0) {
            cur /= 2;
        } else {
            cur = cur*3+1;
        }
        if (se.count(cur)) {
            res = i;
            break;
        }
        se.insert(cur);
    }
    cout << res << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define H 500001
int n;
void maxHeapify(int*,int);
void buildMaxHeap(int *);
int main(){
  int A[H];
  int i;

  scanf("%d",&n);
  for(i = 1; i <= n; i++)
    scanf("%d",&A[i]);
  buildMaxHeap(A);
  for(i = 1; i <= n; i++) 
    printf(" %d",A[i]);
  printf("\n");
  return 0;
}

void maxHeapify(int A[],int i) 
{
  int l,r,largest,tmp;
  l = 2*i;
  r = 2*i + 1;
  if(l <= n && A[l] > A[i]) 
    largest = l;
  else 
    largest = i;
  if(r <= n && A[r] > A[largest])
    largest = r;
  if(largest != i) {
    tmp = A[i];
    A[i] = A[largest];
    A[largest] = tmp;
    maxHeapify(A,largest);
  }
}

void buildMaxHeap(int A[]) 
{
  int i;
  for(i = n/2; i >= 1; i--) 
    maxHeapify(A,i);
}

Measured memory_bytes: 2552
// 選択ソート
#include<iostream>
using namespace std;

template<class T>
int selectionSort(T* array, int size)
{
        int s=0;
        T min;
        for(int i=0; i<size-1; i++){
                min = i;
                for(int j=i+1; j<size; j++){
                        if( array[j] < array[min] ){ min = j; }
                }
                T tmp;
                if( min != i){
                        tmp = array[min];
                        array[min] = array[i];
                        array[i] = tmp;
                        s++;
                }
        }
        return s;
}

int main()
{
        int n, s;
        cin >> n;
        int array[n];
        for(int i=0; i<n; i++){ cin >> array[i]; }

        s = selectionSort(array, n);

        cout << array[0];
        for(int i=1; i<n; i++){
                cout << " " << array[i];
        }
        cout << endl << s << endl;
        return 0;
}
        

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;using ll=int_fast64_t;using ld=long double;constexpr ll INF=1LL<<60,MOD=1e9+7;//998244353;
void solve();int main(){cin.tie(nullptr);ios::sync_with_stdio(false);cout<<fixed<<setprecision(10);solve();return 0;}
#define SELECTOR(_1,_2,_3,_4,SELECT,...) SELECT
#define rep(...) SELECTOR(__VA_ARGS__,_rep2,_rep1,_rep0)(__VA_ARGS__)
#define _rep0(i,n) for(int i=0;i<(int)n;++i)
#define _rep1(i,k,n) for(int i=k;i<(int)n;++i)
#define _rep2(i,k,n,d) for(int i=k;d>0?i<(int)n:i>(int)n;i+=d)
#ifdef __LOCAL
#include "ostreams.h"
#endif
template<class T> inline bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
template<class T> vector<T> make_vector(size_t a,T b){return vector<T>(a,b);}
template<class... Ts> auto make_vector(size_t a,Ts... ts){return vector<decltype(make_vector(ts...))>(a,make_vector(ts...));}
void print(){cerr<<endl;} template<class T,class... Ts> void print(const T& a,const Ts&... ts){cerr<<a<<' ';print(ts...);}

void solve(){
    ll n; cin >> n;
    vector<ll> A(n);
    ll g = 0;
    rep(i, n){
        cin >> A[i];
        g = gcd(g, A[i]);
    }

    if(g != 1){
        cout << "not coprime" << endl;
        return;
    }

    vector<bool> used(1000001);
    for(ll a : A){
        ll k = 3 + pow(a, 0.5);
        set<ll> primes;
        rep(p, 2, k){
            while(a % p == 0){
                primes.insert(p);
                a /= p;
            }
        }
        if(a != 1){
            primes.insert(a);
        }
        for(ll p : primes){
            if(used[p]){
                cout << "setwise coprime" << endl;
                return;
            } else {
                used[p] = true;
            }
        }
    }

    cout << "pairwise coprime" << endl;
}

Measured memory_bytes: 11464
// 2006à\ID J[O2.0
#include <iostream>

using namespace std;

char dx[] = {-1,1,0,0};
char dy[] = {0,0,-1,1};
int b[20][20];
int w, h;

int dfs(int x, int y, int step){
	int res = 100;
	if(step > 10) return 100;
	for(int i=0;i<4;i++){
		int nx = x+dx[i], ny = y+dy[i];
		if(nx<0||h<=nx||ny<0||w<=ny||b[nx][ny]==1) continue;
		while(0<=nx&&nx<h&&0<=ny&&ny<w){
			if(b[nx][ny]==3) return step;
			if(b[nx][ny]==1){
				b[nx][ny] = 0;
				res = min(res, dfs(nx-dx[i], ny-dy[i], step+1));
				b[nx][ny] = 1;
				break;
			}
			nx += dx[i], ny += dy[i];
		}
	}
	return res;
}

int main(){
	int t;
	while(cin >> w >> h, w){
		int sx, sy;
		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				cin >> b[i][j];
				if(b[i][j] == 2) sx = i, sy = j;
			}
		}
		int ans = dfs(sx, sy, 1);
		cout << (ans != 100 ? ans : -1) << endl;
	}
}

Measured memory_bytes: 868
#include <ctime>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <map>
using namespace std;

typedef long long ll;
typedef double lf;
typedef long double Lf;
typedef pair <int,int> pii;
typedef pair <ll, ll> pll;

#define TRACE(x) cerr << #x << "  " << x << endl
#define FOR(i, a, b) for (int i = (a); i < int(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define _ << " " <<

#define fi first
#define sec second
#define mp make_pair

const int MAXN = 510;

int n, m, h, w;
ll p[MAXN][MAXN];

ll myabs(ll x) {
  if (x < 0) return -x;
  return x;
}

int main() {
  scanf("%d %d %d %d",&n,&m,&h,&w);
  if (n % h == 0 && m % w == 0) {
    puts("No");
    return 0;
  }

  REP(i, h) REP(j, w) p[i][j] = 1;
  p[h - 1][w - 1] = -w * h;

  FOR(j, w, m) REP(i, h) p[i][j] = p[i][j % w];
  FOR(i, h, n) REP(j, m) p[i][j] = p[i % h][j];

  while (1) {
    ll sum = 0;
    ll maks = -1;
    REP(i, n) REP(j, m) sum += p[i][j];
    REP(i, n) REP(j, m) maks = max(maks, myabs(p[i][j]));

    if (maks > (ll)1e9) break;

    if (sum > 0) {
     puts("Yes");
     REP(i, n) {
      REP(j, m) printf("%lld ",p[i][j]);
      puts("");
     }
     return 0;
    }

    REP(i, n) REP(j, m) p[i][j] *= 2;
    for (int i = h - 1; i < n; i += h)
      for (int j = w - 1; j < m; j += w)
        p[i][j]++;
  }

  puts("No");
  return 0;
}



Measured memory_bytes: 3328
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#define PI 3.141592653589793
#define MOD 1000000007
//#define DEBUG

//qsort用、昇順
int compare_int(const void *a, const void *b)
{
	return *(int*)a-*(int*)b;
}
//qsort(array, 10, sizeof(int), compare_int)

long int x[200100], y[200100];

int main(){
	long int n, d, count = 0;
	long int tmp, dd;
	scanf("%ld%ld", &n, &d);
	dd = d*d;
	for(int i=0; i<n; i++){
		scanf("%ld%ld", &x[i], &y[i]);
	}

	for(int i=0; i<n; i++){
		tmp = x[i]*x[i] + y[i]*y[i];
		if(tmp<=dd) count++;
	}
	
	printf("%ld\n", count);

	
	return 0;
}



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

struct UnionFind
{
  vector<int> par; //par[i]はiの親の番号
  
  UnionFind(int N) : par(N)
  {
    for(int i = 0; i < N; i++) par[i] = i; //最初は全て根として初期化
  }
  
  int root(int x) //データxが属する木の根を再帰で得る root(x)={xの木の根}
  {
    if(par[x] == x) return x;
    return par[x] = root(par[x]); //親を再帰的にたぐり根を探す
  }
  
  void unite(int x, int y) //xとyの木を併合
  {
    int rx = root(x); //xの根
    int ry = root(y); //yの根
    if(rx == ry) return; //xとyの根が同じ(同じ木にある)ならそのまま
    par[rx] = ry; //xとyの根が同じでない(同じ木にない)ならyの根にxの根を付ける
  }
  
  bool same(int x, int y)//2つのデータx,yが同じ木に属するならtrue
  {
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
};

int main()
{
  int N, M, x, y;
  cin >> N >> M;
  vector<int> p(N);
  
  int total = 0;
  UnionFind tree(N);
  
  for(int i = 0; i < N; i++){cin >> p.at(i);}
  for(int i = 0; i < M; i++)
  {
    cin >> x >> y;
    x--;
    y--;
    tree.unite(x, y);
  }
  for(int i = 0; i < N; i++)
  {
    if(tree.same(i, p.at(i) - 1)) total++;
  }
  cout << total << endl;
}

Measured memory_bytes: 4048
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
using namespace std;

int main(){
	bool mayRed[100001];
	int x,y,m,n,ball[100001],res=1;
	memset(mayRed,0,sizeof(mayRed));
	memset(ball,0,sizeof(ball));
	mayRed[1]=1;
	cin >> n >> m;
	for(int i=1;i<=n;i++)
		ball[i]=1;
	while(m--){
		cin >> x >> y;
		if(mayRed[x]==1&&mayRed[y]==0&&ball[x]-1>0){
			mayRed[y]=1;
			res++;
		}
		else if(mayRed[x]==1&&mayRed[y]==0&&ball[x]-1==0){
			mayRed[x]=0;mayRed[y]=1;
		}
		else if(mayRed[x]==1&&mayRed[y]==1&&ball[x]-1==0){
			mayRed[x]=0;
			res--;
		}
		ball[x]--;ball[y]++;
	}
	cout << res << endl;
	return 0;
} 

Measured memory_bytes: 768
using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main()
    {
        string[] s = Console.ReadLine().Split().ToArray();
        int d = int.Parse(s[0]);
        int g = int.Parse(s[1]);

        int[] p = new int[d];
        int[] c = new int[d];
        int[] all_AC_sum = new int[d];

        for (int i = 0; i < d; i++)
        {
            s = Console.ReadLine().Split().ToArray();
            p[i] = int.Parse(s[0]);
            c[i] = int.Parse(s[1]);
            all_AC_sum[i] = p[i] * (i + 1) * 100 + c[i];
        }

        int AC_n = int.MaxValue;
        
        // Math.Pow(2, d)は1 << dと同義
        for (int i = 0; i < Math.Pow(2, d); i++)
        {
            bool[] bits = new bool[d];
            for (int j = 0; j < d; j++)
            {
                if ((1 & i >> j) == 1) bits[j] = true;
            }
            int sum = 0;
            int tmp_AC_n = 0;
            for (int j = 0; j < bits.Length; j++)
            {
                if (bits[j])
                {
                    sum += all_AC_sum[j];
                    tmp_AC_n += p[j];
                    Debug.Write(all_AC_sum[j]);
                }
                else Debug.Write('-');
            }
            if (sum >= g)
            {
                Debug.Write("=" + sum + "☆\n");
                AC_n = Math.Min(AC_n, tmp_AC_n);
            }
            else
            {
                Debug.Write("=" + sum + "\n");
                for (int t = bits.Length - 1; 0 <= t; t--)
                {
                    if (!bits[t])
                    {
                        for (int part_AC_n = 1; part_AC_n <= p[t]; part_AC_n++)
                        {
                            sum += 100 * (t + 1);
                            if (sum >= g)
                            {
                                Debug.WriteLine("=" + sum + "(" + (t + 1) * 100 + "点問題を" + part_AC_n + "問)☆\n");
                                AC_n = Math.Min(AC_n, tmp_AC_n + part_AC_n);
                                break;
                            }
                        }
                        break;
                    }
                }
            }
        }
        Console.WriteLine(AC_n);
    }
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
  int h, w;
  cin >> h >> w;
  vector<string> s(h);
  rep(snip_i, h) cin >> s.at(snip_i);
  vector<vector<int>> ans(h, vector<int>(w,0));
  

  rep(i, h){
    vector<int> temp(w, -1), cov;
    int co = 0;
    int num = 0;
    rep(j, w){
      if(s.at(i).at(j) == '#'){
        cov.push_back(co);
        num++;
        co = 0;
        continue;
      }
      co++;
      temp.at(j) = num;
    }
    cov.push_back(co);
    rep(j, w){
      if(temp.at(j) > -1){
        ans.at(i).at(j) += cov.at(temp.at(j));
      }
    }
  }

  int mx = 0;
  rep(j, w){
    vector<int> temp(h, -1), cov;
    int co = 0;
    int num = 0;
    rep(i, h){
      if(s.at(i).at(j) == '#'){
        cov.push_back(co);
        num++;
        co = 0;
        continue;
      }
      co++;
      temp.at(i) = num;
    }
    cov.push_back(co);
    rep(i, h){
      if(temp.at(i) > -1){
        ans.at(i).at(j) += cov.at(temp.at(i));
        mx = max(mx, ans.at(i).at(j));
      }
    }
  }

  // rep(i, h){
  //   rep(j, w){
  //     cerr << ans.at(i).at(j) << " ";
  //   }
  //   cerr << endl;
  // }
  cout << mx-1 << endl;
  return 0;
}

Measured memory_bytes: 20096
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

int main()
{
    IO;
    set<int> st;
    int n;
    cin >> n;
    vector<int> v;
    for(int i = 0; i < n; i++)
    {
        int a;
        cin >> a;
        st.insert(a);
        v.push_back(a);
    }
    int ans = 0;
    for(int i = 1; i <n - 1; i++)
    {

        int a = v[i], b = v[i - 1],c = v[i + 1];
        int mini = min(a,min(b,c));
        int maxi = max(a,max(b, c));
        if(a != mini && a !=maxi)
            ans++;
    }
    cout << ans;
    return 0;
}


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

using namespace std;

char a[10][10];

int main() {
  
  int n, m, k, ans = 0;
  
  cin >> n >> m >> k;
  
  for(int i = 0; i < n; i++)
  for(int j = 0; j < m; j++) {
     cin >> a[i][j];
  }
  
  for(int i = 0; i < (1 << n); i++) {
     for(int j = 0; j < (1 << m); j++) {
        int cur = 0;
        for(int z = 0; z < n; z++) {
           for(int p = 0; p < m; p++) {
              if (a[z][p] == '#' && ((i >> z) & 1) && ((j >> p) & 1)) {
                 cur++;
              }
           }
        }
        if (cur == k) {
           ans++;
        }
     }
  }
  
  cout << ans;
}

Measured memory_bytes: 3588
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cstring>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
int main(){
    int n;
    cin >> n;
    vector<int>a(n+1,0),b(n+1,0);
    rep(i,n){
        cin >> a[i];
    }
    rep(i,n){
        cin >> b[i];
    }
    rep(i,n){
        a[i+1] += a[i];
        b[i+1] += b[i];
    }
    int ans = a[0] + b[n-1];
    rep(i,n){
        if(i)ans = max(ans, a[i]+b[n-1]-b[i-1]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
from math import sin, cos, sqrt

l = list(map(int, input().split()))
a, b = l[0], l[1]
h, m = l[2], l[3]

PI = 3.14159265359

theta_a = 2*PI*(h/12) + (2*PI/12)*(m/60)
theta_b = 2*PI*(m/60)

pa_x = a*cos(theta_a)
pa_y = a*sin(theta_a)
pb_x = b*cos(theta_b)
pb_y = b*sin(theta_b)

print(sqrt((pa_x-pb_x)**2+(pa_y-pb_y)**2))


Measured memory_bytes: 9528
#include <iostream>

bool f[100001];

int main(){
    int n, tmp, ans = 0;
    std::cin >> n;
    for(int i = 0; i < n; i++){
        std::cin >> tmp;
        if(i==tmp-1) f[i] = true;
    }
    for(int i = 0; i < n; i++){
        if(f[i]){
            ans++;
            if(f[i+1]) i++;
        }
    }
    std::cout << ans << std::endl;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define REP(x,y,z) for(int x=y;x<=z;x++)
#define MSET(x,y) memset(x,y,sizeof(x))
#define M 405
using namespace std;
using LL = long long;
int n,a[M];
bool vis[M][M];
LL dp[M][M],pre[M];

LL dfs(int x,int y) {
    if (x==y) return 0LL;
    if (vis[x][y]) return dp[x][y];
    vis[x][y] = true;
    LL &res = dp[x][y];

    LL sum = pre[y] - pre[x-1];
    res = (1LL << 61);
    REP(i,x,y-1) res = min(res, dfs(x,i) + dfs(i+1,y) + sum);
    return res;
}
int main()
{
    scanf("%d", &n);
    REP(i,1,n) scanf("%d", &a[i]);

    pre[0] = 0;
    REP(i,1,n) pre[i] = pre[i-1] + a[i];
    printf("%lld\n", dfs(1,n));
    return 0;
}


Measured memory_bytes: 5244
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <math.h>
#include <vector>
#include <map>
#include <queue>
#include <utility>
#include <algorithm>
using namespace std;
int main() {
  string S;
  cin >> S;
  bool ans = false;
  for (int i = 0; i < 3; i++) {
	  if (S[i] == S[i + 1]) {
		  ans = true;
		  break;
		}
	}
  if (ans) {
	  cout << "Bad" << endl;
	}
  else {
	  cout << "Good" << endl;
	}
  return 0;
}


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

ll n, k, ar[200005];
ld arr[200005], cur;
vector<ld> v;

int main() {
	fastio; cin >> n >> k;
	FOR(i, 1, n) {
		cin >> ar[i];
		arr[i] = log2l(ar[i]);
		cur += arr[i];
		if (i >= k) {
			v.pb(cur);
			cur -= arr[i-k+1];
		}
	}
	FOR(i, 1, v.size()-1) cout << (v[i] > v[i-1] ? "Yes\n" : "No\n");
}


Measured memory_bytes: 11384
using System;

namespace ITP1
{
    class Program
    {
        static void Main(string[] args)
        {
            string W = Console.ReadLine();
            W = W.ToLower();
            
            int cou = 0;

            while (true)
            {
                string[]T = Console.ReadLine().Split(' ');
                if (T[0] == "END_OF_TEXT") break;
                
                for (int i = 0; i < T.Length; i++)
                {
                    T[i] = T[i].ToLower();
                    
                        if (T[i] == W)
                        {
                        cou++;
                        }
                    
                }

            }
            Console.WriteLine(cou);
        }
    }
}

Measured memory_bytes: 9136
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
ll INF = (1LL << 50) - 1;
int MOD = 1e9+7;

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

ll N, M, L;

vector<P> graph[310];
ll cost[310][310];//cost[i][j] i->jのコスト
P dist[310][310];//(回数,距離)
void dijkstra(ll s){
    //<cost, (座標)>
    priority_queue<PP, vector<PP>, greater<PP> > que;
    que.push(PP( P(0LL, 0LL), s) );
    while(!que.empty()){
        auto c = que.top().first;
        auto now = que.top().second;
        que.pop();

        if(dist[s][now] < c)continue;

        for(auto next: graph[now]){
            auto nextpos = next.first;
            auto nextc = next.second;
            ll count = c.first;
            ll dcost = c.second;
            if(dcost + nextc > L){
                dcost = nextc;
                count++;
            }else{
                dcost += nextc;
            }
            if(dist[s][nextpos] <= P(count, dcost))continue;
            dist[s][nextpos] = P(count, dcost);
            que.emplace(dist[s][nextpos], nextpos);
        }
        
    }
}
main(){
    
    cin >> N >> M >> L;
    rep(i,0,N)rep(j,0,N)cost[i][j] = INF;
    rep(i,0,N)cost[i][i] = 0;
    rep(i,0,N)rep(j,0,N)dist[i][j] = P(INF, INF);
    rep(i,0,N)dist[i][i] = P(0, 0);

    vector<ll> A(M),B(M),C(M);
    rep(i,0,M)cin >> A[i] >> B[i] >> C[i];
    rep(i,0,M){
        A[i]--, B[i]--;
        if(C[i] > L)continue;
        graph[A[i]].emplace_back(B[i],C[i]);
        graph[B[i]].emplace_back(A[i],C[i]);
    }
    rep(i,0,M)cost[A[i]][B[i]] = cost[B[i]][A[i]] = C[i];
    rep(i,0,N)dijkstra(i);

    int Q;
    cin >> Q;
    rep(i,0,Q){
        int s,t;
        cin >> s >> t;
        s--,t--;
        auto tmp = dist[s][t];
        ll count = min(dist[s][t].first, dist[t][s].first);
        if(count == INF)count = -1;
        cout << count << endl;
        //cout << dist[s][t].first << " " << dist[s][t].second << "," << dist[t][s].first << " " << dist[t][s].second << endl;
    }
}

Measured memory_bytes: 6144
#include <stdio.h>

int main(){
int a;
int b;

while(1)
{
scanf("%d %d\n",&a,&b);

if(a==0 && b==0) {break;}

else {

if(a>b){
printf("%d %d\n",b,a);
}

else{
printf("%d %d\n",a,b);
}
}
}
}


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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

    int A,B,C; cin >> A >> B >> C;
    bool ans = false;

    if(A%B == C) ans = true;

    int t = 2;

    while(true){
        if((A*t)%B == A%B) break;
        if((A*t)%B == C) ans = true;
        t++;
    }

    cout << (ans?"YES":"NO") << endl;

    return 0;

}

Measured memory_bytes: 256
n=int(input())
nlist=list(map(int,input().split()))

import collections

count_dict=collections.Counter(nlist)

anslist=[]
all_kumi=0
for i in count_dict.values():
    all_kumi += i*(i-1)//2
 
for j in range(0,n):
    print(all_kumi - count_dict[nlist[j]] + 1)


Measured memory_bytes: 87756
#include "bits/stdc++.h"
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(s) s.begin(), s.end()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;
const int DIV = 1e9+7;

int n, m;
vi p;

class UnionFind{
    public:
        UnionFind(int n){
            par.resize(n); rnk.resize(n);
            for(int i = 0; i < n; i++){ par[i] = i; rnk[i] = 0; }
        }
        int find(int x) {
            if(par[x] == x) return x;
            else return par[x] = find(par[x]);
        }
        void unite(int x, int y) {
            x = find(x); y = find(y);
            if(x == y) return;

            if(rnk[x] < rnk[y]) { par[x] = y; }
            else{
                par[y] = x;
                if (rnk[x] == rnk[y]) rnk[x]++;
            }
        }
        bool same(int x, int y) { return find(x) == find(y); }

    private:
        vector<int> par; vector<int> rnk;
};


int main()
{
    cin >> n >> m;
    p.resize(n); rep(i, n) cin >> p[i];
    rep(i, n) p[i]--;


    UnionFind un(n);
    rep(i, m){
        int x, y; cin >> x >> y;
        un.unite(x - 1, y - 1);
    }
    int ans = 0;
    rep(i, n){
        if(p[i] == i || un.find(p[i]) == un.find(i)) ans++;
    }
    cout << ans << endl;

    return 0;

}

Measured memory_bytes: 1408
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
string s,t;
int main(void){
    while(1){
    cin>>s;
    if(s==".")return 0;
    cin>>t;
    if(s==t){cout<<"IDENTICAL"<<endl;continue;}
    vector<int> v1,v2;
    vector<string>u1,u2;
    for(int i=0;i<s.size();i++){
        if(s[i]=='"')v1.push_back(i);
    }
    for(int i=0;i<v1.size();i+=2){
        u1.push_back(s.substr(v1[i]+1,v1[i+1]-v1[i]-1));
    }
    for(int i=0;i<t.size();i++){
        if(t[i]=='"')v2.push_back(i);
    }
    for(int i=0;i<v2.size();i+=2){
        u2.push_back(t.substr(v2[i]+1,v2[i+1]-v2[i]-1));
    }
    int cnt=0;
    if(u1.size()!=u2.size())cout<<"DIFFERENT"<<endl;
    else{
        for(int i=0;i<u1.size();i++){
            if(u1[i]!=u2[i])cnt++;
        }
        if(cnt==1){
            s='"'+s+'"';
            t='"'+t+'"';
            vector<int> v1,v2;
            vector<string>u1,u2;
            for(int i=0;i<s.size();i++){
                if(s[i]=='"')v1.push_back(i);
            }
            for(int i=0;i<v1.size();i+=2){
                u1.push_back(s.substr(v1[i]+1,v1[i+1]-v1[i]-1));
            }
            for(int i=0;i<t.size();i++){
                if(t[i]=='"')v2.push_back(i);
            }
            for(int i=0;i<v2.size();i+=2){
                u2.push_back(t.substr(v2[i]+1,v2[i+1]-v2[i]-1));
            }
            int cnt1=0;
            for(int i=0;i<u1.size();i++){
                if(u1[i]!=u2[i])cnt1++;
            }
                
            
            
            
            if(cnt1==0)cout<<"CLOSE"<<endl;
            else cout<<"DIFFERENT"<<endl;
        }
        else cout<<"DIFFERENT"<<endl;
    }
    }
}



Measured memory_bytes: 3148
#include <bits/stdc++.h>
using namespace std;
void debug() {cout<<endl;}
template<typename T,typename... Args>
void debug(T x,Args... args) {cout<<x<<" ";debug(args...);}
#define forn(i,a,b) for(int i=a;i<b;++i)
#define SZ(x) int(x.size())
#define pb push_back
#define F first
#define S second
#define endl "\n"
typedef long long ll;
typedef pair<int, int> pii;

int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    int n, m, c;
    cin >> n >> m >> c;
    int b[m];
    forn(i, 0, m) {
        cin >> b[i];
    }
    int ans = 0;
    forn(i, 0, n) {
        int sum = c;
        forn(j, 0, m) {
            int a;
            cin >> a;
            sum += a*b[j];
        }
        if (sum > 0) ans++;
    }
    cout << ans << endl;    
}


Measured memory_bytes: 3652
data = gets.split(" ").map{|nn|nn.to_i}
n = data[0]
m = data[1]
if n==1 && m == 1
  puts "1"
elsif n == 1
  puts (m-2).to_s
elsif m == 1
  puts (n-2).to_s
else
  puts ((m-2)*(n-2)).to_s
end

Measured memory_bytes: 1788
#include<stdio.h>
int main(void)
{
    int a,b,c,i=0,s;
    scanf("%d%d%d",&a,&b,&c);
    while(i<=100){
        s=b*i+c;
        if(s%a==0){
            printf("YES\n");
            return 0;
        }
        i++;
    }
    printf("NO\n");
    return 0;
}


Measured memory_bytes: 1608
n,q = map(int,input().split())
s = input() + '0'
lr = [list(map(int,input().split())) for _ in range(q)]
cnt = [0] * (n+1)

for i in range(n):
  if s[i] == 'A' and s[i+1] == 'C':
    cnt[i+1] = cnt[i] + 1
  else:
    cnt[i+1] = cnt[i]
for i in lr:
  print(cnt[i[1]-1] - cnt[i[0]-1])

Measured memory_bytes: 30656
#include <bits/stdc++.h>
    using namespace std;
     
	int a,b;


    int main() {
      cin >> a >> b;
      
      if (a * b % 2 == 1) {
        
        cout << "Odd" << endl;
      }
      else {
        cout << "Even" << endl;
      }
    }

Measured memory_bytes: 256
#include <stdio.h>

struct Score
{
	char name[32];
	int point;
};

int main(void)
{
	int n;
	char flag = 0;
	
	while (scanf("%d", &n) * n != 0){
		struct Score team[10];
		int i, j;
		
		flag == 0 ? flag = 1 : puts("");
		for (i = 0; i < n; i++){
			int w, d;
			
			scanf("%s", team[i].name);
			scanf("%d %*d %d", &w, &d);
			team[i].point = w * 3 + d;
		}
		for (i = 0; i < n - 1; i++){
			for (j = 0; j < n - i - 1; j++){
				if (team[j].point < team[j + 1].point){
					struct Score tmp = team[j];
					team[j] = team[j + 1];
					team[j + 1] = tmp;
				}
			}
		}
		for (i = 0; i < n; i++){
			printf("%s,%d\n", team[i].name, team[i].point);
		}
	}
	
	return 0;
}

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

int main(){
	int count = 0;
	string W, T, E = "END_OF_TEXT";
	cin>>W;
	
	while(1){
		int i = 0,j = 0;
		cin>>T;
		if((int) E.size() == (int) T.size()){
			for(i = 0; i < (int) E.size(); i++){
				if(E[i] != T[i]) break;
			}		
		}
		if(i == E.size()) break;
		
		if((int)W.size() == (int)T.size()){
			for(i = 0; i < (int) W.size(); i++){
				if(isupper(T[i])) T[i] = tolower(T[i]);
				if(W[i] != T[i]) break;
			}
			if(i == (int)W.size()) count++;
		}
		
	}
	cout<<count<<endl;

	return 0;
}


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

using namespace std;

int main(){
	int number_of_heights;
	cin >> number_of_heights;
	int heghts[number_of_heights];
	for(int i = 0; i < number_of_heights; ++i){
		cin >> heghts[i];
	}
	int ans_assume = 1;
	for(int i = 0; i < number_of_heights - 1; ++i){
		if( heghts[i+1] > heghts[i] )	--heghts[i+1];
      	else if(heghts[i+1] < heghts[i])	ans_assume = 0;
    }
	if(ans_assume == 1){
		cout << "Yes\n";
	} else {
		cout << "No\n";
	}

}

Measured memory_bytes: 640
#include <stdio.h>
#include <stdbool.h>

int main(){
    int N;
    if(scanf("%d", &N)==1);
    if(N<3 || N>100){
        return -1;
    }

    int D1[128], D2[128];
    for(int i=0; i<N; i++){
        scanf("%d %d", &D1[i], &D2[i]);
    }

    bool hantei=false;   
    for(int i=0; i<N; i++){
        if( (D1[i]==D2[i]) 
            && (D1[i+1]==D2[i+1])
            && (D1[i+2]==D2[i+2]) ){
                hantei=true;
        }
    }

    if(hantei){
        printf("Yes\n");
    }
    else{
        printf("No\n");
    }

    return 0;
}

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

int main(){
  int H,W,N;
  cin >> H >> W >> N;
  vector<int>vec;
  for(int i = 0 ; i < N ; i++){
    int tmp; cin >> tmp;
    vec.push_back(tmp);
  }
  int data[H][W];
  for(int i = 0 ; i < H ; i++){
    for(int j = 0 ; j < W ; j++){
      data[i][j] = 0;
    }
  }

  int x = 0;
  int y = 0;
  bool down = true;

  for(int i = 0 ; i < vec.size() ; i++){
    for(int j = 0 ; j < vec[i] ; j++){
      data[y][x] = (i+1);
      if(down){
        if(y + 1 == H){
          x++;
          down = !down;
        }else {
          y++;
        }
      }
      else {
        if(y - 1 == -1){
          x++;
          down = !down;
        }else {
          y--;
        }
      }
    }
  }

  for(int i = 0 ; i < H ; i++){
    for(int j = 0 ; j < W ; j++){
      if(j)cout << ' ';
      cout << data[i][j];
    }
    cout << endl;
  }
  
  return 0;
}


Measured memory_bytes: 384
import numpy as np

n = int(input())
flower = [int(part) for part in input().split()]
flower = np.array(flower)

count = 0
highest = max(flower)
for h in range(1, highest+1):
    signal = (flower >= h)
    #print(signal)
    
    pre = False
    for now in signal:
        #print(pre, now)
        if not pre and now:
            count += 1
        pre = now
print(count)

Measured memory_bytes: 14452
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
 
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <iterator>
#include <functional>
#include <limits>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include<chrono>
 
using namespace std;
//using namespace std::chrono;
 
#define ios ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define vl int64_t

int main()
{
     ll n;
     cin>>n;
     string s,t;
     cin>>s>>t;
     for(ll i=0;i<n;i++)
     {
          cout<<s[i]<<t[i];
     }
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <cstdint>
#include <cinttypes>
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>

using namespace std;
static const long k10E7 = 1000000007;

int main()
{
    double W, H, x, y;
    cin >> W >> H >> x >> y;

    int multiple = 0;
    if(x == W / 2.0 && y == H / 2.0){
        multiple = 1;
    }

    cout << W * H / 2.0 << " " << multiple << endl;

    return 0;
}



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

int main()
{
    string a, b;
    cin >> a >> b;
    int ab = stoi(a + b);

    if ((int)(sqrt(ab)) * (int)(sqrt(ab)) == ab)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

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

int main() {
  int n;
  string s;
  cin>>n>>s;
  for(int i=0;i<s.size();i++){
    if(s.at(i)+n<=90){
      cout<<(char)(s.at(i)+n);
    }
    else{
      cout<<(char)(s.at(i)+n-26);
    }
  }
  cout<<endl;
}

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

#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 ALL(v) v.begin(), v.end()

int main() {
  int N,K,Q;
  cin >> N >> K >> Q;
  vector<int> A(Q);
  map<int, int> P;
  REP(i,Q) {
    int a;
    cin >> a;
    P[a - 1]++ ;  
  }
  REP(i,N) {
  	cout << ((K - (Q - P[i]))>0?"Yes":"No") << endl;
  }
}

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i, n) for(int i = (int)(n); i >= 0; i--)
#define repm(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define repmr(i, m, n) for(int i = (int)(n); i >= (int)(m); i--)
#define all(x) (x).begin(),(x).end()
#define inf 2e9

using namespace std;
typedef long long int lli;
typedef long long ll;

int n,q;
vector<vector<int>> tree(200000, vector<int>());

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

    string ans = "Impossible";
    if(a % 3 == 0 || b % 3 == 0 || (a+b) % 3 == 0) ans = "Possible";

    cout << ans << endl;
}


Measured memory_bytes: 4992
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();

        int ans = 0;
        for (int i = 0; i <= 9; i++) {
            for (int j = 0; j <= 9; j++) {
                for (int k = 0; k <= 9; k++) {
                    StringBuilder sb = new StringBuilder();
                    sb.append(i);
                    sb.append(j);
                    sb.append(k);
                    String num = sb.toString();
                    int m = 0;
                    for (int l = 0; l < n; l++) {
                        if (s.charAt(l) == num.charAt(m)) {
                            m++;
                        }
                        if (m >= 3) {
                            ans++;
                            break;
                        }
                    }
                }
            }
        }
        System.out.println(ans);
    }

}


Measured memory_bytes: 24988
#include<stdio.h>
#include<assert.h>
#include<map>
#include<cmath>
#include<set>
#include<queue>
#include<algorithm>

using namespace std;

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

const int MX = 200005;
const int MM = 1000000007;

ll gcd(ll a, ll b){
	return b ? gcd(b, a%b) : a;
}

ll pw(ll a, ll b, ll M){
	ll r = 1;
	while(b){
		if( b&1 ) r = r*a % M;
		a = a*a % M; b /= 2;
	} return r;
}

pll ex_gcd(ll a, ll b){
	if( b == 0 ) return pll(1, 0);
	else{
		pll t = ex_gcd(b, a%b);
		// b * t.first + (a - b*a/b) * t.second
		return pll(t.second, t.first - a/b*t.second);
	}
}

ll get_answer(ll a, ll b, ll c, ll d){
	ll g = gcd(b, d);
	pll t = ex_gcd(b, d);
	ll x = ((__int128) (c-a)/g * t.first * b + a) % (b*d/g);
	assert((c-a)%g == 0);
	if( x < 32 ) x += b*d/g;
	return x;
}

ll inv(ll A, ll B){
	assert(gcd(A, B) == 1);
	pll t = ex_gcd(A, B);
	return (t.first%B + B) % B;
}

ll P(ll X){
	ll r = 1;
	for(int i = 2; i*i <= X; i++){
		if( X%i == 0 ){
			X /= i, r *= (i-1);
		}
		while( X%i == 0 ){
			X /= i, r *= i;
		}
	}
	if( X != 1 ) r *= (X-1);
	return r;
}

ll O = 1;
ll F1(int A, int M){
	if( A == 0 ) return M*(30/M+1);
	ll B = A, N = M;
	if( gcd(A, M) != 1 ){
		while(gcd(A, N) != 1){
			O *= gcd(A, N); N /= gcd(A, N);
		}
		ll x = F1(pw(A, O, N), N) * O;
		return x;
	}
	ll Pi = P(M), G = gcd(Pi, M);
	ll xi = F1(A%G, G);
	
	ll x = get_answer(pw(A, xi, M) * inv(O, M) % M, M, xi, Pi);
	return x;
}

void solve(){
	int A, M;
	scanf("%d%d", &A, &M);
	O = 1;
	ll p = F1(A, M);
	printf("%lld\n", p);
}

int main()
{
	int Q;
	scanf("%d", &Q);
	for(int i = 1; i <= Q; i++) solve();
}


Measured memory_bytes: 128
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
N = int(input())
A = factorization(N)
if N == 1:
  print(0)
  exit()
ans = 0
for a,b in A:
    if b < 3:
        ans += 1
    elif b < 6:
        ans += 2
    elif b < 10:
        ans += 3
    elif b < 15:
        ans += 4
    elif b < 21:
        ans += 5
    elif b < 28:
        ans += 6
    elif b < 36:
        ans += 7
    elif b < 45:
        ans += 8
    else:
        ans += 9
print(ans)

Measured memory_bytes: 82436
num = raw_input()
num_list = raw_input()
num_list = num_list.split()
print " ".join(num_list)

 
for i in range(1, len(num_list)):
        num_list = map(int, num_list)
        temp = num_list[i]
        j = i - 1
        while (j >= 0 and num_list[j] > temp):
                num_list[j+1] = num_list[j]
                j -= 1
        num_list[j+1] = temp
        num_list = map(str, num_list)
        print " ".join(num_list)

Measured memory_bytes: 6464