akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

using pii = pair<int,int>;
#define f(i,a,b) for (int i = a; i < b; i++)
#define fr(i,a,b) for (int i = b-1; i >= a; i--)
#define Min(a,b) a=min(a,b)
#define Max(a,b) a=max(a,b)
#define pb push_back

const int oo = 1e9;

string a,b;
int n;

int solve() {
	int x[n],y[n];	
	{
		int j = 0;
		f(i,0,n) if (b[i]-'0') j = i;
		j -= n;
		f(i,0,n) {
			if (b[i]-'0') j = i;
			x[i] = i-j;
		}
		j = n;
		fr(i,0,n) if (b[i]-'0') j = i;
		j += n;
		fr(i,0,n) {
			if (b[i]-'0') j = i;
			y[i] = j-i;
		}
	}
	int ans = oo;
	f(d,0,n) {
		vector<pii> dp;
		int cost = d;
		f(i,0,n) if (a[i] != b[(i+d)%n]) {
			cost++;
			if (y[i]>d) dp.pb({x[i],y[(i+d)%n]});
		}
		sort(begin(dp),end(dp));
		int delta = dp.size()?oo:0;
		int Y = 0;
		fr(i,0,dp.size()) {
			Min(delta,2*(dp[i].first+Y));
			Max(Y,dp[i].second);
		}
		Min(ans,cost+delta);
	}
	return ans;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	clock_t start = clock();
#endif

	cin>>a>>b;
	n = a.length();
	bool contain1 = 0;
	f(i,0,n) if (b[i]-'0') contain1 = 1;
	if (a==b) cout << 0 << endl;
	else if (!contain1) cout << -1 << endl;
	else {
		int ans = solve();
		reverse(begin(a),end(a));
		reverse(begin(b),end(b));
		Min(ans,solve());
		cout << ans << endl;
	}

#ifdef LOCAL
	cout << setprecision(12) << (long double)(clock()-start) / CLOCKS_PER_SEC << endl;
#endif
	
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define pii pair<int,int>
#define REP(i,a) for(int (i)=0; (i)<(a); (i)++)
#define RREP(i,a) for(int (i)=a-1; (i)>=(0); (i)--)
#define REP2(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
#define m0(x) memset(x,0,sizeof(x))
typedef long long ll;

using namespace std;

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll N,A,B;
  cin >> N >> A >> B;
  ll C = A+B;
  if(N <= A) cout << N;
  else if(N <= C) cout << A;
  else{
    ll ans = 0;
  	ans += ((ll)N/C)*A;
  	if(N%C >= A) ans += A;
  	else ans += N%C;
  	cout << ans;
  }
  return 0;
}

Measured memory_bytes: 256
from heapq import heappush, heappop
V, E, r = map(int, input().split())
inf = 10**10
edges = [[] for _ in [None]*V]
vertices = [inf]*V
vertices[r] = 0

for _ in [None]*E:
    s, t, d = map(int, input().split())
    edges[s].append((t, d))

q = [(0, r)]
rem = V-1
while q:
    cost, v = heappop(q)
    if vertices[v] < cost:
        continue
    for dest, _cost in edges[v]:
        newcost = cost + _cost
        if vertices[dest] > newcost:
            vertices[dest] = newcost
            heappush(q, (newcost, dest))
    rem -= 1
    if rem == 0:
        break

print("\n".join([str(n) if n!=inf else "INF" for n in vertices]))

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

int main() {
  int N;
  cin >> N;
  int res = 0;
  int a = 10000000000;
  int b = 0;
  rep(i,N-1){
    cin >> b;
    res += min(a,b);
    a = b;
  }
  res += a;
  
  cout << res << endl;
}

Measured memory_bytes: 3564
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define fi first
#define se second

#define INF 2147483600

int main(){
  int n,l;
  cin>>n>>l;
  vector<string> vec(n);

  rep(i,n) cin>>vec[i];

  sort(all(vec));

  rep(i,n) cout<<vec[i];
  cout<<endl;

  return 0;
}


Measured memory_bytes: 256
// author: gary
#include <bits/stdc++.h>
using namespace std;
#define SZ(x) ( (int) (x).size() )
typedef pair<int, int> pii;
typedef long long ll;
template<class T> bool cmax(T& a, T b) { if(a < b) { a = b; return true; } return false; }
template<class T> bool cmin(T& a, T b) { if(a > b) { a = b; return true; } return false; }
string s;
int main() {
  while(cin >> s) {
    if(SZ(s) < 4 || s[0] != 'Y' || s[1] != 'A' || s[2] != 'K' || s[3] != 'I')
      puts("No");
    else
      puts("Yes");
  }

  return 0;
}


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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()

using ll = long long;
using P = pair<int,int>;
using mp =  map<int,int>;

const int MOD = 1e9 + 7;

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

    int n, m;
    cin >> n >> m;
    vector<int> a;
    vector<int> b;
    rep(i, m){
        int x ,y;
        cin >> x >> y;
        if(x == 1) {
            a.push_back(y);
        }else{
            if(y == n) b.push_back(x);
        }
    }

    sort(all(a));
    sort(all(b));

    bool ok = false;
    for (auto& p : a) {
        if(binary_search(all(b), p)) {
            ok = true;
            break;
        }
    }

    cout << (ok? "POSSIBLE": "IMPOSSIBLE") << endl;

    return 0;
}


Measured memory_bytes: 1276
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<iomanip>
#include<map>
#include<deque>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define erep(i, n) for (int i = 0; i <= (int)(n); i++)
using p = pair<int, int>;

int main() {
    int n; cin >> n;
    vector<int> a(n + 1), b(n);
    erep (i, n) cin >> a[i]; 
    rep (i, n) cin >> b[i]; 
    int r = 0;
    ll ans = 0;

    rep (i, n) {
        if (r >= a[i]) {
            ans += a[i];
            r = b[i];
        } else if ((b[i] + r) >= a[i]) {
            ans += a[i];
            r = b[i] - (a[i] - r);
        } else {
            ans += b[i] + r;
            r = 0;
        }
    }
    if (a[n] <= r) ans += a[n];
    else ans += r;
    cout << ans << endl;
}


Measured memory_bytes: 1024
input()

a =raw_input()

edge = []

while len(a) > 1:
      if a[0] == a[1]:
            edge.append(2)
            a = a[2:]
      else:
            edge.append(1)
            a = a[1:]
         
if len(a) == 1:
      edge.append(1)

ans = 1

if edge[0] == 1:
      ans = 3
else:
      ans = 6

for i in range(1, len(edge)):
      if (edge[i-1], edge[i]) == (1, 1):ans *= 2
      if (edge[i-1], edge[i]) == (1, 2):ans *= 2
      if (edge[i-1], edge[i]) == (2, 1):ans *= 1
      if (edge[i-1], edge[i]) == (2, 2):ans *= 3
      ans %= 10**9 + 7

print ans

Measured memory_bytes: 2696
import sys
import bisect

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N = int(input())
    A = [int(x) for x in input().split()]

    A.sort()

    impossible_num = 0
    ruiseki = 0

    for i, a in enumerate(A):
        if i == N - 1:
            continue
        ruiseki += a
        if A[i + 1] > ruiseki * 2:
            impossible_num = i + 1

    print(N - impossible_num)



if __name__ == '__main__':
    main()



Measured memory_bytes: 14168
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
int main() {
//input
int a,b,c;
cin>>a>>b>>c;
//compute

//output
if((a+b+c)>=22)
 cout<<"bust";
else 
  cout<<"win";
	return 0;
}

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

int main () {

    char buf[256];
    while( scanf("%s", buf) != EOF ) {

        int len = strlen(buf);
        int i;
        for ( i = 0 ; i < len / 2; ++ i ) {
            char c = buf[len - i - 1];
            buf[len - i - 1] = buf[i];
            buf[i] = c;
        }
        printf("%s\n", buf);
    }
    return 0;
}

Measured memory_bytes: 524
#include <iostream>
#include <vector>

using namespace std;

int N, A, B, C;
vector<int> v;

int dfs(int k, int a, int b, int c){
  if(k==N){
    return abs(a-A)+abs(b-B)+abs(c-C)+1e6*(a==0||b==0||c==0);
  }
  int c1 = dfs(k+1, a, b, c);
  int c2 = dfs(k+1, a+v[k], b, c)+(a==0?0:10);
  int c3 = dfs(k+1, a, b+v[k], c)+(b==0?0:10);
  int c4 = dfs(k+1, a, b, c+v[k])+(c==0?0:10);
  return min(c1,min(c2,min(c3,c4)));
}

int main(){
  cin>>N>>A>>B>>C;
  for(int i=0;i<N;i++){
    int l; cin>>l; v.push_back(l);
  }
  int ans = dfs(0,0,0,0);
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int a,b;
    cin >> a >> b;
    if((a * b) % 2 == 0){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
}

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

/* -128 ~ 127 */
using i8  = int8_t;
/* 0 ~ 255 */
using u8  = uint8_t;
/* -32,768 ~ 32,767 */
using i16 = int16_t;
/* 0 ~ 65,535 */
using u16 = uint16_t;
/* -2,147,483,648 ~ 2,147,483,647 */
using i32 = int32_t;
/* 0 ~ 4,294,967,295 */
using u32 = uint32_t;
/* -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 */
using i64 = int64_t;
/* 0 ~ 18,446,744,073,709,551,615 */
using u64 = uint64_t;
/* (-3.4 * 10^38) ~ (3.4 * 10^38) */
using f32 = float;
/* (-1.7 * 10^308) ~ (1.7 * 10^308) */
using f64 = double;
using f80 = __float80;

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

template <typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template <typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }

/* 定数 */
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;

#define fn auto
#define ALL(v) v.begin(), v.end()

fn Main() {
    u32 M, N;
    cin >> N >> M;
    Vec<u32> A(N);
    u32 sum = 0;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
        sum += A[i];
    }
    sort(ALL(A), greater<u32>());
    if ((double)A[M - 1] >= (double)sum / (4.0 * M)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

fn main() -> int {
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}



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

#define REP(i, n) for(ll i = 0; i < n; i++)
#define ALL(x) (x).begin(),(x).end()
#define MSG(x) cout << x << endl;
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
using ll = long long;
const static ll MOD = 1e9 + 7;

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

    bool ok = false;
    REP(i, s.size()) {
        if (s.at(i) == 'C') ok = true;
        if (s.at(i) == 'F' && ok) {
            MSG("Yes")
            exit(EXIT_SUCCESS);
        }
    }

    MSG("No")
}

Measured memory_bytes: 256
N, M, Q = list(map(int,input().split()))
L = []
R = []
for i in range(M):
    in1, in2 = map(int,input().split())
    L.append(in1 - 1)
    R.append(in2 - 1)
p = []
q = []
for i in range(Q):
    in1, in2 = map(int,input().split())
    p.append(in1 - 1)
    q.append(in2 - 1)
    
a = [[0 for _ in range(N)] for _ in range(N)]
for i in range(M):
    a[L[i]][R[i]] += 1
    
def d2_add(a):
    w = len(a[0])
    h = len(a)
    da = [[0] * w for j in range(h)]
    da[0][0] = a[0][0]
    for i in range(1, w):
        da[0][i] = da[0][i - 1] + a[0][i]
    for i in range(1, h):
        cnt_w = 0
        for j in range(w):
            cnt_w += a[i][j]
            da[i][j] = da[i - 1][j] + cnt_w
    return da

def d2_calc(da, p, q, x, y):
    if p > x or q > y:  return 0
    if p == 0 and q == 0:  return da[x][y]
    if p == 0:  return da[x][y] - da[x][q - 1]
    if q == 0:  return da[x][y] - da[p - 1][y]
    return da[x][y] - da[p - 1][y] - da[x][q - 1] + da[p - 1][q - 1]

ret = d2_add(a)
for i in range(Q):
    ans = d2_calc(ret, p[i], p[i], q[i], q[i])
    print(ans)

Measured memory_bytes: 116044
#include<stdio.h>

#define MAX 100

struct Node
{
  int id;
  int chkz;
  int c[MAX];
};

struct Node a[MAX];

int flag = 0;

int main()
{
  int n,i,j,k=0;

  scanf("%d",&n);

  for(i = 0 ; i < n ; i++)
    {
      scanf("%d%d",&a[i].id,&a[i].chkz);

      if(a[i].chkz >= 1)
	{
	  for(j = 0 ; j < a[i].chkz ; j++)
	    {
	      scanf("%d",&a[i].c[j]);
	    }
	}
    }

  for(i = 0 ; i < n ; i++)
    {
      for(j = 0 ; j < n ; j++)
	{
	  if(a[i].c[k] == j+1)
	    {
	     printf("1");
	     k+=1;
	    }
	  else printf("0");
	  
	  if(j < n-1) printf(" ");
	}
      k = 0;
      printf("\n");
    }
}



Measured memory_bytes: 2064
#include <algorithm>
#include <climits>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <vector>

#define int long long int
constexpr int INF = std::numeric_limits<int>::max();
constexpr int NINF = std::numeric_limits<int>::min();
using namespace std;

void solve() {
  int K, S;
  cin >> K >> S;

  int ans = 0;
  for (int x = 0; x <= K; x++) {
    for (int y = 0; y <= K; y++) {
      int z = S-x-y;
      if (0 <= z && z <= K) {
        ans++;
      }
    }
  }
  cout << ans << endl;
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
  return 0;
}


Measured memory_bytes: 3108
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back
#define mp make_pair

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,m;
    cin>>n>>m;
    vector<ll>a(m+1);
    ll sum=0;
    for(ll i=1;i<=m;i++)
    {
        cin>>a[i];
        sum=sum+a[i];
    }
    cout<<max(-1LL,n-sum)<<endl;
    return 0;
}


Measured memory_bytes: 3708
#include<bits/stdc++.h>
using namespace std;
#define lld long long int
lld n,m,ans=0;
unordered_map<lld,vector<lld>> graph;
unordered_map<lld,lld> dist;

lld dfs(lld st){
    if(dist.find(st)!=dist.end()){
        return dist[st];
    }
    lld x=0;
    for(auto i:graph[st]){
        x=max(x,1+dfs(i));
    }
    dist[st]=x;
    return dist[st];
}

int main(){
    cin>>n>>m;
    for(int i=0;i<m;i++){
        lld u,v;
        cin>>u>>v;
        graph[u].push_back(v);
    }
    for(int i=1;i<=n;i++){
        ans=max(ans,dfs(i));
    }
    cout<<ans<<"\n";
}

Measured memory_bytes: 15268
#include <iostream>
#include <algorithm>
#include <climits>
#include <string>
#include <vector>
#include <cmath>

using namespace std;

#define str to_string
#define rep(i, n) for (int i=0; i<int(n); i++)
#define all(c) (c).begin(), (c).end()


int main() {
  int a, b;
  while (cin >> a >> b) {
    cout << (to_string(a+b)).length() << "\n";
  }
  return 0;
}

Measured memory_bytes: 1216
#include<iostream>
#include <iomanip>

using namespace std;

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

	long double h, w, o;
	h = w = o = double(L) / 3;
	cout << fixed;
	cout << setprecision(12) << h * w * o << endl;

	return 0;
}

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define LOOP(i) while(i--)
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	int K=in(),T=in();
	int MK=0;
	REP(i,T){
		MK = max(MK,in());
	}
	if(T==1){
		out(MK-1);
		return 0;
	}
	
	out(max(0,2*MK-K-1));
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
const ll INF = 1001001001;
const ll MOD = 1e9 + 7;

int main(){
  int n, T;
  cin >> n >> T;
  int ans = INF;
  rep(i, n){
    int t, c;
    cin >> c >> t;
    if(t <= T){
      ans = min(ans, c);
    }
  }
  if(ans == INF){
    cout << "TLE" << endl;
    return 0;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/indexed.hpp>

using namespace std;
using namespace boost::adaptors;
using namespace std::string_literals;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;
using boost::irange;

struct UnionFind {
  vector<int> parent;
  UnionFind (int n) : parent(n, -1) {}
  int root(int x) { return parent[x] < 0 ? x : parent[x] = root(parent[x]); }
  bool merge(int x, int y) {
    x = root(x); y = root(y);
    if (x == y) return false;
    if (parent[y] < parent[x]) swap(x, y);
    if (parent[x] == parent[y]) --parent[x];
    parent[y] = x;
    return true;
  }
};

int main()
{
  int n;
  cin>>n;
  vector<tuple<int,int>> vt;
  vecint va(n), vb(n);
  for(auto& e:va) {
    cin>>e;
  }
  for(auto& e:vb) {
    cin>>e;
  }
  for(int i:irange(0,n)) {
    int a=va[i];
    int b=vb[i];
    vt.emplace_back(b,a);
  }
  boost::sort(va);
  boost::sort(vt);
  bool ok = true;
  map<int,int> m;
  bool swappable = false;
  for (int i:irange(0,n)) {
    m[va[i]] = i;
    if (va[i] > get<0>(vt[i])) {
      ok = false;
    }
    if (i > 0 && va[i] <= get<0>(vt[i-1])) {
      swappable = true;
    }
  }
  UnionFind uf(n);
  for (int i:irange(0,n)) {
    ll b,a;
    tie(b,a) = vt[i];
    int ai = m[a];
    uf.merge(i, ai);
  }
  set<int> s;
  for (int i:irange(0,n)) {
    s.insert(uf.root(i));
  }
  if (!swappable && s.size() == 1) ok = false;
  if(ok) {
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  return 0;
}


Measured memory_bytes: 6900
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int a = sc.nextInt();
    int b = sc.nextInt();

    int n1 = 0;
    int n2 = 0;
    int n3 = 0;

    for (int i = 0; i < n; i++) {
      int p = sc.nextInt();
      if (p <= a) {
        n1++;
      } else if (p <= b) {
        n2++;
      } else {
        n3++;
      }
    }

    System.out.println(Math.min(Math.min(n1, n2), n3));

  }
}

Measured memory_bytes: 35656
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1000000010
#define EPS 1e-9
#define F first
#define S second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"

typedef pair<int,int> PII;
typedef pair<int,string> PIS;
typedef pair<string,int> PSI;


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  int d,t,s;
  cin>>d>>t>>s;
  if(t*s >= d) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;

  return 0;
}


Measured memory_bytes: 3684
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

#define MOD 1000000007

void solve(int test_case) {//228
	int a,b;
	cin>>a>>b;
	if(b%a==0)cout<<a+b;else cout<<b-a;
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


Measured memory_bytes: 3608
#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds; 

#define int long long
#define pb push_back
#define pf push_front
#define eb emplace_back
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define f first
#define s second
#define sz(x) (int)x.size()
#define endl "\n"
#define forn(i,n) for(int i=0;i<n;++i)
#define fore(i,l,r) for(int i=int(l);i<=int(r);++i)
#define rep(i,begin,end) for(__typeof(end) i=(begin);i!=(end);i++)
#define fill(a,value) memset(a,value,sizeof(a));
#define gcd(a,b) __gcd((a),(b))
#define watch1(x) cout<<(x)<<endl
#define watch2(x,y) cout<<(x)<<" "<<(y)<<endl
#define watch3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll;
typedef long double ld; 
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset;

const int INF = 9e18;
const int mod = 1e9 + 7;
const int N = 10;

int i,j,n,m,h,w,k;
char a[N][N];

void solve()
{
    cin>>h>>w>>k;
    for(i=0;i<h;++i)
    {
        for(j=0;j<w;++j)
        {
            cin>>a[i][j];
        }
    }
    int ans=0;
    for(i=0;i<(1<<h);++i)
    {
        for(j=0;j<(1<<w);++j)
        {
            int black=0;
            for(n=0;n<h;++n)
            {
                for(m=0;m<w;++m)
                {
                    if(i&(1<<n))
                        continue;
                    if(j&(1<<m))
                        continue;
                    if(a[n][m]=='#')
                        black++;
                }
            }
            if(black==k)
                ans++;
        }
    }
    cout<<ans;
}

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

Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using vpii = vector<pair<int, int>>;
using vpll = vector<pair<ll, ll>>;

int		main(void)
{
	string S;
	ll K;
	cin >> S;
	cin >> K;
	int one = 0;
	while (S[one] == '1')
		one++;
	if (K <= one || S[0] != '1')
		cout << S[0] << endl;
	else
	{
		for (int i=0; S[i]; i++)
		{
			if (S[i] != '1')
			{
				cout << S[i] << endl;
				return (0);
			}
		}
		cout << 1 << endl;
	}
}


Measured memory_bytes: 256
def fukumu(D, kazu):
    for i in str(kazu):
        if D.count(i) == 0:
            continue
        else:
            return True
    return False

def keisan(N, D):
    kazu = N
    while fukumu(D, kazu):
        kazu += 1
    return kazu

N, K = [int(i) for i in input().split()]
D = input().split()
print(keisan(N,D))


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long int n,d,c=0;
  cin >> n >> d;
  long long int x,y;
  for(int i=0;i<n;i++)
  {
    cin >> x >> y;
    if(sqrt((x*x)+(y*y)) <= d)
    {
      c++;
    }
  }
  cout << c << endl;
  return 0;
}


Measured memory_bytes: 3676
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<vector<P>> Graph;

  int n,m;
  int a[50],b[50];
  bool graph[50][50],visit[50];

void dfs(int v){
  visit[v] = true;
  REP(i,n)
    if(graph[v][i] && !visit[i]) dfs(i);
}
  
int main(){

  cin >> n >> m;

  // 隣接行列でエッジの有無を管理
  REP(i,m){
    cin >> a[i] >> b[i];
    a[i]--;b[i]--;
    graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
  }
  
  int ans = 0;
  REP(i,m){
    graph[a[i]][b[i]] = graph[b[i]][a[i]] = false; // エッジ取り出し
    REP(j,n) visit[j] = false;
    
    dfs(0);
    
    bool f = false;
    REP(j,n){
      if(!visit[j]){
        f = true; break;
      }
    }
    if(f) ans++;
    graph[a[i]][b[i]] = graph[b[i]][a[i]] = true; // エッジ復元
  }
  
  cout << ans << endl;

 return 0;
}

Measured memory_bytes: 256
#include<iostream> 
using namespace std;
#define r(i,n) for(int i=0;i<n;i++)
#define c(a) cout<<a<<" ";
int main(){c("1407 38");int t=2;r(i,38){c(1);r(j,37){c(t);t++;}}r(i,37){r(j,37){c(i+2)r(l,37)c(37*l+39+(j+i*l)%37)}}}

Measured memory_bytes: 3432
N, M = map(int, input().split())
sc = []
tf = True
tff = False
for i in range(M):
  sc.append(list(map(int, input().strip().split())))
if len(sc) == 0:
  if N == 1:
    print(0)
  else:
    print("1"+"0"*(N-1))
else:
  num = []
  for i in range(N):
    num.append(0)
  sc.sort()
  if N == 1 and sc[0][0] == 1 and sc[0][1] == 0:
    tff = True
  for i in range(M-1):
    if sc[i][0] == sc[i+1][0] and sc[i][1] != sc[i+1][1]:
      tf = False
  for i in sc:
    if i[0] == 1 and i[1] == 0:
      tf = False
    else:
      num[i[0]-1] = i[1]
  if tf and num[0] == 0:
    num[0] = 1
  string = ""
  for i in num:
    string += str(i)
  if tff == True:
    print(0)
  elif tf == True:
    print(string)
  else:
    print(-1)

Measured memory_bytes: 3064
#include <iostream>

using namespace std;

const int N = 1e5;
int arr[N + 2] = { 0 };

int main() {
	int n, m, l, r, ans = 0;
	cin >> n >> m;
	for(int i = 0;i < m;++i){
		cin >> l >> r;
		arr[l] += 1;
		arr[r + 1] -= 1;
	}
	for(int i = 1;i <= n;++i) {
		arr[i] += arr[i - 1];
		if(arr[i] == m) ++ans;
	} 
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 640
#include <cstdio>
#include <iostream>

using namespace std;

int main(){
	double v;
	double t,y;
	int n;
	while(cin >> v){
		t = v/9.8;
		y = 4.9 * t * t;

		n = ((y+5)/5)+1;

		cout << n << endl;
	}
}

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

#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define int long long
#define pb push_back
#define pii pair<int,int>
#define fr(i,n) for(int i=0;i<n;i++)
#define F first
#define S second
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int32_t main()
{   fastio;
    int a , b , c , k;
    cin>>a>>b>>c>>k;
    int sum=0;
    sum += min(a , k);
    k -= min(a , k);
    //sum += min(a , k);
    k -= min(b , k);
    sum -= min(c , k);
    k -= min(c , k);
    cout<<sum<<"\n";
}

Measured memory_bytes: 3612
import java.io.BufferedReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new java.io.InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);
        StringTokenizer st = new StringTokenizer(br.readLine());

        String[] S_Array = st.nextToken().split("");
        st = new StringTokenizer(br.readLine());
        String[] T_Array = st.nextToken().split("");

        int result = 0;

        for(int i = 0; i < S_Array.length; i++) {
            if(!S_Array[i].equals(T_Array[i])) result++;
        }
        
        pw.println(result);
        br.close();
        pw.close();
    }
}

Measured memory_bytes: 64912
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
signed main() {
    int N;
    cin >> N;
    int ans = 1;
    int cnt = 1;
    for(int i = 0; i < N; i++) {
        int A;
        cin >> A;
        ans*=3;
        if(A%2 == 0) {
            cnt*=2;
        }
    }
    cout << ans-cnt << endl;
}

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

int main() {
	int a,b;
	cin >> a >> b;
  ll A = 0;
	ll B = 0;
	rep(i,b){
		A = A*10;
		A = A+ a;
	}
	rep(i,a){
		B = B*10;
		B = B +b;
	}

	cout << max(A,B) << endl;
}

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

int main(){
  int N,M;
  cin>>N>>M;
  vector<int> vec(M+1);
  for(int i=0;i<M;i++)
    cin>>vec.at(i);
  int count=0;
  vector<int> dp(N+1);
  if(vec.at(0)==1){
    dp.at(1)=0;
    count++;
  }
  else
    dp.at(1)=1;
  dp.at(0)=1;
  if(N>1){
  	for(int i=2;i<=N;i++){
  	  if(vec.at(count)==i)
      	count++;
      else{
      	dp.at(i)=dp.at(i-1)+dp.at(i-2);
        dp.at(i)=dp.at(i)%1000000007;
      }
  	}
  }
  cout<<dp.at(N)<<endl;
}

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

long cntDigits(long n);

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    if(b - a == c - b) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main
{
	public static void main (String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int res = 0;
        int n = sc.nextInt();
        int m = sc.nextInt();
        int h[] = new int[n];
        for(int i=0;i<n;i++) {
        	h[i] = sc.nextInt();
        }
        HashMap<Integer, List<Integer>> map = new HashMap<Integer, List<Integer>> ();
        for(int i=0;i<m;i++) {
        	int a = sc.nextInt();
        	int b = sc.nextInt();
        	if(!map.containsKey(a)) {
        		List<Integer> l = new ArrayList<Integer>();
        		l.add(b);
        		map.put(a, l);
        	}
        	else {
        		List<Integer> l = map.get(a);
        		l.add(b);
        		map.put(a,l);
        	}
        	if(!map.containsKey(b)) {
        		List<Integer> l = new ArrayList<Integer>();
        		l.add(a);
        		map.put(b, l);
        	}
        	else {
        		List<Integer> l = map.get(b);
        		l.add(a);
        		map.put(b,l);
        	}
        }
        for(int a : map.keySet()) {
        	boolean flag = false;
        	for(int i=0;i<map.get(a).size();i++) {
        		if(h[a-1]>h[map.get(a).get(i)-1]) {
        			flag =true;
        		}
        		else {
        			flag=false;
        			break;
        		}
        	}
        	if(flag==true) {
        		res++;
        	}
        }
        System.out.println(res+(n-map.size()));
	}
}


Measured memory_bytes: 78168
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1LL << 60;
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)


int main() {
	int n, m;
	cin >> n >> m;
	vector<int>in(n);
	vector<int>e[101010];
	for (int i = 0; i < m; i++) {
		int x, y;
		cin >> x >> y;
		e[x].pb(y);
		in[y]++;
	}

	stack<int>st;
	for (int i = 0; i < n; i++)if (!in[i])st.push(i);

	vector<int>ans;
	while (st.size()) {
		int i = st.top();
		st.pop();
		ans.pb(i);
		fore(x, e[i]) {
			in[x]--;
			if (!in[x])st.push(x);
		}
	}

	if (ans.size() != n)puts(-1);
	else {
		fore(x, ans)puts(x);
	}

	return 0;
}


Measured memory_bytes: 6024
#include <iostream>
using namespace std;
using ll=long long;
int main(){
  ll n, a, b;
  cin >> n >> a >> b;
  ll c=n%(a+b);
  if(c<a) cout << a*(n/(a+b))+c;
  else cout << a*(n/(a+b))+a;
  return 0;
}

Measured memory_bytes: 256
A, B = map(int, input().rstrip().split())
ret = 1000000
for i in range(1, 10001):
    if int(i * 0.08) == A and int(i*0.1) == B and ret > i:
        ret = i
        break
if ret == 1000000:
    ret = -1
print(ret)


Measured memory_bytes: 2940
use std::cmp;
use std::collections::HashMap;
use std::collections::VecDeque;
use std::io::Read;
use std::usize::MAX;

macro_rules! input {(source = $s:expr, $($r:tt)*) => {let mut iter = $s.split_whitespace();let mut next = || { iter.next().unwrap() };input_inner!{next, $($r)*}};($($r:tt)*) => {let stdin = std::io::stdin();let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));let mut next = move || -> String{bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect()};input_inner!{next, $($r)*}};}
macro_rules! input_inner {($next:expr) => {};($next:expr, ) => {};($next:expr, $var:ident : $t:tt $($r:tt)*) => {let $var = read_value!($next, $t);input_inner!{$next $($r)*}};}
macro_rules! read_value {($next:expr, ( $($t:tt),* )) => {( $(read_value!($next, $t)),* )};($next:expr, [ $t:tt ; $len:expr ]) => {(0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()};($next:expr, chars) => {read_value!($next, String).chars().collect::<Vec<char>>()};($next:expr, usize1) => {read_value!($next, usize) - 1};($next:expr, [ $t:tt ]) => {{let len = read_value!($next, usize);(0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()}};($next:expr, $t:ty) => {$next().parse::<$t>().expect("Parse error")};}

fn solve() {
    input! {
        n: u64,
        a: [u64;n]
    }

    let mut sorted_a = a.clone();
    sorted_a.sort();
    sorted_a.reverse();

    let first = sorted_a[0];
    let second = sorted_a[1];

    for i in 0..n {
        if a[i as usize] == first {
            println!("{}", second);
        } else {
            println!("{}", first);
        }
    }
}

fn main() {
    let thd = std::thread::Builder::new().stack_size(104_857_600);
    thd.spawn(|| solve()).unwrap().join().unwrap();

    /*
    // 入力を一括で読み込む場合
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut input = buf.split_whitespace();

    // inputに対しnext()で読み込んでいく
    let q: usize = input.next().unwrap().parse().unwrap();
    */
}

const LARGE_PRIME: u64 = 1_000_000_007;

// @〜でsnippet


Measured memory_bytes: 13948
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <utility>
#include <deque>
#include <stack>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<ll> vl;
typedef queue<int> qi;
typedef queue<ll> ql;
typedef pair<ll,ll> pll;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
#define rep(i,n) for (int i=0;i<n;i++)
#define mp make_pair
#define pb push_back
#define pf push_front
#define F first
#define S second
#define INF 200000009
int dp[100005];//-1:lose 1:win 0:unknown
int n,k,a[105];

int main(){
	ios::sync_with_stdio(false);
	cin>>n>>k;
	for (int i=1;i<=n;++i) cin>>a[i];
	dp[0]=-1;
	for (int i=1;i<=k;++i){
		dp[i]=-1;
		for (int j=1;j<=n;++j){
			if (i-a[j]<0) continue;
			if (dp[i-a[j]]==-1){
				dp[i]=1;break;
			}
		}
	}
	cout<< (dp[k]==1? "First":"Second");
	return 0; 
}

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


#include "boost/multiprecision/cpp_int.hpp"
#include "boost/multiprecision/cpp_dec_float.hpp"
namespace mp = boost::multiprecision;
typedef mp::cpp_int LL;
typedef mp::number<mp::cpp_dec_float<1024>> DD;// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)



typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"
#define SORT(v) sort(v.begin(),v.end())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define POSL(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define POSU(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
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;
}

void mod_print(ll k){
    ll P=1000;
    rep(y,1,P){
        ll x=mod(y*k);
        if(x+P>=i_7){
            x-=i_7;
        }
        if(abs(x)<=P){
            cout<<x<<"/"<<y<<endl;
            return;
        }
    }
    cout<<"nun"<<endl;
}
//////////////////////////



ll SOLVE(){
    dd a,b;cin>>a>>b ;
    dd c=a*b;
    cout<<(ll)c<<endl;
    
    
    return 0;
}

int main(){fastio
    
    clock_t start = clock();
    SOLVE();
    clock_t end = clock();
    const double time = static_cast<double>(end - start) / CLOCKS_PER_SEC * 1000.0;
    cerr<<endl<<time<<"ms"<<endl;
    
    return 0;
}


Measured memory_bytes: 3812
n = int(input())
a = list(map(int, input().split()))
b = {1: 0, 2: 0, 4: 0}
for i in a:
    if i % 2:
        b[1] += 1
    else:
        if (i // 2) % 2:
            b[2] += 1
        else:
            b[4] += 1
if b[1] + b[2] - 1 <= b[4]:
    print("Yes")
    exit()
if b[1] <= b[4]:
    print("Yes")
    exit()
if b[1] == 0:
    print("Yes")
    exit()
print("No")

Measured memory_bytes: 14252
#include <iostream>
#include <cstdio>
#include <cstring>
#define int long long
#define fre(x) freopen(x".in","r",stdin),freopen(x".out","w",stdout)
using namespace std;

inline int read(){
	int sum=0,f=1;char ch=getchar();
	while(ch>'9'||ch<'0'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){sum=sum*10+ch-'0';ch=getchar();}
	return f*sum;
}

const int N=43;
const int M=1<<17;
const int Mod=1000000007;
int n,X,Y,Z,ans=1,lim,st;
int f[N][M];

signed main(){
	n=read();
	X=read();Y=read();Z=read();
	st|=1<<(Z-1);
	st|=1<<(Y+Z-1);
	st|=1<<(X+Y+Z-1);
	lim=(1<<(X+Y+Z))-1;
	f[0][0]=1;
	for(int i=1;i<=n;i++){
		ans=ans*10%Mod;
		for(int j=0;j<lim;j++){
			for(int k=1;k<=10;k++){
				int ret=((j<<k)|(1<<(k-1)))&lim;
				if((ret&st)!=st) f[i][ret]=(f[i][ret]+f[i-1][j])%Mod;
			}
		}	   
	}
	for(int j=0;j<lim;j++) ans=(ans-f[n][j])%Mod;
	printf("%lld\n",(ans+Mod)%Mod);
	return 0;
}


Measured memory_bytes: 42240
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int main() {
	int h, w, n; cin >> h >> w >> n;
	vector<int>place(2); cin >> place[0] >> place[1];
	string s, t; cin >> s >> t;
	vector<int>ma(4);
	vector<int>now(4);
	string A = "UDLR";
	string B = "DURL";
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 4; j++) {
			if (s[i] == A[j]) {
				now[j]++;
				ma[j] = max(ma[j], now[j]);
			}
		}
		for (int j = 0; j < 4; j++) {
			if (t[i] == B[j]) {
				if ((j == 0 && place[0] - (now[j] - 1) <= h) ||
					(j == 1 && place[0] + (now[j] - 1) > 0) ||
					(j == 2 && place[1] - (now[j] - 1) <= h) ||
					(j == 3 && place[1] + (now[j] - 1) > 0))
					now[j]--;
			}
		}
	}

	bool ret = true;
	if (place[0] - ma[0] <= 0)ret = false;
	if (place[0] + ma[1] > h)ret = false;
	if (place[1] - ma[2] <= 0)ret = false;
	if (place[1] + ma[3] > w)ret = false;

	cout << (ret ? "YES" : "NO") << endl;
	return 0;
}

Measured memory_bytes: 776
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>

#define pb push_back
#define mp make_pair
#define taskname "A"

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef tree <int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

const int maxn = 5e5 + 5;
const int mod = 1e9 + 7;
vector<int> adj[maxn];
int n,m,k;
int res[maxn];
vector<int> adj1[maxn];
int vis[maxn];
vector<int> val;

void dfs(int u,int cur){
    val.pb(u);
    vis[u] = cur;
    for(auto c : adj[u]){
        if(vis[c]==0)dfs(c,cur);
    }
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    if(fopen(taskname".INP","r")){
		freopen(taskname".INP", "r",stdin);
		freopen(taskname".OUT", "w",stdout);
    }
    cin >> n >> m >> k;
    for(int i = 1 ; i <= m ; ++i){
        int u , v;cin >> u >> v;
        adj[u].pb(v);adj[v].pb(u);
    }
    for(int i = 1 ; i <= k ; ++i){
        int u ,v;cin >> u >> v;
        adj1[u].pb(v);adj1[v].pb(u);
    }
    for(int i = 1 ; i <= n ; ++i){
        if(vis[i]==0){
            val.clear();
            dfs(i,i);
            for(auto u : val){
                int & ans = res[u];
                ans = (int)val.size() - 1 - adj[u].size();
//                cout << val.size() - adj[u].size() - 1 << endl;
                for(auto c : adj1[u]){
                    if(vis[c] == i)ans--;
                }
            }
        }
    }
    for(int i = 1 ; i <= n ; ++i)cout << res[i] << " ";
}


Measured memory_bytes: 33788
// -*- coding:utf-8-unix -*-


use proconio::input;

// ABC086C - Traveling
// https://atcoder.jp/contests/abs/fasks/arc089_a

fn main() {
/*     input! {
        n: usize,
        mut plan: [(i32, i32, i32); n],  // Vec<(i32, i32, i32)>
    }
 */
    input! {
        k:u64,
        mut ab: (u64,u64),
    }

    for n in ab.0..ab.1 + 1 {
        if n % k == 0{
            println!("OK");
            return;
        } 
    }
    println!("NG");
}


Measured memory_bytes: 2160
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;
use std::f64::consts::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: u64,
        x: u64,
        mut m: [u64; n],
    }
    let min_cost: u64 = m.iter().sum();
    m.sort();
    println!("{}", (x-min_cost) / m[0] + n);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define RI register int
const int mod=924844033,N=4005;
int vis[N][2],ed[N],f[N][N][2],fac[N],js,n,K,ans;
int qm(int x) {return x>=mod?x-mod:x;}
int main()
{
	scanf("%d%d",&n,&K);
	for(RI i=1;i<=n;++i)
		for(RI j=0;j<=1;++j) {
			if(vis[i][j]) continue;
			for(RI x=i,y=j;x<=n;x+=K,y^=1) ++js,vis[x][y]=1;
			ed[js]=1;
		}
	f[1][0][0]=1;
	for(RI i=1;i<=js;++i)
		for(RI j=0;j<=n;++j) {
			f[i+1][j][0]=qm(f[i][j][0]+f[i][j][1]);
			if(!ed[i]) f[i+1][j+1][1]=f[i][j][0];
		}
	fac[0]=1;for(RI i=1;i<=n;++i) fac[i]=1LL*fac[i-1]*i%mod;
	for(RI i=0,fh=1;i<=n;++i,fh=-fh)
		ans=qm(ans+qm(1LL*fh*qm(f[js][i][0]+f[js][i][1])%mod*fac[n-i]%mod+mod));
	printf("%d\n",ans);
	return 0;
}

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

using namespace std;

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

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main()
{
  int N;
  cin >> N;
  vector<int> h(N);
  REP(i, N)
  cin >> h[i];
  int ans = 0;
  int now = 0;
  REP(i, N)
  {
    if (now < h[i])
      ans += (h[i] - now);
    now = h[i];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
from collections import Counter
n=int(input())
s=[]
for i in range(n):
  s.append(input())
c=list(Counter(s).items())
t=[]
for i in range(len(c)):
  t.append(c[i][1])
m=max(t)
a=[]
for i in range(len(c)):
  if c[i][1]==m:
    a.append(c[i][0])
a.sort()
for i in range(len(a)):
  print(a[i])

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

using namespace std;
using ll = long long;

void init();
void solve();

#define rep(i, a) for (int i = 0; i < (int) (a); i++)
#define reps(i, a, b) for (int i = (int) (a); i < (int) (b); i++)
#define rrep(i, a) for (int i = (int) a-1; i >= 0; i--)
#define rreps(i, a, b) for (int i = (int) (a)-1; i >= (int) (b); i--)
#define MP(a, b) make_pair((a), (b))
#define PB(a) push_back((a))
#define all(v) (v).begin(), (v).end()
#define PRINT(f) if((f)){cout << (TRUE__) << endl;}else{cout << FALSE__ << endl;}
#define TRUE__  "YES"
#define FALSE__ "NO"
#define PERM(v) next_permutation(all(v))
#define UNIQUE(v) sort(all(v));(v).erase(unique(all(v)), v.end())
#define CIN(type, x) type x;cin >> x

#ifdef LOCAL
#define lcout(a) cout << a
#define lcoutln(a) cout << a << endl
#define lcerr(a) cerr << a
#define lcerrln(a) cerr << a << endl
#else
#define lcout(a) 
#define lcoutln(a) 
#define lcerr(a) 
#define lcerrln(a) 
#endif
#define MOD 1000000007
#define PI 3.141592653589793238462643383

signed main()
{
	init();
	solve();
}

int N;
vector<int> a;

void init()
{
	cin >> N;
	a.resize(3*N);
	rep(i, 3*N) cin >> a[i];
	sort(all(a), greater<int>());
}

void solve()
{
	ll sum = 0;
	rep(i, N) {
		sum += a[i*2+1];
	}
	cout << sum << endl;
}


Measured memory_bytes: 1408
import java.util.Scanner;
 
public class Main {
 
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
 
        int h = scanner.nextInt();
        int w = scanner.nextInt();
        while (h + w > 0) {
             
             
            for(int i=0; i<h; i++){
                for(int j=0; j<w; j++){
                   if(j%2==0&&i%2==0||j%2==1&&i%2==1)
                    System.out.print("#");
                   else
                   System.out.print("."); 
                    
                }
                System.out.println();
            }
            System.out.println();
             
             
             
            h = scanner.nextInt();
            w = scanner.nextInt();
        }
    }
}
 



Measured memory_bytes: 35096