akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
	int n,m,k;
	scanf("%d%d%d",&n,&m,&k);
	for (int i=n;i<=min(n+k-1,m);i++) printf("%d\n",i);
	for (int i=max(m-k+1,n+k);i<=m;i++) printf("%d\n",i);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
const int w=10000;
const int maxn=1e6+5;
char a[w]; char b[w]; char c[w];
bool ab[maxn]; bool ac[maxn]; bool bc[maxn];
bool match(char x,char y)
{
	return (x=='?')||(y=='?')||(x==y);
}
int main(void)
{
	scanf("%s%s%s",a,b,c);
	int la=strlen(a); int lb=strlen(b); int lc=strlen(c);
	for(int i=0;i<la;i++) for(int j=0;j<lb;j++) if(match(a[i],b[j])==false) ab[i-j+w]=true;
	for(int i=0;i<la;i++) for(int j=0;j<lc;j++) if(match(a[i],c[j])==false) ac[i-j+w]=true;
	for(int i=0;i<lb;i++) for(int j=0;j<lc;j++) if(match(b[i],c[j])==false) bc[i-j+w]=true;
	int res=4*w;
	for(int i=-4000;i<=4000;i++)
	{
		for(int j=-4000;j<=4000;j++)
		{
			if(ab[i+w]==false&&ac[j+w]==false&&bc[j-i+w]==false)
			{
				int L=min(0,min(i,j));
				int R=max(la,max(i+lb,j+lc));
//				if(R-L<10) printf("L==%d,R==%d,i==%d,j==%d,R-L==%d\n",L,R,i,j,R-L);
				res=min(res,R-L);
			}
		}
	}
	printf("%d\n",res);
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.lang.Math;

class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		int n = scan.nextInt();
		for(int i = 0; i < n; i++) {
			double x1,y1,x2,y2,x3,y3;
			
			x1 = scan.nextDouble();
			y1 = scan.nextDouble();
			x2 = scan.nextDouble();
			y2 = scan.nextDouble();
			x3 = scan.nextDouble();
			y3 = scan.nextDouble();
			
			double a1, a2, b1, b2, c1, c2, px, py;

			a1 = 2 * (x2 - x1);
			b1 = 2 * (y2 - y1);
			c1 = x1*x1 - x2*x2 + y1*y1 - y2*y2;
			
			a2 = 2 * (x3 - x1);
			b2 = 2 * (y3 - y1);
			c2 = x1*x1 - x3*x3 + y1*y1 - y3*y3;
			
			double temp = a1*b2 - a2*b1;
			
			px = (b1*c2 - b2*c1) / temp;
			py = (c1*a2 - c2*a1) / temp;
			
			double r = Math.sqrt((x1-px)*(x1-px) + (y1-py)*(y1-py));
			
			System.out.printf("%.3f %.3f %.3f\n", px, py, r);
		}
	}
}

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

int main() {
  int s, s1, s2, s3, a;
  cin >> s;
  s1 = s / 100;
  a = s / 10;
  s2 = a - s1 * 10;
  s3 = s - a * 10;
  cout << s1 + s2 + s3 << endl;
}

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

using namespace std;
int main(){
	long long n,ans=0;
	scanf("%lld", &n);
	long long a[n+5],b[n+5],c[n+5],check[n+5][4];
	for(long long i=1;i<=n;i++)
	scanf("%lld %lld %lld", &a[i], &b[i], &c[i]);
	memset(check,0,sizeof(check));
	for(long long i=1;i<=n;i++){
		check[i][1]=max(check[i-1][2],check[i-1][3])+a[i];
		check[i][2]=max(check[i-1][1],check[i-1][3])+b[i];
		check[i][3]=max(check[i-1][1],check[i-1][2])+c[i];
	}
	ans=max(check[n][1], check[n][2]);
	ans=max(ans,check[n][3]);
	printf("%lld", ans);
} 

Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1}; // 移動方向

//入力
ll n,m;
ll p[100010], y[100010];
vector<ll> c[100010]; 

int main()
{
  scanf("%lld %lld",&n,&m);
  for(int i=0;i<m;i++){
    scanf("%lld %lld",&p[i],&y[i]);
    c[p[i]].push_back(y[i]);
  }
  for(int i=0;i<n;i++){
    sort(c[i+1].begin(),c[i+1].end());
  }
  for(int i=0;i<m;i++){
    printf("%012lld\n", p[i]*1000000+lower_bound(c[p[i]].begin(),c[p[i]].end(),y[i])-c[p[i]].begin()+1);
  }
  return 0;
}


Measured memory_bytes: 8576
#include<stdio.h>
int main()
{
  int n,x,y,i,m;
  x=-10000000,y=10000000;
  long int z=0;
    scanf("%d",&n);
  for(i=0;i<n;i++){
     scanf("%d",&m);
     if(x<m)x=m;
     if(y>m)y=m;
     z=z+m;
     }
 
  printf("%d %d %ld\n",y,x,z);
  return 0;
}
    

Measured memory_bytes: 600
#include <bits/stdc++.h>
typedef long long lint;
using namespace std;

// ABC-084-D

// 累積和
struct cumulative_sum {
    using lint = long long int;
    int sz;
    // data[i]:元の数列
    vector<lint> data;
    // cum[i]:[0,i)の和
    vector<lint> sum;
    // 要素数を指定して初期化
    cumulative_sum(const int _sz) : sz(_sz) {
        data.assign(sz, 0);
        sum.assign(sz + 1, 0);
    }
    lint& operator[](const int k) {
        return data[k];
    }
    // dataに基づいてsumを構築
    void build() {
        for (int i = 0; i < sz; i++) sum[i + 1] = sum[i] + data[i];
    }
    // [a,b)の和を求める
    lint query(const int a, const int b) {
        return sum[b] - sum[a];
    }
};

int q;
vector<int> l, r;

//エラトステネスの篩
vector<bool> eratosthenes_sieve(int n) {
    vector<bool> res(n + 1, true);
    res[0] = res[1] = false;
    for (int i = 2; i * i <= n; i++) {
        if (res[i]) {
            for (int j = i; i * j <= n; j++) res[i * j] = false;
        }
    }
    return res;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    vector<bool> p = eratosthenes_sieve(1e+5);
    cumulative_sum cum(1e+5 + 1);
    for (int i = 0; i <= 1e+5; i++) {
        if (i % 2 == 1 && p[i] && p[(i + 1) / 2]) {
            cum[i] = 1;
        } else {
            cum[i] = 0;
        }
    }
    cum.build();
    cin >> q;
    for (int i = 0; i < q; i++) {
        int l, r;
        cin >> l >> r;
        r++;
        cout << cum.query(l, r) << endl;
    }
}

Measured memory_bytes: 2176
import collections

N = int(input())
a = list(map(int, input().split()))
a.sort()
c = collections.Counter(a)

cnt = []
tmp = a[0]
cnt1 = 1
for i in range(1, N):
    if(abs(tmp-a[i]) <= 2):
        cnt1 += 1
    else:
        cnt.append(cnt1)
        if(a[i]-a[i-1] <= 1):
            cnt1 = c.get(a[i-1]-1, 0)+c.get(a[i-1], 0)+1
            tmp = a[i-1]-1
        else:
            cnt1 = 1
            tmp = a[i]
if(len(cnt) > 0):
    print(max(cnt1, max(cnt)))
else:
    print(cnt1)

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

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

	int N; cin >> N;
	int d[110000];
	for (int i = 0; i < N; i++) {
		cin >> d[i];
	}
	sort(d, d + N);
	int z = d[N / 2] - d[N / 2 - 1];
	cout << z;
}

Measured memory_bytes: 640
S = input()
if len(S) %2 == 0 :
    S = S[:-2]
else :
    S =S[:-1]
while(1) :
    l = int(len(S)/2)

    if S[:l] == S[l:] :
        print(len(S))
        exit()
    S = S[:-2]

Measured memory_bytes: 9032
#include <bits/stdc++.h>
using namespace std;
#define inf 1000000000

int main(){
	int H, N;
	cin >> H >> N;
	int A[N], B[N];
	for(int i=0;i<N;i++){
		cin >> A[i] >> B[i];
	}
	int dp[N+1][H+1];
	for(int i=0;i<=N;i++){
		dp[i][0] = 0;
	}
	for(int j=1;j<=H;j++){
		dp[0][j] = inf;
	}
	for(int i=1;i<=N;i++){
		for(int j=1;j<=H;j++){
			dp[i][j] = min(min(dp[i-1][j], 
				dp[i-1][max(0, j - A[i-1])] + B[i-1]),
				dp[i][max(0, j - A[i-1])] + B[i-1]);
		}
	}
	cout << dp[N][H] << endl;
}


Measured memory_bytes: 42716
#include<cstdio>
#include<string>
#include<cstring>
#include<utility>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<algorithm>
#include<vector>
#include<iostream>
#define ll long long
#define pii pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define inf 0x7fffffff
using namespace std;
ll a[1010],b[1010],c[1010];
vector<ll> v;
int main()
{
	int i,j,k,n,m,x,y,z,w;
	scanf("%d%d%d%d",&x,&y,&z,&w);
	for(i=0;i<x;i++)
	{
		scanf("%lld",&a[i]);
	}
	for(i=0;i<y;i++)
	{
		scanf("%lld",&b[i]);
	}
	for(i=0;i<z;i++)
	{
		scanf("%lld",&c[i]);
	}
	sort(a,a+x);
	reverse(a,a+x);
	sort(b,b+y);
	reverse(b,b+y);
	sort(c,c+z);
	reverse(c,c+z);
	for(i=0;i<x;i++)
	{
		for(j=0;j<y;j++)
		{
			for(k=0;k<z;k++)
			{
				if((i+1)*(j+1)*(k+1)<=w)
				{
					v.push_back(a[i]+b[j]+c[k]);
				}
				else
				{
					break;
				}
			}
		}
	}
	sort(v.begin(),v.end());
	reverse(v.begin(),v.end());
	for(i=0;i<w;i++)
	{
		printf("%lld\n",v[i]);
	}
	return 0;
}

Measured memory_bytes: 1400
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
#define vector2(a,b,c) vector<vector<int>> a(b/*縦！w*/,vector<int>(c/*横！w*/))
#define INF 1e10
#define MOD 1e9+7
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; }
using Graph = vector<vector<int>>;
signed main(){
  int a,b,c;
  cin>>a>>b>>c;
  vector<int> d(3);
  d[0]=a;
  d[1]=b;
  d[2]=c;
  sort(all(d));
  cout<<d[0]+d[1]<<endl;
}

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

typedef int64_t Int;
#define all(x) (x).begin(), (x).end()
 
const double EPS = 1e-10;
const Int INF = 1e18;
const int inf = 1e9;
const Int mod = 1e9+7;

bool print_space_enable = false;
void print() { 
    cout << '\n'; 
    print_space_enable = false;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
    if (print_space_enable) std::cout << " ";
    cout << fixed << setprecision(15) << head;
    print_space_enable = true;
    print(std::forward<Tail>(tail)...);
}

template<typename T>
void print(vector<T> v) {
    for (size_t i = 0; i < v.size(); i++) {
        if (i > 0) std::cout << " ";
        std::cout << v[i];
    }
    std::cout << '\n';
}

vector<pair<char, int64_t>> run_length(string s) {
    vector<pair<char, int64_t>> ret;
    if (s.empty()) return ret;
    int64_t cnt = 0;
    char c = s[0];
    for (size_t i = 0; i < s.size(); i++) {
        if (s[i] == c) {
            cnt++;
        } else {
            ret.emplace_back(c, cnt);
            c = s[i];
            cnt = 1;
        }
        if (i + 1 == s.size()) {
            ret.emplace_back(c, cnt);
        }
    }
    return ret;
}

void solve() {
    Int n;
    cin >> n;
    vector<Int> a(n);
    for (Int i = 0; i < n; i++) {
        cin >> a[i];
    }
    if (n == 1) {
        print(1);
        return;
    }
    vector<Int> b;
    b.push_back(a[0]);
    for (Int i = 1; i < n; i++) {
        if (b.back() != a[i]) {
            b.push_back(a[i]);
        }
    }
    Int m = b.size();
    Int res = 0;
    Int mode = 0;
    for (Int i = 1; i < m; i++) {
        if (mode == 0) {
            if (b[i - 1] <= b[i]) {
                mode = 1;
            } else {
                mode = 2;
            }
        }
        if (mode == 1) {
            if (b[i - 1] > b[i]) {
                res++;
                mode = 0;
            }
        }
        if (mode == 2) {
            if (b[i - 1] < b[i]) {
                res++;
                mode = 0;
            }
        }
    }
    print(res + 1);
}

int main() {
    solve();
    return 0;
}


Measured memory_bytes: 5004
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    ll a,b,c,k;
    cin>>a>>b>>c>>k;
    if(k<=a) cout<<k;
    else if(a<k&&k<=a+b) cout<<a;
    else if(a+b<k) cout<<a-(k-(a+b));
}

Measured memory_bytes: 3592
def tanku?(a)
    c = 0
    l = 0
    s = [5, 7, 5, 7, 7]
    a.each do |k|
        return false if c > 4
        l += k
        if l >= s[c]
            return false if l != s[c]
            c += 1
            l = 0
        end
    end
    return l == 0 && c == 5
end

loop do
    n = gets.to_i
    break if n == 0
    a = []
    l = 0
    ans = nil
    n.times do |i|
        a << gets.size - 1
        next if ans
        l += a[-1]
        l -= a.shift until l <= 31
        if l == 31 && tanku?(a)
            ans = i - a.size + 2
        end
    end
    puts ans
end


Measured memory_bytes: 6876
/*
	In the name of ALLAH
	Author : Raashid Anwar
*/

#include <bits/stdc++.h>
using namespace std;

#define int int64_t
#define mod 1000000007


int power(int a,int b) {
	int r=1;
	while(b) {
		if(b&1)
			r=(r*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return r;
}


int32_t main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	char c;
	string s="abcdefghijklmnopqrstuvwxyz";
	cin>>c;
	cout<<s[c-'a'+1]<<"\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
int MOD = 1000000007;

signed main(){
    int N;
    string S;
    cin >> N >> S;
    
    int ans = 0;
    for(int i=0;i<N-2;i++){
        if(S[i]=='A' && S[i+1]=='B' && S[i+2]=='C') ans++;
    }
    
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
from bisect import *
A,B,Q=map(int,input().split())
S=[int(input()) for i in range(A)]
T=[int(input()) for i in range(B)]
X=[int(input()) for i in range(Q)]
value1=2*(10**10)
for x in X:
    value=value1
    s1=bisect_left(S,x)
    for s in [s1-1,s1]:
        if -1< s < A:
            t1=bisect_left(T,S[s])
            for t in [t1-1,t1]:
                a=0
                if -1< t < B:
                    if x>S[s]:
                        a+=x-S[s]
                    else:
                        a+=S[s]-x
                    if S[s]>T[t]:
                        a+=S[s]-T[t]
                    else:
                        a+=T[t]-S[s]
                    if value>a:
                        value=a
    t1=bisect_left(T,x)
    for t in [t1-1,t1]:
        if -1< t < B:
            s1=bisect_left(S,T[t])
            for s in [s1-1,s1]:
                a=0
                if -1< s < A:
                    if x>T[t]:
                        a+=x-T[t]
                    else:
                        a+=T[t]-x
                    if S[s]>T[t]:
                        a+=S[s]-T[t]
                    else:
                        a+=T[t]-S[s]
                    if value>a:
                        value=a

    print(value)


Measured memory_bytes: 95448
#include <stdio.h>
#include <math.h>

int main(void)
{

	unsigned long n;
	unsigned long a[100000];
	unsigned long ans = 1;
	unsigned long c[100000];

	scanf("%lu", &n);

	for (int i = 0; i < n; i++){
		scanf("%lu", &a[i]);
	}
       
       for(int i=0; i<n/2; i++){
             ans *= 2;
             //printf("%d\n",ans);
             ans = ans % (unsigned long)(pow(10.0, 9) + 7);
        }

	for (int i = 0; i < n; i++){
		c[i] = 0;
	}

	for (int i = 0; i < n; i++){
		c[a[i]] += 1;
	}

	if (n % 2 == 1){
		if (c[0] != 1){
			ans = 0;
		}
		for (int i = 1; i < n; i++){
			if (i % 2 == 1){
				if (c[i] != 0){
					ans = 0;
				}
			}
			else{
				if (c[i] != 2){
					ans = 0;
				}
			}
		}
	}
	else{
		for (int i = 0; i < n; i++){
			if (i % 2 == 1){
				if (c[i] != 2){
					ans = 0;
				}
			}
			else{
				if (c[i] != 0){
					ans = 0;
				}
			}
		}
	}

	printf("%lu\n", ans);
	return 0;
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
using namespace std; 
#define mod 1000000007
#define INF 0x3f3f3f3f
#define all(x) (x).begin(),(x).end()
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define endl "\n" 
#define pb push_back
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define mp make_pair
#define print(v); for(auto x:v) cout<<x<<" "; cout<<endl;
typedef long long int ll;
int main()
{
    fast;
    ll n, a, b;
    cin >> n >> a >> b;
    ll ans = (n / (a + b)) * a + min(n % (a + b), a);
    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 256
//Mandelbrot: z(n+1) = (z(n))^2 + c
//Rick: I programmed you to believe that
//#include <boost/multiprecision/cpp_int.hpp> 
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
typedef int ll;
typedef double db;
// __int128 s128;
// __uint128_t u128;
typedef unsigned long long u64;
#define int long long int
#define PI 3.14159265359
#define sz(a) (ll)a.size()
#define lt(a) (ll)a.length()
#define pll pair<ll,ll>
#define tc(x) ll x; cin>>x; while(x--)
#define f(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define bac(i,a,b) for(ll i=(ll)a;i>=(ll)b;i--)
#define print(a)  for (auto x : a) cout << x << " "; cout << endl
#define mll map<ll,ll>
#define umll unordered_map<ll,ll>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define mt make_tuple
#define eb emplace_back
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(a) a.begin(),a.end()
#define setbits(a) __builtin_popcountll(a)
#define ps(x,y) fixed<<setprecision(y)<<x;
#define F first
#define S second
#define teevra_gati ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define P 998244353
#define Q 1000000006
#define inf 1e18
#define N 1000005
//using namespace boost::multiprecision; 
using namespace __gnu_pbds;
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); //shuffle(all(v), rng);



void solve(){

    char c;
    cin>>c;
    int i = c;
    if(i >=97) cout<<'a';
    else cout<<'A';
}

signed main() {
    teevra_gati
    
    
    solve();
    return 0;
}

Measured memory_bytes: 3648
//##Moh_K_Imar .......
//27/08/2020  ...  8.10
//Ya Rab....
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
int main(){
    ll a,b;
    cin>>a>>b;
    cout<<a*b<<endl;

    return 0;
}



Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	if(n % 2 == 0) cout << n / 2 - 1 << endl;
	else cout << n / 2 << endl;
}

Measured memory_bytes: 256
#include <iostream>;
#include <stdlib.h>;
using namespace std;
int main ()
{
    int w,a,b;
    cin>>w>>a>>b;
    if (abs(a-b)<=w){cout<<0<<endl;}
    else if (abs(b-(a+w))<abs((b+w)-a)){cout<<abs(b-(a+w));}
    else{cout<<abs(b+w-a);}
    cout<<endl;
    return 0;
}

Measured memory_bytes: 3608
import java.util.Scanner;

public class Main {
    public static boolean debug = true;

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

        int[] no = new int[n];
        for(int i=0;i<n;i++){
            no[i] = sc.nextInt();
        }

        int[] manzoku = new int[n];
        for(int i=0;i<n;i++){
            manzoku[i] = sc.nextInt();
        }

        int[] plus = new int[n-1];
        for(int i=0;i<n-1;i++){
            plus[i] = sc.nextInt();
        }

        int sum = 0;

        int temp = -99;
        for(int i=0;i<n;i++){
            int now = no[i];
            sum += manzoku[now-1];

            if(temp == now-1){
                sum += plus[temp-1];
            }

            temp = now;

        }

        System.out.println(sum);


    }

    public static void d(String message){
        if(debug){
            System.out.println(message);
        }
    }
}


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

using namespace std;

using ll = long long;
using vi = vector<int>;
using pi = pair<int,int>;

#define mp make_pair
#define pb push_back
#define rsz resize
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()

void setIO(string name = ""){
    freopen((name+".in").c_str(), "r", stdin); 
    freopen((name+".out").c_str(), "w", stdout);
}

int main(){
 	ios_base::sync_with_stdio(0); cin.tie(0); 
	// setIO();
	int x,a; cin >> x >> a;
	if(x<a)
		cout << 0 << "\n";
	else
		cout << 10 << "\n";
	
    
}





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

int key(int string);
int  main(void) {
    char string[32];
    int i,hand,count,temp;
    while (1) {
        scanf("%s\n",string);
        if (string[0]=='#') break;
        for (i=0; i<strlen(string); i++) {
            temp=key(string[i]);
            if (i==0) {
                hand=temp;
                count=0;
            } else if ((hand==0&&temp==1)||(hand==1&&temp==0)) {
                count++;
                hand=temp;
            }
        }
        printf("%d\n",count);
    }
    return 0;
}

int key(int string) {
    if (string=='y'||string=='u'||string=='i'||string=='o'||string=='p'||string=='h'||string=='j'||string=='k'||string=='l'||string=='n'||string=='m') {
        return 1;
    } else {
        return 0;
    }
}

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

int main(void)
{
  int x, y;
  while (1) {
    cin >> x >> y;
    if (x == 0 && y ==0) break;
    if (x > y) {
      cout << y << " " << x << endl;
    } else {
      cout << x << " " << y << endl;
    }
  }
  return 0;
}

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

int main(){
  int n;
  cin >> n;
  vector<int> h(n);
  for(int i=0;i<n;i++) cin >> h[i];
  
  vector<int> dp(n);
  dp[1]=max(h[0]-h[1],h[1]-h[0]);
  
  for(int i=2;i<n;i++){
    int a=dp[i-1]+abs(h[i]-h[i-1]);
    int b=dp[i-2]+abs(h[i]-h[i-2]);
    dp[i]=min(a,b);
  }
  
  cout << dp[n-1] << endl;
  
}

Measured memory_bytes: 4032
#include<bits/stdc++.h>
using namespace std;
int main(void){
  int N;
  cin >> N;
  map<string, long long> m;
  for(int i = 0; i < N; i++){
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    m[s]++;
  }
  long long ans = 0;
  for(auto n : m) ans += n.second * (n.second - 1) / 2;
  cout << ans << endl;
  return 0;
}


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

public class Main {

	public static void main(String args[]) {
		ConsoleScanner cin = new ConsoleScanner();
		PrintWriter cout = new PrintWriter(System.out);
		solve(cin, cout);
		cout.flush();
	}

	private static void solve(ConsoleScanner cin, PrintWriter cout) {
		int n = cin.nextInt();
		int m = cin.nextInt();
		int[][] abs = new int[m][];
		for (int i = 0; i < abs.length; i++)
			abs[i] = new int[] { cin.nextInt(), cin.nextInt() };

		long millis = System.currentTimeMillis();

		boolean ans = solve(n, m, abs);
		if (ans)
			cout.println("POSSIBLE");
		else
			cout.println("IMPOSSIBLE");

		assert null != cout.format("%d elapsed", System.currentTimeMillis() - millis);
	}

	private static boolean solve(int n, int m, int[][] abs) {
		int[] ships = new int[n + 1];
		for (int[] ab : abs) {
			Arrays.sort(ab);
			if (ab[0] == 1)
				ships[ab[1]] += 1;
			if (ab[1] == n)
				ships[ab[0]] += 1;
		}
		boolean ans = 2 == Arrays.stream(ships).max().getAsInt();
		return ans;
	}

	static class ConsoleScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

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

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

}


Measured memory_bytes: 49712
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    int N,K;
    int R,S,P;
    string T;
    cin >> N >> K >> R >> S >> P >> T;
    int ans = 0;
    for(int i = 0; i < N; i++) {
        if(T[i%K] == T[i] && i >= K) {
            T[i%K] = 'n';
        }
        else {
            if(T[i] == 'r') {
                ans+=P;
                T[i%K] = T[i];
            }
            else if(T[i] == 's') {
                ans+=R;
                T[i%K] = T[i];
            }
            else {
                ans+=S;
                T[i%K] = T[i];
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3768
import numpy as np

def solve():
    ret = np.array([[1 for _ in range(W)] for _ in range(H)])
    row_groups = np.array([0 for _ in range(H)])
    row_group_set = set()
    prev_row = 0
    for row in range(H):
        if '#' in s[row]:
            row_groups[prev_row: row + 1] = row
            row_group_set.add(row)
            prev_row = row + 1
    row_groups[prev_row: ] = prev_row - 1

    cur_group_num = 1
    for row in row_group_set:
        prev_col = 0
        for col in range(W):
            if s[row][col] == '#':
                ret[row][prev_col: col + 1] = cur_group_num
                cur_group_num += 1
                prev_col = col + 1
            ret[row][prev_col: ] = cur_group_num - 1

    for row, row_group_num in enumerate(row_groups):
        if row in row_group_set:
            continue
        for col in range(W):
            ret[row][col] = ret[row_group_num][col]

    for row in ret:
        print(' '.join(map(str, row.tolist())))

if __name__ == "__main__":
    H, W, K = map(int, input().split())
    s = []
    for row in range(H):
        s.append(list(input()))
    solve()

Measured memory_bytes: 29020
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define fi first
#define se second
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl;
#define MOD llong(1e9+7)
#define MAX  405

bool vis[MAX][MAX];
string S[MAX];
llong bla,whi;
pair<int,int> dxy[4];

void DFS(int i,int j){
    vis[i][j] = true;
    if(S[i][j] == '.'){
        whi ++;
        REP(k,4){
            if(S[i + dxy[k].fi][j + dxy[k].se] == '#' and vis[i + dxy[k].fi][j + dxy[k].se] == false) DFS(i + dxy[k].fi,j + dxy[k].se);        }
    }
    if(S[i][j] == '#'){
        bla ++;
        REP(k,4){
            if(S[i + dxy[k].fi][j + dxy[k].se] == '.' and vis[i + dxy[k].fi][j + dxy[k].se] == false) DFS(i + dxy[k].fi,j + dxy[k].se);
        }
    }
}

int main(){
    dxy[0] = make_pair(0,1);
    dxy[1] = make_pair(0,-1);
    dxy[2] = make_pair(1,0);
    dxy[3] = make_pair(-1,0);
    int h,w;
    cin >> h >> w;
    string dum;
    REP(i,w+2) dum += 'a';
    REP(i,h){
        string s;
        cin >> s;
        S[i+1] = 'a';
        S[i+1] += s;
        S[i+1] += 'a';
    }
    S[0] = dum;
    S[h+1] = dum;
    REP(i,h+2) REP(j,w+2) vis[i][j] = false;
    llong ans = 0;
    FOR(i,1,h+1){
        FOR(j,1,w+1){
            if(vis[i][j]) continue;
            bla = 0,whi = 0;
            DFS(i,j);
            ans += bla * whi;
        }
    }
    cout << ans << endl;

}

Measured memory_bytes: 13184
#include<iostream>
#include<stdio.h>
#include<vector>
#include<cmath>
#include<queue>
#include<string.h>
#include<map>
#include<set>
#include<algorithm>
#define ll long long
#define pi pair < ll,ll >
#define mp(a,b) make_pair(a,b)
#define rep(i,a,b) for(int i = a;i < b;i++)
#define N 300004
#define INF 1e9+7

using namespace std;

ll n,h[N],ar[N],seg[4*N],dp[N];

void update(ll low,ll high,ll pos,ll slow,ll val)
{
    if(low == high && low==slow)
    {
        seg[pos] = max(seg[pos],val);
        return;
    }
    if(low > slow|| high < slow)
        return;

    ll mid = (low+high)/2;

    update(low,mid,pos*2+1,slow,val);
    update(mid+1,high,pos*2+2,slow,val);

    seg[pos] = max(seg[pos*2+1],seg[pos*2+2]);

    return;
}

ll query(ll low,ll high,ll pos,ll shigh)
{
    if(high < shigh)
        return seg[pos];
    if(low >= shigh)
        return 0;

    ll mid = (low+high)/2;

    return max(query(low,mid,pos*2+1,shigh),query(mid+1,high,pos*2+2,shigh));
}

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

    cin >> n;

    rep(i,0,n)
    {
        cin >> h[i];
    }

    rep(i,0,n)
    {
        cin >> ar[i];
    }

    ll ans = 0;

    rep(i,0,n)
    {
        dp[i] = ar[i] + query(0,n,0,h[i]);
        update(0,n,0,h[i],dp[i]);
        ans = max(ans,dp[i]);
    }

    cout << ans;

    return 0;
}



Measured memory_bytes: 14080
#include<bits/stdc++.h>
#define int long long 

using namespace std ;

int n , m ;
pair<int,int>arr[100001];
multiset<int>mst;

int32_t main(){
        ios_base::sync_with_stdio(0); cin.tie(0);

        cin >> n >> m ; 
        for(int i=0;i<n;i++)
                cin >> arr[i].first >> arr[i].second;

        sort(arr,arr+n);
        int nxt = 0 , ans = 0;
        for(int i=1 ; i<=m ; i++ ){
                while(nxt < n and arr[nxt].first == i ){
                        mst.insert(arr[nxt].second);
                        nxt++;
                }
                if(!mst.empty()){
                        ans += *(mst.rbegin());
                        mst.erase(prev(mst.end()));
                }
        }

        cout << ans << endl;
        
        return 0;
        
}

Measured memory_bytes: 6528
#include <iostream>
#include <vector>
#include <cmath>

int b()
{
    long long n, a, b = 0;
    std::cin >> n >> a >> b;
    
    long long it = n / (a + b);
    long long rem = n % (a + b);
    
    it *= a;
    if(a < rem)
    {
        rem = a;
    }
    
    std::cout << it + rem ;
    return 0;
}

int main(int argc, const char * argv[])
{
    b();
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 1e5+10; 
const int INF = 2e9;
int dp[N],h[N];
void init(int n)
{
	for(int i=1;i<=n;i++)
	{
		dp[i] = INF;
	}
}
int main()
{
	int n,k;
	cin >> n >> k;
	init(n);
	for(int i=1;i<=n;i++)
	{
		cin >> h[i];
	}
	dp[1]=0,dp[2]=abs(h[1]-h[2]);
	for(int i=3;i<=n;i++)
	{
		for(int j=1;j<=k;j++)
		{
			if(i-j>=1)
				dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]));
		}
	}
	cout<<dp[n];
	return 0;
}

Measured memory_bytes: 1024
h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]
flag = True
for i in range(h):
    for j in range(w):
        if s[i][j] == '#':
            if not(i == 0 or s[i-1][j] == '#') and not(j == 0 or s[i][j-1] == '#') and not(i == h-1 or s[i+1][j] == '#') and not(j == w-1 or s[i][j+1] == '#'):
                flag = False
            if not(flag):
                break
        if not(flag):
            break
print('Yes' if flag else 'No')

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;
typedef long long ll;

int main() {
    ll n, a, b;
    cin >> n >> a >> b;
    vector<ll> h(n);
    for(int i=0;i<n;i++)
        cin >> h[i];
    ll lo = 0, hi = 1000000000;
    while(lo+1<hi) {
        ll m = (lo + hi) / 2;
        ll cnt = 0;
        for(int i=0;i<n;i++) {
            if((h[i]-b*m) < 0) continue;
            cnt += (h[i]-b*m+a-b-1)/(a-b);
        }
        if(cnt <= m)
            hi = m;
        else
            lo = m;
    }
    cout << hi << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  int N,K;
  cin >> N >> K;
  vector<int> d(K);
  vector<int> e(100);
  set<int> S;
  for(int i=0;i<K;i++)
  {
    cin >> d[i];
    for(int j=0;j<d[i];j++)
    {
      cin >> e[j];
      S.insert(e[j]);
    }
  }
  cout << N - S.size() << endl;
  return 0;
}


Measured memory_bytes: 3640
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO ?????????????????????????????????????????????
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());

		Movie[] movies = new Movie[n];
		for(int i = 0; i < n; i++){
			String[] tmpArray = br.readLine().split(" ");
			movies[i] = new Movie(Integer.parseInt(tmpArray[0]), Integer.parseInt(tmpArray[1]));
		}

		Arrays.sort(movies);

		//debug
//		for(int i = 0; i < n; i++){
//			System.out.println(movies[i].toString());
//		}
		int first = 0;
		int date = 0;
		boolean[] isFirst = new boolean[32];
		

		for(int i = 0; i < n; i++){
			for(int j = movies[i].start ; j <= movies[i].end ; j++){
				if(!isFirst[j]){
					isFirst[j] = true;
					first++;
					break;
				}
			}
		}
//		for(int i = 0; i < n ;i++){
////			int tmpDate = movies[i].start;
//
//			for(int j = movies[i].start ; j <= movies[i].end ; j++){
//				if(j > date){
//					first++;
//					date = j;
//					break;
//				}
//			}
//		}

		System.out.println(50*31 + 50*first);
	}

}

class Movie implements Comparable<Movie>{
	int start;
	int end;
	int interval;

	public Movie(int s, int e){
		this.start = s;
		this.end = e;
		this.interval = e - s + 1;
	}

	@Override
	public int compareTo(Movie m) {
		// TODO ?????????????????????????????????????????????
//		return this.start == m.start ? (this.interval == m.interval ? 0 : this.interval - m.interval) : this.start - m.start;
//		return this.end == m.end ? (this.start == m.start ? 0 : this.start - m.start) : this.end - m.end;
		return this.interval == m.interval ? (this.start == m.start ? 0 : this.start - m.start) : this.interval - m.interval;
	}

	public String toString(){
		return "from "+start + " to "+end;
	}


}

Measured memory_bytes: 24568
n, k = map(int, input().split())
d = {}
q, r = divmod(n, k)
if r == 0:
    for i in range(k):
        d[i] = q
else:
    for i in range(k):
        if i == 0:
            d[i] = q
        elif 1 <= i <= r:
            d[i] = q+1
        else:
            d[i] = q
#print(d)
ans = 0
if k%2 != 0:
    ans = d[0]**3
else:
    ans = d[0]**3+d[k//2]**3
print(ans)


Measured memory_bytes: 61040
n = int(input())
h = list(map(int, input().split()))
cost = [0] * n
cost[1] = abs(h[0] - h[1])
for i in range(2, n):
    c1 = cost[i - 1] + abs(h[i - 1] - h[i])
    c2 = cost[i - 2] + abs(h[i - 2] - h[i])
    if c1 < c2:
        cost[i] = c1
    else:
        cost[i] = c2
print(cost[-1])

Measured memory_bytes: 13928
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)


table = Dict{Int, Int}()


function f(x, y, z)
    return x^2 + y^2 + z^2 + x * y + y * z + z * x
end




function main()
    N = parseInt(readline())
    for x in 1:100
        for y in 1:100
            for z in 1:100
                if haskey(table, f(x, y, z))
                    table[f(x, y, z)] += 1
                else
                    table[f(x, y, z)] = 1
                end
            end
        end
    end

    for i in 1:N
        if haskey(table, i)
            println(table[i])
        else
            println(0)
        end
    end
end


main()

Measured memory_bytes: 201016
{-# LANGUAGE BangPatterns #-}
import Control.Monad
import Data.Maybe
import qualified Data.Vector.Unboxed as V
import qualified Data.Vector.Unboxed.Mutable as VM
import qualified Data.ByteString.Char8 as BS

main = do
  n <- readLn
  happiness <- V.replicateM n $ do
    -- [a,b,c] <- map (read . BS.unpack) . BS.words <$> BS.getLine
    [a,b,c] <- map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine
    -- a,b,c <= 10^4
    return (a,b,c :: Int)
  let (a,b,c) = V.foldl1' (\(!a,!b,!c) (!a',!b',!c') -> (max b c + a', max a c + b', max a b + c')) happiness
  print (max a (max b c))


Measured memory_bytes: 3452
# coding: utf-8
import sys


def readline():
    return sys.stdin.readline().rstrip()


def read(f=int):
    return f(readline())


def reads(f=int):
    return list(map(f, readline().split()))


def read_n(n: int, f=int):
    return [read(f) for _ in range(n)]


def reads_n(n: int, f=int):
    return [reads(f) for _ in range(n)]

N = read()
D = reads()

from itertools import combinations

print(sum(a * b for a, b in combinations(D, 2)))



Measured memory_bytes: 3064
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil,pi,factorial
    from operator import itemgetter
    def I(): return int(input())
    def MI(): return map(int, input().split())
    def LI(): return list(map(int, input().split()))
    def LI2(): return [int(input()) for i in range(n)]
    def MXI(): return [[LI()]for i in range(n)]
    def SI(): return input().rstrip()
    def printns(x): print('\n'.join(x))
    def printni(x): print('\n'.join(list(map(str,x))))
    inf = 10**17
    mod = 10**9 + 7
#main code here!
    n=I()
    lis=LI2()
    ind=[i for i in range(n)]
    if lis[0]!=0:
        print(-1)
        sys.exit()
    for i in range(1,n):
        if lis[i]==0:
            ind[i]=0
        else:
            ind[i]=ind[i-1]+1
    for i in range(n):
        if lis[i]>ind[i]:
            print(-1)
            sys.exit()
    ans=0
    for i in range(n-1):
        x=lis[i]
        if lis[i+1]==lis[i]+1:
            continue
        elif lis[i+1]>lis[i]+1:
            print(-1)
            sys.exit()
        else:
            ans+=x
    if n!=1 and lis[-1]==lis[-2]+1:
        ans+=lis[-1]
    else:
        ans+=lis[-1]
    
    print(ans)
            
            
            
            
        
    
    
    
    



if __name__=="__main__":
    main()


Measured memory_bytes: 93316
import itertools

import numpy as np

height, width, k = map(int, input().split())
k -= 1

MOD = 1000000007

# 1 つの行について valid な線の引き方を列挙
patterns = []
for r in range(width - 1):
    for pattern in itertools.combinations(range(width - 1), r):
        # 隣り合ってたらだめ
        if all(abs(a - b) != 1 for a, b in zip(pattern[:-1], pattern[1:])):
            patterns.append(pattern)

# counts[w][v]: 1 行で w から v へ行けるパターンの数
counts = np.zeros((width, width))
for pattern in patterns:
    for w in range(width):
        if w in pattern:
            counts[w][w + 1] += 1
        elif w - 1 in pattern:
            counts[w][w - 1] += 1
        else:
            counts[w][w] += 1
if width == 1:
    counts[0][0] = 1

# 0 から高さ h の w に行けるパターン数
# dp[h][w]
dp = np.zeros((height, width))
dp[0] = counts[0].copy()
for h in range(height - 1):
    dp[h + 1] = np.dot(dp[h], counts) % MOD

print(int(dp[-1][k]))


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

int main() {
  vector<char> data(6);
  for(int i=0;i<6;i++) {
    cin >> data[i];
  }
  
  if(data[2]==data[3]&&data[4]==data[5]) cout << "Yes" <<endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>

using namespace std;

/* nを素因数分解する */
map<long long, int> primefactor(long long n) {
  map<long long, int> ret;
  for (long long i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if (n != 1) ret[n] = 1;
  return ret;
}

int main() {
  int n;
  cin >> n;
  cout << n << ":";
  for (auto it : primefactor(n)) {
    while (it.second--) cout << " " << it.first;
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 3100
s = list(str(input()))
n = len(s)

for i in range(n):
    s.pop()
    #print(s)
    #print(s[0:n//2], s[n//2:])
    if s[0:len(s)//2] == s[len(s)//2:]:
        print(len(s))
        exit()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define vl vector<ll>
#define vi vector<int>
#define sl set<ll>
#define sc set<char>
#define pi pair<int,int>
#define pl pair<ll,ll>
#define mpi map<ll,ll>
#define mpc map<char,ll>
#define forn(i,n) for(ll i=0;i<n;i++)
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define inf        10000000


int main()
{
    ll n;
    cin>>n;
    ll a[n];
    forn(i,n)
    cin>>a[i];
    ll dp[200005];
    dp[0]=0;
    dp[1]=abs(a[1]-a[0]);
    for(ll i=2;i<n;i++)
    {
        dp[i]=min(dp[i-2]+abs(a[i]-a[i-2]),dp[i-1]+abs(a[i]-a[i-1]));
    }
    cout<<dp[n-1];
}

Measured memory_bytes: 1792
# https://atcoder.jp/contests/abc150/tasks/abc150_d
import math


def lcm(x, y):
    return (x * y) // math.gcd(x, y)


n, m = list(map(int, input().split()))
A = list(map(int, input().split()))
for i in range(len(A)):
    A[i] //= 2

div_two_cnt = None
for a in A:
    cnt = 0
    while a % 2 == 0:
        a //= 2
        cnt += 1
    if div_two_cnt is None:
        div_two_cnt = cnt
    elif cnt != div_two_cnt:
        print(0)
        exit()

tmp = A[0]
for i in range(1, n):
    tmp = lcm(tmp, A[i])

# print(tmp)
print(((m // tmp) + 1)//2)


Measured memory_bytes: 85060
#include<bits/stdc++.h>
#include<boost/variant.hpp>
using namespace std;
typedef long long ll;
typedef vector<boost::variant<bool, ll, int, string, double, char*, char, const char*>> any;
template<typename T> inline void pr(const vector<T> &xs){
	for(int i=0; i<xs.size()-1; i++) cout<<xs[i]<<" ";
	(xs.empty()?cout:(cout<<xs[xs.size()-1]))<<endl;
}
#ifdef DEBUG
#define debug(...) pr(any{__VA_ARGS__})
#define debugv(x) pr((x))
#else
#define debug(...)
#define debugv(x)
#endif

int main(){
	int N, K, R, S, P;
	cin >> N >> K >> R >> S >> P;
	string T;
	cin >> T;

	ll ans = 0;
	for(int i=0; i<K; i++){
		char last = T[i];
		int count = 1;
		for(int j=1; j*K+i<N; j++){
			if(T[j*K+i]==last) count++;
			else {
				int x;
				if(last == 'r') x = P;
				else if(last == 's') x = R;
				else x = S;
				ans += (count+1)/2 * x;
				count = 1;
				last = T[j*K+i];
			}
		}
		int x;
		if(last == 'r') x = P;
		else if(last == 's') x = R;
		else x = S;
		ans += (count+1)/2 * x;
	}

	cout << ans << endl;


	return 0;
}


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

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(itr,v) for(auto &(itr):(v))
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<bool> vb;
typedef vector<ld> vld;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a*b/gcd(a,b);}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

int n, t, dp[114514];
vi p;

signed main() {
	cin >> n;
	p.pb(1);
	t = 6;
	while (t<=n) {
		p.pb(t);
		t *= 6;
	}
	t = 9;
	while (t<=n) {
		p.pb(t);
		t *= 9;
	}
	rep(i,n) dp[i] = inf;
	
	repr(i,n) each(j,p) {
		t = i-j;
		if (t<0) continue;
		chmin(dp[t],dp[i]+1);
	}
	cout << dp[0] << ln;
}

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

using namespace std;

const long long mod = 1000000007;

vector <vector <int>> dp(1009, vector <int>(1009, 0));

int main()
{
    int h, w;

    cin >> h >> w;

    vector <string> s(h);

    for (int i = 0; i < h; ++i)
        cin >> s[i];

    dp[0][0] = 1;

    for (int i = 0; i < h; i++)
        for (int j = 0; j < w; j++)
        {
            char downDirection = '*', rightDirection = '*';
            if (i + 1 < h)
                downDirection = s[i + 1][j];
            if (j + 1 < w)
                rightDirection = s[i][j + 1];

            if(downDirection == '.')
                dp[i+1][j] = (dp[i + 1][j] + dp[i][j]) % mod;

            if(rightDirection == '.')
                dp[i][j+1] = (dp[i][j + 1] + dp[i][j]) % mod;

            //cout << downDirection << " " << rightDirection << "\n";
        }

    cout << dp[h - 1][w - 1];

    return 0;
}


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

using namespace std;

typedef long long ll;
typedef vector<ll> v1;

const ll mod = 1000000007;


ll n,m;
ll a[1001];
ll b[1001];
ll ans = 1;

void cerrvec(ll *from, ll *to){
  for(auto x = from;x != to;x++){
    cerr << *x << " ";
  }
  cerr << endl;
}

int main(){
  cin >> n >> m;
  for(ll i = 0;i < n;i++){
    cin >> a[i];
  }
  for(ll i = 0;i < m;i++){
    cin >> b[i];
  }
  a[n] = 0;
  b[m] = 0;
  sort(a,a+n+1,greater<ll>());
  sort(b,b+m+1,greater<ll>());
  // cerrvec(a,a+n+1);
  // cerrvec(b,b+n+1);
  set<ll> s;
  for(ll i = 0;i < n;i++){
    if(s.count(a[i])){
      cout << 0 << endl;
      return 0;
    }
    s.insert(a[i]);
  }
  s = set<ll>();
  for(ll i = 0;i < m;i++){
    if(s.count(b[i])){
      cout << 0 << endl;
      return 0;
    }
    s.insert(b[i]);
  }
  ll r = 0;
  ll l = 0;
  for(ll i = 0,x = n*m;i < n*m;i++,x--){
    while(a[r] > x) r++;
    while(b[l] > x) l++;
    if(a[r] == x && b[l] == x){
      ans *= 1;
    }else if(a[r] == x){
      ans *= l;
      ans %= mod;
    }else if(b[l] == x){
      ans *= r;
      ans %= mod;
    }else{
      ans *= r*l-i;
      ans %= mod;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <map>
#include <vector>
#define REP(i,n) for(int i=0;i<(int)n;i++)
#define REP1(j,n) for(int j=0;j<(int)n;j++)
#define REPD(i,n) for(int i=n;i>=0;i--)
#define REPD1(j,n) for(int j=n;j=>0;j--)
#define REPS(i,n) for(int i=0;i<=(int)n;i++)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
using namespace std;
typedef long long ll;


int main(void) {
	/*int x1,x2,x3,x4,y1,y2,y3,y4;
	cin >> x1 >> y1 >> x2 >> y2;

	cout<<x3<<y3<<x4<<y4 <<endl;*/
	int k,ans;
	cin >> k;
	if (k % 2 == 0) {
		ans = (k / 2) * (k/2);
	}
	else {
		ans = (k / 2)*(k / 2 + 1);
	}
	cout << ans << endl;
	return 0;
}




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

int abs(int n) {
  if (n >= 0) return n;
  else return -n;
}

int main() {
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  
  if ((abs(b-a) <= d) && (abs(b-c) <= d)) cout << "Yes" << endl;
  else if (abs(a-c) <= d) cout << "Yes" << endl;
  else cout << "No" << endl;
  
}


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

int main(){
  long long n, d;
  long long p, q;
  int cnt = 0;

  cin >> n >> d;
  
  while(n--){
    cin >> p >> q;
    if(d*d >= p*p + q*q) cnt++;
  }
  
  cout << cnt << endl;
  return 0; 
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
int main() {
  double A, B, H, M, Ans, rad_H, rad_M;
  cin >> A >> B >> H >> M;
  rad_H = 2*PI * (60*H+M) / 720;
  rad_M = 2*PI * M / 60;
  Ans = sqrt((A*cos(rad_H)-B*cos(rad_M))*(A*cos(rad_H)-B*cos(rad_M))+(A*sin(rad_H)-B*sin(rad_M))*(A*sin(rad_H)-B*sin(rad_M)));
  printf("%.10f\n", Ans);
}




Measured memory_bytes: 4116