akhauriyash/Code-Regression huggingface dataset:
#if __has_include("../library/Basic/Debug.hpp")

#include "../library/Basic/Debug.hpp"

#else

/* ----- Header Files ----- */
// IO
#include <cstdio>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm
#include <algorithm>
#include <cmath>
#include <numeric>

// container
#include <vector>
#include <string>
#include <tuple>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>

// others
#include <random>
#include <limits>
#include <functional>
#include <ctime>
#include <cassert>
#include <cstdint>


/* ----- Type Alias ----- */
using Bool = bool;
using Int = long long int;
using Real = long double;
using Char = char;
using String = std::string;
template <class T, class U>
using Pair = std::pair<T, U>;
template <class... Ts>
using Tuple = std::tuple<Ts...>;

template <class T>
using Vector = std::vector<T>;
template <size_t N>
using Bits = std::bitset<N>;
template <class T>
using Queue = std::queue<T>;
template <class T>
using Stack = std::stack<T>;
template <class T>
using Deque = std::deque<T>;

template <class T>
using MaxHeap = std::priority_queue<T>;
template <class T>
using MinHeap = std::priority_queue<T, std::vector<T>, std::greater<T>>;
template <class T>
using Set = std::set<T>;
template <class T, class U>
using Map = std::map<T, U>;

template <class T, class... Us>
using Func = std::function<T(Us...)>;

template <class T>
T genv(T v) { return v; }

template <class T, class... Ts>
auto genv(size_t l, Ts... ts) {
    return Vector<decltype(genv<T>(ts...))>(l, genv<T>(ts...));
}

template <class Cost = Int>
struct Edge {
    Int src, dst;
    Cost cost;
    Edge(Int src = -1, Int dst = -1, Cost cost = 1)
        : src(src), dst(dst), cost(cost){};

    bool operator<(const Edge<Cost>& e) const { return this->cost < e.cost; }
    bool operator>(const Edge<Cost>& e) const { return this->cost > e.cost; }
};

template <class Cost = Int>
using Edges = Vector<Edge<Cost>>;
template <class Cost = Int>
using Graph = Vector<Vector<Edge<Cost>>>;

#endif

/* ----- Misc ----- */
void fastio() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
}

struct Fout {
    Int precision;
    Fout(Int precision) : precision(precision) {}
};
std::ostream& operator<<(std::ostream& os, const Fout& fio) {
    os << std::fixed << std::setprecision(fio.precision);
    return os;
}


/* ----- Constants ----- */
// constexpr Int INF = std::numeric_limits<Int>::max() / 3;
// constexpr Int MOD = 1000000007;
// constexpr Real PI = acos(-1);
// constexpr Real EPS = 1e-10;
// std::mt19937 mt(int(std::time(nullptr)));

int main() {
    Int r;
    std::cin >> r;
    std::cout << 3 * r * r << std::endl;
    return 0;
}


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

using namespace std;

int main()
{
	int a, b;
	cin >> a >> b;
	int c=0;
	if(a>0)
	{
		cout << "Positive";
		return 0;
	}
	if(a==0)
	{
		cout << "Zero";
		return 0;
	}
	if(a<0)
	{
		if(b>=0)
		{
			cout << "Zero";
			return 0;
		}
		if(b<0)
		{
			c=b-a+1;
		}
	}
	if(c%2==0)
	{
		cout << "Positive";
	}
	else
	{
		cout << "Negative";
	}
}


Measured memory_bytes: 256
def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

s = input()
lis = ["A", "T", "G", "C"]
cnt = 0
maxcnt = 0
for i in range(len(s)):
    if(my_index(lis, s[i], -1)>=0): 
        cnt += 1
        #print(my_index(lis, s[i]), s[i], my_index(lis, s[i])>=0)
    else:
        maxcnt = max(maxcnt, cnt)
        cnt = 0
maxcnt = max(maxcnt, cnt)
print(maxcnt)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define int long long
#define P(x) cout << x << endl
#define D(x) P(#x << ": " << x)
#define F(i,n) for(int i = 0; i < (int)(n); ++i)
#define DEC(i,n) for(int i = (int)(n); --i >= 0;)
#define S(s) (int)((s).size())
#define ALL(v) v.begin(), v.end()
#define V vector
#define pb push_back
#define mt make_tuple
using namespace std;

signed main() {
	int q,h,s,d,n; cin >> q >> h >> s >> d >> n;
	int p1 = min(4*q,min(2*h,s));
	int p2 = min(2*p1,d);

	int ans = p2*(n/2);
	if(n&1) ans += p1;
	P(ans);

}

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

class guid
{
    public:
    string S;
    int P;
    int num;
    void getdat(string &str,int poi,int n)
    {
        S=str;
        P=poi;
        num=n;
    }
    void putdat()
    {
        cout<<num<<endl;
    }
};
bool sorbystr (guid const & a, guid const & b)
{
    return a.S<b.S;
}
bool sorbyint (guid const & a, guid const & b)
{
    return a.P>b.P;
}

int main()
{
    int n,P;
    string str;
    cin>>n;
    guid rest[n];
    for(int i=0;i<n;i++)
    {
        cin>>str>>P;
        rest[i].getdat(str,P,i+1);
    }
    stable_sort(rest,rest+n,sorbyint);
    stable_sort(rest,rest+n,sorbystr);
    for(int i=0;i<n;i++)
    {
        rest[i].putdat();
    }
    // cout<<endl;
    // for(int i=0;i<n;i++)
    // {
    //     rest[i].putdat();
    // }
    // cout<<endl;
    // int j=0;
    // string a;
    // a=rest[j].S;
    // while(j<n-1)
    // {
    //     //cout<<j<<endl;
        
    //     if(a==rest[j].S)
    //     {
    //         // cout<<"worl"<<endl;
    //         int count=0,temp=j;
    //         while(a==rest[j].S&&j<n)
    //         {
    //             // cout<<"word "<<j<<" "<<a<<endl;
    //             count++;
                
    //             if(j==n-1)
    //             {
    //                 break;
    //             }
    //             j++;
    //         }
    //         cout<<count<<" "<<temp<<endl;
    //         stable_sort(rest+temp,rest+count,sorbyint);
    //     }
    //     else
    //     {
    //         a=rest[j].S;
    //         // cout<<a<<" "<<j<<endl;
    //     }
    //     // cout<<rest[5].S<<endl;
        
    //     //j++;
    //     //a=rest[j].S;
    // }
    
    return 0; 
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int [][]d = new int[n][6];
		for(int i = 0; i < n; i++) {
			for(int j = 0; j < 6; j++) {
				d[i][j] = scan.nextInt();
			}
		}
		scan.close();
		int [][][]D = new int[n][24][6];
		for(int i = 0; i < n; i++) {
			int[]d0 = {d[i][0], d[i][1], d[i][2], d[i][3], d[i][4], d[i][5]};
			int[]d1 = {d[i][1], d[i][5], d[i][2], d[i][3], d[i][0], d[i][4]};
			int[]d2 = {d[i][2], d[i][0], d[i][1], d[i][4], d[i][5], d[i][3]};
			int[]d3 = {d[i][3], d[i][0], d[i][4], d[i][1], d[i][5], d[i][2]};
			int[]d4 = {d[i][4], d[i][0], d[i][2], d[i][3], d[i][5], d[i][1]};
			int[]d5 = {d[i][5], d[i][1], d[i][3], d[i][2], d[i][4], d[i][0]};
			for(int j = 0; j < 6; j++) {
				D[i][0][j] = d0[j];
				D[i][4][j] = d1[j];
				D[i][8][j] = d2[j];
				D[i][12][j] = d3[j];
				D[i][16][j] = d4[j];
				D[i][20][j] = d5[j];
			}
			for(int j = 0; j < 3; j++) {
				int[]k0 = rot(D[i][0]);
				int[]k1 = rot(D[i][j + 4]);
				int[]k2 = rot(D[i][j + 8]);
				int[]k3 = rot(D[i][j + 12]);
				int[]k4 = rot(D[i][j + 16]);
				int[]k5 = rot(D[i][j + 20]);

				for(int k = 0; k < 6; k++) {
					D[i][j + 1][k] = k0[k];
					D[i][j + 5][k] = k1[k];
					D[i][j + 9][k] = k2[k];
					D[i][j + 13][k] = k3[k];
					D[i][j + 17][k] = k4[k];
					D[i][j + 21][k] = k5[k];
				}
			}
		}
		for(int i = 0; i < n - 1; i++) {
			for(int j = i + 1; j < n; j++) {
				for(int k = 0; k < 24; k++) {
					boolean flag = true;
					for(int l = 0; l < 6; l++) {
						if(d[i][l] != D[j][k][l]) {
							flag = false;
							break;
						}
					}
					if(flag) {
						System.out.println("No");
						System.exit(0);
					}
				}
			}
		}
		System.out.println("Yes");

	}
	static int[] rot(int[] d) {
		int []t = new int[6];
		int []d1 = new int[6];
		for(int j = 0; j < 6; j++) {
			t[j] = d[j];
			d1[j] = d[j];
		}
		d1[1] = t[3];
		d1[2] = t[1];
		d1[3] = t[4];
		d1[4] = t[2];
		return d1;
	}
	static void disp(int[] d) {
		for(int i : d) {
			System.out.print(i + " ");
		}
		System.out.println();
	}
}


Measured memory_bytes: 29444
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll=long long;
int main(){
    int n;
    cin>>n;
    vector<int>t(n),x(n),y(n);
    rep(i,n){
        cin>>t[i]>>x[i]>>y[i];
        if(t[i]<(x[i]+y[i])){
            cout<<"No"<<endl;
            return 0;
        }
        if(t[i]%2!=(x[i]+y[i])%2){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
}

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

int x[5];
int i;
  for(i=0;i<5;i++)
  {
    cin>>x[i];
  }

  for(i=0;i<5;i++)
  {
    if(x[i]==0)
    {
      cout<<i+1;
    }
  }
    cout<<endl;
  
  return 0;
}



Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#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++)

int main() {
  long long N,D;
  cin>>N>>D;
  long long X[N][D];
  rep(i,N){
    rep(j,D){
      cin>>X[i][j];               
    }
  }
  long long count=0;
  long long kyori=0;
  rep(i,N){
    rep2(j,i+1,N){
      kyori=0;
      rep(k,D){
        kyori+=abs(X[i][k]-X[j][k])*abs(X[i][k]-X[j][k]);
      }
      long long hantei=sqrt(kyori);
      if(hantei*hantei==kyori)count++;
    }
  }
  cout<<count<<endl;
  return 0;
}

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

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const double PI = 3.1415926535897932;

/* a と b の最大公約数を返す関数 */
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}


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

	ll ret = 0;
	for (int i = 0; i <= n; ++i)
	{
		if (i % 3 != 0 and i % 5 != 0)
		{
			ret += i;
		}
	}

	cout << ret << endl;
	return 0;
}

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

#define each(i, c) for (auto& i : c)
#define mkp(a, b) make_pair(a, b)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> Pll;
const ll MOD = 1e9+7;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << ": " << p.second << ")"; return os; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ", "; os << ")"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; each (i, m) os << i << ", "; os << "}"; return os; }

class modint {
  private:
    ll m_val;
    ll m_mod;
  public:
    constexpr modint() : m_val(0), m_mod() { m_mod = MOD; }
    constexpr modint(const ll x) : m_val(0), m_mod(0) { m_mod = MOD; m_val = x % m_mod; }
    constexpr modint(const ll x, const ll mod) : m_val(0), m_mod(0) { m_mod = mod; m_val = x % m_mod; }
    constexpr ll val() const { return m_val; }
    constexpr modint operator+(const modint &rhs) const { return modint(*this) += rhs; }
    constexpr modint operator-(const modint &rhs) const { return modint(*this) -= rhs; }
    constexpr modint operator*(const modint &rhs) const { return modint(*this) *= rhs; }
    constexpr modint operator/(const modint &rhs) const { return modint(*this) /= rhs; }
    constexpr modint &operator+=(const modint &rhs) {
      m_val += rhs.m_val;
      if (m_val >= m_mod) m_val -= m_mod;
      return *this;
    }
    constexpr modint &operator-=(const modint &rhs) {
      if (m_val < rhs.m_val) m_val += m_mod;
      m_val -= rhs.m_val;
      return *this;
    }
    constexpr modint &operator*=(const modint &rhs) {
      m_val = m_val * rhs.m_val % m_mod;
      return *this;
    }
    constexpr modint &operator/=(const modint &rhs) {
      *this *= rhs.pow(m_mod - 2);
      return *this;
    }
    constexpr modint pow(ll n) const {
      if (n == 0) return 1;
      modint o = pow(n >> 1);
      o *= o;
      if (n & 1) o *= *this;
      return o;
    }
    friend ostream& operator<<(ostream& os, const modint &a) { os << a.val(); return os; }
};

int main() {
  ll x, y;
  cin >> x >> y;

  ll xn = 0, yn = 0;
  if (x == y && x % 3 == 0) {
    xn = x/3;
    yn = y/3;
  } else if (x > y) {
    for (ll i = x/2; i >= 1; --i) {
      ll rx = x - i*2;
      ll ry = y - i;
      if (ry%2 == 0 && ry/2 == rx) {
        xn = i;
        yn = ry/2;
        break;
      }
    }
  } else if (x < y) {
    for (ll i = y/2; i >= 1; --i) {
      ll ry = y - i*2;
      ll rx = x - i;
      if (rx%2 == 0 && rx/2 == ry) {
        yn = i;
        xn = rx/2;
        break;
      }
    }
  }

  if (xn == 0 && yn == 0) {
    cout << 0 << endl;
    return 0;
  }

  modint a = 1;
  modint b = 1;
  modint c = 1;
  for (ll i = 1; i <= xn+yn; ++i) {
    a = a * i;
  }
  for (ll i = 1; i <= xn; ++i) {
    b = b * i;
  }
  for (ll i = 1; i <= yn; ++i) {
    c = c * i;
  }

  cout << a/(b*c) << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      	
      	int num = sc.nextInt();
      	int nums[] = new int[num];
      	int c[] = new int[4];
      	String str[] = {"AC","WA","TLE","RE"};
      	String stack;
      
      	for(int i = 0;i < 4;i++) c[i] = 0;
      
      	for(int i = 0;i < num;i++) {
          stack = sc.next();
          for(int j  = 0;j < 4;j++) {
          	if(str[j].equals(stack)) c[j]++; 
          }
       	}
      
      	for(int i = 0;i < 4;i++) System.out.println(str[i] +" x " +c[i]);
        
	}
}


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

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

   ll count = 0;
   rep (i, n+1) {
       if (i % 3 != 0 && i % 5 != 0) {
           count += i;
       }
   }

   cout << count << endl;
}

Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
#include <iomanip>
#include <unordered_map>
using namespace std;

using INT = long long;
using UINT = unsigned long long;

UINT gcd(UINT a, UINT b) {
	while (1) {
		if (a < b) swap(a, b);
		if (!b) break;
		a %= b;
	}
	return a;
}

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

const UINT mod = 1000000007;
const double pi = 3.141592653589793238462;
const INT intmax = 9223372036854775807;

UINT _PowMod(UINT x, UINT y, UINT _mod)
{
	if (y == 0)
	{
		return 1;
	}
	else if (y == 1)
	{
		return x % _mod;
	}
	else if (y % 2 == 0)
	{
		auto tmp = _PowMod(x, y / 2, _mod);
		return tmp * tmp % _mod;
	}
	else
	{
		auto tmp = _PowMod(x, y / 2, _mod);
		return (tmp * tmp % _mod) * x % _mod;
	}
}


UINT PowMod(UINT x, UINT y)
{
	return _PowMod(x, y, mod);
}

UINT getModInv(UINT N)
{
	return PowMod(N, mod - 2);
}

INT nCrMod(INT start, INT n, INT r)
{
	if (n < r)
	{
		return 0;
	}
	INT a = start;
	for (size_t i = n; i >= n - r + 1; i--)
	{
		a *= i;
		a %= mod;
	}
	for (size_t i = 1; i <= r; i++)
	{
		a *= getModInv(i);
		a %= mod;
	}
	return a;
}

INT nHrMod(INT start, INT n, INT r)
{
	return nCrMod(start, n + r - 1, r);
}

INT _nCrMod(INT start, INT n, INT r)
{
	if (n <= 0)
	{
		return 0;
	}
	return nCrMod(start, n, r);
}

struct uf
{
	vector<INT> p;

	uf(INT n) : p(n)
	{
		for (size_t i = 0; i < n; i++)
		{
			p[i] = i;
		}
	}

	INT rt(INT n)
	{
		return p[n] == n ? n : p[n] = rt(p[n]);
	}

	void un(INT n, INT m)
	{
		p[rt(n)] = p[rt(m)];
	}

	bool eq(INT n, INT m)
	{
		return rt(n) == rt(m);
	}
};

bool lineCol(INT a1x, INT a1y, INT a2x, INT a2y, INT b1x, INT b1y, INT b2x, INT b2y)
{
	auto ta = (b1x - b2x) * (a1y - b1y) + (b1y - b2y) * (b1x - a1x);
	auto tb = (b1x - b2x) * (a2y - b1y) + (b1y - b2y) * (b1x - a2x);
	auto tc = (a1x - a2x) * (b1y - a1y) + (a1y - a2y) * (a1x - b1x);
	auto td = (a1x - a2x) * (b2y - a1y) + (a1y - a2y) * (a1x - b2x);

	return tc * td < 0 && ta * tb < 0;
}

INT powInt(INT a, INT b)
{
	if (b == 0)
	{
		return 1;
	}
	if (b == 1)
	{
		return a;
	}
	INT tmp = powInt(a, b / 2);
	return (b % 2 == 1 ? a * tmp * tmp : tmp * tmp);
}

INT _sMod(string n, INT mod)
{
	INT k = (n[0] - '0') % mod;
	for (size_t i = 1; i < n.length(); i++)
	{
		k *= 10;
		k += (n[i] - '0');
		k %= mod;
	}
	return k;
}

#define forin(v, n)				\
for (size_t i = 0; i < n; i++)	\
{								\
	cin >> v[i];				\
}

#define vec(t, name, n)			vector<t> name(n)
#define vec_(t, name, n, init)	vector<t> name(n, init)

#define vec2(t, name, n, m)			vector<vector<t>> name(n, vector<t>(m))
#define vec2_(t, name, n, m, init)	vector<vector<t>> name(n, vector<t>(m, init))

struct xy
{
	INT x, y;
	xy() :x(0), y(0) {}
	xy(INT _x, INT _y) : x(_x), y(_y) {}
};

int main()
{
	INT n, k, x, y;
	cin >> n >> k >> x >> y;
	cout << min(n,k) * x + max(0LL, n - k) * y << endl;

	return 0;
}


Measured memory_bytes: 256
/** Author: Dwai
 *  Omae wa mou shindeiru!
**/

#include <bits/stdc++.h>
using namespace std;

#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second
#define all(a) (a).begin(),(a).end()
#define fr(i,a,b) for (i = a; i <= b; i++)
#define frr(i,a,b) for (i = a; i >= b; i--)
#define rep(i,n) for (i = 0 ; i < n; i++)
#define repr(i,n) for (i = n - 1; i >= 0; i--)
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
#define flushinput   cin.ignore(numeric_limits<streamsize>::max(),'\n');

void debug_out() { cerr << endl; }

void clock_out(){
  cerr<<"\nTime Elapsed : " << 1.0*clock() / CLOCKS_PER_SEC << " s\n";
}

void fileio(){
  freopen("/home/dwai/Desktop/cp/input.txt","r", stdin);
  freopen("/home/dwai/Desktop/cp/output.txt", "w", stdout);
  freopen("/home/dwai/Desktop/cp/debug.txt", "w", stderr);
}

void ofileio(){
  freopen("input.txt","r", stdin);
  freopen("output.txt", "w", stdout); 
}

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << H;
  debug_out(T...);
}

#ifndef ONLINE_JUDGE
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define fio() fileio()
#define ofio() fileio()
#define clock() clock_out()
#else
#define debug(...) 42
#define fio() 42
#define ofio() ofileio()
#define clock() 42
#endif

typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<pll> vll;
typedef map<ll,ll> mll;

int IT_MAX = 1 << 20;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;

void solve(){
	ll n;cin>>n;

	db dp[n+1][n+1];
	ll i,j;

	fr(i,0,n)
	{
		fr(j,0,n)
			dp[i][j]=0.00;
	}
	dp[0][0]=1;
	db p[n];
	rep(i,n) cin>>p[i];

	fr(i,1,n)
	{
		fr(j,0,n)
		{
			if(j==0)
				dp[i][j]=(dp[i-1][j])*(1-p[i-1]);
			else
			{
				dp[i][j]=dp[i-1][j-1]*p[i-1]+dp[i-1][j]*(1-p[i-1]);
			}
		}
	}
	ll x=n/2;
	x++;
	db ans=0;
	while(x<=n)
	{
		ans+=dp[n][x];
		x++;
	}

	cout<<setprecision(9)<<fixed<<ans;
}

int main(){
	//fio();
	fast

	solve();
	return 0;
}

Measured memory_bytes: 70656
N = int(input())
A = list(map(int, input().split()))

S = sum(A)
ans = []

# 山1
v = S
for i in range((N-1)//2):
    v -= 2 * A[(2*i+1) % N]
ans.append(v)

for i in range(1, N):
    ans.append(2*A[i-1] - ans[i-1])

print(" ".join(map(str, ans)))

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

typedef long long ll;
int a[10];

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	
	for(int i=1;i<=5;i++){
		cin>>a[i];
	}
	for(int i=1;i<=5;i++){
		if(a[i] == 0){
			cout<<i;
		}
	}
	
	return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
long long a[200005],res=0;
long long xr[200005],sum[200005];
int main()
{
	int n;
	scanf("%d",&n);
	for (int i=1; i<=n; i++) 
	{
		scanf("%lld",&a[i]);
		sum[i]=sum[i-1]+a[i];
		xr[i]=xr[i-1]^a[i];
	}
//	printf("%d %d\n",sum[0],xr[0]);
	int pt=1;
    for(int i=1;i<=n;i++)
    {
        while((sum[i]-sum[pt-1])!=(xr[i]^xr[pt-1])) pt++;
//        printf("%d %d\n",pt,i);
        res+=i-pt+1;
//		res++;
    }
	printf("%lld\n",res);
	return 0;
}
//a+b>=a^b

Measured memory_bytes: 4992
#include <iostream>
#include <vector>
#include <cstdio>

using namespace std;

int main(void) {
    int N, M;
    cin >> N >> M;

    vector<int> red(N), any(N, 1);
    red[0] = 1;
    int i;
    for (i=0; i<M; i++) {
        int x, y;
        scanf("%d %d", &x, &y);
        x--; y--;

        if (red[x]) {
            red[y]++;
        }
        any[x]--;
        any[y]++;
        if (!any[x]) {
            red[x] = 0;
        }
    }

    int num_possible_red=0;
    for (i=0; i<N; i++) {
        if (red[i] && any[i]) {
            num_possible_red++;
        }
    }

    cout << num_possible_red << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main(void){
    int n, k, x, y;

    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    cin >> k;
    cin >> x;
    cin >> y;
    cout << (n > k? k * x + (n - k) * y : n * x) << "\n";
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
int c1[26][4001],c2[26][4001];
int main() {
	string s, t; cin >> s >> t;
	int n1 = s.length(), n2 = t.length();
	rep(i, n1) {
		rep(j, 26) {
			if (s[i] == 'a' + j)c1[j][i+1] = c1[j][i] + 1;
			else c1[j][i+1] = c1[j][i];
		}
	}
	rep(i, n2) {
		rep(j, 26) {
			if (t[i] == 'a' + j)c2[j][i+1] = c2[j][i] + 1;
			else c2[j][i+1] = c2[j][i];
		}
	}
	int out = 0;
	rep1(i, min(n1, n2)) {
		map<vector<int>, bool> mp;
		rep(j, n2 - i + 1) {
			vector<int> v(26);
			rep(k, 26) {
				v[k] = c2[k][j + i] - c2[k][j];
			}
			mp[v] = 1;
		}
		rep(j, n1 - i + 1) {
			vector<int> v(26);
			rep(k, 26) {
				v[k] = c1[k][j + i] - c1[k][j];
			}
			if (mp[v]) {
				out = i; break;
			}
		}
	}
	cout << out << endl;
	return 0;
}


Measured memory_bytes: 5448
#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 Set(a, v) memset(a, v, sizeof(a))
using namespace std;

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

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

const int N = 2e5 + 1e3;
int n, a[N];

int main () {
	n = read();
	long long ans = 0;
	For (i, 1, n) {
		a[i] = read();
		if (i == 1 && a[1] != 0 || i > 1 && a[i] > a[i - 1] + 1) return puts ("-1"), 0;
	}
	Fordown (i, n, 1)
		ans += (a[i] + 1 == a[i + 1] ? 0 : a[i]);
	printf ("%lld\n", ans);
    return 0;
}


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

#define MOD 1000000007

int Extgcd(int a, int b, int &x, int &y) {
	int g = a;
	if (b != 0) {
		g = Extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	} else {
		x = 1;
		y = 0;
	}
	return g;
}

int ModInverse(int a, int m) {
	int x, y;
	Extgcd(a, m, x, y);
	return (x % m + m) % m;
}

const int MAX_N = 2 * 100010;
vector<int> fact(MAX_N), rfact(MAX_N);

void Init() {
	fact[0] = rfact[0] = 1;
	for (int i=1; i<MAX_N; i++) {
		fact[i] = (fact[i - 1] * i) % MOD;
		rfact[i] = (rfact[i - 1] * ModInverse(i, MOD)) % MOD;
	}
}

inline int Combination(int n, int k) {
	return ((fact[n] * rfact[n - k]) % MOD) * rfact[k] % MOD;
}

int H, W, A, B;

signed main()
{
	cin >> H >> W >> A >> B;
	Init();
	int ans = 0;
	for (int i=1; i<=H-A; i++) {
		int l1 = Combination(i + B - 2, min(i - 1, B - 1));
		int l2 = Combination(H - i + W - B - 1, min(W - B - 1, H - i));
		ans = (ans + (l1 * l2) % MOD) % MOD;
	}

	cout << ans << endl;
}


Measured memory_bytes: 3328
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

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

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> v(n);
    for (auto &&i : v) scanf("%d", &i);
    int ans = 0;
    for (int i = 0; i <= k && i <= n; ++i) {
        for (int j = 0; i+j <= k && i+j <= n; ++j) {
            GPQ<int> q;
            int s = 0;
            int sousa = k-i-j;
            for (int l = 0; l < i; ++l) {
                q.emplace(v[l]);
                s += v[l];
            }
            for (int l = 0; l < j; ++l) {
                q.emplace(v[n-l-1]);
                s += v[n-l-1];
            }
            while(sousa && !q.empty() && q.top() < 0){
                sousa--;
                s -= q.top();
                q.pop();
            }
            ans = max(ans, s);
        }
    }
    cout << ans << "\n";
    return 0;
}

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

int N, A;
int cnt[100005];
int maxi;

int main() {
    scanf("%d", &N);
    for (int i = 0; i != N; ++i) {
        scanf("%d", &A); ++cnt[A];
    }
    maxi = max(maxi, cnt[0] + cnt[1]);
    for (int i = 1; i != 100000; ++i)
        maxi = max(maxi, cnt[i] + cnt[i - 1] + cnt[i + 1]);
    printf("%d\n", maxi);
    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define rep(i,n) for(ll i=0;i<(n);i++)  
#define pii pair<int,int>
#define piii pair<int,pii>
#define mp make_pair
#define pb push_back  
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second  
const int INF = INT_MAX;
const ll LLINF = LLONG_MAX;
const double eps = 1e-5;
const double PI = M_PI;  
#define DEB cout<<"!"<<endl
#define SHOW(a,b) cout<<(a)<<" "<<(b)<<endl
#define SHOWARRAY(ar,i,j) REP(a,i)REP(b,j)cout<<ar[a][b]<<((b==j-1)?((a==i-1)?("\n\n"):("\n")):(" "))
  
#define DIV 1000000007
typedef vector<ll> Array;
typedef vector<Array> matrix;
typedef tuple<int,int,int> tiii;
#define mt make_tuple

ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if(n&1==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}
int k[1000100];
int main(){
  int n; cin >> n;
  rep(i,n){
    int tmp; cin >> tmp;
    k[tmp]++; k[tmp+1]++;
    if(tmp > 0) k[tmp-1]++;
  }
  int ans = 0;
  rep(i,1000001)
    if(k[ans] < k[i])
      ans = i;
  cout << k[ans] << endl;
}

Measured memory_bytes: 640
#include <cstdio>
#include <cmath>
using namespace std;
int N, C[10][10], ans;
int main() {
  scanf("%d", &N);
  for(int i = 1, l, r; i <= N; ++i) {
    l = i/pow(10, (int)log10(i)), r = i %10;
    ++C[l][r];
  }
  for(int i = 1, l, r; i <= N; ++i) {
    l = i/pow(10, (int)log10(i)), r = i %10;
    ans += C[r][l];
  }
  printf("%d\n", ans);
}

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

#define F first
#define S second
#define prev azaza
#define MP make_pair
#define PB push_back

using namespace std;
typedef long long ll;
typedef long double ld;

const int max_n = 1, inf = 1000111222;

int main()
{
    //freopen("input.txt", "r", stdin);
    int n;
    ld s = 0;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        int a;
        cin >> a;

        s += 1.0 / a;
    }
    cout << fixed << setprecision(15) << ld(1) / s << endl;

    return 0;
}




Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var i int
	stack := make([]int, 0)
	for {
		v, _ := fmt.Scan(&i)
		// fmt.Println(stack)
		// println(v)
		if v == 0 {
			break
		}
		if i == 0 {
			fmt.Println(stack[len(stack)-1])
			stack = stack[:len(stack)-1]
			continue
		}
		stack = append(stack, i)
	}
}


Measured memory_bytes: 1076
//Lion's Sin Escanor 

#include<bits/stdc++.h>
using namespace std;
     
     
//#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long
#define sd(x) scanf("%d",&x)
#define sld(x) scanf("%lld",&x)
#define pld(x) printf("%lld\n",x)
#define pd(x) printf("%d\n",x)
#define moder 1000000007
#define forn(i,n) for(int i = 0; i < n ; i++)

ll moding( ll x , ll y ){
   
    ll ans = x % y;

    if(ans < 0)ans = ans + y ;

    return ans ;

}


bool isprime(ll n){
    if(n==2) return true;
    if(n==3) return true;
    if(n%2 == 0) return false;
    if(n%3 == 0) return false;

    ll i = 5,w=2;

    while(i*i <= n){
        if(n%i == 0)return false;

        i += w;
        w = 6 - w;
    }

    return true;
}

ll cmp(string s1 , string s2){
    // 1 for diff
    // 0 for same 

    int n = s1.size();
    int m = s2.size();

    if(n!=m)return 1;

    forn(i,n)
        if(s1[i] != s2[i])return 1;


    return 0; // SAME
}




int main(){

    int a, b; cin >> a >> b;
    cout << 6 - a - b << endl;


           
     
     
        
    return 0;
}
      
       

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var a, b int
	
	fmt.Scanf("%d", &a)
	fmt.Scanf("%d", &b)
	
	calc := [3]int{a+b,a-b,a*b}

	result := calc[0]
	for i := 0; i < len(calc); i++ {
		if calc[i] > result {
			result = calc[i]
		}
	}
	fmt.Printf("%d", result)
	
}

Measured memory_bytes: 512
#include<iostream>
#include<string>
using namespace std;
int main() {
	char a[3][3];

	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 3; j++) {
			cin >> a[i][j];
		}
	}

	for (int i = 0; i < 3; i++) {
		cout << a[i][i];
	}
}


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

int main()
{
    int result;
    cin >> result;
    bool returnBool = false;
    for(int i = 1; i < 10; i++){
        for(int j = 1; j < 10; j++){
            if(i*j == result){
                returnBool = true;
            }    
        }
    }
    cout << ((returnBool) ? "Yes" : "No");
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<string>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int main (){
	int N,court;
	while(~scanf("%d",&N)){
		int a = 0,b = 0,c = 0,d = 0;
		court = 0;
		a = N / 1000;
		b = (N - a * 1000) / 100;
		c = (N - a * 1000 - b * 100) / 10;
		d = N % 10;
		if((a == b && b== c) ||(b == c && c == d))
			printf("Yes\n");
		else
			printf("No\n");
	}
	return 0;
}
		

Measured memory_bytes: 256
#include<stdio.h>
#include<ctype.h>
#include<time.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<algorithm>
using namespace std;
int main()
{
	int ar[3],t;
	scanf("%d",&t);
	while(t--)
	{
		scanf("%d %d %d",&ar[0],&ar[1],&ar[2]);
		sort(ar,ar+3);
		if(ar[2] * ar[2] == ((ar[0] * ar[0]) + ar[1] * ar[1])) printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 1024
from math import *
PI = 3.1415926535898
while True:
	try:
		rd = map(float, raw_input().strip().split(','))
		v1 = rd[10]
		v2 = rd[11]
		rd = rd[:-2]
		total = 0
		for x in rd:
			total += x
		t = total / (v1+v2) * v1
		pas = 0
		i = 0
		while pas < t:
			pas += rd[i]
			i += 1
		print i
	except EOFError:
		break

Measured memory_bytes: 6420
#include <iostream>
#include <stdexcept>
#include <cassert>
#include <cmath>
using namespace std;


int main() {
  int A, B, C, K;
  cin >> A >> B >> C;
  cin >> K;

  bool possible = false;
  for (int b = 0; b <= K; b++) {
    int c = K - b;
    if (A < pow(2, b) * B && pow(2, b) * B < pow(2, c) * C) {
      possible = true;
      break;
    }
  }

  if (possible) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 3908
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <stack>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <cctype>
#include <complex>
#include <string>
#include <sstream>

using namespace std;

#define all(c) c.begin(),c.end()
#define rall(c) c.rbegin(),c.rend()
#define mp(a,b) make_pair((a),(b))
#define eq ==

typedef long long ll;
typedef complex<double> point;
typedef pair<int,int> pii;


const double EPS = 1e-9;

// 0: "Straight"
// 1: "Right"
// 2: "Back"
// 3: "Left"
// 4: "Halt"
const int dx[][4] = {
    // → ↓ ← ↑
    {1,0,-1,0},
    // ↑ → ↓ ←
    {0,1,0,-1},
    // ← ↑ → ↓
    {-1,0,1,0},
    // ↓ ← ↑ →
    {0,-1,0,1}
};

const int dy[][4] = {
    // → ↓ ← ↑
    {0,1,0,-1},
    // ↑ → ↓ ←
    {-1,0,1,0},
    // ← ↑ → ↓
    {0,-1,0,1},
    // ↓ ← ↑ →
    {1,0,-1,0}
};

// → ↑ ← ↓
const int dd[][4] = {
    // → ↓ ← ↑
    {0,3,2,1},
    // ↑ → ↓ ←
    {1,0,3,2},
    // ← ↑ → ↓
    {2,1,0,3},
    // ↓ ← ↑ →
    {3,2,1,0}
};
struct Robot{
    int y,x,dir,step;
    Robot(int y,int x,int dir,int step) : y(y),x(x),dir(dir),step(step) {};
};

bool operator<(const Robot& lhs,const Robot& rhs){
    return lhs.step < rhs.step;
}
bool operator>(const Robot& lhs,const Robot& rhs){
    return lhs.step > rhs.step;
}

int main(){
    while(true){
        int w,h;
        cin >> w >> h;
        if(w == 0 and h == 0) break;
        int gy = h-1,gx = w - 1;
        vector<vector<int> > field(h,vector<int>(w));
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                cin >> field[i][j];
            }
        }

        vector<int> costs(4);
        for(int i=0;i<4;i++) cin >> costs[i];

        vector<vector<vector<char> > > used(h,vector<vector<char> >(w,vector<char>(4,false)));
        priority_queue<Robot,vector<Robot>,greater<Robot> > que;
        que.push(Robot(0,0,0,0));
        int ret = 0;
        while(not que.empty()){
            Robot r = que.top();
            que.pop();
            if(used[r.y][r.x][r.dir]) continue;
            used[r.y][r.x][r.dir] = true;
            if(r.y == gy and r.x == gx){
                ret = r.step;
                break;
            }
            for(int i=0;i<4;i++){
                int ny = r.y + dy[r.dir][i];
                int nx = r.x + dx[r.dir][i];
                if(ny < 0 or ny >= h or nx < 0 or nx >= w) continue;
                if(i == field[r.y][r.x]){
                    que.push(Robot(ny,nx,dd[r.dir][i],r.step));
                }else{
                    que.push(Robot(ny,nx,dd[r.dir][i],r.step+costs[i]));
                }
            }
        }
        cout << ret << endl;
    }
    return 0;
}

Measured memory_bytes: 1404
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1e9+7,INF=mod*mod*3;//M_PI
#define rep(i,N) for(ll i=0; i<(N); i++)
#define rep1(i,N) for(ll i=1; i<(N); i++)
#define pb push_back

ll N;
ll B[105];

int main(){

cin.tie(0);
ios::sync_with_stdio(false);

cin>>N;
rep(i,N-1){
    cin>>B[i];
}
ll ans=0;
rep(i,N){
    if(i==0) ans+=B[0];
    else if(i==N-1) ans+=B[N-2];
    else ans+=min(B[i-1],B[i]);
}
cout<<ans<<endl;

}
    


Measured memory_bytes: 3660
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define MOD 1000000007
#define len(x) x.size()
#define min3(a, b, c) min(a, min(b, c))
#define max3(a, b, c) max(a, max(b, c))
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define alla(a,n) a, a + n
#define endstring std::string::npos
#define prtarr(n,len) {for(int i=0;i<len;i++) cout<<n[i]<<" "; cout<<"\n";}
#define prtpair(n) {cout<<n.fr<<" "<<n.sc<<"\n";}
#define Ataru main
using namespace std;

typedef long long int ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pll> vpll;
typedef vector<vll> vvll;
typedef vector<string> vs;
using namespace std;
int judge(int x,int y){
    cout<<"? "<<x+1<<" "<<y+1<<endl;
    int a; cin>>a;
    return a;
}
const ll INF= 0x3f3f3f3f;
const ll bignum=1e18;

int n;
int Ataru(){
    /// #jojofan
    /// #csgofan
    /// Author: Ataru
    //freopen("input.txt", "r", stdin) ;
    //freopen("output.txt", "w", stdout) ;
    ios_base::sync_with_stdio(false);
    cin.tie(NULL) ; cout.tie(NULL) ;
    cin>>n;
    int cnt=0;
    bool exist=false;;
    for(int i=0;i<n;i++){
        int sub1,sub2;
        cin>>sub1>>sub2;
        if(sub1==sub2) ++cnt;
        else cnt=0;
        if(cnt>=3) exist=true;
    }
    if(exist) cout<<"Yes";
    else cout<<"No";

    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(var, begin, end) for (int var = (begin); var <= (end); var++)
#define RFOR(var, begin, end) for (int var = (begin); var >= (end); var--)
#define REP(var, length) FOR(var, 0, length - 1)
#define RREP(var, length) RFOR(var, length - 1, 0)
#define EACH(value, var) for (auto value : var)
#define SORT(var) sort(var.begin(), var.end())
#define REVERSE(var) reverse(var.begin(), var.end())
#define RSORT(var) SORT(var); REVERSE(var)
#define OPTIMIZE_STDIO ios::sync_with_stdio(false); cin.tie(0); cout.precision(10); cout << fixed
#define endl '\n'

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

void solve(istream& cin, ostream& cout) {
  int n;
  cin >> n;
  vector<long double> a(n);
  REP(i, n) cin >> a[i];
  long double sum = 0;
  REP(i, n) sum += 1 / a[i];
  long double ans = 1 / sum;
  cout << ans << endl;
}

#ifndef TEST
int main() {
  OPTIMIZE_STDIO;
  solve(cin, cout);
  return 0;
}
#endif


Measured memory_bytes: 3844
for e in iter(input,'0'):
 a=list(tuple(map(int,input().split())) for _ in range(int(e)))
 s,t=a[0]
 b={tuple(map(int,input().split())) for _ in range(int(input()))}
 for x,y in b:
  f=1
  for u,v in a[1:]:
   if(x+u-s,y+v-t)not in b:f=0;break
  if f:print(x-s,y-t);break


Measured memory_bytes: 6052
import sys
# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
# import heapq
import decimal
# import statistics
import queue

# import numpy as np

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===

def main():
    s = list(input())
    t = list(input())

    sl = len(s)
    tl = len(t)

    dp = [[0 for _ in range(tl + 1)] for __ in range(sl + 1)]

    for i in range(sl):
        for j in range(tl):
            if s[i] == t[j]:
                dp[i + 1][j + 1] = dp[i][j] + 1
            else:
                dp[i + 1][j + 1] = max(dp[i + 1][j], dp[i][j + 1])

    ans = ""
    x = sl
    y = tl
    while x > 0 and y > 0:
        if s[x - 1] == t[y - 1]:
            ans = s[x - 1] + ans
            x -= 1
            y -= 1
        elif dp[x][y] == dp[x - 1][y]:
            x -= 1
        elif dp[x][y] == dp[x][y - 1]:
            y -= 1
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 158024
#include <algorithm>
#include <stdio.h>
#define MOD 1000000007
#define ll long long
#define maxf 200000
 
int f[maxf+1], invf[maxf+1];
 
inline int lgput (int a, int n) {
    int rez = 1;
    while (n) {
        if (n % 2 == 1)
            rez = (1LL * rez * a) % MOD;
        a = (1LL * a * a) % MOD, n /= 2;
    }
    return rez;
}
 
inline int combinari (int a, int b) {
    if(b < a) return 0;
    else return 1LL * f[b] % MOD * invf[a] % MOD * invf[b-a] % MOD;
}
int main() {
    int n, m, a, b, nr = 0;
    scanf("%d%d%d%d", &n, &m, &a, &b);
 
    f[0] = 1;
    invf[0] = 1;
    for (int i = 1; i <= maxf; i++) f[i] = 1LL * i * f[i-1] % MOD;
    invf[maxf] = 1LL * lgput (f[maxf], MOD - 2);
    for (int i = maxf - 1; i >= 1; i--) invf[i] = 1LL * invf[i+1] * (i+1) % MOD;
    for (int i = 1; i <= n - a; i++) {
        nr = (nr + 1LL * combinari(i - 1, b + i - 2) * combinari(m - b - 1, m + n - b - i - 1) % MOD)% MOD;
    }
 
    printf("%d", nr);
 
    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MX 100105
ll dp[MX];
int A[MX], N, K;

ll go(int pos){
    if (pos >= N) return 0;
    if (dp[pos] != -1) return dp[pos];
    ll ans = INT_MAX;
    for (int i = 1; i <= K; i++)
       if (pos+i <= N) ans = min(ans, abs(A[pos] - A[pos+i]) + go(pos+i));
    return dp[pos] = ans;
}

int main()
{
    memset(dp, -1, sizeof(dp));
    scanf("%d%d", &N, &K);
    for (int i = 1; i <= N; i++){
        scanf("%d", &A[i]);
    }
    ll res = go(1);
    printf("%lld\n", res);
    return 0;
}



Measured memory_bytes: 6144
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<list>
#include<set>
#include<string>
using namespace std;
int gcd(int a, int b) {
	int c = a % b;
	while (c != 0) {
		a = b;
		b = c;
		c = a % b;
	}
	return b;
}
struct UnionFind {
	vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

	UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
		for (int i = 0; i < N; i++) par[i] = i;
	}

	int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
		if (par[x] == x) return x;
		return par[x] = root(par[x]);
	}

	void unite(int x, int y) { // xとyの木を併合
		int rx = root(x); //xの根をrx
		int ry = root(y); //yの根をry
		if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
		par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
	}

	bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}
};
typedef long long ll;

const ll M = 1000000007;

vector<ll> fac(300001); //n!(mod M)
vector<ll> ifac(300001); //k!^{M-2} (mod M)

ll mpow(ll x, ll n) {
	ll ans = 1;
	while (n != 0) {
		if (n & 1) ans = ans * x % M;
		x = x * x % M;
		n = n >> 1;
	}
	return ans;
}
ll comb(ll a, ll b) {
	if (a == 0 && b == 0)return 1;
	if (a < b || a < 0)return 0;
	ll tmp = ifac[a - b] * ifac[b] % M;
	return tmp * fac[a] % M;
}
int compare(string a, string b) {
	int i;
	for (i = 0; i < a[i] != '\0'; i++) {
		if (b[i] == '\0')
			return -1;
		else if (a[i] < b[i])
			return 1;
		else if (a[i] > b[i])
			return -1;
	}
	if (b[i] != '\0')
		return 1;
	else
		return 0;
}
int main() {
	int c[33], i, len;
	char s[111111];
	cin >> s;
	for (i = 0; i < 26; i++)
		c[i] = 0;
	for (i = 0; s[i] != '\0'; i++)
		c[s[i] - 'a']++;
	len = i;
	for (i = 0; i < 26; i++) {
		if (c[i] * 3 - 2 > len) {
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
}

Measured memory_bytes: 4992
import fractions
a,b,c,d=map(int,input().split())
 
s=c*d//fractions.gcd(c, d)
bk=0
ak=0
ans=0
bc=b//c
ac=a//c    
bd=b//d
ad=a//d
bsa=b//s
asa=a//s
bk=b-bc-bd+bsa
ak=a-ac-ad+asa
ans=bk-ak
if a%c==0 or a%d==0 or a%s==0:
    ans=ans
else:
    ans+=1
print(ans)

Measured memory_bytes: 5076
#include <cstring>
#include <algorithm>
#include <map>
#include <stack>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <vector>
#include <iostream>
#include <set>
#define MP make_pair
#define F first
#define PB push_back
#define S second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int maxn = 1e5 + 5;
const int mod = 1e9 + 7;
const int inf = (1 << 30);
const int block = 700;

int a[maxn];

int main() {
    ios_base::sync_with_stdio (false);
    int n, x;
    cin >> n >> x;
    for (int i = 1; i <= n; i++)
        cin >> a[i];
    sort (a + 1, a + n + 1);
    int cnt = 0;
    for (int i = 1; i <= n; i++) {
        if (a[i] <= x)
            cnt ++;
        x -= a[i];
        x = max (x, 0);
    }
    cnt -= (x > 0);
    cout << cnt << endl;
}

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

#include <climits>
#include <cmath>
#include <cstring>

#include <iomanip>

using namespace std;

#define FAST       			ios_base :: sync_with_stdio(false); cin.tie(NULL); 
#define endl "\n"

typedef long long int  ll;
typedef unsigned long long int ull;

int main()
{
	FAST;
	ll n,m;
	cin >> n >> m;
	
	ull ans = 0;
	if(2*n <= m)
	{
	    ans += n;
	    m -= (2*n);
	    n = 0;
	}
	else
	{
	    ans += m/2;
	    n -= (m/2);
	    m = 0;
	}
	
	ans += (m/4);
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
ll fpow(ll a,ll b)
{
    if(a==0) return 0;
    if(b==0) return 1;
    if(b==1) return a;
    //cout<<b<<'\n';
    ll t=fpow(a,b/2);
    t=(t*t)%mod;
    if(b%2) return (t*a)%mod;
    return t;
}
ll inv[2000050];

ll c(ll m,ll n)
{
    ll tmp=1;
    for(int i=m;i>m-n;i--)
        tmp=(tmp*i)%mod;
    for(int i=1;i<=n;i++)
        tmp=(tmp*inv[i])%mod;
    return tmp;
}
ll pre(ll r,ll l)
{

    return c(r+l+2,r+1)-1;
}

int main()
{
    for(ll i=1;i<=1000005;i++)
        inv[i]=fpow(i,mod-2);
    int r1,r2,c1,c2;
    cin>>r1>>c1>>r2>>c2;
    //cout<<c(5,3)<<'\n';

    ll ans=(pre(r2,c2)-pre(r1-1,c2)-pre(r2,c1-1)+pre(r1-1,c1-1))%mod;
    while(ans<0) ans+=mod;
    cout<<ans<<'\n';
}


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

using namespace std;

int main(){
    int k,n;
    cin >> k >> n;
    int d_max = 0;
    vector<int> a(n);
    for(int i = 0; i < n; ++i){
        cin >> a[i];
    }

    sort(a.begin(), a.end());

    for(int i = 0; i < n - 1; ++i){
        d_max = max(d_max, abs(a[i + 1] - a[i]));
    }

    d_max = max(d_max,a.front() + (k - a.back()));

    cout << k - d_max << endl;

    return 0;
}

Measured memory_bytes: 4056
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,A,B;
  cin >> N >> A >> B;



  if (A>=B){
      cout << B << " ";
  } else {
      cout << A << " ";
  }
  if (A+B>N){
      cout <<(A+B-N);
  } else {
      cout << 0;
  }
  cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using ll = int64_t;

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

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

    ll a, b;

    cin >> a >> b;

    map<ll, int> divsa = pf(a), divsb = pf(b);

    int ctr = 1;
    for (const auto &e : divsa) {
        if (divsb.find(e.first)->first == e.first) {
            ctr++;
        }
    }

    cout << ctr;

    return 0;
}


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

signed main(){
    
  char c;
  cin >> c;
  
  if(c=='A')cout << 'T' <<endl;
  if(c=='T')cout << 'A' << endl;
  if(c=='C')cout << 'G' << endl;
  if(c=='G')cout << 'C' << endl;
  return 0;
}
    
  


Measured memory_bytes: 256