akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("mmx,avx,fma")
//#pragma GCC optimize ("unroll-loops")

using namespace __gnu_pbds;
using namespace std;

template <class T>
istream& operator >> (istream& in, vector<T>& v){ for(auto& e : v){ in >> e; } return in; }
template <char d = ' ', class T>
ostream& operator << (ostream& out, vector<T>& v){ for(auto& e : v){ out << e << d; } return out; }
template <char d = ' ', class T>
ostream& operator << (ostream& out, set<T>& v){ for(auto& e : v){ out << e << d; } return out; }

#define pb push_back
#define mk make_pair
#define X first
#define Y second
#define cont continue
#define ret return
#define For(i, a, b) for (int i = a; i < b;i++)
#define forn(i, a) for (int i = 0;i < a;i++)
#define ford(i, a, b) for (int i = b - 1;i >= a;i--)
#define fordn(i, a) for (int i = a - 1;i >= 0;i--)
#define forr(x, arr) for(auto &x: arr)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define REE(s_) {cout << s_ << '\n';exit(0);}
#define endl '\n'
#define makeunique(x) sort(all(x)), (x).resize(unique(all(x)) - (x).begin())

#define int long long
typedef double dd;
typedef long double ldd;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef map<int, int> mii;
typedef map<string, int> msi;
typedef set<int> si;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }
template <typename T> std::string toString(T val){std::ostringstream oss; oss << val; return oss.str();}

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
//const int dx[8] = {0, 0, 1, 1, 1, -1, -1, -1};
//const int dy[8] = {1, -1, 1, 0, -1, 1, 0, -1};
//const int dx[8] = {2, 2, 1, 1, -1, -1, -2, -2};
//const int dy[8] = {1, -1, 2, -2, 2, -2, 1, -1};

const int mod = 1e9 + 7;

//int powq(int a, int n) {
//    int res = 1;
//    while (n){
//        if (n & 1) {
//            res *= a;
//            res %= mod;
//            --n;
//        }
//        else {
//            a *= a;
//            a %= mod;
//            n >>= 1;
//        }
//
//    }
//    res %= mod;
//    return res;
//}

signed main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    #ifdef KULA
//        freopen("input.txt", "r", stdin);
//        freopen("output.txt", "w", stdout);
    #else
//        freopen("input.in", "r", stdin);
//        freopen("output.out", "w", stdout);
    #endif
    vi aa;
    int a, b, k;
    cin >> a >> b  >> k;
    For(i, 1, 1000){
        if (a % i ==0 && b % i == 0) aa.pb(i);
    }
    sort(rall(aa));
    cout << aa[k - 1];
    return 0;
}


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

#define EQ(a,b) (abs((a)-(b)) < EPS)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define sz size()
#define all(a) (a).begin(),(a).end()

using namespace std;
typedef double D;
typedef complex<D> P;
typedef pair<P,P> L;
typedef pair<D,int> pdi;

const D EPS = 1e-8;
const D PI = acos(-1);

inline D dot(P x, P y){return real(conj(x)*y);}
inline D cross(P x, P y){return imag(conj(x)*y);}

inline D seg_p_dis(L a,P x){
  if(dot(a.sc-a.fs,x-a.fs)<EPS)return abs(x-a.fs);
  if(dot(a.fs-a.sc,x-a.sc)<EPS)return abs(x-a.sc);
  return abs(cross(a.sc-a.fs,x-a.fs))/abs(a.sc-a.fs);
}

int main(){
  int w,n;
  while(scanf("%d%d",&w,&n)){
    if(w==0)return 0;

    vector< vector<L> > l(n);
    rep(i,n){
      int m;
      scanf("%d",&m);
      vector<P> p(m);
      rep(j,m){
	int x,y;
	scanf("%d%d",&x,&y);
	p[j] = P(x,y);
      }
      rep(j,m){
	l[i].push_back(L(p[j],p[(j+1)%m]));
      }
    }

    int v = n+2;
    vector< vector<pdi> > g(v);
    g[v-2].pb(pdi(w,v-1));
    L ls = L(P(0,0),P(0,1e4)), lt = L(P(w,0),P(w,1e4));
    rep(i,n){
      D dis = w;
      for(L a : l[i])dis = min(dis, seg_p_dis(ls,a.fs));
      g[v-2].pb(pdi(dis, i));
      dis = w;
      for(L a : l[i])dis = min(dis, seg_p_dis(lt,a.fs));
      g[i].pb(pdi(dis,v-1));
      rep(j,i){
	dis = w;
	for(L a : l[i])for(L b : l[j]){
	    dis = min(dis, seg_p_dis(a,b.fs));
	    dis = min(dis, seg_p_dis(b,a.fs));
	  }
	g[i].pb(pdi(dis,j)); g[j].pb(pdi(dis,i));
      }
    }

    vector<D> d(v,1e9);
    d[v-2] = 0;
    bool use[220];
    memset(use,0,sizeof(use));

    for(;;){
      int u = -1;
      rep(i,v){
	if(!use[i] && (u<0 || d[u] > d[i]+EPS) )u = i;
      }
      if(u<0 || u==v-1)break;
      use[u] = true;
      
      for(pdi nxt : g[u]){
	D ncost = d[u] + nxt.fs;
	if(!use[nxt.sc] && d[nxt.sc] > ncost +EPS){
	  d[nxt.sc] = ncost;
	}
      }
    }
    printf("%.9lf\n",d[v-1]);
  }
}

Measured memory_bytes: 2052
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll mod = 1e9 + 7;
#define pival 3.14159265359
#define pll pair<ll,ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pqq priority_queue
#define all(a) a.begin(), a.end()
#define sz(a) (ll)(a.size())
#define endl '\n'
ll power(ll x, ll y, ll p)
{ 
    ll res = 1;  
    x = x % p;
    while (y > 0) { 
        if (y & 1) res = (res * x) % p; 
        y = y >> 1;
        x = (x * x) % p;   
    } 
    return res; 
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n;
    cin >> n;
    if (n % 2 != 0) {
        cout << 0 << endl;
        return 0;
    }   
    ll x = n / 2;
    ll p = 5;
    ll ans = 0;
    while (1) {
        ll ex = x / p;
        if (ex == 0) break;
        ans += ex;
        p *= 5;
    }
    cout << ans << endl;
    return 0;
}

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

#define rep(i, n) for(int i = 0; i < (n); i++)
using ll = long long;
constexpr ll INF = 10000000000;
const ll MOD = 1000000007;

using namespace std;

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

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

	int pt = 0;
	if (a > 0 && b > 0) {
		if (a > b) pt = 1;
		if (a < b)pt = 2;
	}

	if (a > 0 && b < 0) {
		if (a > abs(b))pt = 3;
		if (a < abs(b))pt = 4;
		if (a == abs(b))pt = 11;
	}

	if (a < 0 && b > 0) {
		if (b > abs(a))pt = 5;
		if (b < abs(a))pt = 6;
		if (b == abs(a))pt = 11;
	}
	if (a < 0 && b < 0) {
		if (a > b)pt = 7;
		if (a < b)pt = 8;
	}

	if (a > 0 && b == 0) {
		pt = 21;
	}
	if (a < 0 && b == 0) {
		pt = 22;
	}
	if (a == 0 && b > 0) {
		pt = 31;
	}
	if (a == 0 && b < 0) {
		pt = 32;
	}


	if (pt == 1)cout << a - b + 2 << endl;
	if (pt == 2)cout << b - a << endl;

	if (pt == 3)cout << a - abs(b) + 1 << endl;
	if (pt == 4)cout << abs(b) - a + 1 << endl;

	if (pt == 5)cout << b - abs(a) + 1 << endl;
	if (pt == 6)cout << abs(a) - b + 1 << endl;

	if (pt == 7)cout << abs(b) - abs(a) + 2 << endl;
	if (pt == 8)cout << abs(a) - abs(b) << endl;

	if (pt == 11)cout << 1 << endl;
	
	if (pt == 21)cout << a + 1 << endl;
	if (pt == 22)cout << abs(a) << endl;

	if (pt == 31)cout << b << endl;
	if (pt == 32)cout << abs(b) + 1 << endl;
}


Measured memory_bytes: 256
#if !defined(__clang__) && defined(__GNUC__)
#include <bits/stdc++.h>
#else
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#endif //  !defined(__clang__) && defined(__GNUG__)
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/multi_array.hpp>

using namespace std;

template <typename Tlist, typename Tfunc>
void __combination(
    Tlist const& list, typename Tlist::size_type const n, Tfunc const& func,
    Tlist& tmp, typename Tlist::size_type const i, typename Tlist::size_type const j)
{
    if (i == n)
    {
        func(tmp);
        return;
    }

    for (typename Tlist::size_type k = j; k != list.size() + (1 + i- n); ++k)
    {
        tmp[i] = list[k];
        __combination(list, n, func, tmp, i + 1, k + 1);
    }
}

template <typename Tlist, typename Tfunc>
void combination(
    Tlist const& list, typename Tlist::size_type const n, Tfunc const& func)
{
    Tlist tmp(n);
    __combination(list, n, func, tmp, 0, 0);
}

/*
  uint64_t sum = 0;
  combination(inis, 3, [&sum](auto& v) {
  sum += std::accumulate(std::begin(v), std::end(v), 1ULL, [](auto acc, auto nn) {
  return acc*nn;
  });
  });
*/

int main()
{
    int64_t N;
    std::cin >> N;

    std::vector<int64_t> a;
    for (size_t i = 0; i < N; ++i) {
        int64_t t;
        std::cin >> t;
        a.push_back(t);
    }

    std::sort(std::begin(a), std::end(a),
              [](const auto& A, const auto& b) {
                  return A > b;
              });

    int64_t n = a[0];
    double nn = n / 2.0;

    int64_t r = a[1];

    for (int64_t i = 1; i < N; ++i) {
        if (abs((double)r - nn) > abs((double)a[i] - nn)) {
            r = a[i];
        }
    }

    std::cout << n << " " << r << std::endl;

    return 0;
}


Measured memory_bytes: 1400
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using ll = long long;

ll M, N;
ll A[110], S, cnt;

int main()
{
  std::cin >> N >> M;

  rep( i, N )
  {
    std::cin >> A[i];
    S += A[i];
  }

  rep( i, N )
  {
    if( A[i]*(4*M) >= S )
      ++cnt;
  }

  std::cout << (cnt >= M ? "Yes" : "No") << std::endl;

  return 0;
}

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

using namespace std;

#define sqr(a) ((a)*(a))
#define all(a) (a).begin(), (a).end()

const long long MOD = (int) 1e9 + 7;

long long binPow(long long a, long long b) {
    if (b == 0)
        return 1;

    long long ans = binPow(a, b / 2);
    ans = ans * ans % MOD;

    if (b % 2)
        ans = ans * a % MOD;

    return ans;
}

int main() {
//    freopen("input.txt", "r", stdin);
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int n;
    cin >> n;

    string a;
    cin >> a;

    for (char i : a) {
        cout << char((i - 'A' + n) % 26 + 'A');
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mem(a,b) memset(a,b,sizeof(a))
#define pii pair<int,int>
#define int long long
const int inf = 0x3f3f3f3f;
const int maxn = 201110;
const int M = 1e9+7;

int p[maxn],q[maxn],r[maxn];

int sum[maxn];
int ans[maxn];

signed main()
{
    int x,y,a,b,c;
    cin>>x>>y>>a>>b>>c;
    int n = x+y;
    for(int i = 1; i <= a; i++) 
    {
        cin>>p[i];
    }
    sort(p+1,p+1+a,greater<int>());
    for(int i = 1; i <= b; i++) 
    {
        cin>>q[i];
    }
    sort(q+1,q+1+b,greater<int>());
    for(int i = 1; i <= c; i++) 
    {
        cin>>r[i];
    }
    sort(r+1,r+1+c,greater<int>());
    for(int i = 1; i <= c; i++) 
    {
        sum[i] = sum[i-1] + r[i];
    }
    int red = 0,green = 0,pos = 1;
    while(red < x && green < y)
    {   
        if(p[red+1] > q[green+1]) 
        {   
            red++;
            ans[pos] = ans[pos-1]+p[red];
        }
        else
        {
            green++;
            ans[pos] = ans[pos-1]+q[green];
        }
        pos++;
    }
    while(red < x)
    {
        red++;
        ans[pos] = ans[pos-1]+p[red];
        pos++;
    }
    while(green < y)
    {
        green++;
        ans[pos] = ans[pos-1]+q[green];
        pos++;
    }
    int res = 0;
    for(int i = 0; i <= min(c,n); i++) 
    {
        res = max(res,sum[i]+ans[n-i]);
    }
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 7040
# 数列aの最小値min_aの最大値はM//N
# 他の要素がmin_aの倍数であれば、min_aが最大公約数となる
# すなわち、(M-min_a)をmin_aで割った余りが0

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

if M%2 == 0:
    for i in range(M//N, 0, -1):
        if (M - i)%i == 0:
            break
    print(i)    
else:
    if M//N % 2 == 0:
        min_a = M//N - 1
    else:
        min_a = M//N
    for i in range(min_a, 0, -2):
        if (M - i)%i == 0:
            break
    print(i)      

Measured memory_bytes: 40044
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <queue>
#include <algorithm> // sort

#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll mod = 1000000007;
static const ll INF = 1000000000000000000LL;
using namespace std;


int main(){
    ll a,b,c;
    cin >> a >> b >> c;
    ll res = 0;
    //やってみる
    while(true)
    {
        if(res > 100000)
        {
            res = -1;
            break;
        }
        if(a % 2 == 1 || b % 2 == 1 || c % 2 == 1)break;
        ll tmp_a, tmp_b;
        tmp_a = a;
        tmp_b = b;
        
        a = b / 2 + c / 2;
        b = tmp_a / 2 + c / 2;
        c = tmp_a / 2 + tmp_b / 2;

        ++res;
    }


    cout << res << endl;

    return 0;
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
 
ll N,M;
 
int main(){
    cin >> N >> M;
    if(N%2 == 1){
        for(int i=0;i<M;i++){
            cout << 1+i << " " << N-i << endl;
        }
        return 0;
    }
    int p = 0;
    for(int i=0;i<M;i++){
        if((N-i)-(1+i) <= N / 2){
            break;
        }
        cout << 1+i << " " << N-i << endl;
        p++;
    }
    for(int i=p;i<M;i++){
        cout << 1+i << " " << N-i-1 << endl;
    }
    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
using ll = long long;
const long long INF = 1LL << 60;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;

int main() {
	int n, w;
	cin >> n >> w;
	int max_sum_v = (n + 1) * 1001;
	VV<ll> dp(n + 1, V<ll>(max_sum_v, INF));
	dp[0][0] = 0;
	V<int> vw(n);
	V<int> vv(n);
	rep(i, n) {
		cin >> vw[i] >> vv[i];
	}
	rep(i, n) {
		for (int sum_v = 0; sum_v < max_sum_v; ++sum_v) {
			chmin(dp[i + 1][sum_v], dp[i][sum_v]);
			if (sum_v - vv[i] < 0) continue;
			chmin(dp[i + 1][sum_v], dp[i][sum_v - vv[i]] + vw[i]);
		}
	}
	ll r=0;
	rep(i, max_sum_v) {
		if (dp[n][i] <= w) r = i;
	}
	cout << r << endl;
	return 0;
}

Measured memory_bytes: 81152
S = input()
a = int(S[0:2])
b = int(S[2:4])
LIST = [False,False]

if 1 <= b <= 12 and a >= 0:#YYMM
    LIST[0] = True 
if 1 <= a <= 12 and b >= 0:#MMYY
    LIST[1] = True 

if LIST[0] and LIST[1]:
    print("AMBIGUOUS")
elif LIST[0] and not LIST[1]:
    print("YYMM")
elif not LIST[0] and LIST[1]:
    print("MMYY")
else:
    print("NA")


Measured memory_bytes: 3064
/*...Part - 01...*/

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <queue>
#include <deque>
#include <iterator>
#include <bitset>
#include <assert.h>
#include <new>
#include <sstream>
//#include <bits/stdc++.h>
using namespace std ;

/*...Part - 02...*/

typedef long long               ll ;
typedef long double             ld ;
typedef unsigned long long      ull ;
typedef pair<int,int>           pii ;
typedef pair<ll,ll>             pll ;
typedef vector<int>             vi ;
typedef vector<ll>              vll ;
typedef vector<vector<int>>     vvi ;

int Int(){int x ; scanf("%d",&x) ; return x ;}
ll Long(){ll x ; scanf("%lld",&x) ; return x ;}

/*...Part - 03...*/
/*....Debugger....*/

#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) {cout << endl ;}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << ' ' ;
    err(++it, args...);
}

/*...Part - 04...*/
/*...Needed to change according to problem requirements...*/

const int N          = (int)1e5 + 5 ;
const int maxN       = (int)1e6 + 6 ;
const ll  Mod        = (ll)1e9 + 7 ;
const int inf        = (int)2e9 ;
const ll  Inf        = (ll)1e18 ;

/*..........................................................*/
/*...Part - 05...*/

#define     debug(x)    cerr << #x << " = " << x << '\n' ;
#define     rep(i,b,e)  for(__typeof(e) i = (b) ; i != (e + 1) - 2 * ((b) > (e))  ; i += 1 - 2 * ((b) > (e)))
#define     Int         Int()
#define     Long        Long()
#define     all(x)      x.begin() , x.end()
#define     sz(x)       (int)x.size()
#define     ff          first
#define     ss          second
#define     pb          push_back
#define     eb          emplace_back
#define     mem(a)      memset(a , 0 ,sizeof a)
#define     memn(a)     memset(a , -1 ,sizeof a)

/*...Part - 06...*/
/*...... ! Code start from here ! ......*/

int dp[N][3], a[N][3], n, k;

int call(int p, int l){
    if(p == n)return 0 ;
    int& ret = dp[p][l] ;
    if(~ret)return ret ;
    ret = 0 ;
    for(int i = 0 ; i < 3 ; ++i){
        if(i == l)continue ;
        ret = max(ret , call(p + 1, i) + a[p][i]) ;
    }
    return ret ;
}
int main(){
    int test = 1 , tc = 0 ;
    while(test--){
        n = Int;
        for(int i = 0 ; i < n ; ++i){
            for(int j = 0 ; j < 3 ; ++j)
                a[i][j] = Int;
        }
        memn(dp) ;
        int res = 0 ;
        for(int i = 0 ; i < 3 ; ++i)res = max(res , call(1 , i) + a[0][i]) ;
        cout << res << '\n' ;
    }
    return 0 ;
}

/*...Always look at the part - 04...*/
/*...............END................*/




Measured memory_bytes: 10368
#include <cstdio>

int main(){
	char tbl[8][8];
	char ttbl[8][8];
	
	for(int i = 0; i < 8; i++){
		scanf("%s", &tbl[i]);
	}
	
	printf("90\n");
	for(int i = 0; i < 8; i++){
		for(int j = 7; j >= 0; j--){
			printf("%c", tbl[j][i]);
		}
		putchar('\n');
	}
	
	printf("180\n");
	for(int i = 7; i >= 0; i--){
		for(int j = 7; j >= 0; j--){
			printf("%c", tbl[i][j]);
		}
		putchar('\n');
	}
	
	printf("270\n");
	for(int i = 7; i >= 0; i--){
		for(int j = 0; j < 8; j++){
			printf("%c", tbl[j][i]);
		}
		putchar('\n');
	}
	
	return 0;
}

Measured memory_bytes: 952
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = scanner.nextInt();
        }
        int cnt = sort(A);
        for (int i = 0; i < N; i++) {
            System.out.print(A[i]);
            if (i == N - 1) {
                System.out.println("");
            } else {
                System.out.print(" ");
            }
        }
        System.out.println(cnt);
    }

    private static int sort(int[] a) {
        int cnt = 0;
        for (int i = 0; i < a.length; i++) {
            int mi = i;
            for (int j = i + 1; j < a.length; j++) {
                if (a[j] < a[mi]) {
                    mi = j;
                }
            }
            if (i != mi) {
                int t = a[i];
                a[i] = a[mi];
                a[mi] = t;
                cnt++;
            }
       }
        return cnt;
    }
}

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

// definition {{{ 1

// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)

#define Scll(x) scanf("%llu", &x)
#define Scll2(x,y) scanf("%llu%llu", &x, &y)
#define Scll3(x,y,z) scanf("%llu%llu%llu", &x, &y, &z)

#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2

// constants {{{ 2
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// }}} 2

// systems {{{ 2
#define Rep(x,y) for(int x = 0; x < y; x++)
#define Repe(x,y,z) for(int x = z; x < y; x++)
// }}} 2

// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n");
// }}} 2

// }}} 1

int main() {

    int N;
    int a,b;
    Scd2(a,b);

    if( b%a==0 ) printf ("%d\n", a+b); else printf ("%d\n", b-a);

    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<cmath>
using namespace std;
#define REP(i, limit) for(int i=0; i< limit; ++i)
#define FOR(i, j, limit) for(int i=j; i< limit; ++i)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ECHO(x) cout<<x<<endl;
#define LL long long
int INF = 2147483647;
LL LINF = 9223372036854775807;
LL MOD = 1000000007;
typedef pair<int, int>P;
typedef pair<LL, LL>PL;
typedef vector<int> vi;
typedef vector<LL> vl;


int main(){
  int n;
  cin>>n;

  int a[n+2];
  a[0]=0;
  a[n+1]=0;
  LL sum=0;
  REP(i, n) {
    cin>>a[i+1];
    sum+=abs(a[i+1]-a[i]);
  }
  sum += abs(a[n+1]-a[n]);
  LL ans;
  FOR(i,1, n+1){
    ans = sum -abs(a[i-1]-a[i]) -abs(a[i]-a[i+1]) + abs(a[i-1] -a[i+1]);
    ECHO(ans);
  }
  return 0;
}


Measured memory_bytes: 1664
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i, j, n) for (i64 i = (j); i < (n); ++i)
using namespace std;
using i64 = int64_t;

int main()
{
  i64 n;
  cin >> n;
  vector<i64> x(n), y(n);
  rep(i, 0, n) cin >> x[i] >> y[i];

  i64 ans = n;
  rep(i, 0, n)
  {
    rep(j, 0, n)
    {
      if (i == j)
        continue;
      i64 p = x[j] - x[i];
      i64 q = y[j] - y[i];

      i64 cnt = 0;
      rep(k, 0, n)
      {
        rep(l, 0, n)
        {
          if (k == l)
            continue;
          i64 r = x[l] - x[k];
          i64 s = y[l] - y[k];
          if (p == r && q == s)
            ++cnt;
        }
      }
      ans = min(ans, n - cnt);
    }
  }
  cout << ans;
}


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

int main() {
  int n;
  cin >> n;
  vector<long long> a(n), b(n);
  for(int i = 0; i < n; i++) cin >> a.at(i) >> b.at(i);
  
  long long ans = 0;
  reverse(a.begin(), a.end());
  reverse(b.begin(), b.end());
  for(int i = 0; i < n; i++){
    a.at(i) += ans;
    long long cnt = (a.at(i) + b.at(i) - 1) / b.at(i);
    ans += b.at(i) * cnt - a.at(i);
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 4800
#include <bits/stdc++.h>
#define INF 2000000000000000000
#define ll long long
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N, M;
  cin >> N >> M;
  vector<ll> A(N);
  for (ll i = 0; i < N; ++i) {
    cin >> A.at(i);
    A.at(i) %= M;
  }
  for (ll i = 0; i < N - 1; ++i) {
    A.at(i + 1) = (A.at(i) + A.at(i + 1)) % M;
  }
  A.push_back(0);
  // for (ll i = 0; i <= N; ++i) {
  //   cout << A.at(i) << " ";
  // }
  // cout << "\n";
  sort(A.begin(), A.end());
  ll before = A.at(0);
  ll num = 0;
  ll ans = 0;
  // for (ll i = 0; i < N; ++i) {
  //   if (A.at(i) == 0) {
  //     ans += 1;
  //   }
  // }
  for (ll i = 0; i <= N; ++i) {
    if (A.at(i) != before) {
      ans += ((num - 1) * num) / 2;
      num = 1;
      before = A.at(i);
    }
    else {
      num += 1;
    }
  }
  ans += (num - 1) * num / 2;
  cout << ans << "\n";
}


Measured memory_bytes: 4720
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <sstream>
#include <stack>
#include <deque>
using namespace std;
#define ll long long
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define pi pair<int,int>
#define pii pair<pi,int>
#define sqr(x) ((x)*(x))
#define FOR for(int i=0;i<n;i++)for(int j=0;j<m;j++)
const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	int n,m;
	cin>>n>>m;
	cout<<n-m+1;

    //system("pause");
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
  long long ans=0;
  int n,a[200020],b;
  cin >> n;
  for(int i=1; i<=n; i++) {
    cin >> a[i];
    a[i]-=i;
  }
  sort(a+1,a+1+n);
  b=a[(n+1)/2];
  for(int i=1; i<=n; i++) {
    ans+=abs(a[i]-b);
  }
  cout << ans << endl;
}


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

bool check(vector<string>& S, int h, int w) {
  int H = S.size();
  int W = S[0].size();
  for (int i = -1; i <= 1; i += 2) {
    int hi = h + i;
    if (hi == -1 || hi == H) continue;
    if (S[hi][w] == '#') return true;
  }
  for (int j = -1; j <= 1; j += 2) {
    int wj = w + j;
    if (wj == -1 || wj == W) continue;
    if (S[h][wj] == '#') return true;
  }
  return false;
}

int main() {
  int H, W;
  cin >> H >> W;

  vector<string> S(H);
  for (int i = 0; i < H; i++) {
    cin >> S[i];
  }

  for (int h = 0; h < H; h++) {
    for (int w = 0; w < W; w++) {
      if (S[h][w] == '#' && !check(S, h, w)) {
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
}

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

using namespace std;

#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second

template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }

typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const bool debug = 0;

ll dp[1001][1001];

int main() {
  string t, b;
  cin >> t >> b;
  
  dp[0][0] = 1;
  REP(i, t.size()) {
  	REP(j, b.size()) {
  		if (dp[i][j] == 0) continue;
  		
  		(dp[i + 1][j] += dp[i][j]) %= MOD;
  		if (t[i] == b[j]) (dp[i + 1][j + 1] += dp[i][j]) %= MOD;
		}
  }
  
  
  ll ans = 0;
  REP(i, t.size() + 1) ans += dp[i][b.size()];
  cout << ans % MOD << endl;
  
	return 0;
}

Measured memory_bytes: 9960
#include<iostream>
#include<vector>
#include<string>
#include<stdlib.h>

using namespace std;

int main() {
	int A, B;
	int sum = 0;

	cin >> A >> B;

	if (A >= B) {
		sum = A;
		if ((A - 1) >= B)
			sum += A - 1;
		else
			sum += B;
	}
	else {
		sum = B;
		if ((B - 1) >= A)
			sum += B - 1;
		else
			sum += A;
	}

	cout << sum << endl;


	
}



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

int main(){
    string s,t,u;
    int a,b;
    cin>>s>>t;
    cin>>a>>b;
    cin>>u;
    if(s==u){
        cout<<a-1<<' '<<b<<endl;
    }else{
        cout<<a<<' '<<b-1<<endl;
    }
}

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


int main() {
  int N;
  cin >> N;
  
  vector<string> vec(N);
  
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  
  int A=0;
  int B=0;
  int C=0;
  int D=0;
  
  for (int i = 0; i < N; i++) {
    if(vec.at(i)=="AC"){
      A ++;
    }
    if(vec.at(i)=="WA"){
      B++;
    }
    if(vec.at(i)=="TLE"){
      C++;
    }
    if(vec.at(i)=="RE"){
      D++;
    }
  }
  
  cout << "AC x " << A <<endl;
  cout << "WA x "<<B <<endl;
  cout << "TLE x "<<C <<endl;
  cout << "RE x "<<D <<endl;

}

Measured memory_bytes: 6372
#include<iostream>
using namespace std;
 
int main()
{
  int a, b, c; cin >> a >> b >> c;
  if ((a < c and  c < b ) || ( a > c and c > b))
  {
	cout << "Yes" << endl;
  }
  else
  {
	cout << "No" << endl;
  }
}

Measured memory_bytes: 256
N,M = map(int,input().split())
k = 1
for i in range(1,int(M**0.5)+1):
    if M%i==0:
        a = i
        b = M//i
        k1 = 1
        k2 = 1
        if b>=N:
            k1 = a
        if a>=N:
            k2 = b
        k = max(k,k1,k2)
print(k)

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

int main() {
  int n, a, b, m = 0, s = 0;
  cin >> n >> b;
  for(int i = 1;i < n;i++) {
    cin >> a;
    if(a > b) {
      if(m < s) m = s;
      s = 0;
    } else {
      s++;
    }
    b = a;
  }
  cout << (m < s ? s : m) << endl;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pll;

#define endl "\n"

const ll INF = 1e15;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
const double PI = acos(-1.0);

mt19937 rng((int) chrono::steady_clock::now().time_since_epoch().count());

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

    ll a;
    cin >> a;
    cout << a + a * a + a * a * a << endl;
}


Measured memory_bytes: 3612
N = int(input())
D = list(map(int, input().split()))

T = [0 for _ in range(13)]

for d in D:
    if d > 12:
        T[24-d] += 1
    else:
        T[d] += 1

which = []
A = []
ans = -1
for i, t in enumerate(T):
    if t == 0:
        continue
    elif t == 1:
        which.append(i)
    elif t == 2:
        A.extend([i, 24-i])
    else:
        ans = 0
        break

def dfs(which, i, l, p):
    if i == len(which):
        p.append(l)
        return p
    t = which[i]
    p = dfs(which, i+1, l+[t], p)
    p = dfs(which, i+1, l+[24-t], p)
    return p

if ans == 0:
    print(0)
else:
    p = dfs(which, 0, [], [])
    #print(p)
    ans = 0
    for l in p:
        B = sorted(l+A)
        pre = 0
        tmp = 100
        for b in B:
            tmp = min(tmp, b-pre)
            pre = b
        tmp = min(tmp, 24-pre)
        ans = max(ans, tmp)
    print(ans)

Measured memory_bytes: 3064
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
//#define mt make_tuple
//typedef tuple<int,int,int> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int a,b;
	cin>>a>>b;
	if(a<=b)cout<<a<<endl;
	else cout<<a-1<<endl;
}









Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
double a,b,x;
double Rad_to_deg  = 45.0 / atan(1.0);
int main ( void ) {
	cin>>a>>b>>x;
	if ( x >= ( a * a * b ) / 2 ) {
		double C = 2.0 * b - ( 2.0 * x / ( a * a ) );
		double hu = atan ( a / C );
		hu = hu * Rad_to_deg * 1.0;
		printf ( "%.10lf\n" , 90.0000000 - hu );
	}
	else {
		double A = ( 2.0 * x ) / ( a * b );
		double hu = atan ( A / b );	
		hu = hu * Rad_to_deg * 1.0;
		printf ( "%.10lf\n" , 90.0000000 - hu );
	}
	return 0;
}

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

int main() {
    int num;
    long long center, centerL;
    cin >> num;

    vector<long long> vec(num);
    vector<long long> vec2;
    for (int i = 0; i < num; i++) { cin >> vec.at(i); }

    vec2 = vec;
    sort(vec2.begin(), vec2.end());

    center = vec2.at(num / 2);
    centerL = vec2.at(num / 2 - 1);

    for (int i = 0; i < num; i++) {
        if (vec.at(i) < center) {
            cout << center << endl;
        } else {
            cout << centerL << endl;
        }
    }
}

Measured memory_bytes: 6296
import java.io.*;
import java.util.*;
import java.math.*;
import java.awt.Point;
 
public class Main {
	//static final long MOD = 998244353L;
	//static final long INF = -1000000000000000007L;
	//static final long MOD = 1000000007L;
	static final int INF = 1000000007;
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter pw = new PrintWriter(System.out);
		int N = sc.ni();
		int X = sc.ni();
		if (500*N>=X) {
			pw.println("Yes");
		} else {
			pw.println("No");
		}
		pw.close();
	}
	
	//Find the GCD of two numbers
	public static long gcd(long a, long b) {
		if (b == 0)
			return a;
		else
			return gcd(b,a%b);
	}
	
	//Fast exponentiation (x^y mod m)
	public static long power(long x, long y, long m) { 
		long ans = 1;
		x %= m;
		while (y > 0) { 
			if(y % 2 == 1) 
				ans = (ans * x) % m; 
			y /= 2;  
			x = (x * x) % m;
		} 
		return ans; 
	}
	
	public static int[][] shuffle(int[][] array) {
		Random rgen = new Random();
		for (int i = 0; i < array.length; i++) {
		    int randomPosition = rgen.nextInt(array.length);
		    int[] temp = array[i];
		    array[i] = array[randomPosition];
		    array[randomPosition] = temp;
		}
		return array;
	}
	
    public static int[][] sort(int[][] array) {
    	//Sort an array (immune to quicksort TLE)
 
		Arrays.sort(array, new Comparator<int[]>() {
			  @Override
        	  public int compare(int[] arr1, int[] arr2) {
				  return arr1[1]-arr2[1]; //ascending order
	          }
		});
		return array;
	}
    
    public static long[][] sort(long[][] array) {
    	//Sort an array (immune to quicksort TLE)
		Random rgen = new Random();
		for (int i = 0; i < array.length; i++) {
		    int randomPosition = rgen.nextInt(array.length);
		    long[] temp = array[i];
		    array[i] = array[randomPosition];
		    array[randomPosition] = temp;
		}
		Arrays.sort(array, new Comparator<long[]>() {
			  @Override
        	  public int compare(long[] arr1, long[] arr2) {
				  return 0;
	          }
		});
		return array;
	}
    
    static class FastScanner { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastScanner() { 
            br = new BufferedReader(new InputStreamReader(System.in)); 
        } 
  
        String next() { 
            while (st == null || !st.hasMoreElements()) { 
                try { 
                    st = new StringTokenizer(br.readLine());
                } catch (IOException  e) { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int ni() { 
            return Integer.parseInt(next()); 
        } 
  
        long nl() { 
            return Long.parseLong(next()); 
        } 
  
        double nd() { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() { 
            String str = ""; 
            try { 
                str = br.readLine(); 
            } catch (IOException e) {
                e.printStackTrace(); 
            } 
            return str;
        }
    }
}

Measured memory_bytes: 21460
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <math.h>
#include <sstream>
#include <numeric>
#include <string>
#include <cassert>

using namespace std;
typedef long long ll;

int main() {
  int N, K;
  string S;
  cin >> N >> K;
  cin >> S;
  int ans = 0;
  int x = 0;
  for (int i = 1; i < N; ++i) {
    if (S[i - 1] == S[i]) ++ans;
    else ++x;
  }
  while (K > 0 and x >= 2) {
    ans += 2;
    x -= 2;
    --K;
  }
  if (K > 0 and x == 1) {
    ans += 1;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<queue>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
typedef long long int ll;
ll dx[4] = {1,0,0,-1};
ll dy[4] = {0,1,-1,0};

#define ARRAY_MAX 100005
int dp[ARRAY_MAX];

int main(){

    int n;
    cin >> n;
    REP(i,ARRAY_MAX){
        dp[i] = i;
    }

    for(int i = 1;i <= 6;i++){
        int tmp = int(pow(6,i));
        for(int j = 0;j <= n;j++){
            if(j >= tmp){
                dp[j] = min(dp[j],dp[j-tmp]+1);
            }
        }
    }

    for(int i = 1;i <= 5;i++){
        int tmp = int(pow(9,i));
        for(int j = 0;j <= n;j++){
             if(j >= tmp){
                dp[j] = min(dp[j],dp[j-tmp]+1);
            }
        }
    }
    cout << dp[n] << endl;
    return 0;
}

Measured memory_bytes: 640
import java.util.*;

class Pair
{
	int num;
	int walk;
	Pair(int num, int walk)
	{
		this.num = num;
		this.walk = walk;
	}
}
public class Main 
{
	
	public static void main(String[] args) 
	{
		Scanner stdIn = new Scanner(System.in);
		while(stdIn.hasNext())
		{
			int n = stdIn.nextInt();
			if(n == 0)
			{
				break;
			}
			List<Pair> list = new ArrayList<Pair>();
			for(int i = 0; i < n; ++i)
			{
				int num = stdIn.nextInt();
				int day1 = stdIn.nextInt();
				int day2 = stdIn.nextInt();
				list.add(new Pair(num, day1 + day2));
			}
			Collections.sort(list, new Comparator<Pair>()
			{ 
				public int compare(Pair t1, Pair t2)
				{
					return (t1.walk - t2.walk); 
				}
			} );
			System.out.println(list.get(list.size() - 1).num + " " + list.get(list.size() - 1).walk);
		}
	}
}

Measured memory_bytes: 16000
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!$BDs=P;~$K%3%a%s%H%"%&%H(B!!
#ifdef DEBUG_
#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

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; }

    template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int mod = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);
    int N; 
    cin >> N;
    VI t(N),v(N);
    REP(i,N) cin >> t[i];
    REP(i,N) cin >> v[i];
    VI S(N+1);
    REP(i,N){
        S[i+1] = S[i] + t[i];
    }

    vector<vector<double>> speed(40010);
    REP(i,N){
        int t1 = S[i];
        int t2 = S[i+1];
        for(int j = 2 * t1; j <= 2*t2; j++){
            speed[j].eb(v[i]);
        }
    }
    REP(i,N){
        int t1 = S[i+1];
        double vlimit;
        if(i == N-1) vlimit = 0;
        else vlimit = v[i+1];
        for(int j = 0; j <= 2 * t1; j++){
            speed[j].eb((2.0*t1-j)/ 2.0 + vlimit);
        }
    }
    REP(i,N){
        int t1 = S[i];
        double vlimit;
        if(i == 0) vlimit = 0;
        else vlimit = v[i-1];
        for(int j = 2*t1; j < 40010; j++){
            speed[j].eb((j-2.0*t1) / 2.0 + vlimit);
        }

    }
    double ans = 0;
    REP(i,S[N]*2){
        double v1 = *min_element(speed[i].begin(),speed[i].end());
        double v2 = *min_element(speed[i+1].begin(),speed[i+1].end());

        //cout << "sec: " << i / 2.0 << endl;
        //cout << v1 << endl;

        ans += (v1 + v2) * 0.25;
    }
    cout << ans << endl;

    

}

Measured memory_bytes: 44160
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MX=1e5+5;

int main(){
     int i, j, k;
     string str;
     cin >> str;
     for(i=0; i<str.length(); ++i) if(str[i]=='?') str[i]='D';
     cout << str << endl;
}


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

#define x first
#define y second

using namespace std;
using lli = long long int;
const lli maxn=1e6+5;
lli n,d;
lli dem;

void nhap()
{
    //freopen("test.inp","r",stdin);
    {
        cin>>n>>d;
        for(lli i=1;i<=n;i++)
		{
            lli u,v;
            cin>>u>>v;
            if(sqrt(u*u+v*v) <=d)
			{
                dem++;
			}

		}

		cout<<dem;
    }
}
int main()
{
    nhap();
}


Measured memory_bytes: 3664
#include "bits/stdc++.h"

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define bit(n) (1LL << (n))
#define sz(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define en '\n'
#define pb push_back
#define P pair<int, int>

typedef long long ll;
using namespace std;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = (int)1e9;
const ll  inf = (ll)1e18;
const int mod = 1000000007;

struct aaa {
	aaa() {
		cin.tie(0);
		ios::sync_with_stdio(0);
		cout << fixed << setprecision(20);
	};
}aaaaa;

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

	string a = s.substr(0, 2);
	string b = s.substr(2, 2);

	bool is_a = false, is_b = false;

	if (1 <= stoi(a) && stoi(a) <= 12) {
		is_a = true;
	}
	if (1 <= stoi(b) && stoi(b) <= 12) {
		is_b = true;
	}

	if (is_a && is_b) {
		cout << "AMBIGUOUS" << endl;
	}
	else if (is_a) {
		cout << "MMYY" << endl;
	}
	else if (is_b) {
		cout << "YYMM" << endl;
	}
	else {
		cout << "NA" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, OrderedDict
from copy import deepcopy
from functools import lru_cache, reduce
from math import ceil, floor
from sys import setrecursionlimit

import heapq
import itertools
import operator


inf = float('inf')


# globals
N = 0


def set_inputs():
    global N
    N = get_int()
    return


def main():
    setrecursionlimit(100000)
    set_inputs()
    if N == 0:
        print(0)
        return
    n = N
    ans = []
    while n != 0:
        rem = n % 2
        n = (n - rem) // (-2)
        ans.append(rem)
    ans.reverse()
    print("".join(map(str, ans)))
    return


def get_int():
    return int(input())


def get_float():
    return float(input())


def get_str():
    return input().strip()


def get_li():
    return [int(i) for i in input().split()]


def get_lf():
    return [float(f) for f in input().split()]


def get_lc():
    return list(input().strip())


def get_data(n, types):
    if len(types) == 1:
        return [types[0](input()) for _ in range(n)]
    return zip(*(
        [t(x) for t, x in zip(types, input().split())]
        for _ in range(n)
    ))


if __name__ == '__main__':
    main()


Measured memory_bytes: 3828
import java.util.Arrays;

public class Main {
	
	public static void main(String[] args) {
	    java.util.Scanner scanner = new java.util.Scanner(System.in);
	    int h = scanner.nextInt();
	    int w = scanner.nextInt();
	    int c[][] = new int[10][10];
	    for (int i = 0; i < 10; i++) {
	    	for (int j = 0; j < 10; j++) {
	    		c[i][j] = scanner.nextInt();
	    	}
	    }
	    calcCost(c);
	    int total = 0;
	    for (int i = 0; i < h*w; i++) {
	    	int a = scanner.nextInt();
	    	if (a == -1 || a == 1) {
	    		continue;
	    	}
	    	total = total + c[a][1];
	    }
	    System.out.println(total);
	}
	
	private static void calcCost(int[][] c) {
		for (int k = 0; k < 10; k++) {
			for (int i = 0; i < 10; i++) {
				for (int j = 0; j < 10; j++) {
					c[i][j] = Math.min(c[i][j], c[i][k] + c[k][j]);
				}
			}
		}
	}

}


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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 60)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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; }



string s;
void solve(){
	cin >> s;
	
	for(int i = 0; i < 3; i++){
		if(s[i] == '7'){
			cout << "Yes" << endl;
			return;
		}
	}
	cout << "No" << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define int long long
#define all(a) a.begin(), a.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b, ans = 0;
    cin >> a >> b;
    if(a + b == 15) cout << "+" << endl;
    else if(a * b == 15) cout << "*" << endl;
    else cout << "x" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <cassert>
#include <random>

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

using namespace std;
typedef long long int ll;
const ll INF = 10000000000;
const double PI = acos(-1);
const ll mod = 1000000007;

int main()
{
    int n, p;
    cin >> n >> p;
    vector<int> a(n);
    rep(i, n) cin >> a[i];

    bool is_all_even = true;
    rep(i, n) {
        if (a[i] % 2 != 0) is_all_even = false;
    }

    ll ans = pow(2, n);

    if (is_all_even) {
        if (p == 0) cout << ans << endl;
        else cout << 0 << endl;
    }
    else {
        cout << ans / 2 << endl;
    }
    return 0;
}


Measured memory_bytes: 4012
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<set>

using namespace std;
int main() {
	int a; cin >> a;
	string s; cin >> s;
	if (a < 3200)cout << "red";
	else cout << s;
	cout << endl;

	return 0;
}

Measured memory_bytes: 256