akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#define NIL -1
#define INF 1000000
#define WHITE -46
#define BLACK -96

int G[101][101];
int d[101];
int pi[101];
int color[101];
int n,r=0;

void prim(int);

int main(){
  int i,j,t=0;

  scanf("%d",&n);

  for(i=1; i <= n; i++){
    for(j=1; j <= n; j++){
      scanf("%d",&G[i][j]);
    }
  }

  prim(1);

  for(i=1; i <= n; i++){
    t += d[i];
  }

  printf("%d\n",t);

  return 0;
}

void prim(int r){
  int i,u,v,mincost;
  
  for(u=1; u <= n; u++){
    d[u] = INF;
    pi[u] = NIL;
    color[u] = WHITE;
  }
  
  d[r] = 0;

  while(1){
    mincost = INF;
    for(i=1; i <= n; i++){
      if(color[i] != BLACK && d[i] < mincost){
	mincost = d[i];
	u = i;
      }
    }
    if(mincost == INF){
      break;
    }
    color[u] = BLACK;
    for(v=1; v <= n; v++){
      if(color[v] != BLACK && G[u][v] < d[v] && G[u][v] != NIL){
	pi[v] = u;
	d[v] = G[u][v];
      }
    }
  }
}



Measured memory_bytes: 2048
numbers = []
n = int(raw_input())
s = raw_input()
count = 0

numbers = s.split(" ")
for i in range(int(n)):
	numbers[i] = int(numbers[i])

for i in range(int(n)):
	minj = i
	for j in range (i, n):
		if numbers[j] < numbers[minj]:
			minj = j
	if i != minj:	
	    numbers[i], numbers[minj] = numbers[minj], numbers[i]
	    count += 1

print ' '.join([str(a) for a in numbers])
print count 

Measured memory_bytes: 6352
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
const int INF=1e9;
const int MOD=1e9+7;
const double pi=acos(-1);

int main(){
  int n;
  cin >> n;
  vector<string>vec(n);
  rep(i,n) cin >> vec[i];
  vector<vector<int>>al(n,vector<int>(26));
  rep(i,n){
    rep(j,26){
      al[i][j]=0;
    }
  }
  rep(i,n){
    rep(j,vec[i].size()){
      al[i][vec[i][j]-'a']++;
    }
  }
  string ans="";
  rep(i,26){
    int sum=INF;
    rep(j,n){
      sum=min(sum,al[j][i]);
    }
    rep(j,sum){
      ans+=char('a'+i);
    }
  }
  cout << ans << endl;
  
}


Measured memory_bytes: 256
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

void chmin(T)(ref T x, T y) { x = min(x, y); } void chmax(T)(ref T x, T y) { x = max(x, y); }
bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
T lcm(T)(T x, T y) { return x * (y / gcd(x, y)); }

//long mod = 10^^9 + 7;
long mod = 998_244_353;
//long mod = 1_000_003;
void moda(T)(ref T x, T y) { x = (x + y) % mod; }
void mods(T)(ref T x, T y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(T)(ref T x, T y) { x = (x * y) % mod; }
void modpow(T)(ref T x, T y) { if (!y) { x = 1; return; } auto t = x; x.modpow(y>>1); x.modm(x); if (y&1) x.modm(t); }
void modd(T)(ref T x, T y) { x.modm(y.modpow(mod - 2)); }

void main()
{
	auto N = RD;
	if (N % 10 == 3)
	{
		writeln("bon");
	}
	else if (N % 10 == 0 || N % 10 == 1 || N % 10 == 6 || N % 10 == 8)
	{
		writeln("pon");
	}
	else
	{
		writeln("hon");
	}
	stdout.flush;
	debug readln;
}

Measured memory_bytes: 2704
from collections import *
from heapq import*
import sys
input=lambda:sys.stdin.readline()


def BFS(point,d):
    cost=[1e7]*(n+1)
    cost[point]=0
    Q=[]
    heappush(Q,(0,point))
    
    while Q:
        c,p=heappop(Q)
        for np in d[p]:
            if cost[np]==1e7:
                cost[np]=c+1
                heappush(Q,(c+1,np))
    return cost

n=int(input())
d=[[]for i in range(n+1)]

for i in range(n-1):
    a,b=map(int,input().split())
    d[a].append(b)
    d[b].append(a)

x=BFS(1,d)[1:]
y=BFS(n,d)[1:]

#print(x,y)

F=0
S=0

for s,t in zip(x,y):
    if s<=t:
        F+=1
    else:
        S+=1

if F<=S:
    print("Snuke")
else:
    print("Fennec")


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

int main() {
    int x, a, b;
    cin >> x >> a >> b;
    string ans;
    if (b-a <= 0) ans = "delicious";
    else if (b-a <= x) ans = "safe";
    else ans = "dangerous";
    cout << ans << endl;
}

Measured memory_bytes: 256
A = int(input())
B = int(input())
C = int(input())
X = int(input())

count = 0

for i in range(A+1):
#    print(i)
    for j in range(B+1):
#        print(j)
        for k in range(C+1):
            if X == 500*i + 100*j +50*k:
                count += 1

print(count)


Measured memory_bytes: 3068
#include <bits/stdc++.h>
using namespace std;
#define LL long long 
#define LLU long long unsigned
#define rarr(arr, n) for(int aab = 0; aab < n; aab++){cin >> arr[aab];}
#define parr(arr, n) for(int aab = 0; aab < n; aab++){cout << arr[aab] << " ";}
#define pb push_back
#define f first
#define s second
#define all(x) x.begin(), x.end()
#define debug(x) cout << #x << " = " << x << "\n";

#define freopen freopen("in.txt", "r", stdin);freopen("out.txt", "w", stdout);ios_base::sync_with_stdio(0);cin.tie(0);

int main(){
	long long int n, m, k, aa = 0, bb = 0, sum = 0, counter = 0;
	cin >> n >> m >> k;
	long long int a[n], b[m];
	rarr(a, n);
	rarr(b, m);
	while(aa < n && sum + a[aa] <= k){
        sum += a[aa];
        aa++;
    }
    counter = aa;

    while(bb < m && aa >= 0){
        sum += b[bb];             
        bb++;
        while(sum > k && aa > 0){
            aa--;
            sum -= a[aa];
        }
        if(sum <= k && aa + bb > counter){
            counter = aa + bb;
        }
    }
    cout << counter;
}

Measured memory_bytes: 6756
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pll;

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

    string s,t;

    cin >> s >>t;
    string answer;

    for(int i = 0;i <n; i++){
        answer += s.at(i);
        answer += t.at(i);
    }

    cout << answer << endl;
}


Measured memory_bytes: 256
#if defined(LOCAL)
#define PROBLEM_NAME "C"
const double _max_double_error = 1e-9;
#include "testutils.h"
#endif
#include <bits/stdc++.h>

using namespace std;

using vi = vector<int>; using vvi = vector<vi>;
using ii = pair<int,int>; using vii = vector<ii>;
using l = long long; using vl = vector<l>; using vvl = vector<vl>;
using ll = pair<l,l>; using vll = vector<ll>; using vvll = vector<vll>;
using lu = unsigned long long;
using vb = vector<bool>; using vvb = vector<vb>;
using vd = vector<double>; using vvd = vector<vd>;
using mll = unordered_map<l, l>;
const l INF = numeric_limits<int>::max();
const double EPS = 1e-10; static constexpr auto PI = acos(-1);
const l e0=1, e3=1000, e5=100000, e6=10*e5, e7=10*e6, e8=10*e7, e9=10*e8;
const char lf = '\n';
#define all(x) begin(x), end(x)
#define F(a,b,c) for (l a = l(b); a < l(c); a++)
#define B(a,b,c) for (l a = l(b); a > l(c); a--)

#if defined(LOCAL)
bool local = true;
#define L(x...) debug(x)
#else
bool local = false;
#define L(x, ...) (x)
#endif
struct VoidStream { void operator&(std::ostream&) { } };
#define LOG !(local) ? (void) 0 : VoidStream() & cerr

l f(vl& v, l a, l b, l K) { // [a, b)
  if (a >= b) return 0;
  if (b - a == 1) return (v[a] >= K) ? 1 : 0;
  l m = a + (b - a) / 2;
  vl left, right;
  l t = 0, j = 0;
  l r = f(v, a, m, K) + f(v, m, b, K);
  B(i, m - 1, a - 1) {
    t += v[i];
    j++;
    left.emplace_back(K * j - t);
  }
  sort(all(left)); // TODO: remove?
  t = 0; j = 0;
  F(i, m, b) {
    j++;
    t += v[i];
    right.emplace_back(t - K * j);
  }
  sort(all(right));
  for (auto i : left) {
    auto p = lower_bound(all(right), i);
    r += distance(p, right.end());
  }
  return r;
}

void solve(istream& in, ostream& out) {
  l N, K;
  while (in >> N >> K) {
    vl v(N); F(i, 0, N) in >> v[i];
    l answer = f(v, 0, N, K);
    out << answer << lf;
  }
}

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
  cout << fixed << setprecision(15);
#if defined(LOCAL)
  maybe_run_tests(cin, cout);
#else
  solve(cin, cout);
#endif
}


Measured memory_bytes: 4168
#include "bits/stdc++.h"
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long int
// #define int ll
//#define slld(t) scanf("%lld",&t)
//#define sd(t) scanf("%d",&t)
//#define pd(t) printf("%d\n",t)
//#define plld(t) printf("%lld\n",t)
#define vec vector < int >
#define vecp vector < pair < int , int > >
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define debug(x)   cerr<<#x<<": "<<x<<endl
#define pii pair < int , int >
#define pll pair < ll , ll > 
#define debug(x)   cerr<<#x<<": "<<x<<endl
#define mod  1000000007
#define N   100005
#define MAX 300005
#define mod1 1000000007
#define mod2 998244353
#define bitcnt __builtin_popcount
#define PI acos(-1)
//#define endl "\n"
 
const ll inf = (ll)1e18 + 10;
const int maxn = 500;
const int maxl = 500;


signed main(){
  fast;
  
   string s;
   cin >> s;
   vec v;
   int cnt = 1 , ans = 0;
   int n = s.length();
   for(int i = 0 ; i < n-1 ; i++){
         if(s[i] == s[i+1])
          cnt++;
        else{
          v.pb(cnt);
          cnt = 1;
        }
   }
   v.pb(cnt);

   for(int i = 0 ; i <  v.size() ; i++){
   
        int x = v[i] % 3;
        if(x == 1 )
          ans += 2*(v[i]/3) + 1;
        else if(x == 2){
          if(i == v.size() - 1)
            ans += 2*(v[i]/3) + 1;
          else
            ans += 2*(v[i]/3) + 2 , v[i+1] -=1;
          
        }
        else{
            ans += 2*(v[i]/3);
        }
        

   }
   // cout << endl;
   cout << ans << endl;



  
 
}

Measured memory_bytes: 1680
//============================================================================
// Name        : d.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main() {

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

	vector<int> plusall,minusall;
	for(int i=0;i<n;i++){
		if(d[i]>=0){
			plusall.push_back(d[i]);
		}else{
			minusall.push_back(d[i]);
		}
	}
	int ans=0;

	for(int i=0;i<=n;i++){
		vector<int> l(n),r(n);
		for(int j=0;j<=n;j++){
			if(i+j>k)continue;
			vector<int> minus,plus;
			if(i+j>=n){
				minus=minusall;
				plus=plusall;
			}else{
				for(int i2=0;i2<i;i2++){
					int temp=d[i2];
					if(temp>=0){
						plus.push_back(temp);
					}else{
						minus.push_back(temp);
					}
				}
				for(int j2=0;j2<j;j2++){
					int temp=d[n-1-j2];
					if(temp>=0){
						plus.push_back(temp);
					}else{
						minus.push_back(temp);
					}
				}
			}
			int resk=k-i-j;
			int plussum=0;
			for(int m=0;m<plus.size();m++){
				plussum+=plus[m];
			}
			int minussum=0;

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

			for(int m=resk;m<minus.size();m++){
				minussum+=minus[m];
			}
			ans=max(ans,plussum+minussum);
//			cout<<i<<' '<<j<<endl;
//			cout<<plussum<<' '<<minussum<<endl;


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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define EPS (1e-10)
#define equals(a, b) (fabs((a)-(b)) < EPS)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<double> vd;
typedef pair<double,double> PD;
typedef pair<int,P> ed;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  
int main() {
  int N;
  cin >> N;
  v(string) s(N);
  rep(i,N) {
    cin >> s[i];
  }
  rep(i,N-1) {
    if(s[i+1][0] != s[i].back()) {
      cout << "No" << endl;
      return 0;
    }
  }
  sort(rng(s));
  uni(s);
  if(sz(s)<N) {
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define INCANT cin.tie(0), ios::sync_with_stdio(false), cout << fixed << setprecision(20);
#define int long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define _overload(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(...) _overload(__VA_ARGS__, repi, _rep)(__VA_ARGS__)
#define _rev(i, n) revi(i, n, 0)
#define revi(i, a, b) for(int i = (int)(a - 1); i >= (int)(b); i--)
#define rev(...) _overload(__VA_ARGS__, revi, _rev)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
void in(){}
template<typename F, typename... R>
bool in(F& f, R&... r){
    if(cin >> f){in(r...);return true;}
    else return false;
}
#define out(x) cout << (x)
#define space() cout << " "
#define indent() cout << '\n'
void print(){}
template<typename F, typename... R>
void print(F f, R... r){out(f), indent(), print(r...);}
#define debughead(x) cerr << "Line " << __LINE__ << ": " << #x << ": "
#define debugout(x) cerr << (x) << " "
#define debugindent() cerr << '\n'
#define debug(x) debughead(x), debugout(x), debugindent()
const int INF = 1e18, MOD = 1e9 + 7;
template<typename T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<typename T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}
bool isPrime(int n){
    rep(i, 2, sqrt(n) + 1){
        if(i > 3){
            i++;
        }
        if(!(n % i)){
            return false;
        }
    }
    return true;
}
main(){
    INCANT;
    int n, h, tmp, res = 0;
    string s;
    in(n, h);
    int a[n], b[n];
    rep(i, n){
        in(a[i], b[i]);
    }
    sort(a, a + n, greater<int>());
    sort(b, b + n, greater<int>());
    for(int i = 0; b[i] > a[0] && i < n; i++){
        h -= b[i];
        res++;
        if(h < 1){
            print(res);
            return 0;
        }
    }
    print(res + (h + a[0] - 1) / a[0]);
}


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

int digit(int n) {
  if (0 <= n && n <= 9) {
    return 1;
  } else {
    return digit(n/10) + 1;
  }
}

int main() {
  int N;
  cin >> N;
  int count = 0;
  for (int i = 1; i <= N; i++) {
    if (digit(i) % 2 == 1) {
      count++;
    }
  }
  cout << count << endl;
}

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

class Point{
public:
  int x;
  int y;
  void spin(){
    int xx=x;
    int yy=y;
    x = -yy;
    y = xx;
  }
};

int main(){
  int n;
  while(cin>>n,n){
    vector<vector<Point> > vec(n+1);
    for(int i=0;i<=n;i++){
      int m;
      cin>>m;
      vec[i].resize(m);
      for(int j=0;j<m;j++) cin>>vec[i][j].x>>vec[i][j].y;
    }
    vector<bool> check(n,false);
    for(int i=0;i<4;i++){
      for(int j=1;j<=n;j++){
	for(int r=0;r<2;r++){
	  if((vec[0].size() == vec[j].size()) && !check[j-1]){
	    int diffx = vec[0][0].x - vec[j][0].x;
	    int diffy = vec[0][0].y - vec[j][0].y;
	    bool lock = true;
	    for(int k=1;k<(int)vec[0].size();k++){
	      if((vec[0][k].x - vec[j][k].x != diffx) || (vec[0][k].y - vec[j][k].y != diffy)) lock = false;
	    }
	    if(lock){
	      check[j-1]=true;
	    }
	  }
	  reverse(vec[0].begin(),vec[0].end());
	}
      }
      for(int j=0;j<(int)vec[0].size();j++){
	vec[0][j].spin();
      }
    }
    for(int i=0;i<(int)check.size();i++){
      if(check[i]){
	cout<<i+1<<endl;
      }
    }
    cout<<"+++++"<<endl;
  }
  return 0;
}

Measured memory_bytes: 1204
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#include <time.h>
#define _USE_MATH_DEFINES
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;
typedef complex<double> xy_t;
typedef vector<ll> vll;
typedef vector< vector<ll> > matrix;
#define REP(i, x, y) for(ll i = (ll)x; i < (ll)y; i++)
#define DREP(i, x, y, d) for(ll i = (ll)x; i < (ll)y; i += (ll)d)
#define PER(i, x, y) for(ll i = (ll)x; i > (ll)y; i--)
#define DPER(i, x, y, d) for(ll i = (ll)x; i > (ll)y; i -= (ll)d)
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
int iinf = intmax / 8;
ll inf = llmax / 8;
double eps = 1e-12;

int main() {
    ll num[4];
    fill(num, num + 4, 0);
    REP(i, 0, 3) {
        ll a, b;
        cin >> a >> b;
        num[a - 1]++;
        num[b - 1]++;
    }
    ll odd = 0;
    REP(i, 0, 4) {
        if (num[i] % 2 == 1) {
            odd++;
        }
    }
    if (odd <= 2) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 256
var input = require('fs').readFileSync('/dev/stdin', 'utf8').trim();
var n = Number(input);
process.stdout.write(n + ': '); 
var primes = [];
 
while (n % 2 == 0) {
    primes.push(2);
    n /= 2;
}
while (n % 3 == 0) {
    primes.push(3);
    n /= 3;
}
for (var i = 1; n > 1; i++) {
    var low = i * 6 - 1;
    var high = i * 6 + 1;
    while (n % low == 0) {
        primes.push(low);
        n /= low;
    }
    while (n % high == 0) {
        primes.push(high);
        n /= high;
    }
}

process.stdout.write(primes.join(' ')+"\n");


Measured memory_bytes: 15484
#include <bits/stdc++.h>
using namespace std;
typedef  long long   ll;
typedef  long double ld;
#define ceil(n, m) ((n / m) + ( n % m ? 1 : 0))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	//freopen("input.txt", "r", stdin);
	int n;
	cin >> n;
	int ans = n % 1000;
	if (ans)
		ans = 1000 - ans;
	cout << ans; 


}


Measured memory_bytes: 3640
using System;

namespace Sort
{
    class Progarm
    {
        static void Main()
        {
            int n = int.Parse(Console.ReadLine());
            var a = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            int c = 0;
            for( int i = 0; i < n; i++)
            {
                int m = i;
                for (int j = i; j < n; j++)
                    if (a[j] < a[m]) m = j;
                int t = a[i];
                a[i] = a[m]; a[m] = t;
                if (i != m) c++;
            }
            var r = Array.ConvertAll(a, e => e.ToString());
            Console.Write("{0}\n{1}\n", string.Join(" ", r), c);
        }
    }
}

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

int main() {
  vector<vector<int>> bingo(3,vector<int>(3));
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++){
      cin >> bingo.at(i).at(j);
    }
  }
  int n;
  cin >> n;
  vector<int> number(n);
  for(int i=0;i<n;i++){
    cin >> number.at(i);
  }
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++){
      for(int k=0;k<n;k++){
        if( number.at(k) == bingo.at(i).at(j) ){
          bingo.at(i).at(j) = 0;
        }
      }
    }
  }
  bool x = true;
  for(int i=0;i<3;i++){
    if( bingo.at(i).at(0) == 0 && bingo.at(i).at(1) == 0 && bingo.at(i).at(2) == 0  ){
      cout << "Yes" <<endl;
      x = false;
      break;
    }
    else if( bingo.at(0).at(i) == 0 && bingo.at(1).at(i) == 0 && bingo.at(2).at(i) == 0 ){
      cout << "Yes" <<endl;
      x = false;
      break;
    }
    else if( bingo.at(0).at(0) == 0 && bingo.at(1).at(1) == 0 && bingo.at(2).at(2) == 0 ){
      cout << "Yes" <<endl;
      x = false;
      break;
    }
    else if( bingo.at(2).at(0) == 0 && bingo.at(1).at(1) == 0 && bingo.at(0).at(2) == 0 ){
      cout << "Yes" <<endl;
      x = false;
      break;
    }
  }
  if(x)
    cout << "No" << endl;
}


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

void solve(){
  int N; 
  cin >> N;
  string st; 
  cin >> st;

  int i, j;
  int step = 0;
  i = 1; j = 2;
  while(i < j){
    int i = step;
    int j = N -step-1;

    while(st[i] != 'W' && i < N) i++;
    while(st[j] != 'R' && j >= 0) j--;

    if(i > j) break;
    char tmp = st[i];
    st[i] = st[j]; 
    st[j] = tmp;
    step++;
  }
  cout << step << endl;
}

int main(){
  solve();
  return 0;
}


Measured memory_bytes: 3676
<?php
  $n = intval(trim(fgets(STDIN)));

  function luca($n){
    $a = 2;
    $b = 1;
    $i = 1;
    while($i < $n){
      $tmp = $a;
      $a = $b;
      $b = $tmp + $b;
      $i += 1;
    }
    return $b;
  }

  echo luca($n) . PHP_EOL;
?>

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

#include <boost/multiprecision/cpp_int.hpp>

// increment
#define rep_n(_1, _2, _3, NAME, ...) NAME
#define rep_2(i, n) for (int(i) = 0; (i) < (int)(n); ++(i))
#define rep_3(i, initial, n) \
  for (int(i) = (int)(initial); (i) < (int)(n); ++(i))
#define rep(...) rep_n(__VA_ARGS__, rep_3, rep_2, rep_1)(__VA_ARGS__)
// decrement
#define rep_r_n(_1, _2, _3, NAME, ...) NAME
#define rep_r_2(i, n) for (int(i) = (int)(n); (i) > 0; (i)--)
#define rep_r_3(i, initial, n) \
  for (int(i) = (int)(initial); (i) > (int)(n); (i)--)
#define rep_r(...) rep_r_n(__VA_ARGS__, rep_r_3, rep_r_2)(__VA_ARGS__)
// define type definition
using namespace std;
typedef long long ll;
using mpint = boost::multiprecision::cpp_int;  // 多倍長整数（任意精度）
typedef pair<int, int> P;

// define construct variable
const double EPS = numeric_limits<double>::epsilon();
// 10^9 + 7
const ll MOD = ll(1e9) + 7;
const ll INF = ll(1e10);
const string ALPHABET = "abcdefghijklmnopqrstuvwxyz";
const double PI = acos(-1);

// define methods
// 最大公約数
ll gcd(const ll a, const ll b) { return b ? gcd(b, a % b) : a; }
// 最小公倍数
ll lcm(const ll a, const ll b) { return a / gcd(a, b) * b; }
// char -> int
int ctoi(char c) { return (int)(c - '0'); }
// 素因数分解
vector<pair<ll, ll>> prime_factorize(ll n) {
  vector<pair<ll, ll>> p;
  for (ll i = 2; i * i <= n; i++) {
    if ((n % i) != 0) continue;
    pair<ll, ll> a = make_pair(i, 0);
    while ((n % i) == 0) {
      n /= i;
      a.second += 1;
    }
    p.push_back(a);
  }

  if (n != 1) p.push_back(make_pair(n, 1));
  return p;
}
// 組み合わせの整合性を保つ（後ほど解析する）
ll modinv(ll a) {
  ll b = MOD, u = 1, v = 0;
  while (b) {
    ll t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= MOD;
  if (u < 0) {
    u += MOD;
  }
  return u;
}
// 順列
ll permutation(const ll n, const ll m) {
  ll result = 1;
  for (ll i = n; i > n - m; i--) {
    result = (result * i) % MOD;
  }
  return result;
}

// 繰り返し n 乗法
ll repeat_square(const ll n, const ll x) {
  if (x == 0) return 1;
  ll res = repeat_square(n, x / 2);
  res = res * res % MOD;
  if ((x % 2) == 1) res = res * n % MOD;
  return res;
}
// 組み合わせ nCm
ll combination(ll n, ll m) {
  ll p = permutation(n, m);
  ll div = 1;
  for (ll i = 2; i <= m; i++) {
    div = (div * i) % MOD;
  }
  return (p * modinv(div)) % MOD;
}

// アルファベットの取得
string get_alphabet(ll n) {
  n--;
  return string(1, 'a' + (n % 26));
}

int main() {
  int N, K;
  cin >> N >> K;
  vector<ll> a(N);
  rep(i, N) {
    cin >> a[i];
  }

  ll start = a[0];
  rep(i, K, N) {
    ll temp = a[i];
    // cout << endl;
    // cout << start << ": " << temp << endl;
    if (start < temp) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
    start = a[i - K + 1];
  }
  return 0;
}


Measured memory_bytes: 4848
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,int> P;
typedef pair<P,P> PP;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=9999999999;
ll c[10][10];
ll dp[10];


int main(){
    int h,w;
    cin>>h>>w;
    for(int i=0;i<10;i++){
        for(int j=0;j<10;j++){
            cin>>c[i][j];
        }
    }
    priority_queue<P,vector<P>,greater<P> > q;
    for(int i=0;i<10;i++) dp[i]=INF;
    q.push(P(0,1));
    dp[1]=0;
    while(!q.empty()){
        P p=q.top(); q.pop();
        int now=p.second;
        ll cost=p.first;
        for(int from=0;from<10;from++){
            if(from==now) continue;
            if(dp[from]>cost+c[from][now]){
                dp[from]=cost+c[from][now];
                q.push(P(dp[from],from));
            }
        }
    }
    ll ans=0;
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            int a;
            cin>>a;
            if(a==-1) continue;
            ans+=dp[a];
        }
    }
    cout<<ans<<endl;


}

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <cstdio>
//ranker
using namespace std;

#define REPS(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (int i = (a); i >= n; --i)
#define DEP(i, n) DEPS(i, n, 0)

using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using pis = pair<int, string>;
using psi = pair<string, int>;
using D = double;


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

 int D, E;
 while(1){
   double len;
   cin >> D >> E;
   if(D == 0 && E == 0) break;

   int num;
   double min = 100.000;

   for(num=0; num<D+1; num++){
     len = sqrt(1.0*(num*num+(D-num)*(D-num)));
     if(min > abs(len-E*1.0)) min = abs(len-E*1.0);
   }
   cout << min << endl;
 }
  return 0;
}

Measured memory_bytes: 3296
n,y = gets.chomp.split.map(&:to_i)
(0..n).each do |i|
  (0..n).each do |k|
    if 10000*i + 5000*k + 1000*(n-i-k) == y && i+k <= n
      puts "#{i} #{k} #{n-i-k}"
      exit
    end 
  end 
end 
puts "-1 -1 -1"

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

int main()
{
    char str[20];
    cin>>str;

    for(int i=0;i<4;i++)
    cout<<str[i];
    cout<<" ";
    for(int i=4;i<12;i++)
    cout<<str[i];
    cout<<"\n";
    return 0;
}


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

using namespace std;
typedef int64_t ll;
typedef uint64_t ull;
typedef long double ld;

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

	int n;
	cin >> n;
	int a[n], b[n];
	for(int i = 0; i < n; i++) {
		cin >> a[i];
		b[i] = a[i];
	}

	sort(b, b+n);
	for(int i = 0; i < n; i++) {
		if(a[i] == b[n-1])
			cout << b[n-2] << '\n';
		else
			cout << b[n-1] << '\n';
	}



	cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << " ms.\n";
}

// g++ o .cpp -O2 -std=c++11 -D cute -Wall -Wno-unused-result



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

using namespace std;


#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define REP(i,a) FOR(i,0,a)
#define ROF(i,a,b) for(int i = (b)-1; i >=(a); i--)
#define RREP(i,a) ROF(i,0,a)
#define MOD 1000000007
#define pb push_back
#define um unordered_map
#define us unordered_set
#define rs resize
#define LSB(x) ((x)&(-x))
typedef long long ll;
typedef vector<int> vi; typedef vector<vi> vvi;
typedef vector<bool> vb; typedef vector<vb> vvb;
typedef vector<ll> vll; typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef priority_queue<pii, vector<pii>, greater<pii>> djki;
typedef priority_queue<pll, vector<pll>, greater<pll>> djkll;
typedef unordered_map<int, int> umii;
typedef unordered_map<ll, ll> umll;
typedef unordered_set<int> usi;
typedef unordered_set<ll> usll;
int n;
vvi arr;
vector<vvi> dp;

ll solve(int day, int choice, int k) {
    if(dp[day][choice][k] != 0) return dp[day][choice][k];
    if(day == n-1) return arr[day][choice];
    ll best = 0;
    for(int i = 0; i < 3; i++) {
        if(choice == i) continue;
        else best = max(best, arr[day][choice] + solve(day+1, i, 1));
    }
    return dp[day][choice][k] = best;

}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin >> n;
    arr.resize(n, vi(3));
    dp.resize(n, vvi(3, vi(2, 0)));
    REP(i, n) {
        cin >> arr[i][0] >> arr[i][1] >> arr[i][2];
    }
    cout << max(solve(0, 0, 1), max(solve(0, 1, 1), solve(0, 2, 1))) << endl;
    return 0;
}

Measured memory_bytes: 33024
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        string s = sc.Next().Substring(0, 1) + sc.Next().Substring(0, 1) + sc.Next().Substring(0, 1);

        string answer = s.ToUpper();

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 11092
// https://atcoder.jp/contests/abc055/tasks/abc055_b

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

int main()
{
  /* Magic word */
  // cin.tie(0);
  // ios::sync_with_stdio(false);
  /* ---------- */

  int n;
  ll p = 1;

  cin >> n;

  REP(i, n)
  {
    p *= i + 1;
    p = p % (ll)(pow(10, 9) + 7);
  }

  cout << p << '\n';

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int w,h;
int x,y;
int main(){
    cin>>w>>h>>x>>y;
    double ans=(double)w*h/2;
    int n = (2*x==w && 2*y==h) ? 1 : 0;
    printf("%.10f %d\n",ans,n);
    return 0;
}

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

static const int MAX = 100;
static const int INFTY = 3000;
static const int WHITE = 0, GRAY = 1, BLACK = 2;

int n;
int A[MAX][MAX];

int prim() {
	int i1, j1, min;
	int p[MAX], color[MAX], d[MAX];

	for (int i = 0; i < n; i++)	{
		p[i] = -1; //MST??????????????????i??????
		color[i] = WHITE; 
		d[i] = INFTY; //MST??¨????????\????????????????°??????¢
	}
	d[0] = 0;

	while (1) {
		min = INFTY;
		i1 = -1;
		for (int i = 0; i < n; i++)	{
			if (d[i] < min && color[i] != BLACK) {
				i1 = i;
				min = d[i];
			}
		}
		if (i1 == -1) break;

		color[i1] = BLACK;
		for (int j = 0; j < n; j++)	{
			if (A[i1][j] != INFTY && color[j] != BLACK) {
				if (d[j] > A[i1][j]) {
					d[j] = A[i1][j];
					p[j] = i1;
					color[j] = GRAY;
				}
			}
		}
	}
	int sum = 0;
	for (int i = 0; i < n; i++)	{
		if (p[i] != -1) sum += A[i][p[i]];
	}
	return sum;
}

int main() {
	int i1,j1;
	cin >> n;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			int t;
			cin >> t;
			A[i][j] = (t == -1) ? INFTY : t;
		}
	}

	cout << prim() << endl;

	return 0;
}

Measured memory_bytes: 1200
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#include<cassert>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())
#define Endl endl

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T> using vv=vector<vector<T>>;
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
#define out(args...){vector<string> a_r_g_s=s_p_l_i_t(#args, ','); e_r_r(a_r_g_s.begin(), args); }
vector<string> s_p_l_i_t(const string &s, char c){vector<string> v;int d=0,f=0;string t;for(char c:s){if(!d&&c==',')v.pb(t),t="";else t+=c;if(c=='\"'||c=='\'')f^=1;if(!f&&c=='(')++d;if(!f&&c==')')--d;}v.pb(t);return move(v);}
void e_r_r(vector<string>::iterator it) {}
template<typename T, typename... Args> void e_r_r(vector<string>::iterator it, T a, Args... args){ if(*it==" 1"||*it=="1") cerr<<endl; else cerr << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << ", "; e_r_r(++it, args...);}
const ll MOD=1e9+7;

int X,Y;

bool bd(int x,int y){
  return (x==0 || x==X) || (y==0 || y==Y);
}

int main(){
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(0);
  int n;
  cin>>X>>Y>>n;
  vector<pii> ue,mi,shi,hi;
  rep(i,n){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if(bd(a,b) && bd(c,d)){
      rep(_,2){
	if(b==0){
	  ue.eb(a,i);
	}else if(a==X){
	  mi.eb(b,i);
	}else if(b==Y){
	  shi.eb(-a,i);
	}else{
	  hi.eb(-b,i);
	}
	swap(a,c); swap(b,d);
      }
    }
  }
  vector<int> v;
  for(auto vs:{ue,mi,shi,hi}){
    sort(all(vs));
    for(pii p:vs) v.pb(p.Y);
  }
  //out(v,1);
  vector<int> st;
  for(int x:v){
    if(st.size() && st.back()==x) st.pop_back();
    else st.pb(x);
    //out(st,1);
  }
  cout<<(st.size()?"NO":"YES")<<endl;
  return 0;
}


Measured memory_bytes: 5824
#include <stdio.h>

int main(){
	int i,a,b;
	i=1;
	while(1){
		scanf("%d %d",&a,&b);
		if(a == 0 && b == 0) break;
		if( a > b){
			printf("%d %d\n",b,a);
		} else {
			printf("%d %d\n",a,b);
		}
	}
	return 0;
}

Measured memory_bytes: 600
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

A = n()
B = n()
C = n()
X = n()

count = 0
for i in range(A+1):
    for j in range(B+1):
        rest = X - (500*i + 100*j)
        if rest >= 0 and rest // 50 <= C:
            count += 1
print(count)


Measured memory_bytes: 3064
#include <iostream>
using namespace std;
const int maN = 2e5+5;
int parent[maN];
int sz[maN];
int find_set(int v)
{
    if(v == parent[v])
        return v;
    return parent[v] = find_set(parent[v]);
}

void union_sets(int a, int b)
{
    int u = find_set(a);
    int v = find_set(b);
    if(u!=v)
    {
        if(sz[u] < sz[v])
        {
            swap(u, v);
        }
        parent[u] = v;
            sz[v] += sz[u];
    }
}

int main() {
    int n, m;
    cin >> n >> m;
    
    for(int i = 0; i <= n; ++i)
    {
        parent[i] = i;
        sz[i] = 1;
    }
    for(int i = 0; i < m; ++i)
    {
        int a, b;
        cin >> a >> b;
        --a, --b;
        union_sets(a, b);
    }
    
    // for(int i = 1; i <= n; ++i)
    // {
    //     int aa = find_set(i);
    //     cout << parent[aa] << " ";
    // }
    int max_set = 1;
    for(int i = 0; i < n; ++i)
    {
        // cout << sz[i] << " ";
        if(max_set < sz[i])
            max_set = sz[i]; 
    }
    
    cout << max_set;

	return 0;
}


Measured memory_bytes: 5200
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N; cin >> N;
  int a[N], b[N];
  FOR(i,0,N) cin >> a[i];
  FOR(i,0,N) cin >> b[i];
  int ans = 0;
  int cnt = a[0];
  FOR(i,0,N) cnt += b[i];
  ans = max(ans, cnt);
  FOR(i,1,N) {
    cnt += a[i];
    cnt -= b[i-1];
    ans = max(ans, cnt);
  }
  cout << ans << endl;
  return 0;

}

Measured memory_bytes: 256
#pragma once
#include<iostream>
#include<string>
#include<stdio.h>

using namespace std;


string s;
int nagasa;
int a,b;
int result;

int main(){
	a=0;
	b=0;

		cin >> s;

		nagasa=s.size();
		result=nagasa;

		for(int i=0;i<nagasa;i++){
			if(s[i]=='S'){
				a++;
			}
			else{
				b++;
			}

			if(b>a){
				result-=2*a;
				a=0;
				b=0;
			}


		}

		result-=2*b;



		printf("%d\n",result);

		//for(int i=0;i<;i++)



return 0;
}



Measured memory_bytes: 640
#include<stdio.h>
int main(void){
  int a,b,i,f,c[10],d;
  scanf("%d %d",&a,&b);
  c[0]=1;
  for(i=1;i<10;i++){
    c[i]=c[i-1]*10;
  }
  f=0;
  d=0;
  if(a>=b){
    for(i=0;i<=a-1;i++){
    f=b*c[i]+f;
    }
    printf("%d\n",f);
      }
  if(a<b){
    for(i=0;i<=b-1;i++){
      d=a*c[i]+d;
    }
    printf("%d\n",d);
      } 
  return 0;
}



Measured memory_bytes: 128
import java.util.*;
	import java.util.Map.Entry;
	 
	 
	 class Main {
		 static int mod =  (int) (Math.pow(10,9)+7);
//		 static int mod =  (int) 998244353;
		 static List<ArrayList<Integer>> list= new ArrayList<ArrayList<Integer>>();
		 public static void main(String[] args) {
	    	
	        Scanner sc = new Scanner(System.in);
	        int N = sc.nextInt();
	        String S = sc.next();
	        char[] c = S.toCharArray();
	        boolean flg = false;
	        int[] a= new int[N+5];
	        for(int i=0;i<4;i++) {
		        a = new int[N+5];
	        	a[0]=i%2;
	        	a[1]=i>>1;
	        	for(int j=1;j<N+1;j++) {
	        		if(a[j]==0) {
	        			if(c[j%N]=='o') {
	        				a[j+1]=a[j-1];
	        			} else {
	        				a[j+1]=(a[j-1]+1)%2;
	        			}
	        		} else {
	        			if(c[j%N]=='o') {
	        				a[j+1]=(a[j-1]+1)%2;
	        			} else {
	        				a[j+1]=a[j-1];
	        			}	        			
	        		}
	        	}
	        	if(a[0]==a[N]&&a[1]==a[N+1]) {
	        		flg=true;
	        		break;
	        	}
	        }
	        
	        if(flg==false) {
	        	System.out.println(-1);
	        	return;
	        }
	        
	        StringBuffer str = new StringBuffer();
	        for(int i=0;i<N;i++) {
	        	if(a[i]==0) {
	        		str.append("S");
	        	} else {
	        		str.append("W");
	        	}
	        }
	        System.out.println(str);
		 }
	}

Measured memory_bytes: 41908
#include<bits/stdc++.h>
#define rep(i,a,...) for(int i = (a)*(strlen(#__VA_ARGS__)!=0);i<(int)(strlen(#__VA_ARGS__)?__VA_ARGS__:(a));++i)
#define per(i,a,...) for(int i = (strlen(#__VA_ARGS__)?__VA_ARGS__:(a))-1;i>=(int)(strlen(#__VA_ARGS__)?(a):0);--i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
#define lambda(RES_TYPE, ...) (function<RES_TYPE(__VA_ARGS__)>)[&](__VA_ARGS__) -> RES_TYPE
#define method(FUNC_NAME, RES_TYPE, ...) function<RES_TYPE(__VA_ARGS__)> FUNC_NAME = lambda(RES_TYPE, __VA_ARGS__)
using ll = long long;
//const ll MOD = (ll)1e9+7;
const ll MOD = 998244353;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}
#ifdef DEBUG
#define debug(x) cout<<"LINE "<<__LINE__<<": "<<#x<<" = "<<x<<endl;
#else
#define debug(x) (void)0
#endif

namespace templates{
  ll modpow(ll x, ll b){
    ll res = 1;
    while(b){
      if(b&1)res = res * x % MOD;
      x = x * x % MOD;
      b>>=1;
    }
    return res;
  }

  ll modinv(ll x){
    return modpow(x, MOD-2);
  }

  bool was_output = false;
  template<class t>
  void output(t a){
    if(was_output)cout << " ";
    cout << a;
    was_output = true;
  }
  void outendl(){
    was_output = false;
    cout << endl;
  }
  ll in(){
    ll res;
    scanf("%lld", &res);
    return res;
  }

  template<class t>
  istream& operator>>(istream&is, vector<t>&x){
    for(auto &i:x)is >> i;
    return is;
  }

  template<class t, class u>
  istream& operator>>(istream&is, pair<t, u>&x){
    is >> x.first >> x.second;
    return is;
  }

  template<class t>
  void in(t&x){
    cin >> x;
  }

  template<class t>
  t in(){
    t res; cin >> res; return res;
  }

  template<class t>
  void out(t x){
    cout << x;
  }

  template<class t>
  vector<t> sorted(vector<t> line,function<bool(t,t)> comp=[](t a,t b){return a<b;}){
    sort(line.begin(),line.end(),comp);
    return line;
  }

  template<class t>
  vector<t> reversed(vector<t> line){
    reverse(line.begin(),line.end());
    return line;
  }
}

using namespace templates;

int main(){
  int n = in();
  set<int> x;
  rep(i,n)x.emplace(in());
  cout << (lambda(bool){
      int m = in();
      rep(_,m)if(!x.count(in()))return false;
      return true;
    })() << endl;
}



Measured memory_bytes: 12548
#include<iostream>
#include<string>
using namespace std;
 
int main(){
  string S;
  cin >>S;
  
    bool C_odd=false;
    bool C2_odd=false;
    for(int i=1;i<S.size();i++){
      if(S.at(i)=='C'&&C2_odd==false&&i<S.size()-1&&i!=1){
        C_odd=true;
        C2_odd=true;
        continue;
      }
      if((S.at(i)>='A')&&(S.at(i)<='Z')){
        C_odd=false;
        break;
      }
    }
   if(S.at(0)=='A'&&C_odd==true){
        cout<<"AC"<<endl;
      }else{
     cout<<"WA"<<endl;
   }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <iomanip>
#include <math.h>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <functional>

using namespace std;

typedef long long int ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, int> pli;
typedef std::pair<ll, ll> pll;

#define FOR(i,n,m) for(ll i=(ll)(m);i<(ll)(n);++i)
#define REP(i,n) FOR(i,n,0)
#define IREP(i,n) for(ll i=(ll)(n);i>=0;--i)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int x[105], y[105];

int main()
{
	int N, M, X, Y;
	cin >> N >> M >> X >> Y;
	REP(i, N)
	{
		cin >> x[i];
	}
	REP(i, M)
	{
		cin >> y[i];
	}

	string S = "War";
	sort(x, x + N);
	sort(y, y + M);
	FOR(i, Y, X+1)
	{
		if (i > x[N - 1] && i <= y[0])
		{
			S = "No War";
			break;
		}
	}
	cout << S << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cassert>
#include <complex>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <sstream>
#include <ctime>
#include <cctype>
#include <set>
#include <map>
#include <queue>
#include <bitset>
#include <deque>
#include <stack>
#include <memory.h>
using namespace std;
#define ll long long 
int n,a[100005];
map<int,int> mp;
int main()
{
	cin>>n;
	for(int i=0;i<n;i++){
		scanf("%d",a+i);
		mp[a[i]]++;
		mp[a[i]-1]++;
		mp[a[i]+1]++;
	}
	int mx=-999;
	for(int i=0;i<100000;i++){
		mx=max(mp[i],mx);
	}
	cout<<mx;
    return 0;
}

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

int main() {
  int a,b,c,d;
  d=0;
  cin >> a>>b>>c;
  if(a==b) d++;
  if(b==c) d++;
  if(a==c) d++;
  if(d==1) cout<<"Yes";
  else cout<<"No";
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define USE_LLONG_AS_INT
#ifdef USE_LLONG_AS_INT
#define int long long
#define inf (1ll<<60)
#else
#define inf (1<<30)
#endif
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;
const string sp=" ";

void run();

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

signed main(){
    init();
    run();
    return 0;
}

void run(){
    int n,k;
    cin>>n>>k;
    vi a(n),f(n);
    rep(i,n)cin>>a[i];
    rep(i,n)cin>>f[i];
    SORT(a);
    RSORT(f);
    int l=-1,r=inf;
    while(r-l>1){
        int m=(l+r)/2;
        int s=0;
        rep(i,n)s+=max(0ll,a[i]-m/f[i]);
        (s<=k?r:l)=m;
    }
    cout<<r<<endl;
}

Measured memory_bytes: 3456