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

// begin fast read template by CYJian (source: https://www.luogu.com.cn/paste/i11c3ppx)

namespace io {
	const int __SIZE = (1 << 21) + 1;
	char ibuf[__SIZE], *iS, *iT, obuf[__SIZE], *oS = obuf, *oT = oS + __SIZE - 1, __c, qu[55]; int __f, qr, _eof;
	#define Gc() (iS == iT ? (iT = (iS = ibuf) + fread (ibuf, 1, __SIZE, stdin), (iS == iT ? EOF : *iS ++)) : *iS ++)
	inline void flush () { fwrite (obuf, 1, oS - obuf, stdout), oS = obuf; }
	inline void gc (char &x) { x = Gc(); }
	inline void pc (char x) { *oS ++ = x; if (oS == oT) flush (); }
	inline void pstr (const char *s) { int __len = strlen(s); for (__f = 0; __f < __len; ++__f) pc (s[__f]); }
	inline void gstr (char *s) { for(__c = Gc(); __c < 32 || __c > 126 || __c == ' ';)  __c = Gc();
		for(; __c > 31 && __c < 127 && __c != ' '; ++s, __c = Gc()) *s = __c; *s = 0; }
	template <class I> inline bool gi (I &x) { _eof = 0;
		for (__f = 1, __c = Gc(); (__c < '0' || __c > '9') && !_eof; __c = Gc()) { if (__c == '-') __f = -1; _eof |= __c == EOF; }
		for (x = 0; __c <= '9' && __c >= '0' && !_eof; __c = Gc()) x = x * 10 + (__c & 15), _eof |= __c == EOF; x *= __f; return !_eof; }
	template <class I> inline void print (I x) { if (!x) pc ('0'); if (x < 0) pc ('-'), x = -x;
		while (x) qu[++ qr] = x % 10 + '0',  x /= 10; while (qr) pc (qu[qr --]); }
	struct Flusher_ {~Flusher_(){flush();}}io_flusher_;
} using io::pc; using io::gc; using io::pstr; using io::gstr; using io::gi; using io::print;

// end fast read template by CYJian

#define iter(i, a, b) for(int i=(a); i<(b); i++)
#define rep(i, a) iter(i, 0, a)
#define rep1(i, a) iter(i, 1, (a)+1)
#define log(a) cerr<<"\033[32m[DEBUG] "<<#a<<'='<<(a)<<" @ line "<<__LINE__<<"\033[0m"<<endl
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define pb push_back
#define mp make_pair
 
using ll=long long;
using pii=pair<int, int>;
//#define int ll
const int MOD = 1000000007;

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int k, a, b; gi(k), gi(a), gi(b);
	for(int i=a; i<=b; i++) {
		if(i%k == 0) {
			pstr("OK\n");
			return 0;
		}
	}
	pstr("NG\n");
}


Measured memory_bytes: 3656
import java.io.*;
import java.util.*;
public class Main
{
    static PrintWriter out=new PrintWriter((System.out));
    public static void main(String args[])throws IOException
    {
        Reader sc=new Reader();
        int n=sc.nextInt();
      	int d=n%10;
      	if(d==3)
        {
          out.println("bon");
        }
      	else if(d==0||d==1||d==6||d==8)
        {
          out.println("pon");
        }
     	else
        {
          out.println("hon");
        }
        out.close();
    }
 
 
    static class Reader 
    { 
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st=new StringTokenizer("");
        public String next()
        {
            while(!st.hasMoreTokens())
            {
                try
                {
                    st=new StringTokenizer(br.readLine());
                }
                catch(Exception e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
 
        public int nextInt()
        {
            return Integer.parseInt(next());
        }
 
        public long nextLong()
        {
            return Long.parseLong(next());
        }
 
        public double nextDouble()
        {
            return Double.parseDouble(next());
        }
 
        public String nextLine()
        {
            try
            {
                return br.readLine();
            }
            catch(Exception e)
            {
                e.printStackTrace();
            }
            return null;
        }
 
        public boolean hasNext()
        {
            String next=null;
            try
            {
                next=br.readLine();
            }
            catch(Exception e)
            {
            }
            if(next==null)
            {
                return false;
            }
            st=new StringTokenizer(next);
            return true;
        }
    } 
}

Measured memory_bytes: 32572
// NK
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
#define vi vector<int>
#define vii vector<ii>
#define vll vector<ll>
#define eb emplace_back
#define pb push_back
#define pob pop_back
#define psf push_front
#define pof pop_front
#define mkp make_pair
#define all(x) x.begin(), x.end()

const int MAXS = 2e3+5;
array<vi, MAXS> g;
array<bool, MAXS> vis;
array<int, MAXS> ans;

void bfs(int u){
  queue<ii> BFS;
  BFS.push(ii(u, 0)); //node, dis
  vis[u]=1;
  while(!BFS.empty()){
    int auxu = BFS.front().first, w = BFS.front().second;
    BFS.pop();
    for (int i=0; i<g[auxu].size(); i++){
      int v = g[auxu][i];
      if (!vis[v]){
	vis[v]=1;
	BFS.push(ii(v, w+1));
	ans[w+1]++;
      }
    }
  }
}

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

  int n,x,y; cin>>n>>x>>y;
  for (int i=1; i<n; i++){
    g[i].eb(i+1);
    g[i+1].eb(i);
  }
  g[x].eb(y);
  g[y].eb(x);

  for (int i=1; i<=n; i++){
    vis.fill(0);
    bfs(i);
  }
  for (int i=1; i<n; i++) cout<<(ans[i]/2)<<'\n';

  return 0;
}


Measured memory_bytes: 384
import java.util.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	private void doit(){
		while(true){
			int n = sc.nextInt();
			if (n == 0) break;
			long sum = 0;
			for(int i = 0; i < n; i++){
				sum += sc.nextInt();
			}
			int [] data = new int[n-1];
			for(int i =0; i < n-1; i++){
				data[i] = sc.nextInt();
			}
			Arrays.sort(data);
			long max = 0;
			
			for(int i = 1; i < n; i++){
				max = Math.max(max,sum * (n - i + 1));
				sum += data[n-1-i];
			}
			max = Math.max(max, sum);
			System.out.println(max);
		}
	}

	private void debug(Object... o) {
		System.out.println("debug = " + Arrays.deepToString(o));
	}

	public static void main(String[] args) {
		new Main().doit();
	}
}

Measured memory_bytes: 158828
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=998244353,MAX=100005,INF=1<<28;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    while(1){
        int N,M;cin>>N>>M;
        int maxi=-1;
        if(N==0) break;
        
        vector<int> A(N);
        
        for(int i=0;i<N;i++){
            cin>>A[i];
        }
        
        for(int i=0;i<N;i++){
            for(int j=i+1;j<N;j++){
                if(A[i]+A[j]<=M&&maxi<A[i]+A[j]) maxi=A[i]+A[j];
            }
        }
        
        if(maxi==-1) cout<<"NONE"<<endl;
        else cout<<maxi<<endl;
    }
}



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

struct node{
	int cnt, totaltime, id;
	int ass[51];
};

bool cmp(node a, node b){
	if (a.cnt > b.cnt)return true;
	else if (a.cnt < b.cnt)return false;
	else if (a.totaltime < b.totaltime)return true;
	else if (a.totaltime > b.totaltime)return false;
	else return a.id > b.id;
}

int main()
{
	int m, t, p, r, mk, tk, pk, jk;
	while (cin >> m >> t >> p >> r){
		if (!m && !t && !p && !r)return 0;
		vector<node> vec(t);
		for (int i = 0; i < t; ++i){
			vec[i].id = i + 1;
			vec[i].cnt = 0;
			vec[i].totaltime = 0;
		}
		for (int i = 0; i < r; ++i)
		{
			cin >> mk >> tk >> pk >> jk;
			if (!jk){
				++vec[tk - 1].cnt;
				vec[tk - 1].totaltime += mk + vec[tk-1].ass[pk];
			}else{
				vec[tk-1].ass[pk] += 20;
			}
		}
		sort(vec.begin(), vec.end(), cmp);
		cout << vec[0].id;
		for (int i = 1; i < vec.size(); ++i){
			if (vec[i - 1].cnt == 0 || (vec[i].cnt == vec[i - 1].cnt && vec[i].totaltime == vec[i - 1].totaltime)){
				putchar('=');
			}
			else putchar(',');
			cout << vec[i].id;
		}
		putchar('\n');
	}
}


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

#define int long long

typedef long long li;
typedef long double ld;

void solve();
int32_t main() {
    #ifndef ONLINE_JUDGE
    //    freopen("input.txt", "r", stdin);
    #endif
    cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}
const int N = 3e5 + 55;
inline int getv (int n, int r) {
	return 3 * n + r;
}
vector<int> adj[N];
int n, m;
const int inf = 1e15;
vector<int> dijkstra (int src, int n) {
	priority_queue<pair<int, int>> q;
	bool vis[N] = {false};
	vector<int> dist(3 * n + 5, inf);
	q.push(make_pair(0, src));
	while (!q.empty()) {
		int curv = q.top().second, curd = -q.top().first;
		q.pop();
		if (vis[curv])
			continue;
		vis[curv] = true;
		dist[curv] = curd;
		for (auto i: adj[curv]) {
			if (dist[i] > dist[curv] + 1) {
				dist[i] = dist[curv] + 1;
				q.push(make_pair(-dist[i], i));
			}
		}
 	}
 	return dist;
}
void solve() {
	cin >> n >> m;
	for (int i = 1; i <= m; ++i) {
		int a, b;
		cin >> a >> b;
		for (int r = 0; r < 3; ++r) {
			adj[getv(a, r)].push_back(getv(b, (r + 1)%3));
		}
	}
	int s, t;
	cin >> s >> t;
	auto lol = dijkstra(getv(s, 0), n);
	int ans = lol[getv(t, 0)];
	if (ans > (int) 1e9) cout << -1;
	else cout << ans / 3;
}

Measured memory_bytes: 19328
#pragma GCC optimize("O3", "unroll-loops")
#include <bits/stdc++.h>

using namespace std;
const int maxn = 64 + 10;
long long n, k, ai, bt[maxn], x = 0, cnt[maxn], ans = 0;

long long f(int p) {
	long long tmp = 0;
	for (int i = 0; i < p; i++)
		if (bt[i] <= n - bt[i])
			tmp += (n - bt[i]) * (1LL << i);
		else
			tmp += (bt[i]) * (1LL << i);
	return tmp + (1LL << p) * bt[p];
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> ai;
		for (long long j = 0; (1LL << j) <= ai; j++)
			if (ai & (1LL << j))
				bt[j]++;
	}
	for (long long i = 0; i <= 62; i++) {
		if (k & (1LL << i))
			cnt[i] = cnt[i - 1] +  (n - bt[i]) * (1LL << i);
		else
			cnt[i] = cnt[i - 1] + (bt[i]) * (1LL << i);
	}
	ans = cnt[62];
	for (long long i = 0; i <= 62; i++) {
		if (k & (1LL << i))
			ans = max(ans, cnt[62] - cnt[i] + f(i));
	}
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 256
import sys
n = int(input())
A=[int(e)for e in sys.stdin]
cnt = 0
G = [797161,265720,88573,29524,9841,3280,1093,364,121,40,13,4,1]
G = [v for v in G if v <= n]
def insertionSort(A, n, g):
    global cnt
    for i in range(g, n):
        v = A[i]
        j = i - g
        while j >= 0 and A[j] > v:
            A[j+g] = A[j]
            j = j - g
            cnt += 1
        A[j+g] = v
for g in G:
    insertionSort(A, n, g)
print(len(G))
print(*G)
print(cnt)
print(*A,sep='\n')


Measured memory_bytes: 53284
#include<cstdio>
#define CARDINAL_NUMBER 10

bool isIncludeDigitThree(int num) {
  for(int left_num = num; left_num > 0; left_num /= 10) {
    int first_digit = left_num % 10;

    if(first_digit == 3) {
      return true;
    }
  }

  return false;
}

int main() {
  int num;
  scanf("%d", &num);

  for(int i = 1; i <= num; i++) {
    if (i % 3 == 0 || isIncludeDigitThree(i)) {
      printf(" %d" , i);
    };
  }

  printf("\n");
}



Measured memory_bytes: 2748
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <bits/stdc++.h>


using namespace std;
template<class T1, class T2> inline void chkmin(T1 &x, const T2 &y) {if (x > y) x = y;}
template<class T1, class T2> inline void chkmax(T1 &x, const T2 &y) {if (x < y) x = y;}
#define all(c) (c).begin(), (c).end()
#define sz(c) (int)(c).size()
#define mp make_pair
#define pb push_back
#define read(FILENAME) freopen((string(FILENAME) + ".in").c_str(), "r", stdin)
#define write(FILENAME) freopen((string(FILENAME) + ".out").c_str(), "w", stdout);
const int MAXN = 2003;


int n;
bitset<2001> w[MAXN];
bitset<2001> dp[MAXN];


int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	//read("input");
	cin >> n;
	for (int i = 1; i < n; i++) {
		string s;
		cin >> s;
		for (int j = 0; j < i; j++) {
			if (s[j] == '0') {
				w[j][i] = 1;
			} else {
				w[i][j] = 1;
			}
		}
	}
	for (int i = 0; i < n; i++) {
		dp[i][i] = 1;
	}
	for (int len = 1; len < n; len++) {
		for (int i = 0; i <= n - len; i++) {
			int j = i + len;
			bitset<2001> tmp = dp[i + 1] & dp[j] & w[i];
       		dp[j][i] = (tmp._Find_next(i) <= j);
        	tmp = dp[i] & dp[j - 1] & w[j];
        	dp[i][j] = (tmp._Find_next(i - 1) < j);
		}
	}
	cout << (dp[0] & dp[n - 1]).count() << endl;
	return 0;
}


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

int main() {
	int N, T;
	cin >> N >> T;
	int on = 0, ans = 0, t1 = 0, t2 = 0;
	rep(i, N) {
		t2 = t1;
		cin >> t1;
		if (on == 0) {
			on = T;
			ans += T;
		}
		else {
			on = max(0, on - t1 + t2);
			ans = ans - on + T;
			on = T;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define df 0
typedef long int li;

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

int main(){
  if(df) printf("*debug mode*\n");
  int n,x; cin >>n >>x;
  int d=0;
  for(int i=0;i<n;i++){
    int t; cin >>t;
    t-=x;
    if(t<0)t*=-1;
    d=gcd(d,t);
  }
  cout << d;
}

/// confirm df==0 ///


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

y = 0
if l[0] > x:
    w = l[0] - x
    y += w
    l[0] -= w

for i in range(n-1):
    if l[i] + l[i+1] > x:
        z = l[i+1] + l[i] - x
        y += z
        l[i+1] -= z

print(y)

Measured memory_bytes: 14252
#include <iostream>
  #include <cstdio>
  #include <cstring>
  #include <cmath>
  #include <cstring>
  #include <chrono>
  #include <complex>
  #define endl "\n"
  #define ll long long int
  #define vi vector<int>
  #define vll vector<ll>
  #define vvi vector < vi >
  #define pii pair<int,int>
  #define pll pair<long long, long long>
  #define mod 1000000007
  #define inf 1000000000000000001;
  #define all(c) c.begin(),c.end()
  #define mp(x,y) make_pair(x,y)
  #define mem(a,val) memset(a,val,sizeof(a))
  #define eb emplace_back
  #define f first
  #define s second
  
  using namespace std;
  int main()
  {
    std::ios::sync_with_stdio(false);
    string s,t;
    cin>>s>>t;
    ll max=0,count;
    for(int i=0;i<=s.length()-t.length();i++)
    { 
      count=0;
      for(int j=0;j<t.length();j++)
      {
        if(s[i+j]==t[j])
        count++;
      }
      if(count>max)
        max=count;
    }
    ll a=s.length(),b=t.length();
    if(a>=b)
      max=b-max;
    cout<<max;
    return 0;
  }


Measured memory_bytes: 3148
/*------------------------- Bism Allah Alruhmin Alrahim -------------------------------*/
#include <bits/stdc++.h>
#define forn(i, n) for (int i = 0; i < n; i++)
#define ford(i, n) for (int i = n - 1; i > -1; i--)
#define forl(i, l, r) for (int i = l; i <= r; i++)
#define vc vector
#define f first
#define s second
#define pb(i) push_back(i)
#define mx(ar, n) (*max_element(ar, ar + n))
#define mn(ar, n) (*min_element(ar, ar + n))

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;


int main()
{
    int n , m , k ;
    vector<int> v; 
    cin >> n >> m >> k;
    for (int i = 1; i <= max(m,n); i++)
    {
        if(m%i == 0 and n%i == 0){
            v.push_back(i) ;
        }
    }
    reverse(v.begin() , v.end());
    cout << v[k-1] << endl ;
    
    return 0 ;
}

Measured memory_bytes: 256
N,P = (int(i) for i  in input().split())

k = P
a = 2
ans = 1
counter = 0
while(k >= a*a):
    if (k%a==0):
        k = k // a
        counter += 1
    else:
        a += 1
        counter = 0
    if counter >= N:
        ans *= a
        counter = 0
if (k%a==0):
    k = k // a
    counter += 1
else:
    a += 1
    counter = 0
if counter >= N:
    ans *= a
    counter = 0
if N == 1:
    ans = P
print(ans)

Measured memory_bytes: 3064
use std::cmp;
fn main() {
    let mut sc = Scanner::new();
    let n = sc.usize_read();
    let c = sc.usize_read();
    let d: Vec<Vec<i32>> = (0..c).map(|_| sc.read_vec(c)).collect();
    let cc: Vec<Vec<usize>> = (0..n).map(|_| sc.read_vec(n)).collect();

    let mut count = vec![vec![0; c + 1]; 3];
    for i in 0..n {
        for j in 0..n {
            count[(i + j) % 3][cc[i][j] - 1] += 1;
        }
    }

    let mut ans = std::i32::MAX;
    for c1 in 0..c {
        for c2 in 0..c {
            if c1 == c2 {
                continue;
            }
            for c3 in 0..c {
                if c1 == c3 || c2 == c3 {
                    continue;
                }
                let mut tmp = 0;
                let next = vec![c1, c2, c3];
                for i in 0..3 {
                    for prev in 0..c {
                        tmp += count[i][prev] * d[prev][next[i]];
                    }
                }

                ans = cmp::min(ans, tmp);
            }
        }
    }

    println!("{}", ans);
}

struct Scanner {
    ptr: usize,
    length: usize,
    buf: Vec<u8>,
    small_cache: Vec<u8>,
}

#[allow(dead_code)]
impl Scanner {
    fn new() -> Scanner {
        Scanner {
            ptr: 0,
            length: 0,
            buf: vec![0; 1024],
            small_cache: vec![0; 1024],
        }
    }

    fn load(&mut self) {
        use std::io::Read;
        let mut s = std::io::stdin();
        self.length = s.read(&mut self.buf).unwrap();
    }

    fn byte(&mut self) -> u8 {
        if self.ptr >= self.length {
            self.ptr = 0;
            self.load();
            if self.length == 0 {
                self.buf[0] = b'\n';
                self.length = 1;
            }
        }

        self.ptr += 1;
        return self.buf[self.ptr - 1];
    }

    fn is_space(b: u8) -> bool {
        b == b'\n' || b == b'\r' || b == b'\t' || b == b' '
    }

    fn read_vec<T>(&mut self, n: usize) -> Vec<T>
    where
        T: std::str::FromStr,
        T::Err: std::fmt::Debug,
    {
        (0..n).map(|_| self.read()).collect()
    }

    fn usize_read(&mut self) -> usize {
        self.read()
    }

    fn read<T>(&mut self) -> T
    where
        T: std::str::FromStr,
        T::Err: std::fmt::Debug,
    {
        let mut b = self.byte();
        while Scanner::is_space(b) {
            b = self.byte();
        }

        for pos in 0..self.small_cache.len() {
            self.small_cache[pos] = b;
            b = self.byte();
            if Scanner::is_space(b) {
                return String::from_utf8_lossy(&self.small_cache[0..(pos + 1)])
                    .parse()
                    .unwrap();
            }
        }

        let mut v = self.small_cache.clone();
        while !Scanner::is_space(b) {
            v.push(b);
            b = self.byte();
        }
        return String::from_utf8_lossy(&v).parse().unwrap();
    }
}


Measured memory_bytes: 6396
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define inf 10e17
#define rep(i,n) for(long long i=0; i<n; i++)
#define repr(i,n,m) for(long long i=m; i<n; i++)
#define mod 1000000007
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<long long>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto&& itr : x) { cerr << (itr) << " "; }

template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}

template <class T>
T to_rad(T d) {
  return d * M_PI / 180.0;
}

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

  cout << setprecision(15) << fixed;
  int A,B,H,M;
  cin >> A >> B >> H >> M;

  double d = abs(6.0 * M - (30 * H + 0.5 * M));
  double rad = to_rad(d);
  double ans = sqrt(A * A + B * B - 2 * A * B * cos(rad));
  cout << ans << endl;
}

Measured memory_bytes: 4256
#include<iostream>
#include<string>
#include<vector>
#include<map>
using namespace std;
int abs(int a, int b);
int main(){
  int n;
  while(cin >>n,n){
    string s;
    cin >>s;
    vector<pair<int,int> > log;
    for(int i=0,a,b; i<n; i++){
      cin >>a>>b;
      log.push_back(make_pair(a-1,b-1));
    }
    for(int i=log.size()-1; i>=0; i--){
      int a = log[i].first,b = log[i].second;
      char c = s[a];
      s[a] = s[b];
      s[b] = c;
      int k = abs(a,b);
      for(int j=0; j<k; j++){
	if(s[a] == 'z') s[a] = 'a';
	else s[a]++;
	if(s[b] == 'z') s[b] = 'a';
	else s[b]++;
      }
    }
    cout <<s<<endl;
  }
  return 0;
}
int abs(int a, int b){
  if(a<b) return b-a;
  else return a-b;
}

Measured memory_bytes: 1208
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < 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 INF (2e9)
#define EPS (1e-7)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

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

    REP(i, k) {
        if(i % 2 == 0) {
            a /= 2;
            b += a;
        } else {
            b /= 2;
            a += b;
        }
    }

    cout << a << " " << b << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;

int main(){
  int n;
  cin>>n;
  map<ll,int> m;
  vector<ll> v;
  rep(i,0,n){
    ll a;
    cin>>a;
    if(m[a]==0) m[a]++;
    else{
      v.push_back(a);
      m[a]=0;
    }
  }
  sort(v.rbegin(),v.rend());
  if(v.size()<2){
    cout<<0<<endl;
  }
  else{
    cout<<v[0]*v[1]<<endl;
  }
}

Measured memory_bytes: 6528
#include<stdio.h>
char s[500050],c;
int main(){
  int t=200010,r,i,n,q,f=1;
  scanf("%s %d",s+t,&n);
  for(r=t;s[r];r++);
  while(n--){
    scanf("%d",&q);
    if(q==1)f=1-f;
    else{
      scanf("%d %c",&q,&c);
      if(q%2==f)s[--t]=c;
      else      s[r++]=c;
    }
  }
  if(f){
    for(i=t;i<r;i++)printf("%c",s[i]);
  }
  else{
    for(i=r;i>t;i--)printf("%c",s[i-1]);
  }
  printf("\n");
  return 0;
}

Measured memory_bytes: 768
import math #計算用

#スペース区切りの文字をint型でインプット
li = list(map(int,input().split())) #[a,b,h,m]

a=li[0] #時針の長さ
b=li[1] #分針の長さ
h=li[2] #〇時
m=li[3] #〇分

#12時の方角を軸に角度θを求める

#時針の角度θ
h_Theta=float(h*60+m)/720 * 2*math.pi
#分針の角度θ
m_Theta=float(m)/60 * 2*math.pi

#時針のx座標
hx=a*math.cos(h_Theta)
#時針のy座標
hy=a*math.sin(h_Theta)
#分針のx座標
mx=b*math.cos(m_Theta)
#分針のy座標
my=b*math.sin(m_Theta)

#x座標の差
dx=hx-mx
#y座標の差
dy=hy-my

#求める長さ
ans=math.sqrt(dx**2+dy**2)
print(ans)

Measured memory_bytes: 62612
n = gets.chomp.to_i
lp, rp = 0, 0

n.times do |i|
  l, r = gets.chomp.split("\s")
  case l <=> r
  when -1 then
    rp += 3
  when 1 then
    lp += 3
  else
    lp += 1
    rp += 1
  end
end

puts "#{lp} #{rp}"

Measured memory_bytes: 8636
v,n,s=1e3;main(c){for(;read(0,&c,1);s=v)n=c-10?v=(c*4+17)%92%8*pow(10,10509>>c%38%8*2&3),n+v-s*2*(s<v):!printf("%d\n",n,v=1e3);}

Measured memory_bytes: 0
from sys import stdin
import math


def main():
    _in = [_.rstrip() for _ in stdin.readlines()]
    A, B, C, D = list(map(int,_in[0].split(' ')))  # type:list(int)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    HP_takahashi = A
    HP_aoki = C
    while HP_takahashi-D > 0 or HP_aoki-B > 0:
        HP_aoki -= B
        HP_takahashi -= D
    else:
        if HP_takahashi <= 0 and HP_aoki <= 0:
            TF = 'Yes'
        elif HP_takahashi <= 0:
            TF = 'No'
        else:
            TF = 'Yes'
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(TF)


def ans():
    _in = [_.rstrip() for _ in stdin.readlines()]
    A, B, C, D = list(map(int,_in[0].split(' ')))  # type:list(int)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    TF = 'Yes' if math.ceil(A/D)>=math.ceil(C/B) else 'No'
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(TF)


if __name__ == "__main__":
    #main()
    ans()


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

class Main {

	static final int M = 1000000007;

	private static int[] counts;

	private static void factorize(int n) {
		for (int i = 2; i * i <= n; i++) {
			if (n % i != 0) continue;
			int count = 0;
			while (n % i == 0) {
				count++;
				n /= i;
			}
			counts[i] += count;
		}
		if (n != 1) {
			counts[n]++;
		}
	}


	public static void main(String[] args) throws Exception {
		final Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		counts = new int[N + 1];

		for (int i = 2; i <= N; i++) {
			factorize(i);
		}

		long a = 1;
		for (int i = 0; i < counts.length; i++) {
			if (counts[i] == 0) continue;
			a = (a * (counts[i] + 1)) % M;
		}

		System.out.println(a);
	}
}


Measured memory_bytes: 23764
from math import gcd
k = int(input())
li = []
li2 = [6623853, 6741078, 6864016, 6953457, 7094451, 7215016, 7359936, 7475145, 7593865, 7689630, 7886244, 7984165, 8130747, 8253888, 8403448, 8523897, 8684853, 8802826, 8949612, 9105537, 9267595, 9376656, 9574704, 9686065, 9827097, 9997134, 10174780, 10290813, 10493367, 10611772, 10813692]
cnt = 0
if k < 170:
    for i in range(1, k + 1):
    	for j in range(1, k + 1):
            for l in range(1, k + 1):
        	    li.append(gcd(gcd(i, j), gcd(j, l)))
    print(sum(li))
else:
    print(li2[k - 170])

Measured memory_bytes: 41384
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

//INSERT ABOVE HERE
signed main(){
  Int n,m;
  cin>>n>>m;
  vector<Int> a(n);
  for(Int i=0;i<n;i++) cin>>a[i];
  vector<Int> v(n+1);
  for(Int i=1;i<=n;i++) v[i]=i;

  Int sum=n;
  vector<Int> cnt(n+1,0);
  auto ex=[&](Int k){
            if(v[k]>0) sum-=cnt[v[k]]++==0;
            v[k]--;
          };
  auto sh=[&](Int k){
            v[k]++;
            if(v[k]>0) sum+=--cnt[v[k]]==0;
          };
  
  for(Int i=0;i<n;i++) ex(a[i]);

  for(Int i=0;i<m;i++){
    Int x,y;
    cin>>x>>y;
    x--;
    sh(a[x]);
    a[x]=y;
    ex(a[x]);
    cout<<sum<<endl;
  }
  return 0;
}


Measured memory_bytes: 8064
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

n = int(input())
a = list( map(int, input().split()))

xorall = 0

for aa in a:
    xorall ^= aa

ans = []

for aa in a:
    ans.append(xorall^aa)

print(*ans,sep=' ')


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

int main(void){
  char s[256]="";
  s[255] = '1';
  int i=0;
  int w=0;
  int x=0;
  scanf("%s", s);
  while(s[i] != '1'){

    if(s[i] == 'C')
      if(x<1)
	x++;
    if(s[i] =='F' && x > 0){
	w++;
	break;
      }

    i++;
  }
  if(w > 0)
    printf("Yes\n");
  else
    printf("No\n");

  return EXIT_SUCCESS;
}

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

using namespace std;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}


typedef long long ll;

#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1000000007;
//const ll MOD = 998244353;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { -1,0, 1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
// #define mp make_pair
//#define endl '\n'

int main() {
  int a, b;
  cin >> a >> b;
  int now = 1;
  int ans = 0;
  while (now < b) {
    now += a - 1;
    ans++;
  }
  cout << ans << endl;
  
}


Measured memory_bytes: 256
import math
import sys
from collections import Counter
def getinputdata():

    # 配列初期化
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:


        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result





arr_data = getinputdata()

n = int(arr_data[0][0])
k = int(arr_data[0][1])

arr=arr_data[1]


list01=Counter(arr)

#print(list01,len(list01))

#print(list01)

cnt=0
if len(list01) > k:
    
    for key,val in sorted(list01.items(),key=lambda x: x[1]):

#        print(key,val,len(list01))

        cnt+=list01.pop(key)
        
        
        if len(list01)==k:
            
            break
        

print(cnt)


Measured memory_bytes: 44060
a, b = map(int, input().split())
l =  [[] for _ in range(a+2)]
l[0] = '#'*(b+2)
l[a+1] = '#'*(b+2)

for i in range(1, a+1):
    l[i] = '#' + input() + '#'

for i in range(a+2):
    print(l[i])

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using vll = vector<ll>;
using vll2 = vector<vector<ll>>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll LINF = (1LL << 60) - 1LL;
constexpr ll MOD = 1e9 + 7;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> a(n), p(n), q(n);
    for (int i = 0; i < n; i++) {
        cin >> p[i];
    }
    for (int i = 0; i < n; i++) {
        cin >> q[i];
    }
    iota(all(a), 1);
    int aa, b, c = 0;
    do {
        c++;
        bool f = true;
        for (int i = 0; i < n; i++) {
            if (a[i] != p[i]) {
                f = false;
            }
        }
        if (f) {
            aa = c;
        }
        f = true;
        for (int i = 0; i < n; i++) {
            if (a[i] != q[i]) {
                f = false;
            }
        }
        if (f) {
            b = c;
        }
    } while (next_permutation(all(a)));
    cout << abs(b - aa) << endl;
}


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

using namespace std;

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

void solve()
{
	long long n, m;
	string s, t;
	cin >> n >> m;
	cin >> s;
	cin >> t;
	long long c = gcd(n, m), lcm = n * m / c, size = 0;
	for(int i = 0; i < c; i++)
	{
		if (s[i * n / c] != t[i * m / c])
		{
			cout << -1 << "\n";
			return;
		}
	}
	cout << lcm << "\n";
}

int main()
{
	solve();
}


Measured memory_bytes: 512
N = int(input())
S1 = input()
_ = input()
nums = [0]*N
ans = 3
c = 1
mod = 1000000007
for i in range(N-1):
    if S1[i] == S1[i + 1]:
        nums[i], nums[i + 1] = c,c
        c += 1

for i in range(N-1):
    if i > 0 and nums[i] == nums[i + 1] and nums[i] != 0 and nums[i - 1] != 0:
        ans *= 3 
    elif nums[i] == nums[i + 1] and nums[i] != 0:
        ans *= 2
    elif nums[i] == nums[i + 1] == 0:
        ans *= 2
    ans %= mod
print(ans)

Measured memory_bytes: 3064
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner s=new Scanner(System.in);
        int a=s.nextInt();
        int b=s.nextInt();
        int m=s.nextInt();
        int aa[]=new int[a];
        int bb[]=new int[b];
        for(int j=0;j<a;j++){
            aa[j]=s.nextInt();
        }
        for(int j=0;j<b;j++){
            bb[j]=s.nextInt();
        }
        int min=Integer.MAX_VALUE;
        for(int j=0;j<m;j++){
            int x=s.nextInt();
            int y=s.nextInt();
            int c=s.nextInt();
            if(min>aa[x-1]+bb[y-1]-c){
                min=aa[x-1]+bb[y-1]-c;
            }
        }
        Arrays.sort(aa);
        Arrays.sort(bb);
        if(min>aa[0]+bb[0]){
            min=aa[0]+bb[0];
        }
        System.out.println(min);
    }
}


Measured memory_bytes: 151024
#include <bits/stdc++.h>
#define INF INT_MAX
#define ll  long long
#define ull unsigned long long
#define rep(i,n) for(ll i=0; i<n; ++i)
#define FOR(i, s, e) for(ll i=s; i<e; ++i)
#define MOD 1000000007
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if(a>b) {a=b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) { if(a<b) {a=b; return true;} return false;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int K, N; cin >> K >> N;
  vector<int> A(N*2);
  rep(i,N) cin >> A[i];
  rep(i,N) A[N+i] = K + A[i];
  sort(A.begin(), A.end());

  int ans = INF;
  rep(i, N)
    chmin(ans, A[i+N-1]-A[i]);

  cout << ans << endl;
}

Measured memory_bytes: 4772
N = int(raw_input())
h = map(int, raw_input().split())

count = 0

while any(h):
    max_h = max(h)
    i = 0

    while i < len(h):
        if h[i] == max_h:
            j = i
            while j < len(h):
                if max_h == h[j]:
                    h[j] = h[j] - 1
                    j += 1
                else:
                    count += 1
                    break
            if j == len(h):
                count += 1
            i = j
        else:
            i += 1
print(count)


Measured memory_bytes: 2568
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
    int A, B, Q;
    cin >> A >> B >> Q;
    vector<long long> s(A + 2);
    vector<long long> t(B + 2);
    long long INF = 1e18;
    s[0] = -INF;
    t[0] = -INF;
    for(int i = 0; i < A; i++) cin >> s[1 + i];
    s[A + 1] = INF;
    for(int i = 0; i < B; i++) cin >> t[1 + i];
    t[B + 1] = INF;
    for(int i = 0; i <Q; i++){
        long long x;
        cin >> x;
        int ind1 = lower_bound(s.begin(), s.end(), x) - s.begin();
        int ind2 = lower_bound(t.begin(), t.end(), x) - t.begin();
        long long ans = 1e18;
        for(int j = 0; j < 2; j++){
            long long y = s[ind1 - j];
            for(int k = 0; k < 2; k++){
                long long z = t[ind2 - k];
                long long d1 = abs(y - x) + abs(z - y), d2 = abs(z - x) + abs(y - z);
                ans = min(ans, min(d1, d2));
            }
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 4780
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long a,b,c;
  cin >> a >> b >> c;
  if(a%2==0||b%2==0||c%2==0){
    cout << 0;
  }
  else if(c>=a&&c>=b){
    cout << a*b;
  }
  else if(a>=b&&a>=c){
    cout << b*c;
  }
  else{
    cout << a*c;
  }
}


Measured memory_bytes: 256
S = input().strip()
if S[0]=="A" and S[2:-1].count("C")==1:
    for i in range(2,len(S)-1):
        if S[i]=="C":
            ind = i
            break
    res = 0
    for i in range(1,len(S)):
        if i!=ind and not(97<=ord(S[i])<=122):
            res = 1
            break
    if res==0:
        print("AC")
    else:
        print("WA")
else:
    print("WA")

Measured memory_bytes: 3064
#include <iostream>
#include <numeric>
#include <algorithm>
#include <vector>
#include <array>
#include <string>
#include <queue>
#include <cmath>
#include <iterator>
#include <math.h>
#include <cstdio>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <tuple>

using namespace std;
using lli = long long int;
using ulli = unsigned long long int;

namespace atcoder{
    void judge_outer(bool judge_exp,string ok = "Yes",string ng = "No"){
        if(judge_exp){
            cout << ok << endl;
        }else{
            cout << ng << endl;
        }
    }
    
    int ncr(int left,int right){
        right = min(left - right,right);
        int ans =1;
        for(int i=1;i<=right;i++){
            ans = ans * (left-right+i)/i;
        }
        return ans;
    }
    
    [[maybe_unused]] const int LIMIT = 1000000256;
    [[maybe_unused]] const int tenfive = 100000;
    
    
}

using namespace atcoder;

int main(void) {
	string mst;
	int k;
	cin >> mst;
	cin >> k;
	set<string> strs;
	string stk;
	//i番目,j文字
	for (int i = 0; i<mst.size(); i++) {
		for (int j = 1; j < 6; j++) {
		    //substrのout of range防止
		    if(j <= mst.size()-i)
			    strs.insert(mst.substr(i, j));
		}
	}
	for(string s:strs)cerr << s << endl;
	auto it = strs.begin();
	for(int i=1;i<k;i++)++it;
	
	cout << *it << endl;
	return 0;
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
#define long long long
using namespace std;
const long inf=2e18;
long a,b,c,k,ta,tb,tc;
int main()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  cin>>a>>b>>c>>k;

  if(k%2==0)cout<<a-b<<endl;
  else cout<<b-a<<endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	int n, ans = 0, mn = inf; cin >> n;
	rep(i, n){
		int a; cin >> a;
		if(a < mn){
			ans++;
			mn = a;
		}
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
while(1){
	char s[1000000+2];
	int n,m,ans=0,c=0;
	scanf("%d",&n);
if(n==0)break;
	scanf("%d",&m);
	scanf("%s",&s);
	for(int i=0;i<m;i++){
		if((c%2==0&&s[i]=='I')||(c%2==1&&s[i]=='O'))c++;
		else{
			if(c>=2*n+1)ans+=1-n+((c-1)-(c-1)%2)/2;
			c=0;
			if(s[i]=='I')c=1;
		}
	}
	printf("%d\n",ans);
}
}

Measured memory_bytes: 2152
import numpy as np

points, dimention = map(int, input().split())
count = 0

coordinate = []
for i in range(points):
  coordinate.append(input())

for s in range(points-1):
  point1 = np.array([int(i) for i in coordinate[s].split()])
  for t in range(s+1, points):
    point2 = np.array([int(i) for i in coordinate[t].split()])
    distance = np.sqrt(np.sum((point1 - point2) * (point1 - point2)))
    if distance.is_integer():
      count += 1
print(count)
    
    

Measured memory_bytes: 12448
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int N, K;
	cin >> N >> K;
	VI A(N), sum(N + 2, 0);
	
	REP(i, N) {
		cin >> A[i];
		A[i]--;
		A[i] %= K;
		sum[i + 1] += sum[i] + A[i];
		sum[i + 1] %= K;
		//cout << sum[i + 1] << " ";
	}
	//REP(i, sum.size())cout << sum[i] << " ";
	//cout << endl;
	int ans = 0;
	int a = 0, b = 0;
	map<int, int>mp;
	
	REP(i, N + 1) {
		ans += mp[sum[i]];
		mp[sum[i]]++;
		b++;
		if (b-a>=K) {
			mp[sum[a]]--;
			a++;
		}
	}

	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 15872
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <set>
using namespace std;

int main(){
    int a1,a2,a3;
    cin >> a1 >> a2 >> a3;

    vector<int> c = {abs(a1-a2),abs(a2-a3),abs(a3-a1)};
    sort(c.begin(),c.end());
    int ans = c[0] + c[1];
    cout << ans << endl;
}

Measured memory_bytes: 256
/**
 *    author:  otera    
**/
#include<iostream>
#include<string> 
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm> 
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

void solve() {
	int n; cin >> n;
    int n_ = n;
    map<int, int> mp;
    for(int i = 2; i * i <= n_; ++ i) {
        if(n_ % i == 0) {
            while(n_ % i == 0) {
                mp[i] ++;
                n_ /= i;
            }
        }
    }
    if(n_ != 1) mp[n_] ++;
    int ans = 0;
    for(auto p: mp) {
        int co = p.sc;
        //cerr << p.fr << " " << p.sc << endl;
        int num = 1;
        int res = 0;
        while(co - num >= 0) {
            co -= num;
            chmax(res, num);
            ++ num;
        }
        ans += res;
    }
    cout << ans << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

Measured memory_bytes: 3588
n = gets.to_i
input = gets.chomp.split(" ").map(&:to_i)
input.sort!.reverse!
result = []
foo = 0
for i in 0..n-1
	if input[i] == input[i+1]
		result.push(input[i])
		input.delete_at(i)
		foo += 1
		if foo == 2
			break
		end
		next
	end
end
if result.size >= 2
	puts result[0]*result[1]
else
	puts 0
end


Measured memory_bytes: 10248
#include <string>
#include <iostream>
#include <algorithm>
#include <vector>
#include <functional>

using namespace std;
int h, w;
void solve(vector<string> &f) {
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (f[i][j] == '#') {
				for (int k = i - 1; k <= i + 1; k++) {
					for (int l = j - 1; l <= j + 1; l++) {
						if (k == i && l == j || k >= h || l >= w || k < 0 || l < 0) {
							continue;
						}
						if (f[k][l] == '#') {
							continue;
						}
						if (f[k][l] == '.') {
							f[k][l] = '0';
						}
						int t = f[k][l] - '0';
						++t;
						f[k][l] = t + '0';
					}
				}
			}
		}
	}
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (f[i][j] == '.') {
				f[i][j] = '0';
			}
		}
	}
	return;
}
int main() {
	
	cin >> h >> w;
	vector<string> field(h);
	for (int i = 0; i < h; i++) {
		cin >> field[i];
	}
	solve(field);
	for (int i = 0; i < h; i++) {
		cout << field[i] << 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++)
using P = pair<int, int>;
const int MX = 200005;
int n, k, p[MX], l, r, ans, s = -1;
P qu[MX];
bool a[MX];
void push(int t, bool k){
	while(l < r && (k ^ (qu[r-1].first > p[t]))) r--;
	qu[r++] = P(p[t],t);
}
int main(){
	scanf("%d%d", &n, &k);
	rep(i,n){
		scanf("%d", p+i);
		push(i,0);
		if(qu[l].second < i-k+1) l++;
		if(qu[l].second == i-k+1) a[i-k+1] = true;
		if(r-l == k){
			if(s != -1 && s+k <= i) ans--;
			s = i;
		}
	}
	l=r=0;
	for(int i = n-1; i > 0; i--){
		push(i,1);
		if(i+k-1 < qu[l].second) l++;
		if(i+k-1 == qu[l].second && a[i-1]) ans--;
	}
	printf("%d\n", ans+n-k+1);
}

Measured memory_bytes: 2816
H,W,K = map(int, input().split())
table = [input() for _ in range(H)]

cnt = 0
for h in range(2**H):
    h_bits = [j for j in range(H) if (h >> j &1)]
    for w in range(2**W):
        w_bits = [j for j in range(W) if (w >> j &1)]
        blacks = 0
        for hi in h_bits:
            for wi in w_bits:
                blacks += 1 if table[hi][wi] == "#" else 0
        cnt += 1 if blacks == K else 0

print(cnt)

Measured memory_bytes: 9156
#include<bits/stdc++.h>
using namespace std;
 
using ll = long long;
using pll = pair<ll, ll>;
#define all(x) (x).begin(), (x).end()
#define call(x) (x).cbegin(), (x).cend()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define sz(x) ((x).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
const double PI = acos(-1);
const int mod = 1e9+7;
const long long INF = (1LL << 60);
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}
ll stringcount(string s, char c){return count(s.cbegin(), s.cend(), c);}
bool isInteger(double x){return floor(x) == x;}
ll ceil(ll a, ll b){return ((a)+(b)-1)/b;}
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; }

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

  ll n, k;
  cin >> n >> k;
  vector<ll> a(n);
  rep(i, 0, n){
    cin >> a[i];
    a[i]--;
  }

  ll index = 0;
  vector<ll> root;
  map<ll, ll> mp;
  vector<ll> point(n);
  ll cnt = 0;
  while(1){
    if(mp[index] > 0){
      break;
    }else if(cnt == k){
      cout << index+1 << endl;
      return 0;
    }

    root.pb(index);
    mp[index]++;
    point[index] = cnt;
    index = a[index];
    cnt++;
  }

  vector<ll> pre_point;
  for(ll i = point[index]; i < cnt; i++){
    pre_point.pb(root[i]);
  }
  ll ans_point = (k-cnt) % sz(pre_point);
  cout << pre_point[ans_point]+1 << endl;
  return 0;
}

Measured memory_bytes: 20564