akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
using namespace std;

struct Card { char suit, value; };

void bubble(struct Card A[], int N) {
	for ( int i = 0; i < N; i++) {
		for ( int j = N - 1; j >= i + 1; j--) {
			if ( A[j].value < A[j - 1].value) {
				Card t = A[j]; A[j] = A[j - 1]; A[j - 1] = t;
			}
		}
	}
}

void selection(struct Card A[], int N) {
	for ( int i = 0; i < N; i++) {
		int minj = i;
		for ( int j = i; j < N; j++) {
			if ( A[j].value < A[minj].value) minj = j;
		}
		Card t = A[i]; A[i] = A[minj]; A[minj] = t;
	}
}
 
void print(struct Card A[], int N) {
	for ( int i = 0; i < N; i++) {
		if (i) cout << " ";
		cout << A[i].suit << A[i].value;
	}
	cout << endl;
} 

bool isStable(struct Card C1[], struct Card C2[], int N) {
	for ( int i = 0; i < N; i++) {
		if ( C1[i].suit != C2[i].suit ) return false;
	}
	return true;
}

int main() {
	Card C1[100], C2[100];
	int N;
	char ch;
	
	cin >> N;
	for ( int i = 0; i < N; i++) {
		cin >> C1[i].suit >> C1[i].value;
		
	}
	
	for ( int i = 0; i < N; i++) C2[i] = C1[i];
	
	bubble(C1, N);
	selection(C2, N);
	
	print(C1, N);
	cout << "Stable" << endl;
	
	print(C2, N);
	if ( isStable(C1, C2, N) ) {
		cout << "Stable" << endl;
	} else {
		cout << "Not stable" << endl;
	}
	
	return 0;
	
}


Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
double dp[3000][3000];
double a[3000];
int n;
double solve(int index,int head)
{
    if(index==n)
    {
        if(head>n-head)
        return 1.0;
        else
        return 0.0;
    }
    if(dp[index][head]!=-1.0)
    return dp[index][head];
    return dp[index][head]=solve(index+1,head+1)*a[index]+solve(index+1,head)*(1-a[index]);
}
int main()
{
    int i,j,k,x,y,z;
    cin>>n;
    for(i=0;i<n;i++)cin>>a[i];
    for(i=0;i<=2999;i++)for(j=0;j<=2999;j++)dp[i][j]=-1.0;
    cout<<std::setprecision(10)<<solve(0,0);
    return 0;
}


Measured memory_bytes: 70784
#include <stdio.h>
#include <cmath>
 
using namespace std;
 
int main(){
	int N,T,A;
  	scanf("%d",&N);
	scanf("%d %d",&T,&A);
	double best_height = 45600;
	int best_id = 0;
	int hi,tmp;
	
	//printf("%d",N);
	//printf("%d %d\n",T,A);
	for(int i=0;i<N;i++){
		scanf("%d", &hi);
		if(abs(T-0.006*hi-A)<best_height){
			best_height = abs(T-0.006*hi-A);
			best_id = i+1;
		}
		//printf("%d ",hi);
 
	}
	printf("%d\n",best_id);
 
}

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

typedef long long int ll;
#define INF 1999999999
#define MODA 1000000007
#define PI 3.1415926535897932384626433

int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
     int n;
     cin >> n;
     vector<ll> v;
     for(int i = 0; i < n; i++){
        ll ele;
        cin >> ele;
        v.push_back(ele);
     }
     sort(v.begin(), v.end());
     ll len = v.size();
     ll ans = v[len-1] - v[0];
     cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cstring>
#include <string.h>
#include <sstream>
#include <map>
#include <iomanip>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <set>
#include <numeric>

using namespace std;
using ll = long long;

#define pb push_back
#define in insert
#define endl '\n'

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

    ll h, n;
    cin >> h >> n;
    ll v, sum = 0;
    for(int i = 0; i < n; i++) {
        cin >> v;
        sum += v;
    }
    if(sum < h) {
        cout << "No";
    } else {
        cout << "Yes";
    }
}


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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            ABC082_B();
        }

        static void ABC082_B()
        {
            var s = string.Join("", Console.ReadLine().OrderBy(x => x));
            var t = string.Join("", Console.ReadLine().OrderByDescending(x => x));

            var result = string.Compare(s, t);
            if (result < 0)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}

Measured memory_bytes: 13536
//============================================================================
// Name        : abc141_f.cpp F - Xor Sum 3
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : https://atcoder.jp/contests/abc141/tasks/abc141_f
//============================================================================

#pragma GCC optimize ("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

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

// 参照: https://img.atcoder.jp/abc141/editorial.pdf
int main() {
	int N, i, col;
	cin >> N;

	// 格納
	unsigned long long A[N];
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
	}

	// すべての XOR を取る
	// これで 1 になるビットは最大化問題に関わらない
	// ここで 0 になるビットを 1 にできれば大きな数にできるので、0 になるビットを「興味深いビット」と呼ぶことにする
	unsigned long long all_xor = 0LL;
	for (i = 0; i < N; ++i) {
		all_xor ^= A[i];
	}

	// 「興味深いビット」の抽出
	all_xor = ~all_xor; // ~all_xor (「興味深いビット」が立ったもの)
	for (i = 0; i < N; ++i) {
		A[i] &= all_xor;
	}
	all_xor = ~all_xor;

	// 行列 [A0; A1; ...; AN] の行標準形を求める
	int rank = 0;
	for (col = 59; col >= 0; --col) { // 上位ビットから (列方向), 59ビット目～0ビット目
		for (i = rank; i < N; ++i) { // 行方向
			if (A[i] & (1LL << col)) { // col ビット目が立っていたら抜ける
				break;
			}
		}
		if (i == N) { // rank = N と分かった時点で抜ける
			continue;
		}

		if (i > rank) {
			// A[rank] の col ビット目は立っていなかったが、下の行を順に見て行って  A[i] の col ビット目が立っていたなら、
			// A[rank] の col ビット目がここで立つ
			A[rank] ^= A[i];
		}
		// 下のほうの未処理の行
		for (i = rank + 1; i < N; i++) { // 行方向
			A[i] = min(A[i], A[i] ^ A[rank]); // col ビット目は 0 になる
		}

		rank++;
	}

	// 上の行から XOR していく
	unsigned long long x = 0;
	for (i = 0; i < N; i++) {
		x = max(x, x ^ A[i]);
	}

	unsigned long long res = (x << 1) + all_xor;
	cout << res << endl;

	return 0;
}


Measured memory_bytes: 1024
N,T = list(map(int,input().split()))

Tlist = list(map(int,input().split()))
#######################################

#for t,v in [ map(int,input().split()) for _ in range(N-1) ]:
Tlist.reverse()
goukei = 0
tugi_time = 1e10
for t_i in Tlist:
	goukei += min( T , tugi_time - t_i )
	tugi_time = t_i

print (goukei)

Measured memory_bytes: 26708
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;

int main() {
    ll n, k;
    cin >> n >> k;

    vl a(n);
    ll sum = 0;
    rep(i, n) {
        cin >> a[i];
        sum += a[i];
    }

    vl yakusu;  // sumの約数
    for(ll i = 1; i*i <= sum; i++) {
        if(sum%i == 0) {
            yakusu.pb(i);
            if(i*i != sum) {
                yakusu.pb(sum/i);
            }
        }
    }

    ll ans = 1;
    rep(I, yakusu.size()) {

        ll d = yakusu[I];

        vl r(n);
        rep(i, n) {
            r[i] = a[i]%d;
        }
        sort(all(r));

        ll tot = 0;
        rep(i, n) {
            tot += r[i];
        }
        
        ll l = n - tot/d;
        ll need = 0;
        rep(i, l) {
            need += r[i];
        }
        
        if(need <= k) {
            ans = max(ans, d);
        }
    }

    out(ans);
    re0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<climits>
#include<algorithm>
#include<sstream>
#include<iostream>
#include<string>
#include<queue>
#include<stack>
#include<set>
#include<list>
#include<map>
#include<vector>

using namespace std;


#define rep(i,n) for(int i=0; i<n; i++)
#define rept(i,a,b) for(int i=a; i<b; i++)
#define repi(i,a,b) for(int i=a; i>b; i--)
#define ll long long

#define IMIN INT_MIN;
#define IMAX INT_MAX;

int maxelem(vector<int> src) {
	int dst = IMIN;
	rep(i, src.size()) {
		dst = (dst > src[i]) ? dst : src[i];
	}
	return dst;
}

int secondelem(vector<int> src) {
	int dst = IMIN;
	int dst2 = IMIN;
	rep(i, src.size()) {
		if (dst < src[i]) {
			dst2 = dst;
			dst = src[i];
		}
		else if (dst2 < src[i]) {
			dst2 = src[i];
		}
	}
	return dst2;
}

vector<int> count(vector<int> a) {
	int ma = maxelem(a);
	vector<int> count(ma+1, 0);
	rep(i, a.size()) {
		count[a[i]]++;
	}
	return count;
}

int find(vector<int> a, int b) {
	rep(i, a.size()) {
		if (a[i] == b) return i;
	}
	return -1;
}

int main(){
	int a, b, k;
	cin >> a >> b >> k;
	int m;
	int cnt = 0;
	repi(i, min(a, b), 0) {
		if (a % i == 0 && b % i == 0) {
			cnt++;
			if (cnt == k) m = i;
		}
	}
	cout << m << endl;

	return 0;
}





Measured memory_bytes: 256
n = int(input())
fa = 0
sa = 0
fi = 0
si = 0
for i in range(n):
    a = int(input())
    if a > fa:
        sa, si = fa, fi
        fa = a
        fi = i
    elif a > sa:
        sa = a
        si = i

for i in range(n):
    if i != fi:
        print(fa)
    else:
        print(sa)

Measured memory_bytes: 55640
num = int(input())
strnum_line = input().split(" ")

num_line = [int(n) for n in strnum_line]
#print(num_line)
fumidai = 0 

for i in range(1,len(num_line)):
    if(num_line[i] < num_line[i-1]):
        #print(i)
        a = num_line[i-1] - num_line[i]
        #print(a)
        fumidai += a
        num_line[i] = num_line[i-1]
        #print(num_line)
        
print(fumidai)

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

using namespace std;
//using namespace __gnu_pbds;

#define LL       long long
#define DS       pair<int, int>
#define READ(f)  freopen(f, "r", stdin)
#define WRITE(f) freopen(f, "w", stdout)

const int N = 3e5 + 5;
const int MOD = 1e9 + 7;
const double PI = 2 * acos(0.0);
//template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

double sum[N];

int main() {
    //ios::sync_with_stdio(false);
    //cin.tie(0);
    int n, k;
    scanf("%d %d", &n, &k);
    for (int i = 1; i <= n; i++) {
        double x;
        cin >> x;
        sum[i] = (x + 1.0) / 2.0;
        sum[i] += sum[i - 1];
    }
    double ans = 0.0;
    for (int i = 1; i + k - 1 <= n; i++) {
        double tmp = sum[i + k - 1] - sum[i - 1];
        ans = max(ans, tmp);
    }
    cout << fixed << setprecision(10) << ans << '\n';
    return 0;
}


Measured memory_bytes: 1792
/* Author : Prasuk Jain */
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define int              long long int
#define ull              unsigned long long
#define ld               long double
#define fo(i, n)         for(int i=0; i<n; i++)
#define FOR(i, a, b)     for(int i=a; i<b; i++)
#define rfor(i, n)       for(int i=n-1; i>=0; i--)
#define RFOR(i, a, b)    for(int i=b-1; i>=a; i--)
#define tr(it, v)        for(auto it=a.begin(); it!=a.end(); it++)
#define vi               vector<int>
#define pii              pair<int,int>
#define mii              map<int,int>
#define pqb              priority_queue<int>
#define pqs              priority_queue<int,vi,greater<int>>
#define mp               make_pair
#define pb(x)            push_back(x)
#define hcf(x, y)        __gcd(x, y)
#define lcm(x, y)        boost::math::lcm(x,y)
#define setpre(x, y)     fixed << setprecision(y) << x
#define setbits(x)       __builtin_popcountll(x)
#define zerolead(x)      __builtin_clzll(x)
#define zerotrail(x)     __builtin_ctzll(x)
#define all(x)           x.begin(), x.end()
#define sortall(x)       sort(all(x))
#define PI               3.1415926535897932384626
const int mod = 1e9+7;
const int inf = 1e18;
int mpow(int base, int exp);
bool isprime(int num);
void prifact(int num);

//*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!//

void coderprasukj(){ 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}

int32_t main() {
    //coderprasukj();
    int d1,t, n, k, x=0, y;
    cin >> n >> k;
    int a[n+1];
    fo(i,n+1) a[i]=0;
    while(k--){
       cin >> d1;
       int arr[d1];
       fo(i, d1) cin >> arr[i];
       fo(i, d1) a[arr[i]]++;
    }
    for(int i=1; i< n+1 ;i++) 
    if(a[i]==0) x++;
    cout << x << "\n";
    return 0;
}

//*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!*!//

int mpow(int base, int exp) {
    base %= mod;
    int result = 1;
    while (exp > 0) {
        if (exp & 1) result = ((int)result * base) % mod;
        base = ((int)base * base) % mod;
        exp >>= 1;
    }
  return result;
}

bool isprime(int num) {
    if(num <= 1) return false;
    for(int i=2; i*i <= num; i++)
        if(num%i == 0) return false;
    return true;
}

void prifact(int num){
    for(int i=2; i<=num; i++)
    if(num%i == 0){
        int cnt = 0;
        while(num%i == 0)
        cnt++ , num /= i;
        cout << i << "^" << cnt << " ";
    }
    if(num > 1)
    cout << num << "^" << "1" << " ";
}



Measured memory_bytes: 3644
/*
    Author      : Dinesh Verra
    College     : ABV-IIITM
    Date        : 02/08/2020
    Source		: 
    Explanation : 
*/
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp> 
// using namespace boost::multiprecision; 
using namespace std;
typedef long long ll;
// typedef unsigned long long ll;
#define cu continue
#define br break
#define pb push_back
#define eb emplace_back
#define mod 1000000007
#define inf INT_MAX
#define pll pair <ll,ll>
#define min_pq priority_queue <pll> ,vector <pll>, greater <pll> > > 
#define F first
#define S second
#define vll vector <ll>
#define vpll vector <pll>
#define dbg(n) cout<<#n<<' '<<n<<endl;
#define all(v) v.begin(),v.end()
#define nl cout<<'\n'

template <typename A1>
void prn(A1&& arg)
{
	cout<<arg<<'\n';
}
template <typename A1, typename... A>
void prn(A1&& arg, A&&... args)
{
	cout<<arg<<' ';
	prn(args...);
}

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


	ll k,mx=5000000;
	cin>>k;
	ll n=0;
	for(ll i=1;i<=mx;i++)
	{
		n*=10;
		n+=7;
		n%=k;
		if(n==0)
		{
			prn(i);
			return 0;
		}
	}
	prn(-1);
}

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

int main(){
    string n;
    cin>>n;
    if (n[0] == '7' || n[1] == '7' || n[2] == '7') puts("Yes");
    else puts("No");
}

Measured memory_bytes: 3584
n = gets.chomp.to_i
a = []
a = gets.split.map(&:to_i)
b = []
b = gets.split.map(&:to_i)
 
#p n
#p a
#p b
 
t = 0
for i in 0..n-1
 if a[i] >= b[i]
     t += (a[i]-b[i])
 end
end
puts t 

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> P1;
typedef pair<P, P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i, x) for (long long i = 0; i < x; i++)
#define repn(i, x) for (long long i = 1; i <= x; i++)
#define SORT(x) sort(x.begin(), x.end())
#define ERASE(x) x.erase(unique(x.begin(), x.end()), x.end())
#define POSL(x, v) (lower_bound(x.begin(), x.end(), v) - x.begin())
#define POSU(x, v) (upper_bound(x.begin(), x.end(), v) - x.begin())
vector<pair<string, P> > vec;
// vector<vector<int>> data(3, vector<int>(4));

void solve(long long N, long long M, vector<long long> A) {
    ll res = 0;
    rep(i, M) { res += A[i]; }
    if (N - res >= 0)
        cout << N - res << endl;
    else
        cout << "-1" << endl;
}

int main() {
    long long M;
    long long N;
    scanf("%lld", &N);
    scanf("%lld", &M);
    vector<long long> A(M - 1 + 1);
    for (int i = 0; i <= M - 1; i++) {
        scanf("%lld", &A[i]);
    }
    solve(N, M, A);
    return 0;
}


Measured memory_bytes: 3848
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int a, b; cin >> a >> b;
  cout << (a + b & 1 ? "IMPOSSIBLE" : to_string(a + b >> 1)) << '\n';
}

Measured memory_bytes: 256
N,M,C=map(int,input().split())
ans=0
B=list(map(int,input().split()))

for i in range(N):
    A=list(map(int,input().split()))
    s=C
    for j in range(M):
        s+=A[j]*B[j]
    if s>0:
        ans+=1

print(ans)


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

using namespace std;

struct Combination
{
  int mod;
  vector< int64_t > mfact, rfact;

  Combination(int sz, int mod) : mfact(sz + 1), rfact(sz + 1), mod(mod)
  {
    mfact[0] = 1;
    for(int i = 1; i < mfact.size(); i++) {
      mfact[i] = mfact[i - 1] * i % mod;
    }
    rfact[sz] = inv(mfact[sz]);
    for(int i = sz - 1; i >= 0; i--) {
      rfact[i] = rfact[i + 1] * (i + 1) % mod;
    }
  }

  int64_t fact(int k) const
  {
    return (mfact[k]);
  }

  int64_t pow(int64_t x, int64_t n) const
  {
    int64_t ret = 1;
    while(n > 0) {
      if(n & 1) (ret *= x) %= mod;
      (x *= x) %= mod;
      n >>= 1;
    }
    return (ret);
  }

  int64_t inv(int64_t x) const
  {
    return (pow(x, mod - 2));
  }

  int64_t P(int n, int r) const
  {
    if(r < 0 || n < r) return (0);
    return (mfact[n] * rfact[n - r] % mod);
  }

  int64_t C(int p, int q) const
  {
    if(q < 0 || p < q) return (0);
    return (mfact[p] * rfact[q] % mod * rfact[p - q] % mod);
  }

  int64_t H(int n, int r) const
  {
    if(n < 0 || r < 0) return (0);
    return (r == 0 ? 1 : C(n + r - 1, r));
  }
};

using int64 = long long;
const int INF = 1 << 30;
const int mod = 1e9 + 7;

int N;
vector< int > g[5000];
int sub[5000];
int centroid_sz = INF;
vector< int > centroid;
Combination comb(5001, mod);

int build_dfs(int idx, int par)
{
  sub[idx] = 1;
  for(auto &to : g[idx]) {
    if(to == par) continue;
    sub[idx] += build_dfs(to, idx);
  }
  return (sub[idx]);
}


void build_centroid(int idx, int par, const int all)
{
  int connect = all - sub[idx];
  for(auto &to : g[idx]) {
    if(to == par) continue;
    build_centroid(to, idx, all);
    connect = max(connect, sub[to]);
  }
  if(connect < centroid_sz) {
    centroid_sz = connect;
    centroid.clear();
  }
  if(connect == centroid_sz) {
    centroid.emplace_back(idx);
  }
}


int main()
{
  cin >> N;
  for(int i = 1; i < N; i++) {
    int x, y;
    cin >> x >> y;
    --x, --y;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  build_centroid(0, -1, build_dfs(0, -1));
  assert(centroid.size() <= 2);
  if(centroid.size() == 2) {
    cout << comb.fact(N / 2) * comb.fact(N / 2) % mod << endl;
    return (0);
  }
  build_dfs(centroid[0], -1);


  int sz = 1;
  vector< int > dp1(1);
  dp1[0] = 1;
  for(auto &to : g[centroid[0]]) {
    vector< int > dp2(sz + sub[to]);
    for(int i = 0; i < sz; i++) {
      for(int j = 0; j <= sub[to]; j++) {
        (dp2[i + j] += dp1[i] * comb.fact(sub[to]) % mod * comb.rfact[sub[to] - j] % mod * comb.C(sub[to], j) % mod) %= mod;
      }
    }
    sz += sub[to];
    dp1.swap(dp2);
  }
  int ret = 0;
  for(int i = 0; i < N; i++) {
    if(i % 2 == 0) (ret += dp1[i] * comb.fact(N - i) % mod) %= mod;
    else (ret += mod - dp1[i] * comb.fact(N - i) % mod) %= mod;
  }
  cout << ret << endl;
}



Measured memory_bytes: 896
n = int(input())
a = list(map(int,input().split()))
a.append(1000000000000)
a.sort()
b = list()

cn = 1
for i in range(n):
    if(a[i]==a[i+1]):
        cn += 1
    else:
        b.append((a[i],cn))
        cn = 1
        
b.sort(key = lambda x : (x[0],x[1]))
#print(b)
sn = 0

for i in range(len(b)):
    if(b[i][1]-b[i][0]<0):
        sn += b[i][1]
    elif(b[i][1]-b[i][0]>0):
        sn += b[i][1]-b[i][0]
        
print(sn)

Measured memory_bytes: 65704
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int[] l = new int[n];
		int max = 0;
		int sum = 0;
		for(int i = 0; i < n; i++) {
			l[i] = sc.nextInt();
			max = Math.max(max, l[i]);
			sum += l[i];
		}
		
		if(max < sum - max) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 23124
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>

#define FOR(i, f, n) for(int (i) = (f); (i) < (n); (i)++)
#define RFOR(i, f, n) for(int (i) = (f); (i) >= (n); (i)--)
#define REP(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define RREP(i, n) for(int (i) = (n); (i) >= 0; (i)--)
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for(int (i) = (n); (i) >= 0; (i)++)
#define p(...) printf(__VA_ARGS__); cout << endl;
#define input(x) x; cin >> x;
#define list_input(x, n) x[(n)]; for(int (i) = 0; (i) < (n); (i)++) cin >> x[i];
#define lambda(a, b, c) [](const a, const b){ return c ;}
#define key(t, x, compare) [](const t& a, const t& b){ return a x compare b x ;}

using namespace std;

using pii = pair<int, int>;

int main(){
  int input(n);
  int input(k);
  int list_input(a, n);

  sort(a, a + n);
  int result = 0;
  RFOR(i, n - 1, n - k){
    result += a[i];
  }

  p("%d", result);
}


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

int solve(string& s){
int n=s.size(),ans=0;

for (int i=1;i<n;i++){
    if(s[i]==s[i-1]){
            ans++;
    if (s[i]=='0'){s[i]='1';}
    else if(s[i]=='1'){s[i]='0';}

}

}
return ans;
}


int main(){
ios::sync_with_stdio(false);
string j;
cin >> j;

cout << solve(j)<<endl;

return 0;
}


Measured memory_bytes: 512
#include <iostream>
 #include <vector>
 #include <cmath>
 using namespace std;

 int main()
 {
     int t, a, n;
     vector<double> p;
     cin >> n >> t >> a;
     double h;
     for(int i = 0; i < n; i++){
         cin >> h;
         p.push_back(h);
     }

     int lowestK;
     float lowestabs = 10000000;
     double cn;
     for(int i = 0; i < n; i++)
     {
         cn = t - (p[i] * 0.006);
         if(abs(a - cn) < lowestabs)
         {
             lowestabs = (abs(a - cn));
             lowestK = i;
         }
     }

     cout << lowestK + 1;
 }


Measured memory_bytes: 256
N,W = map(int,input().split())
wv = [[int(i) for i in input().split()] for j in range(N)]

MAXV = 0
for i in range(N):
    MAXV += wv[i][1]

# 初期化
dp = [[float("inf")]*(MAXV+1) for i in range(N+1)]

# 初期条件 (価値と重さが0)
dp[0][0] = 0

# DPループ
for i in range(N):
    for j in range(MAXV+1):
        # (i-1)番目を選ぶ場合
        if j - wv[i][1] >= 0:
            dp[i+1][j] = min(dp[i+1][j], dp[i][j-wv[i][1]]+wv[i][0])
        # (i-1)番目を選ばない場合
        dp[i+1][j] = min(dp[i+1][j], dp[i][j])

for i in range(MAXV+1)[::-1]:
    if dp[N][i] <= W:
        print(i)
        exit()


Measured memory_bytes: 312664
#include <iostream>
#include <queue>
#include <utility>
#define inf 1000000000

using namespace std;
typedef pair<int, int> P;

int H, W;
char c[1005][1005];
int dist[1005][1005];
const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1};

void bfs()
{
	queue<P> Q;
	
	for(int y = 1; y <= H; y++){
		for(int x = 1; x <= W; x++){
			dist[x][y] = inf;
			if(c[x][y] == '#'){
				dist[x][y] = 0;
				Q.push(make_pair(x, y));
			}
		}
	}
	
	int x, y, nx, ny;
	while(Q.size()){
		x = Q.front().first, y = Q.front().second;
		Q.pop();
		for(int i = 0; i < 4; i++){
			nx = x + dx[i], ny = y + dy[i];
			if(nx < 1 || nx > W || ny < 1 || ny > H) continue;
			if(c[nx][ny] != '.') continue;
			if(dist[nx][ny] < inf) continue;
			Q.push(make_pair(nx, ny));
			dist[nx][ny] = dist[x][y] + 1;
		}
	}
}

int main(void)
{
	cin >> H >> W;
	for(int y = 1; y <= H; y++){
		for(int x = 1; x <= W; x++){
			cin >> c[x][y];
		}
	}
	
	bfs();
	
	int ans = 0;
	for(int y = 1; y <= H; y++){
		for(int x = 1; x <= W; x++){
			ans = max(ans, dist[x][y]);
		}
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 13328
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <random>
#include <time.h>
using namespace std;
int main() {
	long long int a, b, c,d;
	cin >> a >> b >> c;
	for (int i = 1; i < b; i++) {
		d = a*i;
		if (d%b == c) {
			cout << "YES"<<endl;
			return 0;
		}
	}
	cout << "NO" << endl;
}

Measured memory_bytes: 256
//#pragma once
#include <stdio.h>
#include <string>
#include <iostream>
#include <queue>
#include <algorithm>
#include <sstream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <numeric>
#include<bitset>

using namespace std;
#define modd 1000000007


typedef pair<long long, long long> pl;



#define ll long long




/*
class UnionFind {
public:
	vector <ll> par; 
	vector <ll> siz;
	vector <ll> gr;

	// Constructor
	UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) ,gr(sz_){
		for (ll i = 0; i < sz_; ++i) par[i] = i; 
	}
	void init(ll sz_) {
		par.resize(sz_);
		siz.assign(sz_, 1LL);  // resize だとなぜか初期化されなかった
		for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
	}

	// Member Function
	// Find
	ll root(ll x) { // 根の検索
		while (par[x] != x) {
			x = par[x] = par[par[x]]; // x の親の親を x の親とする
		}
		return x;
	}

	// Union(Unite, Merge)
	bool merge(ll x, ll y) {
		x = root(x);
		y = root(y);
		if (x == y) return false;

		// merge technique（データ構造をマージするテク．小を大にくっつける）
		if (siz[x] < siz[y]) swap(x, y);
		siz[x] += siz[y];
		par[y] = x;
		return true;
	}



	bool issame(ll x, ll y) { // 連結判定
		return root(x) == root(y);
	}

	ll size(ll x) { // 素集合のサイズ
		return siz[root(x)];
	}


};*/


long long N, M, K, a, b, c, d,e, H, W;
long long A[100][2005] = {};
long long B[200005] = {};
long long C[200005] = {};
long long BB[200005] = {};
long long CC[200005] = {};
bool f, ff;
string S[2];
set <long long>sll;
pl bufpl;
vector <long long>vl[100005];
vector <pl>vpl[20];
vector <string> vs[20];
set<ll> llset;

struct ST
{
	long long Kati;
	int bangou;

	bool operator<(const ST& another) const
	{
		return Kati < another.Kati;//比較
	};

};



vector <ST> vst;
ST st[200005];
ST bufst;
bitset<5000> bits;

char ch[100][100];

int main() {


	cin >> H>>W;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cin >> ch[i][j];
		}
	}

	for (int i = 0; i < H; i++) {
		for (int j = W-1; j >=0; j--) {
			if (ch[i][j] == '#') {
				B[i] = j;
				break;
			}
		}
	}

	for (int i = 0; i < H; i++) {
		for (int j = 0; j <W; j++) {
			if (ch[i][j] == '#') {
				BB[i] = j;
				break;
			}
		}
	}

	for (int j = 0; j < W; j++) {
		for (int i = H-1; i >=0; i--) {
			if (ch[i][j] == '#') {
				C[j] = i;
				break;
			}
		}
	}

	for (int j = 0; j < W; j++) {
		for (int i = 0; i <H; i++) {
			if (ch[i][j] == '#') {
				CC[j] = i;
				break;
			}
		}
	}

	f = true;

	for (int i = 0; i < H; i++) {
		for (int j = i + 1; j < H; j++) {
			if (BB[j] < B[i]) {
				f = false;
			}
		}
	}

	for (int i = 0; i < W; i++) {
		for (int j = i + 1; j < W; j++) {
			if (CC[j] < C[i]) {
				f = false;
			}
		}
	}
	
	if (f) {
		cout << "Possible" << endl;
	}
	else {
		cout << "Impossible" << endl;
	}
	return 0;

}


Measured memory_bytes: 8448
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(int)(n); ++i)

using namespace std;
int main(){
    int n;
    int toint[256];
    for(int i = 0; i < 10; i++){
        toint[i + '0'] = i;
    }
    for(int i = 0; i < 26; i++){
        toint[i + 'A'] = 10 + i;
    }
    for(int i = 0; i < 26; i++){
        toint[i + 'a'] = 36 + i;
    }
    scanf("%d", &n);
    const int BUF_SIZE = 4194304;
    char buf[BUF_SIZE];
    fread(buf, sizeof(char), BUF_SIZE, stdin);
    int sum = 0;
    int idx = 0;
    for(int i = 0; i < n; i++){
        int p = 0;
        for(; buf[idx] != ' '; idx++){
            p = p * 10 + buf[idx] - '0';
        }
        idx++;
        int x = 0;
        for(; buf[idx] != '\n'; idx++){
            x = x * p + toint[buf[idx]];
        }
        idx++;
        sum = sum ^ x;
    }
    if(sum == 0){
        cout << "lose" << endl;
    }else{
        cout << "win" << endl;
    }
    return 0;
}

Measured memory_bytes: 3964
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return;std::cout << e << std::endl;}
template<class T> void DEBUG(string str, T e){if(DEBUG_OUT == false)return;std::cout <<str << ">>" << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == 1)return;for(const auto& v : vv){ DEBUG(v); } }
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
template<typename T> void SORT_(vector<int>& v,bool GREATER = 0){if(GREATER == 0)sort(v.begin(),v.end());else{sort(v.begin(),v.end(),std::greater<T>());}}


void solve(void)
{  
  string A,B;
  cin>>A>>B;
  string X = A + B;
  int Z = stoi(X);
  int K = sqrt(Z);
  if(K*K == Z)
  {
    cout<<"Yes"<<endl;
  }  
  else
  {
    cout<<"No"<<endl;
  }
  return;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(9);
  solve();

 
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <cstring>
#include <climits>
#include <queue>
#include <map>
#include <sstream>
using namespace std;

#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define EPS 1e-9

int main(){
	int n;
	int data[21];
	while(cin>>n,n){
		int ret = INT_MAX;
		rep(i,n)cin>>data[i];
		rep(i,(1<<n)){
			int a=0,b=0;
			for(int j=0; j<n; j++){
				if( i&(1<<j) ){
					a += data[j];
				}else{
					b += data[j];
				}
			}
			ret = min(ret, abs(a-b));
		}
		printf("%d\n",ret);
	}
	return 0;
}

Measured memory_bytes: 868
#include <bits/stdc++.h>
using namespace std;
#define int         long long
#define mp          make_pair
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
// #define vb          vector<bool>
// #define vc          vector<char>
#define vii         vector<pii>
//#define mi          map<int,int>
//#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (int)x.size()
// #define ub(x)       upper_bound(x)
// #define lb(x)       lower_bound(x)
#define endl        '\n'
#define file        freopen("b1.in","r",stdin);freopen("output.txt","w",stdout)
#define fastio      ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
// #define N            1e5+5
// #define M           1e9+7
#define MAX         50000
#define mem0(a)     memset(a,0,sizeof(a))
#define prec        cout<<std::setprecision(9)<<std::fixed
#define forn(i,a,b)  for(int i=a;i<b;i++)
#define pi          3.14159265358979323

struct cmp { 
    bool operator() (pii a,pii b){
        return ((a.F-a.F/2)*a.S)<((b.F-b.F/2)*b.S);
    }
};

const int N=1e6+1;
// int n,m,k;
int cnt[N],all;
const int MOD=1e9+7;

void Anon_mouS(){
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        int x;
        cin>>x;
        cnt[x]++;
        all=__gcd(all,x);
    }
    bool ok=true;
    for(int i=2;i<N and ok; i++){
        int sum=0;
        for(int j=i;j<N;j+=i)sum+=cnt[j];
        if(sum>1)ok=false;
    }
    if(ok)cout<<"pairwise coprime"<<endl;
    else{
        if(all==1)cout<<"setwise coprime"<<endl;
        else cout<<"not coprime"<<endl;
    }
}
int32_t main(){
    fastio;
    int q=1;
    // sieve();
    // cin>>q;
    for(int it=1;it<=q;it++){
        // cout<<"Case #"<<it<<": ";
        Anon_mouS();
    }
    return 0;   
}

Measured memory_bytes: 11484
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
using namespace std;

int c[26], tmp[26];

int main()
{
    int n;
    cin >> n;
    fill(c, c+26, -1);
    for(int i=0; i<n; i++){
        string s;
        cin >> s;
        fill(tmp, tmp+26, 0);
        for(int j=0; j<s.size(); j++){
            tmp[s[j]-'a']++;
        }
        for(int j=0; j<26; j++){
            if(c[j]==-1){
                c[j]=tmp[j];
                tmp[j]=0;
            }else{
                c[j]=min(c[j], tmp[j]);
            }
        }
    }
    for(int i=0; i<26; i++){
        for(int j=0; j<c[i]; j++){
            cout << char('a'+i);
        }
    }
    
    return 0;
}


Measured memory_bytes: 376
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fi first
#define se second
#define pb push_back
#define rep(i, s, n) for (int i = s; i < n; i++)
#define rrep(i, s, n) for (int i = (n)-1; i >= (s); i--)
#define all(a) a.begin(),a.end()
const long long MOD = 1e9+7, INF = 1e18;
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 N,M;
vector<int>a,b;
int sa[60],sb[60];
int dp[55][55][55][55][2][2];

int f(int anow,int bnow,int asta,int bsta,int turn,int pass){
	if(pass==2)return 0;
	if(turn%2&&dp[anow][bnow][asta][bsta][turn][pass]!=INF)return dp[anow][bnow][asta][bsta][turn][pass];
	else if(turn%2==0&&dp[anow][bnow][asta][bsta][turn][pass]!=-INF)return dp[anow][bnow][asta][bsta][turn][pass];
	int&t = dp[anow][bnow][asta][bsta][turn][pass];
	if(turn%2==0){
		if(asta-anow||bsta-bnow)chmax(t,f(asta,bsta,asta,bsta,turn^1,0)+sa[asta]-sa[anow]-(sb[bsta]-sb[bnow]));
		else chmax(t,f(asta,bsta,asta,bsta,turn^1,pass+1)+sa[asta]-sa[anow]-(sb[bsta]-sb[bnow]));
		if(asta<N){
			if(a[asta]==-1)chmax(t,f(anow,bsta,asta+1,bsta,turn^1,0));
			else chmax(t,f(anow,bnow,asta+1,bsta,turn^1,0));
		}
	}else{
		if(asta-anow||bsta-bnow)chmin(t,f(asta,bsta,asta,bsta,turn^1,0)+sa[asta]-sa[anow]-(sb[bsta]-sb[bnow]));
		else chmin(t,f(asta,bsta,asta,bsta,turn^1,pass+1)+sa[asta]-sa[anow]-(sb[bsta]-sb[bnow]));
		if(bsta<M){
			if(b[bsta]==-1)chmin(t,f(asta,bnow,asta,bsta+1,turn^1,0));
			else chmin(t,f(anow,bnow,asta,bsta+1,turn^1,0));
		}
	}
	return t;
}

signed main(){
	cin>>N>>M;
	a.resize(N);
	b.resize(M);
	rep(i,0,N){
		cin>>a[i];
		sa[i+1] += sa[i] + a[i]*(a[i]!=-1);
	}
	rep(i,0,M){
		cin>>b[i];
		sb[i+1] += sb[i] + b[i]*(b[i]!=-1);
	}
	rep(i,0,55)rep(j,0,55)rep(k,0,55)rep(l,0,55)
		rep(m,0,2)rep(n,0,2){
			if(m%2)dp[i][j][k][l][m][n] = INF;
			else dp[i][j][k][l][m][n] = -INF;
		}
	cout<<f(0,0,0,0,0,0)<<endl;
}


Measured memory_bytes: 289096
//shan61916
#include <bits/stdc++.h>
  using namespace std;
typedef   long long ll;
typedef   unsigned long long ull ;
typedef   double dll ;

#define   mp make_pair
#define   pb push_back
#define   ff first 
#define   ss second
#define   IOS ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define   endl "\n" 
#define   pll pair<ll, ll>
#define   all(x) x.begin(), x.end()
#define   vll vector<ll> 

const ll inf = (ll)(1e17 + 17);
const ll mod = (ll)(1e9 + 7);

ll modadd(ll x, ll y){return (x%mod + y%mod)%mod;}
ll modmul(ll x, ll y){return (x%mod * y%mod)%mod;}
ll modsub(ll x, ll y){return (x%mod - y%mod + mod)%mod;}
// ll moddiv(ll x, ll y){return modmul(x, fast_exp(y, mod-2));}

ll n;
vector<vll> adj(100100);
ll dp[100010][3];
ll dfs(ll idx, ll parent, ll color) {
  ll &ans = dp[idx][color];
  if(ans != -1) return ans;
  ans = 1;
  for(auto it: adj[idx]) {
    if(it == parent) continue;
    if(color == 0)ans = modmul(ans, dfs(it, idx, color^1)); 
    else if(color == 1) {
      ans = modmul(ans, modadd(dfs(it, idx, color), dfs(it, idx, color^1)));
    }
  }
  return ans;
}
int main(){
 IOS
#ifdef SHAN
    freopen("input.txt" , "r" , stdin);  
#endif
  cin >> n;
  for(ll i = 0; i < n - 1; i++) {
    ll x, y;
    cin >> x >> y;
    adj[x].pb(y);
    adj[y].pb(x);
  }
  memset(dp, -1, sizeof dp);
  ll ans = 0;
  ans = modadd(dfs(1, -1, 1), ans);
  ans = modadd(dfs(1, -1, 0), ans);
  cout << ans << endl;
  return 0;
} //good night.

Measured memory_bytes: 14976
using System;
using System.Collections.Generic;
using System.Text;

namespace AOJ
{
    class Program
    {
        static void Main(string[] args)
        {
            var inputLine = Console.In.ReadLine();
            var r = double.Parse(inputLine);

            var area = r * r * Math.PI;
            var circumference = 2 * r * Math.PI;

            Console.WriteLine("{0:0.000000} {1:0.000000}", area, circumference);
        }
    }
}


Measured memory_bytes: 15940
#include<iostream>
using namespace std;
int main(){
	string red[101],blue[101];
	int r=0,b=0;
	int ans[102]={0};
	int N,M;
	cin>>N;
	for(int i=0;i<N;i++){
		cin>>red[i];
	}
	cin>>M;
	for(int i=0;i<M;i++){
		cin>>blue[i];
	}
	for(int i=0;i<N;i++){
		r=0,b=0;
		for(int j=0;j<N;j++){
			if(red[i]==red[j]){
				r++;
			}
		}
		for(int j=0;j<M;j++){
			if(red[i]==blue[j]){
				b++;
			}
		}
		ans[i]=r-b;
	}
	int max=-1;
	for(int i=0;i<N;i++){
		if(ans[i]>max){
			max=ans[i];
		}
	}
	if(max<0){
		cout<<"0"<<endl;
	}else{
		cout<<max<<endl;
	}
	
	
	
	
	
	return 0;
}

Measured memory_bytes: 256
function main(input) {
  // 1行目がinput[0], 2行目がinput[1], …に入る
  input = input.split(' ')
  const a = parseInt(input[0], 10)
  const b = parseInt(input[1], 10)
  const ans = a * b
  if (ans % 2 === 0) {
    console.log('Even')
  } else {
    console.log('Odd')
  }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 7372
#include <bits/stdc++.h>
#define lsb(x) (x & (-x))
#define ll long long
#define ull unsigned long long
// 217
// 44

using namespace std;


int main() {
    //ifstream cin("A.in");
    //ofstream cout("A.out");
    int i, n, a, k;
    ios::sync_with_stdio(false);
    cin >> n;
    int ans = 0;
    for(i = 1; i <= n; i++) {
        cin >> a >> k;
        while(a % k > 0 && a > k) {
            int d = a / k;
            a -= 1LL * (d + 1) * ((a - 1LL * d * k + d) / (d + 1));
        }
        ans ^= (a / k);
    }
    if(ans == 0)
        cout << "Aoki";
    else
        cout << "Takahashi";
    //cin.close();
    //cout.close();
    return 0;
}


Measured memory_bytes: 256
x1,y1,x2,y2 = map(int, input().split())

x3 = y1 - y2 + x2
y3 = -x1 + x2 + y2

x4 = y2 - y3 + x3
y4 = -x2 + x3 + y3

print (x3,y3,x4,y4)

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
typedef long long lint;
int n,sum;
bool vld[(int)1e4+5];

namespace utils{
	template <class T> inline void apn(T &x,const T y){x>y?x=y:0;}
	template <class T> inline void apx(T &x,const T y){x<y?x=y:0;}
	inline int nxi(){
		int x=0;
		char c;
		while(((c=getchar())>'9'||c<'0')&&c!='-');
		const bool f=(c=='-')&&(c=getchar());
		while(x=x*10-48+c,(c=getchar())>='0'&&c<='9');
		return f?-x:x;
	}
}
using namespace utils;

int main(){
	vld[0]=1;
	for(int i=nxi(); i; --i){
		int x=nxi();
		for(int j=sum; ~j; --j){
			vld[j+x]|=vld[j];
		}
		sum+=x;
	}
	int ans=sum;
	while(ans>0&&(ans%10==0||!vld[ans])) --ans;
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<tr1/unordered_map>
using namespace std;
typedef long long ll;
#define pb push_back
const ll INF=1e18;
const int inf=0x3f3f3f3f;
const int M=4444;
void py(){
    cout<<"Yes"<<'\n';
}
void pn(){
    cout<<"No"<<'\n';
}
char s[4444];
int r[M],g[M],b[M],sufb[M],sufr[M],sufg[M];
int main(){
    int n;
    scanf("%d%s",&n,s+1);
    for(int i=1;i<=n;i++)
        if(s[i]=='R')
            r[i]=1;
        else if(s[i]=='G')
            g[i]=1;
        else
            b[i]=1;
    for(int i=n;i>=1;i--)
        sufb[i]=sufb[i+1]+b[i],sufr[i]=sufr[i+1]+r[i],sufg[i]=sufg[i+1]+g[i];
    ll ans=0;
    for(int i=1;i<=n;i++){
        if(s[i]=='G'){
            for(int j=i+1;j<=n;j++){
                if(s[j]=='G')
                    continue;
                if(s[j]=='R'){///grb
                    ans+=sufb[j+1];
                    if(j+(j-i)<=n){
                        ans-=b[j+(j-i)];
                    }
                }
                else{///gbr
                    ans+=sufr[j+1];
                    if(j+(j-i)<=n){
                        ans-=r[j+(j-i)];
                    }
                }

            }
        }
        else if(s[i]=='B'){
            for(int j=i+1;j<=n;j++){
                if(s[j]=='B')
                    continue;
                if(s[j]=='R'){///brg
                    ans+=sufg[j+1];
                    if(j+(j-i)<=n){
                        ans-=g[j+(j-i)];
                    }
                }
                else{///bgr
                    ans+=sufr[j+1];
                    if(j+(j-i)<=n){
                        ans-=r[j+(j-i)];
                    }
                }

            }
        }
        else{
            for(int j=i+1;j<=n;j++){
                if(s[j]=='R')
                    continue;
                if(s[j]=='G'){///rgb
                    ans+=sufb[j+1];
                    if(j+(j-i)<=n){
                        ans-=b[j+(j-i)];
                    }
                }
                else{///rbg
                    ans+=sufg[j+1];
                    if(j+(j-i)<=n){
                        ans-=g[j+(j-i)];
                    }
                }

            }
        }
    }
    printf("%lld\n",ans);
    return 0;
}


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

#define int             long long
#define FOR( i, m, n )  for( int (i) = (m); (i) < (n); (i)++ )
#define REP( i, n )     FOR( i, 0, n )
#define REPR( i, m )    for( int (i) = (m); (i) >= 0; (i)-- )
#define REPONE( i, n )  FOR( i, 1, n + 1 )
#define ALL( a )        (a).begin(), (a).end()
#define MP              make_pair

using namespace std;
using P = pair<int, int>;

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( a > b ) { a = b; return 1; } return 0; }

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

signed main(){
    int a; cin >> a;
    string s; cin >> s;

    if( a >= 3200 ) cout << s << endl;
    else cout << "red" << endl;
}

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

int main() {
	int a, b, ave;
	cin >> a >> b;
  	ave = (a + b) /2;
  	if((a + b) % 2 > 0)
  	cout << ave + 1<< endl;
  	else
    cout << ave << endl;
}

Measured memory_bytes: 256
/**
 * Created by kaki on 2017/04/17.
 */

import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        Scanner scan = new Scanner(System.in);
        int a = Integer.parseInt(scan.next());
        int b = Integer.parseInt(scan.next());
        int c = Integer.parseInt(scan.next());
        if (a < b && b < c) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    }
}

Measured memory_bytes: 26236
import java.io.IOException;
import java.io.InputStream;
import java.util.*;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		String s = sc.next();
		StringBuilder sb = new StringBuilder();
		long sum = 0;
		for (int i = 0; i < s.length(); i++) {
			if (s.charAt(i) == 'A') {
				sb.append('A');
			} else if (i != s.length() - 1 && s.charAt(i) == 'B' && s.charAt(i + 1) == 'C') {
				sb.append('D');
				i++;
			} else {
				int a = 0;
				for (int j = 0; j < sb.length(); j++) {
					if (sb.charAt(j) == 'A') {
						a++;
					} else if (sb.charAt(j) == 'D') {
						sum += a;
					}
				}
				sb = new StringBuilder();
			}
		}
		int a = 0;
		for (int j = 0; j < sb.length(); j++) {
			if (sb.charAt(j) == 'A') {
				a++;
			} else if (sb.charAt(j) == 'D') {
				sum += a;
			}
		}

		System.out.println(sum);
	}
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;
	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}
	private int readByte() {
		if (hasNextByte()) {
			return buffer[ptr++];
		} else {
			return -1;
		}
	}
	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}
	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
			ptr++;
		}
		return hasNextByte();
	}
	public String next() {
		if (!hasNext()) {
			throw new NoSuchElementException();
		}
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	public long nextLong() {
		if (!hasNext()) {
			throw new NoSuchElementException();
		}
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || Integer.MAX_VALUE < nl) {
			throw new NumberFormatException();
		}
		return (int) nl;
	}
	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

Measured memory_bytes: 35924
#include <iostream>
#include <algorithm>
using namespace std;
bool isStraight(int* a)
{
	if(a[0]==1&&a[1]==10&&a[2]==11&&a[3]==12&&a[4]==13) return true;
	for(int i=1;i<5;i++) if(a[i]!=a[i-1]+1) return false;
	return true;
}
int main()
{
	int a[5]; char ch;
	while(cin >> a[0] >> ch >> a[1] >> ch >> a[2] >> ch >> a[3] >> ch >> a[4])
	{
		int sum=1; int pair=0;
		sort(a,a+5);
		for(int i=1;i<5;i++)
		{
			int tmp=1;
			while(i<5 && a[i-1]==a[i]) {tmp++; i++;}
			sum=max(tmp,sum);
		}
		bool flag=true;
		for(int i=1;i<5;i++)
		{
			if(flag && a[i-1]==a[i]) {pair++; flag=false;}
			else flag=true;
		}
		if(sum==4) cout << "four card" << endl;
		else if(sum==3 && pair==2) cout << "full house" << endl;
		else if(isStraight(a)) cout << "straight" << endl;
		else if(sum==3) cout << "three card" << endl;
		else if(pair==2) cout<< "two pair" << endl;
		else if(pair==1) cout << "one pair" << endl;
		else cout << "null" << endl;
	}
}

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

int digit(long long n){
  string s = to_string(n);
  return (int)s.size();
}

int main() {
  long long N;
  cin >> N;
  int ans = 1000000;
  
  for (long long A = 1; A < sqrt(N) + 10; A++){
    if (N % A) continue;
    long long B = N / A;
    ans = min(ans, max(digit(A), digit(B)));
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 3712