akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>

#define int long long
using namespace std;
const int maxn = 600000;
int n;
char c[maxn+1];
int f[maxn+2];
int g[maxn+2];
int a[maxn+1];

main()
{
	ios_base::sync_with_stdio(0);
	//freopen("input.txt","r",stdin);
	n = 0;
	while (cin >> c[n+2])
		n++;
	n++;
	
	f[1] = 0;
	for (int i=2; i<=n; i++)
	if (c[i]=='>')
		f[i] = f[i-1]+1;
	else
		f[i] = 0;
	
	/*for (int i=1; i<=n; i++)
		cout << f[i] << ' ';
	cout << '\n';*/
	
	for (int i=n; i>=2; i--)
		if (f[i]==0)
			g[i] = 0;
		else
			g[i] = max(f[i],g[i+1]);
	
	/*for (int i=1; i<=n; i++)
		cout << g[i] << ' ';
	cout << '\n';*/
	
	a[0] = -1;
	for (int i=1; i<=n; i++)
	{
		if (f[i]==0)
		{
			if (f[i+1]==0)
				a[i] = a[i-1]+1;
			else
			if (f[i+1]>0)
				a[i] = max(a[i-1]+1,g[i+1]);
		}
		else
		if (f[i]>0)
		{
			if (g[i+1]!=0)
				a[i] = max((int) 0,min(a[i-1]-1,g[i+1]-f[i+1]+1));
			else
				a[i] = max((int) 0,min(a[i-1]-1,(int) 0));
		}
	}
	
	
	int res = 0;
	for (int i=1; i<=n; i++)
	{
		//cout << a[i] << ' ';
		res+=a[i];
	}
	
	//cout << '\n';
	
	cout << res << '\n';
		
	return 0;
}


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

using namespace std;

int main() {
  int x1, y1, x2, y2, x3, y3, x4, y4;
  
  cin >> x1 >> y1 >> x2 >> y2;
  
  // Rotate Matrix
  x3 = y1 - y2 + x2;
  y3 = -(x1 - x2) + y2;
  x4 = y2 - y3 + x3;
  y4 = -(x2 - x3) + y3;
  
  cout << x3 << " " << y3 << " " << x4 << " " << y4;
}

Measured memory_bytes: 256
unittest
{
	assert( [ "4 4", "2 4", "1 1", "2 3", "2 4" ].solve == "1\n3\n6\n-1" );
}



import std.algorithm;
import std.container;
import std.conv;
import std.format;
import std.range;
import std.stdio;

void main()
{
	stdin.byLineCopy.solve.writeln;
}

auto solve( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto h = 0L;
	auto w = 0L;
	input.front.formattedRead!"%s %s"( h, w );
	auto abs = new long[ 2 ][ h ];
	foreach( ref ab; abs )
	{
		input.popFront;
		ab = input.front.split.to!( long[] );
		ab[ 0 ] -= 1;
	}
	
	// 各y座標について最小移動回数を計算
	auto anss = new long[ h ];
	auto rbt = redBlackTree( iota( 0L, w ) );
	auto st = SegmentTree!( long, min, long.max )( new long[ w + 1 ] );		// x座標ごとの横の移動回数（縦の移動回数は全部同じなので持たなくていい）
	foreach( y, ref ans, ab; lockstep( anss, abs ) )
	{
		// 壁にぶつかったx座標について、横移動で壁の右端と合流させる
		auto xs = rbt.upperBound( ab[ 0 ] - 1 );
		auto p = false;
		while( !xs.empty && xs.front < ab[ 1 ] )
		{
			auto x = xs.front;
			xs.popFront;
			rbt.removeKey( x );
			st.set( ab[ 1 ], min( st.get( ab[ 1 ] ), st.get( x ) + ab[ 1 ] - x ) );
			st.set( x, long.max );
			p = true;
		}
		if( p && ab[ 1 ] < w ) rbt.insert( ab[ 1 ] );
		
		// 最小移動回数を取得
		auto m = st.query( 0, w );
		if( m == long.max ) ans = -1;
		else                ans = y + 1 + m;		// 縦の移動回数を加算
	}
	return anss.to!( string[] ).join( "\n" );
}

// セグメント木
struct SegmentTree( T, alias op = ( ( a, b ) => a + b ), T I = T.init )
{
	T[] ts;
	
	this( long n )
	{
		ts = new T[ n << 1 ];
		static if( I != T.init ) ts[] = I;
	}
	
	this( T[] qs )
	{
		ts = new T[ qs.length << 1 ];
		ts[ $ >> 1 .. ( $ >> 1 ) + qs.length ] = qs;
		foreach_reverse( i; 1L .. ts.length.signed >> 1 )
		{
			ts[ i ] = op( ts[ i << 1 ], ts[ i << 1 | 1 ] );
		}
	}
	
	void set( long i, T v )
	{
		i += ts.length.signed >> 1;
		ts[ i ] = v;
		for( i >>= 1; 0 < i; i >>= 1 )
		{
			ts[ i ] = op( ts[ i << 1 ], ts[ i << 1 | 1 ] );
		}
	}
	
	auto get( long i )
	{
		i += ts.length.signed >> 1;
		return ts[ i ];
	}
	
	auto query( long l, long r )
	{
		l += ts.length.signed >> 1;
		r += ts.length.signed >> 1;
		auto x = I;
		auto y = I;
		for( ; l < r; l >>= 1, r >>= 1 )
		{
			if( l & 1 )
			{
				x = op( x, ts[ l ] );
				l++;
			}
			if( r & 1 )
			{
				r--;
				y = op( ts[ r ], y );
			}
		}
		return op( x, y );
	}
	
	auto length()
	{
		return ts.length >> 1;
	}
	
	auto toString()
	{
		return format( "ST(%s)", ts[ $ >> 1 .. $ ] );
	}
}


Measured memory_bytes: 32344
#include <iostream>
#include <cstdio>
#include <cstring>

int main()
{
	int a, b, c, d;
	while(~scanf("%d%d%d%d", &a, &b, &c, &d)){
		if(abs(a - c) <= d){
			printf("Yes\n");
			continue;
		}
		if(abs(a - b) <= d && abs(b - c) <= d){
			printf("Yes\n");
			continue;
		}
		printf("No\n");
	}
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<vector>
using namespace std;
typedef pair<int, int> P;

const int MAX_N = 1e5;
int n, q, k;
int x[MAX_N], y[MAX_N];
struct ver {
    vector<pair<int, int>> to;
    long dist = 0;
};
ver v[MAX_N];

void solve(int m, int par) {
    for (auto &i : v[m].to) {
        if (i.first != par) {
            v[i.first].dist = v[m].dist + i.second;
            solve(i.first, m);
        }
    }
}

int main() {
    scanf("%d", &n);
    for (int i = 0; i < n - 1; i++) {
        int a, b, c;
        scanf("%d %d %d", &a, &b, &c);
        v[a - 1].to.push_back(P(b - 1, c));
        v[b - 1].to.push_back(P(a - 1, c));
    }
    scanf("%d %d", &q, &k);
    solve(k - 1, k - 1);
    for (int i = 0; i < q; i++) scanf("%d %d", &x[i], &y[i]);
    for (int i = 0; i < q; i++) {
        printf("%ld\n", v[x[i] - 1].dist + v[y[i] - 1].dist);
    }
    return 0;
}


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

int main() {
    
    int A, B, K;
    cin >> A >> B >> K;
    
    int i;
    for (i = min(A, B); i >= 1; --i) {
        if (A % i == 0 && B % i == 0) {
            --K;
            if (K == 0) {
                break;
            }
        }
    }
    
    cout << i << endl;
    
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        
        for (int i = 1; i < 10000000; i++) {
            int c = (int)(Math.floor(i * 0.08));
            int d = (int)(Math.floor(i * 0.1));
            
            if (a == c && b == d) {
                System.out.println(i);
                return;
            }
        }
        
        System.out.println(-1);
    }
}


Measured memory_bytes: 25044
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		long a = sc.nextLong();
		long b = sc.nextLong();
		long c = sc.nextLong();

		long ans = 0;

		if (a % 2 == 0 || b % 2 == 0 || c % 2 == 0) {
			ans = 0;
		} else {

			ans = Math.min(a * b, Math.min(a * c, b * c));
		}

		System.out.println(ans);
	}

}


Measured memory_bytes: 22868
#include <cstdint>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int Count(const vector<string>& grid, const vector<bool>& rows, const vector<bool>& cols) {
  int cnt = 0;
  for (size_t h = 0; h < grid.size(); ++h) {
    if (rows[h]) continue;
    const string& row = grid[h];
    for (size_t w = 0; w < row.size(); ++w) {
      if (cols[w]) {
        continue;
      } else if (row[w] == '#') {
        ++cnt;
      }
    }
  }
  return cnt;
}

int64_t PaintCols(const vector<string>& grid, const int K, const vector<bool>& rows,
                  vector<bool>&cols, const size_t col) {
  if (col >= grid[0].size()) {
    if (Count(grid, rows, cols) == K) {
      return 1;
    }
    return 0;
  }
  int64_t result = 0;
  { // Paint col
    vector<bool> paint_cols = cols;
    paint_cols[col] = true;
    result += PaintCols(grid, K, rows, paint_cols, col + 1);
  }
  result += PaintCols(grid, K, rows, cols, col + 1);
  
  return result;
}

int64_t PaintRows(const vector<string>& grid, const int K, vector<bool>& rows, const size_t row) {
  if (row >= grid.size()) {
    vector<bool> cols(grid[0].size(), false);
    return PaintCols(grid, K, rows, cols, 0);
  }
  int64_t result = 0;
  {  // paint row
    vector<bool> paint_rows = rows;
    paint_rows[row] = true;
    result += PaintRows(grid, K, paint_rows, row + 1);
  }
  result += PaintRows(grid, K, rows, row + 1);
  return result;
}

int64_t Solve(vector<string>& grid, int K) {
  vector<bool> rows(grid.size(), false);
  return PaintRows(grid, K, rows, 0);
}

int main() {
  int H, W, K;
  cin >> H >> W >> K;
  vector<string> grid(H);
  for (int h = 0; h < H; ++h) {
    cin >> grid[h];
  }
  
  cout << Solve(grid, K) << endl;
  
  return 0;
}


Measured memory_bytes: 3628
class UFTree
  def initialize(n)
    @parent = (0...n).to_a
    @rank = Array.new(n, 0)
  end
     
  def find(x)
    return x if @parent[x] == x
    return @parent[x] = find(@parent[x])
  end
     
  def unite(a, b)
    a = find(a)
    b = find(b)
    return if a == b
    if @rank[a] < @rank[b]
      @parent[a] = b
    else
      @parent[b] = a
      @rank[a] += 1 if @rank[a] == @rank[b]
    end
  end
end
    
def smaller(a, b)
  a < b ? a : b
end
    
N = gets.to_i
G = (0...N).to_a
xv = []
yv = []
N.times do
  x, y = gets.split.map(&:to_i)
  xv << x
  yv << y
end
     
Q = []
H = G.sort{|a, b| xv[a] <=> xv[b]}
H.zip(H.drop(1)).take(N - 1).each do |a, b|
  Q << [a, b, smaller((xv[a] - xv[b]).abs, (yv[a] - yv[b]).abs)]
end
     
J = G.sort{|a, b| yv[a] <=> yv[b]}
J.zip(J.drop(1)).take(N - 1).each do |a, b|
  Q << [a, b, smaller((xv[a] - xv[b]).abs, (yv[a] - yv[b]).abs)]
end
     
tree = UFTree.new(N)
cost = 0
n = 0
Q.sort!{|a, b| a[2] <=> b[2]}.each do |a, b, c|
  break if n == N
  next if tree.find(a) == tree.find(b)
  cost += c
  tree.unite(a, b)
  n += 1
end
     
puts cost

Measured memory_bytes: 31592
#include <bits/stdc++.h>
 
using namespace std;
 
#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define RSORT(x) sort((x).rbegin(),(x).rend())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back
#define chmax(x,y) x = max(x,y)

 
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int> > VVI;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<bool> VB;
typedef vector<LL> VL;
typedef vector<vector<long long>> VVLL;
typedef vector<set<int>> VSI;
const int MOD = 1e9+7;
const int INF = 1e9;
const LL LINF = 1e18;
int gcd(int a, int b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

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

int main() {
    int n;
    cin >> n;
    vector<LL> l(n);

    rep(i,n) cin >> l[i];
    LL ans = 0;

    for(int i = 0; i < n; i++) {
        for(int j = i + 1; j < n; j++) {
            for(int k = j + 1; k < n; k++) {
                if(abs(l[i] - l[j]) < l[k] and l[k] < l[i] + l[j]) {
                    if(l[i] != l[j] and l[i] != l[k] and l[j] != l[k]) {ans++;}
                    }
            }
        }
    }

    cout << ans << endl;

}


Measured memory_bytes: 3636
#include <stdio.h>

int main(void)
{
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    if(a >= 0 && a <= 100 && b >= 0 && b <= 100 && c >= 0 && c <= 100){
        if(a < b && b < c)
            printf("Yes\n");
        else
            printf("No\n");
    }
}


Measured memory_bytes: 2076
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{

    int a , sum=0;
    cin>>a;
    if(a<=100 && a>=1){
    for(int i=1 ; i<=a ;i++){
        if(i%2==1)
    {
        sum=sum+1;

    }


    }

  double e=sum/(static_cast<double>(a));
  cout<<fixed <<setprecision(9)<<e<<endl;}
  else
  {
      cout<<"wrong";
  }
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
    using namespace std;
    #define forn(i,n) for(int i = 0 ; i < n ;i++)
    #define ll long long int
    #define ld long double
    int main()
    { 
        ll mod = 998244353;
    	int n;
    	cin >> n;
    	int d[n];
    	forn(i,n)cin >> d[i];
    	if(d[0] != 0){cout<<0<<"\n";return 0;}
    	int a[n];
    	memset(a,0,sizeof(a));
    	forn(i,n)a[d[i]]++;
        if(a[0] > 1){cout<<0<<endl;return 0;}
    	bool f1;
    	f1 = false;
        forn(i,n){
    		if(a[i] == 0 && f1 == false)f1=true;
    		if(f1 == true && a[i] != 0){
    			cout<<0<<"\n";return 0;
    		}
    	}
    	long long int ans = 1;
    	for(int i = 2; i<n ;i++)
    	{
    		if(a[i-1] >= 2  && a[i]!=0)
            {
                for(int j = 1; j<= a[i]; j++)
    			ans = (ans*a[i-1])%mod;
            }
    	}
    	cout<<ans<<"\n";
    return 0;
    }

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

int main() {
  int n,ans = 0;
  cin >> n;
  vector<int>data(n);
  for(int i = 0;i < n;i++){
    cin >> data[i];
    data[i]--;
  }
  for(int i = 0;i < n;i++){
    if(data[data[i]] == i) ans++;
  }
  cout << ans/2 << endl;
}


Measured memory_bytes: 640
struct Heap<Element: Comparable>: CollectionType {
  var items = [Element]()
  var startIndex: Int {
    return items.startIndex
  }
  var endIndex: Int {
    return items.endIndex
  }
  subscript(i: Int) -> Element {
    return items[i]
  }
  mutating func push(item: Element) {
    var i = items.count
    while i > 0 {
      let p = (i - 1) / 2
      if items[p] <= item {
        break
      }
      if i == items.count {
        items.append(items[p])
      } else {
        items[i] = items[p]
      }
      i = p
    }
    if i == items.count {
      items.append(item)
    } else {
      items[i] = item
    }
  }
  mutating func pop() -> Element {
    let ret = items[0]
    let x = items[items.count - 1]
    var i: Int = 0
    while i * 2 + 1 < items.count - 1 {
      var a = i * 2 + 1
      let b = i * 2 + 2
      if b < items.count - 1 && items[b] < items[a] {
        a = b
      }
      if items[a] >= x {
        break
      }
      items[i] = items[a]
      i = a
    }
    items[i] = x
    items.removeLast()
    return ret
  }
}
let M=Int(String(readLine()!.characters.split(" ")[1]))!
var q=Heap<Int>()
readLine()!.characters.split(" ").map{q.push(-Int(String($0))!)}
(0..<M).map{_ in q.push(q.pop()/2)}
print(q.reduce(0){$0-$1})

Measured memory_bytes: 7884
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <assert.h>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
typedef vector<double> VD;

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

const ll mod = 1000000007;
const int N = 1000010;
ll fact[N], invf[N];

ll add(ll x, ll y){
    return (x+y)%mod;
}

ll mul(ll x, ll y){
    return (x%mod)*(y%mod)%mod;
}

ll powll(ll x, ll y){
    ll res = 1LL;
    while(y){
        if (y & 1LL)
            res *= x;
        res %= mod;
        x = (x*x) % mod;
        y >>= 1LL;
    }
    return res;
}

ll divll(ll x, ll y){
    return (x * powll(y,mod-2)) % mod;
}

ll nPr(ll n, ll r){
    if (n < r || r < 0) return 0;
    return mul(fact[n], invf[n-r]);
}

ll nCr(ll n, ll r){
    if (n < r || r < 0) return 0;
    return mul(mul(fact[n], invf[r]), invf[n-r]);
}

int main() {
    ll n;
    cin >> n;
    fact[0] = invf[0] = 1;
    FOR(i,1,N-1){
        fact[i] = (fact[i-1] * i) % mod;
        invf[i] = divll(invf[i-1], i);
    }

    VL way(n);
    ll ans = 0;
    FOR(k,1,n-1){
        ll tmp = (fact[k] * fact[n-1-k]) % mod;
        tmp = (tmp * nCr(k-1, n-k-1)) % mod;
        way[k] = tmp;
    }

    FORR(k,n-1,1) way[k] = (way[k] - way[k-1] + mod) % mod;
    REP(i,n) ans = (ans + i * way[i]) % mod;

    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 23680
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define REP(i, n) for (LL i = 0; i < (LL)(n); i++)
#define REP2(i, n) for (LL i = 1; i <= (LL)(n); i++)
#define FOR(i, m, n) for (LL i = m; i < n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define REVE(x) reverse(x.begin(), x.end())
#define ALL(x) (x).begin(), (x).end()
#define SUM(x) accumulate(x.begin(), x.end(),0)
#define vLL(v,n) vector<LL> v(n); REP(i,n)cin>>v[i];
#define vstr(v,n) vector<string> v(n); REP(i,n)REP(i,n)cin>>v[i];
LL INF = 1e9 + 1;
LL MOD = 1e9+7;
  LL a,b,c,d,e,n,m,l,k,r,x,y,z,t,ans=INF,ans2=0,p;
string s,S;
int main() {
ios_base::sync_with_stdio(false);
  cin >> n;
  vLL(T,n);
 cin >>m;

REP(i,m){
cin>>p>>x;
a=T[p-1];
T[p-1]=x;
cout << SUM(T)<<endl;
T[p-1]=a;
 }
 
}

Measured memory_bytes: 3632
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())

if a<40:
    a=40
if b<40:
    b=40
if c<40:
    c=40
if d<40:
    d=40
if e<40:
    e=40
print((a+b+c+d+e)//5)



Measured memory_bytes: 5592
#include<stdio.h>
#include<stdlib.h>
#define INFTY 1000000000
void merges(int*,int,int,int);
void mergesorts(int*,int,int);
int count=0;
int n;
int main(){
  int mid;
  int right;
  int left;
  int *list;
  scanf("%d",&n);
  list=(int *)malloc(n*sizeof(int));
  mid=(n-1)/2;
  left=0;
  right=n;
  int i;
  for(i=0;i<n;i++)scanf("%d",&list[i]);
  mergesorts(list,left,right);
  for(i=0;i<n;i++)printf("%d%c",list[i],((i<n-1)?' ':'\n'));
  printf("%d\n",count);
  free(list);
  return 0;
}
void merges(int* list,int left,int mid,int right){
  int i;
  int j;
  int k;
  int m1;
  int m2;
  int *n1;
  int *n2;
  m1=mid-left;
  m2=right-mid;
  n1=(int *)malloc((m1+1)*sizeof(int));
  n2=(int *)malloc((m2+1)*sizeof(int));
  for(i=0;i<m1;i++)n1[i]=list[left+i];
  for(i=0;i<m2;i++)n2[i]=list[mid+i];
  n1[m1]=INFTY;
  n2[m2]=INFTY;
  i=0;
  j=0;
  for(k=left;k<right;k++){
    if(n1[i]<=n2[j]){
      list[k]=n1[i];
      i++;
    }
    else{
      list[k]=n2[j];
      j++;
    }
    count++;
  }
  free(n1);
  free(n2);
}
void mergesorts(int *list,int left,int right){
int mid;
if(left+1<right){
mid=(left+right)/2;
mergesorts(list,left,mid);
mergesorts(list,mid,right);
merges(list,left,mid,right);
}
}



Measured memory_bytes: 5512
import scala.io.StdIn.{readInt,readLine}

object Main {
  def main(args:Array[String]) = {
    var n = 0
    while( {n=readInt;n} != 0 ) {
      val y = readInt.toDouble
      val rate = {
        for(i <- 1 to n) yield {
          val s = readLine.split(" ")
          if(s(2).toInt ==1) (s(0),1+y*s(1).toDouble/100)
          else (s(0), Math.pow(1+s(1).toDouble/100,y))
        }
      }.toList.maxBy(_._2)
      println(rate._1)
    }
  }
}

Measured memory_bytes: 48312
#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> >;

struct P { int c0, c1; };
P expr(auto& i);
P num(auto& i) {
  switch (*i) {
    case '?': return ++i, P{1, 1};
    case '(': {
      P res = expr(++i);
      return ++i, res;
    }
  }
}
P term(auto& i) {
  P res = num(i);
  int s = min(res.c0, res.c1);
  while (true) switch (*i) {
    case '&': {
      P curr = num(++i);
      res.c0 = min(res.c0, s + curr.c0);
      res.c1 += curr.c1;
      s += min(curr.c0, curr.c1);
      break;
    }
    default: return res;
  }
}
P expr(auto& i) {
  P res = term(i);
  int s = min(res.c0, res.c1);
  while (true) switch (*i) {
    case '|': {
      P curr = term(++i);
      res.c0 += curr.c0;
      res.c1 = min(res.c1, s + curr.c1);
      s += min(curr.c0, curr.c1);
      break;
    }
    default: return res;
  }
}

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  string s; cin >> s;
  auto i = begin(s);
  auto res = expr(i);
  cout << res.c0 << ' ' << res.c1 << '\n';
}


Measured memory_bytes: 3500
using System;
using System.Collections.Generic;
using System.Linq;
//using System.Numerics;
class Program
{     
    
    public void Slove()
    {
        var inputs = Console.ReadLine().Split();
        int n = int.Parse(inputs[0]);
        int a = int.Parse(inputs[1]);
        int b = int.Parse(inputs[2]);
        int[] pos = Console.ReadLine().Split().Select(int.Parse).ToArray();
        long sum = 0;
        foreach(int i in Enumerable.Range(0, n - 1))
        {
            long temp = (long)(pos[i + 1] - pos[i]) * a;
            if(temp > b)
                temp = b;
            sum += temp;
        }
        System.Console.WriteLine(sum);
    }
    
    static void Main(string[] args)
    {
        new Program().Slove();
    }
}


Measured memory_bytes: 19680
#include <stdio.h>

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

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

int n, A, B, C, l[10], ans;

int omgJaeyoung(int a, int b, int c, int idx, int cnt){
	int ret = 987654321;
	if(idx == n){
		if(a == 0 || b == 0 || c == 0)	return ret;
		return abs(A-a)+abs(B-b)+abs(C-c)+10*(cnt-3);
	}
	ret = min(ret, omgJaeyoung(a+l[idx], b, c, idx+1, cnt+1));
	ret = min(ret, omgJaeyoung(a, b+l[idx], c, idx+1, cnt+1));
	ret = min(ret, omgJaeyoung(a, b, c+l[idx], idx+1, cnt+1));
	ret = min(ret, omgJaeyoung(a, b, c, idx+1, cnt));
	return ret;
}

int main() {
	cin>>n>>A>>B>>C;
	for(int i = 0;i<n;i++)	cin>>l[i];
	ans = 987654321;
	cout<<omgJaeyoung(0, 0, 0, 0, 0);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
int n, V[50],C[50];
int main()
{
    cin>>n;
    for(int i=0;i<n;i++)cin>>V[i];
    for(int i=0;i<n;i++)cin>>C[i];

    int ans = 0;

    for(int i=0;i<n;i++)
        {
            if(V[i] > C[i])ans+= V[i]-C[i];
        }

    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<vector>
using namespace std;
 
int main(){
  string a;
  int count;
  int judge;
  count = 0;
  judge = 0;
  cin >> a;
  if(a[0] == 'A'){
    if(a[1] >= 'a' && a[1] <= 'z' && a[a.size()-1] >= 'a' && a[a.size()-1] <= 'z'){
    	for(int i = 2; i < a.size() - 1; i++){
          if(a[i] == 'C'){
            count++;
          }
          else if(a[i] >= 'a' && a[i] <= 'z'){
          }
          else{
            break;
          } 
          if(i == a.size() - 2){
            judge = 1;
          }
        }
    }
  }
  if(judge == 1 && count == 1){
    cout << "AC" << endl;
  }
  else{
    cout << "WA" << endl;
  }
}

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

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var l = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = l[0], K = l[1];
            var sticks = Console.ReadLine().Split().Select(int.Parse).ToArray();

            Array.Sort(sticks);
            var total = 0;

            for (var i = N - 1; i >= N - K; i--)
            {
                total += sticks[i];
            }

            Console.WriteLine(total);
        }
    }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
#define FAST       			ios_base :: sync_with_stdio(false); cin.tie(NULL);

bool prime_judge(int n) {
  double root_n = sqrt((double) n);
  int int_root_n = (int) root_n;
  bool result = true;
  for (int i = 2; i <= int_root_n; i++) {
    if (n % i == 0) {
      result = false;
    }
  }
  return result;
}

int main() {
  FAST;
  int X;
  cin >> X;
  int Y = X;
  while (!prime_judge(Y)) {
    Y++;
  }
  cout << Y << endl;
}

Measured memory_bytes: 256
primes = [True]*100000
for i in range(2,100000):
  if primes[i] == False:
    continue
  for j in range(2*i, 100000, i):
    primes[j] = False

c = [0]*100000

for i in range(3,100000):
  if primes[i] and primes[(i+1)//2] == True:
    c[i] = c[i-1]+1
  else:
    c[i] = c[i-1]


q = int(input())
ran = []
for i in range(q):
  ran.append(list(map(int, input().split())))
for i in range(q):
  print(c[ran[i][1]]-c[ran[i][0]-1])


Measured memory_bytes: 29816
#define _CRT_NO_SECURE_WARNINGS
#pragma warning(disable:4996)

#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdio>
#include <string>
#include <iomanip>
#include <set>
#include <map>

using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
	~debug() { cerr << endl; }
	eni(!= ) cerr << boolalpha << i; ris;
}
eni(== ) ris << range(begin(i), end(i));
}
sim, class b dor(pair < b, c > d) {
	ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
	sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using namespace std;


typedef long long ll;

void solve() {
	int x, y, z;
	cin >> x >> y >> z;
	int temp;
	temp = y;
	y = x;
	x = temp;
	temp = z;
	z = x;
	x = temp;
	cout << x << " " << y << " " << z << endl;

	
	
}
	
	
	



int main(){
	ios_base::sync_with_stdio(NULL);
	cin.tie(0);
//freopen("solver.txt", "r", stdin);
	/*int t;
	cin >> t;
	while (t--) {
		solve();
	}*/
	solve();
}




Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#define ll long long
using namespace std;
template <class T>
inline void rd(T &x) {
	x=0; char c=getchar(); int f=1;
	while(!isdigit(c)) { if(c=='-') f=-1; c=getchar(); }
	while(isdigit(c)) x=x*10-'0'+c,c=getchar(); x*=f;
}
const int N=(1<<18)+10,mod=998244353;
int Pow(int x,int y) {
	int res=1;
	while(y) {
		if(y&1) res=res*(ll)x%mod;
		x=x*(ll)x%mod,y>>=1;
	}
	return res;
}
int A[N],B[N],C[N];
int m,n;
void FWT(int *A,int f) {
	for(int l=1;l<n;l<<=1)
		for(int p=l<<1,i=0;i<n;i+=p)
			for(int j=0;j<l;++j) {
				int t1=A[i+j],t2=A[i+l+j];
				A[i+j]=(t1+t2)%mod;
				A[i+l+j]=(t1-t2+mod)%mod;
			}
	if(f==1) {
		int inv=Pow(n,mod-2);
		for(int i=0;i<n;++i) A[i]=A[i]*(ll)inv%mod;
	}
}
int main() {
	rd(m); n=(1<<m);
	int sum=0;
	for(int i=0;i<n;++i)
		rd(A[i]),sum+=A[i];
	sum=Pow(sum,mod-2);
	for(int i=0;i<n;++i)
		A[i]=A[i]*(ll)sum%mod;
	A[0]=(A[0]-1+mod)%mod;
	FWT(A,0);
//	for(int i=0;i<n;++i) printf("%d ",A[i]); puts("");
	B[0]=n-1;
	for(int i=1;i<n;++i)
		B[i]=mod-1;
	FWT(B,0);
	C[0]=0;
	for(int i=1;i<n;++i)
		C[i]=B[i]*(ll)Pow(A[i],mod-2)%mod;
	FWT(C,1);
	int tmp=C[0];
	for(int i=0;i<n;++i) C[i]=(C[i]-tmp+mod)%mod;
	for(int i=0;i<n;++i) printf("%d\n",C[i]);
	return 0;
}

Measured memory_bytes: 5888
#!/usr/bin/env python3
# from collections import Counter

parent = None


def root(a):
    if parent[a] == a:
        return a
    else:
        parent[a] = root(parent[a])
        return parent[a]


def is_same(a, b):
    return root(a) == root(b)


def unite(a, b):
    # print('before:',end='')
    # print(parent)
    ra = root(a)
    rb = root(b)
    # print(ra, rb, sep='|')
    if ra == rb:
        return
    parent[ra] = rb
# print('after:',end='')
# print(parent)


n, m = map(int, input().split())
grid = []

for i in range(m):
    x, y = map(int, input().split())
    x, y = x - 1, y - 1
    grid.append((x, y))
    # grid[y][x] = 1

# print(grid)

ans = 0
for i in range(m):
    # print('-----------------------')
    parent = [k for k in range(n)]
    # print(parent)

    for j, e in enumerate(grid):
        # print(j, e, sep='#')
        if j == i:
            continue
        a, b = e
        unite(a, b)

    # print(grid[i], parent, sep='=')
    a, b = grid[i]
    if not is_same(a, b):
        # print(parent)
        ans += 1
    # print(parent)

print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define sim template < class c
#define ris return *this
#define dor > debug & operator <<
#define eni(x) sim > typename \
	enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
	ris << "(" << d.first << ", ", d.second << ")";
}
sim dor(rge<c> d) {
	*this << "[";
	for (auto it = d.b; it != d.e; it++)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

const ll mod = 1e9 + 7;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int H, W;
	cin >> H >> W;
	vector<vector<char>> a(H, vector<char> (W));
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cin >> a[i][j];
		}
	}
	vector<vector<ll>> dp(H, vector<ll> (W, 0));
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (i == 0 && j == 0) {
				dp[i][j] = 1;
				continue;
			}
			if (a[i][j] == '.') {
				if (i - 1 >= 0 && a[i - 1][j] == '.') {
					dp[i][j] = (dp[i][j] + dp[i - 1][j]) % mod;
				}
				if (j - 1 >= 0 && a[i][j - 1] == '.') {
					dp[i][j] = (dp[i][j] + dp[i][j - 1]) % mod;
				}
			}
		}
	}
	cout << dp[H - 1][W - 1];
				
	
	return 0;
}


Measured memory_bytes: 9088
import java.io.PrintWriter;
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		PrintWriter pr = new PrintWriter(System.out);
		while(true){
			int X = 10;
			int Y = 10;
			int[][] map = new int[21][21]; 
			int N = sc.nextInt();
			if(N==0) break;
			for(int s=0;s<N;s++){
				map[sc.nextInt()][sc.nextInt()]=1;;
			}
			int M = sc.nextInt();
			for(int s=0;s<M;s++){
				String tmp = sc.next();
				int d = sc.nextInt();
				for(int k=1;k<=d;k++){
					if(tmp.equals("N")){
						Y++;
					}else if(tmp.equals("E")){
						X++;
					}else if(tmp.equals("S")){
						Y--;
					}else if(tmp.equals("W")){
						X--;
					}
					map[X][Y] = 0;
				}
			}
			boolean e = true;
			for(int x=0;x<21;x++){
				for(int y=0;y<21;y++){
					if(map[x][y]!=0){
						e = false;
					}
				}
			}
			if(e){
				pr.println("Yes");
			}else{
				pr.println("No");
			}
		}
		pr.flush();
		sc.close();
	}
}

Measured memory_bytes: 42684
input = require('fs').readFileSync('/dev/stdin', 'utf8')
lines = input.split('\n')
N = lines.shift() * 1
ans = Math.floor(N / 11) * 2
m = N % 11
if (m == 0) {
} else if (m <= 6) {
    ans += 1
} else {
    ans += 2
} 
console.log(ans)

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

using namespace std;

int main(){
  int N;
  long long K;
  cin >> N >> K;
  
  vector<int> A(N);
  for(int i = 0; i < N; i++){
    cin >> A[i];
    --A[i];
  }
  
  vector<int> B(N);
  for(int i = 0; i < N; i++) B[i] = i;
  
  while(K){
    if(K & 1ll){
      for(int i = 0; i < N; i++){
        B[i] = A[B[i]];
      }
    }
    
    vector<int> C(N);
    for(int i = 0; i < N; i++){
      C[i] = A[A[i]];
    }
    A = C;
    K >>= 1;
  }
  
  cout << B[0] + 1 << endl;
  
  return 0;
}

Measured memory_bytes: 5580
# -*- coding: utf-8 -*-
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    A, P = i2nn()
    n = A * 3 + P
    print(n // 2)

main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;
//inline int in() { int x; scanf("%d",&x); return x;}
inline ll in() { ll x; cin >> x; return x; }
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
const int MX = 200005;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
map<ll, ll> prime_factor(ll n) {
  map<ll, ll> ret;
  for(ll i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if (n != 1) ret[n] = 1;
  return ret;
}

vector<int> to[2505];
vector<int> rto[2505];
bool reachablefrom1[2505];
bool reachableToN[2505];
bool ok[2505];

void dfs(int v) {
  if (reachablefrom1[v]) return;
  reachablefrom1[v] = true;
  for (int u : to[v]) {
    dfs(u);
  }
}
void rdfs(int v) {
  if (reachableToN[v]) return;
  reachableToN[v] = true;
  for (int u : rto[v]) {
    rdfs(u);
  }
}

int main() {
  ll n = in();
  vl d(n); cin >> d;
  ll ans = 0;
  for (int i = 0; i < n - 1; i++)
    for (int j = i + 1; j < n; j++)
      ans += d[i] * d[j];
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 384
//2019/9/28

#include <stdio.h>

int main (void) {
    int num,mat[2][100002],i,j;
    scanf("%d",&num);
    for (i=0;i<num;i++) {
        scanf("%d",&mat[0][i]);
        mat[1][mat[0][i]-1]=i+1;
    }
    for (i=0;i<num;i++) {
        if (i!=num-1) {
            printf("%d ",mat[1][i]);
        }
        else {
            printf("%d\n",mat[1][i]);
        }    
    }    
    return 0;
}

Measured memory_bytes: 1536
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
    int ichi=0;
    int ni=0;
    int san=0;
    int yon=0;
    for(int i=0;i<3;i++){
        int a,b;
        cin>>a>>b;
        if(a==1||b==1){
            ichi++;
        }
        if(a==2||b==2){
            ni++;
        }
        if(a==3||b==3){
            san++;
        }
        if(a==4||b==4){
            yon++;
        }
    }
    if(max({ichi,ni,san,yon})==2){
        cout<<"YES"<<endl;
    }
    else{
        cout<<"NO"<<endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N, K, C;
  cin>>N>>K>>C;
  string S;
  cin>>S;
  vector<int> arr1, arr2;
  map<int, int> amap;
  for(int i=0;i<S.size();++i) {
    if(S[i]=='o') {
      arr1.push_back(i);
      i += C;
    }
  }

  for(int i=S.size()-1;i>=0;--i) {
    if(S[i]=='o') {
      arr2.push_back(i);
      i -= C;
    }
  }
  reverse(arr2.begin(), arr2.end());
  vector<int> ans;
  for(int i=0;i<min(arr1.size(), arr2.size());++i) {
    if(arr1[i]==arr2[i]) ans.push_back(arr1[i]);
  }
  if(ans.size()>K) return 0;
  for(int i=0;i<ans.size();++i) cout<<ans[i]+1<<endl;
}



Measured memory_bytes: 6516
#include <bits/stdc++.h>
template<class T> inline bool chmin(T&a, T b){if(a > b){a = b; return true;}else{return false;}}
template<class T> inline bool chmax(T&a, T b){if(a < b){a = b; return true;}else{return false;}}
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1.0)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int main() {
    int x;
    cin >> x;
    cout << (x < 1200 ? "ABC" : "ARC") << endl;
}


Measured memory_bytes: 3564
#include <stdio.h>
typedef long long int ll;
constexpr int kN = int(2E5 + 10);
 
ll x[kN], y[kN];
 
int main() {
	int n, ans = 0;
	ll d;
	scanf("%d%lld", &n, &d);
	d *= d;
	for (int i = 1; i <= n; i++) scanf("%lld%lld", &x[i], &y[i]);
	for (int i = 1; i <= n; i++) if (x[i] * x[i] + y[i] * y[i] <= d) ans++;
	printf("%d\n", ans);
	
}

Measured memory_bytes: 4840
#!/usr/bin/env python
# -*- coding: utf-8 -*-

while True:
    N,K = map(int,input().split())
    A = sorted([int(input()) for i in range(0,K)])

    if (N,K) == (0,0):
        break

    if A[0] == 0:
        flag = True
        A = A[1:]
        K -= 1
    else:
        flag = False

    ans = 0
    count = 0
    diff_list = []
    s = 0
    for i in range(1,K):
        if A[i] - A[i-1] == 2:
            diff_list.append(A[i-1] - A[s])
            s = i
            count = 0
        elif A[i] - A[i-1] > 2:
            diff_list.append(A[i-1] - A[s])
            diff_list.append(0)
            s = i
            count = 0
        else:
            count += 1
            ans = max(ans,count)
    else:
        diff_list.append(A[i] - A[s])

    if flag is True:
        ans = 0
        for i in range(1,len(diff_list)):
            ans = max(ans,diff_list[i] + diff_list[i-1] + 2)

    print(ans + 1)

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;

#define forn(i, n) for (int i = 0; i < n; ++i)
#define rforn(i, n) for (int i = n - 1; i >= 0; --i)
#define pb push_back
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"

const unsigned int M = 1e9+7; 
const char nl = '\n';

// void generator(ll t)
// {
//     srand((unsigned) time(0));
//     while(t--)
//     {   
//         ll input=rand()%1000+1 ;
//         cout<<"input : "<<input<<" : ";
//         ll ans=solve(input);
//         ll ans1=naive(input);
//         if(ans==ans1)  cout<<ans<<": OK\n";
//         else
//         {
//             cout<<ans1<<" : "<<ans<<" : Error\n";
//             break;
//         }   
//     }
// }

int main()
{
    #ifndef ONLINE_JUDGE
  	    freopen("in.txt", "r", stdin);
   	    freopen("out.txt", "w", stdout);
   	    freopen("err.txt", "w", stderr);
    #endif
    // auto start = chrono::high_resolution_clock::now();
    // generator(10000);   
    // auto stop =chrono::high_resolution_clock::now();
    // auto duration =chrono::duration_cast<chrono::microseconds>(stop - start);
    // cout << "Time taken by function: "<< duration.count() << " microseconds" << endl; 
	
	IOS
    ll t=1;
    //cin>>t;
    while(t--)
    {
      string a,b;
      cin>>a>>b;
      ll ans=0;
      for(ll i=0;i<a.length();++i)
     	if(a[i]!=b[i]) ans++;
      cout<<ans;
    }
    
    return 0;
}


Measured memory_bytes: 3812
#include <iostream>
#include <vector>
#include <climits>

using namespace std;

const int kSize = 100001;

vector<int> V;

struct Node {
    int to;
    int weight;

    Node(int _to, int _weight) {
        to = _to;
        weight = _weight;
    }
};

int n;
vector<Node> adj[kSize];
bool isMarked[kSize];
int tree[kSize];
int ans = 0;

pair<int,int> GetMinWeight(int v) {
    int ans = INT_MAX;
    int vertex = -1;
    for (int i = 0; i < adj[v].size(); ++i) {
        int u = adj[v][i].to;
        if (!isMarked[u]) {
            //ans = min(ans, adj[v][i].weight);
            //vertex = u;
            if (adj[v][i].weight <= ans) {
                ans = adj[v][i].weight;
                vertex = u;
            }
        }
    }

    ans = ans == INT_MAX ? -1 : ans;
    return make_pair(ans, vertex);
}

int GetMinVertex() {
    int v = -1;
    int min = INT_MAX;
    for (int i = 0; i < V.size(); ++i) {
        pair<int, int> p = GetMinWeight(V[i]);
        int weight = p.first;
        if (weight != -1 && weight <= min) {
            min = weight;
            v = p.second;
        }
    }

    ans += min;
    return v;
}

int Prime() {
    V.push_back(1);
    isMarked[1] = true;

    while (V.size() < n) {
        int v = GetMinVertex();
        //cout << v << endl;
        V.push_back(v);
        isMarked[v] = true;
    }
}

int main() {
    fill(isMarked, isMarked + kSize, false);
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= n; ++j) {
            int weight;
            cin >> weight;
            if (weight != -1) {
                adj[i].emplace_back(j, weight);
            }
        }
    }

    Prime();
    cout << ans << endl;
}


Measured memory_bytes: 5620
#include <stdio.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)

int a,b,k,cnt;
int main(){
	scanf("%d%d%d",&a,&b,&k);
	for(int i=100;;i--)if(a%i==0&&b%i==0){
		cnt++;
		if(cnt==k){
			printf("%d",i);
			return 0;
		}
	}
}

Measured memory_bytes: 128
h,w = map(int,input().split())
A = [list(map(str,input())) for i in range(h)]
for k in range(max(h,w)):
    counter = 0
    for i in range(h):
        if '#' not in A[i-counter]:
            del(A[i-counter:i-counter+1])
            counter += 1
            h -= 1
        if i-counter >= h-1:
            break
    counter = 0
    B = [list(row) for row in zip(*A)]
    for j in range(w):
        if '#' not in B[j-counter]:
            del(B[j-counter:j-counter+1])
            counter += 1
            w -= 1
        if j-counter >= w-1:
            break
    A = [list(row) for row in zip(*B)]
for row in A:
    print(*row, sep='')

Measured memory_bytes: 4724
# -*- coding: utf-8 -*-
time = []
for i in range(5):
    time.append(int(input()))


def tkey(x):
    rem = x % 10
    return 0 if rem == 0 else 10 - rem


time.sort(key=tkey)

ans = 0
for i in range(len(time)):
    if i != 4 and time[i] % 10 != 0:
        time[i] = 10 * (time[i] // 10 + 1)
    ans += time[i]

print(ans)


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

int main() {
  int h, n, a, tmp;
  cin >> h >> n;
  a = 0;
  for (int i=0; i<n; i++) {
    cin >> tmp;
    a += tmp;
  }
  if (a>=h) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define ll int64_t
#define _GLIBCXX_DEBUG
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
//約数列挙(√N)
vector< int64_t > divisor(int64_t n) {
  vector< int64_t > ret;
  for(int64_t i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}
//素因数分解(√N)
map< int64_t, int > prime_factor(int64_t n) {
  map< int64_t, int > ret;
  for(int64_t i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}
//素数テーブル(NloglogN)
vector< bool > prime_table(int n) {
  vector< bool > prime(n + 1, true);
  if(n >= 0) prime[0] = false;
  if(n >= 1) prime[1] = false;
  for(int i = 2; i * i <= n; i++) {
    if(!prime[i]) continue;
    for(int j = i + i; j <= n; j += i) {
      prime[j] = false;
    }
  }
  return prime;
}
//二項係数(K)
template< typename T >
T binomial(int64_t N, int64_t K) {
  if(K < 0 || N < K) return 0;
  T ret = 1;
  for(T i = 1; i <= K; ++i) {
    ret *= N--;
    ret /= i;
  }
  return ret;
}
//二項係数テーブル(N^2)
template< typename T >
vector< vector< T > > binomial_table(int N) {
  vector< vector< T > > mat(N + 1, vector< T >(N + 1));
  for(int i = 0; i <= N; i++) {
    for(int j = 0; j <= i; j++) {
      if(j == 0 || j == i) mat[i][j] = 1;
      else mat[i][j] = mat[i - 1][j - 1] + mat[i - 1][j];
    }
  }
  return mat;
}
//unionfind
struct UnionFind {
  vector< int > data;
 
  UnionFind(int sz) {
    data.assign(sz, -1);
  }
 
  bool unite(int x, int y) {
    x = find(x), y = find(y);
    if(x == y) return (false);
    if(data[x] > data[y]) swap(x, y);
    data[x] += data[y];
    data[y] = x;
    return (true);
  }
 
  int find(int k) {
    if(data[k] < 0) return (k);
    return (data[k] = find(data[k]));
  }
 
  int size(int k) {
    return (-data[find(k)]);
  }
};

int main(){
  int x;
  cin >> x;
  cout << 10-x/200 << endl;
}

Measured memory_bytes: 3628
n,K=map(int,input().split())
A=list(map(int,input().split()))
F=list(map(int,input().split()))
A.sort(reverse=True)
F.sort()
ng=-1
ok=10**18+1
while ok-ng>1:
             mid=(ng+ok)//2
             k=K
             for a,f in zip(A,F):
                     k-=max(0,a-mid//f)
             if k<0:
                 ng=mid
             else:
                ok=mid
print(ok)

Measured memory_bytes: 119500
/*
	Name:
	Author: xiaruize
	Date:
*/
#pragma GCC optimize(2)
#include<algorithm>
#include<bitset>
#include<cctype>
#include<cerrno>
#include<clocale>
#include<cmath>
#include<complex>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<utility>
#include<vector>
#include<cwchar>
#include<cwctype>
using namespace std;
#define ull unsigned long long
#define MOD 1000000007
#define ALL(a) (a).begin(), (a).end()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define ll long long
#define form(i,j,n) for(int i=int(j);i<=int(n);i++)
#define pb push_back
#define mk make_pair
#define pii pair<int,int>
#define pis pair<int,string>
#define sec second
#define sz(a) int((a).size())

inline int read()
{
    char ch=getchar();
    int x=0,f=1;
    while(ch<'0'||ch>'9'){if(ch=='-') f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9') x=x*10+(ch^48),ch=getchar();
    return x*f;
}

int main()
{
 	ios::sync_with_stdio(false);
	cin.tie(0);
 	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int n;
	cin>>n;
	int a[n],b[n];
	for(int i=0;i<n;i++)
	{
		cin>>a[i]>>b[i];
	}
	sort(a,a+n);
	sort(b,b+n);
	if(n%2==0)
	{
		cout<<b[n/2]+b[n/2-1]\
		-(a[n/2]+a[n/2-1])+1<<endl;
	}
	else
	{
		cout<<b[n/2]-a[n/2]+1;
	}
	return 0;
}


Measured memory_bytes: 5184
import * as fs from 'fs';

const [a, b]: number[] = fs.readFileSync('/dev/stdin', 'utf8').trim().split(' ').map(Number);

if (a % 3 === 0) {
    console.log('Possible');
} else if (b % 3 === 0) {
    console.log('Possible');
} else if ((a + b) % 3 === 0) {
    console.log('Possible');
} else {
    console.log('Impossible');
}


Measured memory_bytes: 7372
#include<cstdio>
#include<math.h>
 
int main(){
	double a,b,c,d;
	scanf("%lf %lf %lf %lf", &a, &b, &c, &d);
	printf("%f\n", sqrt((c - a) * (c - a) + (d - b) * (d -b)));
	return 0;
}
	

Measured memory_bytes: 1080