akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>	
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ld long double
#define pii pair <int, int>
#define sz(a) (int)(a.size()) 
#define resize(v) v.resize(unique(all(v)) - v.begin()); 
#define all(a) a.begin(), a.end()
#define forit(it, s) for(__typeof(s.begin()) it = s.begin(); it != s.end(); it ++)

// random_device rd; mt19937 g(rd());    
                                        	
using namespace std;
using namespace __gnu_pbds;
 
void Fast_Read_Out()
{
    ios_base::sync_with_stdio(0);
    cin.tie(), cout.tie();
}
 
void Random()
{
    unsigned int seed;                                                                        
    asm("rdtsc" : "=A" (seed));
    srand(seed);        
}
 
unsigned int Time()
{
     unsigned int time = clock() / 1000.00;                           
     return time;
}

template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; 
 
const int mod = (int)1e9 + 7;
const int N = (int)1e5 + 123;
 
string s;
int k[N], d[N];
vector <int> ans;

int main ()
{
	#ifdef JUDGE
		freopen("input.txt", "r", stdin);
	#endif		
	Fast_Read_Out();
	Random();   
	int n, m;
	cin >> n >> m;
	cin >> s;
	int it = n - 1;
	int left = n;
	int cur = 0;
	while(it >= 0)
	{
		cur++;
		int nleft = left;
		while(it >= left - m && it >= 0)
		{
			if(s[it] == '0')
			{
				d[it] = cur;
				nleft = it;
				k[cur] = it;
			}
			it--;
		}
		if(left == nleft) 
		{
			cout << -1 << endl;
			exit(0);
		}
		left = nleft;
	}
	cur = d[0];
	while(cur)
	{
		ans.pb(abs(k[cur]));
		cur--;
	}
	ans.pb(n);
	for(int i = 0; i < sz(ans) - 1; i++) cout << ans[i + 1] - ans[i] << ' '; 
}                                

Measured memory_bytes: 1864
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author anand.oza
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        APrefixAndSuffix solver = new APrefixAndSuffix();
        solver.solve(1, in, out);
        out.close();
    }

    static class APrefixAndSuffix {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            String s = in.next(), t = in.next();

            for (int i = n; i >= 0; i--) {
                if (s.endsWith(t.substring(0, i))) {
                    out.println(2 * n - i);
                    return;
                }
            }
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 21204
#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 ld long double
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
template <typename T> using ord_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int N = 2e5 + 123, K = 33;
int n, dp[K], T;

struct Pair {
	int x, y;
	bool operator < (const Pair & p) const {
		return ((ll)x - 1) * p.y > ((ll)p.x - 1) * y;
	}
};
Pair p[N];

int main() {
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	
	cin >> n >> T;
	T++;
	for (int i = 0; i < n; i++) {
		cin >> p[i].x >> p[i].y;
		p[i].x++, p[i].y++;
	}
	sort(p, p + n);
	memset(& dp, 0x3f, sizeof(dp));
	dp[0] = 1;
	int pos = n;
	for (int i = 0; i < n; i++) {
		if (p[i].x == 1) {
			pos = i;
			break;
		}
		for (int j = K - 1; j >= 1; j--)
			dp[j] = min((ll)dp[j], (ll)dp[j - 1] * p[i].x + p[i].y);
	}
	vector <int> v;
	for (int i = pos; i < n; i++)
		v.pb(p[i].y);
	sort(all(v));
	int res = 0;
	for (int i = 0; i < K; i++) {
		if (dp[i] > T) continue;
		res = max(res, i);
		ll cur = 0;
		for (int j = 1; j <= SZ(v); j++) {
			cur += v[j - 1];
			if (dp[i] + cur <= T)
				res = max(res, i + j);
			else break;
		}
	}
	cout << res;
}


Measured memory_bytes: 5780
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#include <string.h>
#include <math.h>

int main (void)
{
    char S[7];

    gets(S);

    if (strcmp(S, "Sunny") == 0) puts("Cloudy");
    else if(strcmp(S, "Cloudy") == 0) puts("Rainy");
    else if (strcmp(S, "Rainy") == 0) puts("Sunny");

    return 0;
}


Measured memory_bytes: 128
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>

#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

#include <stdexcept>

using namespace std;

// type alias
using ll = long long;
using ull = unsigned long long;

//conversion
//------------------------------------------
inline int toint(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class t> inline string tostring(t x) { ostringstream sout; sout << x; return sout.str(); }

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl
#define DEBUG(x) cerr << #x << " = " << (x) << " (l" << __line__ << ")" << " " << __file__ << endl

inline ll floor(ll a, ull b)
{
	ll llb = b;
	if (a >= 0)
	{
		return a / llb;
	}
	else
	{
		return - ( (-a + llb - 1) / llb);
	}
}

inline ll ceil(ll a, ull b)
{
	ll llb = b;
	if (a >= 0)
	{
		return (a + llb - 1) / llb;
	}
	else
	{
		return - (-a / llb);
	}
}

inline ll get_lowest_one_bit(ll a)
{
	return a & (-a);
}

inline ll get_highest_one_bit(ll a)
{
	while ((a & (a - 1)) != 0)
	{
		a = a & (a - 1);
	}
	return a;
}

inline bool is_power2(ull a)
{
	if (a == 0)
	{
		return false;
	}
	return !(a & (a - 1));
}

inline ll get_specified_bit(ll a, unsigned bit)
{
	return (a & (1LL << bit)) >> bit;
}

// computational complexity: o(log(max(a, b))) 
inline ull get_gcd(ull a, ull b)
{
	if (b == 0)
	{
		return a;
	}
	return get_gcd(b, a % b);
}

template<class Integer>
inline Integer get_power(Integer base, ull exponential)
{
	Integer result = 1;
	while (exponential >= 1)
	{
		if (exponential & 1)
		{
			result = result * base;
		}
		base = base * base;
		exponential >>= 1;
	}

	return result;
}

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

	ll N;
	cin >> N;
	
	vector<ll> A_counts(N, 0LL);
	ll a;
	for (ll i = 0; i < N; ++i)
	{
		cin >> a;
		--a;
		++A_counts[a];
	}

	vector<ll> ds(N, 0LL);
	for (ll i = 0; i < N; ++i)
	{
		if (A_counts[i] > 0)
		{
			++ds[A_counts[i] - 1];
		}
	}

	ll sum_d = accumulate(ds.begin(), ds.end(), 0LL);
	ll accum_d = 0, accum_kd = 0;
	vector<ll> fs(N);
	for (ll i = 0; i < N; ++i)
	{
		accum_d += ds[i];
		accum_kd += (i + 1) * ds[i];

		fs[i] = (accum_kd + (i + 1) * (sum_d - accum_d)) / (i + 1);
	}

	vector<ll> res(N);
	for (ll i = 0; i < N; ++i)
	{
		auto iter = upper_bound(fs.begin(), fs.end(), i + 1, greater<ll>());
		auto dist = distance(fs.begin(), iter);
		cout << dist << endl;
	}

	return 0;
}


Measured memory_bytes: 10240
#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define put(a) cout<<a<<"\n"
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
#define SZ(x) ((ll)(x).size())
typedef long long ll;
typedef pair<int, int> P;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){if(a>b){a=b;return 1;}return 0;}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){if(a<b){a=b;return 1;}return 0;}

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    int s = 0;
    REP(i,n){
        cin >> a[i];
        s += a[i];
    }
    int ave = s/n;
    int res = INT_MAX;
    FOR(i,-1,2){
        int k = 0;
        int t = ave + i;
        REP(i,n){
            k += (a[i]-t)*(a[i]-t);
        }
        chmin(res,k);
    }
    
    put(res);
    return 0;
}


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

#define EPS (1e-10)
#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = b - 1; i >= (int)(a); --i)
#define all(a) a.begin(), a.end()

using namespace std;
using ll = long long;
using vi = vector<int>;
using vb = vector<bool>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
using vvb = vector<vb>;

constexpr int MOD = 1000000007;

ll _floor(ll a, ll b, ll x) { return floor((a * x) / b) - a * floor(x / b); }

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

    ll a, b, n;
    cin >> a >> b >> n;

    ll c = (n / b) * b - 1;
    ll ans = _floor(a, b, n);
    if (c > 0) { ans = max(ans, _floor(a, b, c)); }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3580
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define inf 1e18
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pb push_back
#define ff first
#define ss second
#define vll vector<ll>
#define pii pair<ll,ll>
#define sz(v) (v).size()
#define srt(v) sort(v.begin(),v.end())
#define ull unsigned long long
#define tell(a) cout<<a<<" "
#define el cout<<endl
#define rev(v) reverse(v.begin(),v.end())
#define rep(i,a,n) for(int i=a;i<n;i++)
ll power(ll x, ll y, ll p){ll res = 1;x = x % p;while (y > 0){   if (y & 1)res = (res*x) % p;y = y>>1;
x = (x*x) % p;}return res;}

int main()
{
	IOS;
	long double x;
	cin>>x;
	ll ans=100,i;
	for(i=0;ans<x;i++)
	{
		ans=ans+(ans*0.01);
	}
	cout<<i;
}



Measured memory_bytes: 3740
/**
*	created: 05.09.2020 23:11:48
**/
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using bint = boost::multiprecision::cpp_int;
using namespace std;
using ll = long long;
using P = pair<int,int>;
// #define endl '\n'
#define int long long
#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 rep2(i,s,n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pcnt(bit) __builtin_popcountll(bit)
const long double pi = acos(-1.0);
const int MAX = 1000010;
const int INF = 1ll << 60;
const int MOD = 1000000007;
// const int MOD = 998244353;
template<typename T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return 1;} return 0;}
template<typename T> bool chmin(T &a, const T &b) {if (b < a) {a = b; return 1;} return 0;}
template<typename T> T pow(T a, ll n) {T r(1); while(n) {if (n & 1) r *= a; a *= a; n >>= 1;} return r;}
struct faster_io {faster_io() {cin.tie(0); ios_base::sync_with_stdio(false);}} faster_io_;

// Segment Tree
// SegTree<X>(n,fx,ex): monoid(∈X, fx:binary operation, ex:identity element)
template <typename X> struct SegTree {
    using FX = function<X(X, X)>;
    int n; FX fx; const X ex; vector<X> dat;
    SegTree(int n_, FX fx_, X ex_) : n(), fx(fx_), ex(ex_), dat(n_*4, ex_) {
        int x = 1; while (n_ > x) {x *= 2;} n = x;
    }
    void set(int i, X x) {dat[i+n-1] = x;}
    void build() {rrep(k,n-1) {dat[k] = fx(dat[2*k+1], dat[2*k+2]);}}
    void update(int i, X x) {
        i += n - 1; dat[i] += x;
        while(i) {i = (i-1)/2; dat[i] = fx(dat[i*2+1], dat[i*2+2]);}
    }
    // query(a,b): apply fx to [a,b), Ο(log(n))
    X query(int a, int b) {return query_sub(a, b, 0, 0, n);}
    private:
    X query_sub(int a, int b, int k, int l, int r) {
        if (r <= a || b <= l) return ex;
        else if (a <= l && r <= b) return dat[k];
        else {
            X vl = query_sub(a, b, k*2+1, l, (l+r)/2);
            X vr = query_sub(a, b, k*2+2, (l+r)/2, r);
            return fx(vl, vr);
        }
    }
};

signed main() {
    int n, q; cin >> n >> q;
    auto fx = [](int x1, int x2) -> int {return x1+x2;};
    int ex = 0;
    SegTree<int> seg(n, fx, ex);
    rep(i,n) {
        int a; cin >> a;
        seg.update(i,a);
    }
    rep(i,q) {
        int t, a, b; cin >> t >> a >> b;
        if(t) cout << seg.query(a,b) << endl;
        else seg.update(a,b);
    }
    return 0;
}

Measured memory_bytes: 19984
#include<stdio.h>

#define NUMBER 4

int main(void){

  int a[NUMBER],b[NUMBER];
  int a_number[10],b_number[10];
  int hit,blow;
  int i;

  while(scanf("%d",&a[0]) != EOF){
    hit = blow = 0;
    
    for(i=0;i<10;i++){
      a_number[i] = b_number[i] = 0;
    }

    a_number[a[0]]++;

    for(i=1;i<NUMBER;i++){
      scanf("%d",&a[i]);
      a_number[a[i]]++;
    }

    for(i=0;i<NUMBER;i++){
      scanf("%d",&b[i]);
      b_number[b[i]]++;
    }

    for(i=0;i<NUMBER;i++){
      if(a[i] == b[i])
	hit++;
    }

    for(i=0;i<10;i++){
      blow += (a_number[i] < b_number[i]) ? a_number[i] :b_number[i];
    }

    blow -= hit;

    printf("%d %d\n",hit,blow);
  }
  return 0;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<int,int>
#define I vector<int>
#define S set<int>
#define pb(v) push_back(v)
#define V vector
#define rt return
#define rmsame(a) sort(ALL(a)),a.erase(unique(ALL(a)), a.end())
class Edge{
public:
    int from,to,value;
    Edge(int a,int b,int c){
        from = a;
        to = b;
        value = c;
    }
    Edge(int a,int b){
        from = a;
        to = b;
    }
};
int main(){
    string s;cin >> s;
    if(s.size()<4){
        cout<<"No"<<endl;
        return 0;
    }
    Yes(s.substr(0,4)=="YAKI");
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(long long i=0; i<n; i++)
#define Rep(i,n) for(long long i=1; i<n; i++)
#define ll long long
#include <math.h>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <set>
#include <vector>


using namespace std;
#define PI acos(-1)
using P =pair<ll,ll>;

ll ketasu(ll a){
   ll num=1;
   while(a/10){
       num++;
       a/=10;
   }
   return num;
}

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

ll kosuu(ll a){
    ll sum=0;
    for(ll i=1;i*i<=a;i++){
        if(a%i==0){
            if(a!=1&&i*i!=a){
            sum+=2;
            }else{
             sum++;   
            }
        }
    }
    return sum;
}

ll n;



    vector<pair<ll,ll>>p;
void fs(ll a){
    for(ll i=2;i*i<=n;i++){
        ll cnt=0;
        while(n%i==0){
            n/=i;
            cnt++;
        }
        p.emplace_back(i,cnt);
    }
    return;
}


ll di[]={1,0,-1,0};
ll dj[]={0,-1,0,1};
int main(){
   int n;
   cin>>n;
    long long int a[n],ans=0,i;
    int mod=1000000007;
    long long int sum=0;
 
    for( i = 0 ; i < n ; i++ ){
            cin>>a[i];
        sum = sum + a[i];
    }
    for( i = 0 ; i < n ; i++ ){
        sum = sum - a[i];
        if(sum<0)sum+=mod;
 
        ans+=(sum%mod * a[i]%mod)%mod;
        ans%=mod;
    }
    cout<<ans%mod;
 
    return 0;
}
 




Measured memory_bytes: 5080
n, a, b = [int(i) for i in input().split()]
p = 10**9+7


def comb(a, b):
    c = 1
    for i in range(b):
        c *= a - i
        c %= p
    d = 1
    for i in range(b):
        d *= i + 1
        d %= p
    return c*pow(d, p-2, p)


ans = pow(2, n, p) - 1 - comb(n, a) - comb(n, b)
print(ans % p)


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

int main(){
  int n, a, b;
  cin >> n;
  a = 0;
  b = 0;
  while (n >= 1000){
    a = a + 1;
    n = n - 1000;
  }
  n = n - 100 * a;
  if (n >=10  && n <= 99) {
    n = n - 10 * a;
    if (n >=0  && n <= 9) {
      b = 1;
    }
  }
  else {
    n = n + 100 * a;
    a = 0;
    while (n >= 100){
      a = a + 1;
      n = n - 100;
    }
    n = n - 10 * a;
    if (n >= 0  && n <= 9) {
      n = n - 1 * a;
      if (n == 0) {
        b = 1;
      }
    }
  }
  if (b == 1){
  cout << "Yes";
  }
  else{
  cout << "No";
  }
}

Measured memory_bytes: 3640
N=int(input())
S=input()

def rot(s):
    alpha2num = lambda c: ord(c) - ord('A')
    num=alpha2num(s)
    return chr((num+N)%26+65)

l=[]
for i in range(len(S)):
    l.append(rot(S[i]))
print(''.join(l))

Measured memory_bytes: 40176
#include <bits/stdc++.h>
#define pb push_back
template <typename T> inline T abs(const T &x) { return x < 0 ? -x : x; }
typedef long long ll;
inline int gcd(int x, int y)
{
	while (y) {
		int r = x % y;
		x = y;
		y = r;
	}
	return x;
}
char a[100005], b[100005];
std::map<ll, char> app;
int main()
{
	int n, m;
	scanf("%d%d%s%s", &n, &m, a, b);
	ll len = (ll)n / gcd(n, m) * m;
	for (int i = 0; i < n; i++)
		app[len / n * i] = a[i];
	for (int i = 0; i < m; i++) {
		if (app.count(len / m * i) && app[len / m * i] != b[i]) {
			puts("-1");
			return 0;
		}
	}
	printf("%lld\n", len);
	return 0;
}


Measured memory_bytes: 6144
#include <bits/stdc++.h>
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
typedef vector<pii> vp;
typedef vector<tiii> vt;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; scanf("%d",&x); return x;}
//cout << fixed << setprecision(10);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main () {
  vi x(5);
  rep(i,5) cin >> x[i];

  vector<int> v;
  rep(i,5) v.push_back(i);
  
  int ans = INF;
  do {
    int t = 0;
    rep(i,5) {
      t += x[v[i]];
      if (i == 4) ans = min(ans, t);
      else t = dup(t,10)*10;
    }
  } while (next_permutation(v.begin(), v.end()));

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

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

int S[10000][1261]={};

int main()
{
  int N,M,r,q,t,n,m,s,ts,te,time;

  while(1){
    cin>>N>>M;
    if(N==0 && M==0)break;
    for(int i=0;i<M;i++){
      for(int j=0;j<=1261;j++)S[i][j]=0;
    }
    cin>>r;
    for(int i=0;i<r;i++){
      cin>>t>>n>>m>>s;
      if(s==1)S[m-1][t]++;
      else S[m-1][t]--;
    }
    for(int i=0;i<M;i++){
      for(int j=1;j<=1261;j++){
        S[i][j]+=S[i][j-1];
      }
    }
    cin>>q;
    for(int i=0;i<q;i++){
      cin>>ts>>te>>m;
      time=0;
      for(int j=ts;j<te;j++){
	if(S[m-1][j]>0)time++;
      }
      cout<<time<<endl;
    }
  }
  return 0;
}

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

int main(){

int x;
int y;

cin >> x;
cin >> y;

if (x<y){
cout << "a" << " < " << "b" << endl;
}
else if(x>y){
cout << "a" << " > " << "b" << endl;
}
else {
cout << "a" <<  " == " << "b" << endl;

}
return 0;

}



Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rREP(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string s;
    cin >> s;
    int keta = s.size();
    int dp[keta][13];
    rep(i, keta) rep(j, 13) dp[i][j] = 0;
    rep(i, keta) {
        if (i == 0) {
            if (s[i] != '?') {
                dp[i][s[i]-'0'] = 1;
            }
            else
            {
                rep(j, 10) dp[i][j] = 1;
            }
        }
        else if (s[i] != '?') {
            rep(j, 13)
            {
                dp[i][(j*10+(s[i]-'0'))%13] += dp[i-1][j];
                dp[i][(j*10+(s[i]-'0'))%13] %= MOD; 
            }
        }
        else
        {
            rep(j,13)
            {
                rep(k, 10)
                {
                    dp[i][(j*10+k)%13] += dp[i-1][j];
                    dp[i][(j*10+k)%13] %= MOD; 
                }
            }
        }
    }
    cout << dp[keta-1][5] << endl;
}


Measured memory_bytes: 5584
#include <stdio.h>
 
void main(){
    int N,A[80];
    long long G =1000,a = 0;
    scanf("%d",&N);
    for(int i = 0;i < N;i++){
        scanf("%d",A+i);
    }
    for(int i = 0;i < N-1;i++){
        if(A[i] < A[i+1]){
            a = G/A[i];
            G = G%A[i];
            G = G + a*A[i+1];
            a = 0;
        }
    }
    printf("%ld\n",G);
}

Measured memory_bytes: 1724
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main()
{
	int A, B, tmp;
	cin >> A >> B;
	vector<int> v(5);
	int cnt = 0;
	FOR(i, A, B + 1){
		tmp = i;
		REP(j, 5){
			v[j] = tmp % 10;
			tmp /=10;
		}
		if(v[0] == v[4] && v[1] == v[3])
			cnt++;
	}
	cout << cnt << endl;
}

Measured memory_bytes: 256
a, b, m = gets.split.map(&:to_i)
an = gets.split.map(&:to_i)
bn = gets.split.map(&:to_i)

ab_min = an.min + bn.min

c_min = Array.new(m) { x, y, c = gets.split.map(&:to_i); an[x-1] + bn[y-1] - c }.min

puts [ab_min, c_min].min


Measured memory_bytes: 18844
//#pragma GCC optimize(2)
//#pragma GCC optimize(3)
//#pragma GCC optimize(4)
//#pragma GCC optimize("unroll-loops")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
//#include <bits/extc++.h>
#define fi first
#define se second
#define db double
#define mp make_pair
#define pb push_back
#define mt make_tuple
//#define pi acos(-1.0)
#define ll long long
#define vi vector<int>
#define mod 998244353
#define ld long double
//#define C 0.5772156649
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#define pll pair<ll,ll>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define pii pair<int,int>
#define ull unsigned long long
#define bpc __builtin_popcount
#define base 1000000000000000000ll
#define fin freopen("a.txt","r",stdin)
#define fout freopen("a.txt","w",stdout)
#define fio ios::sync_with_stdio(false);cin.tie(0)
#define mr mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
inline ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
inline void sub(ll &a,ll b){a-=b;if(a<0)a+=mod;}
inline void add(ll &a,ll b){a+=b;if(a>=mod)a-=mod;}
template<typename T>inline T const& MAX(T const &a,T const &b){return a>b?a:b;}
template<typename T>inline T const& MIN(T const &a,T const &b){return a<b?a:b;}
inline ll mul(ll a,ll b,ll c){return (a*b-(ll)((ld)a*b/c)*c+c)%c;}
inline ll qp(ll a,ll b){ll ans=1;while(b){if(b&1)ans=ans*a%mod;a=a*a%mod,b>>=1;}return ans;}
inline ll qp(ll a,ll b,ll c){ll ans=1;while(b){if(b&1)ans=mul(ans,a,c);a=mul(a,a,c),b>>=1;}return ans;}

using namespace std;
//using namespace __gnu_pbds;

const ld pi = acos(-1);
const ull ba=233;
const db eps=1e-5;
const ll INF=0x3f3f3f3f3f3f3f3f;
const int N=200000+10,maxn=2000000+10,inf=0x3f3f3f3f;

priority_queue<pii>q;
int a[N],b[N];
int main()
{
    int n;scanf("%d",&n);
    ll sum=0;
    for(int i=0;i<n;i++)scanf("%d",&a[i]);
    for(int i=0;i<n;i++)scanf("%d",&b[i]),q.push(mp(b[i],i));
    while(!q.empty())
    {
        int x=q.top().se;q.pop();
        if(b[x]<a[x])return 0*puts("-1");
        else if(b[x]>a[x])
        {
            int te=b[(x-1+n)%n]+b[(x+1)%n];
            if(b[x]-a[x]<te)return 0*puts("-1");
            sum+=(b[x]-a[x])/te;
            b[x]-=(b[x]-a[x])/te*te;
            q.push(mp(b[x],x));
        }
    }
    printf("%lld\n",sum);
    return 0;
}
/********************

********************/


Measured memory_bytes: 3700
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B;
  cin >> A >> B;
  int result = 0;
  if (A >= 13) {
    result = B;
  }
  else if (A >= 6) {
    result = B / 2;
  }
  
  cout << result << endl;
    
  return 0;
}

Measured memory_bytes: 3604
//
//  main.cpp
//

#include <algorithm>
#include <array>
#include <assert.h>
#include <iostream>
#include <limits>
#include <math.h>
#include <memory>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = long long;
using ull = unsigned long long;

int main() {
    int N, D;
    cin >> N >> D;
    cout << N / (2 * D + 1) + (N % (2 * D + 1) != 0) << endl;
}



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

public class Main {

	private static Scanner sc = new Scanner(System.in);

		class circle{
			int x;
			int y;
			int r;
			int c;
	  			
	  			circle(Scanner sc){
	  				this.x=sc.nextInt();
	  				this.y=sc.nextInt();
	  				this.r=sc.nextInt();
	  				this.c=sc.nextInt();
	  		}
	  			
	  			Boolean isCoveredBy(circle another){
	  					return Math.sqrt((this.x-another.x)*(this.x-another.x)+(this.y-another.y)*(this.y-another.y))<this.r+another.r;
	  					  				
	  			}
	  	
	  
  }

		private void cal() throws IOException{
			
			for(;;){	
				int n=sc.nextInt();
				if(n==0)
					break;
				
				circle[] circles=new circle[n];
				int[] coverbit=new int[n];
				
				for(int i=0;i<n;i++){
					circles[i]=new circle(sc);
					
					for(int j=i-1;j>=0;j--)
					    if(circles[i].isCoveredBy(circles[j]))
						coverbit[i]|=(1<<j);
						
					    
				}
				
				int Max=0;
				boolean PossibleBit[]=new boolean[1<<n];
				PossibleBit[0]=true;
				
				for(int i=0;i<(1<<n);i++){
					
					if(!PossibleBit[i])
						continue;
				
					Max=Math.max(Integer.bitCount(i),Max);
					for(int first=0;first<n;first++){
					    if((~i & coverbit[first])!=0 || (i&1<<first)!=0)
						continue;
						for(int second=first+1;second<n;second++){
							if((~i & coverbit[second])!=0 || (i&1<<second)!=0)
								continue;
							if(circles[first].c!=circles[second].c)
								continue;
							
							PossibleBit[i|(1<<first)|(1<<second)]=true;
						}
					
					}
						


					
				}
				
						System.out.println(Integer.toString(Max));
				
			}
		}

	public static void main ( String [] args ) throws IOException{
    	
	  new Main().cal();
    }
	
    
}

Measured memory_bytes: 28000
import java.util.*;

public class Main {
    static Scanner scanner = new Scanner(System.in);

    public static void main(String[]$) {
        int[] s = scanner.next().chars().map(c -> c - '0').toArray();
        int ans1 = 0, ans2 = 0;
        for (int i = 0; i < s.length; i++) {
            if (s[i] == i % 2) {
                ans1++;
            } else {
                ans2++;
            }
        }
        System.out.println(Math.min(ans1, ans2));
    }
}

Measured memory_bytes: 28880
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef long long ll;
int P[200000];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    int N;
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> P[i];
    }
    int m = N+1;
    int ans = 0;
    for(int i = 0; i < N; i++){
        if(m >= P[i]) ans++;
        m = min(m, P[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>


using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD (ll)1000000007
#define P pair<ll, ll>

ll ans = INF;
int main() {
	ll n;
	cin >> n;
	for (int i = 1; i <= sqrt(n); i++) {
		if (n % i == 0)ans = min(ans, i + n / i - 2);
	}
	cout << ans <<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int W,H,x,y,r;
	scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
	if(x<0 || y<0 || x-r<0 || y-r<0 || x+r>W || y+r>H){
		printf("No\n");
	}
	else{
		printf("Yes\n");
	}
	return 0;
}


Measured memory_bytes: 2108
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
using namespace std;

int main(){
  string s;

  while(getline(cin,s)){
   
    for(int i=0;i<s.length();i++){
   if(s[i] == '@'){


     for(int k=0;k<s[i+1]-'0';k++){
	  cout << s[i+2];
	}
     
	i+=2;
      }
      else{
	cout << s[i];
      }

    }
    cout << endl;

  }
  

  return 0;
}

Measured memory_bytes: 0
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef pair<int, int> pii;
#define erep(i, x, n) for (auto i = x; i<=(ll)(n); i++)
#define rep(i, x, n) for(auto i = x; i<(ll)(n); i++)
#define all(v) ((v).begin()), ((v).end())
#define sz(v) ((int)((v).size()))
#define mod(n, m) (((n%m) + m)%m)
#define reset(n, m) memset(n, m, sizeof n)
#define endl '\n'



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

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

	int cnt = 0;
	while(n)
	{
		cnt++;
		n /= k;
	}

	cout << cnt << endl;

	return 0;
}


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

#define maxsiz 1000000
#define F first
#define S second
#define fr(i,k,n) for(int i = k ; i < n ; i++ )
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define printvect(a,n) fr(i,0,n) cout << a[i] << " " ;
#define point pair<int,int>
#define pii pair<int,int>
#define pib pair<int,bool>
#define arr vector<int> 
#define vectin(a,n) fr(i,0,n) { cin >> a[i] ; }
typedef unsigned long long int ull;

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

	int count = 0 ;
	fr(i,0,n)
	{
		if(a[a[i]-1]==i+1)
			count++;
	}
	cout << count/2 << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
  int a,b,c; cin>>a>>b>>c;
  if((10*b+c)%4==0) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}

Measured memory_bytes: 256
def main():
    sa = input()
    sb = input()
    sc = input()
    person = "a"
    while len(sa if person == "a" else sb if person == "b" else sc) > 0:
        if person == "a":
            person = sa[0]
            sa = sa[1:]
        elif person == "b":
            person = sb[0]
            sb = sb[1:]
        else:
            person = sc[0]
            sc = sc[1:]
    print("A" if person == "a" else "B" if person == "b" else "C")


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w
using namespace std;

//#define int long long
//typedef    long long          ll;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      P;
 
const int INF=1e+9;
const double EPS=1e-9;
const int MOD=1000000007;
 
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

int a[4],op[3];
char o[5] = "+-";

void dfs(int i,int sum){
	if(i == 4){
		if(sum == 7){
			printf("%d%c%d%c%d%c%d=7\n",a[0],o[op[0]],a[1],o[op[1]],a[2],o[op[2]],a[3]);
			exit(0);
		}
		return;
	}
	op[i - 1] = 0;
	dfs(i + 1,sum + a[i]);
	op[i - 1] = 1;
	dfs(i + 1,sum - a[i]);
}

signed main(){
	string s;
	cin >> s;
	for(int i = 0;i < 4;i++) a[i] = s[i] - '0';
	dfs(1,a[0]);
	return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<P> p(n);
  ll time = 0;
  rep(i,n) {
    int a, b;
    cin >> a >> b;
    p[i]=make_pair(b,a);
  }
  sort(p.begin(),p.end());
  rep(i,n) {
    time+=p[i].second;
    if(p[i].first>=time) continue;
    else {
      cout << "No" << endl; 
      return 0;
    }
  }
  cout << "Yes" << endl;
}


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

using i32 = int_fast32_t;
using i64 = int_fast64_t;
using u32 = uint_fast32_t;
using u64 = uint_fast64_t;
using f64 = double;
using f80 = long double;

#define FOR(v, a, b) for(i64 v = (a); v < (b); ++v)
#define FORE(v, a, b) for(i64 v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(i64 v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define fst first
#define snd second
#define UNIQ(v) (v).erase(unique(ALL(v)), (v).end())
#define bit(i) (1LL<<(i))

#ifdef DEBUG
#include <Mylib/Debug/debug.cpp>
#else
#define dump(...) ((void)0)
#endif

using namespace std;

template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}
template <typename T> void puts_all(const T &value){std::cout << value << "\n";}
template <typename T, typename ...Args> void puts_all(const T &value, const Args&... args){std::cout << value << " ";puts_all(args...);}

template <typename T, typename U> bool chmin(T &a, const U &b){return (a>b ? a=b, true : false);}
template <typename T, typename U> bool chmax(T &a, const U &b){return (a<b ? a=b, true : false);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}
template <typename T> auto make_vector(int n, int m, const T &value){return vector<vector<T>>(n, vector<T>(m, value));}


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



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

    if(s == "AAA" or s == "BBB"){
      puts_all("No");
    }else{
      puts_all("Yes");
    }

    
  }


  return 0;
}


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

int main () {
	int N, K;
	cin >> N >> K;
	int sum=0, tmp;
	for (int i=0; i<N; i++) {
		cin >> tmp;
		if (tmp >= K)
			sum ++;
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
#-swank
(unless (member :child-sbcl *features*)
  (quit
   :unix-status
   (process-exit-code
    (run-program *runtime-pathname*
                 `("--control-stack-size" "128MB"
                   "--noinform" "--disable-ldb" "--lose-on-corruption" "--end-runtime-options"
                   "--eval" "(push :child-sbcl *features*)"
                   "--script" ,(namestring *load-pathname*))
                 :output t :error t :input t))))
(defmacro dp (name args memo-size &body body)
  (let ((memo (gensym)))
    `(let ((,memo (make-array ,memo-size :initial-element nil)))
       (defun ,name ,args
         (or (aref ,memo ,@args)
             (setf (aref ,memo ,@args)
                   ,@body))))))

(defun split (x str)
  (let ((pos (search x str))
        (size (length x)))
    (if pos
        (cons (subseq str 0 pos)
              (split x (subseq str (+ pos size))))
        (list str))))

(defmacro collect-times (time body)
  `(loop repeat ,time collect ,body))

(defun read-times (time)
  (collect-times time (read)))

(defmacro aif (expr then else)
  `(let ((it ,expr))
     (if it ,then ,else)))

(defmacro awhen (expr &rest then)
  `(aif ,expr (progn ,@then) nil))

(defun comulative (function list &key base)
  (if base
      (comulative function (cons base list))
      (do ((lst (cdr list) (cdr lst))
           (acc (list (car list))))
          ((null lst) (reverse acc))
        (push (funcall function (car acc) (car lst)) acc))))

(defun binary-search (function left right
                      &optional
                        (eps 1)
                        (average-function (lambda (x y) (ash (+ x y) -1))))
  (if (<= (abs (- left right)) eps)
      right
      (let ((mid (funcall average-function left right)))
        (if (funcall function mid)
            (binary-search function left mid eps average-function)
            (binary-search function mid right eps average-function)))))

(defun arithmetic-mean (&rest body)
  (/ (apply #'+ body) (length body)))

(defvar +MOD+ (+ (expt 10 9) 7))


(defun main (a b k)
  (* (- a b) (expt -1 k)))

(let ((a (read))
      (b (read))
      (c (read))
      (k (read)))
  (princ (main a b k)))


Measured memory_bytes: 11708
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, n) for (int i = 1; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;
int main()
{
    int n;
    cin >> n;
    vector<ll> t(n), x(n), y(n);
    rep(i, n) cin >> t[i] >> x[i] >> y[i];

    ll ct = 0, cx = 0, cy = 0;

    rep(i, n) {
        ll dt = t[i] - ct;
        ll dx = abs(x[i] - cx);
        ll dy = abs(y[i] - cy);

        if (dx + dy <= dt && (dt - dx - dy) % 2 == 0) {
            //ok            
        } 
        else {
            put("No");
            return 0;
        }
        cx = x[i];
        cy = y[i];
        ct = t[i];
    }

    put("Yes");

    

    return 0;
}

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

#define For(i, l, r) for (register int i = (l), i##end = (int)(r); i <= i##end; ++i)
#define Fordown(i, r, l) for (register int i = (r), i##end = (int)(l); i >= i##end; --i)
#define Rep(i, r) for (register int i = (0), i##end = (int)(r); i < i##end; ++i)
#define Set(a, v) memset(a, v, sizeof(a))
#define Cpy(a, b) memcpy(a, b, sizeof(a))
#define debug(x) cout << #x << ": " << (x) << endl

using namespace std;

template<typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, T b) { return b > a ? a = b, 1 : 0; }

inline int read() {
	int x(0), sgn(1); char ch(getchar());
	for (; !isdigit(ch); ch = getchar()) if (ch == '-') sgn = -1;
	for (; isdigit(ch); ch = getchar()) x = (x * 10) + (ch ^ 48);
	return x * sgn;
}

void File() {
#ifdef zjp_shadow
	freopen ("D.in", "r", stdin);
	freopen ("D.out", "w", stdout);
#endif
}

const int N = 2e5 + 1e3;

using ll = long long;

ll f[N][5], a[N], n;

int main () {

	File();

	n = read();

	For (i, 1, n) a[i] = read();

	Set(f, 0x3f);

	f[0][0] = 0;

	For (i, 1, n) {
		ll cur = f[i - 1][0];
		f[i][0] = cur + a[i];

		chkmin(cur, f[i - 1][1]);
		f[i][1] = cur + (a[i] & 1) + 2 * (a[i] == 0);

		chkmin(cur, f[i - 1][2]);
		f[i][2] = cur + !(a[i] & 1);

		chkmin(cur, f[i - 1][3]);
		f[i][3] = cur + (a[i] & 1) + 2 * (a[i] == 0);

		chkmin(cur, f[i - 1][4]);
		f[i][4] = cur + a[i];

////	debug(i);
////	Rep (j, 5)
////		cout << f[i][j] << endl;
////	puts("===========");
	}

	printf ("%lld\n", min({f[n][0], f[n][1], f[n][2], f[n][3], f[n][4]}));

    return 0;

}

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

int main(){
    int N,L;
    cin >> N >> L;
    int A,B;
    A = L;
    B = L + N -1;
    int ans;
    if (B<0) ans = B;
    else if(A>0) ans = A;
    else ans = 0;

    cout << N*(A+B)/2 - ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repn(i, n) for (int i = 0; i <= (int)(n); i++)
#define srep(i, l, n) for (int i = l; i < (int)(n); i++)
#define srepn(i, l, n) for (int i = l; i <= (int)(n); i++)
#define pb push_back 
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; }

const int MOD = 1000000007;
const ll INF = 1e12;
#define PI 3.14159265369;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


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

Measured memory_bytes: 256
import collections
import itertools
r,g,b,n=map(int,input().split())
x,y=n//r,n//g
x,y=list(range(0,r*x+1,r)),list(range(0,g*y+1,g))
l=[i+j for i,j in itertools.product(x,y) if i+j<=n]
z=collections.Counter(l)
count=0
for key,value in zip(z.keys(),z.values()):
  v=n-key
  if v==0:
    count+=value
  elif v%b==0:
    count+=value
print(count)

Measured memory_bytes: 183140
#include<iostream>
#include<vector>
typedef unsigned long long ull;
typedef signed long long sll;
using namespace std;

#define INF 0x7FFFFFFFFFFFFFFF

vector<sll> START,END;
vector<vector<int>> from,to;

void set_start(ull x)
{
  if(START[x]==-1)
  {
    START[x]=0;
    for(auto i:from[x])
    {
      set_start(i);
      START[x]=max(START[x],1+START[i]);
    }
  }
}
void set_end(ull x)
{
  if(END[x]==-1)
  {
    END[x]=0;
    for(auto i:to[x])
    {
      set_end(i);
      END[x]=max(END[x],1+END[i]);
    }
  }
}

int main()
{
  ull i,N,M,x,y,MAX=0;
  cin >> N >> M;
  //start[i],iから出発する最長パスの長さ
  START.resize(N,-1);
  //end[i],iで終了する最長パスの長さ
  END.resize(N,-1);
  from.resize(N);
  to.resize(N);
  for(i=0;i<M;++i)
  {
    cin >> x >> y;
    from[x-1].push_back(y-1);
    to[y-1].push_back(x-1);
  }
  for(i=0;i<N;++i)
  {
    set_start(i);
    set_end(i);
  }
  for(i=0;i<N;++i)
  {
    MAX = (ull)max((sll)MAX,START[i]+END[i]);
  }
  cout << MAX;
  return 0;
}

Measured memory_bytes: 17280
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>   
using namespace std;

int N,i, j, tmp;
long sum; 
 
int main()
{
  cin>>N;
    vector<int> ins;
for(int i = 0; i < N*2; i++) {
  int in; cin >> in;
  ins.push_back(in);
}
    for (i=0; i<N*2; ++i) {
      for (j=i+1; j<N*2; ++j) {
        if (ins[i] > ins[j]) {
          tmp =  ins[i];
          ins[i] = ins[j];
          ins[j] = tmp;
        }
      }
    }
    for (i=0;i<2*N; i++){
      if ( i%2 ==0){
      sum = sum + ins[i];
      }
    }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef       long long int      ll;
#define       READ               freopen("in.txt", "r", stdin);
#define       WRITE              freopen("out.txt", "w", stdout);
#define       optimize           ios::sync_with_stdio(0);cin.tie(0);
#define       RESET(a, b)        memset(a, b, sizeof(a))
#define       gcd(a, b)          __gcd(a, b)
#define       MX                 200005
bool cmp(long long int x,long long int y)
{
   return x>y;
}
int main(void)
{
   double x,y,f,n,d,ans=0;
   vector<long long int> v,v1,v2;
   vector< pair <long long int,long long int> >p,p1,p2;
   set<long long int> st;
   priority_queue<long long int> pq;
   priority_queue< long long int,vector<long long int>,greater<long long int> > lpq;
   priority_queue< pair<long long int,long long int>,vector< pair<long long int,long long int> >,greater< pair <long long int,long long int> > > plpq;
   string s;
   //cin>>t;
   //while(t--)
   //{
      cin>>n>>d;
      for(long long int i=0;i<n;i++)
      {
         cin>>x>>y;
         f=sqrt(x*x + y*y);
         //cout<<f<<endl;
         if(f<=d)
            ans++;
      }
      cout<<ans<<endl;
   //}
   return 0;
}


Measured memory_bytes: 3848
#include<iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<map>
#include<set>

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

using namespace std;
using ll = long long;

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

    set<int> st;
    st.insert(a);
    st.insert(b);
    st.insert(c);

    if (st.size() == 2) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256