akhauriyash/Code-Regression huggingface dataset:
function gcd(arr) {
  const unit = (a, b) => b ? unit(b, a % b) : a
  let gcd = arr[0]
  for (let i = 1; i < arr.length; i++) {
    gcd = unit(gcd, arr[i]); 
  }
  return gcd;
}

function Main(input) {
  let result = 0;
  for(let a = 1; a < parseInt(input) + 1; a++) {
    for(let b = 1; b < parseInt(input) + 1; b++) {
      for(let c = 1; c < parseInt(input) + 1; c++) {
        result += gcd([a, b, c]);
      }
    }   
  }
  console.log(result);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 34628
#include <bits/stdc++.h>
using namespace std;
using lint     = long long;
const lint inf = 1LL << 60;
const lint mod = 1000000007;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    vector<vector<int>> a(3, vector<int>(3));
    for (int i = 0; i < 3; ++i) {
        for (int j = 0; j < 3; ++j) {
            cin >> a[i][j];
        }
    }
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        int b;
        cin >> b;
        for (int k = 0; k < 3; ++k) {
            for (int j = 0; j < 3; ++j) {
                if (a[k][j] == b)
                    a[k][j] = -1;
            }
        }
    }
    bool ok = false;
    for (int i = 0; i < 3; ++i) {
        int cnt = 0;
        for (int j = 0; j < 3; ++j) {
            if (a[i][j] == -1)
                cnt++;
        }
        if (cnt == 3)
            ok = true;
    }
    for (int i = 0; i < 3; ++i) {
        int cnt = 0;
        for (int j = 0; j < 3; ++j) {
            if (a[j][i] == -1)
                cnt++;
        }
        if (cnt == 3)
            ok = true;
    }
    if (a[0][0] == -1 && a[1][1] == -1 && a[2][2] == -1)
        ok = true;
    if (a[0][2] == -1 && a[1][1] == -1 && a[2][0] == -1)
        ok = true;
    if (ok)
        cout << "Yes"
             << "\n";
    else
        cout << "No"
             << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <ctype.h>
using namespace std;

int main(void) {
	int r, c;
	cin >> r >> c;
	int A[101][101];
	for (int i = 0; i <= 100; i++) {
		for (int j = 0; j <= 100; j++) {
			A[i][j] = 0;
		}
	}
	for (int i = 0; i < r; i++) {
		for (int j = 0; j < c; j++) {
			cin >> A[i][j];
			A[i][c] += A[i][j];
		}
	}
	for (int j = 0; j <= c; j++) {
		for (int i = 0; i < r; i++) {
			A[r][j] += A[i][j];
		}
	}
	for (int i = 0; i <= r; i++) {
		for (int j = 0; j <= c; j++) {
			printf("%d", A[i][j]);
			if (j != c) {
				putchar(' ');
			}
		}
		putchar('\n');
	}

	return 0;
}


Measured memory_bytes: 3264
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(X,Y) ((X)>(Y)?X=(Y),true:false)
#define chmax(X,Y) ((X)<(Y)?X=(Y),true:false)
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}
#define N 2010
string g[N];
int n, m, q, s[N][N], t1[N][N], t2[N][N];

int f(int x[N][N], int a, int b, int c, int d){
	return x[c][d]-x[a][d]-x[c][b]+x[a][b];
}

int main(){
	cin>>n>>m>>q;
	rep(i, n) cin>>g[i];
	rep(i, n) rep(j, m) s[i+1][j+1] = s[i][j+1]+s[i+1][j]-s[i][j]+g[i][j]-'0';
	rep(i, n-1) rep(j, m) t1[i+1][j+1] = t1[i][j+1]+t1[i+1][j]-t1[i][j]+(g[i][j]=='1'&&g[i+1][j]=='1');
	rep(i, n) rep(j, m-1) t2[i+1][j+1] = t2[i][j+1]+t2[i+1][j]-t2[i][j]+(g[i][j]=='1'&&g[i][j+1]=='1');
	vector<int> res(q, 0);
	rep(i, q){
		int a, b, c, d;
		cin>>a>>b>>c>>d;
		a--; b--;
		res[i] += f(s, a, b, c, d);
		res[i] -= f(t1, a, b, c-1, d);
		res[i] -= f(t2, a, b, c, d-1);
	}
	rep(i, q) cout<<res[i]<<endl;

	return 0;
}


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

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

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define NCK_MAX 510000
#define INF 1000000000000 //10^12
#define MOD 998244353
#define PB push_back
#define MP make_pair
#define F first
#define S second

const int mod = 998244353;

struct mint
{
    ll x; // typedef long long ll;
    mint(ll x = 0) : x((x % mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint &operator+=(const mint a)
    {
        if ((x += a.x) >= mod)
            x -= mod;
        return *this;
    }
    mint &operator-=(const mint a)
    {
        if ((x += mod - a.x) >= mod)
            x -= mod;
        return *this;
    }
    mint &operator*=(const mint a)
    {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const
    {
        if (!t)
            return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1)
            a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint &operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream &operator>>(istream &is, const mint &a) { return is >> a.x; }
ostream &operator<<(ostream &os, const mint &a) { return os << a.x; }


ll myPow(ll x, ll n, ll m)
{
  if (n == 0)
    return 1;
  if (n % 2 == 0)
    return myPow(x * x % m, n / 2, m);
  else
    return x * myPow(x, n - 1, m) % m;
}

ll fac[NCK_MAX], finv[NCK_MAX], inv[NCK_MAX], facn[NCK_MAX];

// テーブルを作る前処理
void COMinit()
{
  fac[0] = fac[1] = 1;
  facn[1] = NCK_MAX;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < NCK_MAX; i++)
  {
    fac[i] = fac[i - 1] * i % MOD;
    facn[i] = facn[i - 1] * (NCK_MAX - i + 1) % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}
ll modinv(ll a, ll mod)
{
  return myPow(a, mod - 2, mod);
}

// 二項係数計算
long long COM(int n, int k)
{
  if (n < k)
    return 0;
  if (n < 0 || k < 0)
    return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}



int main(int argc, char const *argv[]) {
  int n,m,k;
  cin >> n >> m >> k;
  mint ans = 0;
  COMinit();
  REP(i,k+1) {
    mint tmp = mint(m - 1).pow(n - i - 1) * m;
    ll com;
    if (i == 0){
      com = 1;
    }
    else {
      com = COM(n - 1, i);
    }

    tmp *= com;
    ans += tmp;
  }
  printf("%lld\n",ans.x);
  return 0;
}


Measured memory_bytes: 19664
#include <stdio.h>
#include <stdlib.h>
#define N 100

void push(int);
int pop();

int stack[N],top=0;
int main() {
  char S[N];
  int i,n=0,x,y,z;


  while (scanf("%s",S)!=EOF) {
    if (S[0] == '+') {
      y = pop();
      z = pop();
      push(y+z);
    }
    else if (S[0] == '-') {
      /* code */
      y = pop();
      z = pop();
      push(z-y);
    }
    else if (S[0] == '*') {
      /* code */
      y = pop();
      z = pop();
      push(y*z);
    }
    else if (S[0] >= '0' && S[0] <= '9') {
      x = atoi(S);
      push(x);
    }
  }
  printf("%d\n",stack[top] );
  return 0;
}
void push(int x){
  top++;
  stack[top] = x;
}

int pop(void){
  top--;
  return stack[top+1];
}



Measured memory_bytes: 2104
n = int(input())

ans = [0 for _ in range(n+1)]
x = 1
y = 1
z = 1

while True:
    f = x * x + y * y + z * z + x * y + y * z + z * x
    if f > n:
        if z > 1:
            y += 1
            z = 1
        elif y > 1:
            x += 1
            y = 1
        else:
            break
    else:
        ans[f] += 1
        z += 1

for i in range(1, n+1):
    print(ans[i])


Measured memory_bytes: 9272
#include <stdio.h>

int main() {
	int Zx, count = 0;
	int count1, count2;
	char Yz[104] = {};
	scanf("%d %s", &Zx, &Yz);
	if (Zx % 2 != 0) {
		printf("No");
		return 0;
	}
	int haafu = Zx / 2;
	for (int u = 0; u < haafu; u++) {
		if (Yz[u] == Yz[u + haafu]) {
			count++;
		}
	}
	count == haafu ? printf("Yes") : printf("No");

	return 0;
}

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

int main() {
	int n;
	cin>>n;
	
	int ar[n],ans=0;
	for(int i=0;i<n;i++){
		cin>>ar[i];
	}
	
	sort(ar,ar+n);
	cout<<ar[n/2]-ar[n/2-1]<<'\n';
}

Measured memory_bytes: 640
n = int(input())
v_list = list(map(int,input().split()))
v_list.sort()
v_list = v_list[::-1]
while len(v_list)!=1:
  a = v_list.pop()
  b = v_list.pop()
  v_list.append((a+b)/2)
print(v_list[0])

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'

char c[2][3];
void mainp()
{
    for(int i=0; i<2; i++)
        for(int j=0; j<3; j++) cin>>c[i][j];
        
    if(c[0][0]==c[1][2]&&c[0][1]==c[1][1]&&c[0][2]==c[1][0]) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    mainp();
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define SELECTER(_1, _2, _3, SELECT, ...) SELECT
#define REP1(i, n) for(int (i)=0; (i)<(n); (i)++)
#define REP2(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define REP(...) SELECTER(__VA_ARGS__, REP2, REP1,) (__VA_ARGS__)
#define MOD 1'000'000'007

template <class T> ostream& operator<<(ostream& os, const vector<T>& v){ os << "{"; for(size_t i=0; i<v.size(); i++) os << v[i] << (i+1==v.size() ? "" : ", "); os << "}"; return os; }
template <class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p){ return os << "{" << p.first << ", " << p.second << "}"; }

bool C(vector<long long> &A, vector<long long> &F, long long K, long long x){
    long long N = A.size();
    for(int i=0; i<N; i++){
        long long hoge = x / F[i];
        if(A[i] > hoge){
            K -= A[i] - hoge;
        }
        if(K < 0) return false;
    }
    return true;
}

int main(){
    long long N, K;
    cin >> N >> K;
    vector<long long> A(N), F(N);
    REP(i, N) cin >> A[i];
    REP(i, N) cin >> F[i];
    sort(A.begin(), A.end());
    sort(F.begin(), F.end(), greater<long long>());

    if(C(A, F, K, 0)){
        cout << 0 << endl;
        return 0;
    }

    long long ub = (*max_element(A.begin(), A.end())) * (*max_element(F.begin(), F.end()));
    long long lb = 0;
    while(ub - lb > 1){
        long long mid = (lb + ub) / 2;
        if(C(A, F, K, mid)) ub = mid;
        else lb = mid;
    }
    cout << ub << endl;
    return 0;
}

Measured memory_bytes: 3456
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause")
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
const long double pi = acos(-1);
const long double eps = 1e-10;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    init();

    int n, k; cin >> n >> k;
    VI a(n); cin >> a;

    auto dp = vec<ll>(n + 1, k + 1);
    dp[0][0] = 1;
    FOR(i, 0, n) {
        FOR(j, 0, k)dp[i][j + 1] += dp[i][j];
        eFOR(j, 0, k) {
            ll x = dp[i][j];
            if (a[i] + 1 <= j)x -= dp[i][j - a[i] - 1];
            (dp[i + 1][j] += x) %= mod;
        }
    }

    cout << dp[n][k] << "\n";
}

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

int main(){
	int n;
	int t[110000], x[110000], y[110000];
	cin >> n;

	t[0] == x[0] == y[0] == 0;
	for(int i = 0; i < n; i++){
		cin >> t[i+1] >> x[i+1] >> y[i+1];
	}

	bool can = true;
	for(int i = 0; i < n; i++){
		int dt = t[i+1] - t[i];
		int dist = abs(x[i+1]-x[i]) + abs(y[i+1]-y[i]);
		if(dt < dist) can = false;
		if(dist%2 != dt%2) can = false;
	}

	if(can) cout << "Yes" << endl;
	else cout << "No" << endl;

}

Measured memory_bytes: 1408
import java.util.*;
import java.io.*;
import static java.lang.Math.*;

public class Main {
    public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		long x = sc.nextLong();
		
		// 計算
		long result = 0;
		long a = x/11;
		int b = 0;
		if(1 <= x%11 && x%11 < 7) b = 1;
		if(7 <= x%11) b = 2;
		result = 2*a + b;
		
		
		// 出力
		System.out.println(result);
	}
	
	public static class Scanner {
		private BufferedReader br; private StringTokenizer tok;
		public Scanner(InputStream is) throws IOException { br = new BufferedReader(new InputStreamReader(is));}
		private void getLine() throws IOException { while(!hasNext()) tok = new StringTokenizer(br.readLine());}
		private boolean hasNext() { return tok != null && tok.hasMoreTokens();}
		public String next() throws IOException { getLine(); return tok.nextToken();}
		public int nextInt() throws IOException { return Integer.parseInt(next());}
		public long nextLong() throws IOException { return Long.parseLong(next());}
		public double nextDouble() throws IOException { return Double.parseDouble(next());}
	}
}


Measured memory_bytes: 25172
S = str(input())
ODD = ["R", "U", "D"]
EVEN = ["L", "U", "D"]
flag = False
for i in range(len(S)):
    if i%2 == 0:
        if not ( S[i] in ODD):
            flag = True
            print("No")
    if i%2 == 1:
        if not ( S[i] in EVEN):
            flag = True
            print("No")
    if flag == True:
        break
if flag == False:
    print("Yes")

Measured memory_bytes: 3064
#include <iostream>
#define aabi(arr) for(int i = 0; i < n; cin >> arr[i++])

using namespace std;

int main(){
    int n, ret = 0;
    cin >> n;
    int v[n], c[n];
    aabi(v);
    aabi(c);
    for(int i = 0; i < n; i++){
        if(v[i] > c[i])
            ret += v[i] - c[i];
    }
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>

int main(void)
{
    double glass_v;
    double glass_y;
    double t;
    int ans;
    
    while (scanf("%lf", &glass_v) != EOF){
        t = glass_v / 9.8;
        glass_y = 4.9 * t * t;
        ans = 1;
        while ((5 * ans) - 5 < glass_y){
            ans++;
        }
        printf("%d\n", ans);
    }
    
    return (0);
}

Measured memory_bytes: 0
// inputに入力データ全体が入る
function Main(input) {
  var a, b;
  a = Number(input.split('\n')[0].split(' ')[0]);
  b = Number(input.split('\n')[0].split(' ')[1]);
  
  console.log(Math.max(a + b, a - b, a * b));
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 11468
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl
#define show2(a, n, m) rep(i, n) { rep(j, m) {cout << a[i][j] << ' ';} cout << endl;} 
#define chmin(a, b) a = min(a, b)
#define chmax(a, b) a = max(a, b)

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<long long, long long> pll;
typedef long double ld;

const int INF = 1 << 30;
const long long INFL = 1LL << 60;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100010;

struct UnionFind {
    vector<int> par;
	vector<int> cnt;

    UnionFind(int N) : par(N), cnt(N) {
        for (int i = 0; i < N; i++) {par[i] = i; cnt[i] = 1;}
    }

    int root(int x) {
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

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

    void merge(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        par[rx] = ry;
		cnt[ry] = cnt[rx] + cnt[ry];
    }

	int count(int x) {
		return cnt[root(x)];
	}
};

int main() {
//	cout << fixed << setprecision(15);
	int n, m;
	cin >> n >> m;
	vi a(m), b(m);
	rep(i, m) {
		cin >> a[i] >> b[i];
		a[i]--; b[i]--;
	}

	int ans = 0;
	rep(i, m) {
		UnionFind uf(n);
		rep(j, m) {
			if(i == j) continue;
			uf.merge(a[j], b[j]);
		}
		if(uf.count(0) != n) ans++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include<bits/stdc++.h>
#define ll long long
using namespace std;

int root(int arr[],int i){
    while(arr[i]!=i){
         arr[i]=arr[arr[i]];
        i=arr[i];
    }
    return i;
}
void Union(int arr[],int Size[],int a,int b){
int rootA=root(arr,a);
int rootB=root(arr,b);
if(Size[rootA]<Size[rootB]){
    arr[rootA]=arr[rootB];
    Size[rootB]+=Size[rootA];
}else{
arr[rootB]=arr[rootA];
Size[rootA]+=Size[rootB];
}
}
bool findRoot(int a,int b,int arr[]){
 if(root(arr,a)==root(arr,b))return true;
 else return false;
}

bool nCyc=false;
/*void dijkstra(int v,long long dis[]){
dis[v]=0;
multiset<pair<int,int> >s;
s.insert({0,v});
while(!s.empty()){
    pair<int,int>p= *s.begin();
    s.erase(s.begin());
    int x=p.second;
  if(vis[x])continue;
    vis[x]=1;
    for(int i=0;i<adj[x].size();i++){
        int e=adj[x][i].first,w=adj[x][i].second;
      //  cout<<dis[e]<<" "<<dis[x]+w<<endl;
        if(dis[e]>dis[x]+w){
            dis[e]=dis[x]+w;
            s.insert(make_pair(dis[e],e));
        }
    }
}
}*/
/*void bfs(int s){
    queue<int>q;
    q.push(s);
    while(!q.empty()){
        int v=q.front();
        q.pop();
        for(int i=0;i<adj[v].size();i++){
            if(!vis[adj[v][i]]){
                 q.push(adj[v][i]);
                 vis[adj[v][i]]=1;
            }
        }
    }
}*/

int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};
/*bool isVal(int i,int j){
      if(i<0 || j<0 || j>=m || i>=n)return false;
      return true;
}*/
/*void dfs(int i,int j) {

    if(!isVal(i,j) || vis[i][j] || arr[i][j]=='#')return;
      vis[i][j]=1;
	  if(arr[i][j]=='G'){
	  check++;
	  }
	  if(arr[i][j]=='B'){
        b=1;
        return;
	  }
	for(int k=0;k<4;k++){
     int pos1=i+dx[k],pos2=j+dy[k];
   //  cout<<pos1<<" "<<pos2<<endl;
     if( isVal(pos1,pos2) && (arr[pos1][pos2]=='#'))continue;
               dfs(pos1,pos2);
	}
}
void dfs2(int i,int j){
 if(isVal(i,j)==false || arr[i][j]!='.')return;
  arr[i][j]='#';
}*/
/*
double prim(int x){
    priority_queue<pair<double,int>,vector<pair<double,int> >,greater<pair<double,int> > >q;
    double min_cost=0.0;
    pair<double,int>p;
     q.push(make_pair(0.0,x));
     while(!q.empty()){
      p=q.top();
      q.pop();
      x=p.second;
      if(vis[x])continue;
      min_cost+=p.first;
      vis[x]=1;
      for(int i=0;i<adj[x].size();i++){
         int y=adj[x][i].second;
         if(!vis[y]){
            q.push(adj[x][i]);
        }
      }
     }
   return min_cost;
}*/


bool check(int i,int mask){
    return(mask&(1<<i))!=0;
}

int setBit(int i, int mask){
    return (mask | (1<<i));
}
long long solve(int i,int mask,int cnt){
   return 0;
}
int main()
{
//freopen("diamond.in", "r", stdin);
//freopen("diamond.out","w", stdout);
string s,t;
cin>>s>>t;
int cnt=0;
for(int i=0;i<t.length();i++){
    if(s[i]!=t[i])cnt++;
}
cout<<cnt;
return 0;

}



Measured memory_bytes: 3904
#include<bits/stdc++.h>
using namespace std;
const int INF=1e9;
const int MOD=1e9+7;
typedef pair<int,int> pii;
typedef long long ll;
template<typename A,size_t N,typename T>
void Fill(A (&array)[N],const T &val)
{
    std::fill( (T*)array,(T*)(array+N),val );
}

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

int main(void)
{
    int N;
    int X[105];
    cin >> N;
    int ans=1e9,sum=0;
    for(int i=0;i<N;i++)
    {
        cin >> X[i];
    }
    for(int meet=0;meet<=100;meet++)
    {
        sum=0;
        for(int j=0;j<N;j++)
        {
            sum+=(X[j]-meet)*(X[j]-meet);
        }
        ans=min(ans,sum);
    }
    cout << ans << endl;

}

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

int main() {
    int N;
    int d[110];
    cin >> N;
    for(int i=0; i< N; i++) cin >> d[i];

    int num[110] = {0};
    for(int i=0;i<N;i++){
        num[d[i]]++;
    }

    int res = 0;
    for(int i=1;i<=100; i++){
        if(num[i]){
            res++;
        }
    }
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<vector>
using namespace std;
int n, T;
int main(){
  cin >> n >> T;
  int c, t;
  vector<int> m(0);
  for(int i = 0; i < n; i++){
    cin >> c >> t;
    if(t <= T){
      m.push_back(c);
    }
  }
  int k = m.size();
  if(k == 0) cout << "TLE" << endl;
  else {
    sort(m.begin(), m.end());
    cout << m.front() << endl;
  }
}

Measured memory_bytes: 256
N=int(input())
xy=[list(map(int,input().split())) for _ in range(N)]

def parity():
  res=sum(xy[0])%2
  for x,y in xy:
    if (x+y)%2!=res:
      return -1
  return res
 
p=parity()
if p==-1:
  print(-1)
  exit()

dd=[1]
if p==0:dd.append(1)
lim=10**12
while len(dd)<40 and dd[-1]*2<=lim:
    dd.append(dd[-1]*2)
print(40)
print(*dd)
 
for x,y in xy:
  ans=""
  for d in dd[::-1]:
    if abs(x)>abs(y):
      if x>0:
        x-=d
        ans+="R"
      else:
        x+=d
        ans+="L"
    else:
      if y>0:
        y-=d
        ans+="U"
      else:
        y+=d
        ans+="D"
  print(ans[::-1])

Measured memory_bytes: 9348
<?php 
	for($i=0;$i<10;$i++)fscanf(STDIN,"%d",$ar[]);
	$a=0;
	$b=0;
	$c=0;
	for($i=0;$i<10;$i++){
		if($ar[$i]>$a){
			$c=$b;
			$b=$a;
			$a=$ar[$i];
		}
		else if($ar[$i]>$b){
			$c=$b;
			$b=$ar[$i];
		}
		else if($ar[$i]>$c){
			$c=$ar[$i];
		}
	}
	print "$a\n$b\n$c";
?>

Measured memory_bytes: 6564
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;

int main() {
  int A, B;
  cin >> A >> B;

  if(B%A==0) {
    cout << B/A << endl;
  }
  else {
    cout << B/A + 1 << endl;
  }

  return 0;
}



Measured memory_bytes: 3124
#include <stdio.h>
int main()
{
    int hour_1;
    int hour_2;
    int min_1;
    int min_2;
    int k;
    scanf("%d %d %d %d %d", &hour_1, &min_1, &hour_2, &min_2, &k);
    int total_hour = hour_2 - hour_1;
    int total_minute = min_2 - min_1;
    int duration = (total_hour * 60) + total_minute - k;
    printf("%d\n", duration);
}

Measured memory_bytes: 1700
#include <bits/stdc++.h>
using namespace std;
#define mod 998244353
#define MOD 1000000007
#define inf 0x3f3f3f3f
#define linf 0x3f3f3f3f3f3f3f3fll
typedef long long ll;
typedef pair<int,int> pii;
typedef unsigned long long ull;
const int maxt=(1<<16)+10;
int n;
ll a[20][20];
ll val[maxt];
int p[maxt];
int main()
{
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			scanf("%lld",&a[i][j]);
		}
	}
	for(int i=0;i<(1<<n);i++)
	{
		for(int j=0;j<n;j++)if(i>>j&1)
		{
			p[i]++;
			for(int k=j+1;k<n;k++)if(i>>k&1)
			{
				val[i]+=a[j][k];
			}
		}
	}
	for(int i=0;i<(1<<n);i++)
	{
		if(p[i]<2)continue;
		for(int j=i;j;j=(j-1)&i)
		{
			if(j==i)continue;
			val[i]=max(val[i],val[j]+val[i-j]);
		}
	}
	printf("%lld\n",val[(1<<n)-1]);
	return 0;
}

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

long next(long time, long f) {
  if (time % f == 0) return time;
  else return time + f - time % f;
}
int main() {
  int n;cin>>n;
  int c[n-1],f[n-1];
  long s[n-1];
  rep(i,n-1) cin>>c[i]>>s[i]>>f[i];
  
  long time;
  rep(i,n-1) {
    time=s[i];
    rep(j,n-1) {
      if (j<i) continue;
      time = max(s[j], next(time,f[j])) + c[j];
      
    }
    cout << time << endl;
  }
  cout << 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<ll> ql;
typedef deque<ll> dql;
typedef priority_queue<ll/*, vl, greater<ll>*/> pql; //降順(/*昇順*/)
typedef set<ll> sl;
typedef pair<ll, ll> pl;
typedef vector<vl> vvl;
typedef vector<pl> vpl;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rep2(i, n) for(ll i = 1; i <= ll(n); i++)
//#define rep(i, k, n) for(ll i = k-1; i < ll(n); i++)
//#define rep2(i, k, n) for(ll i = k; i <= ll(n); i++)
#define all(v) (v).begin(), (v).end()
bool chmin(ll &a, ll b) {if(b < a) {a = b; return 1;} return 0;}
bool chmax(ll &a, ll b) {if(b > a) {a = b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
const ll MAX = 1e9;
const char newl = '\n';

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

  ll h, w, k, ans=0;
  cin >> h >> w >> k;
  vvl b(h, vl(w));
  char c;
  ll cntt=0;
  rep(hh, h) rep(ww, w) {
    cin >> c;
    if(c=='#') b[hh][ww] = 1;
  }
  
  rep(i, 1LL << h) rep(j, 1LL << w) {
    ll cnt = 0;
    vector<bool> column(h, 1), row(w, 1);
    rep(l, h) if(i & 1LL << l) column[l] = 0;
    rep(l, w) if(j & 1LL << l) row[l] = 0;
    rep(hh, h) rep(ww, w) if(column[hh] and row[ww]) cnt += b[hh][ww];
    if(cnt==k) ans++;
  }
  cout << ans << newl;
  return 0;
}

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

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

  int j = k;
  for (int i = min(a, b); i >= 1; i--) {
    if (a % i == 0 && b % i == 0) {
      if (j == 1) {
        cout << i << endl;
        return 0;
      }
      j--;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

ll dfs(ll a, ll b){
  if(a==0){
    if(b>0) return 1;
    return 0;
  }
  if(b<=(ll)pow(2, a+1)-2) return dfs(a-1, b-1);
  return (ll)pow(2, a) + dfs(a-1, b- pow(2, a+1) + 1);
}
  

int main(){
  ll N; ll X; cin >> N >> X;
  cout << dfs(N, X) << endl;
}

  

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector< vector<int> > VVI;
typedef vector< vector<int> > VVL;
typedef pair<int,int> PII;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb push_back
#define mp make_pair

int main(){
  int N;
  cin>>N;
  vector<string> S(N);
  rep(i,N) cin>>S[i];
  map<string,int> M;
  rep(i,N) M[S[i]]++;
  auto X=M.begin();
  int A=0;
  rep(i,M.size()){
    if(A<X->second) A=X->second;
    X++;
  }
  X=M.begin();
  rep(i,M.size()){
    if(X->second==A) cout<<X->first<<endl;
    X++;
  }
}

Measured memory_bytes: 27264
#include <iostream>

int main()
{
    int n;
    while(std::cin >> n) {
        int ans = 0;
        for(int a = 0; a < 10; a++) {
            for(int b = 0; b < 10; b++) {
                for(int c = 0; c < 10; c++) {
                    for(int d = 0; d < 10; d++) {
                        if(a + b + c + d == n) {
                            ans++;
                        }
                    }
                }
            }
        }
        std::cout << ans << std::endl;
    }
    return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <string>

using namespace std;

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

    while (!s.empty()) {
        s.erase(s.size()-1);
        int ssize = s.size();
        if (ssize % 2 == 0) {
            int shalf = ssize / 2;
            for (int i = 0; i < shalf; i++) {
                if (s[i] != s[shalf + i]) {
                    break;
                }
                if (i == shalf - 1) {
                    cout << ssize << endl;
                    return 0;
                }
            }
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(v, a, b) for(int v = (a); v < (b); ++v)
#define FORE(v, a, b) for(int v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define RS resize
#define CLR clear
#define PB push_back
#define ALL(x) (x).begin(), (x).end()
using namespace std;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int h1, m1, s1, h2, m2, s2;
	
	REP(i, 3){
		cin >> h1 >> m1 >> s1 >> h2 >> m2 >> s2;
		
		int d = (h2 * 60 * 60 + m2 * 60 + s2) - (h1 * 60 * 60 + m1 * 60 + s1);
		
		cout << d / 3600 << " " << (d - (d / 3600) * 3600) / 60 << " " << d % 60 << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1192
#include <iostream>
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
using namespace std;
using namespace mp;

int main() {
	int n;
	cpp_int a, b, sum;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a >> b;
		sum = a + b;
		string str = sum.str();
		if (str.length() > 80) cout << "overflow" << endl;
		else cout << a + b << endl;
	}
	return 0;
}


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

int main(void) {
	int n, i, *sc, t;
	double a, v;
	while (1) {
		scanf("%d", &n);
		if (n == 0) break;
		sc = (int*)calloc(n, sizeof(int));
		t = 0;
		v = 0.0;
		for (i = 0; i < n; i++) {
			scanf("%d", sc + i);
			t += sc[i];
		}
		a = (double)t / (double)n;
		for (i = 0; i < n; i++) {
			v += ((double)sc[i] - a) * ((double)sc[i] - a);
		}
		printf("%lf\n", sqrt(v / (double)n));
		free(sc);
	}
	return 0;
}

Measured memory_bytes: 644
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i,n) for(int i = 0; i < n; i++)
const long long int MOD = 1000000007;

const int M = 1000005;

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

	int n;
	cin >> n;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	sort(a.begin(), a.end());
	vector<int> cnt(M);
	for (int x : a) {
		if (cnt[x] != 0) {
			cnt[x] = 2;
			continue;
		}
		for (int i = x; i < M; i += x) cnt[i]++;
	}
	int ans = 0;
	for (int x : a) {
		if (cnt[x] == 1) ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 7952
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define MOD 1000000007
#define INF 1 << 30

using namespace std;
typedef long long ll;

int main(void) {
	int num, i, k, q, a;
	cin >> num >> k >> q;
	vector<int> d(num + 1, 0);
	for (i = 0; i < q; i++) {
		scanf("%d", &a);
		d[a]++;
	}
	for (i = 1; i <= num; i++) {
		if (q - d[i] >= k)
			printf("No\n");
		else
			printf("Yes\n");
	}
	return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<class T>
istream& operator >> (istream& is, vector<T>& v)
{
	for (auto &i : v) is >> i;
	return is;
}
template<class T>
ostream& operator<<(ostream& os, vector<T>& v)
{
	const string delimiter = "\n";
	REP(i, v.size())
	{
		os << v[i];
		if (i != v.size() - 1) os << delimiter;
	}
	return os;
}
/*--------------------template--------------------*/

int n;
string s;

pii sim(int p)
{
	int l = p - 1, r = p + 1;
	int cnt = 0;
	while (1)
	{
		if (p == -1)
		{
			return pii(cnt, 1);
		}
		if (p == n)
		{
			return pii(cnt, 0);
		}
		cnt++;
		if (s[p] == '>')
		{
			p = r;
			r++;
		}
		else
		{
			p = l;
			l--;
		}
	}
}

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	cin >> n >> s;
	int lb = 0, ub = n;
	int ans = 0;
	while (ub - lb > 1)
	{
		int mid = (ub + lb) / 2;
		auto res = sim(mid);
		chmax(ans, res.first);
		if (res.second == 0) ub = mid;
		else lb = mid;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3344
s = input()
highest, high, h, mh = [0], [0], 0, 0
for i in range(len(s)):
    if s[-i-1] == '\\':     h += 1
    elif s[-i-1] == "/":    h -= 1
    
    if mh < h:  mh = h
    
    high.append(h)
    highest.append(mh)

high, highest = high[::-1], highest[::-1]
puddle, h = [], high[0]
v, vsum = 0, 0
for i in range(1, len(s) + 1):
    h = min(h, highest[i])
    if high[i] < h:
        if s[i-1] != "_":
            v -= 0.5
        v += h - min(high[i-1], high[i])
    elif v != 0:
        v = int(v + 0.5)
        puddle.append(v)
        vsum += v
        v, h = 0, high[i]
    else:
        h = high[i]
        
print(vsum)
if len(puddle) != 0:
    print(len(puddle), ' '.join(list(map(str, puddle))))
else:
    print(0)


Measured memory_bytes: 6692
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define mx 100000
#define md 1000000007ll
#define prMX 10000000
ll prime[prMX+2];
bool vis[prMX+2];
#define MX 10000000000000ll

int main(){
    ll r,d,x;
    cin>>r>>d>>x;
    ll ans[12];
    ans[0] =x;
    for(int i=1;i<=10;i++){
        ans[i] = ans[i-1]*r-d;
    }

    sort(ans+1,ans+10+1);
    for(int i=1;i<=10;i++)cout<<ans[i]<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int const N = 1e5 + 5;
int a[N];
int n;
int dp[N];
void iterative_dp(){
    dp[n] = dp[n+1] = 0;
    for(int i=n-2; i>=0; i--){
        if(i == n-2)
            dp[i] = dp[i+1] + abs(a[i]-a[i+1]);
        else
            dp[i] = min(dp[i+1] + abs(a[i]-a[i+1]) , dp[i+2]  + abs(a[i]-a[i+2]) );
    }
}

int main() {
#ifdef ONLINE_JUDGE
    ios::sync_with_stdio(false), cin.tie(0);
#endif
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    cin>>n;
    for(int i=0; i<n; i++)
        cin>>a[i];
    iterative_dp();
    cout<<dp[0]<<'\n';
}


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

int main() {
  int n, m, x;
  cin >> n >> m >> x;
  int a, r_cost, l_cost;
  r_cost = 0;
  l_cost = 0;
  int i;
  for (i = 0; i < m; i++) {
    cin >> a;
    (a < x ? r_cost++ : l_cost++);
  }
  cout << min(r_cost, l_cost) << 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 = Integer.parseInt(sc.nextLine());
    boolean first = true;
    boolean check = false; //true = +, false = -,
    int count = 1;
    int n = Integer.parseInt(sc.next());;
    for(int i = 0; i < N-1; i++){
      int m = Integer.parseInt(sc.next());
      if(first){
        if(n > m){
          check = true;
          first = false;
          n = m;
        }else if(n < m){
          check = false;
          first = false;
          n = m;
        }
      }else{
        if(check){
          if(n > m){
            n = m;
          }else if(n < m){
            count++;
            first = true;
            n = m;
          }
        }else{
          if(n < m){
            n = m;
          }else if(n > m){
            count++;
            first = true;
            n = m;
          }
        }
      }
    }
    System.out.println(count);
  }
}

Measured memory_bytes: 45096
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = 1; i <= n; i++)
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); }
using P = pair <int, int>;
 
ll MOD = 1000000007;
ll INF =1<<29;
 
int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n)cin >> a[i];
    rep (i,n) a[i]++;
    vector<int> b(n),c(n);
    rep(i,n){
        b[i]=a[i]-1;
        c[i]=a[i]+1;
    }
    vector<int> cnt(100100);
    rep(i,n){
        cnt[a[i]]++;
        cnt[b[i]]++;
        cnt[c[i]]++;
    }
    int ans =0;
    rep(i,100100){
        ans = max(ans,cnt[i]);
    }
    cout << ans <<endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	int ii=1,f=0;
	long long temp1=1;
	long long a,temp2;
	cin>>n;
	for(ii=1;ii<=n;ii++)
	{
		cin>>a;
		if(f==0)
		{
//			if(a==0)
//			{
//				cout<<0;
//				return 0;
//			}
			
			temp2=temp1*a;

			if(temp2<temp1 && a!=0)
			{	
				temp1=-1;
				f=1;
			}
			else
				temp1=temp2;			
		}
		else
		{
			if(a==0)
			{
				cout<<0;
				return 0;
			}
			else
				temp1=-1;
		}	
	}
	
	if(temp1>1000000000000000000)
		cout<<-1;
	else
		cout<<temp1;			
	return 0;
}

Measured memory_bytes: 3632
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, c, k int
	fmt.Scan(&n, &c, &k)
	t := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&t[i])
	}
	sort.Ints(t)

	ans := 0
	r := t[0] + k
	s := 1
	for i := 1; i < n; i++ {
		s++
		if r < t[i] || c < s {
			ans++
			r = t[i] + k
			s = 1
		}
	}
	fmt.Println(ans + 1)
}


Measured memory_bytes: 5504
import sys
input = sys.stdin.readline
N = int(input())
e = [[] for _ in range(N + 1)]
for _ in range(N - 1):
  u, v = map(int, input().split())
  e[u].append(v)
  e[v].append(u)

s = [1]
color = [0] * (N + 1)
color[1] = 1
while len(s):
  x = s.pop()
  for y in e[x]:
    if color[y]:
      if color[x] == color[y]: break
      continue
    s.append(y)
    color[y] = color[x] ^ 2
  else: continue
  print("No")
  exit(0)
res = [-1] * (N + 1)
mx = 0
for _ in range(int(input())):
  v, p = map(int, input().split())
  res[v] = p
  mx = max(mx, p)
table = [[] for _ in range(mx + 1 + N + 1)]
for i in range(N + 1):
  if res[i] != -1: table[res[i]].append(i)

for i in range(mx + N + 1):
  while len(table[i]):
    x = table[i].pop()
    for y in e[x]:
      if res[y] == -1:
        res[y] = res[x] + 1
        table[i + 1].append(y)
      elif abs(res[x] - res[y]) != 1:
        break
    else: continue
    break
  else: continue
  break
else:
  print("Yes")
  for r in res[1: ]: print(r)
  exit(0)
print("No")

Measured memory_bytes: 146616
n = int(input())
sLst = list(input())
alphaLst = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
ans = str()

if n == 26:
    n = 0

for s in sLst:
    idx = alphaLst.index(s) + n
    if idx >= 26:
        idx -= 26
    ans = ans + alphaLst[idx]

print(ans)


Measured memory_bytes: 3316
#include<algorithm>
#include<iostream>
using namespace std;
long long Q,H,S,D,N,ans;
int main()
{
    cin>>Q>>H>>S>>D>>N;
    ans=(N%2==0)?(min(min(min(Q*8,H*4),S*2),D)*N/2):(min(min(Q*4,H*2),S)+min(min(min(Q*8,H*4),S*2),D)*(N-1)/2);
    cout<<ans<<endl;
    return 0;
}

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

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}

void code() {
    ll n,x,t;
    cin>>n>>x>>t;
    ll ans=(ll)ceil(double(n)/x);
    ans*=t;

    cout << ans << "\n";
}

signed main() {
    std::ios_base::sync_with_stdio(false);
    ll t=1;
    // cin>>t;
    for(ll i=0; i<t; i++) {
        code();
    }
}


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


int main() {
    int N;
    cin >> N;
    string w;
    cin >> w;
    char last = w.at(w.size() - 1);
    vector<string> used;
    used.push_back(w);
    bool ans = true;
    rep(i, N - 1){
        cin >> w;
        if (last != w.at(0)) ans = false;
        last = w.at(w.size() - 1);
        used.push_back(w);

    }
    sort(used.begin(), used.end());
    string tmp = used.at(0);
    for(int i = 1; i < N; i++){
        if (tmp == used.at(i)) ans = false;
        tmp = used.at(i);
    }
    if (ans) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

#define ll long long
#define reg register
#define rep(i, a, b) for (reg int i = (a), i##end = (b); i <= i##end; ++i)
#define dep(i, a, b) for (reg int i = (a), i##end = (b); i >= i##end; --i)

template <typename _typer> inline _typer read() {
	_typer init = 0;
	char ch = getchar(), k = 0;
	for ( ; !isdigit(ch); ch = getchar()) k = (ch == '-');
	for ( ; isdigit(ch); ch = getchar()) init = (init << 3) + (init << 1) + (ch ^ 48);
	return k ? -init : init;
}
const ll N = 25, INF = 1e9;

/*******************************************************************************
 *
 *
 *
 ******************************************************************************/

int n, A[N];

int main() {
	cin >> n;
	rep (i, 1, n) cin >> A[i];
	int Ans = 0;
	rep (i, 2, n - 1) {
		int Q[10];
		Q[0] = A[i - 1], Q[1] = A[i], Q[2] = A[i + 1];
		sort(Q, Q + 3);
		if (Q[1] == A[i]) ++Ans;
	}
	cout << Ans << endl;
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <list>

using ll = long long;
using ld = long double;
using namespace std;
const int INF = 1e9+100;
const ll INF64 = 7e18l;
const int mod = 1000000007;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(), (a).end()
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);


int main(){
    FIN;
    ll n; cin >> n;
    ll a;
    map<int,int> A;
    for(int i=2;i<=n;i++){
        cin >> a;
        A[a]++;
    }

    for(int i=1;i<=n;i++){
        if(A[i] > 0) cout << A[i] << endl;
        else cout << 0 << endl;
    }
    
    return 0;
}


Measured memory_bytes: 13032
#include<bits/stdc++.h>
using namespace std;
int N, M;

int main()
{
    cin >> N >> M;
    for(int i=0; i<M+2; ++i) cout <<'#';
    cout << endl;
    for(int i=0; i<N; ++i)
    {
        string s; cin >> s; cout << '#' << s << '#' <<endl;
    }    
    for(int i=0; i<M+2; ++i) cout <<'#';
    cout << endl;
}

Measured memory_bytes: 256
input()
A=[0]+list(map(int,input().split()))
H=len(A)
def h(i):
 l=2*i;r,g=l+1,[i,l][l<H and A[i]<A[l]]
 if r<H and A[g]<A[r]:g=r
 if g!=i:A[i],A[g]=A[g],A[i];h(g)
for i in range(H//2,0,-1):h(i)
print(' '+' '.join(map(str,A[1:])))


Measured memory_bytes: 65080
#include <iostream>
#include <algorithm>
#include <string>
#include <functional>

using namespace std;

class Team{
public:
	string name;
	int win;
	int lose;
	int draw;
	int point;

};
bool operator<( const Team& rhs, const Team& lhs ){
	return ( rhs.point < lhs.point );
}
bool operator>( const Team& rhs, const Team& lhs ){
	return ( rhs.point > lhs.point );
}
int main(int argc, char const* argv[])
{
	int num;
	Team team[10];
	bool a = false;

	while( cin >> num && num != 0 ){
		if( a == true ) cout << endl;
		a = true;
		for( int i = 0;i < num;i++ ){
			cin >> team[i].name >> team[i].win >> team[i].lose >> team[i].draw;
			team[i].point = team[i].win * 3 + team[i].draw;
		}
		stable_sort( team, team + num, greater<Team>() );
		for( int i = 0;i < num;i++ ) cout << team[i].name << "," << team[i].point << endl;
	}
	return 0;
}

Measured memory_bytes: 0
//Triangle

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define nvarep(n,a) ll n;cin>>n;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define vecrep(n,a,type) vector<type>a(n);rep(i,0,n)cin>>a[i]
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
using p = pair<ll, string>;
using graph = vector<vector<ll>>;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

signed main (){
    int s;cin>>s;
    int m = 1000000000;
    int t = ceil((double)s/(double)m);
    cout<<"0 0 1"<<spa<<m<<spa<<t<<spa<<t*m-s<<nnn;
    return 0;
}

Measured memory_bytes: 3700
#include<bits/stdc++.h>
#define mod 1000000007
#define mod1 998244353
#define Mmax 1000005
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long int li;
typedef unsigned long long int ull;
using namespace std;
bool sortbysec(const pair<li,li>&a,const pair<li,li>&b)
{
    return (a.second<b.second);
}
bool comp(pair<li,pair<li,li>>a,pair<li,pair<li,li>>b)
{
  if(a.first<b.first)
  return 1;
  else if(a.first>b.first)
  return 0;
  else
  {
    return a.second.first<b.second.first;
  }
}
li mpow(li x,li y)
{
  li ans=1;
  while(y)
  {
    if(y%2!=0)
    ans=(ans%mod)*(x%mod)%mod;
    y/=2;
    x=((x%mod)*(x%mod))%mod;
  }
  return ans;
}
void bfs(vector<li>v[],li visit[],li s,li ans[])
{
  deque<li>q;
  q.push_back(s);
  visit[s]=1;
  while(!q.empty())
  {
    li x=q.front();
    q.pop_front();
    for(auto i=v[x].begin();i!=v[x].end();i++)
    {
      if(!visit[*i])
      {
        q.push_back(*i);
        visit[*i]=1;
      }
    }
  }
}
void dfs(vector<li>v[],li visit[],li s)
{
  visit[s]=1;
  cout<<s<<" ";
    for(auto i=v[s].begin();i!=v[s].end();i++)
    {
      if(!visit[*i])
      {
        dfs(v,visit,*i);
      }
    }
}
vector<li>factor(li n)
{
  vector<li>v;
  if(n%2==0)
  {
    while(n%2==0)
    n/=2;
    v.push_back(2);
  }
  for(li i=3;i<=sqrt(n);i+=2)
  {
    if(n%i==0)
    {
      while(n%i==0)
      n/=i;
      v.push_back(i);
    }
  }
  if(n>1)
  v.push_back(n);
  return v;
}
int main()
{
fast_io
li n;
cin>>n;
map<string,li>m;
while(n--)
{
  string s;
  cin>>s;
  m[s]++;
}
cout<<m.size();
return 0;
}


Measured memory_bytes: 19276