akhauriyash/Code-Regression huggingface dataset:
#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 fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

const ll INF = ll(1e9);
ll dist[101][101];
bool ex[1001];
ll we[1001];
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n,m; cin>>n>>m;
	for(int i = 1; i <= n; i++)
	{
		for(int j = 1; j <= n; j++)
		{
			dist[i][j]=INF;
			if(i==j) dist[i][j]=0;
		}
	}
	vector<ii> vec;
	for(int i = 0; i < m; i++)
	{
		int u, v; cin>>u>>v;
		int w; cin>>w;
		vec.pb(mp(u,v));
		we[i]=w;
		dist[u][v]=dist[v][u]=w;
	}
	for(int k = 1; k <= n; k++)
	{
		for(int i = 1; i <= n; i++)
		{
			for(int j = 1; j <= n; j++)
			{
				dist[i][j]=min(dist[i][j],dist[i][k]+dist[k][j]);
			}
		}
	}
	
	for(int i = 0; i < vec.size(); i++)
	{
		int u = vec[i].fi; int v = vec[i].se;
		int w = we[i];
		/*
		for(int j = 1; j <= n; j++)
		{
			for(int k = j + 1; k <= n; k++)
			{
				if((dist[j][u]+dist[v][k]+w==dist[j][k])||(dist[j][v]+dist[u][k]+w==dist[j][k]))
				{
					ex[i]=1;
				}
			}
		}
		*/
		if(w==dist[u][v]) ex[i]=1;
	}
	int ans = 0;
	for(int i = 0; i < m; i++)
	{
		if(!ex[i]) ans++;
	}
	cout<<ans<<'\n';
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main()
{
    #ifdef TarekHasan
        freopen("input.txt","r",stdin);
    #endif // TarekHasan
    string str; cin >> str;
    long long int sum = 0;
    for(char c : str)
    {
        sum+=(c-'0');
    }
    sum%9 ? cout << "No\n" : cout << "Yes\n";
    return 0;
}


Measured memory_bytes: 3728
#include <stdio.h>
#include <memory.h>
typedef struct{
	int team;
	int time;
}data;
data c[1000000];
int main(void){
	int n,m,s,i,j;
	while(scanf("%d",&n),n){
		memset(c,0,sizeof(c));
		for(i=0;i<n;i++){
			scanf("%d",&c[i].team);
			for(j=0;j<4;j++){
				scanf("%d %d",&m,&s);
				c[i].time+=m*60+s;
			}
		}
		for(i=0;i<n-1;i++){
			for(j=n-1;j>i;j--){
				if(c[j-1].time>c[j].time){
					data t=c[j-1];
					c[j-1]=c[j];
					c[j]=t;
				}
			}
		}
		printf("%d\n",c[0].team);
		printf("%d\n",c[1].team);
		printf("%d\n",c[n-2].team);
	}
	return 0;
}

Measured memory_bytes: 8420
import sys
import numpy as np
def main():
    input = sys.stdin.readline
    N = int(input())
    Bs = list(map(int, input().split()))
 
    A = np.zeros(N)
    for i in range(N-1):
        b_c = Bs[i]
        if i == 0:
            A[i] = b_c
            A[i+1] = b_c
        elif i == N-2:  # 最終
            A[i+1] = b_c
        elif i != N-2:  # 最終以外
            b_n = Bs[i+1]
            if b_c < b_n:
                if A[i] < b_c:
                    pass
                else:
                    A[i] = b_c
                A[i+1] = b_c
            elif b_c >= b_n:
                #A[i] = b_c
                if Bs[i - 1] > b_c:
                    A[i] = b_c
                else:
                    pass
                A[i + 1] = b_n
    #print(A)
    ans = np.int64(np.sum(A))
    print(ans)
if __name__ == '__main__':
    main()

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

int main(){
    int N;
    string A,B;
    cin>>N;
    vector<string>vec(N);
    for(int i=0;i<N;i++){
        cin>>vec[i];
        A=vec[i];
        if(i>=1){
            if(B[B.size()-1]!=A[0]){
                cout<<"No"<<endl;
                return 0;
            }       
        }
        B=vec[i];
    }
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            if(vec[i]==vec[j]&&i!=j){
                cout<<"No"<<endl;
                return 0;
            }
        }
    }
    cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define len(v) ll(v.size())
#define fi first
#define se second

template <class T>
void cout_vec(const vector<T> &vec){
  for(auto itr:vec) cout<<itr<<' ';
  cout<<'\n';
}

typedef pair<ll,ll> P;
const ll mod=1e9+7;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    vector<int> l(2*n);
    rep(i,2*n) cin>>l[i];
    sort(begin(l),end(l),greater<int>());
    int ans=0;
    //cout_vec(l);
    rep(i,2*n){
      if(i%2==1) ans+=l[i];
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
// #pragma comment(linker, "/stack:200000000")
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,mmx,avx,tune=native")
// #define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
const double PI = acos(-1.0);
const double EPS = (1e-9);
typedef long long ll;
typedef unsigned long long ull;
#define flush fflush(stdout), cout.flush()
#define all(v) ((v).begin()),((v).end())
#define rall(v) ((v).rbegin()),((v).rend())
#define clr(v,line) memset(v,line,sizeof(v))
#define rep(i,n) for(int(i)=0;(i)<(int)(n);(i)++)
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define RT(x) return cout<<x, 0;
//#define lcm(a,b) (a*(b/__gcd(a,b)))
#define P 1000000007
#define endl '\n'
// const int dx[] = {1,-1,0,0,1,-1,1,-1};
// const int dy[] = {0,0,1,-1,1,-1,-1,1};
// const int dxhorse[] = {-2,-2,-1,-1,1,1,2,2};
// const int dyhorse[] = {1,-1,2,-2,2,-2,1,-1};
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 <<endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* coma = strchr(names + 1, ',');cerr.write(names, coma - names) << " : " << arg1<<" | ";__f(coma+1, args...);
}
#else
#define trace(...)
#endif
 
void file() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
void fast()
{
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL); cout.tie(NULL);
}
std::mt19937 rng((int) std::chrono::steady_clock::now().time_since_epoch().count());



int main(int argc, char const *argv[])
{
    // file();
    fast();
    cout<<fixed<<setprecision(10);
    int n; cin>>n;
    std::vector<double> v(n + 5);
    rep(i, n)cin>>v[i + 1];
    std::vector<double> dp(n + 5, 0.0);
    dp[0] = 1;
    // dp(i) --> the probability of getting i faces
    for (int i = 1; i <= n; ++i)
    {
        for (int j = i; j >= 0; --j)
        {
            dp[j] *=(1.0 - v[i]);
            if(j)
            dp[j] += dp[j - 1] * v[i]; 
        }
    }
    double ans=0.0;
        
    int lim=(n+1)/2;
        
    for (int i = lim; i < n + 1; ++i)
    {
        ans+=dp[i];
    }
    cout<<ans;
}

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

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

using namespace std;
const long long INF = 1LL << 61;
const long long MOD = 1000000000 + 7;

long long modPow(int n, int num) {
	if (num == 0) return 1;
	long long res = modPow(n, num / 2);
	if (num % 2 == 0) res = (res * res) % MOD;
	else res = (((res * res) % MOD) * n) % MOD;
	return res;
}

void modNck(int n, int k, vector<long long> & nums) {
	long long res = 1;
	nums.push_back(res);
	for (int i = 0; i < k; i++) {
		res = (res * ((long long)n - i) % MOD * modPow(i + 1, MOD - 2)) % MOD;
		nums.push_back(res);
	}
}

int main() {
	int N, K; cin >> N >> K;
	vector<long long> nums;
	vector<long long> nums2;
	modNck(N - K + 1, K, nums);
	modNck(K - 1, K - 1, nums2);
	rep(i, K) {
		if (i == 0)cout << nums[i + 1] << endl;
		else cout << (nums[i + 1] * nums2[i]) % MOD << endl;
	}
}

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

int main() {
     ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll n;
    cin>>n;
    ll arr[n][3];
    ll dp[n][3];
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<3;j++)
         cin>>arr[i][j];
    }
    dp[0][0]=arr[0][0];
    dp[0][1]=arr[0][1];
    dp[0][2]=arr[0][2];
    
    for(int i=1;i<n;i++)
    {
        for(int j=0;j<3;j++)
        {  dp[i][j]=INT_MIN;
            for(int k=0;k<3;k++)
            {
                if(j!=k)
                {
                    dp[i][j]=max(dp[i-1][k]+arr[i][j],dp[i][j]);
                }
            }
        }
    }
    cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));
    
}

Measured memory_bytes: 4992
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <utility>
#include <functional>
#include <deque>
#include <cctype>
#include <stack>
#include <bitset>
#include <set>

using namespace std;
using ll = long long;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, pair<ll, ll>> PP;

const ll MOD = 1e9 + 7;
const ll INF = 1 << 30;
const ll INF2 = 9e18;
const double INF3 = 9e14;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
const int tx[8] = { -1,0,1,-1,1,-1,0,1 }, ty[8] = { -1,-1,-1,0,0,1,1,1 };
#define ALL(x) (x).begin(),(x).end()
#define pb push_back
#define fr first
#define sc second



int main() {
	int a[5], ans = 0;
	cin >> a[0] >> a[1] >> a[2];
	sort(a, a + 3);
	if (a[1] == a[2]) {
		if ((a[1] - a[0]) % 2 == 1) {
			ans = (a[1] - a[0] + 1) / 2 + 1;
		}
		else ans = (a[1] - a[0] + 1) / 2;
	}
	else {
		ans += a[2] - a[1];
		a[1] = a[2];
		a[0] += ans;
		//cout << a[0] << ' ' << a[1] << ' ' << a[2] << endl;
		if ((a[1] - a[0]) % 2 == 1) {
			ans += (a[1] - a[0] + 1) / 2 + 1;
		}
		else ans += (a[1] - a[0] + 1) / 2;
	}
	cout << ans << endl;
	return 0;
}


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

using E = System.Linq.Enumerable;

public class Program
{
    public static void Main()
    {
        var s = Console.ReadLine();
        var t = Console.ReadLine();
        
        var n = s.Length;
        var ss = s + s;
        int i = 0, j = 0;
        while (true)
        {
            while (i < n && ss[i++] != t[j]);
            if (i > n)
            {
                break;
            }

            while (j < n && ss[i - 1 + j] == t[j])
            {
                j++;
            }
            if (j == n)
            {
                Console.WriteLine("Yes");
                return;
            }

            i++;
            j = 0;
        }
        Console.WriteLine("No");
    }
}

Measured memory_bytes: 11092
#include<iostream>
#include<cstdio>
using namespace std;
#define Latte 10007

int main(){
    char input;
    int N,dp[1100][8]={},ans=0;
    cin>>N;
    dp[0][1]=1;
    for(int i=0;i<N;i++){
        cin>>input;
        if(input=='J') input=0;
        else if(input=='O') input=1;
        else input=2;
        for(int j=0;j<8;j++){
            if(dp[i][j]==0) continue;
            for(int k=0;k<8;k++){
                if(j&k && k&(1<<input)){
                    dp[i+1][k]+=dp[i][j]%Latte;
                }
            }
        }
    }
    for(int i=0;i<8;i++){
        ans+=dp[N][i]%Latte;
    }
    printf("%d\n",ans%Latte);
    return 0;
}

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

typedef long long ll;

using namespace std;

#define swap(a, b)    do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while(0)
#define repd(i, a, b) for(typeof(b) i = a; i < (b); ++i)
#define rep(i, n)     repd(i, 0, n)
#define dump(x)       cerr << #x << " = " << (x) << endl
#define debug(x)      cerr << "L" << __LINE__ << ": " << #x << " = " << (x) << endl
#define YesNo(x) cout << ((x) ? "Yes" : "No") << endl
#define YESNO(x) cout << ((x) ? "YES" : "NO") << endl

int main(int argc, const char* argv[]) {
	ll n;
	cin >> n;

	ll c[n], v[n];
	rep(i, n) {
		cin >> v[i];
	}
	rep(i, n) {
		cin >> c[i];
	}

	ll ret = 0;
	rep(i, n) {
		if(v[i] > c[i]) ret += v[i] - c[i];
	}

	cout << ret << endl;

	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#define _USE_MATH_DEFINES
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef complex<double> xy_t;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
ll inf = llmax / 2;
double eps = 1e-11;

ll frsum[200000];
ll bksum[200000];

int main() {
    int N;
    cin >> N;
    int a[3 * N];
    for (int i = 0; i < 3 * N; i++) {
        cin >> a[i];
    }
    priority_queue<int, vector<int>, greater<int> > frque;
    priority_queue<int> bkque;
    ll fs = 0;
    ll bs = 0;
    for (int i = 0; i < N; i++) {
        frque.push(a[i]);
        bkque.push(a[3 * N - 1 - i]);
        fs += a[i];
        bs += a[3 * N - 1 - i];
    }
    frsum[0] = fs;
    bksum[N] = bs;
    for (int i = 0; i < N; i++) {
        ll frmin = frque.top();
        if (frmin < a[N + i]) {
            frque.pop();
            fs -= frmin;
            frque.push(a[N + i]);
            fs += a[N + i];
        }
        frsum[i + 1] = fs;
        ll bkmax = bkque.top();
        if (bkmax > a[2 * N - 1 - i]) {
            bkque.pop();
            bs -= bkmax;
            bkque.push(a[2 * N - 1 - i]);
            bs += a[2 * N - 1 - i];
        }
        bksum[N - 1 - i] = bs;
    }
    ll ans = llmin;
    for (int i = 0; i <= N; i++) {
        if (ans < frsum[i] - bksum[i]) {
            ans = frsum[i] - bksum[i];
        }
    }
  ll b = 1;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      for (int k = 0; k < 30; k++) {
        b++;
      }
    }
  }
    cout << ans << endl;
}


Measured memory_bytes: 3956
#include <cstdio>
#include <cctype>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>

#define debug(...) fprintf(stderr, __VA_ARGS__)

#ifndef AT_HOME
#define getchar() IO::myGetchar()
#define putchar(x) IO::myPutchar(x)
#endif

namespace IO {
	static const int IN_BUF = 1 << 23, OUT_BUF = 1 << 23;

	inline char myGetchar() {
		static char buf[IN_BUF], *ps = buf, *pt = buf;
		if (ps == pt) {
			ps = buf, pt = buf + fread(buf, 1, IN_BUF, stdin);
		}
		return ps == pt ? EOF : *ps++;
	}

	template<typename T>
	inline bool read(T &x) {
		bool op = 0;
		char ch = getchar();
		x = 0;
		for (; !isdigit(ch) && ch != EOF; ch = getchar()) {
			op ^= (ch == '-');
		}
		if (ch == EOF) {
			return false;
		}
		for (; isdigit(ch); ch = getchar()) {
			x = x * 10 + (ch ^ '0');
		}
		if (op) {
			x = -x;
		}
		return true;
	}

	inline int readStr(char *s) {
		int n = 0;
		char ch = getchar();
		for (; isspace(ch) && ch != EOF; ch = getchar())
			;
		for (; !isspace(ch) && ch != EOF; ch = getchar()) {
			s[n++] = ch;
		}
		s[n] = '\0';
		return n;
	}

	inline void myPutchar(char x) {
		static char pbuf[OUT_BUF], *pp = pbuf;
		struct _flusher {
			~_flusher() {
				fwrite(pbuf, 1, pp - pbuf, stdout);
			}
		};
		static _flusher outputFlusher;
		if (pp == pbuf + OUT_BUF) {
			fwrite(pbuf, 1, OUT_BUF, stdout);
			pp = pbuf;
		}
		*pp++ = x;
	}

	template<typename T>
	inline void print_(T x) {
		if (x == 0) {
			putchar('0');
			return;
		}
		std::vector<int> num;
		if (x < 0) {
			putchar('-');
			x = -x;
		}
		for (; x; x /= 10) {
			num.push_back(x % 10);
		}
		while (!num.empty()) {
			putchar(num.back() ^ '0');
			num.pop_back();
		}
	}

	template<typename T>
	inline void print(T x, char ch = '\n') {
		print_(x);
		putchar(ch);
	}

	inline void printStr_(const char *s, int n = -1) {
		if (n == -1) {
			n = strlen(s);
		}
		for (int i = 0; i < n; ++i) {
			putchar(s[i]);
		}
	}

	inline void printStr(const char *s, int n = -1, char ch = '\n') {
		printStr_(s, n);
		putchar(ch);
	}
}
using namespace IO;

const int N = 200005;

int n, k, c, f[N], h[N], g[N];
char s[N];

int main() {
	read(n), read(k), read(c), ++c;
	readStr(s + 1);
	f[0] = 0, h[0] = 0;
	for (int i = 1; i <= n; ++i)
		if (s[i] == 'o' && i >= f[i - 1]) {
			f[i] = i + c;
			h[i] = h[i - 1] + 1;
		} else {
			f[i] = f[i - 1];
			h[i] = h[i - 1];
		}
	g[n + 1] = 0;
	for (int i = n; i; --i) {
		if (s[i] == 'x') {
			g[i] = g[i + 1];
		} else {
			g[i] = g[std::min(i + c, n + 1)] + 1;
		}
	}
	for (int i = 1; i <= n; ++i) {
		int t = std::min(n + 1, f[i - 1]);
		t = std::max(t, i + 1);
		if (s[i] == 'o' && h[i - 1] + g[t] < k) {
			print(i);
		}
	}
}


Measured memory_bytes: 7680
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n-1); i >= 0; i--)
#define all(v) (v).begin(),(v).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a/gcd(a,b)*b; }
typedef pair<int, int> P;
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const ll MOD = 1e9+7;

int main() {
    int MAXN = 200000;
    int n;
	cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    vector<ll> cnt(MAXN);
    rep(i,n) cnt[a[i]-1]++;
    ll ans = 0;
    rep(i,MAXN) {
        if (cnt[i] >= 2) {
            ans += (ll)cnt[i]*(cnt[i]-1)/2;
        }
    }
    rep(i,n) {
        cout << ans - (cnt[a[i]-1]-1) << endl;
    }
	return 0;
}


Measured memory_bytes: 4992
#include <iostream>
#include <string>
#include <algorithm>
#include <climits>

using namespace std;

int abs(int a) {return (a < 0) ? -a : a;}

int main(){
    int N, X; cin >> N >> X; int x[N];
    for (int i = 0; i < N  ; i++) cin >> x[i];
    sort(x, x+N); int g, D = 0;
    for (int i = 0; i < N-1; i++) g =        __gcd(g, x[i+1]-x[i]  );
    for (int i = 0; i < N  ; i++) D = max(D, __gcd(g, abs (X-x[i])));
    cout << D << endl;
    return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<limits>
#include<iomanip>
#include<cmath>
#include<climits>
using namespace std;

#define rp(i,n) for(int i=0;i<n;i++)
#define rep(i,m,n) for(int i=m;i<=n;i++)
#define llrp(i,n) for(long long i=0;i<n;i++)
#define llrep(i,m,n) for(long long i=m;i<=n;i++)
#define sort(a) sort(a.begin(),a.end())
#define reverse(a) reverse(a.begin(),a.end())
#define pb push_back
#define elif else if
#define vcin(a); rp(i,a.size()){cin>>a[i];}
#define vcout(a); rp(i,a.size()){cout<<a[i]<<endl;}
#define allchar(c) for(char c='a';c<='z';c++)

typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef long long ll;
typedef string S;
typedef pair<int,int> P;
typedef queue<int> qi;

const int mod=1e9+7;

ll modpow(ll a,ll b,ll p){
    if(b==0){
        return 1;
    }elif(b%2==0){
        return modpow((a*a)%p,b/2,p);
    }else{
        return (a*modpow(a,b-1,p))%p;
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m;
    cin >> n >> m;
    cout << n+m/2 << endl;
    return 0;
}


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

#define MIN_INT -2147483648
#define MAX_INT 2147483647
#define MIN_LONG -9223372036854775808L
#define MAX_LONG 9223372036854775807L

#define long long long int

using namespace std;

// @author: pashka

#define MOD 998244353

long sum(long a, long b) { return (a + b) % MOD; }
long sub(long a, long b) { return (a - b + MOD) % MOD; }
long mult(long a, long b) { return (a * b) % MOD; }

long power(long a, long b) {
    long res = 1;
    while (b > 0) {
        if (b & 1) {
            res = mult(res, a);
        }
        a = mult(a, a);
        b >>= 1;
    }
    return res;
}

long inv(long a) {
    return power(a, MOD - 2);
}

vector<long> fact_precalc(1, 1);
vector<long> inv_fact_precalc(1, 1);

void ensure_fact(int n) {
    while (n >= (int)fact_precalc.size()) {
        fact_precalc.push_back(mult(fact_precalc.back(), fact_precalc.size()));
        inv_fact_precalc.push_back(inv(fact_precalc.back()));
    }
}

long fact(int n) {
    ensure_fact(n);
    return fact_precalc[n];
}

long inv_fact(int n) {
    ensure_fact(n);
    return inv_fact_precalc[n];
}

long calc_c(int n, int k) {
    if (n < 0 || k < 0 || k > n)
        return 0;
    long res = fact(n);
    res = mult(res, inv_fact(k));
    res = mult(res, inv_fact(n - k));
    return res;
}

int main() {
    ios::sync_with_stdio(false);

    long n, m;
    cin >> n >> m;

    long res = 0;
    for (int k = 0; k <= min(n, m); k++) {
        if ((3 * m - k) % 2 == 1) continue;
        long x = calc_c((3 * m - k) / 2 + n - 1, n - 1);
        x = sub(x, mult(calc_c((3 * m - k - (2 * m + 2)) / 2 + n - 1, n - 1), n - k));
        x = sub(x, mult(calc_c((3 * m - k - (2 * m)) / 2 + n - 1, n - 1), k));
        res = sum(res, mult(x, calc_c(n, k)));
    }
    cout << res << "\n";

    return 0;
}

Measured memory_bytes: 29132
#include <bits/stdc++.h>  // g++ -std=c++14 -o a a.cpp

using namespace std;

typedef pair<int, int> P;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end()) // ユニークなvectorにする。連続した値を除去して切り出す。
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

int main() {
  int N;
  cin >> N;
  ll power = 1;
  rep(i, N) {
    ll multi = i + 1;
    power = (power * multi) % MOD;
  }
  cout << power << endl;
}

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

#define int long long
typedef pair<int, int> P;

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

/*
#define cin ifs
#define cout ofs
ifstream ifs("in.txt");
ofstream ofs("out.txt");
//*/
int A, B, X;

signed main() {
    cin >> A >> B >> X;
    if (A <= X && A + B >= X) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define srep(i,s,t) for (int i = s; i < t; i++)
#define drep(i,n) for(int i = (n)-1; i >= 0; i--)
#define MOD 1e9+7;
using namespace std;
using Graph = vector<vector<int>>;
typedef vector<vector<char>> field_t;
typedef long long ll;
typedef pair<int, int> point_t;
vector<vector<pair<int,int>>> z(100010);
vector<vector<int>> a,b;
vector<bool> seen;

signed main()
{
    int N;
      cin >> N;
    if(N%2){
        cout << (N+1)/2<<endl;
    }else{
        cout << N/2 <<endl;
    }

    return 0;
}

Measured memory_bytes: 2560
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
class ABC95B
{
    public static void Main()
    {
        string[] input = Console.ReadLine().Split(' ');
        int N = int.Parse(input[0]);
        int X = int.Parse(input[1]);

        List<int> recips =new  List<int>();

        for (int i = 0; i < N; i++)
        {
            recips.Add(int.Parse(Console.ReadLine()));
        }
        int a = recips.Sum();
        recips.Sort();
    

        Console.WriteLine(N + (X - a )/recips[0]);
    }
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 2e5 + 10;
#define fi first
#define se second
#define pb push_back
int n,m,k;
vector<int>v[N],g[N];
int vis[N];
vector<int>res;
int tmp;
void dfs(int now){
  vis[now]=tmp;
  res.pb(now);
  for(auto k:v[now]){
    if(vis[k])
      continue;
    dfs(k);
  }
}
vector<int>G[N];
int ans[N];
int main() {
  ios::sync_with_stdio(false);
  cin>>n>>m>>k;
  for(int i=1;i<=m;i++){
    int s,t;
    cin>>s>>t;
    v[s].pb(t);
    v[t].pb(s);
    G[s].pb(t);
    G[t].pb(s);
  }
  for(int i=1;i<=k;i++){
    int s,t;
    cin>>s>>t;
    g[s].pb(t);
    g[t].pb(s);
    G[s].pb(t);
    G[t].pb(s);
  }
  for(int i=1;i<=n;i++){
    if(vis[i])continue;
    res.clear();
    ++tmp;
    dfs(i);
    int ct=res.size()-1;
    int cnt=ct;
    for(auto k:res){
      cnt=ct;
      for(auto x:G[k]){
        if(vis[x]==tmp){
          cnt--;
        }
      }
      ans[k]=cnt;
    }
  }
  for(int i=1;i<=n;i++)cout<<ans[i]<<' ';
  return 0;
}

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

int main() {
	int n; cin >> n;
	int t[100], ans = 0;
	for (int i = 0; i < n; i++) {
		int tmp; cin >> tmp;
		t[i] = tmp;
		ans += tmp;
	}

	int m; cin >> m;
	for (int i = 0; i < m; i++) {
		int p, x; cin >> p >> x;
		p--;
		cout << ans - t[p] + x << endl;
	}

	return 0;
}

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

int main(void)
{
	char b;
	cin>>b;
	if(b=='A')
	{
		cout<<"T"<<endl;
	}
	else if(b=='T')
	{
		cout<<"A"<<endl;
	}
	else if(b=='C')
	{
		cout<<"G"<<endl;
	}
	else if(b=='G')
	{
		cout<<"C"<<endl;
	}
}

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



int main() {
	ll N;
	cin >> N;
	
	ll tmp = 10000000000000;
	rep(1, sqrt(N)) {
		if (N % i == 0) {
			tmp = min(tmp, (N / i - 1) + (i - 1));
			
			
		}
	}
	cout << tmp << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int m,f,r;
    while(1){
        cin >> m >> f >> r;
        if (m == -1 & f == -1 & r == -1) break;
        if (m == -1 || f == -1) cout << "F" << endl;
        else if (m+f >= 80) cout << "A" << endl;
        else if (m+f >= 65) cout << "B" << endl;
        else if (m+f >= 50) cout << "C" << endl;
        else if (m+f >= 30 & r >= 50) cout << "C" << endl;
        else if (m+f >= 30) cout << "D" << endl;
        else cout << "F" << endl;
    }
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
 
#define INT_INF (2 * 1e9)
#define LL_INF  (2LL * 1e18)
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#ifdef __LOCAL
#define DBG(X) cout << #X << "=" << (X) << endl;
#else
#define DBG(X)
#endif
 
using namespace std;
 
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const ll mod = 1e9 + 7;

void solve()
{
	ll a, b, c;
	cin >> a >> b >> c;

	cout << min(c, a + b + 1) + b << endl;
}

int main(int argc, char** argv)
{
	FAST_IO;
	solve();

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
int32_t main()
{

    int n;
    cin >> n;
    map<int,int>mp;
    for(int i=0;i<n;i++)
    {
        int p;
        cin >> p;
        mp[p]++;
    }
    int count=0;
    vector<int>v;
    for(auto it:mp)
    {
        v.push_back(it.first);
    }
    sort(v.begin(),v.end());
    for(int i=0;i<v.size();i++)
    {
        for(int j=i+1;j<v.size();j++)
        {
            for(int k=j+1;k<v.size();k++)
            {
                int a=v[i];
                int b=v[j];
                int c=v[k];
               // cout<<a<<' '<<b<<' '<<c<<'\n';
                if(a+b>c)
                    count+=(mp[a]*mp[b]*mp[c]);
            }
        }
    }
    cout<<count<<'\n';
}

Measured memory_bytes: 3640
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <set>
#include <stdio.h>
#include <math.h>
#include <queue>
using namespace std;
typedef long long int lli;
const long long int MaxN=200005;
const lli mod=1e9+7;
#define fst first
#define snd second
#define mp make_pair
const float pi=3.1415926535897932384626433832795028;
	lli mcd(lli a,lli b){
		if(a==0)return b;
		return mcd(b%a,a);
	}
	int arr[MaxN];
	void solve(){
		int N,K,i,j,p,q,res=0;
		cin>>N>>K;
		for(i=0;i<N;i++)cin>>arr[i];
		sort(arr,arr+N);
		for(i=0;i<K;i++){
			res+=arr[i];
		}
		cout<<res<<"\n";
	}
int main(){
	//cin.tie(0),ios_base::sync_with_stdio(0);
	lli i,j,t;
	t=1;
	for(i=1;i<=t;i++){
		solve();
	}
	
}


Measured memory_bytes: 3184
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        ArrayList<Integer> list = new ArrayList<>();
        for (int i = 0; i < n; i++){
            list.add(sc.nextInt());
        }

        int max = 0;
        int max2 = 0;
        int pos = -1;

        for (int i = 0; i < n; i++){
            int temp = list.get(i);
            if (max < temp){
                max = temp;
                pos = i;
            }
        }

        for (int i = 0; i < n; i++){
            if (i == pos){
                continue;
            }
            int temp = list.get(i);
            if (max2 < temp){
                max2 = temp;
//                pos = i;
            }
        }

        for (int i = 0; i < n; i++){
            if (i != pos) {
                System.out.println(max);
            }else {
                System.out.println(max2);
            }
        }
    }
}


Measured memory_bytes: 95468
use std::io::*;
use std::str::FromStr;

fn main() {
    let a:i64 = read();
    let b:i64 = read();
    let x:i64 = read();

    println!("{}", f(b, x) - f(a - 1, x));
}

fn f(v:i64, x:i64) -> i64 {
    if v < 0 { return 0; }
    else { return v / x + 1; }
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}


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

using namespace std;
#define ll long long
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
const ll mod = 1e9 + 7;
typedef pair<int,int>           PI;
typedef pair<ll,ll>             PL;
typedef vector<PI>               vip; 
typedef vector<int>             vi;
typedef vector<vi>              vvi;
typedef vector<ll>              vl;
typedef vector<vl>              vvl;








int main (){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s,t;
    cin >> s >> t;
    bool there = false;
    string ans = "|";
    
    for(int i = 0 ; i + t.size() -1 <= s.size()-1; i++ ){
        int b = i+ t.size() - 1;
        bool found = true;
        for(int j = 0; j+i <= b; j++){
            if(s[j+i] != t[j] && s[j+i] != '?'){
                found = false;
                break;
            }
        }
        if(found){
            there = true;
            string u;
          	u = s;
            for(int j = 0; j < t.size(); j++){
                u[j+i] = t[j];
            }
            for(int j = 0; j < s.size(); j++){
                if(u[j] == '?') u[j] = 'a';
            }
            if(ans > u){
                ans = u;
            }
            
        }


    }

    if(there) cout << ans << endl;
    else cout << "UNRESTORABLE" << endl;








    return 0;
}

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

int main() {
    int n, k;
    cin >> n >> k;
    vector<ll> h(n);
    rep(i, n) cin >> h[i];
    sort(h.begin(), h.end());
    ll ans = 0;
    int lim;
    if (n < k) lim = 0;
    else lim = n-k;
    rep(i, lim) ans += h[i];
    cout << ans << endl;
}

Measured memory_bytes: 1792
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <sstream>
#include <string>
#include <cstdio>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cstring>
#include <tuple>
#include <utility>
#include <list>
#include <cmath>
#include <unordered_map>

using namespace std;

typedef long long LL;
typedef vector<int> Array;
typedef pair<int, int> P;

const int INF = 1 << 29;
const LL MOD = 100000;
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define all(c) (c).begin(), (c).end()

struct edge{ int to, cost; edge(int t, int c) :to(t), cost(c){} };

int main()
{
	//while (cin >> n)
	stringstream ss;
	//ss << "result" << i + 1 << ".txt";
	//FILE* fp_out = freopen(ss.str().c_str(), "w", stdout);

	int n;
	while (cin >> n && n)
	{
		int s; cin >> s;
		function<int(int, int, int)> dfs = [&](int now, int rem, int sum)
		{
			if (rem == 0 && sum == s) return 1;
			if (now == 10 || rem == 0 || sum > s) return 0;
			return dfs(now + 1, rem, sum) + dfs(now + 1, rem - 1, sum + now);
		};

		cout << dfs(0, n, 0) << endl;
	}

	return 0;
}

Measured memory_bytes: 1204
#include <iostream>
#include <sstream>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <utility>
#include <iomanip>
#include <numeric>
#include <climits>
#include <algorithm>
#include <cstdint>
using namespace std;

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

    int c = 1;
    while (c <= 3)
    {
        if ((a * b * c) % 2)
        {
            cout << "Yes";
            return 0;
        }
        c++;
    }
    cout << "No";
}

Measured memory_bytes: 3532
a, b, k = gets.chomp.split(' ').map(&:to_i)
  
def gcd(a, b)
  if (a > b)
    return gcd(a-b, b) 
  elsif (a < b)
    return gcd(a, b-a)
  else
    return a
  end
end

n = gcd(a, b)
j = 0

n.downto(1) do |i|
  if (n % i == 0)
    j+=1
  end
  if (j == k)
    puts i
    break
  end
end

Measured memory_bytes: 1788
import java.io.*
import java.util.*

fun solve(N: Int, K: Int){
    var ans = 1
    repeat(N){
        if(ans < K){
            ans*=2
        }else ans += K
    }
    println(ans)
    return
}


fun main(args: Array<String>) {
    fun StringArray(size: Int, init: (Int) -> String = { "\u0000" }): Array<String> {
        return Array<String>(size, init)
    }
    class Scanner(stream: InputStream) {
        private val reader = BufferedInputStream(stream).bufferedReader()
        private var st: StringTokenizer? = null
        fun next(): String {
            while (!(st?.hasMoreTokens() ?: false)) st = StringTokenizer(reader.readLine())
            return st!!.nextToken()
        }
    }
    val sc = Scanner(System.`in`)
    val N = sc.next().toInt()
    val K = sc.next().toInt()
    solve(N, K)
}



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

struct Node{
    int key;
    Node *next,*prev;
};

Node *nil;
Node* listSearch(int key){
    Node *cur=nil->next;
    while(cur!=nil&&cur->key!=key){
        cur=cur->next;
    }
    return cur;
}

void init(){
    nil=(Node *)malloc(sizeof(Node));
    nil->next=nil;
    nil->prev=nil;
}
void printList(){
    Node *cur=nil->next;
    int isf=0;
    while(1){
        if(cur==nil)break;
        if(isf++>0)printf(" ");
        printf("%d",cur->key);
        cur=cur->next;
    }
    printf("\n");
}

void deleteNode(Node *t){
    if(t==nil)return;
    t->prev->next=t->next;
    t->next->prev=t->prev;
    free(t);
}
void deleteFirst(){
    deleteNode(nil->next);
}
void deleteLast(){
    deleteNode(nil->prev);
}
void deleteKey(int key){
    deleteNode(listSearch(key));
}
void insert(int key){
    Node *x=(Node *)malloc(sizeof(Node));
    x->key=key;
    x->next=nil->next;
    nil->next->prev=x;
    nil->next=x;
    x->prev=nil;
}
int main(){
    int key,n,i;
    int size=0;
    char com[20];
    int np=0,nd=0;
    cin>>n;
    init();
    for(i=0;i<n;i++){
        cin>>com;
        if(com[0]=='i'){cin>>key;insert(key);np++;size++;}
        else if(com[0]=='d'){
            if(strlen(com)>6){
                if(com[6]=='F')deleteFirst();
                else if(com[6]=='L')deleteLast();
            }else{cin>>key;
                deleteKey(key);nd++;
            }
            size--;
        }
        
    }
    printList();
    return 0;
}


Measured memory_bytes: 34404
#define _USE_MATH_DEFINES
 
#include <bits/stdc++.h> 
 
#define len(x) (int)((x).size())
#define endl '\n'
#define x first
#define y second
#define int long long
#define double long double
#define all(a) (a).begin(), (a).end()
 
#ifdef LOCAL
	#define dbg(x) cout << #x << " = " << x << endl;
#else 
	#define dbg(x)
#endif 
 
using namespace std;
 
void solve(); signed main() {
#ifdef LOCAL
    freopen("file1.txt", "r", stdin);                                       
    freopen("file2.txt", "w", stderr);
#endif
    srand(time(0));
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout.setf(ios::fixed); cout.precision(10);
    solve();  	
}
 
const int MOD = 1e9 + 7, MAXN = 2000, INF = 1e18;
int n, m;
set<int> g[MAXN];
vector<pair<int, int>> edge;

void solve() {
    cin >> n >> m;
    for (int i = 0; i < m; ++i) {
        int u, v;
        cin >> u >> v;
        g[u].insert(v);
        edge.emplace_back(u, v);
    }

    int res = INF;
    vector<int> dt;
    for (auto it : edge) {
        int u = it.x, v = it.y; 
        g[u].erase(v);

        deque<int> q;
        q.push_back(v);
        vector<int> dist(MAXN, INF), pr(MAXN, -1);
        dist[v] = 0;
        while (!q.empty()) {
            int cur = q.front();
            q.pop_front();
            for (auto nxt : g[cur]) {
                if (dist[nxt] == INF) {
                    dist[nxt] = dist[cur] + 1;
                    pr[nxt] = cur;
                    q.push_back(nxt);
                }
            }
        }

        if (dist[u] != INF) {
            vector<int> ans;
            int cur = u;
            while (cur != v) {
                ans.push_back(cur);
                cur = pr[cur];
            }
            ans.push_back(cur);
            sort(all(ans));

            if (len(ans) < res) {
                res = len(ans);
                dt = ans;
            }
        }

        g[u].insert(v);
    }

    if (res == INF) {
        cout << -1 << endl;
    }
    else {
        cout << res << endl;
        for (auto it : dt) {
            cout << it << endl;
        }
    }
}

Measured memory_bytes: 512
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func swap(a int64, b int64) (int64, int64) {
	return b, a
}

func gcd(a int64, b int64) int64 {
	if b > a {
		a, b = swap(a, b)
	}
	if b == 0 {
		return a
	} else {
		return gcd(a%b, b)
	}
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func min(nums ...int64) int64 {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int64(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums ...int64) int64 {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int64(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func nextLong() int64 {
	sc.Scan()
	i, e := strconv.ParseInt(sc.Text(), 10, 64)
	if e != nil {
		panic(e)
	}
	return i
}

func nextString() string {
	sc.Scan()
	s := sc.Text()
	return s
}

func nextByte() byte {
	sc.Scan()
	s := sc.Bytes()
	return s[0]
}

func main() {
	sc.Split(bufio.ScanWords)
	//ans := 1
	N := nextInt()
	M := nextInt()
	K := nextInt()
	Blacknum := 0
	Clear := false
	for row := 0; row <= N; row++ {
		for col := 0; col <= M; col++ {
			Blacknum = (M-col)*row + (N-row)*col
			if Blacknum == K {
				Clear = true
			}
		}
	}
	if Clear {
		fmt.Printf("Yes\n")
	} else {
		fmt.Printf("No\n")
	}
}


Measured memory_bytes: 1772
#include<stdio.h>

int main(void){
int t,n,s,f,j;

while(scanf("%d",&t)&&t!=0){

scanf("%d",&n);
for(j=0;j<n;j++){
scanf("%d%d",&s,&f);
t=t-f+s;
}
if(t>0)
printf("%d\n",t);
else
printf("OK\n");
}

return 0;
}

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

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

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cerr << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cerr<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 500010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = (1 << 30) - 1;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
mt19937 rng; //use it by rng() % mod, shuffle(all(vec), rng)
///////////////////////////////////////////////////////////////////////////////////////////////////

int N, K;
deque<int> que;

void solve() {
	cin >> N >> K;
	rep(i, 0, N) {
		char c; cin >> c;
		que.push_back(c == 'A');
	}
	bool reversed = false;
	rep(i, 0, min(K, 6 * N)) {
		if((que.front() ^ reversed) == 1) que.front() ^= 1;
		else {
			que.pop_front();
			reversed ^= 1;
			que.push_back(reversed ^ 1);
		}
	}
	rep(i, 0, N) {
		que[i] ^= reversed;
	}

	if(K <= 6 * N) {
		rep(i, 0, N) {
			cout << (que[i] == 1 ? 'A' : 'B');
		}
	}
	else {
		if(N % 2 == 0) {
			rep(i, 0, N) {
				cout << (que[i] == 1 ? 'A' : 'B');
			}
		}
		else {
			rep(i, 0, N) {
				cout << ((que[i] ^ (i == 0 ? (K - 6 * N) % 2 : 0)) == 1 ? 'A' : 'B');
			}
		}
	}
	cout << "\n";
}

uint32_t rd() {
	uint32_t res;
#ifdef __MINGW32__
	asm volatile("rdrand %0" :"=a"(res) ::"cc");
#else
	res = std::random_device()();
#endif
	return res;
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
    cerr << fixed;
	cerr.precision(6);
	rng.seed(rd());
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
	if(!freopen("in.txt", "rt", stdin)) return 1;
#endif	
	solve();
    cerr << "Time: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}



Measured memory_bytes: 1280
#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 ll long long
#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 VREP(it, v) for (vector<int>::iterator it = v.begin(); it != v.end(); it++)
typedef pair<ll,ll> pi;
typedef vector<ll> vi;

template <typename T>
using pbds_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

template <typename K, typename V>
using pbds_map = tree<K, V, less<K>, rb_tree_tag, tree_order_statistics_node_update>;
int l, r, d;
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> l >> r >> d;
	if (l % d != 0){
		l += (d - (l%d));
	}
	if (l > r){
		cout << 0 << endl;
		return 0;
	}
	if (r % d != 0){
		r -= (r%d);
	}
	if (r < l){
		cout << 0 << endl;
		return 0;
	}
	cout << (r - l)/d + 1 << endl;
}

//cout.flush()

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

const int P = 1e9 + 7;

inline void upd(int &x, int y) { x = x + y - P; x += x >> 31 & P; }

inline int mpow(int a, int b) {
    int ans = 1;
    for (; b; b >>= 1, a = (ll) a * a % P)
        if (b & 1) ans = (ll) ans * a % P;
    return ans;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> fact(n + 1);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) {
        fact[i] = (ll) fact[i - 1] * i % P;
    }
    vector<int> p(n + 1);
    vector<vector<int>> g(n + 1);
    for (int i = 1; i <= n; ++i) {
        cin >> p[i];
        if (p[i] != -1) g[p[i]].push_back(i);
    }
    vector<bool> vis(n + 1);
    function<void(int, int, int&)> dfs = [&](int u, int f, int &sz) {
        ++sz;
        vis[u] = 1;
        for (auto v : g[u])
            if (!vis[v]) dfs(v, u, sz);
    };
    int re = 0;
    bool found;
    vector<bool> ins(n + 1);
    function<void(int)> dfsbrt = [&](int u) {
        vis[u] = 1;
        ins[u] = 1;
        for (auto v : g[u]) {
            if (!vis[v]) dfsbrt(v);
            else if (ins[v]) found = 1;
        }
        ins[u] = 0;
    };
    int cnt = 0;
    vector<int> sz(n + 1);
    for (int i = 1; i <= n; ++i) {
        if (!vis[i] && p[i] == -1) {
            dfs(i, 0, sz[++cnt]);
        }
    }
    for (int i = 1; i <= n; ++i) {
        int s = 0;
        if (!vis[i]) {
            found = 0; dfsbrt(i);
            re += found;
        }
    }
    vector<int> dp(cnt + 1, 0);
    dp[0] = 1;
    for (int i = 1; i <= cnt; ++i) {
        vector<int> new_dp(cnt + 1, 0);
        for (int j = 0; j <= cnt; ++j) {
            upd(new_dp[j], dp[j]);
            if (j + 1 <= cnt) upd(new_dp[j + 1], (ll) dp[j] * sz[i] % P);
        }
        swap(dp, new_dp);
    }
    // for (int i = 1; i <= cnt; ++i)
        // cerr << dp[i] << " ";
    // cerr << '\n';
    // cerr << re << '\n';
    int ans = (ll) mpow(n - 1, cnt) * n % P;
    upd(ans, P - (ll) re * mpow(n - 1, cnt) % P);
    for (int i = 1; i <= cnt; ++i) {
        int coeff = (ll) fact[i - 1] * mpow(n - 1, cnt - i) % P;
        int tmp = (ll) coeff * dp[i] % P;
        if (i == 1) upd(tmp, P - (ll) cnt * coeff % P);
        upd(ans, P - tmp);
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3900
//Robs Code
/***********HEADER***************/
#include <iostream>
#include <bitset>
#include <deque>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <string>
#include <algorithm>
#include <list>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <set>
#include <queue>
#include <map>
/***********MACROS***************/
#define int long long int
#define fri(l,k) for (i=l;i<=k;i++)
#define frj(l,k) for (j=l;j>=k;j--)
#define fij(a,b,l,k) for(i=a;i<=b;i++) for(j=l;j<=k;j++)
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define endl "\n"
#define pb push_back
#define _1 first
#define _2 second
#define pii pair<int,int>
using namespace std;
int n,m,i,j,l,k,x,y,a,b,cnt[3],sum[3];
/***********MAIN**************/
signed main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	int mat[3][3];
	fij(0,2,0,2){
		cin>>mat[i][j];
	}
	int a[3],b[3];
	for(a[0]=0;a[0]<=100;a[0]++){
		for(a[1]=0;a[1]<=100;a[1]++){
			for(a[2]=0;a[2]<=100;a[2]++){
				b[0] = mat[0][0] - a[0];
				b[1] = mat[1][1] - a[1];
				b[2] = mat[2][2] - a[2];
				bool flag = 0;
				for(int i=0;i<3;i++){
					for(int j=0;j<3;j++){
						if((b[i]+a[j]) != mat[i][j]){
							flag = 1;
							break;
						}
					}
					if(flag){
						break;
					}
				}
				if(!flag){
					cout<<"Yes";
					return 0;
				}
			}
		}
	}
	cout<<"No";
	return 0;
}
//.........

Measured memory_bytes: 768