akhauriyash/Code-Regression huggingface dataset:
from sys import exit

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))


def main():
    n,a,b = mi()
    if not (b-a)%2:
        print((b-a)//2)
    else:
        print(min(a-1,n-b)+(b-a)//2+1)
    


    
main()


Measured memory_bytes: 2940
#include<bits/stdc++.h>
#define ll unsigned long long
#define pii_ pair<int,int>
#define mp_ make_pair
#define pb push_back
#define fi first
#define se second
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define show1(a) cout<<#a<<" = "<<a<<endl
#define show2(a,b) cout<<#a<<" = "<<a<<"; "<<#b<<" = "<<b<<endl
using namespace std;
const ll INF = 1LL<<60;
const int inf = 1<<30;
const int maxn = 2e5+5;
inline void fastio() {ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);}
ll a[maxn];
int main()
{
    fastio();
    int n;
    cin>>n;
    ll ans = 1,lim = 1e18;
    rep(i,1,n) cin>>a[i];
    int flag = 1;
    rep(i,1,n) if(a[i]==0) {cout<<0<<endl;return 0;}
    rep(i,1,n){
        if(lim/a[i] < ans) {flag=0;break;}
        ans = ans*a[i];
    }
    if(flag==1) cout<<ans<<endl;
    else cout<<-1<<endl;
    return 0;
}


Measured memory_bytes: 4420
#include <algorithm>
#include <cstdint>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <cfloat>

using namespace std;

using lint=int64_t;
using uint=uint32_t;
using ulint=uint64_t;

template<class T>
using vector2d=vector<vector<T>>;

template<class T>
bool UpdateMax(T &a, const T &b){
  if(a<b){
    a=b;
    return true;
  }else{
    return false;
  }
}

template<class T>
bool UpdateMin(T &a, const T &b){
  if(a>b){
    a=b;
    return true;
  }else{
    return false;
  }
}

template <class T>
void OutVec(const vector<T>& vec){
  for(int i = 0; i < vec.size() - 1; ++i){
    cout<<vec[i]<<" ";
  }
  cout<<vec.back()<<endl;
}

template <class T>
void OutVec2d(const vector2d<T>& vec){
  for(auto v:vec){
    OutVec(v);
  }
}

int main(){
  cout << std::fixed << std::setprecision(16);
  cin.tie(nullptr);
  std::ios::sync_with_stdio(false);

  int n;
  cin>>n;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
  }

  std::sort(a.begin(), a.end(), std::greater<>());
  lint result=a[0];
  int itr=1;
  for(int placed=3;placed<=n;placed++){
    result+=a[itr];
    if(placed%2==0){
      itr++;
    }
  }
  cout<<result<<endl;

  return 0;
}




Measured memory_bytes: 3992
/* BISMILLAHIR RAHMANIR RAHIM */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

const ll inf = 1e14;
const int mxn = 1e3 + 3;
int n, w, W[102], V[102];
ll dp[102][mxn * 102];

int main() {
	ios_base :: sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	cin >> n >> w;
	int sm = 0;
	for(int i = 1; i <= n; i++) {
		cin >> W[i] >> V[i];
		sm += V[i];
	}
	
	for(int i = 0; i <= n; i++) {
		for(int j = 0; j <= sm; j++) {
			dp[i][j] = inf;
		}
	}

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

	for(int i = 1; i <= n; i++) {
		for(int j = 1; j <= sm; j++) {
			dp[i][j] = dp[i - 1][j];
			if( j >= V[i] ) 
				dp[i][j] = min(dp[i][j], W[i] + dp[i - 1][j - V[i]]);
		}
	}

	for(int j = sm; j > 0; j--) {
		for(int i = 0; i <= n; i++) {
			if( dp[i][j] > w or dp[i][j] == 0 ) continue;
			cout << j << "\n";
			exit(0);
		}
	}
} 

Measured memory_bytes: 80896
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;

signed main() {
	string S;
	int ans = 0;
	cin >> S;
	for (int i = 0; i < 3; i++) {
		if (S.at(i) == '1') ans++;
	}
	cout << ans << endl;
}

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

ll choose(ll n, ll k) {
    if (k == 0) return 1;
    return (n * choose(n-1, k-1)) / k;
}

ll combination(int n, int r) {
    if(n < r)
        return 0;
    if(n-r < r)
        r = n-r;
    long long ret = 1;
    for(int i=0; i<r; i++){
        ret *= (n--);
        ret /= i+1;
    }
    return ret;
}

int main() {
    int N, A, B;
    cin >> N >> A >> B;
    int A_orig = A;
    auto weights = map<ll, int>();
    auto v = vector<ll>(N);
    for (auto i=0; i<N; i++) { 
        cin >> v[i];
        weights[v[i]]++;
    }
    sort(v.rbegin(), v.rend());
    double ans1 = accumulate(v.begin(), v.begin() + A, 0.0) / A;
    printf("%.15f\n", ans1);

    while (!weights.empty()) {  
        int x = weights.rbegin()->second;
        if (x > A) break;
        A -= x;
        B = A;
        weights.erase(--weights.end());
    }
    int x = 0;
    if (!weights.empty())
        x = weights.rbegin()->second;
    ll ans2 = 0;
    for (int i=A; i<=min(x, B); i++) 
        ans2 += choose(x, i);
    cout << ans2 << endl;

    /*
    ll num_ways = 1;
    if (weights.size() == 1) {
        ll count = weights.begin()->second;
        if (count > A) {
            num_ways--;
            ll i = A;
            while (i <= count) {
                num_ways += combination(count, i);
                i++;
            }
        }
    }
    else {
        for (auto rit = weights.rbegin(); rit != weights.rend(); rit++) {
            if (A <= 0) 
                break;
            else if (rit->second > A) 
                num_ways = combination(rit->second, A);     
            A -= rit->second;
        }
    }
    cout << num_ways << endl;
    */
    return 0;
}


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

int main(){
	string s;
	while(1){
		cin >> s;
		if(s=="-") break;
		int c = s.length();
		int n;
		cin >> n;
		for (int i=0;i<n;i++){
			int a;
			cin >> a;
			string t;
			t = s.substr(a,c-a) + s.substr(0,a);
			s = t;
		}
		cout << s << endl;
	}
}

Measured memory_bytes: 1216
l = list(map(int, input().split()))
a =l[0]
b =l[1]
k =l[2]

t = a - k
if (t < 0):
    a = 0
    u = b + t
    if(u < 0):
        b = 0
    else:
        b = u
else:
    a = t

print(str(a) + " " +str(b))

Measured memory_bytes: 3064
/*Bismillahir Rahmanir Rahim*///{
#include <bits/stdc++.h>
using namespace std;
using ll = long long; using ull = unsigned long long; using ld = long double;
const ll llinf = (1ll<<61)-1;
const double eps = 1e-6, ldeps = 1e-9;
struct Dbg {
static constexpr auto &os = cout;   // replace by cerr in interactive.
template<class C> static auto dud(C *x)->decltype(os << *x, 0);
template<class C> static char dud(...);
template<class C> typename enable_if<sizeof dud<C>(0)!=1, Dbg&>::type operator<<(const C &x) { os << x; return *this; }
template<class C> Dbg &dump(C b, C e) {
    *this << "\n[";
    int cur = 0;
    for (C i = b; i!=e and cur<26; i++, cur++) *this << ", "+2*(i==b) << *i;
    return *this << ']';
}
template<class C> typename enable_if<sizeof dud<C>(0)==1, Dbg&>::type operator<<(const C &x) {
    return dump(begin(x), end(x));
}
template<class C, size_t X> typename enable_if<sizeof(C)!=1, Dbg&>::type operator <<(C (&x)[X]) {
    return dump(begin(x), end(x));
}
template<class B, class C> Dbg &operator <<(const pair<B, C> &x) {
    return *this << '{' << x.first << ", " << x.second << '}';
}
template<class C, size_t Y> struct TP {
    void operator()(Dbg& os, const C &t) { TP<C, Y-1>()(os, t); os << ", " << get<Y-1>(t); }
};
template<class C> struct TP<C, 1> { void operator()(Dbg& os, const C &t) { os << get<0>(t); } };
template<class... C> Dbg& operator<<(const tuple<C...> &t) {
    os << '{', TP<decltype(t), sizeof...(C)>()(*this, t); return *this << '}';
}
Dbg &operator<<(ostream&(*x)(std::ostream&)) { os << x; return *this; }
} dbg;
void err(istringstream *iss) { delete iss; }
template<class C, class... Args> void err(istringstream *iss, const C &val, const Args &... args) {
    string name; *iss >> name; if (name.back()==',') name.pop_back();
    dbg << name << " = " << val << "; ", err(iss, args ...);
}
#define bug(args...) dbg << __LINE__ << ": ", err(new istringstream(string(#args)), args), dbg << endl
#define sl(a) int(strlen(a))
#define sz(a) int(a.size())
int T, Q, cn;//}
const int inf = 1000000007, mxn = 300005;

int seq[mxn], si;

signed main() { ios::sync_with_stdio(0); cin.tie(NULL); cout.precision(11);
/*making LIS a is damn ez. Just put max a-1 elements at last, all others in descending order at first. To make LIS = a
and LDS = b together, we can make chunks of descending order, then put chunks in ascending order: 321654987. Length of
at least one chunk is b, others is in [1,b], number of chunks is exactly a.*/

    int n, a, b;
    cin >> n >> a >> b;
    if (!(a-1<=n-b and n-b<=(a-1)*ll(b))) return cout << "-1\n", 0;
    int taken = 0, chunksLeft = a;
    while (taken<n) {
        int can = min(n-taken-chunksLeft+1, b);
        for (int i = taken+can; i >= taken+1; i--) {
            seq[++si] = i;
        }
        taken += can, chunksLeft--;
    }
    for (int i = 1; i <= n; i++) {
        cout << seq[i] << " \n"[i==n];
    }
}

Measured memory_bytes: 3328
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <random>
#include <iomanip>
#include <unordered_set>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<pair<ll,ll> > vpll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<vc> vvc;
typedef vector<vs> vvs;
typedef vector<vll> vvll;
typedef map<int,int> mii;
typedef set<int> si;
#define rep(i,n) for(ll i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define arep(i,v) for(auto i : v)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define fi first
#define se second
constexpr int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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> inline void dump(T &v){irep(i, v){cout<<*i<<((i==--v.end())?'\n':' ');}}
inline string getline(){string s; getline(cin,s); return s;}
inline void yn(const bool b){b?fin("yes"):fin("no");}
inline void Yn(const bool b){b?fin("Yes"):fin("No");}
inline void YN(const bool b){b?fin("YES"):fin("NO");}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
constexpr ll LLINF = 1LL<<60;
constexpr ll MOD = 1000000007;
constexpr ld EPS = 1e-11;


int main() {
    
    int n;
    cin>>n;
    vi v(n);
    rep(i,n)v[i]=i+1;
    do{
        dump(v);
    }while(next_permutation(all(v)));
}


Measured memory_bytes: 3116
N, M = map(int, input().split())
H = [int(i) for i in input().split()]
adj = [[] for i in range(N)]
for i in range(M):
    a, b = map(int, input().split())
    adj[a-1].append(b-1)
    adj[b-1].append(a-1)
ans = 0
for i in range(N):
    if all(H[i] > H[neighbor] for neighbor in adj[i]):
        ans += 1
print(ans)

Measured memory_bytes: 29264
#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;

int main() {
//	cout << fixed << setprecision(15);
	vector<string> s(3);
	rep(i, 3) cin >> s[i];
	cout << s[0][0] << s[1][1] << s[2][2] << endl;
}


Measured memory_bytes: 256
n = input()
s = []
for c in n:
    s.append(int(c))
s.reverse()
l = len(s)
INF = 1000000000


def get_next(c):
    ret = [
        [INF, INF],
        [INF, INF],
    ]
    # for a in range(10):
    #     for b in range(10):
    #         if a - b == c:
    #             ret[0][0] = min(ret[0][0], a + b)
    #         if 10 + a - b == c:
    #             ret[0][1] = min(ret[0][1], a + b)
    #         if a - 1 - b == c:
    #             ret[1][0] = min(ret[1][0], a + b)
    #         if 10 + a - 1 - b == c:
    #             ret[1][1] = min(ret[1][1], a + b)
    for b in range(10):
        a = c + b
        if 0 <= a < 10:
            ret[0][0] = min(ret[0][0], a+b)
        a = c + b - 10
        if 0 <= a < 10:
            ret[0][1] = min(ret[0][1], a+b)
        a = c + b + 1
        if 0 <= a < 10:
            ret[1][0] = min(ret[1][0], a + b)
        a = c + b - 10 + 1
        if 0 <= a < 10:
            ret[1][1] = min(ret[1][1], a + b)
    return ret


dp = [[0 for _ in range(l+1)] for _ in range(2)]

dp[1][0] = INF

for i, c in enumerate(s):
    next_step = get_next(c)
    dp[0][i+1] = min(dp[0][i]+next_step[0][0], dp[1][i]+next_step[1][0])
    dp[1][i+1] = min(dp[0][i]+next_step[0][1], dp[1][i]+next_step[1][1])

print(min(dp[0][l], dp[1][l]+1))
# print(dp)

Measured memory_bytes: 133496
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <cmath> 

typedef long long ll;

using namespace std;

int Digit(ll n) {
    int count = 0;
    while (n > 0) {
        n /= 10;
        count++;
    }

    return count;
}

int main() {
    ll N;
    int ans = 1000000;
    cin >> N;

    for (ll A = 1; A <= sqrt(N); A++) {
        if (N % A != 0) continue;
        int F = max(Digit(A), Digit(N / A));
        ans   = min(ans, F);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main(){
  vector<int> v1;
  vector<int> v2;
  int N;
  cin >> N;
  for(int i = 0;i < N;i++){
    int a = 0;
    cin >> a;
    v1.push_back(a);
  }
  for(int i = 0;i < N;i++){
    int b = 0;
    cin >> b;
    v2.push_back(b);
  }
  int cnt = 0;
  for(int i = 0;i < N;i++){
    if(v1.at(i) >= v2.at(i)){
      int c = 0;
      c = v1.at(i)-v2.at(i);
      cnt += c;
    }
  }
  cout << cnt << endl;
}
    
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(var, begin, end) for (int var = (begin); var <= (end); var++)
#define RFOR(var, begin, end) for (int var = (begin); var >= (end); var--)
#define REP(var, length) FOR(var, 0, length - 1)
#define RREP(var, length) RFOR(var, length - 1, 0)
#define EACH(value, var) for (auto value : var)
#define SORT(var) sort(var.begin(), var.end())
#define REVERSE(var) reverse(var.begin(), var.end())
#define RSORT(var) SORT(var); REVERSE(var)
#define OPTIMIZE_STDIO ios::sync_with_stdio(false); cin.tie(0); cout.precision(10); cout << fixed
#define endl '\n'

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

int max3(int a, int b, int c) {
  if (a < b) {
    return max(b, c);
  } else {
    return max(a, c);
  }
}

void solve(istream& cin, ostream& cout) {
  int a, b;
  cin >> a >> b;
  cout << max3(a + b, a - b, a * b) << endl;
}

#ifndef TEST
int main() {
  OPTIMIZE_STDIO;
  solve(cin, cout);
  return 0;
}
#endif


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

using namespace std;
typedef uint64_t u64;
typedef int64_t i64;
typedef double db;

i64 X, Y, A, B, C;
deque<i64> P, Q, R;

int main() {
  cin >> X >> Y >> A >> B >> C;
  for (int i = 0; i < A; i++) {i64 v; cin >> v; P.push_back(v);}
  for (int i = 0; i < B; i++) {i64 v; cin >> v; Q.push_back(v);}
  for (int i = 0; i < C; i++) {i64 v; cin >> v; R.push_back(v);}
  sort(P.begin(), P.end(), [](i64 l,i64 r) { return l - r > 0ll; });
  sort(Q.begin(), Q.end(), [](i64 l,i64 r) { return l - r > 0ll; });
  P.resize(X);
  Q.resize(Y);
  R.insert(R.end(), P.begin(), P.end());
  R.insert(R.end(), Q.begin(), Q.end());
  sort(R.begin(), R.end(), [](i64 l,i64 r) { return l - r > 0ll; });
  R.resize(X + Y);
  cout << accumulate(R.begin(), R.end(), 0ll) << endl;
  return 0;
}


Measured memory_bytes: 6944
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i <= (n); i++)
#define repi(i,a,b) for (int i = (a); i < (b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;

int main() {
  string s; cin >> s;
  
  int pos_A, pos_Z;
  bool A = false;
  rep(i,s.size()) {
    if (s.at(i) == 'A' && A == false) {
      pos_A = i;
      A = true;
    }
    if (s.at(i) == 'Z') {
      pos_Z = max(pos_Z,i);
    }
  }
  
  cout << pos_Z - pos_A + 1 << endl;  
}

Measured memory_bytes: 640
N = int(input())
R = []
for _ in range(N):
    a, b = map(int, input().split())
    R.append((a, b))
B = []
for _ in range(N):
    c, d = map(int, input().split())
    B.append((c, d))

U = [False for _ in range(N)]
B.sort()

for c, d in B:
    mi = -1
    my = -1
    for i, (a, b) in enumerate(R):
        if not U[i] and a < c and b < d and my < b:
            mi = i
            my = b
    if mi != -1:
        U[mi] = True
print(U.count(True))


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define ll long long
#define x first
#define y second
#define sz(a) ((int)(a.size()))
#define OTIMIZA 2
#define INSERE 1
#define REMOVE 0
#define move aslzxc
int main()
{
	ll n, k;
	cin >> n >> k;
	n %= k;
	ll mn = n;
	for(int i = 0; i < 10; i++)
	{
		n = abs(n - k);
		mn = min(mn , n);
	}
	cout << mn << endl;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cmath>
#include <iostream>
# include <bits/stdc++.h>
using namespace std;
long long powerexp(long long base, long long exp, int mod) {
   long long res = 1;
   while (exp > 0) {
      if (exp % 2 == 1)
         res= (res * base) % mod;
      exp = exp >> 1;
      base = (base * base) % mod;
   }
   return res;
}
int gcd(int a, int b)
{
    int c = a % b;
    while(c != 0)
    {
        a = b;
        b = c;
        c = a % b;
    }
    return b;
}
void PrintVector(vector<long long int> v,long long int n)
{
 
    for(int i=0;i<v.size();i++)
    {
        cout<<v[i]<<" ";
    }
    cout<<endl;
}
void Takevector(vector<long long int> &v,long long int n)
{
  for(long long int i=0;i <n;i++)
  { long long int number;
    cin>>number;
    v.push_back(number);
  }
}
typedef long long int ll;
typedef vector<long long int> vi;
#define sci(x)         int x;       scanf("%d", &x);
#define scii(x, y)     int x, y;    scanf("%d %d", &x, &y);
#define sciii(x, y, z) int x, y, z; scanf("%d %d %d", &x, &y, &z);
#define scl(x)         ll x;       scanf("%lld", &x);
#define scll(x, y)     ll x, y;    scanf("%lld %lld", &x, &y);
#define sclll(x, y, z) ll x, y, z; scanf("%lld %lld %lld", &x, &y, &z);
#define TC(x)          sci(x); while(x --)
#define rep(i, x, y)   for (__typeof(x) i = x; i <= y; i ++)
#define repi(i, x, y)  for (__typeof(x) i = x; i >= y; i --)
#define fore(itr, x)   for (__typeof(x.begin()) itr = x.begin(); itr != x.end(); itr ++)
#define forei(itr, x)  for (__typeof(x.end()) itr = x.end() - 1; itr != x.begin() - 1; itr --)
#define nl cout<<"\n";
int min(int x, int y)  
{  
    return (x < y)? x: y;  
      
}  

int main()
{
  int flag=1,flag1=0;
  ll sum=0,tot=0,ans=0;
  map<int,int>mp;
  vi v,v1;
  set<int>st,st1;
  string s;
  long double  a,b;
  cin>>a>>b;
  long long unsigned int c= a*b;
  cout<<c;
  










return 0;
}

Measured memory_bytes: 3764
#include <iostream>
#include <cmath>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

using namespace std;

int main()
{
  int n;
  cin >> n;
  int v[100];
  REP(i, n) {
    int x;
    cin >> x;
    v[i] = x;
  }

  int s1 = 0;
  int s2 = 0;
  REP(i, n) {
    s2 += v[i];
  }
  int result = 1000000;
  REP(i, n) {
    s1 += v[i];
    s2 -= v[i];
    result = min(abs(s1 - s2), result);
  }
  cout << result;
}


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

#define upto(i,s,e,d) for(int i=(s);i<(e);i+=(d))

using vi = vector<int>;
using vvi = vector<vi>;

int main(){
  int n,d; cin>>n>>d;
  vvi x(n, vi(d));
  int c = 0;
  upto(i,0,n,1){
    upto(j,0,d,1) cin>>x[i][j];
    upto(j,0,i,1){
      int t = 0;
      upto(k,0,d,1) t += (x[i][k]-x[j][k])*(x[i][k]-x[j][k]);
      int s = sqrt(t);
      if(s*s==t) c++;
    }
  }
  cout<<c<<endl;
}

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

const int MAX = 200000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];

//累乗
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

//逆元
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

//コンビネーション
int comb(int n, int c)
{
    //分子
    long long p=1;
    for(int i=0; i<c; i++)
    {
        p = (p*(n-i)) % MOD;
    }

    //分母
    long long q=1;
    for(int i=0; i<c; i++)
    {
        q = (q*(i+1)) % MOD;
    }

    //逆数を求める
# if 0
    long long r = 1;
    for(int i=0; i<MOD-2; i++)
    {
        r = (r*q) % MOD;
    }
#else
    int r = modinv(q, MOD);
#endif
    return (p * r) % MOD;
}


//メイン
int main() 
{  
    //COMinit(); 

    int n, a, b;
    cin >> n;
    cin >> a >> b;

    long long all = modpow(2, n, MOD);

    int val = all;
    val = (val - comb(n, a) + MOD)% MOD;
    val = (val - comb(n, b) + MOD)% MOD;  
    val = (val - 1 + MOD)% MOD;

    cout << val << endl;

    return 0;
}


Measured memory_bytes: 768
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 1LL << 30;
int MOD = 1e9+7;
main(){
    ll a,b;
    cin >> a;
    for(ll c = 1;c*c <= a;c++)b = c*c;
    cout << b << endl;

}

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

class Program {
    static int ReadInt() { return int.Parse(Console.ReadLine()); }
    static int[] ReadInts() { return Console.ReadLine().Split().Select(int.Parse).ToArray(); }
    static string[] ReadStrings() { return Console.ReadLine().Split(); }

    static int Calc(string s) {
        int paaCount = s.Where(e => e == 'p').Count();

        int guu = 0;
        int paa = 0;
        int win = 0;
        int lose = 0;
        for (int i = 0; i < s.Length; i++) {
            switch (s[i]) {
                case 'g':
                    if (guu - paa > 0 && guu - paa >= paaCount) {
                        paa++;
                        win++;
                    }
                    else {
                        guu++;
                    }
                    break;

                case 'p':
                    if (guu - paa > 0) {
                        paa++;
                    }
                    else {
                        guu++;
                        lose++;
                    }
                    paaCount--;
                    break;
            }
        }

        return win - lose;
    }

    static void Main() {
        var s = Console.ReadLine();
        Console.WriteLine(Calc(s));
    }
}

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

using namespace std;

#define sz(x) (int) x.size()
#define all(a) a.begin(), a.end()

int n;
vector<long long> ans;

void go(long long num, int pos, int total) {
    if (pos == total + 1) {
        if (sz(ans) < n) {
            ans.push_back(num);
            // cerr << num << " ";
            if (sz(ans) == n) {
                cout << num << endl;
                exit(0);
            }
        }
        return;
    }
    if (pos == 1) {
        for (int i = 1; i <= 9; i++) {
            go(i, pos + 1, total);
        }
    } else {
        int prev = num % 10;
        for (int i = max(0, prev - 1); i <= min(9, prev + 1); i++) {
            go(num * 10 + i, pos + 1, total);
        }
    }
}

int main() {

    cin >> n;

    for (int i = 1; i <= 10; i++) {
        go(0, 1, i);
    }

    return 0;
}


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

template<class type> struct WeightedUnionFind{
  vector<int> par;
  vector<int> treerank;
  vector<type> wdiff;
  
  WeightedUnionFind(int n){
    init(n);
  }
  
  void init(int n){
    par.resize(n); treerank.resize(n); wdiff.resize(n);
    rep(i, n) par[i] = i, treerank[i] = 0, wdiff[i] = 0;
  }
  
  int find(int x){
    if(par[x] == x) return x;
    int r = find(par[x]);
    wdiff[x] += wdiff[par[x]];
    return par[x] = r;
  }
  
  type weight(int x){
    find(x);
    return wdiff[x];
  }
  
  void unite(int x, int y, type w){
    w += weight(x); w -= weight(y);
    x = find(x); y = find(y);
    if(x == y) return;
    if(treerank[x] < treerank[y]) swap(x, y), w = -w;
    if(treerank[x] == treerank[y]) treerank[x]++;
    par[y] = x;
    wdiff[y] = w;
    return;
  }
  
  type diff(int x, int y){
    return weight(y) - weight(x);
  }
  
  bool same(int x, int y){
    return find(x) == find(y);
  }
};

int main(){
  int n, m; cin >> n >> m;
  WeightedUnionFind<int> wuf(n);
  bool flag = true;
  rep(i, m){
    int l, r, d; cin >> l >> r >> d;
    l--; r--;
    if(wuf.same(l, r)){
      if(wuf.diff(l, r) != d){
        flag = false;
        break;
      }
    }
    else wuf.unite(l, r, d);
  }
  cout << (flag ? "Yes" : "No") << endl;
}

Measured memory_bytes: 1536
#include <iostream>
#include <string>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <list>
#include <iomanip>
#include <vector>
#include <functional>
#include <algorithm>
#include <cstdio>
#include <random>
#include <ctime>
#include <cstdlib>
#include <unordered_map>
#include <string.h>
#include <iostream>

using namespace std;
typedef long long ll;
typedef pair<int, int> Pint;
typedef pair<ll, ll> Pll;
#define rep(begin, i, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    int X;
    cin >> X;
    if ((X / 100) * 5 < X % 100)
    {
        cout << 0 << endl;
    }
    else
    {
        cout << 1 << endl;
    }
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

#-------
# Initialize
N = int(input())
S =[0] * N
for i in range(N):
    S[i] = int(input())
dp = [[0 for i in range(10101)] for j in range(101)]
#-------
# Define

#-------
# Do
dp[0][0] = 1;
for i in range(N):
    for j in range(10001):
        if(dp[i][j] == 1):
            dp[i+1][j] = 1
            dp[i+1][j+S[i]] = 1

ans = 0
for j in range(10001):
    if (j % 10 > 0) & (dp[N][j] == 1):
        ans = max(ans, j)
print(str(ans))

#-------
# Output


Measured memory_bytes: 11380
#include<stdio.h>
int main(void){
    char a[9];
    while(scanf("%s",a)!=EOF){
        int i,j=0;
        for(i=0;i<9;i++){
            if(a[i]=='s')a[i]=i+'0';
        }
        for(i=0;i<9;i+=3){
            if(a[i]==a[i+1] && a[i]==a[i+2]){
                printf("%c\n",a[i]);
                j=1;
            }
        }
        if(j==1)continue;
        for(i=0;i<3;i++){
            if(a[i]==a[i+3] && a[i]==a[i+6]){
                printf("%c\n",a[i]);
                j=1;
            }
        }
        if(j==1)continue;
        if(a[0]==a[4] && a[0]==a[8]){
            printf("%c\n",a[0]);
            continue;
        }
        if(a[2]==a[4] && a[2]==a[6]){
           printf("%c\n",a[2]);
            continue;
        }
        puts("d");

    }

    return 0;
}

Measured memory_bytes: 552
#include<bits/stdc++.h>
using namespace std;
int main(){
	int i;
	string s;
	cin>>s;
	for(i=0;i<s.size();i++){
		if(s[i]=='1') s[i]='9';
		else if(s[i]=='9') s[i]='1';
	}
	cout<<s;
	return 0;
	}


Measured memory_bytes: 256
A = int(input())
B = int(input())
C = int(input())
X = int(input())
ans = 0

for a in range(A+1):
    for b in range(B+1):
        for c in range(C+1):
            Y = 500*a + 100*b + 50*c
            if Y == X:
                ans += 1
print(ans)


Measured memory_bytes: 3060
import java.util.*;
import java.io.*;
 
public class Main {
    public static void main (final String[] args) {
        final Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
      	long m = sc.nextLong();
      	
      	if (n > m) System.out.println(n*m/gcd(n,m));
      	else System.out.println(n*m/gcd(m,n));
    }
  
  	static long gcd (long a, long b) {
	    long temp;
	    while((temp = a%b)!=0) {
		    a = b;
		    b = temp;
	    }
	    return b;
    }
}

Measured memory_bytes: 21844
#include<iostream>
using namespace std;
int main() {
	int n, i, min, max, a;
	long int sum;
	cin >> n;
	cin >> min;
	max = min; sum = min;
	i = 0;
	while (i < n - 1) {
		cin >> a;
		if (min > a) {
			min = a;
		}if (max < a) {
			max = a;
		}
		sum = sum + a;
		i++;
	}
	cout << min << " " << max << " " << sum << endl;
	return 0;
}

Measured memory_bytes: 3100
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

class Program
{
    static void Main()
    {
        var NK = ReadLine().Split().Select(int.Parse).ToArray();
        var N = NK[0];
        var K = NK[1];
        var S = ReadLine();

        var max = 1;
        var c = S[0] == '0' ? 1 : 0;
        var s = 0;
        for (int i = 1; i < N; i++)
        {
            if (S[i - 1] == '1' && S[i] == '0')
            {
                c++;
                if (c > K)
                {
                    if (S[s] == '1') while (S[s] == '1') s++;
                    while (S[s] == '0') s++;
                    i = Max(i, s);
                    c--;
                }
            }
            max = Max(max, i - s + 1);
        }
        WriteLine(max);
    }
}


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

int main(){
  long long n, m; cin >> n >> m;
  vector<pair<long long, long long>> p(n);
  for(int i = 0; i < n; i++){
  	cin >> p[i].first >> p[i].second;
  }
  long long ans = 0;
  int i = 0;
  sort(p.begin(), p.end());
  
  while(m!=0){
  	if(p[i].second<m){
    	m -= p[i].second;
    	ans += p[i].first*p[i].second;
    }
  
  	else{
    	ans += p[i].first*m;
      	m = 0;
    }
    
    i++;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 1792
// aribon3-3_a
// JOI 2011 春合宿 day4-2 本棚
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

template<typename T>
struct SegmentTree {
    using F = function<T(T, T)>;
    int n;
    F f;
    T ti;
    vector<T> dat;
    SegmentTree(F f, T ti, int n_) : f(f), ti(ti) {
        n = 1;
        while (n < n_) n <<= 1;
        dat.assign(n << 1, ti);
    }
    void update(int k, T x) {
        k += n - 1;
        dat[k] = x;
        while (k > 0){
            k = (k - 1) / 2;
            dat[k] = f(dat[k * 2 + 1], dat[k * 2 + 2]);
        }
    }
    T query(int a, int b, int k=0, int l=0, int r=-1) {
        if (r < 0) r = n;

        // [a, b)と[l, r)が交差しなければ単位元を返す
        if (r <= a || b <= l) return ti;

        // [a, b)が[l, r)を完全に含んでいればその節点の値
        if (a <= l && r <= b) return dat[k];

        int m = (l + r) / 2;
        int vl = query(a, b, k*2+1, l, m);
        int vr = query(a, b, k*2+2, m, r);
        return f(vl, vr);
    }
};

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    int N,Q;
    cin >> N >> Q;

    auto f = [](int a, int b){ return min(a, b); };
    int ti = (int)((1ll<<31) - 1);
    auto st = SegmentTree<int>(f, ti, N);

    REP(i, Q){
        int c, x, y;
        cin >> c >> x >> y;
        if (c == 0){
            st.update(x, y);
        } else {
            int ans = st.query(x, y+1);
            print(ans);
        }
    }

    return 0;
}



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

main()
{
    ios::sync_with_stdio(0);
    cout.tie(0);
    cin.tie(0);
    long long i,j,k,l,m,n,o,p;

    string s;

    while(cin>>s)
    {
        if(s[0]=='S'&&s[1]=='A')
            cout<<"1"<<endl;
        else  if(s[0]=='S'&&s[1]=='U')
            cout<<"7"<<endl;
        else  if(s[0]=='M'&&s[1]=='O')
            cout<<"6"<<endl;
        else  if(s[0]=='T'&&s[1]=='U')
            cout<<"5"<<endl;
        else  if(s[0]=='W'&&s[1]=='E')
            cout<<"4"<<endl;
        else  if(s[0]=='T'&&s[1]=='H')
            cout<<"3"<<endl;
        else  if(s[0]=='F'&&s[1]=='R')
            cout<<"2"<<endl;
    }

    return 0;

}


Measured memory_bytes: 3628
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <map>
#include <vector>
using namespace std;
typedef long long LL;
const int N=1e6;
int n,dx=0,fa[N+10],sz[N+10];
LL d[N+10],sum=0;
map <LL,int> mp;
vector <int> son[N+10];
void Dfs(int x) {
    sum+=dx;
    for (int i=0;i<(int)son[x].size();i++) {
        int kx=son[x][i];
        dx++;
        Dfs(kx);
        dx--;
    }
}
void Print(int x) {
    for (int i=0;i<(int)son[x].size();i++) {
        int kx=son[x][i];
        printf("%d %d\n",x,kx);
        Print(kx);
    }    
}
int main() {
    scanf("%d",&n);
    for (int i=1;i<=n;i++) {
        scanf("%lld",&d[i]);
        mp[d[i]]=i;
    }
    sort(d+1,d+n+1);
    for (int i=1;i<=n;i++) sz[i]=1;
    for (int i=n;i>1;i--) {
        int kx=mp[d[i]];
        if (sz[kx]*2>=n) {
            printf("-1\n");
            return 0;
        }
        fa[kx]=mp[d[i]-(n-sz[kx]*2)];
        if (fa[kx]==0) {
            printf("-1\n");
            return 0;
        }
        sz[fa[kx]]+=sz[kx];
        son[fa[kx]].push_back(kx);
    }
    Dfs(mp[d[1]]);
    if (sum!=d[1]) {
        printf("-1\n");
        return 0;
    }
    Print(mp[d[1]]);
    return 0;
}


Measured memory_bytes: 42496
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define INF 0x3f3f3f3f
int main()
{
    int x,y,z;
    scanf("%d %d %d",&x,&y,&z);
    int ans=0;
    ans=abs(y-x)+abs(z-x);
    ans=min(ans,abs(y-z)+abs(x-z));
    ans=min(ans,abs(x-y)+abs(z-y));
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())





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

	int n;
	int L[2000];
	cin >> n;
	rep(i, n)cin >> L[i];
	sort(L, L + n);

	long long ans = 0;
	rep(j, n) {
		rep(i, j) {
			int* p = upper_bound(L + j + 1, L + n, L[j] - L[i]);
			ans += lower_bound(L + j + 1, L + n, L[i] + L[j]) - p;
		}
	}
	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
using ll = long long;
using ull = unsigned long long; 
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
//constexpr long long MOD = 998244353LL;
template<class T, class U> inline bool chmax(T &a, U b) { if (a < b) { a = b; return true;} return false; }
template<class T, class U> inline bool chmin(T &a, U b) { if (a > b) { a = b; return true;} return false; }
////////////////////////////////////////////////////////////////////////////////////////////////////////////

using D = double;
const D PI = acos(-1.0); 
int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int A,B,H,M; cin >> A >> B >> H >> M;
    double a = PI*2*(H*60+M)/720;
    double b = PI*2*M/60;
    D d = abs(a-b);
    d = min(d,2*PI-d);
    D ans = sqrt(D(A*A+B*B-cos(d)*2*A*B));
    cout << fixed <<setprecision(10) << ans << ln;
}

Measured memory_bytes: 4208
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <math.h>
#include <bitset>
#include <cmath>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(int i = s;i<n;i++)
#define repe(i,s,n)for(ll i = s;i<=n;i++)
#define rep_r(i,s,n)for(ll i = n-1;i>s;i--)
#define rep_re(i,s,n)for(ll i = n-1;i>=s;i--)
ll MOD = 1e9 + 7;

int main() {
	ll n; cin >> n;
	cout << n / 2 + ((n & 1) ? 1 : 0) << endl;
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <queue>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>

using namespace std;
int main(){
    int s;
    cin >> s;
    int s0=s%10;
    int s1=(s%100)/10;
    int s2=(s%1000)/100;
    int s3=s/1000;
    if(s0==s1||s1==s2||s2==s3){
        cout<<"Bad"<<endl;
    }else{
        cout<<"Good"<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LOOP(n) for (int _i = 0; _i < (n); _i++)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define FOR(i, r, n) for (int i = (r); i < (n); ++i)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;
using ull = unsigned long long;

const int INF = 2100100100;
const int MOD = 1e9 + 7;

// 多次元 vector 生成
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

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

/*  lcm (a, b) : 2整数版
    入力：整数 a, b
    出力：aとbの最小公倍数
*/
long long lcm(long long a, long long b) {
    long long d = gcd(a, b);
    return a / d * b;
}

/* lcm (vec) : ベクトルでの多整数版
    入力：整数のベクトル vec
    出力：すべての要素の最小公倍数
    注意：最小公倍数がオーバーフローする時は素因数分解を使う
*/
long long lcm(const vector<long long> &vec) {
    long long l = vec[0];
    for (int i = 0; i < vec.size() - 1; i++) {
        l = lcm(l, vec[i + 1]);
    }
    return l;
}

int N;

int main() {
    cin >> N;
    vector<ll> T(N);
    map<ll, int> m;
    REP(i, N) { cin >> T.at(i); }

    cout << lcm(T) << endl;

    return 0;
}


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

void cek(string s)
{
	int l=0;
	int r=s.length()-1;
	while (l<=r)
	{
		if (s[l]!=s[r])
		{
			cout<<"No\n";
			return;
		}
		l++;
		r--;
	}
	cout<<"Yes\n";
	return;
}

int main()
{
	string a;
	cin>>a;
	cek(a);
}

Measured memory_bytes: 256
import java.util.*

fun main(args : Array<String>) {
    val scanner = Scanner(System.`in`)
    println(inOutExec(scanner))
}

fun inOutExec(scanner: Scanner): String {
    val numOfPref = scanner.nextInt()
    val numOfCity = scanner.nextInt()

    val citiesIn = mutableListOf<Pair<Int, Int>>()
    repeat(numOfCity) {
        citiesIn.add(Pair(scanner.nextInt(), scanner.nextInt()))
    }

    val cityCodeMap = citiesIn
            .groupByTo(mutableMapOf()) { it.first }
            .flatMap { entry -> entry.value // List<Pair<Int, Int>>
                        .sortedBy { info -> info.second }
                        .mapIndexed { index, pair ->
                            pair to "%06d%06d".format(pair.first, index + 1) } } // Pair<Pair<Int, Int>, String>
            .toMap()

    return citiesIn.joinToString(separator = "\n", postfix = "\n") { cityCodeMap[it]!! }
}

Measured memory_bytes: 156636
import sys
n = int(sys.stdin.readline().rstrip("\n"))
l = [int(s) for s in sys.stdin.readline().rstrip("\n").split()]
s = 1
if 0 in l:
    print(0)
else:
    for i in l:
        s *= i
        if s > 10**18:
            print(-1)
            break
    else:
        print(s)

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

#define MAX_N 100001

vector <pair <int, int> > adj[MAX_N];
int64_t dis[MAX_N];
bool vis[MAX_N];

void dfs(int v)
{
    vis[v] = true;
    for (int i = 0; i < adj[v].size(); i++) {
        int u = adj[v][i].first;
        int w = adj[v][i].second;
        if (!vis[u]) {
            dis[u] = dis[v] + w;
            dfs(u);
        }
    }
}

int main(void)
{
    int n, k, q;
    scanf("%d", &n);
    for (int i = 1; i < n; i++) {
        int a, b, c;
        scanf("%d%d%d", &a, &b, &c);
        adj[a].push_back(make_pair(b, c));
        adj[b].push_back(make_pair(a, c));
    }
    scanf("%d%d", &q, &k);
    dfs(k);
    while (q--) {
        int x, y;
        scanf("%d%d", &x, &y);
        printf("%lld\n", dis[x] + dis[y]);
    }
    return 0;
}


Measured memory_bytes: 12800
N = int(input())
st = [input().split() for _ in range(N)]
X = input()
ans = 0
flg = 0
for i, ST in enumerate(st):
    s, t = ST

    if s == X:
        flg = 1
        continue

    if flg == 1:
        ans += int(t)

print(ans)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define all(a)  (a).begin(),(a).end()
typedef long long ll;
ll mod=1000000007;
string s;

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

ll lcm(ll a, ll b){
  ll g = gcd(a,b);
  return a/g*b;
}

int main() {
  int n; cin >> n;
  ll out=1;
  for (int i=0;i<n;++i){
    ll t;
    cin>>t;
    out = lcm(out,t);
  }
  cout << out << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <iostream>

using namespace std;

int main(int argc, char const* argv[])
{
	string find_str("Hoshino"),rep_str("Hoshina"),target;
	int n;

	cin >> n;
	getchar();

	for( int i = 0;i < n;i++ ){
		getline(cin,target);
		for( string::size_type pos = target.find( find_str ); pos != string::npos; pos = target.find( find_str, rep_str.size() + pos ) ){
			target.replace( pos, find_str.size(), rep_str ); 
		}
		cout << target << endl;
	}
	return 0;
}

Measured memory_bytes: 0
n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

monstar = sum(A)
for i in range(n):
    A[i] -= B[i]
    A[i + 1] -= (-A[i]) if A[i] < 0 else 0
    A[i] = 0 if A[i] < 0 else A[i]
    A[i + 1] = 0 if A[i + 1] < 0 else A[i + 1]

print(monstar - sum(A))

Measured memory_bytes: 19116
#include <iostream>
#include <cmath>

using namespace std;

int main(int argc, char* argv[]) {
  int N;
  cin >> N;

  int a[N + 2];
  int cost[N + 2];
  a[0] = 0;
  cost[0] = 0;
  int cur = 0;
  int total = 0;
  for (int i = 1; i < N + 2; ++i) {
    if (i != N + 1)
      cin >> a[i];
    else
      a[i] = 0;
    cost[i] = abs(a[i] - a[i - 1]);
    total += cost[i];
  }

  for (int i = 1; i < N + 1; ++i) {
    int tmp = total - cost[i];
    tmp -= cost[i + 1];
    tmp += abs(a[i + 1] - a[i - 1]);
    cout << tmp << endl;
  }

  return 0;
}

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

using E = System.Linq.Enumerable;

public class Program
{
    public static void Main()
    {
        var s = Console.ReadLine().Trim();
        var t = Console.ReadLine().Trim();

        var k = E.Zip(s, t, (x, y) => x == y).Count(x => x);
        Console.WriteLine(k);
    }
}


Measured memory_bytes: 11220
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

int[10^^5] AS, BS, CS;
int[10^^5][3] MEMO;

void main()
{
    auto N = readln.chomp.to!int;
    foreach (i; 0..N) {
        auto abc = readln.split.to!(int[]);
        AS[i] = abc[0];
        BS[i] = abc[1];
        CS[i] = abc[2];
    }

    int solve(int i, int b) {
        if (i == N) return 0;
        auto bb = b == -1 ? 0 : b;
        if (MEMO[bb][i]) return MEMO[bb][i];
        return MEMO[bb][i] =
            max(
                b == 0 ? -1 : solve(i+1, 0) + AS[i],
                b == 1 ? -1 : solve(i+1, 1) + BS[i],
                b == 2 ? -1 : solve(i+1, 2) + CS[i]
            );
    }

    writeln(solve(0, -1));
}

Measured memory_bytes: 11388
n, k = map(int, input().split())
a = list(map(int, input().split()))

for i in range(min(k, 50)):
    b = [0] * (n + 1)
    for j in range(n):
        l = max(0, j - a[j])
        r = min(n - 1, j + a[j])
        b[l] += 1
        b[r + 1] -= 1
    for m in range(n):
        b[m + 1] += b[m]
    a = b[:-1]
print(*a)


Measured memory_bytes: 170868
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <cstring>
#include <fstream>
#include <numeric>
#include <algorithm>

using namespace std;

int main(int argc, char **argv) {
  int n, p, q, r, c;
  long long sweet[1000][4];
  while (cin >> n, n) {
    for (int i = 0; i < n; i++) {
      int hoge;
      cin >> sweet[i][3];
      cin >> sweet[i][0] >> sweet[i][1] >> sweet[i][2];
    }

    cin >> p >> q >> r >> c;
    bool counted = false;
    for (int i = 0; i < n; i++)
      if (p >= sweet[i][0] && q >= sweet[i][1] && r >= sweet[i][2] &&
          c >= sweet[i][0] * 4 + sweet[i][1] * 9 + sweet[i][2] * 4) {
        cout << sweet[i][3] << endl;
        counted = true;
      }
    if (!counted)
      cout << "NA" << endl;
  }
  return 0;
}

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

long long lcm(long long, long long);

int main()
{
	int n;
	long long ans{1};
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		long long a;
		scanf("%lld", &a);
		ans = lcm(ans, a);
	}
	printf("%lld\n", ans);

	return 0;
}

long long lcm(long long a, long long b)
{
	long long gcd{a}, tmp{b};
	while (tmp)
	{
		gcd %= tmp;
		std::swap(tmp, gcd);
	}
	return a / gcd * b;
}


Measured memory_bytes: 3200