akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <fstream>
#include <string>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define ll unsigned long long

const ll MOD = 1000000000000000000;

int main() {
	//入力
	int a,b,c,x,y;
	cin >> a >> b >> c >> x >> y;

	//処理
	ll ans = INT_MAX;
	int a1, b1, c1;
	a1 = b1 = 0;
	c1 = (max(x,y) - a1) * 2;
	ans = c1 * c;
	//
	for (int a1 = 0;a1 <= x;++a1) {
		c1 = (x - a1) * 2;
		b1 = max(0, y - c1 / 2);
		ll z = a1 * a + b1 * b + c1 * c;
		if (z < ans) ans = z;
	}

	//出力
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3656
#include "bits/stdc++.h"
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define FOR(i, a) for (auto &i: a)
#define ALL(obj) begin(obj), end(obj)
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define sum(x) accumulate(ALL(x), 0LL)
#define LOWER_BOUND(A, key) distance(A.begin(), lower_bound(ALL(A), key))
#define UPPER_BOUND(A, key) distance(A.begin(), upper_bound(ALL(A), key))

using namespace std;
const int MOD    = (int)(1e9 + 7);
const int INF    = (int)(1e13 + 7);
const double EPS = 1e-14;
const double PI  = acos(-1);

int CEIL(int a, int b) { return (a >= 0 ? (a + (b - 1)) / b : (a - (b - 1)) / b); } //ceil() for int
int mod(int a, int b) { return a >= 0 ? a % b : a - (b * CEIL(a, b)); }             //always return positive num
int bpm(int a, int b) {                                                             //return x^y in order(log(y))
  int res = 1;
  for (a %= MOD; b; a = a * a % MOD, b >>= 1)
    if (b & 1) res = res * a % MOD;
  return res;
}

struct LCS {
private:
  vector<vector<int>> dp;
  string one, two;
  int n1, n2;

public:
  LCS(string &temp1, string &temp2): n1(temp1.size()), n2(temp2.size()) {
    one = temp1;
    two = temp2;
    dp.assign(n1 + 1, vector<int>(n2 + 1, 0));
  }
  int lcs() {
    for (int i = 0; i < n1; i++) {
      for (int j = 0; j < n2; j++) {
        if (one[i] == two[j]) {
          dp[i + 1][j + 1] = max({dp[i][j] + 1, dp[i + 1][j], dp[i][j + 1]});
        } else {
          dp[i + 1][j + 1] = max(dp[i][j + 1], dp[i + 1][j]);
        }
      }
    }
    return dp[n1][n2];
  }
};

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  rep(_, n) {
    string temp1, temp2;
    cin >> temp1 >> temp2;
    LCS lcs(temp1, temp2);
    cout << lcs.lcs() << endl;
  }
}


Measured memory_bytes: 10892
using System;
class Program
{
    static void Main(string[] args)
    {
        string[] AB = Console.ReadLine().Split(' ');
        int A = int.Parse(AB[0]);
        int B = int.Parse(AB[1]);
        int v1 = A + B;
        int v2 = A - B;
        int v3 = A * B;
        int ans = v1;
        ans = Math.Max(ans, v2);
        ans = Math.Max(ans, v3);
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 13140
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
#include <functional>
#include <cctype>

using namespace std;

#define REP(i,n) for(int i = 0; i < (int)n; ++i)

int main()
{
	int n;
	cin >> n;
	vector<int> S(n);
	REP(i, n) {
		cin >> S[i];
	}
	int q;
	cin >> q;
	vector<int> T(q);
	REP(i, q) {
		cin >> T[i];
	}
	int c = 0;
	sort(S.begin(), S.end());
	sort(T.begin(), T.end());
	REP(i, q) {
		if( binary_search(S.begin(), S.end(), T[i])) {
			++c;
		}
	}

	cout << c << endl;

	return 0;
}

Measured memory_bytes: 1584
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define pii pair<int,int>
#define pli pair<ll,int>
#define pil pair<int,ll>
#define pll pair<ll,ll>
#define mat vector<vector<int>>
const int inf = 1 << 30;
const ll linf = 1e18;
const db EPS = 1e-7;
template<class T> void chmin(T& x, T y){if(x > y) x = y;}
template<class T> void chmax(T& x, T y){if(x < y) x = y;}


ll A, B, N;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> A >> B >> N;
    if(N >= B) N = B - 1;
    cout << ((A * N) / B) - ((N / B) * A) << endl;
    return 0;
}

Measured memory_bytes: 3608
#include <stdio.h>

#define DATA 100

int main(void)
{
	int a[DATA][DATA], b[DATA], c[DATA];
	int n, m, i, j;

	for(i = 0;i < DATA;i++)
	{
		for(j = 0;j < DATA;j++)
			a[i][j] = 0;
		b[i] = 0;
		c[i] = 0;
	}
	scanf("%d %d", &n, &m);
	for(i = 0;i < n;i++)
	{
		for(j = 0;j < m;j++)
			scanf("%d", &a[i][j]);
	}
	for(i = 0;i < m;i++)
	{
		scanf("%d", &b[i]);
	}
	for(i = 0;i < n;i++)
		for(j = 0;j < m;j++)
			c[i] += a[i][j] * b[j];
	for(i = 0;i < n;i++)
	{
		printf("%d\n", c[i]);
	}

	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a[100],n,sum;
	scanf("%d",&n);
	sum=0;
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
	}
	for(int i=1;i<=n;i++)
	{
		if(a[i]!=i)
		{
			sum++;
		}
	}
	if(n<=2)
	{
		printf("YES\n");
	}
	else
	{
		if(sum==2||sum==0)
		{
			printf("YES\n");
		}
		else
		{
			printf("NO\n");	
		}
	}
	return 0;
}

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

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector< vector< pair<int, int> > > v(n);
  for (int i = 0; i < n; ++i) {
    int m;
    cin >> m;
    v[i].resize(m);
    for (int j = 0; j < m; ++j) {
      cin >> v[i][j].first >> v[i][j].second;
      --v[i][j].first;
    }
  }
  int res = 0;
  for (int S = 0; S < 1 << n; ++S) {
    bool ok = true;
    for (int i = 0; i < n; ++i) {
      if (S >> i & 1) {
        for (auto e : v[i]) {
          if ((S >> e.first & 1) != e.second) {
            ok = false;
          }
        }
      }
    }
    if (ok) {
      res = max(res, __builtin_popcount(S));
    }
  }
  cout << res << '\n';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
#define fi first
#define se second
using namespace std;
typedef pair<int, int> P;

signed main(){
    int n, a, b;
    cin >> n >> a >> b;
    int M = b * (n - 1) + a;
    int m = b + a * (n - 1);
    cout << max((int)0, M - m + 1) << endl; 
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cmath>
#include<cassert>
#include<bitset>
using namespace::std;
#define int long long int
int dp[1<<16],ar[20][20];

main(){
	ios_base::sync_with_stdio(0);
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
		for(int j=0;j<n;j++)
			cin>>ar[i][j];
	for(int j=1;j<(1<<n);j++){
			int t=j;
			vector<int> v;
			for(;t;t-=t&(-t))
				v.push_back((int)log2(t&(-t)));
			// cout<<(bitset<20>)j<<'\n';
			t=j;
			for(int i=0;i<v.size();i++)
				for(int j=i+1;j<v.size();j++)
					dp[t]+=ar[v[i]][v[j]];//,cout<<v[i]<<' '<<v[j]<<' '<<ar[v[i]][v[j]]<<' '<<dp[t]<<'\n';
			// for(auto a:v)
			// 	cout<<a<<' ';
			// cout<<dp[j]<<'\n';
		}
	for(int i=1;i<=n;i++)
		for(int j=1;j<(1<<n);j++)
			if(__builtin_popcount(j)==i)
				for(int k=((1<<n)-1)^(((1<<n)-1)&j);k;k--,k^=k&j){
						dp[j|k]=max(dp[j|k],dp[j]+dp[k]);
					}
	cout<<dp[(1<<n)-1]<<'\n';
	// for(int j=1;j<(1<<n);j++)
	// 	cout<<dp[j]<<'\n';
}

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

namespace c
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = long.Parse(Console.ReadLine());
            var a = Console.ReadLine().Split().Select(i => long.Parse(i)).ToArray();

            var d = new Dictionary<long,long>();
            for(var i = 0; i < n - 1; i++){
                if(d.ContainsKey(a[i])){
                    d[a[i]] += 1;
                }else{
                    d.Add(a[i], 1);
                }
            }

            for(var i = 1; i <= n; i++){
                if(d.ContainsKey(i)){
                    Console.WriteLine(d[i]);
                }else{
                    Console.WriteLine(0);
                }
            }
        }
    }
}


Measured memory_bytes: 56784
def solve():
    W, H, x, y = [int(_) for _ in raw_input().split()]
    ans = W * H / 2.0
    if (W % 2 == 0 and x == W/2) and (H % 2 == 0 and y == H/2):
        mul = 1
    else:
        mul = 0
    print ans, mul

if __name__ == '__main__':
    solve()


Measured memory_bytes: 28012
#include <bits/stdc++.h>
#define loop2(i, s, n, a) for (int i = int(s); i < int(n); i += a)
#define loop(i, s, n) loop2(i, s, n, 1)
#define rep(i, n) loop(i, 0, n)

#define pb push_back
#define all(in) in.begin(),in.end()

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

int main(){
    string s; cin >> s;
    int n; cin >> n;
    int m = s.length();

    vector<string> ans;

    rep(i,m+1) rep(j,m+1) if(i < j) {
      ans.push_back(s.substr(i,j-i));
    sort(all(ans));
  	ans.erase(unique(ans.begin(), ans.end()), ans.end());
    if(ans.size() > n) ans.pop_back();
    }
    cout << ans[n-1] << endl;
}

Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
const int MOD = 1e9 + 7;
const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, 1, -1};
typedef long long ll;
using namespace std;
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	int A[n + 1];
	bool flag = false;
	int cnt = 0;
	for(int i = 0; i < n; i++)
	{
		cin >> A[i];
	}
	while(1)
	{
		for(int i = 0; i < n; i++)
		{
			if(A[i] % 2)
				flag = true;
			A[i] /= 2;
		}
		if(flag)
		{
			break;
		}
		cnt++;
	}
	cout << cnt << endl;
	return 0;
}



Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
        int A = sc.nextInt();
        if(N%500>A)
            System.out.println("No");
        else
            System.out.println("Yes");
	}
}


Measured memory_bytes: 23636
//Harjot Singh Student NIT JALANDHAR	

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

#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

typedef long long int ll;

int main()
{
    
     fastio
    int n=0,k=0;
    cin>>n>>k;
    int arr[n];
    for(int i=0;i<n;i++)
    	cin>>arr[i];
    int dp[n];
    dp[1]=abs(arr[1]-arr[0]);
    dp[0]=0;
    for(int i=2;i<n;i++)
    {
    	dp[i]=INT_MAX;
    	for(int j=1;j<=k;j++)
    	{
    		if(i>=j)
    		{
    			dp[i]=min(dp[i-j]+abs(arr[i-j]-arr[i]),dp[i]);
    		}
    		else
    			break;

    	}

    }
    cout<<dp[n-1]<<endl;
  
  	return 0;
}

Measured memory_bytes: 1024
S = input()
if S != S[::-1]:
    print('No')
else:
    N = len(S)
    sub1 = S[:(N - 1) // 2]
    sub2 = S[-(N - 1) // 2:]
    if sub1 != sub1[::-1]:
        print('No')
    elif sub2 != sub2[::-1]:
        print('No')
    else:
        print('Yes')

Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
typedef int64_t Int;
typedef pair<int,int> pii;
const int INF = 999999999;

int N, M; 
vector<vector<int>> G(100010);
vector<int> dist(100010, INF);
vector<int> ans(100010, -1);

void bfs(){
    queue<int> Q;
    Q.push(0); dist[0] = 0;

    while(!Q.empty()){
        int now = Q.front(); Q.pop();
        rep(i,G[now].size()){
            int to = G[now][i];
            if(dist[now] + 1 < dist[to]){
                dist[to] = dist[now]+1;
                ans[to] = now+1;
                Q.push(to);
            } 
        }
    }
}

int main(){
    cin >> N >> M;
    rep(i,M){
        int A, B; cin >> A >> B; A--; B--;
        G[A].push_back(B);
        G[B].push_back(A);
    }

    bfs();

    cout << "Yes" << endl;
    rep1(i,N-1) cout << ans[i] << endl;
}


Measured memory_bytes: 10644
n = int(input())
a = list(map(int, input().split()))
if n % 2 == 0:
    ans, cnt = 0, 0
    for i in range(n):
        if i % 2 == 1:
            ans += a[i]
            cnt += a[i]
    for i in range(n):
        if i % 2 == 0:
            cnt += a[i]
        else:
            cnt -= a[i]
            ans = max(cnt, ans)
else:
    a.insert(0, 0)
    dp = [[0] * (n + 1) for _ in range(3)]
    for i in range(3):
        for j in range(1 + i, n + i - 1, 2):
            if i == 0:
                if j == 1:
                    dp[i][j] = a[j]
                else:
                    dp[i][j] = dp[i][j - 2] + a[j]
            else:
                dp[i][j] = max(dp[i - 1][j - 1], dp[i][j - 2] + a[j])
    ans = dp[2][n]
print(ans)

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

int main(){

    int n, b, f, r, v;
    cin >> n;

    int kousya[12][10];
    for(int i=0; i<12;i++){
        for(int j=0; j<10; j++){
            kousya[i][j] = 0;
        }
    }

    while(n--){

        cin >> b >> f >> r >> v;
        kousya[(b-1) * 3 + (f-1)][r - 1] += v;

    }

    for(int i=1; i<=4; i++){
        for(int j=3; j>=1; j--){
            for(int k=0; k<10; k++){
                cout << " " << kousya[3 * i - j][k];
            }
            cout << "\n";
        }
        for(int l=0; l<20; l++){
            if(i==4){
                break;
            }
            cout << '#';
        }
        if(i!=4){
            cout << "\n";
        }
    }

    return 0;

}


Measured memory_bytes: 3076
#cording: utf-8

N, T = map(int, input().split())

ct = []
for i in range(N):
    ct.append(list(map(int, input().split())))

c_min = 1001
for i in range(N):
    if (ct[i][1] <= T) and (ct[i][0] <= c_min):
        c_min = ct[i][0]

print(c_min if c_min != 1001 else 'TLE')


Measured memory_bytes: 3060
///                ..:: In The Name Of God ::..
#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 endl    '\n'
#define INF 2e9
#define int ll
#define vi          vector<int>
#define de          deque<int>
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()//全範囲指定を簡略化
typedef long long ll;
using namespace std;
//配列の要素数は　sizeof(ar)/sizeof(ar[0]) で求める
int X, A, B;
signed main()
{
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    cin >> X;
    A = X/100;
    B = X%100;
    if(B <= A*5){
        cout << 1 << endl;
    }
    else{
        cout << 0 << endl;
    }
}

Measured memory_bytes: 256
def f(y, b):
    return y**4 + 5*(y**3)*b + 10*(y**2)*(b**2) + 10*y*(b**3) + 5*(b**4)

X = int(input())
for y in range(1, int(X**0.5)+1):
    if X%y==0:
        tmp = X//y
        right = int(tmp**(1/4))+1
        left = -right
        while left < right:
            b = (right + left)//2
            fyb = f(y, b)
            if  fyb == tmp:
                break
            elif fyb > tmp:
                right = b
            else:
                left = b + 1
        if fyb == tmp:
            break
print(y+b, b)

Measured memory_bytes: 9468
import java.util.Scanner;

public class Main {
    static long n;
    static long a;
    static long b;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        a = sc.nextLong();
        b = sc.nextLong();
        int ans = -1;
        for (int i = 0; i < 10000; i++) {
            if (i*8/100 == a && i*10/100 == b) {
                ans = i;
                break;
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 23124
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using Pair = pair<int64_t, int64_t>;

// std::cout << std::setprecision(20) << 1.1 << endl;

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

  int64_t N;
  cin >> N;
  vector<int64_t> A(N);
  for (int64_t i = 0; i < N; ++i) {
    cin >> A[i];
  }
  sort(A.begin(), A.end());
  const int64_t x = A[A.size() - 1];
  auto itr = lower_bound(A.begin(), A.end(), x / 2);
  int64_t y = *itr;
  if (itr != A.begin()) {
    int64_t z = *(itr - 1);
    if (itr == (A.end() - 1)) {
      y = z;
    } else if (abs(z * 2 - x) < abs(y * 2 - x)) {
      y = z;
    }
  }
  cout << x << " " << y << endl;

  return 0;
}


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


int main(){
  double d, t, v;
  
  scanf("%lf %lf %lf", &d, &t, &v);
  
  double tim = d/v;
  
  if (tim > t)
    printf("No\n");
  else
    printf("Yes\n");

  return 0;
}

Measured memory_bytes: 1724
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int a,b,c; cin>>a>>b>>c;
	cout<<((a==b&&a!=c)||(a==c&&a!=b)||(b==c&&b!=a) ? "Yes":"No")<<endl;
	return 0;
}


Measured memory_bytes: 256
a = list(map(int,input().split()))
b=int(input())
for i in range(b):
  if a[0]>=a[1]:
    a[1]=a[1]*2
  else:
    if a[1]>=a[2]:
      a[2]=a[2]*2
if a[0]<a[1]<a[2]:
  print("Yes")
else:
  print("No")


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

int main(){
    string s; cin >> s;
    int n = s.length();
    bool check = 1;
    if(s[0] != '1' || s[n-1] != '0') check = 0;
    rep(i,n/2) if(s[i] != s[n-2-i]) check = 0;
    if(!check) { cout << -1 << endl; return 0; }
    int from = 1, to = 2;
    vector<int> a1,a2;
    rep(i,n-1){
        if(s[i] == '1'){
            cout << from << " " << to << endl;
            from = to; to++;
        }
        else{
            cout << to << " " << from << endl;
            to++;
        }
    }
}

Measured memory_bytes: 3736
using Complib.Generic;
using CompLib.Util;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class Program
{

    public void Solve()
    {
        var sc = new Scanner();
        int n = sc.NextInt();
        var s = new string[n];
        for (int i = 0; i < n; i++)
        {
            s[i] = sc.Next();
        }

        Array.Sort(s, (x, y) =>
        {
            for (int i = 0; i < Math.Min(x.Length, y.Length); i++)
            {
                if (x[i] != y[i])
                {
                    return x[i].CompareTo(y[i]);
                }
            }
            return x.Length.CompareTo(y.Length);
        });

        var l = new List<string>();
        var t = s[0];
        int cnt = 0;
        int max = -1;
        foreach (var ss in s)
        {
            if (ss.Equals(t))
            {
                cnt++;
            }
            else
            {
                if (max < cnt)
                {
                    l = new List<string>();
                    max = cnt;
                }

                if (max <= cnt)
                {
                    l.Add(t);
                }

                t = ss;
                cnt = 1;
            }
        }
        if (max < cnt)
        {
            l = new List<string>();
            max = cnt;
        }
        if (max <= cnt)
        {
            l.Add(t);
        }
        Console.WriteLine(string.Join("\n", l));
    }

    public static void Main(string[] args) => new Program().Solve();
}


namespace Complib.Generic
{
    using System.Collections.Generic;
    class HashMap<K, V> : Dictionary<K, V>
    {
        public V this[K key]
        {
            set { base[key] = value; }
            get
            {
                V o;
                return TryGetValue(key, out o) ? o : base[key] = default(V);
            }
        }
    }
}

namespace CompLib.Util
{
    using System;
    using System.Linq;
    class Scanner
    {
        private int _index;
        private string[] _line;
        const char separator = ' ';

        public Scanner()
        {
            _index = 0;
            _line = new string[0];
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(separator);
                _index = 0;
            }
            return _line[_index++];
        }
        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(separator);
            _index = _line.Length;
            return _line;
        }
        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
    }
}

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

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

int main() {
    
    ll n, c, k; cin >> n >> c >> k;
    vector<ll> t(n,0); for (ll i=0; i<n; i++) cin >> t[i];

    sort(t.begin(), t.end());

    ll ans = 0, tmp_index = 0, group_num = 0;

    bool check;
    for (ll i=0; i<n; i++) {
        check = true;;
        if ((group_num<c)&&(t[i]<=t[tmp_index]+k)) {
            group_num += 1;
            if (group_num==c) {
                group_num = 0;
                tmp_index = i+1;
                ans += 1;
                check = false;
            }
        }
        else {
            ans += 1;
            group_num = 1;
            tmp_index = i;
        }
    }

    if (check) ans += 1;

    cout << ans << "\n";

    return 0;
}

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

const int MAX = 1000000;

int top, S[100];

void push(int x){
    // topを加算してからその位置へ挿入
    top++;
    S[top] = x;
}

int pop(){
    top--;
    // topが指していた要素を返す
    return S[top+1];
}

int main(){
    int a, b;
    top = 0;
    char s[100];
    
    while(scanf("%s", s) != EOF){
        if(s[0] == '+'){
            a = pop();
            b = pop();
            push(a + b);
        } else if(s[0] == '-'){
            b = pop();
            a = pop();
            push(a - b);
        } else if(s[0] == '*'){
            a = pop();
            b = pop();
            push(a * b);
        } else {
            push (atoi(s));  // 文字列を数字に変える関数atoi
        }
    }

    printf("%d\n", pop());

	return 0;
}


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

bool isAccepted = 1;
char word[4];
string input;
int freq[30] = {};

int main() {
	
	for(int i = 0 ; i < 4 ; ++i)	cin >> word[i];
	
	for(int i = 0 ; i < 4 ; ++i)	freq[word[i] - 'A']++;
	
	for(int i = 0 ; i < 30 ; ++i)
		if(freq[i] == 1 || freq[i] > 2)
			isAccepted = 0;
			
	if(isAccepted)	cout << "Yes";
	else			cout << "No";
	
	return 0;
}

Measured memory_bytes: 3544
# gcdの匂いがする

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


def gcd(a, b):
    if a > b:
        return gcd(b, a)
    while a != 0:
        a, b = b % a, a
    return b


ans = arr[0]
for i in range(1, n):
    ans = gcd(ans, arr[i])

print(ans)


Measured memory_bytes: 14228
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef double db;
const ll mod=100000;
ll dp[50][3001];
ll N,M,S;
int main()
{while(1){
	scanf("%lld%lld%lld",&N,&M,&S);
	if(!N) return 0;
	N*=N;
	memset(dp,0,sizeof(dp));
	dp[0][0]=1;
	for(ll i=1;i<=M;i++){
		for(ll j=N;j>=1;j--){
			for(ll k=i;k<=S;k++){
				dp[j][k]=(dp[j][k]+dp[j-1][k-i])%mod;
			}
		}
	}
	printf("%lld\n",dp[N][S]);
}}

Measured memory_bytes: 4356
#include <bits/stdc++.h>
using namespace std;
 
using ll=long long;
 
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
const ll mod = 1e9+7;

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

int get_prime_cnts(ll a) {
    int cnt = 0;
    for (ll i = 2; i*i <= a; ++i) {
        if (a%i == 0) {
            ++cnt; 
            while (a%i == 0) a /= i;
        }
    }
    if (a != 1) ++cnt; 
    return cnt;
}

int main() {
    ll a, b;
    cin >> a >> b;
    ll g = gcd(a, b);
    int cnt = get_prime_cnts(g) + 1;
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
class SegTreeIndex(object):
    # 区間の最小 or 最大値とその index を取得
    # 検証: https://yukicoder.me/submissions/376308
    __slots__ = ["elem_size", "tree", "default", "op", "index", "op2"]
    def __init__(self, a: list, default=float("inf"), op=lambda a,b: b if a>b else a, op2=lambda a,b:a>b):
        # 同じ場合最左のインデックスを返す
        # 最大値・最左 -> -float("inf"), max, lambda a,b:a<=b
        from math import ceil, log
        real_size = len(a)
        self.elem_size = elem_size = 1 << ceil(log(real_size, 2))
        self.tree = tree = [default] * (elem_size * 2)
        self.index = index = [0] * (elem_size * 2)
        tree[elem_size:elem_size + real_size] = a
        index[elem_size:elem_size + real_size] = list(range(real_size))
        self.default = default
        self.op = op
        self.op2 = op2
        for i in range(elem_size-1, 0, -1):
            v1, v2 = tree[i<<1], tree[(i<<1)+1]
            tree[i] = op(v1, v2)
            index[i] = index[(i<<1) + op2(v1, v2)]

    def get_value(self, x: int, y: int) -> tuple:  # 半開区間
        l, r = x + self.elem_size, y + self.elem_size
        tree, op, op2, index = self.tree, self.op, self.op2, self.index
        result_l = result_r = self.default
        idx_l = idx_r = -1
        while l < r:
            if l & 1:
                v1, v2 = result_l, tree[l]
                result_l = op(v1, v2)
                if op2(v1, v2)==1:
                    idx_l = index[l]
                l += 1
            if r & 1:
                r -= 1
                v1, v2 = tree[r], result_r
                result_r = op(v1, v2)
                if op2(v1, v2)==0:
                    idx_r = index[r]
            l, r = l >> 1, r >> 1
        result = op(result_l, result_r)
        idx = idx_r if op2(result_l, result_r) else idx_l
        return result, idx

    def set_value(self, i: int, value: int) -> None:
        k = self.elem_size + i
        self.tree[k] = value
        self.update(k)

    def update(self, i: int) -> None:
        op, tree, index, op2 = self.op, self.tree, self.index, self.op2
        while i > 1:
            i >>= 1
            v1, v2 = tree[i<<1], tree[(i<<1)+1]
            tree[i] = op(v1, v2)
            index[i] = index[(i<<1) + op2(v1, v2)]


N, M = map(int, input().split())
S = list(map(int, input()))
dp = [10 ** 9] * (N + 1)
seg = SegTreeIndex(dp)
from_ = [-10000000] * (N + 1)
seg.set_value(0, 0)
for i, c in enumerate(S[1:], 1):
    if c == 1:
        continue
    v, idx = seg.get_value(max(i - M, 0), i)
    if v == 1000000000:
        print(-1)
        exit()
    from_[i] = idx
    seg.set_value(i, v + 1)
n = seg.tree[N + seg.elem_size]
# print(seg.tree[seg.elem_size:seg.elem_size+N+1])
# print(from_)

Ans = []
v = N
while v != 0:
    v_ = from_[v]
    Ans.append(v - v_)
    v = v_
Ans.reverse()
print(" ".join(map(str, Ans)))


Measured memory_bytes: 23268
var s,r,g,b,n,t:Longint;
begin
read(r,g,b,n);
if r<g then begin
	t:=r;
	r:=g;
	g:=t;
end;
if r<b then begin
	t:=r;
	r:=b;
	b:=t;
end;
if r=1 then begin
	t:=n;
	while t>=0 do begin
		inc(s,t div g+1);
		dec(t,b);
	end;
	writeln(s);
	exit;
end;
t:=n;
while True do begin
if t<0 then begin
dec(n,b);
t:=n;
if t<0 then begin
writeln(s);
exit;
end;
end;
if t mod r=0 then inc(s);
dec(t,g);
end;
end.

Measured memory_bytes: 128
#include<bits/stdc++.h> //Ithea Myse Valgulious
namespace chtholly{
typedef long long ll;
#define re0 register int
#define rec register char
#define rel register ll
#define gc getchar
#define pc putchar
#define p32 pc(' ')
#define pl puts("")
/*By Citrus*/
inline int read(){
  int x=0,f=1;char c=gc();
  for (;!isdigit(c);c=gc()) f^=c=='-';
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return f?x:-x;
  }
inline void read(rel &x){
  x=0;int f=1;char c=gc();
  for (;!isdigit(c);c=gc()) f^=c=='-';
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  x=f?x:-x;
  }
template <typename mitsuha>
inline int write(mitsuha x){
  if (!x) return pc(48);
  if (x<0) x=-x,pc('-');
  int bit[20],i,p=0;
  for (;x;x/=10) bit[++p]=x%10;
  for (i=p;i;--i) pc(bit[i]+48);
  }
inline char fuhao(){
  rec c=gc();
  for (;isspace(c);c=gc());
  return c;
  }
}using namespace chtholly;
using namespace std;

int main(){
int a=read(),b=read(),c=read();
puts(c>=a&&c<=b?"Yes":"No");
}

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

char tab[55][55];
bool vis[55][55];
queue< pair< pair<int,int>,int > > q;
int dist[55][55];
int n,m;

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

void bfs()
{
	memset(dist,-1,sizeof(dist));
	q.push({{1,1},1});
	while (!q.empty())
	{
		pair< pair<int,int>,int > depan=q.front();
		q.pop();
		int x=depan.first.first;
		int y=depan.first.second;
		vis[x][y]=1;
		int step=depan.second;
		for (int i=0;i<4;i++)
		{
			int xx=x+dx[i];
			int yy=y+dy[i];
			if (1<=xx && xx<=n && 1<=yy && yy<=m && !vis[xx][yy] && tab[xx][yy]=='.')
			{
				q.push({{xx,yy},step+1});
				dist[xx][yy]=step+1;
				vis[xx][yy]=1;
			}
		}
	}
}

int main()
{
//	freopen("input.txt","r",stdin);
	cin>>n>>m;
	int hitam=0;
	for (int i=1;i<=n;i++)
	 for (int j=1;j<=m;j++)
	 {
	 	cin>>tab[i][j];
	 	hitam+=(tab[i][j]=='#');
	 }
	bfs();
	if (dist[n][m]==-1)
	 cout<<-1<<"\n";
	else
	 {
	 	int ans=n*m-dist[n][m]-hitam;
	 	cout<<ans<<"\n";
	 }
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    static Scanner scanner = new Scanner(System.in);

    public static void main(String[]$) {
        int n = scanner.nextInt();
        int l = scanner.nextInt();
        long[] a = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = scanner.nextInt();
        }
        int ok = -1;
        for (int i = 1; i < n; i++) {
            if (a[i - 1] + a[i] >= l) {
                ok = i;
            }
        }
        if (ok == -1) {
            System.out.println("Impossible");
        } else {
            System.out.println("Possible");
            for (int i = 1; i < ok; i++) {
                System.out.println(i);
            }
            for (int i = n - 1; i > ok; i--) {
                System.out.println(i);
            }
            System.out.println(ok);
        }
    }
}

Measured memory_bytes: 63696
#include<bits/stdc++.h>
    #define ll long long
    #define rep(i,a,b) for(i=a;i<b;i++)
    #define all(v) v.begin(),v.end()
    #define F first
    #define S second
    #define pb push_back
    #define hell 1000000007

 using namespace std;
                                                                                                                                                                                                vector < int > v[100005];
vector < pair < ll , ll > > ok;
      void solve()
        {
           ll int i,j,k,n,e=0,m,n1,n2,c=0;
     cin>>n>>m;
     if(n>=13) cout<<m;
     else if(n>5) cout<<m/2;
     else cout<<0;
        }




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

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


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

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

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

int main() {
    int n;
    cin >> n;
    vector<double> x(n);
    vector<string> u(n);
    rep(i,n) cin >> x[i] >> u[i];

    double ans = 0.0;
    rep(i,n){
        if(u[i] == "BTC") ans += x[i]*380000;
        else ans += x[i];
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <cassert>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF  9223300000000000000
#define LINF2 1223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;

using namespace std;

void solve()
{
    int a, b, c, x, y;
    scanf("%d%d%d%d%d", &a, &b, &c, &x, &y); x *= 2; y *= 2;
    int i;
    ll ans = LINF;
    for (i = 0; i <= 200000; i++) {
        ll s = (ll)i*c;
        int x2 = MAX(0,x - i), y2 = MAX(0,y - i);
        s += (ll)(x2 + 1) / 2 * a + (ll)(y2 + 1) / 2 * b;
        ans = MIN(ans, s);
    }
    printf("%lld\n", ans);
    return;
}

int main(int argc, char* argv[])
{
#if 1
    solve();
#else
    int T; scanf("%d", &T);
    while(T--) {
        solve();
    }
#endif
    return 0;
}


Measured memory_bytes: 128
from itertools import accumulate
N,Q = map(int,input().split())
S = input()
base = [0]*(N+1)
for i in range(N-1):
    if S[i] == 'A' and S[i+1] == 'C':
        base[i+1] = 1
base = list(accumulate(base))
for i in range(Q):
    l,r = map(int,input().split())
    print(base[r-1]-base[l-1])

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

int main(){
  long long x;
   cin>>x;
  long long y=100;
 
  int count = 0;
  
  while(y<x){
    y += y/100;
      count++ ;
    }
    
    cout<<count<<endl;
}
    
  
  


Measured memory_bytes: 3600
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n=I()
  q=collections.deque()
  for i in range(1,10):
    q.append(i)

  while q:
    a=q.popleft()
    n-=1

    if n==0:
      return a

    _a=a%10
    for i in range(max(0,_a-1),min(10,_a+2)):
      b=int(str(a)+str(i))
      q.append(b)

# main()
print(main())


Measured memory_bytes: 12692
#include <bits/stdc++.h>
using namespace std;
int main(){
	int a,b;	cin>>a>>b;
	vector<int> ac(a),bc(b);
	for(int i=0;i<a;i++)	cin>>ac[i];
	for(int j=0;j<b;j++)	cin>>bc[j];
	int ans=0;
	for(int i=0;i<b;i++){
		int tmp=0;
		int n=i;
		for(int j=0;j<a&&n<b;j++){
			if(bc[n]==ac[j])	tmp++,n++;
		}
		ans=max(ans,tmp);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1236
#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
const double inf = 1e-12;
struct Point {
	double x, y;
} c[N];
int vis[N];
double R[N], f[N];

double pf(double x) {
	return x * x;
}

double dis(Point A, Point B) {
	return sqrt(pf(A.x - B.x) + pf(A.y - B.y));
}

double get(int k, int j) {
	return max(0.0, dis(c[k], c[j]) - (R[k] + R[j]));
}

int main() {
	for(int i = 1; i <= 2; ++i) {
		scanf("%lf%lf", &c[i].x, &c[i].y);
		R[i] = 0;
	}
	int n;
	scanf("%d", &n);
	n += 2;
	for(int i = 1; i <= n; ++i) f[i] = 3e9;
	for(int i = 3; i <= n; ++i) {
		scanf("%lf%lf%lf", &c[i].x, &c[i].y, &R[i]);
	}
	f[1] = 0;
	for(;;) {
		int be = -1;
		for(int i = 1; i <= n; ++i) {
			if(vis[i]) continue;
			if(be == -1 || f[be] > f[i]) be = i;
		}
		if(be == -1) break;
		vis[be] = 1;
		for(int i = 1; i <= n; ++i) {
			f[i] = min(f[i], f[be] + get(i, be));
		}
	}
	printf("%.12f\n", f[2]);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<math.h>
#include<iomanip>
using namespace std;

#define PB push_back

typedef struct edge Edge;
typedef struct list List;

struct edge{
  double x,y;
  Edge* next;
};

struct list{
  Edge* head;
  Edge* tail;
};

void InitList(List*);
void Insert_edge(double,double,Edge*);
Edge* Alloc_edge();
void Calc_edge(List*);
void Print_edge(List*);

int main(int argc,char* argv[]){
  List list;
  InitList(&list);
  int n;
  
  cin>>n;
  for(int i=0;i<n;i++){
    Calc_edge(&list);
  }
  Print_edge(&list);
  return 0;
}


void InitList(List* list){
  list->head=list->tail=Alloc_edge();

  //初期点(0,0)を挿入
  Edge* tmp=list->head;
  list->head=Alloc_edge();
  list->head->x=0;
  list->head->y=0;
  list->head->next=tmp;
  //初期点(100,0)を挿入
  Insert_edge(100,0,list->head);
}

Edge* Alloc_edge(){
  return (Edge*)calloc(1,sizeof(Edge));
}

void Insert_edge(double x,double y,Edge* e){
  Edge* tmp=e->next;

  e->next=Alloc_edge();
  e->next->x=x;
  e->next->y=y;
  e->next->next=tmp;
}

void Calc_edge(List* list){
  Edge* e=list->head;
  Edge* nxt;
  double dx,dy,x,y;
  
  while(e->next!=list->tail){
    nxt=e->next;
    dx=(nxt->x)-(e->x);//まずdx,dyで二点の差分をとる
    dy=(nxt->y)-(e->y);
    dx/=3;dy/=3;//ここで三等分したときの一辺あたりの差分をとる

    Insert_edge(e->x+dx,e->y+dy,e);
    Insert_edge(e->x+dx*2,e->y+dy*2,e->next);
    x=(e->next->next->x)-(e->next->x);//追加した1つ目の座標を(a,b)２つ目を(x1,y1)とする。x=x1-a,y=y1-b
    y=(e->next->next->y)-(e->next->y);
    Insert_edge(x/2-sqrt(3)/2*y+(e->next->x),sqrt(3)/2*x+y/2+(e->next->y),e->next);//元の二点からなる直線上にない新たな一点を追加する

    e=nxt;
  }
}

void Print_edge(List* list){
  Edge* tmp=list->head;
  while(tmp!=list->tail){
    cout<<fixed<<setprecision(8)<<tmp->x<<" "<<tmp->y<<endl;
    tmp=tmp->next;
  }
}

Measured memory_bytes: 1400
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <cstring>
#include <set>
#include <map>
#include <cstdio>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define F first
#define S second
ll n,k,ans;
int main(void){
    cin>>n>>k;
    if(k==0){
        cout<<n*n<<endl;
        return 0;
    }
    for(ll i=k+1;i<=n;i++){
        ans+=(n/i)*(i-k);
        if(n%i>=k)ans+=n%i-k+1;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
while(1):
	n, x = map(int, input().split())
	t = 0
	if n == x == 0:
		break
	for i in range(1, n+1):
		for j in range(i+1, n+1):
			for k in range(j+1, n+1):
				if i+j+k == x:
					if i != j and j != k and k != i:
						t += 1
						#print(i, j, k)
	print(t)

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

//省略形
#define rep(i,n) for(auto i=0; i<n ; ++i)
#define REP(i,a,b) for(auto i=a; i<b; ++i)
#define all(v) (v).begin() , (v).end()
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvc = vector<vector<char>>;
using pii = pair<int , int>;
using pll = pair<long long , long long>;

//よく使う定数
const int INF = 1e9;
const int MOD = 1e9+7;
//逆元
const int INV = 1e9+5;

//UnionFindTree
struct union_find{
  vector<int> data;
  union_find(int size) : data(size , -1) { }

  void merge(int x , int y){
    x = root(x); y = root(y);
    if(x == y) return;
    if(data[y] < data[x]) swap(x , y);
    data[x] += data[y];
    data[y] = x;
    return; 
  }

  bool same(int x , int y){
    x = root(x) , y = root(y);
    return x == y;
  }

  int root(int x){
    return data[x] < 0 ? x : (data[x] = root(data[x]));
  }

  int size(int x){
    return -data[root(x)];
  }
};

//プロトタイプ宣言
void faster(void);
template <class T>
T get_digent(T);
template <class T>
T POW(T , T);
template <class T>
T modpow(T , T , T);
bool is_palindrome(string);

//メモ
//最大公約数:__gcd　|　最小公倍数:__lcm
//回文は反転させて一致すればよい

int main(){
  faster();
  int r;
  cin >> r;
  cout << setprecision(10) << 2*r*M_PI;
}























//同期解除
void faster(void){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}

//桁数取得
template <class T>
T get_digent(auto x){
  string s;
  s = to_string(x);
  ll digent = s.size();
  return digent;
} 

//繰り返し自乗法
template <class T>
T POW(T x, T y){
  if(y==0) return 1;
  if(y%2 == 1){
    ll temp = POW(x,y-1);
    return (temp*x);
  }
  else{
    ll temp = POW(x,y/2);
    return temp*temp;
  }
} 

//繰り返し自乗法(剰余)
template <class T>
T modpow(T x , T y , T mod){
  if(y == 0) return 1;
  if(y%2 == 1){
    ll temp = modpow(x,y-1,mod);
    return temp*x%mod;
  }
  else{
    ll temp = pow_mod(x,y/2,mod);
    return temp*temp%mod;
  }
}

bool is_palindrome(string s){
    string t(s.rbegin(),s.rend());
    return s == t;
}

Measured memory_bytes: 3760
// Author: HarshKumar

#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
const ll N = 1e6 + 6, M = 1e9 + 7;
ll lcm(ll a, ll b)
{
    return a * b / __gcd(a, b);
}
int main()
{
    ios::sync_with_stdio(false), cin.tie(nullptr);
    ll n, m, l = 1;
    cin >> n >> m;
    vector<ll> a(n);
    for (ll &e : a)
        cin >> e, e /= 2, l = lcm(l, e);
    for (ll e : a)
    {
        ll x = l;
        while (e % 2 == 0)
            e /= 2, x /= 2;
        if (x % 2 == 0)
            return cout << 0, 0;
    }
    cout << m / l - m / (2 * l);
}

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

int main(){
    int N,K;
    cin >> N >> K;
    
    vector<int> kudamono;
    rep(i,N){
        int x;
        cin >> x;
        kudamono.push_back(x);
    }
    
    sort(kudamono.begin(),kudamono.end());
    
    int ans=0;
    rep(i,K){
        ans += kudamono[i];
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 3632
#include <algorithm>
#include <climits>
#include <cmath>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
using namespace std;

const int MAX = 100001;
const int MOD = 1000000007;

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

int ceil(int x, int y) { return (x % y == 0) ? x / y : x / y + 1; }

ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

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

  int n;
  ll m;
  cin >> n >> m;
  ll a[n];
  for (int i = 0; i < n; i++) cin >> a[i];

  int count = 0;
  ll tmp = a[0] / 2;
  while (tmp % 2 == 0) {
    tmp /= 2;
    ++count;
  }

  bool check = true;
  for (int i = 1; i < n; i++) {
    int c = 0;
    tmp = a[i] / 2;
    while (tmp % 2 == 0) {
      tmp /= 2;
      ++c;
    }
    if (c != count) {
      check = false;
      break;
    }
  }

  if (!check) {
    cout << 0 << endl;
    return 0;
  }

  ll l = a[0] / 2;
  for (int i = 1; i < n; i++) {
    l = lcm(l, a[i] / 2);
    if (l > m) break;
  }

  ll ans = (m + l) / (2 * l);

  if (l <= m)
    cout << ans << endl;
  else
    cout << 0 << endl;

  return 0;
}


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

using namespace std;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long int H, W;
  cin >> H >> W;

  if (H == 1 || W == 1) {
    cout << 1 << endl;
  } else {
    cout << (H * W + 1) / 2 << endl;
  }
}


Measured memory_bytes: 3596
#include<bits/stdc++.h>
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int>P;

char s[60][30], buf[2];
int d[60][30][60][30][2];
struct st {
	int lx, ly, rx, ry, c;
	bool b;
};
bool operator<(st a, st b) {
	return a.c > b.c;
}
int C(char c) {
	if (isdigit(c))return c - '0';
	return 0;
}
int w, h;
inline void update(st p, priority_queue<st>&que) {
	for (int k = -2; k <= 2; k++) {
		for (int t = 1; t <= 3 - abs(k); t++) {
			if (p.b) {
				int nx = p.lx + k, ny = p.ly + t;
				if (0 <= nx&&nx < h && 0 <= ny&&ny < w&&s[nx][ny] != 'X') {
					int&u = d[p.lx][p.ly][nx][ny][!p.b];
					int c = p.c + C(s[nx][ny]);
					if (u > c) {
						u = c; que.push({ p.lx,p.ly,nx,ny,u,!p.b });
					}
				}
			}
			else {
				int nx = p.rx + k, ny = p.ry - t;
				if (0 <= nx&&nx < h && 0 <= ny&&ny < w&&s[nx][ny] != 'X') {
					int&u = d[nx][ny][p.rx][p.ry][!p.b];
					int c = p.c + C(s[nx][ny]);
					if (u > c) {
						u = c; que.push({ nx,ny,p.rx,p.ry,u,!p.b });
					}
				}
			}
		}
	}
}
int main() {
	while (scanf("%d%d", &w, &h), w) {
		memset(d, 0x3f, sizeof(d));
		priority_queue<st>que;
		rep(i, h)rep(j, w) {
			scanf("%s", buf); s[i][j] = buf[0];
		}
		rep(j, w) {
			int i = h - 1;
			if (s[i][j] == 'S') {
				update({ i,j,0,0,0,1 }, que); update({ 0,0,i,j,0,0 }, que);
			}
		}
		while (!que.empty()) {
			st p = que.top(); que.pop();
			if (d[p.lx][p.ly][p.rx][p.ry][p.b] != p.c)continue;
			update(p, que);
		}
		int Min = INF;
		rep(i, h)rep(j, w)rep(k, h)rep(t, w)rep(y, 2) {
			if (s[i][j] == 'T' || s[k][t] == 'T')Min = min(Min, d[i][j][k][t][y]);
		}
		if (Min == INF)puts("-1");
		else printf("%d\n", Min);
	}
}

Measured memory_bytes: 28624
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define int ll
#define double long double
#define YES {cout<<"YES"<<'\n';}
#define NO {cout<<"NO"<<'\n';}
#define Yes {cout<<"Yes"<<'\n';}
#define No {cout<<"No"<<'\n';}
#define yes {cout<<"yes"<<'\n';}
#define no {cout<<"no"<<'\n';}
void YN(bool flg){cout<<(flg?"YES":"NO")<<'\n';}
void Yn(bool flg){cout<<(flg?"Yes":"No")<<'\n';}
void yn(bool flg){cout<<(flg?"yes":"no")<<'\n';}
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
#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 out(n) {cout << n << '\n';}
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<VI> VVI;
const int MOD = 1000000007;
const long long INF = 10e10;
const double PI = acos(-1.0);
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; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
int POW(int a, int n) { int r = 1; while (n > 0) { if (n & 1)r *= a; a *= a; n /= 2; }return r; }
int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*素因数分解*/map< int, int >prime_factor(int n){map< int, int > ret;for(int i = 2; i * i <= n; i++) {while(n % i == 0) {ret[i]++;n /= i;}}if(n != 1) ret[n] = 1;return ret;}
/*約数列挙*/vector<int> divisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------ライブラリとか----------------

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(15);

    int n; cin >> n;
    YN(n==7||n==5||n==3);

    return 0;
}

Measured memory_bytes: 256