akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
#define INF 1LL<<60

map< ll, ll > prime_factor(ll n) {
    map< ll, ll > ret;
    for(ll i = 2; i * i <= n; i++) {
        while(n % i == 0) {
            ret[i]++;
            n /= i;
        }
    }
    if(n != 1) ret[n] = 1;
    return ret;
}

int main() {
    ll N;
    cin >> N;
    map<ll, ll> factors = prime_factor(N);
    ll ans = 0;
    for(auto f = factors.begin(); f != factors.end(); ++f) {
        ll base = f->first;
        ll mul = f->second;
        ll times = 1;
        while(mul > 0) {
            N /= pow(base, times);
            mul -= times;
            times++;
            ans++;
            if(mul < times) break;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4072
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<tuple>
#include<iomanip>
#include<map>
#include<queue>
#include<set>
#define int long long
using namespace std;
const int INF = 1e10;
const int ZERO = 0;

signed main() {
	string S;
	cin >> S;
	if(S <= "2019/04/30") {
		cout << "Heisei" << endl;
	}
	else {
		cout << "TBD" << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <deque>

using namespace std;

struct sol {
	long long x, cost;
	long long c;

	sol(long long xx, long long cc, long long C) {
		x = xx;
		cost = cc;
		c = C;
	}

	long long getCost(long long y) {
		long long d = y - x;
		return d * d + cost + c;
	}

	long long time(sol sol2) {
		long long l = sol2.x;
		long long r = l;

		while (getCost(r) < sol2.getCost(r)) {
			l = r + 1;
			r *= 2;
		}
		long long ans = r;

		while (l <= r) {
			long long mid = l + (r - l) / 2;
			if (getCost(mid) >= sol2.getCost(mid)) {
				ans = mid;
				r = mid - 1;
			}
			else {
				l = mid + 1;
			}
		}
		return ans;
	}
};

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

	int n;
	long long c;
	cin >> n >> c;

	vector<long long> heights;
	for (int i = 0; i < n; i++) {
		long long h;
		cin >> h;
		heights.push_back(h);
	}

	vector<long long> dp(n);
	deque<sol> all;
	all.push_back({ heights[0], 0, c });

	for (int i = 1; i < n; i++) {
		while (all.size() >= 2 && all[0].getCost(heights[i]) >= all[1].getCost(heights[i])) {
			all.pop_front();
		}
		dp[i] = all[0].getCost(heights[i]);
		sol add(heights[i], dp[i], c);
		while (all.size() >= 2 && all[all.size() - 2].time(all[all.size() - 1]) > all[all.size() - 1].time(add)) {
			all.pop_back();
		}
		all.push_back(add);
	}

	cout << dp[n - 1] << "\n";
}

Measured memory_bytes: 9480
from operator import itemgetter
N,T = [int(x) for x in input().split()]
ct = li = [[0 for j in range(2)] for i in range(N)]
for i in range(N):
    ct[i][0],ct[i][1] = [int(x) for x in input().split()]
ct.sort(key=itemgetter(0))
flag = False
for i in ct:
    if(i[1]<=T):
        print(i[0])
        flag = True
        break
if(not flag):
    print('TLE')


Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
#define int long long

#define FOR(i, a, b) for(int i=a;i<b;i++)
#define rep(i, b) FOR(i,0,b)
#define INF LLONG_MAX
#define all(a) (a).begin,(a).end()

int N,M,S,T;

struct Edge{
    int to,cost;
    Edge(int to,int cost):to(to),cost(cost){}
};
struct idxcost{
    int idx,cost;
    idxcost(int idx,int cost):idx(idx),cost(cost){}

    bool operator > (const idxcost& s)const{
        return (cost > s.cost);
    }
};
vector<Edge> G_en[112345];
vector<Edge> G_snu[112345];
int d[112345];
int d_snu[112345];
int ans[112345];
int pans[112345];

void dijkstra_en(int s){
    //rep(i,112345)d[i]=0;
    priority_queue<idxcost,vector<idxcost>,greater<idxcost>> pq;
    fill(d,d+112345,INF);
    d[s]=0;
    pq.push(idxcost(s,0));
    while(!pq.empty()){
        idxcost p = pq.top();pq.pop();
        int v=p.idx;
        if(d[v]<p.cost)continue;

        for(int i=0;i<G_en[v].size();i++){
            Edge e=G_en[v][i];
            if(d[e.to]>d[v]+e.cost){
                d[e.to]=d[v]+e.cost;
                pq.push(idxcost(e.to,d[e.to]));
            }
        }
    }
}

void dijkstra_snu(int s){

    priority_queue<idxcost,vector<idxcost>,greater<idxcost>> pq;
    fill(d_snu,d_snu+112345,INF);
    d_snu[s]=0;
    pq.push(idxcost(s,0));
    while(!pq.empty()){
        idxcost p = pq.top();pq.pop();
        int v=p.idx;
        if(d_snu[v]<p.cost)continue;

        for(int i=0;i<G_snu[v].size();i++){
            Edge e=G_snu[v][i];
            if(d_snu[e.to]>d_snu[v]+e.cost){
                d_snu[e.to]=d_snu[v]+e.cost;
                pq.push(idxcost(e.to,d_snu[e.to]));
            }
        }
    }

}

signed main(){

    cin>>N>>M>>S>>T;
    S--;T--;

    rep(i,M){
        int u,v,a,b;
        cin>>u>>v>>a>>b;
        //0-indexedに
        u--;v--;
        G_en[u].push_back(Edge(v,a));
        G_en[v].push_back(Edge(u,a));
        G_snu[u].push_back(Edge(v,b));
        G_snu[v].push_back(Edge(u,b));

    }
    dijkstra_en(S);
    dijkstra_snu(T);


    rep(i,N){
        //両替する場所をiとした時のs->i + j->t

        int en_dis=d[i];
        int snu_dis=d_snu[i];

        ans[i]=en_dis+snu_dis;

    }


    int tans=1000000000000000;
    pans[N]=tans;
    for(int i=N-1;i>=0;i--){
        pans[i]=min(pans[i+1],ans[i]);
    }

    rep(i,N){
        //i番目からの都市が使える
        cout<<1000000000000000-pans[i]<<endl;

    }



}

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

int main(){
  long long n,k,ans=0;
  cin>>n >>k;
  if(k%2!=0){
    ans = pow(n/k,3);
  }else{
    ans = pow(n/k,3)+pow(2*n/k-n/k,3);
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MOD 1000000007
#define MAX 1000000007
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define ub upper_bound
#define lb lower_bound
#define zoom ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define precise cout.precision(8); cout << fixed;
#define seed srand(chrono::steady_clock::now().time_since_epoch().count());
const double PI = acos(-1);
using namespace std;

void solve() {
    int N, i; cin >> N;
    vector<int> A(N);
    int temp = 0;
    for(i = 0; i < N; i += 1) {
        cin >> A[i];
        temp ^= A[i];
    }
    for(i = 0; i < N; i += 1) {
        cout << (temp ^ A[i]) << " ";
    }
}

int main() {
    int t = 1;
    //cin >> t;
    while(t--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3964
def ints():
  return [int(x) for x in input().split()]
def ii():
  return int(input())

N, M = ints()
A = ints()
A.sort()
A.reverse()

def combinations(x):
  s = 0
  i = 0
  for j in reversed(range(N)):
    while i<N and A[i]+A[j]>=x:
      i += 1
    s += i
    
  return s

def koufukudo(x):
  s = 0
  si = 0
  i = 0
  for j in reversed(range(N)):
    while i<N and A[i]+A[j]>=x:
      si += A[i]
      i += 1
    s += si + A[j]*i
    
  return s


def bsearch(l, u):
  m = (l+u)//2
  c = combinations(m)
  if c<M:
    return bsearch(l, m)
  else:
    if l==m:
      return (l, c-M)
    return bsearch(m, u)

x, dm = bsearch(0, A[0]*2+1)
print(koufukudo(x)-dm*x)


Measured memory_bytes: 14268
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//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; }
  
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

int cnt[105];

int num(int n){
    int res = 0;
    for(int i=0; i<105; i++) if(cnt[i]>=n) res++;
    return res;
}

int main(){
    int N; cin >> N;
    for(int i=2; i<=N; i++){
        int n=i;
        for(int j=2; j*j<=n; j++){
            if(n%j==0){
                while(n%j==0){
                    cnt[j]++;
                    n /= j;
                }
            }
        }
        if(n!=1) cnt[n]++;
    }

    cout << num(74) + num(14)*(num(4)-1) + num(24)*(num(2)-1) + num(4)*(num(4)-1)/2*(num(2)-2) << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <iomanip>
using namespace std;
 
#define LOCAL  1
#define UPLOAD 2
 
#define ll long long
const long long INF = 1LL << 60;
 
template <class T = long long> T input(){T x;cin >> x;return x;}
template <class T> void output(T x){cout << x << endl;}
#define debug(x) cerr << #x<< ": " << x<< '\n';
#define debugBit(x,n) cerr << #x<< ": " << std::bitset<n>(x) << '\n';
 
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}

int main()
{
#if ENVIRONMENT == LOCAL
    std::ifstream in("input.txt");
    std::cin.rdbuf(in.rdbuf());
#endif
 
  string a = input<string>();
  
  if(a[2] == a[3] && a[4] == a[5]){
    output("Yes");
  }
  else{
    output("No");
  }
 
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>

using namespace std;

#define PB push_back
#define ALL(v) (v).begin(), (v).end()
#define SZ size()
#define FOR(i, a, n) for(long long (i) = (a); (i) < (n); (i)++)
#define REP(i, n) FOR((i), 0, (n))
#define SHOW(v) cout << (v) << endl
#define SHOW2(a, b) cout << (a) << " " << (b) << endl
#define SHOW3(a, b, c) cout << (a) << " " << (b) << " " << (c) << endl
#define GET(v) cin >> (v)
#define GET2(a, b) cin >> (a) >> (b)
#define GET3(a, b , c) cin >> (a) >> (b) >> (c)
#define MOD 1000000007
template<class T> void GETV(T &v) { REP(i, v.size()) { GET(v[i]); } }
template<class T> void SHOWV(T &v) { REP(i, v.size()) { SHOW(v[i]); } }

typedef long long ll;

struct xyz {
    ll a;
    ll b;
};

int main()
{
    int n, h;
    GET2(n, h);
    
    vector<xyz> v(n);
    REP(i, n) {
        cin >> v[i].a >> v[i].b;
    }
    
    sort(ALL(v), [](const xyz &x, const xyz &y){return x.a > y.a;});
    ll max = v[0].a;
    
    sort(ALL(v), [](const xyz &x, const xyz &y){return x.b > y.b;});
    
    ll ans = 0;
    int cnt = 0;
    while(h > 0 && v[cnt].b > max && cnt != n) {
        h -= v[cnt].b;
        ans++;
        cnt++;
        if(h <= 0) {
            SHOW(ans);
            return 0;
        }
    }
    
    ans += h % max == 0 ? h / max : h / max + 1;
    
    SHOW(ans);
    return 0;
}



Measured memory_bytes: 1792
def nc2(n):
	if n<2:
		return 0
	else:
		return (n * (n-1))//2
n = int(input())
li = list(map(int, input().split()))
s=0; 
d2={}
import collections as cl
d = cl.Counter(li)
for k, v in d.items():
	d2[k] = [nc2(v), nc2(v-1)]
	for v in d2[k]:
		s+=v
		break
# print(d2,s)
for i in li:
	print(s-(d2[i][0])+d2[i][1])
# print(d)
# for i in li:
# 	ans = 0
# 	for k,v in d.items():
# 		if k!=i:
# 			ans+=nc2(v)
# 		else:
# 			ans+=nc2(v-1)
# 	print(ans)

Measured memory_bytes: 40636
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <string>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
using namespace std;
#define rep(i,n) for(i=0;i<n;i++)
#define repl(k,n) for(k=0;k<n;++k)

int main() {
	int N;
	int K;
	int i;
	cin >> N >> K;
	vector<int> A(N);
	rep(i, N) {
		cin >> A[i];
	}
	rep(i, N - K) {
		if (A[i + K] > A[i]) {
			cout << "Yes\n";
		}
		else {
			cout << "No\n";
		}
	}
	return 0;
}

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

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

int N;
int x[100010];
int y[100010];
int num[210000];

bool ok(int t) {
	ll need = ((ll)(N + 1) * N / 2) / 2 + 1;
	memset(num, 0, sizeof(num));

	const int B = 100010;

	int d = B;
	++num[d];
	int prefix = 0;

	ll cnt = 0;

	rep(i, N) {
		if (x[i] <= t) {
			prefix += num[d];
			++d;
		} else {
			prefix -= num[d-1];
			--d;
		}
		cnt += prefix;
		++num[d];
	}

	return cnt >= need;
}

int main() {
	cin >> N;

	rep(i, N) {
		cin >> x[i];
		y[i] = x[i];
	}
	sort(y, y + N);

	int lo = 0, hi = N-1;
	if (ok(y[0])) hi = 0;

	while (hi - lo > 1) {
		int t = (lo + hi) / 2;
		if (ok(y[t])) {
			hi = t;
		} else {
			lo = t;
		}
	}

	cout << y[hi] << endl;

	return 0;
}

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

int main() {
  int N;
  string S,T1,T2;
  cin >> N >>S;
  
  for(int i=0; i< N/2; i++) T1 += S.at(i);
  for(int j=N/2; j< N; j++) T2 += S.at(j);
  
  if(T1 == T2) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

int main() {
  int X,Y;
  cin >> X >> Y;
  vector<vector<char>> A (X,vector<char> (Y));
  for(int i=0;i<X;i++){
    for(int j=0;j<Y;j++){
      cin >> A.at(i).at(j);
    }
  }
  
  int dx[8]={1,1,0,-1,-1,-1,0,1};
  int dy[8]={0,1,1,1,0,-1,-1,-1};
  
  for(int i=0;i<X;i++){
    for(int j=0;j<Y;j++){
      if(A.at(i).at(j)=='.'){
        int count=0;
        for(int d=0;d<8;d++){
          int x=i+dx[d];
          int y=j+dy[d];
          if(0<=x && x<X && 0<=y && y<Y && A.at(x).at(y)=='#'){
            count++;
          }
        }
        A.at(i).at(j)='0'+count;
      }
    }
  }
    for(int i=0;i<X;i++){
      for(int j=0;j<Y;j++){
        cout << A.at(i).at(j);
        if(j==Y-1){
          cout << endl;
        }
      }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define MOD 1000000007
#define MAX 510000
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

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

//cout << fixed << setprecision(10);//
//最小公倍数//
ll gcd(ll x, ll y) {
	if (x == 0) return y;
	return gcd(y%x, x);
}
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }

//べき//
ll squ(ll n, ll p, ll m){
	if(p==0) return 1;
	if(p%2==0){
		ll t=squ(n, p/2, m);
		return t*t%m;
	}
	return n*squ(n,p-1,m);
	
}


//逆元mod(mを法とするaの逆元)//
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;
}

//Cmonp//
ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

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

//nが大

ll com(ll n,ll m){
	if(n<=0 || m<=0 || n==m){
		return 1;
	}
	if(n<m){
		return 0;
	}
	ll k=1;
	for(ll i=1;i<=m;i++){
       k*=(n-i+1); 
	   k%=MOD;
	   k*=modinv(i,MOD);
	   k%=MOD;
	}

	return k;
}


//


////////////////////////////////////////////////////////////////////




int main() {
string s;
cin>>s;
if(s[2]==s[3] && s[4]==s[5]){
    cout<<"Yes"<<endl;}
    else{
        cout<<"No"<<endl;
    }
return 0;

}



Measured memory_bytes: 764
#include"bits/stdc++.h"
using namespace std;

double vx(double x, int l, int r, int v) {
  if (x <= l) return v + (l - x);
  else if (l < x && x <= r) return (double)v;
  else return v + (x - r);
}

void Main() {
  int N;
  cin >> N;
  int T = 0;
  int t[N + 2];
  t[0] = 0;
  t[N + 1] = 0;
  for (int i = 1; i <= N; i++) {
    int tmp;
    cin >> tmp;
    t[i] = t[i - 1] + tmp;
    T += tmp;
  }
  int v[N + 2];
  v[0] = 0;
  v[N + 1] = 0;
  for (int i = 1; i <= N; i++) {
    cin >> v[i];
  }

  double ans = 0;
  double vmin1 = 0, vmin2 = 1000000;
  for (double tt = 0; tt <= T; tt += 0.5) {
    vmin2 = min(vmin2, vx(tt, 0, 0, 0));
    for (int i = 1; i <= N; i++) {
      vmin2 = min(vmin2, vx(tt, t[i - 1], t[i], v[i]));
    }
    vmin2 = min(vmin2, vx(tt, T, T, 0));
    //cout << tt << "sec\t" << vmin2 << endl;
    ans += 0.25 * (vmin1 + vmin2);
    vmin1 = vmin2;
    vmin2 = 1000000;
  }
  cout << ans << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}



Measured memory_bytes: 256
n,m = map(int,input().split())

data = []

for i in range(n):
    a,b,c = map(int,input().split())
    s = a+b+c
    data.append((a,b,c))

def signmap(x):
    sign = [-1,-1,-1]
    if x & 4:
        sign[0] = 1
    if x & 2:
        sign[1] = 1
    if x & 1:
        sign[2] = 1
    return sign

score = [0]*n
res = -1
for i in range(8):
    sign = signmap(i)
    for j in range(n):
        a,b,c = data[j]
        score[j] = sign[0]*a + sign[1]*b + sign[2]*c
    score.sort(reverse=True)
    res = max(res,sum(score[:m]))
    #print(sign,end=" ")
    #print(res)
print(res) 


Measured memory_bytes: 3188
#include <cstring>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

unordered_map<ll, ll> mp;


int main() {
#ifdef MY_DEBUG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmissing-noreturn"
    while (true) {
        mp = unordered_map<ll, ll>();
#pragma clang diagnostic pop
#endif

        int n, m;
        cin >> n >> m;
        char a[n][n], b[m][m];
        rep(i, n) rep(j, n) cin >> a[i][j];
        rep(i, m) rep(j, m) cin >> b[i][j];

        rep(i, n - m + 1) {
            rep(j, n - m + 1) {
                bool br = false;
                rep(k, m) {
                    rep(l, m) {
                        if (a[i + k][j + l] != b[k][l]) {
                            br = true;
                            break;
                        }
                    }
                    if (br) break;
                    if (k == m - 1) {
                        cout << "Yes" << endl;
                        return 0;
                    }
                }

            }
        }
        cout << "No" << endl;

#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int a, b, c;
    
    scanf("%d %d %d", &a, &b, &c);
    
    if (a < b && b < c)
    {
        printf("Yes\n");
    } else {
        printf("No\n");
    }
    
    return 0;
};

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

#define SZ(a) int((a).size())
#define _REP(_1,_2,_3,_4,name,...) name
#define _REP4(i,b,e,s) for(decltype(e) _b=(b),_e=(e),i=_b+(0<(s)?0:(s));(0<(s)?i<_e:_e<=i);i+=(s))
#define _REP3(i,b,e) for(decltype(e) _b=(b),_e=(e),i=(_b<_e?_b:_b-1);(_b<_e?i<_e:_e<=i);(_b<_e?i++:i--))
#define _REP2(i,n) for(decltype(n) i=0,_n=(n);i<_n;i++)
#define _REP1(n) for(decltype(n) _i=0,_n=(n);_i<_n;_i++)
#define REP(...) _REP(__VA_ARGS__,_REP4,_REP3,_REP2,_REP1)(__VA_ARGS__)
#define FOR(it,c) for(auto&& it=begin(c);it!=end(c);it++)
#define ROF(it,c) for(auto&& it=rbegin(c);it!=rend(c);it++)
#define EB emplace_back
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define INT(n) int n;assert(0<scanf("%d",&n))

int main(){
  vector<int> v, w;
  INT(n);
  REP(n){
    INT(x); INT(y);
    v.EB(x + y);
    w.EB(x - y);
  }
  sort(v.begin(), v.end());
  sort(w.begin(), w.end());
  int ans = max(v[n - 1] - v[0], w[n - 1] - w[0]);
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 5092
while True:
    m,f,r = [int(x) for x in input().split()]
    if (m,f,r)==(-1,-1,-1): break
    s_mf = m + f
    if   m < 0 or f < 0: print('F')
    elif s_mf <  30:     print('F')
    elif s_mf >= 80:     print('A')
    elif s_mf >= 65:     print('B')
    elif s_mf >= 50:     print('C')
    elif r    >= 50:     print('C')
    else:                print('D')


Measured memory_bytes: 5604
#include <iostream>
#include <cstdio>
#include <cctype>

using namespace std;

int main(void){
	char c;
	while(1){
		c = getchar();
		if(islower(c))
			c = toupper(c);
		else if(isupper(c))
			c = tolower(c);
		cout<<c;
		if(c=='\n')
			break;
	}

  return 0;
}

Measured memory_bytes: 1084
#include <bits/stdc++.h>
#define arep(a,i,n) for(ll i=(a);i<(n);i++)
#define rep(i,n) for(ll i=0;i<(n);i++)
#define cinf(x,n) for(ll i=0;i<(n);i++)cin>>x[i];
#define coutf(x,n) for(ll i=0;i<(n);i++)cout<<x[i]<<endl;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

using namespace std;

int main(){
	int a,b;
	cin >> a >> b;
	if(a%3!=0&&b%3!=0&&(a+b)%3!=0)
		cout << "Impossible" << endl;
	else
		cout << "Possible" << endl;
}

Measured memory_bytes: 3552
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

const int N = 300000;

bool is_prime[N+1];
vector<int> prime;

void sieve(){
  for(int i=0;i<=N;i++) is_prime[i] = true;
  is_prime[0] = is_prime[1] = false;
  for(int i=2;i<=N;i++){
    if(is_prime[i]){
      prime.push_back(i);
      for(int j=2*i;j<=N;j+=i) is_prime[j] = false;
    }
  }
}

main(){
  sieve();
  int n;
  while(cin >> n && n){
    cout << distance(upper_bound(prime.begin(), prime.end(), n), upper_bound(prime.begin(), prime.end(), 2*n)) << endl;
  }
}

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

ll f(int n) {
    if (n < 2) return 0;
    return (ll)n * (n-1) / 2;
}

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> c(n+1);
    rep(i, n) {
        cin >> a[i];
        c[a[i]]++;
    }
    ll sum = 0;
    rep(i, n+1) {
        sum += f(c[i]);
    }
    rep(i, n) {
        ll ans = sum - (c[a[i]] - 1);
        cout << ans << endl;
    }
}

Measured memory_bytes: 4848
#include <iostream>
#include<math.h>
#include<vector>
#include<algorithm>
using namespace std;

#define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define LL long long

#define MAX 100005
#define NIL -1

struct Node{int parent,left,right;};

Node tree[MAX];
int n,depth[MAX];

void print(int u) {
	int i,c;
	//??¨???????????????????????¨???
	cout << "node " << u << ": ";
	cout << "parent = " << tree[u].parent << ", ";
	cout << "depth = " << depth[u] << ", ";

	//?????????????????°???????????????????????°??????????????\???????????¨??\???
	if(tree[u].parent==NIL)cout<<"root, ";
	else if(tree[u].left==NIL )cout<<"leaf, ";
	else cout<<"internal node, ";

	cout<<"[";
	for (i = 0, c = tree[u].left; c != NIL; i++, c = tree[c].right) {
		if(i)cout<<", ";
		cout<<c;
	}
	cout<<"]"<<endl;
}

//?????°????????±???????±???????
void rec(int u, int p) {
	depth[u]=p;
	if (tree[u].right != NIL)rec(tree[u].right, p);//???????????????????????±???????¨????
	if (tree[u].left  != NIL)rec(tree[u].left , p+1);
}

int main() {
	int d,v,c,l,r;
	cin>>n;
	REP(i,n)tree[i].parent=tree[i].left=tree[i].right=NIL;

	REP(i, n) {
		cin>>v>>d;
		REP(j, d) {
			cin>>c;
			if(j==0)tree[v].left=c;
			else tree[l].right=c;
			l=c;
			tree[c].parent=v;
		}
	}
	r=0;
	REP(i,n)if(tree[i].parent==NIL)r=i;
	
	rec(r,0);
	REP(i,n)print(i);
	cin>>n;
	return 0;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MAXN 100010
#define rep(i,n) for (int i = 0; i < (n); ++i)
const ll mod = 1e9+7;

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

int main() {
    ll n, m;
    ll tmp;
    priority_queue<ll> que;
    cin >> n >> m;
    rep(i, n) {
        cin >> tmp;
        que.push(tmp);
    }

    ll ans = 0;

    rep(i, m) {
        ll x = que.top();
        que.pop();

        que.push(x/2);
    }

    rep(i, n) {
        ans += que.top();
        que.pop();
    }

    cout << ans << endl;

}



Measured memory_bytes: 1400
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <map>

#define ll long long
#define REP(i,n) for(int i = 0; i < n; i++)
#define PI 3.141592653589
#define MOD 1000000007

using namespace std;

template<typename T> T gcd(T a, T b){return (a % b)? gcd(b, a % b) : b;}
template<typename T> T lcm(T a, T b){return a * b / gcd(a, b);}

void solve_130C(){
    int w, h, x, y;
    cin >> w >> h >> x >> y;

    bool flag = false;
    if(w % 2 == 0 && w /2 == x){
        if(h % 2 == 0 && h / 2 == y){
            flag = true;
        }
    } 

    if(flag){
        printf("%.10f 1\n", (double) w * h / 2);
    } else printf("%.10f 0\n", (double) w * h / 2);
}

int main(void){
    solve_130C();
    
    return 0;
}

Measured memory_bytes: 256
from collections import deque
S = list(input())
N = len(S)
S = deque(S)


def solve(L):
    if 'BC' not in ''.join(L):
        return 0
    while L[-1] == 'A':
        L.pop()
    A_place = []
    n = len(L) - 1
    for i in range(n):
        if L[i] == 'A':
            A_place.append(i)
    a = len(A_place)
    return int(((a * n - sum(A_place)) - (a * (a - 1) / 2)) / 2)


ans = 0
part_S = []
num = 0
while S:
    if part_S == []:
        if S[0] == 'A':
            part_S.append('A')
            S.popleft()
        else:
            S.popleft()
    else:
        if len(S) >= 2:
            if S[0] == 'A':
                part_S.append('A')
                S.popleft()
            elif S[0] + S[1] == 'BC':
                part_S.append('B')
                part_S.append('C')
                S.popleft()
                S.popleft()
            else:
                ans += solve(part_S)
                S.popleft()
                part_S = []
        else:
            break
ans += solve(part_S)
print(ans)


Measured memory_bytes: 8580
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <deque>
using namespace std;

int main() {
    string S;
    cin >> S;
    vector<char> chars;
    sort(S.begin(), S.end());
    unique_copy(S.begin(), S.end(), back_inserter(chars));

    if(chars.size() == 2)
    {
        if(count_if(S.begin(), S.end(), [&](char c) { return c == chars[0];}) == 2 
        && count_if(S.begin(), S.end(), [&](char c) { return c == chars[1];}) == 2 
        )
        {
            cout << "Yes";
            return 0;
        }
    }
    cout << "No";

}


Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		new Main();
	}
	
	Main()
	{
		Scanner sc = new Scanner(System.in);
		while(sc.hasNextInt()){
			int n = sc.nextInt();
			int cnt = 0;
			for(int i = 2; i <= n; ++i)
				cnt += isPrime(i) ? 1 : 0;
			System.out.println(cnt);
		}
		sc.close();
	}
	
	
	boolean isPrime(int n){
		if(n == 2) return true;
		if(n % 2 == 0) return false;
		
		for(int i = 3; i * i <= n; i += 2)
			if(n % i == 0) return false;
		
		return true;
	}

}

Measured memory_bytes: 19052
n = int(input())
ss = list(input())
num_white = [0]
num_black = [0]

for s in ss:
  if s == '#':
    num_black.append(num_black[-1] + 1)
    num_white.append(num_white[-1])
  else:
    num_black.append(num_black[-1])
    num_white.append(num_white[-1] + 1)

ar_moves = [ ]
for i in range(n+1):
  moves = 0
  # numbers of blacks before i
  moves += num_black[i] - num_black[0]
  # numbers of whites after i
  moves += num_white[-1] - num_white[i]
  ar_moves.append(moves)
print(min(ar_moves))

#  .##..#.
# 00122233
# 01112334


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

int main() {
    int n;cin>>n;
    int ans=0;
    int c=0;
    int p;cin>>p;
    for (int i=1;i<n;i++) {
        int a;cin>>a;
        if (a<=p) {
            c++;
            ans=max(ans,c);
        } else c=0;
        p=a;
    }
    cout<<ans<<endl;
    return 0;
}

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

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pl;

const int INT_INF = 2147483646;
const ll LL_INF = 9223372036854775807;

bool SecondCompare(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second<b.second;
}
 
bool SecondCompareDes(const pair<int,int> &a,const pair<int,int> &b)
{
       return a.second>b.second;
}

ll minll(ll a, ll b){
    if(a >= b)  return b;
    else    return a;
}

ll maxll(ll a, ll b){
    if(a >= b)  return a;
    else    return b;
}

ll a,b;

int main(){
    cin >> a >> b;
    int ans = (a*3+b)/2;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
// -----------------<fast IO>------------------
#define IOS             ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FLSH             fflush(stdout)
#define fileIO(name) \
    freopen(name".in", "r", stdin); \
    freopen(name".out", "w", stdout);
#define PRECISION(x)     cout << fixed << setprecision(x);
// -----------------<TypeDef Start>------------------
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
// -----------------<Constants>------------------
const int MAXN = 1000005;
const int SQRTN = 1003;
const int LOGN = 22;
const double PI=acos(-1);

const int INF=1e9;

int MOD = 1000000007;
const int FMOD = 998244353;
const double eps = 1e-9;
ll gcd(ll a,ll b)
{
    if(a==0)
    return(b);
    return(gcd(b%a,a));
}
// --------------------------------------------------</TEMPLATE>--------------------------------------------------
#define MAXN 1000001
int spf[MAXN];
int hash1[MAXN] = { 0 };
void sieve()
{
    spf[1] = 1;
    for (int i = 2; i < MAXN; i++)

        // Marking smallest prime factor for every
        // number to be itself
        spf[i] = i;

    // Separately marking spf for every even
    // number as 2
    for (int i = 4; i < MAXN; i += 2)
        spf[i] = 2;

    // Checking if i is prime
    for (int i = 3; i * i < MAXN; i++) {

        // Marking SPF for all numbers divisible by i
        if (spf[i] == i) {
            for (int j = i * i; j < MAXN; j += i)

                // Marking spf[j] if it is not
                // previously marked
                if (spf[j] == j)
                    spf[j] = i;
        }
    }
}
void getFactorization(int x)
{
    int temp;
    while (x != 1) {
        temp = spf[x];
        if (x % temp == 0) {

            // Storing the count of
            // prime factors in hash
            hash1[spf[x]]++;
            x = x / spf[x];
        }
        while (x % temp == 0)
            x = x / temp;
    }
}
bool check(int x)
{
    int temp;
    while (x != 1) {
        temp = spf[x];

        // Checking whether it common
        // prime factor with other numbers
        if (x % temp == 0 && hash1[temp] > 1)
            return false;
        while (x % temp == 0)
            x = x / temp;
    }
    return true;
}
void solve()
{
    ll n;
    cin>>n;
    ll arr[n];
    for(ll i=0;i<n;i++)
        cin>>arr[i];
    ll g=arr[0];
    for(ll i=1;i<n;i++)
        g=gcd(g,arr[i]);
    if(g>1)
        cout<<"not coprime"<<endl;
    else
    {
            sieve();
            for (int i = 0; i < n; i++)
                getFactorization(arr[i]);
            for(int i=0;i<n;i++)
            {
                if(!check(arr[i]))
                {
                    cout<<"setwise coprime"<<endl;
                    return;
                }
            }
            cout<<"pairwise coprime"<<endl;
    }

}

int main()
{
    IOS
    ll t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return(0);
}


Measured memory_bytes: 19192
N = int(input())
AX = list(map(int, input().split()))
BX = list(map(int, input().split()))
CX = list(map(int, input().split()))

from pprint import pprint

sum_manzokudo = 0
before_ryori = -1
for i in range(0, N):
    # N番目に食べたもの
    ryori = AX[i]
    # 満足度
    manzokudo = BX[ryori-1]
    # 追加満足度
    add_manzokudo = CX[before_ryori-1] if ryori-1 == before_ryori else 0
    
    sum_manzokudo += (manzokudo + add_manzokudo)
    before_ryori = ryori

print(sum_manzokudo)

Measured memory_bytes: 3828
#include <iostream>
#include <algorithm>

int K = 0, S = 0;

int main(void){
    std::cin >> K >> S;
    int X,Y,Z;
    long long int ans = 0;
    for(X=0;X<=K;++X){
        if(X > S) break;
        for(Y=0;Y<=K;++Y){
            Z = S-X-Y;
            if(Z < 0) break;
            if(Z<= K) ans++;
        }
    }
    std::cout << ans << std::endl;
}


Measured memory_bytes: 256
include Math
a,b,x = gets.split.map(&:to_i)
s = a**2*b

if x == s/2.0
    ans = atan2(a,b)
elsif x < s/2.0
    c = x/(a*b.to_f)*2
    ans = atan2(c,b)
else
    c = x/(a**2.to_f)
    ans = atan2(a,(b-c)*2)
end

p 90 - ans/PI*180

Measured memory_bytes: 1916
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename Q_temp>
using smaller_queue = priority_queue <Q_temp, vector<Q_temp>, greater<Q_temp> >;

const int INF = (int) 1e9;
const ll LINF = (ll) 4e18;
const ll MOD = (ll) (1e9 + 7);
const double PI = acos(-1.0);

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbg2(x_) for(auto a_ : x_) cerr << a_ << " "; cerr << endl;
#define dbg3(x_ , sx_) rep(i, sx_) cerr << x_[i] << " "; cerr << endl;
vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

inline ll CEIL(ll a, ll b) {
    return (a + b - 1) / b;
}

//------------------------------------------------------

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int a[10010], b[10010];

    rep(i, n - 1) {
        cin >> a[i] >> b[i];
        a[i]--, b[i]--;
    }
    ll c[10010];
    rep(i, n) cin >> c[i];
    sort(c, c + n);
    reverse(c, c + n);
    ll sum = 0;
    REP(i, 1, n) sum += c[i];
    cout << sum << endl;
    vector<int> E[10010];

    rep(i, n - 1) {
        E[a[i]].push_back(b[i]);
        E[b[i]].push_back(a[i]);
    }

    int parent_num;
    rep(i, n) if (E[i].size() == 1) {
        parent_num = i;
        break;
    }

    int ans[10010];
    rep(i, n) ans[i] = -1;
    ans[parent_num] = c[0];
    queue<int> que;
    que.push(parent_num);
    int index_cnt = 1;

    while (!que.empty()) {
        int q = que.front();
        que.pop();
        for (auto i : E[q]) {
            if (ans[i] == -1) {
                ans[i] = c[index_cnt];
                index_cnt++;
                que.push(i);
            }
        }
    }
    rep(i, n) cout << ans[i] << (i == n - 1 ? "\n" : " ");
    return 0;
}



Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
//型に気を付けよう
//a=0x61=97
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long  ll;
typedef long double  ld;
typedef pair<int,int> pairii;
typedef vector<int> veci;
const double pi=3.1415926535;
const ll  mod=1000000007;
//桁数指定　cout << fixed << setprecision(2)
int main() {
  string s;cin>>s;
  int ans=s.size();
  for(int i=0;s[i]!='A';i++){
    ans--;
  }
  for(int j=1;s[s.size()-j]!='Z';j++)
  {ans--;
  }
  cout<<ans;
}

Measured memory_bytes: 640
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define USE_LLONG_AS_INT
#ifdef USE_LLONG_AS_INT
#define int long long
#define inf (1ll<<60)
#else
#define inf (1<<30)
#endif
#define rep(i,n) for(int i=0;i<(n);i++)
#define Rep(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a,b) for(int i=(a);i<=(b);i++)
#define rev(i,n) for(int i=(n)-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define eb emplace_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;
const string sp=" ";

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}
    
void run(){
    int n,a,b;
    cin>>n>>a>>b;
    cout<<n/(a+b)*a+min(n%(a+b),a)<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    double d,t,s;
    cin>>d>>t>>s;
    double tt=d/s;
    
    if(tt>t)
    {
        cout<<"No"<<endl;
    }
    else
    {
        cout<<"Yes"<<endl;
    }
}

Measured memory_bytes: 3708
MOD = 10**9+7

N = int(input())

countA = 4
countG = 4
countAG = 1
countGA = 1
countAC = 1
countAGX = 0
countAXG = 0
countAT = 1
ans = 16
nextnums = [0 for _ in range(7)]
for i in range(N-2):
    nextans = ans*4 - countAG - countGA - countAC - countAXG - countAGX
    nextA = ans
    nextG = ans - countAC
    nextAG = countA
    nextGA = countG
    nextAC = countA - countGA
    nextAGX = 2 * countAG
    nextAXG = countAT
    nextAT = countA

    ans = nextans % MOD
    countA = nextA % MOD
    countAC = nextAC % MOD
    countAG = nextAG % MOD
    countAGX = nextAGX % MOD
    countAT = nextAT % MOD
    countAXG = nextAXG % MOD
    countG = nextG % MOD
    countGA = nextGA % MOD
print(ans)


Measured memory_bytes: 3064
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);

  long long N, M, C;

  std::cin >> N >> M;

  if (N > M)
    std::swap(N, M);

  assert(N <= M);

  if (N == 1 && M == 1) {
    C = 1;
  }
  else if (N == 2 || M == 2) {
    C = 0;
  }
  else if (N == 1) {
    assert(M > 1);

    C = M - 2;
  }
  else {
    C = N * M - N * 2 - (M - 2) * 2;
  }

  std::cout << C << std::endl;

  return 0;
}


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

bool color[1000];


void bfs(int u)
{
	queue<int> q;
	q.push(u);
	color[u] = 1;
	while(q.front() <= 120)
	{
		int v = q.front();
		q.pop();
		q.push(v + 4);
		color[v+4] = 1;
		q.push(v+7);
		color[v+7] = 1;
	}
}

int main() {
	
	int n;
	cin>>n;
	bfs(0);
	if(color[n])
	{
		cout<<"Yes";
	}
	else
	{
		cout<<"No";
	}
	
	return 0;
}

Measured memory_bytes: 4824
#include <bits/stdc++.h>
using namespace std;
#pragma warning(disable : 4996)
#define gc getchar_unlocked
#define fo(i, n) for (i = 0; i < n; i++)
#define ll long long
#define si(x) scanf("%d", &x)
#define sl(x) scanf("%I64d", &x)
#define ss(s) scanf("%s", s)
#define pb push_back
#define em emplace_back
#define mp make_pair
#define F first
#define S second
#define endl '\n'
#define clr(x) memset(x, 0, sizeof(x))
#define PI 3.1415926535897932384626
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
const int mod = 1e9 + 7;
int epow(int base, int pow)
{
    int result = 1;
    while (pow)
    {
        if (!(pow % 2))
        {
            base = (base * base) % mod;
            pow /= 2;
        }
        else
        {
            result = (result * base) % mod;
            pow--;
        }
    }
    return result;
}
int main(void)
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    si(n);
    double d = 2 * n * PI;
    cout << setprecision(20) << d << endl;
}

Measured memory_bytes: 3872
#include <stdio.h>
int main() {
  int k, a, b;
  long long cookie = 1;
  scanf("%d%d%d", &k, &a, &b);
  while (k) {
    if (b - a > 2 && cookie >= a && k >= 2) {
      cookie += b - a;
      k -= 2;
    } else {
      cookie++;
      k--;
    }
  }
  printf("%lld\n", cookie);
}

Measured memory_bytes: 128
#include<bits/stdc++.h> 
#define Pair pair<int, double>
#define MP(x, y) make_pair(x, y)
#define fi first
#define se second
//#define int long long 
#define LL long long 
#define Fin(x) {freopen(#x".in","r",stdin);}
#define Fout(x) {freopen(#x".out","w",stdout);}
using namespace std;
const int MAXN = 1e6 + 10, mod = 998244353, INF = 2e9 + 10;
const double eps = 1e-9;
template <typename A, typename B> inline bool chmin(A &a, B b){if(a > b) {a = b; return 1;} return 0;}
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 LL add(A x, B y) {if(x + y < 0) return x + y + mod; return x + y >= mod ? x + y - mod : x + y;}
template <typename A, typename B> inline void add2(A &x, B y) {if(x + y < 0) x = x + y + mod; else x = (x + y >= mod ? x + y - mod : x + y);}
template <typename A, typename B> inline LL mul(A x, B y) {return 1ll * x * y % mod;}
template <typename A, typename B> inline void mul2(A &x, B y) {x = (1ll * x * y % mod + mod) % mod;}
template <typename A> inline void debug(A a){cout << a << '\n';}
template <typename A> inline LL sqr(A x){return 1ll * x * x;}
inline int read() {
    char c = getchar(); int x = 0, f = 1;
    while(c < '0' || c > '9') {if(c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
    return x * f;
}
int N, a[MAXN];
signed main() {
	N = read();
	for(int i = 1; i <= N; i++) a[i] = read();
	sort(a + 1, a + N + 1, greater<int>());
	for(int i = 1; i <= N; i++) {
		if(i + 1 > a[i + 1]) {
			if((a[i] - i) & 1) {puts("First"); return 0;}
			int j;
			for(j = i + 1; a[j] == i; j++); 
			if(!((j - i) & 1)) {puts("First"); return 0;}
			puts("Second"); return 0;
		}
	}
	return 0;
}
/*
10 3
aaaabbbbab
7 7 3 9 10 6 7 6 6 1
2 6 2
1 3 1
2 9 1
*/

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
static const int MAX = 100000;
static const int NIL = -1;
using namespace std;

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

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


int main() {

    ll n; cin >> n;
    ll sum = 0;
    ll ans = 0;
    vector<ll> a(n),b(n);
    rep(i,n) cin >> a[i] >> b[i];
    for(int i = n-1; i >= 0; i --){
        a[i] += sum;
        if(a[i] != 0) {
            if(a[i] % b[i] != 0) {
                ans += (b[i] - a[i] % b[i]);
                sum += b[i] - a[i] % b[i];
            }
        }
    }

    cout << ans;

    return 0;
}


Measured memory_bytes: 4724
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,ans=10000,x;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>x;
		int sum=0;
		while(x%2==0)sum++,x/=2;
		ans=min(ans,sum);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
static const int N=1001;
int lcs(string X,string Y){
  int c[N][N] = {};
  int m=X.size();
  int n=Y.size();

  int max1=0;
  X=' '+X;
  Y=' '+Y;

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

  for(int i=1;i<=m;i++){
    for(int j=1;j<=n;j++){
      if(X[i]==Y[j]){
	c[i][j]=c[i-1][j-1]+1;
      }
      else {
	c[i][j]=max(c[i-1][j],c[i][j-1]);
      }
      max1=max(max1,c[i][j]);
    }
  }
  return max1;
}

int main(){
  string s1,s2;
  int n;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>s1>>s2;
    cout<<lcs(s1,s2)<<endl;
  }
  return 0;
}



Measured memory_bytes: 7124
INF = 10**9
from heapq import heappop,heappush
H,W = (int(i) for i in input().split())
Ch,Cw = (int(i)-1 for i in input().split())
Dh,Dw = (int(i)-1 for i in input().split())
S = [input() for i in range(H)]

dist = [[INF]*W for _ in range(H)]
dist[Ch][Cw]= 0
que = [(0,Ch*W+Cw)]
while(que):
    u_dist,u = heappop(que)
    uh,uw = u//W,u%W
    #if dist[uh][uw] < u_dist:
    #    continue
    for dh in range(-2,3):
        for dw in range(-2,3):
            nh = uh + dh
            nw = uw + dw
            if nh<0 or H <= nh or nw < 0 or W <= nw:
                continue
            if S[nh][nw]=="#":
                continue
            cost = 0 if abs(dh)+abs(dw)<=1 else 1
            if dist[nh][nw] > dist[uh][uw] + cost:
                dist[nh][nw] = dist[uh][uw] + cost
                heappush(que,(dist[nh][nw],nh*W+nw))
if dist[Dh][Dw] == INF:
    print(-1)
else:
    print(dist[Dh][Dw])

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

#define INF 1000000007
#define LINF 1000000000000000007

using namespace std;

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

Int gcd(Int x, Int y){
	if(y == 0)
		return x;
	return gcd(y, x % y);
}

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

bool sosuu(int x){
	bool b = 1;
	if(x == 1) b = 0;
	for(int i = 2; i * i <= x; i++){
		if(x % i == 0) {
			b = 0;
			break;
		}
	}
	return b;
}

int n, m;
string s[2][50];

int main(){
	cin >> n >> m;
	for(int i = 0; i < n; i++){
		cin >> s[0][i];
	}
	for(int i = 0; i < m; i++){
		cin >> s[1][i];
	}
	
	bool b = 0;
	
	for(int i = 0; i <= n-m; i++){
		for(int j = 0; j <= n-m; j++){
			if(s[0][i][j] == s[1][0][0]){
				bool a = 1;
				for(int x = 0; x < m; x++){
					for(int y = 0; y < m; y++){
						if(s[0][i+x][j+y] != s[1][x][y]) a = 0;
					}
				}
				if(a) b = 1;
			}
		}
	}
	
	if(b) cout << "Yes" << endl;
	else cout << "No" << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>

#include <string.h>

using namespace std;

typedef long long ll;

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

const int MAX_N = 100;
const int MAX_V = 10000;

int dp[MAX_N + 1][MAX_V + 1];

int solve(int n, int j, const int N, const int W, const vector<int> v, const vector<int> w) {
    if (dp[n][j] >= 0) {
        return dp[n][j];
    }

    if (j >= w[n]) {
        chmax(dp[n][j], solve(n - 1, j - w[n], N, W, v, w) + v[n]);
    }
    chmax(dp[n][j], solve(n - 1, j, N, W, v, w));

    return dp[n][j];
}

int main(void) {
    int N, W;
    cin >> N >> W;
    vector<int> v(N + 1);
    vector<int> w(N + 1);
    for (int i = 1; i <= N; i++) {
        cin >> v[i] >> w[i];
    }

    memset(dp, -1, sizeof(dp));
    for (int i = 0; i <= N; i++) {
        dp[i][0] = 0;
    }
    for (int i = 0; i <= W; i++) {
        dp[0][i] = 0;
    }

    solve(N, W, N, W, v, w);

    cout << dp[N][W] << endl;
    
    return 0;
}



Measured memory_bytes: 7208