akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<cstring>

using namespace std;

int main()
{
    long long int a,b;
    char s;

    while(scanf("%lld %c %lld",&a,&s,&b)==3)
    {
        if(s=='+')
        {
            printf("%lld\n",a+b);
        }

        else
        {
            if(a==b)
                printf("0\n");

            else if(a>b)
                printf("%lld\n",a-b);

            else
                printf("-%lld\n",b-a);
        }
    }

    return (0);
}


Measured memory_bytes: 256
/*
 * atcoder/abc131/e.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> ostream & operator << (ostream & out, vector<T> const & v) {
  for (auto &&a: v) out << a << " "; out << endl; return out;
}
template <class T> void dump(T &a) { cout << a << endl; }
template <class T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template <class T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }

/*
 * N-1頂点が1頂点を介して繋がっていれば（スター）距離2の頂点ペアは(N-1)(N-2)/2通り.
 * これが最大値でもある.
 * すべての頂点を繋げばK=0は達成できるので、これらの範囲外だった場合は-1.
 * 以下範囲内であると仮定する. 0 <= K <= (N-1)(N-2)/2
 * まずは頂点1と頂点i (2 <= i <=N)をすべて繋ぎK=(N-1)(N-2)/2を構築する.
 * あとは、i, j(2 <= i, j <= N, i < j)を繋ぐと距離1になり距離2のペアが減らせるので、
 * 必要な分だけ辺で繋減らしていく.
 */
int N, K, M;
vector<pair<int, int> > edges;
void solve() {
  cin >> N >> K;
  if (K > (N-2) * (N-1) / 2) {
    cout << -1 << endl;
    return;
  }

  for (int i=2; i<=N; i++) {
    edges.push_back({1, i});
  }

  M = (N-2) * (N-1) / 2;

  for (int i=2; i<N; i++) {
    for (int j=i+1; j<=N; j++) {
      if (M==K) break;
      edges.push_back({i, j});
      M--;
    }
  }

  cout << edges.size() << endl;
  for (auto&&edge: edges) cout << edge.first << " " << edge.second << endl;
}
int main() {
  // cout.precision(15); cout << fixed;

  solve();

  return 0;
}


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

int main ()
{
    string s, p;
    bool ok = false;
    cin >> s >> p;
    s += s;
    
    for (int i = 0;i < s.size();i++)
    {
        for (int j = 0, temp = i;j < p.size();j++, temp++)
        {
            if (s[temp] != p[j]) break;
            if (s[temp] == p[j] && j == p.size()-1)
            {
                ok = true;
            }
        }
        if (ok) break;
    }
    
    if (ok) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}


Measured memory_bytes: 3196
#include <bits/stdc++.h>
using ll = long long;
using itn = int;
using namespace std;
int GCD(int a, int b){
    return b ? GCD(b, a%b) : a;
}
int main(){
    int n,x;
    cin >> n >> x;
    ll a[n+1];
    a[0]=0;
    for(int i=1; i<n+1; i++) cin >> a[i];
    ll cnt=0;
    for(int i=0; i<n; i++){
        if(a[i]+a[i+1]>x){
            cnt += a[i]+a[i+1]-x;
            a[i+1]-=a[i]+a[i+1]-x;
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 1024
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.format;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;
 
alias sread = () => readln.chomp();
alias Point2 = Tuple!(long, "y", long, "x");
 
T lread(T = long)()
{
    return readln.chomp.to!T();
}
 
T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}
 
void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

long disit_sum(long a)
{
    long sum,disit_num;
    foreach(disit;0 .. 9)
    {
        disit_num = a / pow(10, disit);
        sum += disit_num % 10;
    }
    return sum;
}


void main()
{
    string s = sread();
    string o = sread();
    foreach(e; 0 .. o.length)
    {
        writef("%c%c",s[e],o[e]);
    }
    if(s.length > o.length)
    {
        writeln(s[s.length - 1]);
    }
    else
    {
        writeln();
    }
}

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

int main() {
    int N; cin >> N;
    vector<int> A,B,C;
    bool can=false;
    rep(i,N){
        int a; cin >> a;
        A.push_back(a);
        B.push_back(a);
    }
    sort(B.begin(),B.end());
if(A==B){cout << "YES"<< endl; can=true;}
    rep(i,N-1){
        for(int j=i+1;j<N;j++){
            C=A;
           int b=C[i];
           C[i]=C[j];
           C[j]=b;
           if(B==C){
               cout << "YES" << endl;
               can=true; break;
           }
        }
        if(can)break;
    }
    if(!can)cout << "NO" << endl;


    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <algorithm>
#include <queue>

#define ll long long
#define ull unsigned long long
#define mod 1000000007

using namespace std;

int main() {
    int n;
    double* v;
    cin >> n;
    v = new double[n];
    for(int i = 0; i < n; i++){
        cin >> v[i];
    }

    sort(v, v+n);

    double ans = (v[0]+v[1])/2;
    for(int i = 2; i < n; i++){
        ans = (ans+v[i])/2;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(n) for(int I = 0; (I) < (n); ++(I) )
#define repeat(i, n) for( int i = 0; (i) < (n); ++(i) )
#define repeat_to(i, n) for( int i = 0; (i) <= (n); ++(i) )
#define repeat_from(i, m, n) for( int i = (m); (i) < (n); ++(i) )
#define repeat_from_to(i, m, n) for( int i = (m); (i) <= (n); ++(i) )
#define el cout<<endl
#define dump(x) cout<<" "<<#x<<"="<<x
#define vdump(v) for(size_t I=0; I<v.size(); ++I){cout<<" "<<#v<<"["<<I<<"]="<<v[I];} cout<<endl
using namespace std;
using lint = long long;
using ld = long double;

/****************** グラフ ******************/
// 諸宣言
using Weight = lint;
using Flow = lint;
struct Edge {
    int src, dst;
    Weight weight;
    Flow cap;
    Edge() : src(0), dst(0), weight(0) {}
    Edge(int s, int d, Weight w) : src(s), dst(d), weight(w) {}
    Edge(int s, int d, Weight w, Flow c) : src(s), dst(d), weight(w), cap(c) {}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;
using Array = vector<Weight>;
using Matrix = vector<Array>;

void add_edge(Graph &g, int a, int b, Weight w = 1, Flow c = 1) {
    g[a].emplace_back(a, b, w, c);
    g[b].emplace_back(b, a, w, c);
}
void add_arc(Graph &g, int a, int b, Weight w = 1, Flow c = 1) {
    g[a].emplace_back(a, b, w, c);
}

// ダイクストラ法（プライオリティーキュー）O((E+V)logV)
std::vector<Weight> dijkstra(const Graph &g, int s) {
    const Weight INF = std::numeric_limits<Weight>::max() / 8;
    using state = std::tuple<Weight, int>;
    std::priority_queue<state> q;
    std::vector<Weight> dist(g.size(), INF);
    dist[s] = 0;
    q.emplace(0, s);
    while (q.size()) {
        Weight d;
        int v;
        std::tie(d, v) = q.top();
        q.pop();
        d *= -1;
        /* if(v == t) return d; */
        if (dist[v] < d) continue;
        for (auto &e : g[v]) {
            if (dist[e.dst] > dist[v] + e.weight) {
                dist[e.dst] = dist[v] + e.weight;
                q.emplace(-dist[e.dst], e.dst);
            }
        }
    }
    return dist;
}

int main(void) {
    int n, m;
    cin >> n >> m;
    Graph g(n);
    rep(m) {
        int a, b;
        cin >> a >> b;
        --a, --b;
        add_edge(g, a, b);
    }
    vector<Weight> res = dijkstra(g, 0);
    if (res[n-1] == 2) cout << "POSSIBLE" << endl;
    else cout << "IMPOSSIBLE" << endl;
}

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

/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y) {
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
int dp[100005] = {};
int main() {
	int N;
	cin >> N;
	for (int i = 1; i < N + 1; i++) {
		int a;
		cin >> a;
		dp[i] = a;
	}
	int c = 1;
	int cnt = 0;

	if (dp[c] == 2) {
		cout << 1;
		return 0;
	}

	for (int i = 1; i < 100005; i++) {
		c = dp[c];
		cnt++;
		if (c == 2) {
			cout << cnt;
			return 0;
		}
	}

	cout << -1;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <string.h>

int H,W;
int map[100][100];
char str[100][101];

int dx[4] = {1,0,-1,0};
int dy[4] = {0,1,0,-1};

void fill(int y,int x,char c){
	int i;
	
	map[y][x] = 1;
	
	for(i = 0;i < 4;i++){
		if(x+dx[i] >= 0 && x+dx[i] < W && y+dy[i] >= 0 && y+dy[i] < H){
			if(str[y+dy[i]][x+dx[i]] == c && !map[y+dy[i]][x+dx[i]]){
				fill(y+dy[i],x+dx[i],c);
			}
		}
	}
}

int main(void) {
	int i,j,ans;
	
	while(scanf("%d %d",&H,&W),H+W){
		for(i = 0;i < H;i++){
			scanf("%s",str[i]);
		}
		memset(map,0,sizeof(map));
		
		ans = 0;
		for(i = 0;i < H;i++){
			for(j = 0;j < W;j++){
				if(!map[i][j]){
					ans++;
					fill(i,j,str[i][j]);
				}
			}
		}
		
		printf("%d\n",ans);
	}
	
	return 0;
}

Measured memory_bytes: 1124
#include <iomanip>
#include <iostream>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  int A, B;
  cin >> A >> B;
  int XAL = int((double)(A - 1) / 0.08);
  int XAH = int((double)(A + 1) / 0.08);
  int XBL = int((double)(B - 1) / 0.1);
  int XBH = int((double)(B + 1) / 0.1);

  while (int(XAL * 0.08) != A) XAL++;
  while (int(XBL * 0.10) != B) XBL++;

  // cout << "XAL=" << XAL << " XAH=" << XAH << endl;
  // cout << "XBL=" << XBL << " XBH=" << XBH << endl;

  for (int a = XAL; a < XAH; ++a) {
    for (int b = XBL; b < XBH; ++b) {
      if (a == b) {
        cout << a << endl;
        return 0;
      }
    }
  }
  cout << -1 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rrep(i,n) for(int i=(int)(n)-1; i>=0; i--)
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define iter(c) __typeof((c).begin())
#define tr(it,c) for(iter(c) it=(c).begin(); it!=(c).end(); it++)
#define pb(a) push_back(a)
#define pr(a) cout << (a) << endl
#define PR(a,b) cout << (a) << " " << (b) << endl
#define F first
#define S second
typedef long long ll;
typedef pair<int,int> P;
const int MAX=1000000001;
const ll MAXL=1000000000000000001LL;
const ll mod=1000000007;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int main() {
  int M=1000001;
  bool d[M];
  memset(d,false,sizeof(d));
  d[1]=true;
  rep(i,M) {
    if(d[i]) {
      if(i*2<M) d[i*2]=true;
      if(i*3<M) d[i*3]=true;
      if(i*5<M) d[i*5]=true;
    }
  }
  int n,m;
  while(cin >> n && n) {
    cin >> m;
    int ans=0;
    REP(i,n,m+1) ans+=d[i];
    pr(ans);
  }
  return 0;
}


Measured memory_bytes: 2144
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int MOD = 1000000007;
int INF = numeric_limits<int>::max() / 2;


signed main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;

  int dp[N+1][4][4][4] = {};
  int A = 0, T = 1, G = 2, C = 3;
  rep(i, 4){
    rep(j, 4){
      rep(k, 4){
        if(i==A && j == G && k == C) continue;
        if(i==A && j == C && k == G) continue;
        if(i==G && j == A && k == C) continue;
        dp[3][i][j][k] = 1;
      }
    }
  }
  for(int i=4;i<=N;i++){
    rep(j, 4){
      rep(k, 4){
        rep(l, 4){
          rep(m, 4){
            if(k==A && l==G && m==C) continue;
            if(k==A && l==C && m==G) continue;
            if(k==G && l==A && m==C) continue;
            if(j==A && k==G && m==C) continue;
            if(j==A && l==G && m==C) continue;
            dp[i][k][l][m] += dp[i-1][j][k][l];
            dp[i][k][l][m] %= MOD;
          }
        }
      }
    }
  }
  int ans = 0;
  rep(i, 4){
    rep(j, 4){
      rep(k, 4){
        ans += dp[N][i][j][k];
        ans %= MOD;
      }
    }
  }
  cout << ans << endl;
}

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

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <= b; i++)

#define lli long long
#define li long
#define vi vector<int>
#define vli vector<li>
#define vlli vector<lli>
#define pi pair<int,int>
#define pli pair<li, li>
#define vpi vector<pi>

using namespace std;

int main() {

    int won = 0;
    int qtd = 0;
    char c;
    while(scanf("%c", &c) != EOF) {
        if(c == 'o') won++;
        if(c == 'o' || c == 'x') qtd++;
    }

    if(won + (15 - qtd) >= 8) printf("YES\n");
    else printf("NO\n");

}


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

const int mod = 998244353;
int n, a[310], f[310][90010], sum = 0, ans = 0;

int add(int x, int y)
{
    x += y;
    if (x >= mod) x -= mod;
    return x;
}
int sub(int x, int y)
{
    x -= y;
    if (x < 0) x += mod;
    return x;
}
int Pow(int x, int y)
{
    int ans = 1;
    for (; y; y >>= 1, x = 1LL * x * x % mod)
        if (y & 1) ans = 1LL * ans * x % mod;
    return ans;
}
int main()
{
    scanf("%d", &n);
    for (int i = 1; i <= n; i++)
    {
        scanf("%d", &a[i]);
        sum += a[i];
    }
    f[0][0] = 3;
    for (int i = 1; i <= n; i++)
    {
        for (int j = 0; j <= sum; j++)
        {
            f[i][j] = add(f[i - 1][j], f[i - 1][j]);
            if (j >= a[i]) f[i][j] = add(f[i][j], f[i - 1][j - a[i]]);
            // printf("%d ", f[i][j]);
        }
        // puts("");
    }
    ans = Pow(3, n);
    for (int i = sum + 1 >> 1; i <= sum; i++)
        ans = sub(ans, f[n][i]);
    // printf("%d\n", ans);
    if (!(sum & 1))
    {
        memset(f, 0, sizeof(f));
        f[0][0] = 3;
        sum = 0;
        for (int i = 1; i <= n; i++)
        {
            sum += a[i];
            for (int j = 0; j <= sum; j++)
            {
                f[i][j] = f[i - 1][j];
                if (j >= a[i]) f[i][j] = add(f[i][j], f[i - 1][j - a[i]]);
            }
        }
        ans = add(ans, f[n][sum >> 1]);
    }
    printf("%d\n", ans);
}

Measured memory_bytes: 109184
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n) for(int i=1;i<=n;i++)
const ll MOD = 1000000007;
long long modinv(long long a, long long m=MOD) {
    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;
    /*MODの割り算の際に
    a/＝b;
    を
    a *= modinv(b,MOD);
    とする。
        */
}

int N,Q;
const int MAXN = 100000;

int A[MAXN],B[MAXN],C[MAXN];

int main(){

    cin >> N;
    ll ans = 0;
    rep(i,N){
        cin >> A[i];
        ans += A[i];
    }

    cin >> Q;
    rep(i,Q) {
        cin >> B[i] >> C[i];
    }

    map<int,int> ma;

    rep(i,N){
        if(ma[A[i]]>0)ma[A[i]]++;
        else ma[A[i]] = 1;
    }

    

    rep(i,Q) {
        if(ma[B[i]] > 0){
            ans += ma[B[i]]*(C[i] - B[i]);
            if(ma[C[i]]>0){
                ma[C[i]] += ma[B[i]];
            }else{
                ma[C[i]] = ma[B[i]];
            }
            ma[B[i]] = 0;
        }
        cout << ans <<endl;
    }

    

    return 0;
}

Measured memory_bytes: 8872
///https://atcoder.jp/contests/abc136/submissions/6694552
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void* a, const void* b) { return*(ll*)a<*(ll*)b ? -1 : *(ll*)a> * (ll*)b ? 1 : 0; }
int downll(const void* a, const void* b) { return*(ll*)a<*(ll*)b ? 1 : *(ll*)a> * (ll*)b ? -1 : 0; }
void sortup(ll* a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll* a, int n) { qsort(a, n, sizeof(ll), downll); }
ll pom(ll a, ll n, int m) { ll x = 1; for (a %= m; n; n /= 2)n & 1 ? x = x * a % m : 0, a = a * a % m; return x; }
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

ll n, k;
ll a[510];
ll d[10000], cnt;
ll dd;
int c(const void* p, const void* q) {
	if (*(int*)p % dd < *(int*)q % dd)return -1;
	return 1;
}

int main() {
	scanf("%lld%lld", &n, &k);
	rep(i, 0, n)scanf("%lld", a + i);
	ll s = 0;
	rep(i, 0, n)s += a[i];
	//sは5e8くらい
	for (int i = 1; i * i <= s; i++)if (s % i == 0) {
		d[cnt++] = i;
		d[cnt++] = s / i;
	}
	sortdown(d, cnt);
	rep(i, 0, cnt) {
		dd = d[i];
		qsort(a, n, sizeof(ll), c);
		int r = n, pre = 0;
		ll temp = k;
		rep(j, 0, r) {
			pre += a[j] % dd;
			temp -= a[j] % dd;
			if (temp < 0)break;
			while (a[r - 1] % dd + pre >= dd) {
				pre -= dd - a[r - 1] % dd;
				r--;
			}
		}
		if (temp >= 0) {
			printf("%lld", dd);
			return 0;
		}
	}
}


Measured memory_bytes: 252
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>


using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;

#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i,a,b) for(int i = (a); i < (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(v) ((int)v.size())

#define pb push_back
#define mp make_pair
#define mt make_tuple

int main(void)
{
    cin.sync_with_stdio(false);
    int N;
    cin >> N;
    set<int> s;
    REP(n, N) {
        int x;
        cin >> x;
        s.insert(x);
    }
    cout << ((N == SIZE(s)) ? "YES" : "NO") << endl;

    return 0;
}


Measured memory_bytes: 9600
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define itrep(it, a) for(it = (a).begin(); it != (a).end(); it++)
#define all(a) (a).begin(), (a).end()
#define debug(x) cout << "debug " << x << endl;
#define INF (1 << 30)
using namespace std;

int main(){
    int t;
    while(cin >> t, t){
        int n, study = 0;
        cin >> n;
        rep(i,n){
            int a , b;
            cin >> a >> b;
            study+=(b - a);
        }
        if(t <= study) cout << "OK" << endl;
        else cout << t - study << endl;
    }
}

Measured memory_bytes: 1164
<?php
# 数値の入力
fscanf(STDIN, "%d %d", $data1, $data2);
$plus = $data1 + $data2;
$minus = $data1 - $data2;
$Multiplication = $data1 * $data2;

if($plus >= $minus and $plus >= $Multiplication){
    echo $plus."\n";
}elseif($minus >= $plus and $minus >= $Multiplication){
    echo $minus."\n";
}else{
    echo $Multiplication."\n";
}
?>

Measured memory_bytes: 3576
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC opatimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#pragma GCC diagnostic ignored "-Wmissing-declarations"
#define FINAL_OUT(x) {cout << (x) << '\n'; exit(0); }

int const mod = 1e9 + 7;

inline int safe_mul(const int x, const int y) {
    return x * 1LL * y % mod;
}

inline void safe_add(int& x, const int y) {
    x += y;
    if (x >= mod)
        x -= mod;
}

inline int safe_pow(int x, int y) {
    int res = 1;
    for (; y > 0; y >>= 1) {
        if (y & 1)
            res = safe_mul(res, x);
        x = safe_mul(x,x);
    }
    return res;
}


inline int safe_inv(const int x){
    return safe_pow(x, mod - 2);
}

int const maxn = 2 * 200005;
int fact[maxn];
int ifact[maxn];

inline int C(const int n, const int k) {
    if (n < k || k > n || k < 0)
        return 0;
    return safe_mul(fact[n] ,safe_mul(ifact[k], ifact[n - k]));
}

inline int CP(const int n, const int k) {
    return C(n + k - 1, n);
}

int main() {
//    freopen("in.txt","r", stdin);
//    cout << fixed << setprecision(15);
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    fact[0] = ifact[0] = 1;
    for (int i = 1; i < maxn; ++i) {
        fact[i] = safe_mul(fact[i - 1], i);
        ifact[i] = safe_inv(fact[i]);
    }

    int n,k;
    cin >> n >> k;

    int ans = 0;
    for (int i = 0; i <= min(n - 1,k); ++i) {
        safe_add(ans, safe_mul(C(n, i), CP(i, n - i)));
    }
    cout << ans << endl;
}


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

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

typedef long long ll;

signed main()
{
    cout << fixed << setprecision(12);

    int N, K; cin >> N >> K;

    double ans = 0.0;
    rep(i, N){
        double prob = 1.0;
        for (int j = i + 1; j < K; j *= 2){
            prob *= 0.5;
        }
        ans += prob;
    }

    cout << ans / (double)N << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<set>
#include<queue>
#include<string>
#include<sstream>
#include<iostream>
#include<sstream>
#include<stack>
#include<map>
#include<vector>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<math.h>
#include <cassert>
using namespace std;
typedef long long ll;
#define mod 1000000007
#define MAXN 1200

int main()
{
	ll n, m,d;
	cin >> n >> d>>m;
	for (int i = 1; i <= 10; i++)
	{
		m = n * m - d;
		printf("%lld\n", m);
	}
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){
    int i, j;
    int N, a, b;
    int Cakes=4, Donuts=7;
    scanf("%d", &N);
    a = N / Cakes;
    b = N / Donuts;
    for(i=0;i<a+1;i++){
        for(j=0;j<b+1;j++){
            if(Cakes*i + Donuts*j == N){
                printf("Yes\n");
                return 0;
            }
        }
    }
    printf("No\n");
    return 0;
}

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

struct Benri { Benri() { std::cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(12);}} benri;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vll = vector<long long>;
using pll = pair<ll, ll>;
using ull = unsigned long long;

template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define F first
#define S second

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

constexpr long long MOD = 1000000007;
//constexpr long long MOD = 998244353;
//constexpr int INF = 1001001001;
constexpr ll INF = 1001001001001001001ll;
constexpr double EPS = 1e-10;
using number = long long;




struct edge {
    int from, to;
    number cost;
    edge(int a, int b, number c) : from(a), to(b), cost(c) {}
};


using Edges = vector< edge >;

vector< number > bellman_ford(int s, int V, Edges &edges) {
    vector< number > dist(V, INF);
    dist[s] = 0;
    for (int i = 0; i < V - 1; i++) {
        for (auto &e : edges) {
            if (dist[e.from] == INF) continue;
            dist[e.to] = min(dist[e.to], dist[e.from] + e.cost);
        }
    }
    for (auto &e : edges) {
        if (dist[e.from] == INF) continue;
        if (dist[e.from] + e.cost < dist[e.to]) return vector< number >();
    }
    return dist;
}


int main() {
    int V, E, r; cin >> V >> E >> r;
    Edges G;
    int s, t; ll d;
    rep(i, E) {
        cin >> s >> t >> d;
        G.pb(edge(s, t, d));
    }

    vll dist = bellman_ford(r, V, G);

    if (dist.empty()) {
        cout << "NEGATIVE CYCLE" << endl;
        return 0;
    }

    rep(i, V) {
        if (dist[i] == INF) cout << "INF" << endl;
        else cout << dist[i] << endl;
    }

}


Measured memory_bytes: 3212
// INCLUDES
#include <bits/stdc++.h>
#include<assert.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
//DEFINES
#define MAX 1000001
#define pii pair<int, int>
#define c1 __builtin_popcount
#define F first
#define S second
#define all(s) begin(s),end(s)
#define MIN3POS(a, b, c) (a) =< (b) ? ((a) =< (c) ? 1 : 3) : ((b) =< (c) ? 2 : 3)
#define MAX3POS(a,b,c) (a) >= (b) ? ((a) >= (c) ? 1 : 3) : ((b) >= (c) ? 2:3)
#define endl '\n'
#define int long long
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define FOR(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define IOS   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);}
//NAMESPACES
using namespace __gnu_pbds; 
using namespace std;
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
vector<string> __attribute__ ((unused)) args,
__attribute__ ((unused)) int idx, 
__attribute__ ((unused)) int LINE_NUM) { cerr << endl; } 
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifdef XOX
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif
//HELPERS
void showpq(priority_queue <int> gq) 
{ 
    priority_queue <int> g = gq; 
    while (!g.empty()) 
    { 
        cout << '\t' << g.top(); 
        g.pop(); 
    } 
    cout << '\n'; 
} 
  
vector<int> powers2(32,0);void initialize(){ for(int i=1;i<powers2.size();i++) powers2[i] = powers2[i-1]*2;}
int32_t main()
{
IOS
int n,m;
cin>>n>>m;
vector<pair<int,int>> v(n+1);
FOR(i,1,n+1) {
    int a,b;
    cin>>a>>b;
    v[i] = {a,b};
}
sort(begin(v)+1,end(v));
int pos = 1;
priority_queue<int> pq;
int ans = 0;
FOR(i,1,m+1) {
    // debug(ans,pos,i);
    while(pos<=n && v[pos].first<=i) {
        pq.push(v[pos].second);
        pos++;
    }
    // showpq(pq);
    if(pq.size()>0) {
        debug(pq.top());
    ans+=pq.top();
    pq.pop();
    }
}
cout<<ans;
return 0;
}
// Use emplace back in place of pushback
// Use tie function , for object destructuring

Measured memory_bytes: 2936
a, b = map(int, input().split())
if a<=0 and b>=0:
  ans = 'Zero'
elif a>0:
  ans = 'Positive'
else:
  if (b-a)%2 == 0:
    ans = 'Negative'
  else:
    ans = 'Positive'
print(ans)

Measured memory_bytes: 3060
n = int(input())
A = tuple(map(int, input().split()))

from itertools import accumulate
ac = [0] + list(accumulate(A))

ans = 2*10**5*(10**9)
for i in range(1, n):
    ans = min(ans, abs(ac[i] - ac[n] + ac[i]))
print(ans)


Measured memory_bytes: 31748
#pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define ms(a,b) memset(a,b,sizeof(a))
#define msn(a,n,b) for(int i=0;i<=n;i++)a[i]=b
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define fi first
#define se second
using namespace std;
mt19937 rng_32(chrono::steady_clock::now().time_since_epoch().count());
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef double db;
const int mod=1e9+7;
const int seed=233;
const double PI=acos(-1.0);
const double eps=1e-7;
const int inf=0x3f3f3f3f;
const int max_n=100005;
ll ceil(ll x,ll y){if(x==0)return 0;if(y<0)x=-x,y=-y;bool sign=x>0;x=abs(x);return sign?(x+y-1)/y:-x/y;}
ll floor(ll x,ll y){if(x==0)return 0;if(y<0)x=-x,y=-y;bool sign=x>0;x=abs(x);return sign?x/y:-(x+y-1)/y;}
namespace {
    inline int Add(int x,int y){return (x+=y)>=mod?x-mod:x;}
    inline int Sub(int x,int y){return (x-=y)<0?x+mod:x;}
    inline int Mul(int x,int y) {return 1ll*x*y%mod;}
    inline int Pow(int x,int y=mod-2){if(y==0)return 1;int res=1;while(y){if(y&1)res=1ll*res*x%mod;x=1ll*x*x%mod;y>>=1;}return res;}
}
/**********************head************************/
int n, m;
int main() {
    scanf("%d%d", &n, &m);
    for(int i = 1; i <= m; i++) {
        int x; scanf("%d", &x);
        n -= x;
    }
    if(n >= 0) printf("%d\n", n);
    else printf("-1\n");
    return 0;
}

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

int f(int x)
{
  if ((x%2==1 && x<=7) || (x%2==0 && x>=8)) {
    return 0;
  } else if (x==4 || x==6 || x==9 || x==11) {
    return 1;
  } else {
    return 2;
  }
}

int main()
{
  int x,y;
  scanf("%d %d",&x,&y);

  if (f(x) == f(y)) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }
  
  return 0;
}


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


using namespace std;

int main(void) {

	int n, m, X, Y;

	cin >> n >> m >> X >> Y;

	vector<int> x(n);
	vector<int> y(m);

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

	x.push_back(X);
	y.push_back(Y);

	sort(x.begin(), x.end());
	sort(y.begin(), y.end());

	if (x.back() >= y.front()) {
		cout << "War";

	}
	else {
		cout << "No War";
	}

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <vector>
#include <cmath>
#include <math.h>

using namespace std;

long long gcd(long long x, long long y) {
    long p = max(x, y), q = min(x, y);
    if (p % q == 0)
        return q;
    else
        return gcd(q, p % q);
}


int main() {
    long long a, b; cin >> a >> b;
    long long g = gcd(a, b);
    long long g_ = sqrt(g);
    long long ans = 1;

    for (int i = 2; i <= g_; i++) {
        if (g % i == 0) {
            ans++;
            while (g % i == 0)
                g /= i;
        }
    }
    if (g > g_)
        ans++;

    cout << ans << endl;
    return 0;
}

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

class Program {
    static void Main(string[] args) {
        int h = Cin.Ni();
        int w = Cin.Ni();

        for (int i = 0; i < h; i++) {
            string s = Cin.Next();
            Console.WriteLine(s);
            Console.WriteLine(s);
        }
    }
}

public class Cin {
    private static string[] s = new string[0];
    private static int i = 0;

    private static char[] cs = new char[] { ' ' };

    public static string Next() {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        i = 0;
        return Next();
    }

    public static int Ni() {
        return int.Parse(Next());
    }

    public static long NextLong() {
        return long.Parse(Next());
    }

    public static double NextDouble() {
        return double.Parse(Next());
    }

}


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

using namespace std;

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

    int terminateState = 1;

    vector<int> a(N);
    for (auto& ai : a) cin >> ai;

    vector<bool> isPushed(N, false);

    int count = 0;

    int i = 0;
    while (!isPushed[i]) {
        if (i == terminateState) {
            cout << count << endl;
            return 0;
        }
        isPushed[i] = true;
        ++count;
        i = a[i] - 1;
    }
    cout << -1 << endl;

    return 0;
}


Measured memory_bytes: 640
module Main where

import           Control.Monad
import           Data.List
import           Data.Ord
import           Data.List.Split
import           Data.Array.IO
import qualified Data.Vector            as V
import           Data.Maybe
import           Text.Printf

main :: IO ()
main = do
  n <- readLn :: IO Int
  as <- map read . words <$> getLine
  let abas = map abs as
  if (even . length . filter (< 0)) as
    then (print . sum) abas
    else print $ sum abas - (2 * minimum abas)


Measured memory_bytes: 42364
import math


a, b, x = map(int, input().split())
r = 180 / math.pi
h = x / a ** 2
c = h * 2 - b
d = 2 * x / (a * b)
if h >= b / 2:
    th = math.atan((h - c) / (a / 2)) * r
else:
    th = ((math.pi / 2) - math.atan((d / b))) * r
print(th)

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

using namespace std;

int pow_int(int b, int p) {
    int r = 1;
    for (int i = 0; i < p; i++) {
        r *= b;
    }
    return r;
}

int main(void) {
    int X;
    int ans = 0;
    int t;

    cin >> X;

    for (int b = 1; b <= 31; b++) {
        for (int p = 2; p <= 10; p++) {
            t = pow_int(b, p);
            if (t <= X) {
                ans = max(ans, t);
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
	int A, B;
	int pura, hiku, kake, max;
	scanf("%d %d", &A, &B);
	pura = A + B;
	max = pura;
	hiku = A - B;
	kake = A*B;
	if (hiku > max){
		max = hiku;
	}
	if(kake > max){
		max = kake;
	}
	printf("%d\n", max);
	return 0;
}

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

using namespace std;
typedef long long LL;
// typedef pair<double, double> P;
// typedef pair<P, LL> PP;

// vector<P> px(110000);
// vector<P> py(110000);
int main() {
  // #ifndef ONLINE_JUDGE
  //freopen("input", "r", stdin);
  //std::vector<int> v;
  //freopen("output", "w", stdout);
  int n;
  cin>>n;
  if(n==1)
  cout<<1<<endl;
  else{
    int t=2;
    while(t*2<=n)
      t*=2;
    cout<<t<<endl;
  }

  //cout<<"????"<<endl;
}


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

using namespace std;

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

  int n,h,w;cin>>n>>w>>h;
  int tate[200010]={0},yoko[200010]={0};
  for(int i=0;i<n;i++){
    int x,y,wi;cin>>x>>y>>wi;
    tate[max(y-wi,0)]++;tate[min(h,y+wi)]--;
    //cout<<max(y-wi,0)<<" "<<min(h,y+wi)<<endl;
    yoko[max(x-wi,0)]++;yoko[min(w,x+wi)]--;
  }
  for(int i=1;i<w;i++) yoko[i]+=yoko[i-1];
  for(int i=1;i<h;i++) tate[i]+=tate[i-1];
  //cout<<yoko[50000]<<endl;
  bool flag1=true,flag2=true;
  for(int i=0;i<w;i++) if(yoko[i]==0) flag1=false;
  for(int i=0;i<h;i++) if(tate[i]==0) flag2=false;
  if(flag1||flag2) cout<<"Yes"<<endl;
  else cout<<"No" <<endl;
}

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

using namespace std;

// 算法参考维基百科 https://en.wikipedia.org/wiki/Activity_selection_problem
// 通过将所有的活动按照结束时间的早晚进行排序, 从而保证最大的活动量

struct activity {
	// 活动开始时间, 活动结束时间
	int start, finish;
	// 排序时, 结束时间越早的活动越靠前
	bool operator<(activity &a) {
		return finish < a.finish;
	}
};

int main(void) {
	int n;
	cin >> n;
	activity temp_activity;
	vector<activity> vec;

	for (int i = 0; i < n; i++) {
		// 读取每个活动的开始时间与结束时间, 存入队列
		cin >> temp_activity.start >> temp_activity.finish;
		vec.push_back(temp_activity);
	}
	// 按照结束时间进行排序
	sort(vec.begin(), vec.end());

	// 结束时间最早的活动一定会第一个开始
	int cnt = 1;
	// 第一个活动举行之后, 其余的活动最早的也肯定在第一个活动结束之后才能开始
	int last_finish_time = vec[0].finish;

	for (int i = 1; i < vec.size(); i++) {
		// 如果后面的活动的开始时间在前一个活动的结束时间之后, 那么它就可以开始了
		if (vec[i].start > last_finish_time) {
			cnt++;
			// 更新最后的结束时间
			last_finish_time = vec[i].finish;
		}
	}

	cout << cnt << endl;
}


Measured memory_bytes: 3928
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using System.IO.Pipes;

public class HelloWorld
{
    static bool res = false;
    static long[] avail;
    static long[] memo;
    static public void Main()
    {

        //var N = long.Parse(Console.ReadLine());
        var NM = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
        var A = NM[0];
        var B = NM[1];
        var C = NM[2];
        var X = NM[3];
        var Y = NM[4];


        var MinCost = long.MaxValue;

        for (int c = 0; c <= (long)Math.Max(X,Y)*2; c++)
        {
            var cost = c * C;
            var a = Math.Max(0, X - (c / 2));
            var b = Math.Max(0, Y - (c / 2));
            cost += a * A + b * B;

            MinCost = Math.Min(MinCost, cost);
        }

        Console.WriteLine(MinCost);
    }

    public static long Pow(long a, int n)
    {
        switch (n)
        {
            case 0:
                return 1;
            case 1:
                return a;
            default:
                var p = Pow(a, n / 2);
                return p * p * Pow(a, n % 2);
        }
    }

    public static long PrimeFactorization(long n)
    {
        var res = 1L;

        for (long i = 2; i * i <= n; i++)
        {
            if (n % i != 0) continue;
            long exponents = 0;

            // 割り続ける
            while (n % i == 0)
            {
                exponents++;
                n /= i;
            }

            res *= exponents+1;
        }

        // 素数が残っている場合
        if (n != 1) res *= 2;
        return res;
    }
}



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

int main (){

    int N,K,ans=0;
    cin >> N >> K;
    int l[N];
    
    for(int i = 0; i < N; i++) {
        cin >> l[i];
    }

    sort(l,l+N);
    reverse(l,l+N);
    
    for(int i = 0; i < K; i++) {
        ans += l[i];
    }
    
    cout << ans << endl;
    return 0;
}


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

int main() {
    int D,N;
    cin >> D >> N;
    if(D == 0) {
        if(N == 100) {
            cout << 101 << endl;
        }
        else {
            cout << N << endl;
        }
        return 0;
    }
    if(D == 1) {
        if(N == 100) {
            cout << 10100 << endl;
        }
        else {
            cout << N*100 << endl;
        }
        return 0;
    }
    if(N == 100) {
        cout << 1010000 << endl; 
        return 0;
    } 
    cout << N*10000 << endl;
}


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

using namespace std;

int main(void) {
    int a, b, k;
    cin >> a >> b >> k;
    int cnt = 0;
    if (a > b) {
        int temp = a;
        a = b;
        b = temp;
    }

    for (int i = a; i > 0; --i) {
        if ((a % i == 0) && (b % i == 0)) { cnt++; }
        if (cnt == k) {
            cout << i << endl;
            break;
        }
    }
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int n,m;
int a[50],b[50];
bool graph[50][50];
bool visited[50];
void dfs(int v){
	visited[v]=true;
	for(int v2=0;v2<n;v2++){
		if(graph[v][v2]==false) continue;
		if(visited[v2]==true) continue;
		dfs(v2);
	}
}
int main(){
	cin >> n >> m;
	for(int i=0;i<m;i++){
		cin >> a[i] >> b[i];
		a[i]--,b[i]--;
		graph[a[i]][b[i]]=graph[b[i]][a[i]]=true;
	}
	int ans=0;
	for(int i=0;i<m;i++){
		graph[a[i]][b[i]]=graph[b[i]][a[i]]=false;
		for(int j=0;j<n;j++) visited[j]=false;
		dfs(0);
		bool bridge=false;
		for(int j=0;j<n;j++) if(!visited[j]) bridge=true;
		if(bridge) ans++;
		graph[a[i]][b[i]]=graph[b[i]][a[i]]=true;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <string>
#include <iostream>
#include <math.h>
#include <algorithm>
#include <map>
#include <vector>
#include <unordered_map>
#include <iomanip>


using namespace std;
#define ASCII 97


int main() {

	std::string predict, actual;
	cin >> predict;
	cin >> actual;

	const char* predict_c = predict.c_str();
	const char* actula_c = actual.c_str();

	int hit = 0;
	for (int i = 0; i < 3; i++) {
		switch (predict_c[i]) {
		case 'S':
		case 'R':
		case 'C':
			if (predict_c[i] == actula_c[i])
				hit++;
		default:
			break;
		}

	}
	cout << hit << endl;


}



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

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long 

int main(int argc, char const *argv[]){
	int a,b;
	char op;
	scanf("%d %c %d",&a,&op,&b);
	if(op == '+')	printf("%d\n", a + b);
	else printf("%d\n", a - b);
	return 0;
}


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

using namespace std;

struct Item {
  long weight;
  long value;
};

int main() {
  long N, W;
  cin >> N >> W;
  
  vector<Item> items;
  items.reserve(N);
  for (long n = 0; n < N; ++n) {
    long w, v;
    cin >> w >> v;
    items.push_back(Item{w, v});
  }
  vector<vector<long>> dp(N + 1);
  for (auto& v : dp) v.resize(W + 1);
  for (size_t n = 1; n <= N; ++n) {
    for (size_t w = 1; w <= W; ++w) {
      const auto& item = items[n-1];
      long val = item.weight <= w ? item.value + dp[n-1][w - item.weight] : 0;
      dp[n][w] = max(dp[n-1][w], val);
    }
  }
  cout << dp[N][W] << endl;
  
  return 0;
}

Measured memory_bytes: 79488
#include<stdio.h>
#define INFTY (1 << 21)
#define WHITE 0
#define GRAY 1
#define BLACK 2

int h,ray[100][100];

int Pri();

int main(){
    int i,j,a;
    int P;
    
    scanf("%d",&h);
    
    for(i = 0;i < h;i++){
        for(j = 0;j < h;j++){
            scanf("%d",&a);
            
            ray[i][j] = a;
            
            if(ray[i][j] == -1) ray[i][j] = INFTY;
        }
    }
    
    P = Pri();
    
    printf("%d\n",P);
    
    return 0;
}

int Pri(){
    int i,u,min;
    int d[100],p[100],color[100],sum = 0;
    
    for(i = 0;i < h;i++){
        d[i] = INFTY;
        p[i] = -1;
        color[i] = WHITE;
    }
    
    d[0] = 0;
    
    while(1){
        min = INFTY;
        
        u = -1;
        
        for(i = 0;i < h;i++){
            if(min > d[i] && color[i] != BLACK){
                u = i;
                min = d[i];
            }
        }
        
        if(u == -1) break;
        
        color[u] = BLACK;
        
        for(i = 0;i < h;i++){
            if(color[i] != BLACK && ray[u][i] != INFTY){
                if(d[i] > ray[u][i]){
                    d[i] = ray[u][i];
                    p[i] = u;
                    color[i] = GRAY;
                }
            }
        }
    }
    
    for(i = 0;i < h;i++){
        if(p[i] != -1) sum += ray[i][p[i]];
    }
    
    return sum;
}


Measured memory_bytes: 2112
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(long long i=(a);i<(b);++i)
#define per(i,a,b) for(long long i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

int main() {
  ll n,k;
  cin>>n>>k;
  double ans = 0.;
  rep(i,1,n+1){
    double p = 1./n;
    ll c = 0;
    ll n1 = i;
    while(n1<k){
      n1*=2;
      c++;
    }
    p *= pow(0.5,c);
    ans += p;
  }
  printf("%20.20f\n", ans);
  return 0;
}

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

using namespace std;

int main()
{
  long long N, C, K;
  cin >> N >> C >> K;
  vector<long long> T(N);
  for (int i = 0; i < N; i++)
    cin >> T[i];
  sort(T.begin(), T.end());

  long long cnt = 1;
  long long fEnd = T[0] + K;
  long long cap = 1;
  for (int i = 1; i < N; i++) {
    if (cap == C || T[i] > fEnd) {
      cnt++;
      cap = 1;
      fEnd = T[i] + K;
      continue;
    }
    cap++;
  }
  cout << cnt << endl;

  return 0;
}

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

int main()
{
    int c,cd,x;
    cin>>c>>cd>>x;
    if(c>x){
        cout<<"NO";
    }
    else if(c==x){
        cout<<"YES";
    }
    else if(c<x){
        if(c+cd>=x){
            cout<<"YES";
        }
        else{cout<<"NO";}
    }
    return 0;
}


Measured memory_bytes: 256
// AUTHOR - SANDEEP PRADHAN
#pragma GCC optimize("O3")
#define _CRT_SECURE_NO_WARNINGS
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>
#include <memory.h>
#include <assert.h>
#include<limits.h>


#define eps 1e-8
#define PI 3.141592653589793
#define bsize 512

#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<vector<int>>
#define pb push_back
#define bs 1000000007
const int INF = 1e9 + 5;

using namespace std;


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


	int n;
    scanf("%d", &n);
    vector<int> h(n);
    for(int i=0; i<n; i++) 
        scanf("%d", &h[i]);

    vector<int> dp(n, INF);
    dp[0] = 0;
    for(int i=0; i<n; ++i) 
    {
        for(int j : {i + 1, i + 2}) 
        {
            if(j < n)
                dp[j] = min(dp[j], dp[i] + abs(h[i] - h[j]));
        }
    }
    printf("%d\n", dp[n-1]);

	return 0;
}


Measured memory_bytes: 1024
n,q = map(int,input().split())
ki = [[]for _ in range(n)]
P = [0]*n
visited = [0] * n
for i in range(n-1):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    
    ki[a].append(b)
    ki[b].append(a)
for i in range(q):
    p,x = map(int,input().split())
    p -= 1
    P[p] += x
stack = [0]
while stack:
    a = []
    for now in stack:
        visited[now] = 1
      
        for next in ki[now]:
            if visited[next]:continue
            P[next]+= P[now]
            a.append(next)
    stack = a
    
print(*P)
            
    


Measured memory_bytes: 107084
#include<cstdio>
#include<cstring>
#include<string>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<queue>
#include<map>
#include<ctime>

using namespace std;

template <typename T>

inline T read()
{
	T x=0,f=1;char c=getchar();
	while(!isdigit(c))
	{if(c=='-') f=-f;c=getchar();}
	while(isdigit(c))
	{x=(x<<3)+(x<<1)+(c-48);c=getchar();}
	return x*f;
}

#define lint long long int
#define ulint unsigned lint
#define readint read<int>()
#define readlint read<lint>()

const int inf=1e9+1e7;
const int Mod=1e9+7;
const int MAXN=4e3+1e1;
const int MAXM=2e5+1e1;
const int Tp=4e3;

lint dp[MAXN][MAXN],fac[MAXN<<1],inv[MAXN<<1],a[MAXM],b[MAXM];

lint ans=0;
int n;

lint Qpow(lint A,int B)
{

	lint res=1;

	while(B>0)
	{
		if(B&1) (res*=A)%=Mod;
		(A*=A)%=Mod,B>>=1;
	}

	return res;

}

lint C(int A,int B)
{

	if(A<B || A<0 || B<0) return 0;
	else return fac[A]*inv[B]%Mod*inv[A-B]%Mod;

}

int main(void)
{

	//freopen("testdata.in","r",stdin);
	//freopen("testdata.out","w",stdout);

	fac[0]=inv[0]=1;

	for(int i=1;i<=Tp*2;i++) fac[i]=fac[i-1]*i%Mod;

	inv[Tp*2]=Qpow(fac[Tp*2],Mod-2);

	for(int i=Tp*2;i;i--) inv[i-1]=inv[i]*i%Mod;

	scanf("%d",&n);

	for(int i=1;i<=n;i++) a[i]=readint,b[i]=readint;

	for(int i=1;i<=n;i++) ++dp[Tp/2-a[i]+1][Tp/2-b[i]+1];

	for(int i=1;i<=Tp+1;i++) for(int j=1;j<=Tp+1;j++)
	{
		(dp[i][j]+=(dp[i-1][j]+dp[i][j-1])%Mod)%=Mod;
	}

	for(int i=1;i<=n;i++) (ans+=C((a[i]+b[i])<<1,a[i]<<1))%=Mod;

	ans=(Mod-ans)%Mod;

	for(int i=1;i<=n;i++) (ans+=dp[Tp/2+a[i]+1][Tp/2+b[i]+1])%=Mod;

	printf("%lld\n",ans*inv[2]%Mod);

	return 0;
	
}

Measured memory_bytes: 132284